X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=grading%2Flib%2FPintos%2FGrading.pm;h=7e5ec67fb008f7fc5ad06353b1f2c9ae574eb98f;hb=39e2b81b7bb61f390e5bb0a3972f943ef133b7b9;hp=d48b2751c92219f4a1b55f3771d0e2a9cc657cd0;hpb=8416a649a344d5225ae80c99338167f0f436999c;p=pintos-anon diff --git a/grading/lib/Pintos/Grading.pm b/grading/lib/Pintos/Grading.pm index d48b275..7e5ec67 100644 --- a/grading/lib/Pintos/Grading.pm +++ b/grading/lib/Pintos/Grading.pm @@ -16,6 +16,11 @@ use POSIX; use Getopt::Long qw(:config no_ignore_case); use Algorithm::Diff; +# 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, @@ -408,7 +413,9 @@ sub run_pintos { # Grade the test. sub grade_test { # Read test output. - my (@output) = snarf ("output/$test/run.out"); + my ($outfile) = "output/$test/run.out"; + die "$outfile: missing test output file (make failed?)" if ! -e $outfile; + my (@output) = snarf ($outfile); # If there's a function "grade_$test", use it to evaluate the output. # If there's a file "$GRADES_DIR/$test.exp", compare its contents @@ -825,5 +832,12 @@ sub file_contains { close (FILE); return $equal; } + +sub success { + for my $test (@TESTS) { + return 1 if !defined ($result{$test}) || $result{$test} ne 'ok'; + } + return 0; +} 1;