DIE => "failed to create swap disk");
# Format disk, install test.
- my ($pintos_base_cmd) =
- "pintos "
- . "--os-disk=pintos/src/$hw/build/os.dsk "
- . "--fs-disk=output/$test/fs.dsk "
- . "--swap-disk=output/$test/swap.dsk "
- . "-v";
- $result = run_pintos ("$pintos_base_cmd put -f $GRADES_DIR/$test $test",
+ my (@base_opts) = ("--os-disk=pintos/src/$hw/build/os.dsk",
+ "--fs-disk=output/$test/fs.dsk",
+ "--swap-disk=output/$test/swap.dsk",
+ "-v");
+ $result = run_pintos ([@base_opts,
+ "put", "-f", "$GRADES_DIR/$test", $test],
LOG => "$test/put", TIMEOUT => 60);
return $result if $result ne 'ok';
push (@extra_files, "child-syn-wrt") if $test eq 'syn-write';
push (@extra_files, "child-syn-rw") if $test eq 'syn-rw';
for my $fn (@extra_files) {
- $result = run_pintos ("$pintos_base_cmd put $GRADES_DIR/$fn $fn",
+ $result = run_pintos ([@base_opts, "put", "$GRADES_DIR/$fn", $fn],
LOG => "$test/put-$fn", TIMEOUT => 60);
return "Error running `put $fn': $result" if $result ne 'ok';
}
# Run.
- return run_pintos ("$pintos_base_cmd run -q -ex \"$test\"",
+ return run_pintos ([@base_opts, "run", "-q", "-ex", $test],
LOG => "$test/run", TIMEOUT => 120);
}
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';
if ($retval eq 'timeout') {
my ($msg) = "Timed out after $args{TIMEOUT} seconds";
# Run.
my ($timeout) = $test !~ /^mlfqs/ ? 10 : 600;
- return run_pintos ("cd pintos/src/threads/build && pintos -v run -q",
+ return run_pintos (["-v", "run", "-q"],
+ CHDIR => "pintos/src/threads/build",
LOG => "$test/run",
TIMEOUT => $timeout);
}
# Run.
my ($timeout) = $test !~ /^multi-/ ? 10 : 600;
- my ($result) = run_pintos ("pintos "
- . "--os-disk=pintos/src/userprog/build/os.dsk "
- . "--fs-disk=output/$test/fs.dsk "
- . "-v run -q -ex \"$test$args\"",
+ my ($result) = run_pintos (["--os-disk=pintos/src/userprog/build/os.dsk",
+ "--fs-disk=output/$test/fs.dsk",
+ "-v", "run", "-q", "-ex", "$test$args"],
LOG => "$test/run",
TIMEOUT => $timeout);
rename "output/$test/fs.dsk", "output/$test/fs.dsk.keep"
sub get_file {
my ($guest_fn, $host_fn) = @_;
- my ($result) = run_pintos ("pintos "
- . "--os-disk=pintos/src/userprog/build/os.dsk "
- . "--fs-disk=output/$test/fs.dsk.keep "
- . "-v get $guest_fn $host_fn",
+ my ($result) = run_pintos (["--os-disk=pintos/src/userprog/build/os.dsk",
+ "--fs-disk=output/$test/fs.dsk.keep",
+ "-v", "get", "$guest_fn", "$host_fn"],
LOG => "$test/get-$guest_fn",
TIMEOUT => 10);
die "`pintos get $guest_fn' failed - $result\n"
DIE => "failed to create swap disk");
# Run.
- return run_pintos ("pintos "
- . "--os-disk=pintos/src/vm/build/os.dsk "
- . "--fs-disk=output/$test/fs.dsk "
- . "--swap-disk=output/$test/swap.dsk "
- . "-v run -q -ex \"$test\"",
+ return run_pintos (["--os-disk=pintos/src/vm/build/os.dsk",
+ "--fs-disk=output/$test/fs.dsk",
+ "--swap-disk=output/$test/swap.dsk",
+ "-v", "run", "-q", "-ex", "$test"],
LOG => "$test/run",
TIMEOUT => 600);
}