From 08e7cc841692b7d4483eceebc725a56d637f36a4 Mon Sep 17 00:00:00 2001 From: John Regehr Date: Wed, 10 Aug 2011 14:59:06 -0600 Subject: [PATCH] Add support for swarm testing, see: http://www.cs.cmu.edu/~agroce/tse11.pdf --- utah/scripts/john_driver/launchn.pl | 3 ++- utah/scripts/john_driver/random_test.pl | 36 +++++++++++++++++++++---- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/utah/scripts/john_driver/launchn.pl b/utah/scripts/john_driver/launchn.pl index eb0f98dc8..637dca25e 100755 --- a/utah/scripts/john_driver/launchn.pl +++ b/utah/scripts/john_driver/launchn.pl @@ -38,9 +38,10 @@ () system "nohup random_test_llvm_killer.pl > llvm_killer.log 2>&1 &"; +system "rm -rf work*"; + for (my $i=0; $i<$CPUS; $i++) { my $dir = "work$i"; - system "rm -rf $dir"; system "mkdir $dir"; system "env RVDEBUG_HOME=/home/regehr/z/tmp/arm_tmp$i nice -19 nohup random_test.pl $dir $SEEDFILE > $dir/output.txt 2>&1 &"; } diff --git a/utah/scripts/john_driver/random_test.pl b/utah/scripts/john_driver/random_test.pl index 63b8e10f7..b181ddc00 100755 --- a/utah/scripts/john_driver/random_test.pl +++ b/utah/scripts/john_driver/random_test.pl @@ -8,6 +8,9 @@ ################################################################## +my $USE_SWARM = 1; +my $SWARM_FILE = "2.1.0x1000.configs"; + my $SAVE_BADS = 0; my $MIN_PROGRAM_SIZE = 30000; @@ -43,10 +46,9 @@ my $platform = "x86_64"; # remove the comment below to enable ccomp test -my $CSMITH_CCOMP = "--bitfields --no-math64 --no-volatiles --ccomp"; +#my $CSMITH_CCOMP = "--bitfields --no-math64 --no-volatiles --ccomp"; # my $CSMITH_CCOMP = "$BF --quiet --enable-volatile-tests x86 --vol-addr-file $PINTOOL_VOL_ADDR --no-math64 --ccomp --max-array-dim 3 --max-array-len-per-dim 5 --max-struct-fields 5 --math-notmp"; - -#my $CSMITH_CCOMP = ""; +my $CSMITH_CCOMP = ""; # set up pintool for volatile testing my $use_pintool = 0; @@ -98,6 +100,19 @@ ($) return $exit_value; } +my @swarm; + +sub read_swarm_file () { + open INF, "<$CSMITH_HOME/utah/scripts/john_driver/$SWARM_FILE" or die; + while (my $line = ) { + chomp $line; + push @swarm, $line; + } + close INF; + my $n = scalar (@swarm); + print "read $n swarm configurations\n"; +} + sub doit ($$) { (my $n, my $work) = @_; print "------ RANDOM PROGRAM $n ------\n"; @@ -133,12 +148,19 @@ ($$) $SEED = "-s $1 --max-block-size $2 --max-funcs $3"; } + my $SWARM_OPTS = ""; + if ($USE_SWARM) { + my $nopts = scalar (@swarm); + my $idx = $good % $nopts; + $SWARM_OPTS = $swarm[$idx]; + } + my $cmd; if ($CSMITH_CCOMP eq "") { - $cmd = "$CSMITH_HOME/src/csmith $SEED $PACK $XTRA --output $cfile"; + $cmd = "$CSMITH_HOME/src/csmith $SEED $SWARM_OPTS $PACK $XTRA --output $cfile"; } else { - $cmd = "$CSMITH_HOME/src/csmith $SEED $CSMITH_CCOMP $XTRA --output $cfile"; + $cmd = "$CSMITH_HOME/src/csmith $SEED $SWARM_OPTS $CSMITH_CCOMP $XTRA --output $cfile"; } if ($PROVIDE_SEED) { print "$cmd\n"; @@ -247,6 +269,10 @@ ($$) $TIMED_TEST = 0; } +if ($USE_SWARM) { + read_swarm_file(); +} + my $i = 0; while (1) { doit ($i, $work);