Talk more about backtraces.
[pintos-anon] / grading / vm / run-tests
index f74bd9978aaec241878ce68cb59c5f473035ccdd..108821ff631dfca27e23911b534109bf07e7c53a 100755 (executable)
@@ -3,6 +3,7 @@
 # Find the directory that contains the grading files.
 our ($GRADES_DIR);
 
+# Add our Perl library directory to the include path. 
 BEGIN {
     ($GRADES_DIR = $0) =~ s#/[^/]+$##;
     -d $GRADES_DIR or die "$GRADES_DIR: stat: $!\n";
@@ -15,12 +16,12 @@ use POSIX;
 use Algorithm::Diff;
 use Getopt::Long;
 
-our ($VERBOSE) = 0;    # Verbosity of output
+our ($verbose) = 0;    # Verbosity of output
 our (@TESTS);          # Tests to run.
 my ($clean) = 0;
 my ($grade) = 0;
 
-GetOptions ("v|verbose+" => \$VERBOSE,
+GetOptions ("v|verbose+" => \$verbose,
            "h|help" => sub { usage (0) },
            "t|test=s" => \@TESTS,
            "c|clean" => \$clean,
@@ -263,17 +264,17 @@ sub really_run_test {
     # Run.
     my ($timeout) = 600;
     my ($testargs) = defined ($args{$test}) ? " $args{$test}" : "";
-    xsystem ("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$testargs\"",
-            LOG => "$test/run",
-            TIMEOUT => $timeout,
-            EXPECT => 1)
-       or return "Bochs error";
-    
-    return "ok";
+    my ($result) = xsystem ("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$testargs\"",
+                           LOG => "$test/run",
+                           TIMEOUT => $timeout,
+                           EXPECT => 1)
+       ? "ok" : "Bochs error";
+    unlink ("output/$test/fs.dsk", "output/$test/swap.dsk");
+    return $result;
 }
 
 sub grade_test {
@@ -620,7 +621,7 @@ sub write_details {
 \f
 sub xsystem {
     my ($command, %options) = @_;
-    print "$command\n" if $VERBOSE || $options{VERBOSE};
+    print "$command\n" if $verbose || $options{VERBOSE};
 
     my ($log) = $options{LOG};