Advice on TEST failure
Dominic Dunlop [Fri, 10 Jan 1997 09:19:07 +0000 (10:19 +0100)]
At 18:00 +0100 1997-01-09, Paul Marquess wrote:
>What are peoples views on this one. Should I simply write a diagnostic
>message to STDERR when test 51 fails? Some thing like this...
>
> base/cond.........ok
> lib/db-btree......ok
> lib/db-hash.......ok
> lib/db-recno...... not ok 51
>    There is a known problem with older versions of Berkeley DB. You
>    can ignore the errors if you're never going to use the broken
>    functionality (recno databases with a modified bval), otherwise
>    you'll have to upgrade your DB library or OS.  If you feel like
>    upgrading, the most recent version is 1.85. Check out
>    http://www.bostic.com/db for more details.

Looks good to me.  As of 5.003_20, hints/broken-db.msg is a shell scriptlet
that contains a similar (but not quite as useful) message for use by
Configure.  It Would Be Nice if the same text (the same file?) were used in
both situations.  But no big deal.

And, shortly afterwards, Tom Phoenix wrote:
>You're right. Who needs fine print? :-)  What if 'make test' wrapped up
>with a message like this one?
>
>   Failed 1 test, 96.55% okay.
>   u=1.13  s=3.62  cu=60.49  cs=73.18  files=140  tests=3165
>
>   ### Since not all tests were successful, you may want to run
>   ### some tests individually to see the diagnostic messages,
>   ### if any. See the INSTALL document's section on "make test".

That's a good idea, too, whether or not lib/db-recno blats something onto
the screen even when TEST is run without -v.  Here's a patch which
implements it.  (Well, with slightly different ordering.)  I've also taken
the liberty of removing the RCS information from TEST, as it's meaningless
by now, of making the exit behaviour the same for one and for multiple
failures, and of trying to make the difference between "files" and "tests"
clearer.  (This always confused me: I thought maybe "files" was the number
of files that got touched in the course of the tests.)

p5p-msgid: <v03010d01aefbaefcf3bc@[194.51.248.78]>

t/TEST

diff --git a/t/TEST b/t/TEST
index fdd995e..c9d89af 100755 (executable)
--- a/t/TEST
+++ b/t/TEST
@@ -1,6 +1,6 @@
 #!./perl
 
-# $RCSfile: TEST,v $$Revision: 4.1 $$Date: 92/08/07 18:27:00 $
+# Last change: Fri Jan 10 09:57:03 WET 1997
 
 # This is written in a peculiar style, since we're trying to avoid
 # most of the constructs we'll be testing for.
@@ -117,11 +117,17 @@ if ($bad == 0) {
 } else {
     $pct = sprintf("%.2f", $good / $total * 100);
     if ($bad == 1) {
-       warn "Failed 1 test, $pct% okay.\n";
+       warn "Failed 1 test script out of $total, $pct% okay.\n";
     } else {
-       die "Failed $bad/$total tests, $pct% okay.\n";
+       warn "Failed $bad test scripts out of $total, $pct% okay.\n";
     }
+       warn <<'SHRDLU';
+   ### Since not all tests were successful, you may want to run
+   ### some tests individually to see the diagnostic messages,
+   ### if any. See the INSTALL document's section on "make test".
+SHRDLU
 }
 ($user,$sys,$cuser,$csys) = times;
-print sprintf("u=%g  s=%g  cu=%g  cs=%g  files=%d  tests=%d\n",
+print sprintf("u=%g  s=%g  cu=%g  cs=%g  scripts=%d  tests=%d\n",
     $user,$sys,$cuser,$csys,$files,$totmax);
+exit($bad != 0);