2 # Copyright (C) 2011-2012 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # Custom test drivers and parallel test harness: check the documented
18 # semantics for deciding when the content of a test log file should be
19 # copied in the global test-suite.log file. Currently, this is done
20 # with the use of the reStructuredText field ':copy-in-global-log:' in
21 # the associated '.trs' files.
25 cat >> configure.ac << 'END'
29 cat > Makefile.am << 'END'
30 TEST_LOG_DRIVER = ./passthrough-driver
31 TEST_LOG_COMPILER = $(SHELL) -e
34 cat > passthrough-driver <<'END'
37 while test $# -gt 0; do
39 --log-file) log_file=$2; shift;;
40 --trs-file) trs_file=$2; shift;;
41 --test-name) test_name=$2; shift;;
42 --expect-failure|--color-tests|--enable-hard-errors) shift;;
44 *) echo "$0: invalid option/argument: '$1'" >&2; exit 2;;
48 echo "$test_name: RUN"
49 "$@" >$log_file 2>&1 5>$trs_file
51 chmod a+x passthrough-driver
53 # The ':test-result:' and ':recheck:' fields and the first line of the
54 # log file should be be irrelevant for the decision of whether a test
55 # output is to be copied in the 'test-suite.log'.
58 echo :test-result: SKIP >&5
59 echo :copy-in-global-log: no >&5
60 echo :test-result: FAIL >&5
61 echo :test-result: XPASS >&5
65 # In the last line, with leading and trailing whitespace in the value.
67 echo ":test-result: FAIL" >&5
69 echo ":recheck: yes" >&5
70 echo ":copy-in-global-log:$tab $tab no $tab" >&5
73 for RES in XPASS FAIL XFAIL SKIP ERROR UNKNOWN; do
74 unindent > $RES.test <<END
75 echo :test-result: $RES >&5
76 echo :copy-in-global-log: no >&5
81 # In the first line, with no whitespace.
83 echo :copy-in-global-log:no >&5
84 echo ":test-result: FAIL" >&5
88 # Leading whitespace before the field.
90 echo ":test-result: FAIL" >&5
91 echo " $tab $tab$tab :copy-in-global-log: no" >&5
95 cat > yes-1.test <<END
96 echo :test-result: PASS >&5
97 echo :copy-in-global-log: yes >&5
101 # A lacking ':copy-in-global-log:' implies that the content of
102 # the log file should be copied.
103 cat > yes-2.test <<END
104 echo :test-result: PASS >&5
108 # Three corner cases.
110 cat > corn-1.test <<END
112 echo ':copy-in-global-log:' >&5
115 cat > corn-2.test <<END
117 echo '$tab $tab$tab' >&5
120 cat > corn-3.test <<'END'
122 echo ':copy-in-global-log:#@%!' >&5
126 echo TESTS = *.test >> Makefile.am
134 # We don't care about the exit status of "make check" here, that
135 # should be checked in other tests.
138 grep '^seen yes 1$' test-suite.log
139 grep '^seen yes 2$' test-suite.log
140 grep '^seen corn 1$' test-suite.log
141 grep '^seen corn 2$' test-suite.log
142 grep '^seen corn 31$' test-suite.log
143 grep '^seen corn 32$' test-suite.log
144 $FGREP 'not seen' test-suite.log && exit 1