From 556a216befb4a58e9563aeef6e827975f4a26731 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Mon, 20 Jun 2005 20:59:24 +0000 Subject: [PATCH] Always print output for failing test cases. --- src/tests/make-grade | 22 ++++++++++++---------- src/tests/tests.pm | 4 ++-- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/tests/make-grade b/src/tests/make-grade index 20e0cd9..f8c1443 100755 --- a/src/tests/make-grade +++ b/src/tests/make-grade @@ -116,19 +116,22 @@ my (@divider) = ('', '- ' x 38, ''); print map ("$_\n", @overall, @divider, @summary, @divider, @rubrics); for my $test (@failures) { - open (RESULT, '<', "$test.result") or next; print map ("$_\n", @divider); print "DETAILS OF $test FAILURE:\n\n"; - my $first_line = ; - my ($cnt) = 0; - while () { - print; - $cnt++; + + if (open (RESULT, '<', "$test.result")) { + my $first_line = ; + my ($cnt) = 0; + while () { + print; + $cnt++; + } + close (RESULT); } - close (RESULT); - if ($cnt == 0) { - open (OUTPUT, '<', "$test.output") or next; + if (open (OUTPUT, '<', "$test.output")) { + print "\nOUTPUT FROM $test:\n\n"; + my ($panics) = 0; while () { if (/PANIC/ && ++$panics > 2) { @@ -140,4 +143,3 @@ for my $test (@failures) { close (OUTPUT); } } - diff --git a/src/tests/tests.pm b/src/tests/tests.pm index c2a5c64..3c55741 100644 --- a/src/tests/tests.pm +++ b/src/tests/tests.pm @@ -133,13 +133,13 @@ sub compare_output { } die "unknown option " . (keys (%options))[0] . "\n" if %options; - my ($msg) = "Actual output:\n" . join ('', map (" $_\n", @output)); + my ($msg); # Compare actual output against each allowed output. foreach my $exp_string (@$expected) { my (@expected) = split ("\n", $exp_string); - $msg .= "\nAcceptable output:\n"; + $msg .= "Acceptable output:\n"; $msg .= join ('', map (" $_\n", @expected)); # Check whether actual and expected match. -- 2.30.2