X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=grading%2Fuserprog%2Fprep-disk;h=f1b766c8614ebebf16d53dc32299d7f8d27bf091;hb=3a7af748932b8be7c90331f9b322bbaa6e5feb3e;hp=2a5a9f118db518708ab863e54e09947c85d91cdd;hpb=2e2f580dd9eb1a8fa094e35f4b967e2547774d9c;p=pintos-anon diff --git a/grading/userprog/prep-disk b/grading/userprog/prep-disk index 2a5a9f1..f1b766c 100755 --- a/grading/userprog/prep-disk +++ b/grading/userprog/prep-disk @@ -2,6 +2,7 @@ use strict; use Getopt::Long; +use POSIX; my ($pintos) = "pintos"; my ($os_disk) = "../../src/userprog/build/os.dsk"; @@ -33,27 +34,34 @@ if (! -e $os_disk) { our ($formatted) = 0; unlink $fs_disk; -xsystem ("$pintos make-disk '$fs_disk' 2"); +xsystem (0, "$pintos make-disk '$fs_disk' 2"); put_file ("$test"); put_file ("sample.txt") if grep ($_ eq $test, qw (open-normal open-boundary open-twice close-normal close-twice read-normal read-bad-ptr read-boundary read-zero - write-normal write-bad-ptr write-boundary write-zero)); -put_file ("child-simple") if $test eq 'exec-once' or $test eq 'exec-multiple'; + write-normal write-bad-ptr write-boundary write-zero + multi-child-fd)); +put_file ("child-simple") + if grep ($_ eq $test, + qw (exec-once exec-multiple + join-simple join-twice)); put_file ("child-arg") if $test eq 'exec-arg'; +put_file ("child-close") if $test eq 'multi-child-fd'; +put_file ("child-bad") if $test eq 'join-killed'; sub put_file { my ($fn) = @_; my ($cmd) = "$pintos -v --os-disk='$os_disk' --fs-disk='$fs_disk' put"; $cmd .= " -f", $formatted = 1 if !$formatted; $cmd .= " '$fn'"; - xsystem ($cmd); + xsystem (1, $cmd); } sub xsystem { - my ($cmd) = @_; + my ($expect, $cmd) = @_; print "$cmd\n"; - system ($cmd) == 0 || die "command failed\n"; + WIFEXITED ($code) && WEXITSTATUS ($code) == $expect + or die "command failed\n"; }