Skip to content

Commit

Permalink
make the scripts running parallel tests on emulab machines
Browse files Browse the repository at this point in the history
  • Loading branch information
Xuejun Yang committed Aug 6, 2011
1 parent 052f6fb commit eb4f5e2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
19 changes: 9 additions & 10 deletions utah/scripts/jxyang/parallel_test.pl
@@ -1,21 +1,20 @@
#!/usr/bin/perl -w
use strict;
use warnings;
#use Sys::CPU;
use strict;
use warnings;

sub usage () {
die "usage: parallel_test.pl <config-file> <csmith-option>\n";
die "usage: parallel_test.pl <parallel_runs> <config-file> <csmith-option>\n";
}

my $CPUS = 2; #Sys::CPU::cpu_count();

if (scalar (@ARGV) != 2 || !(-e $ARGV[0]) ) {
if (scalar (@ARGV) != 3 || $ARGV[0] < 2 || !(-e $ARGV[1])) {
usage();
}
print "looks like we have $CPUS cpus\n";

my $CONFIG_FILE = $ARGV[0];
my $CSMITH_OPTION = $ARGV[1];
my $CPUS = $ARGV[0];
print "running on $CPUS cpus\n";

my $CONFIG_FILE = $ARGV[1];
my $CSMITH_OPTION = $ARGV[2];
my @ALT_OPTIONS = ();

if ($CSMITH_OPTION =~ /--no-(.*)/) {
Expand Down
29 changes: 15 additions & 14 deletions utah/scripts/jxyang/test.pl
Expand Up @@ -48,7 +48,8 @@
my $PROG_TIMEOUT = 8;

# extra options here
my $CSMITH_USER_OPTIONS = " --bitfields --packed-struct";
my $CSMITH_USER_OPTIONS = " --bitfields --packed-struct";
my $CSMITH_EXTRA_OPTIONS = "";

################# end user-configurable stuff ###################

Expand Down Expand Up @@ -225,7 +226,7 @@ ($)
# run Csmith until generate a big enough program
while (1) {
unlink $cfile;
my $cmd = "$CSMITH_HOME/src/csmith $CSMITH_USER_OPTIONS --output $cfile";
my $cmd = "$CSMITH_HOME/src/csmith $CSMITH_USER_OPTIONS $CSMITH_EXTRA_OPTIONS --output $cfile";
my ($res, $exitcode) = runit($cmd, $CSMITH_TIMEOUT, "csmith.out");
# print "after run csmith: $res, $exitcode\n";

Expand Down Expand Up @@ -297,7 +298,7 @@ ()
$RUN_PROGRAM = 1;
}
} else {
usage();
$CSMITH_EXTRA_OPTIONS = $ARGV[2];
}
} else {
usage();
Expand All @@ -306,28 +307,21 @@ ()
my $cnt = $ARGV[0];
usage() unless ($cnt =~ /^[0-9]+$/ && $cnt >= 0);

my ($second0, $minute0, $hour0, $dayOfMonth, $month) = localtime();
$month++;
print "start time: $month/$dayOfMonth $hour0:$minute0\n";
my ($second0, $minute0, $hour0, $dayOfMonth0, $month0) = localtime();
$month0++;
print "start time: $month0/$dayOfMonth0 $hour0:$minute0\n";

# figure out what compilers to test
my $infile = $ARGV[1];
open INF, "<$infile" or die "Cannot read configuration file ${infile}.\n";
while (my $line = <INF>) {
chomp $line;
$line =~ s/\r?\n?$//; # get rid of LF/CR
if ($line && !($line =~ /^\s*#/)) {
my $res = system ("echo \"int main() { return 0;}\" > foo.c ; $line foo.c > /dev/null 2>&1");
unlink "foo.c", "a.out";
die "cannot execute compiler $line\n" if ($res);
push @COMPILERS, $line;
}

# print out time once per day
my ($second, $minute, $hour, $dayOfMonth, $month) = localtime();
if ($hour == $hour0 && $minute == $minute0 && $second == $second0) {
$month++;
print "current time: $month/$dayOfMonth $hour:$minute";
}
}
close INF;

Expand All @@ -338,6 +332,13 @@ ()
$i++;
}
print "\n";
# print out time once per day
my ($second, $minute, $hour, $dayOfMonth, $month) = localtime();
if ($hour == $hour0 && $minute == $minute0 && $second == $second0 && $dayOfMonth != $dayOfMonth0) {
$month++;
$dayOfMonth0 = $dayOfMonth;
print "current time: $month/$dayOfMonth $hour:$minute\n";
}
}

print "Total csmith errors found: $csmith_bug\n";
Expand Down

0 comments on commit eb4f5e2

Please sign in to comment.