open (STDOUT, ">output/$log.out");
open (STDERR, ">output/$log.err");
}
- exec ($command);
+ chdir $options{CHDIR} or die "$options{CHDIR}: chdir: $!\n"
+ if defined ($options{CHDIR});
+ if (!defined ($options{EXEC})) {
+ exec ($command);
+ } else {
+ exec (@{$options{EXEC}});
+ }
exit (-1);
}
waitpid ($pid, 0);
sub run_pintos {
my ($cmd_line, %args) = @_;
- my ($retval) = xsystem ($cmd_line, %args);
+ unshift (@$cmd_line, 'pintos');
+ my ($retval) = xsystem (join (' ', @$cmd_line), %args, EXEC => $cmd_line);
return 'ok' if $retval eq 'ok';
- 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;
+ }
return 'Error running Bochs' if $retval eq 'error';
die;
}
sub grade_test {
# Read test output.
my ($outfile) = "output/$test/run.out";
- die "$outfile: missing test output file (make failed?)" if ! -e $outfile;
+ 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.";
+ }
+ die "$outfile: missing test output file";
+ }
my (@output) = snarf ($outfile);
# If there's a function "grade_$test", use it to evaluate the output.