GetOptions ("v|verbose+" => \$verbose,
"h|help" => sub { usage (0) },
GetOptions ("v|verbose+" => \$verbose,
"h|help" => sub { usage (0) },
"c|clean" => sub { set_action ('clean'); },
"x|extract" => sub { set_action ('extract'); },
"b|build" => sub { set_action ('build'); },
"t|test" => sub { set_action ('test'); },
"a|assemble" => sub { set_action ('assemble'); })
or die "Malformed command line; use --help for help.\n";
"c|clean" => sub { set_action ('clean'); },
"x|extract" => sub { set_action ('extract'); },
"b|build" => sub { set_action ('build'); },
"t|test" => sub { set_action ('test'); },
"a|assemble" => sub { set_action ('assemble'); })
or die "Malformed command line; use --help for help.\n";
if @ARGV > 0;
@TESTS = split(/,/, join (',', @TESTS)) if defined @TESTS;
if (!defined $action) {
$action = -e 'review.txt' ? 'assemble' : 'test';
}
if @ARGV > 0;
@TESTS = split(/,/, join (',', @TESTS)) if defined @TESTS;
if (!defined $action) {
$action = -e 'review.txt' ? 'assemble' : 'test';
}
+
+ my (@default_tests) = @_;
+ @TESTS = @default_tests;
+ @TESTS = grep (/$do_regex/, @TESTS) if defined $do_regex;
+ @TESTS = grep (!/$no_regex/, @TESTS) if defined $no_regex;
- -T, --tests=TESTS Run only the specified comma-separated tests.
+ -d, --do-tests=RE Run only tests that match the given regular expression.
+ -n, --no-tests=RE Do not run tests that match the given regular expression.
-x, --extract Stop after step 1.
-b, --build Stop after step 2.
-t, --test Stop after step 3 (default if "review.txt" not present).
-x, --extract Stop after step 1.
-b, --build Stop after step 2.
-t, --test Stop after step 3 (default if "review.txt" not present).
# applies any patches providing in the grading directory,
# and installs a default pintos/src/constants.h
sub extract_sources {
# applies any patches providing in the grading directory,
# and installs a default pintos/src/constants.h
sub extract_sources {
open (STDOUT, ">output/$log.out");
open (STDERR, ">output/$log.err");
}
open (STDOUT, ">output/$log.out");
open (STDERR, ">output/$log.err");
}
- $args{EXPECT} = 1 unless defined $args{EXPECT};
- my ($retval) = xsystem ($cmd_line, %args);
+ unshift (@$cmd_line, 'pintos');
+ my ($retval) = xsystem (join (' ', @$cmd_line), %args, EXEC => $cmd_line);
- return "Timed out after $args{TIMEOUT} seconds" if $retval eq 'timeout';
+ if ($retval eq 'timeout') {
+ my ($msg) = "Timed out after $args{TIMEOUT} seconds";
+ my ($load_avg) = `uptime` =~ /(load average:.*)$/i;
+ $msg .= " - $load_avg" if defined $load_avg;
+ return $msg;
+ }
- my (@output) = snarf ("output/$test/run.out");
+ my ($outfile) = "output/$test/run.out";
+ if (! -e $outfile) {
+ if (-s "output/$test/make.err") {
+ # make failed.
+ $details{$test} = snarf ("output/$test/make.err");
+ return "make failed. Error messages at end of file.";
+ }
+ return "preparation for test failed";
+ }
+ my (@output) = snarf ($outfile);
# If there's a function "grade_$test", use it to evaluate the output.
# If there's a file "$GRADES_DIR/$test.exp", compare its contents
# If there's a function "grade_$test", use it to evaluate the output.
# If there's a file "$GRADES_DIR/$test.exp", compare its contents