2
# test-driver - basic testsuite driver script.
4
scriptversion=2013-07-13.22; # UTC
6
# Copyright (C) 2011-2013 Free Software Foundation, Inc.
8
# This program is free software; you can redistribute it and/or modify
9
# it under the terms of the GNU General Public License as published by
10
# the Free Software Foundation; either version 2, or (at your option)
13
# This program is distributed in the hope that it will be useful,
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
# GNU General Public License for more details.
18
# You should have received a copy of the GNU General Public License
19
# along with this program. If not, see <http://www.gnu.org/licenses/>.
21
# As a special exception to the GNU General Public License, if you
22
# distribute this file as part of a program that contains a
23
# configuration script generated by Autoconf, you may include it under
24
# the same distribution terms that you use for the rest of that program.
26
# This file is maintained in Automake, please report
27
# bugs to <bug-automake@gnu.org> or send patches to
28
# <automake-patches@gnu.org>.
30
# Make unconditional expansion of undefined variables an error. This
31
# helps a lot in preventing typo-related bugs.
45
test-driver --test-name=NAME --log-file=PATH --trs-file=PATH
46
[--expect-failure={yes|no}] [--color-tests={yes|no}]
47
[--enable-hard-errors={yes|no}] [--]
48
TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS]
49
The '--test-name', '--log-file' and '--trs-file' options are mandatory.
53
test_name= # Used for reporting.
54
log_file= # Where to save the output of the test script.
55
trs_file= # Where to save the metadata of the test run.
58
enable_hard_errors=yes
59
while test $# -gt 0; do
61
--help) print_usage; exit $?;;
62
--version) echo "test-driver $scriptversion"; exit $?;;
63
--test-name) test_name=$2; shift;;
64
--log-file) log_file=$2; shift;;
65
--trs-file) trs_file=$2; shift;;
66
--color-tests) color_tests=$2; shift;;
67
--expect-failure) expect_failure=$2; shift;;
68
--enable-hard-errors) enable_hard_errors=$2; shift;;
70
-*) usage_error "invalid option: '$1'";;
77
test x"$test_name" = x && missing_opts="$missing_opts --test-name"
78
test x"$log_file" = x && missing_opts="$missing_opts --log-file"
79
test x"$trs_file" = x && missing_opts="$missing_opts --trs-file"
80
if test x"$missing_opts" != x; then
81
usage_error "the following mandatory options are missing:$missing_opts"
84
if test $# -eq 0; then
85
usage_error "missing argument"
88
if test $color_tests = yes; then
89
# Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'.
92
lgn='[1;32m' # Light green.
94
mgn='[0;35m' # Magenta.
97
red= grn= lgn= blu= mgn= std=
100
do_exit='rm -f $log_file $trs_file; (exit $st); exit $st'
101
trap "st=129; $do_exit" 1
102
trap "st=130; $do_exit" 2
103
trap "st=141; $do_exit" 13
104
trap "st=143; $do_exit" 15
106
# Test script is run here.
109
if test $enable_hard_errors = no && test $estatus -eq 99; then
113
case $estatus:$expect_failure in
114
0:yes) col=$red res=XPASS recheck=yes gcopy=yes;;
115
0:*) col=$grn res=PASS recheck=no gcopy=no;;
116
77:*) col=$blu res=SKIP recheck=no gcopy=yes;;
117
99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;;
118
*:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;;
119
*:*) col=$red res=FAIL recheck=yes gcopy=yes;;
122
# Report outcome to console.
123
echo "${col}${res}${std}: $test_name"
125
# Register the test result, and other relevant metadata.
126
echo ":test-result: $res" > $trs_file
127
echo ":global-test-result: $res" >> $trs_file
128
echo ":recheck: $recheck" >> $trs_file
129
echo ":copy-in-global-log: $gcopy" >> $trs_file
134
# eval: (add-hook 'write-file-hooks 'time-stamp)
135
# time-stamp-start: "scriptversion="
136
# time-stamp-format: "%:y-%02m-%02d.%02H"
137
# time-stamp-time-zone: "UTC"
138
# time-stamp-end: "; # UTC"