summaryrefslogtreecommitdiff
path: root/lib/tap-driver.sh
Commit message (Collapse)AuthorAgeFilesLines
* maint: Update copyright years to 2017.Mathieu Lirzin2017-03-021-1/+1
| | | | This update has been made with 'make update-copyright'.
* maint: port time-stamp-time-zone to strict POSIXPaul Eggert2016-01-121-1/+1
| | | | | Set time-stamp-time-zone to "UTC0", not to "UTC", as POSIX defines TZ="UTC0" not TZ="UTC".
* maint: update copyright years to 2015 (branch 'micro')Stefano Lattarini2015-01-051-1/+1
| | | | Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
* maint: update copyright yearsStefano Lattarini2014-04-211-1/+1
| | | | | | We've been in 2014 already for few months now... Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
* TAP driver: cosmetic fixesStefano Lattarini2013-12-231-5/+4
| | | | | | | | * lib/tap-driver.sh: Quote 'like this', not `like this'. Remove an obsolete FIXME. Correctly mark another comment as a TODO rather than as a FIXME. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
* maint: update copyright year for 2013 (in branch maint)Stefano Lattarini2012-12-311-1/+1
| | | | Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
* maint: run "make update-copyright"Stefano Lattarini2012-02-161-1/+1
|
* tap/awk: avoid redirection issues with bash 3.2 and earlierPeter Rosin2012-01-101-1/+4
| | | | | | | | | | 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.
* tap/awk: "Bail out!" recognized also after leading whitespaceStefano Lattarini2011-12-271-3/+7
| | | | | | | | | | | | | | | | | | 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.
* tap/awk: improve comments about Korn shell signal handling issuesStefano Lattarini2011-09-281-7/+11
| | | | | | | | | | * 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.
* tap/awk: account for unusual korn shell signal handling behaviourStefano Lattarini2011-09-281-2/+15
| | | | | | | | | | | | 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'.
* tap/awk: handle exit statuses > 256 (seen on few korn shells)Stefano Lattarini2011-09-281-2/+10
| | | | | | | | | | | | | 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.
* tap/awk: allow escaping of TAP directivesStefano Lattarini2011-08-251-2/+15
| | | | | | | | | * 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.
* tap: improve syncing between awk+shell and perl implementationsStefano Lattarini2011-08-251-11/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* tap/awk: don't redirect awk stderr to log filesStefano Lattarini2011-08-251-8/+14
| | | | | | | | | | | * 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.
* tap/awk: remove obsolete "FIXME" commentStefano Lattarini2011-08-241-7/+2
| | | | | | | * 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.
* tap/awk: handle non-zero exit status from the test commandStefano Lattarini2011-08-221-0/+24
| | | | | | | | | | | * 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.
* tap/awk: prepare to fetch the exit status of the test commandStefano Lattarini2011-08-221-4/+24
| | | | | | * 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.
* tap/awk: refactor for future changesStefano Lattarini2011-08-221-104/+99
| | | | | | * 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.
* tap/awk: support Solaris /usr/xpg4/bin/awkStefano Lattarini2011-08-221-13/+13
| | | | | | * 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.
* tap/awk: support Solaris /usr/bin/nawkStefano Lattarini2011-08-221-7/+1
| | | | | | | | * 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.
* tap/awk: correctly extract message from SKIP plansStefano Lattarini2011-08-211-2/+2
| | | | | | | | | | * 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).
* tap/awk: support colorized outputStefano Lattarini2011-08-211-14/+22
| | | | | | | | | | | | | * 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.
* tap: real (but still incomplete) awk implementation of TAP driverStefano Lattarini2011-08-211-24/+468
| | | | | | | | | | | | | | | | | | | | | * 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).
* parallel-tests: fix help screen for test driver scriptsStefano Lattarini2011-08-171-1/+1
| | | | | | | | * 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.
* tap: add a dummy TAP driver script implemented in shell + awkStefano Lattarini2011-08-171-0/+123
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.