X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=grading%2Fuserprog%2Fprep-disk;h=f37a68297b11d2502190f71a51305dc41f5510a2;hb=ec4c70597de001011d1620268774296a14e23442;hp=1d34e5fb1a340ecaac39c084dc3f7c4abeafce8f;hpb=c893972febefec473748d49cb65e9719b3cf5d80;p=pintos-anon diff --git a/grading/userprog/prep-disk b/grading/userprog/prep-disk index 1d34e5f..f37a682 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,7 +34,7 @@ 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, @@ -55,11 +56,13 @@ sub put_file { 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"; + my ($code) = system ($cmd); + WIFEXITED ($code) && WEXITSTATUS ($code) == $expect + or die "command failed\n"; }