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,
# 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
close (FILE);
return $equal;
}
+\f
+sub success {
+ for my $test (@TESTS) {
+ return 1 if !defined ($result{$test}) || $result{$test} ne 'ok';
+ }
+ return 0;
+}
1;