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-tests 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.
26 cat >> configure.ac << 'END'
30 cat > Makefile.am << 'END'
31 TEST_LOG_DRIVER = ./passthrough-driver
32 TEST_LOG_COMPILER = $(SHELL) -e
35 cat > passthrough-driver <<'END'
38 while test $# -gt 0; do
40 --log-file) log_file=$2; shift;;
41 --trs-file) trs_file=$2; shift;;
42 --test-name) test_name=$2; shift;;
43 --expect-failure|--color-tests|--enable-hard-errors) shift;;
45 *) echo "$0: invalid option/argument: '$1'" >&2; exit 2;;
49 echo "$test_name: RUN"
50 "$@" >$log_file 2>&1 5>$trs_file
52 chmod a+x passthrough-driver
54 # The ':test-result:' and ':recheck:' fields and the first line of the
55 # log file should be be irrelevant for the decision of whether a test
56 # output is to be copied in the 'test-suite.log'.
59 echo :test-result: SKIP >&5
60 echo :copy-in-global-log: no >&5
61 echo :test-result: FAIL >&5
62 echo :test-result: XPASS >&5
66 # In the last line, with leading and trailing whitespace in the value.
68 echo ":test-result: FAIL" >&5
70 echo ":recheck: yes" >&5
71 echo ":copy-in-global-log:$tab $tab no $tab" >&5
74 for RES in XPASS FAIL XFAIL SKIP ERROR UNKNOWN; do
75 unindent > $RES.test <<END
76 echo :test-result: $RES >&5
77 echo :copy-in-global-log: no >&5
82 # In the first line, with no whitespace.
84 echo :copy-in-global-log:no >&5
85 echo ":test-result: FAIL" >&5
89 # Leading whitespace before the field.
91 echo ":test-result: FAIL" >&5
92 echo " $tab $tab$tab :copy-in-global-log: no" >&5
96 cat > yes-1.test <<END
97 echo :test-result: PASS >&5
98 echo :copy-in-global-log: yes >&5
102 # A lacking ':copy-in-global-log:' implies that the content of
103 # the log file should be copied.
104 cat > yes-2.test <<END
105 echo :test-result: PASS >&5
109 # Three corner cases.
111 cat > corn-1.test <<END
113 echo ':copy-in-global-log:' >&5
116 cat > corn-2.test <<END
118 echo '$tab $tab$tab' >&5
121 cat > corn-3.test <<'END'
123 echo ':copy-in-global-log:#@%!' >&5
127 echo TESTS = *.test >> Makefile.am
135 # We don't care about the exit status of "make check" here, that
136 # should be checked in other tests.
139 grep '^seen yes 1$' test-suite.log
140 grep '^seen yes 2$' test-suite.log
141 grep '^seen corn 1$' test-suite.log
142 grep '^seen corn 2$' test-suite.log
143 grep '^seen corn 31$' test-suite.log
144 grep '^seen corn 32$' test-suite.log
145 $FGREP 'not seen' test-suite.log && Exit 1