summaryrefslogtreecommitdiff
path: root/lib/test-driver
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2011-08-05 12:08:20 +0200
committerStefano Lattarini <stefano.lattarini@gmail.com>2011-08-05 12:29:18 +0200
commit4839ca9219b95a6155e4161438318ec0aca3aaef (patch)
tree8ca5b9cb5c3a79a8db71677b2f88907a32891466 /lib/test-driver
parent5e3ae4e14a471a7c61ac75ffd6cd71659e81b07f (diff)
downloadautomake-4839ca9219b95a6155e4161438318ec0aca3aaef.tar.gz
check: small cleanups and refactorings in test harness and drivers
* lib/tap-driver (yn): New subroutine, converts a boolean value to a "yes" or "no" string. (write_test_results): Use it, and related reformatting. * lib/test-driver (trap): Also remove the `.trs' file on signals, for extra safety. (fatal): Remove this function, it's never used. ($logfile, $trsfile): Renamed ... ($log_file, $trs_file): ... to these, for clarity, and in order to be more consistent with the `tap-driver' script. Improve a couple of comments. * automake.in (handle_tests): Don't define anymore the now-obsolete make macro `$(TEST_LOGS_TMP)', nor add it to the list of files to be removed upon "make mostlyclean". * lib/am/check.am ($(TEST_SUITE_LOG)): New shell function `f_ok', tells whether a path refers to an existing, regular, readable file. Use it throughout. (recheck): Be safer w.r.t. make implementation that run recipes with `errexit' shell flag active.
Diffstat (limited to 'lib/test-driver')
-rwxr-xr-xlib/test-driver28
1 files changed, 11 insertions, 17 deletions
diff --git a/lib/test-driver b/lib/test-driver
index c1645a22d..89f6914f3 100755
--- a/lib/test-driver
+++ b/lib/test-driver
@@ -31,12 +31,6 @@ scriptversion=2011-08-04.22; # UTC
# helps a lot in preventing typo-related bugs.
set -u
-fatal ()
-{
- echo "$0: fatal: $*" >&2
- exit 1
-}
-
usage_error ()
{
echo "$0: $*" >&2
@@ -56,10 +50,10 @@ END
}
# TODO: better error handling in option parsing (in particular, ensure
-# TODO: $logfile, $trsfile and $test_name are defined).
+# TODO: $log_file, $trs_file and $test_name are defined).
test_name= # Used for reporting.
-logfile= # Where to save the output of the test script.
-trsfile= # Where to save the result(s) the test script.
+log_file= # Where to save the output of the test script.
+trs_file= # Where to save the metadata of the test run.
expect_failure=no
color_tests=no
enable_hard_errors=yes
@@ -68,8 +62,8 @@ while test $# -gt 0; do
--help) print_usage; exit $?;;
--version) echo "test-driver $scriptversion"; exit $?;;
--test-name) test_name=$2; shift;;
- --log-file) logfile=$2; shift;;
- --trs-file) trsfile=$2; shift;;
+ --log-file) log_file=$2; shift;;
+ --trs-file) trs_file=$2; shift;;
--color-tests) color_tests=$2; shift;;
--expect-failure) expect_failure=$2; shift;;
--enable-hard-errors) enable_hard_errors=$2; shift;;
@@ -90,14 +84,14 @@ else
red= grn= lgn= blu= mgn= std=
fi
-do_exit='rm -f $logfile; (exit $st); exit $st'
+do_exit='rm -f $log_file $trs_file; (exit $st); exit $st'
trap "st=129; $do_exit" 1
trap "st=130; $do_exit" 2
trap "st=141; $do_exit" 13
trap "st=143; $do_exit" 15
# Test script is run here.
-"$@" >$logfile 2>&1
+"$@" >$log_file 2>&1
estatus=$?
if test $enable_hard_errors = no && test $estatus -eq 99; then
estatus=1
@@ -116,10 +110,10 @@ esac
echo "${col}${res}${std}: $test_name"
# Register the test result, and other relevant metadata.
-echo ":test-result: $res" > $trsfile
-echo ":global-test-result: $res" >> $trsfile
-echo ":recheck: $recheck" >> $trsfile
-echo ":copy-in-global-log: $gcopy" >> $trsfile
+echo ":test-result: $res" > $trs_file
+echo ":global-test-result: $res" >> $trs_file
+echo ":recheck: $recheck" >> $trs_file
+echo ":copy-in-global-log: $gcopy" >> $trs_file
# Local Variables:
# mode: shell-script