lib/tap-driver.sh


Log

Author Commit Date CI Message
Stefano Lattarini 641a5a4b 2012-02-16T10:46:23 maint: run "make update-copyright"
Peter Rosin 8525b870 2012-01-10T10:01:29 tap/awk: avoid redirection issues with bash 3.2 and earlier Fixes automake bug#10465. * lib/tap-driver.sh: Add workaround for bash 3.2 and earlier, which sometimes does not properly set '$?' when failing to write redirected output of a compound command. See the Autoconf manual for more details. The workaround was pointed out by Eric Blake.
Stefano Lattarini 2fa8a9e9 2011-12-27T11:45:59 tap/awk: "Bail out!" recognized also after leading whitespace Newer versions of TAP::Harness (e.g., 3.23 on Perl 5.14.1) recognize a "Bail out!" directive also when it is prepended by leading whitespace; this was not the case for older TAP:Harness versions, (e.g., for version 3.17 on Perl 5.12.4), and for our TAP driver implemented in awk. * lib/tap-driver.sh: Handle the "Bail out!" directive also when it is preceded by leading whitespace. * tests/tap-spurious.test: Remove the tests checking that a "Bail out!" string coming right after leading whitespace does not trigger a bailout action. * tests/tap-bailout-leading-space.test: New test. * tests/list-of-tests.mk: Add it. Problem reported by Jim Meyering in automake bug#10374.
Stefano Lattarini 5014b1c2 2011-09-28T20:48:13 tap/awk: improve comments about Korn shell signal handling issues * lib/tap-driver.sh: Link an Austin Group discussion about how shells are allowed, and even encouraged, to set the special variable `$?' to values greater than 256 to report termination of a child by a signal. Improve and extend comments about our workarounds for unusual korn shell signals' propagation. Thanks to Eric Blake for the pointers.
Stefano Lattarini 93fcb730 2011-09-28T16:31:24 tap/awk: account for unusual korn shell signal handling behaviour This change has been motivated by a testsuite failure on Debian with the AT&T Korn Shell version 93u-1. * lib/tap-driver.sh: Temporarily ignore some common signals when waiting for the test command to complete, to avoid premature exit in Korn shells that propagate to themselves signals that have killed a child process. See also related commit `v1.11-1342-g6321ad3'.
Stefano Lattarini c6988f33 2011-09-28T16:05:06 tap/awk: handle exit statuses > 256 (seen on few korn shells) Some Korn shells, when a child process die due to signal number n, can leave in $? an exit status of 256+n instead of the more standard 128+n. Apparently, both behaviours are allowed by POSIX, so be prepared to handle them both. This change has been motivated by a testsuite failure on Debian with the AT&T Korn Shell version 93u-1. * lib/tap-driver.sh (get_test_exit_message): Handle the described Korn Shell behaviour too. ($scriptversion): Update.
Stefano Lattarini e698ee3e 2011-08-25T13:22:58 tap/awk: allow escaping of TAP directives * lib/tap-driver.sh (setup_result_obj): Handle escaping of TAP directives in a way tat is (mostly) compatible by what is done by the TAP::Parser module. With this change, the tests `tap-escape-directive.test' and `tap-escape-directive-2.test' now also pass with the shell/awk implementation of the TAP driver.
Stefano Lattarini 33d456f2 2011-08-25T12:44:32 tap: improve syncing between awk+shell and perl implementations * lib/tap-driver.pl (stringify_test_result): Renamed ... (stringify_result_obj): ... to this. Break up a clause in the long "if/elsif/.../else" construct to avoid unaesthetic line breaks and to be more synced with the sibling function in `tap-driver.sh'. Rename the `$result', `$PASS' and `$FAIL' variables to respectively `$result_obj', `$COOKED_PASS' and `$COOKED_FAIL', for clarity and better syncing. (handle_tap_test): Renamed ... (handle_tap_result): ... to this, and change the name of the `$test' local variable to `$result_obj'. (extract_comment): Reimplement using the simpler `index' and `substr' builtins, rather than with more advanced uses of regular expressions. (%test_results, @test_results): Renamed respectively ... (%test_results_seen, @test_results_list): ... to these, and related adjustments throughout the `TEST_RESULTS' block. (main, get_global_test_result): Refactor and do some cosmetic changes to make these functions clearer and better synced with sibling code in `tap-driver.sh'. Other minor cosmetic and typo fixes. * lib/tap-driver.sh (extract_tap_comment): Remove outdated "FIXME" comments. (get_global_test_result): Small reordering to make it better synced with its sibling function in `tap-driver.pl'. (stringify_result_obj): Consistently use `result_obj' as the parameter name. Other minor cosmetic and typo fixes.
Stefano Lattarini 4f394b74 2011-08-24T11:27:00 tap/awk: don't redirect awk stderr to log files * lib/tap-driver.sh: Handle the file descriptors redirections more smartly, to avoid sending error messages from awk (about e.g. syntax or I/O errors) to the log files instead that to the console. * tests/tap-driver-stderr.test: New test, verifying the improved driver behaviour. Notice that this test still fails when using the perl implementation of the TAP driver. * tests/Makefile.am (tap_other_tests): Update.
Stefano Lattarini a822d925 2011-08-24T09:54:22 tap/awk: remove obsolete "FIXME" comment * lib/tap-driver.sh: Remove obsolete "FIXME" comment about our driver losing the exit status of the tested program; this issue has been solved in precedent commit `v1.11-1052-gd630a0d'. Fix an unrelated typo in comments since we are at it.
Stefano Lattarini d630a0d4 2011-08-22T15:00:09 tap/awk: handle non-zero exit status from the test command * lib/tap-driver.sh (get_test_exit_message): New function in the awk script, used to extract the exit status of the test program, or at least a good guess of it. (write_test_results): Use it, reporting an ERROR result if it detects that the test program exited with a non-zero status. * tests/tap-signal.test: Account for the differences in the error messages generated by the awk and perl TAP drivers. Fix an unrelated typo in comments since we are at it.
Stefano Lattarini 5116cc97 2011-08-22T12:14:32 tap/awk: prepare to fetch the exit status of the test command * lib/tap-driver.sh: Rewrite some logic in the main parsing loop, to make it possible to read the exit status of the test command from the last line of the input stream.
Stefano Lattarini 48b98a63 2011-08-22T12:00:05 tap/awk: refactor for future changes * lib/tap-driver.sh: Rewrite the awk script so that the parsing of the input stream is implemented as a hand-rolled loop in the BEGIN block, using the `getline' builtin.
Stefano Lattarini 484ec4ec 2011-08-22T10:02:11 tap/awk: support Solaris /usr/xpg4/bin/awk * lib/tap-driver.sh: Use `\t', not `\\t', to represent tabulation character in regexps, even when inside double-quoted strings; that seems to be more portable to Solaris 10 XPG4 awk.
Stefano Lattarini 6c20cf07 2011-08-22T08:43:22 tap/awk: support Solaris /usr/bin/nawk * lib/tap-driver.sh (close_or_die): Remove, the use of the `close' builtin in there was confusing /usr/bin/nawk from Solaris 10 into a syntax error. (write_test_results): Simply use `close' on the `*.trs' file, that should be enough.
Stefano Lattarini c9ca5f61 2011-08-21T23:15:45 tap/awk: correctly extract message from SKIP plans * lib/tap-driver.sh (/^1\.\.0+[ \t]*#/): Add a forgotten `?' to the regex used to extract the skip message from a "1..0" TAP plan. * tests/planskip.test: Check for the just-fixed bug. * tests/tap-planskip-unplanned-corner.test: Don't be too strict w.r.t. the formatting of the "skip whole test" message, to avoid failing due to bugs irrelevant for this test (like the one just fixed).
Stefano Lattarini 1bc8f828 2011-08-21T20:09:34 tap/awk: support colorized output * lib/tap-driver.sh: Pass definition of colors to the BEGIN block of the awk script, using ... ($init_colors): ... this new variable, which supersedes ... ($red, $grn, $lgn, $blu, $mgn, $std): ... these variables, which have been consequently removed. ($color_tests): We don't have to pass this anymore to the awk script, so do not convert it to a numeric boolean. (decorate_result): Implement for real. With this change, the test 'tap-color.test' now passes.
Stefano Lattarini fdfe9a11 2011-08-21T18:15:35 tap: real (but still incomplete) awk implementation of TAP driver * lib/tap-driver.sh : Add an incomplete, but mostly working, implementation of a TAP parser and driver in awk. It doesn't yet support colorized output, fetching of exit status from test programs, nor a way to escape TAP directives in TAP result lines, but passes all the tests of TAP support in the automake testsuite, apart from the following ones: - tap-color.test - tap-escape-directive.test - tap-exit.test - tap-missing-plan-and-bad-exit.test - tap-passthrough-exit.test - tap-planskip-badexit.test - tap-planskip-unplanned-corner.test - tap-signal.test Tested on Debian GNU/Linux with GNU awk 3.1.7 and 3.0.2, "original awk" 2010-05-23-1, and mawk 1.3.3-15 (with which also the test `tap-realtime.test' fails, in addition to those listed above).
Stefano Lattarini 081e90a8 2011-08-17T16:32:48 parallel-tests: fix help screen for test driver scripts * lib/tap-driver.pl ($USAGE): The `--trs-file' option is mandatory too. * lib/tap-driver.sh (print_usage): Likewise. * lib/test-driver (print_usage): Likewise. ($scriptversion): Update.
Stefano Lattarini 51f413e9 2011-08-17T14:59:19 tap: add a dummy TAP driver script implemented in shell + awk The user can also now decide which implementation of the TAP driver to use in the testsuite by defining the `$am_tap_implementation' variable to either "perl" or "shell". Future enhancements will allow the testsuite to automatically run the test scripts on TAP support with both the TAP driver implementations, to improve coverage. * tests/defs (fetch_tap_driver): Honor the `$am_tap_implementation' variable to decide which implementation of the TAP driver to fetch. ($am_tap_implementation): Default to "perl". * tests/tap-common-setup.test: Do not fetch the TAP driver, the code in tap-setup.sh does that already (and respecting runtime overriding of `$am_tap_implementation'). * lib/tap-driver: Renamed ... * lib/tap-driver.pl: ... to this, and ... ($ME): ... adjusted this. * doc/automake.texi: Adjust to the renaming. * tests/Makefile.am (TAP_LOG_DRIVER): Likewise. * tests/tap-doc2.test: Likewise. * lib/tap-driver.sh: New script, still mostly dummy. * lib/Makefile.am (dist_script_DATA): Update, and since we are at it, rewrite it to make it easier to add new entries in the future.