When running a "test" or "assemble" target, run-tests now returns zero
[pintos-anon] / grading / lib / Pintos / Grading.pm
index 36599a0afbdd9957374843f0d50ee314d629a52c..7e5ec67fb008f7fc5ad06353b1f2c9ae574eb98f 100644 (file)
@@ -16,6 +16,11 @@ use POSIX;
 use Getopt::Long qw(:config no_ignore_case);
 use Algorithm::Diff;
 \f
+# We execute lots of subprocesses.
+# Without this, our stdout output can get flushed multiple times,
+# which is harmless but looks bizarre.
+$| = 1;
+
 sub parse_cmd_line {
     my ($do_regex, $no_regex);
     GetOptions ("v|verbose+" => \$verbose,
@@ -827,5 +832,12 @@ sub file_contains {
     close (FILE);
     return $equal;
 }
+\f
+sub success {
+    for my $test (@TESTS) {
+       return 1 if !defined ($result{$test}) || $result{$test} ne 'ok';
+    }
+    return 0;
+}
 
 1;