Improve.
[pintos-anon] / grading / threads / run-tests
index 1783ca9550c421547161fd249c75375e0e0f6b5c..7fcc91cc6853256f82712f0f5f19be62d00d8cca 100755 (executable)
@@ -156,7 +156,7 @@ sub run_test {
     }
 
     # Really run the test.
-    $status = really_run_test ($test);
+    my ($status) = really_run_test ($test);
 
     # Save the results for later.
     open (DONE, ">output/$test/done") or die "output/$test/done: create: $!\n";
@@ -171,7 +171,8 @@ sub really_run_test {
     # If there's residue from an earlier test, move it to .old.
     # If there's already a .old, delete it.
     xsystem ("rm -rf output/$test.old", VERBOSE => 1) if -d "output/$test.old";
-    rename "output/$test", "output/$test.old" or die "rename: $!\n";
+    rename "output/$test", "output/$test.old" or die "rename: $!\n"
+       if -d "output/$test";
 
     # Make output directory.
     mkdir "output/$test";
@@ -430,8 +431,10 @@ sub verify_common {
                $A2L = "i386-elf-addr2line";
            }
            open (A2L, "$A2L -fe output/$test/kernel.o @addrs|");
-           while (my $function = <A2L>) {
-               my ($line) = <A2L>;
+           for (;;) {
+               my ($function, $line);
+               last unless $function = <A2L>;
+               $line = <A2L>;
                chomp $function;
                chomp $line;
                $details .= "  $function ($line)\n";