]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
test defs: new function 'fatal_', for hard errors
authorStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 7 Jun 2011 13:24:11 +0000 (15:24 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 8 Jun 2011 08:52:48 +0000 (10:52 +0200)
Before this patch, the only way offered by tests/defs to
properly signal a hard error was the `framework_failure_'
function.  But the error message issued by that function,
as its name would suggest, refers to a set-up failure in the
testsuite, while hard errors can obviously also be due to
other reasons.  The best way to fix this inconsistency is to
introduce a new function with a more general error message.

Inspired by a recent similar change to Gnulib's tests/init.sh.

* tests/defs.in (fatal_): New function.
* tests/README (Section "Writing test cases" subsection "Do"):
Suggest the use of `fatal_', not of `framework_failure_', for
generic hard errors.  The latter should be reserved for "real"
set-up failures.

ChangeLog
tests/README
tests/defs.in

index cb9918fc2a6bc04a2078a7766e496302f7d838ac..5b3053dff420b45888196ea5b79dbff77b12f360 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2011-06-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       test defs: new function 'fatal_', for hard errors
+       Before this patch, the only way offered by tests/defs to
+       properly signal a hard error was the `framework_failure_'
+       function.  But the error message issued by that function,
+       as its name would suggest, refers to a set-up failure in the
+       testsuite, while hard errors can obviously also be due to
+       other reasons.  The best way to fix this inconsistency is to
+       introduce a new function with a more general error message.
+       Inspired by a recent similar change to Gnulib's tests/init.sh.
+       * tests/defs.in (fatal_): New function.
+       * tests/README (Section "Writing test cases" subsection "Do"):
+       Suggest the use of `fatal_', not of `framework_failure_', for
+       generic hard errors.  The latter should be reserved for "real"
+       set-up failures.
+
 2011-06-02  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        maintcheck: fix some failures, extend some checks
index 2b5b5afab95f8293542bf2ac2ecb92e031c327f7..57b2ddb231440af73b4b043d63363bc85e64013f 100644 (file)
@@ -102,8 +102,10 @@ Do
 
   Use the `skip_' function to skip tests, with a meaningful message if
   possible.  Where convenient, use the `warn_' function to print generic
-  warnings, and the `fail_' function for test failures.  Finally, you may
-  use the `framework_fail_' function for hard errors.
+  warnings, the `fail_' function for test failures, and the `fatal_'
+  function for hard errors.  In case a hard error is due to a failed
+  set-up of a test scenario, you can use the `framework_fail_' function
+  instead.
 
   For tests that use the `parallel-tests' Automake option, set the shell
   variable `parallel_tests' to "yes" before including ./defs.  Also,
index 87a350dade21e639ed17b577a5689032c28b896e..5849fbdbea0b3491359cc0b6d700ad193e376d3e 100644 (file)
@@ -148,6 +148,7 @@ Exit ()
 warn_ () { echo "$@" 1>&$stderr_fileno_; }
 fail_ () { warn_ "$me: failed test: $@"; Exit 1; }
 skip_ () { warn_ "$me: skipped test: $@"; Exit 77; }
+fatal_ () { warn_ "$me: hard error: $@"; Exit 99; }
 framework_failure_ () { warn_ "$me: set-up failure: $@"; Exit 99; }
 
 # cross_compiling