projects
/
pintos-anon
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Comments.
[pintos-anon]
/
grading
/
vm
/
prep-disk
diff --git
a/grading/vm/prep-disk
b/grading/vm/prep-disk
index 10afa8f5530a7d79c117124d2ef74fa85841769f..d6d85a24035886ff45477882873c49754a5a6920 100755
(executable)
--- a/
grading/vm/prep-disk
+++ b/
grading/vm/prep-disk
@@
-2,6
+2,7
@@
use strict;
use Getopt::Long;
use strict;
use Getopt::Long;
+use POSIX;
my ($pintos) = "pintos";
my ($os_disk) = "../../src/userprog/build/os.dsk";
my ($pintos) = "pintos";
my ($os_disk) = "../../src/userprog/build/os.dsk";
@@
-27,7
+28,7
@@
if (! -e $os_disk) {
our ($formatted) = 0;
unlink $fs_disk;
our ($formatted) = 0;
unlink $fs_disk;
-xsystem ("$pintos make-disk '$fs_disk' 2");
+xsystem (
0,
"$pintos make-disk '$fs_disk' 2");
while (@ARGV) {
put_file (shift (@ARGV));
}
while (@ARGV) {
put_file (shift (@ARGV));
}
@@
-37,11
+38,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'";
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 {
}
sub xsystem {
- my ($cmd) = @_;
+ my ($
expect, $
cmd) = @_;
print "$cmd\n";
print "$cmd\n";
- system ($cmd) == 0 || die "command failed\n";
+ my ($code) = system ($cmd);
+ WIFEXITED ($code) && WEXITSTATUS ($code) == $expect
+ or die "command failed\n";
}
}