Skip to content

Commit

Permalink
Add support for swarm testing, see:
Browse files Browse the repository at this point in the history
  • Loading branch information
regehr committed Aug 10, 2011
1 parent 2824b30 commit 08e7cc8
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 6 deletions.
3 changes: 2 additions & 1 deletion utah/scripts/john_driver/launchn.pl
Expand Up @@ -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 &";
}
Expand Down
36 changes: 31 additions & 5 deletions utah/scripts/john_driver/random_test.pl
Expand Up @@ -8,6 +8,9 @@

##################################################################

my $USE_SWARM = 1;
my $SWARM_FILE = "2.1.0x1000.configs";

my $SAVE_BADS = 0;

my $MIN_PROGRAM_SIZE = 30000;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 = <INF>) {
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";
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -247,6 +269,10 @@ ($$)
$TIMED_TEST = 0;
}

if ($USE_SWARM) {
read_swarm_file();
}

my $i = 0;
while (1) {
doit ($i, $work);
Expand Down

0 comments on commit 08e7cc8

Please sign in to comment.