. "--swap-disk=output/$test/swap.dsk "
. "-v run -q -ex \"$test$testargs\"",
LOG => "$test/run",
- TIMEOUT => $timeout)
+ TIMEOUT => $timeout,
+ EXPECT => 1)
or return "Bochs error";
return "ok";
die "fork: $!\n" if !defined $pid;
if (!$pid) {
if (defined $log) {
- close STDOUT;
open (STDOUT, ">output/$log.out");
- close STDERR;
open (STDERR, ">output/$log.err");
}
exec ($command);
if ($@) {
die unless $@ eq "alarm\n"; # propagate unexpected errors
print "Timed out $pid.\n";
- print "not killed\n" if !kill ('SIGTERM', $pid);
+ kill ('SIGTERM', $pid);
$status = 0;
}
print "Child terminated with signal $signal\n";
}
- unlink ("output/$log.err") if defined ($log) && $status == 0;
+ my ($expected_exit) = !defined ($options{EXPECT}) ? 0 : $options{EXPECT};
+ my ($ok) = WIFEXITED ($status) && WEXITSTATUS ($status) == $expected_exit;
+
+ unlink ("output/$log.err") if defined ($log) && $ok;
die $options{DIE} if $status != 0 && defined $options{DIE};
- return $status == 0;
+ return $ok;
}
sub snarf {
my (@cmd) = ($bin, '-q');
push (@cmd, '-j', $jitter) if defined $jitter;
- print join (' ', @_), "\n";
- exec (@_);
+ print join (' ', @cmd), "\n";
+ exec (@cmd);
} elsif ($sim eq 'qemu') {
print "warning: qemu doesn't support --terminal\n"
if $vga eq 'terminal';