summaryrefslogtreecommitdiff
path: root/lib/test-driver
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2011-07-28 12:25:22 +0200
committerStefano Lattarini <stefano.lattarini@gmail.com>2011-08-02 23:29:32 +0200
commit0c81b43f711fb861f04227ced8dba889596d9c43 (patch)
tree1e41aa1197c9c3a13c3bfa4ad42727aa93360c37 /lib/test-driver
parent4014b502e2180c1c1ea501ef77e5f97c186d4cbe (diff)
downloadautomake-0c81b43f711fb861f04227ced8dba889596d9c43.tar.gz
test harness: use new `.trs' files to hold test metadata
With this change, the test harness will keep test metadata in dedicated `.trs' files, instead of having them embedded into the `.log' files. This allows for easier forward-compatibility and extension of test metadata, and for more flexibility in the format of the `.log' files. Note that this change makes the `:end-metadata:' field obsolete. * doc/automake.texi (Parallel Test Harness, Log files generation and test results recording): Document the new APIs and behaviour; some related minor rewordings and fixlets. * NEWS: Update. * automake.in (handle_tests): When bringing in the content of `check2.am', substitute %BASE% with the basename of the `.log' file being created by a rule. Add the generated `.trs' files to the list of files to be cleaned by "make mostlyclean". * lib/am/check.am (am__test_driver_flags): Rename ... (am__common_driver_flags): ... to this, and remove the flags `--test-name' and `--log-file' from it: they are now define in the proper rules in `check2.am'. (am__TEST_BASES): New internal variable, holding the names of the tests, with any registered extension removed. (am__stealth_MAKE): New internal variable, can be used instead of $(MAKE) in recipes requiring a recursive call to make, but which are not intended to be executed by "make -n". (.log.trs): New suffix rule, to recover from deletion of `.trs' files. ($(TEST_SUITE_LOG)): Almost completely rewritten to follow the new API of "test logs in `.log' files, test metadata in `.trs' files". It goes to some length to work correctly in face of unreadable or missing `.log' and `.trs' files, and to error out with proper error messages when this is not possible. [%?PARALLEL_TESTS%] (check-TESTS): Also remove relevant "stale" `.trs' files (in addition to `.log files) before remaking the $(TEST_SUITE_LOG). (recheck, recheck-html): Look for the `:recheck:' field in the `.trs' files, not in the `.log' files. * lib/am/check2.am (?GENERIC?%EXT%.log, ?!GENERIC?%OBJ%): Adjust the call to the test driver, in particularly passing the new option `--trs-file'. [%am__EXEEXT%] (?GENERIC?%EXT%$(EXEEXT).log): Likewise. * lib/tap-driver ($USAGE): Adjust the help screen. (Getopt::Long::GetOptions): Handle the `--trs-file' option, through the use of ... ($trs_file): ... this new global variable. (finish): Write metadata for the test run to `$trs_file' rather then to `$log_file', through the use of ... (write_test_results): ... this new function. * lib/test-driver (print_usage): Update the help screen. (Option parsing): Handle the `--trs-file' option, through the use of ... ($resfile): ... this new global variable. (Main code): Write metadata for the test run to `$trsfile' rather than to `$logfile'. Minor related adjustments to comments. * tests/.gitignore: Ignore `*.trs' files. * tests/parallel-tests-unreadable-log.test: Moved ... * tests/parallel-tests-unreadable.test: ... to this, and extended to also check the semantics for unreadable `.trs' files. * tests/test-driver-end-metadata.test: Deleted as obsolete. * tests/test-driver-metadata-no-leading-space.test: Likewise. * tests/test-driver-global-log.test: Renamed ... * tests/test-metadata-global-log.test: ... to this, and modified as to verify the new APIs and semantics. * tests/test-driver-recheck: Renamed ... * tests/test-metadata-recheck.test: ... to this, and modified likewise. * tests/parallel-tests-once.test: New test. * tests/parallel-tests-make-n.test: Likewise. * test-metadata-results.test: Likewise. * test-missing.test: Likewise. * test-missing2.test: Likewise. * test-trs-basic.test: Likewise. * test-trs-recover.test: Likewise. * test-trs-recover2.test: Likewise. * tests/Makefile.am (TESTS): Update.
Diffstat (limited to 'lib/test-driver')
-rwxr-xr-xlib/test-driver30
1 files changed, 11 insertions, 19 deletions
diff --git a/lib/test-driver b/lib/test-driver
index 45b3afe37..472ba4925 100755
--- a/lib/test-driver
+++ b/lib/test-driver
@@ -1,7 +1,7 @@
#! /bin/sh
# test-driver - basic driver script for the `parallel-tests' mode.
-scriptversion=2011-07-27.12; # UTC
+scriptversion=2011-08-01.21; # UTC
# Copyright (C) 2011 Free Software Foundation, Inc.
#
@@ -48,7 +48,7 @@ print_usage ()
{
cat <<END
Usage:
- test-driver [--help|--version] --test-name=NAME --log-file=PATH
+ test-driver --test-name=NAME --log-file=PATH --trs-file=PATH
[--expect-failure={yes|no}] [--color-tests={yes|no}]
[--enable-hard-errors={yes|no}] [--] TEST-SCRIPT
The \`--test-name' and \`--log-file' options are mandatory.
@@ -59,9 +59,10 @@ END
rst_section () { sed 'p;s/./=/g;p;g'; }
# TODO: better error handling in option parsing (in particular, ensure
-# TODO: $logfile and $test_name are defined).
+# TODO: $logfile, $trsfile and $test_name are defined).
test_name= # Used for reporting.
-logfile= # Where to save the result and output of the test script.
+logfile= # Where to save the output of the test script.
+trsfile= # Where to save the result(s) the test script.
expect_failure=no
color_tests=no
enable_hard_errors=yes
@@ -71,6 +72,7 @@ while test $# -gt 0; do
--version) echo "test-driver $scriptversion"; exit $?;;
--test-name) test_name=$2; shift;;
--log-file) logfile=$2; shift;;
+ --trs-file) trsfile=$2; shift;;
--color-tests) color_tests=$2; shift;;
--expect-failure) expect_failure=$2; shift;;
--enable-hard-errors) enable_hard_errors=$2; shift;;
@@ -118,24 +120,14 @@ esac
# Report outcome to console.
echo "${col}${res}${std}: $test_name"
+# Register the test result, and other relevant metadata.
+echo ":test-result: $res (exit status: $estatus)" > $trsfile
+echo ":recheck: $recheck" >> $trsfile
+echo ":copy-in-global-log: $gcopy" >> $trsfile
+
# Now write log file.
{
echo "$res: $test_name (exit: $estatus)" | rst_section
- # Blank lines required for having the output be valid RST.
- echo
- echo ":test-result: $res (exit status: $estatus)"
- echo
- echo ":recheck: $recheck"
- echo
- echo ":copy-in-global-log: $gcopy"
- echo
- # So that the output from the test script won't be parsed for
- # testsuite metadata.
- echo ":end-metadata:"
- echo
- # Use a reStructuredText transition to better separate the test
- # metadata the test registered output.
- echo ------------
echo
cat $tmpfile
} > $logfile