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 # Test the "make recheck" semantics for custom test drivers, as documented
18 # in the Automake manual.
23 cat >> configure.in << 'END'
27 cat > Makefile.am << 'END'
28 LOG_DRIVER = ./dummy-driver
34 # Tests to be re-run by "make recheck"
39 echo ":recheck:" > y-3
40 echo ":recheck:yes" > y-4
41 echo ":recheck: who cares" > y-5
42 echo ":recheck: $tab y" > y-6
43 echo ":recheck: yeah!$tab$tab " > y-7
60 echo " $tab $tab$tab :recheck: yes" > y-8
62 # The :test-result: fields and the fist line of the log should be
63 # irrelevant for the decision of whether "make recheck" should or
64 # should not re-run a test.
66 echo ":test-result: PASS" > y-100
78 # Tests *not* to be re-run by "make recheck"
81 echo ":recheck:no" > n-1
82 echo ":recheck: no " > n-2
83 echo ":recheck: $tab no" > n-3
84 echo ":recheck: no $tab$tab " > n-4
101 echo " $tab $tab$tab :recheck: no" > n-8
103 # The :test-result: fields should be irrelevant for the decision of
104 # whether "make recheck" should or should not re-run a test.
109 :test-result: UNKNOWN
113 rechecked=`echo y-[0-9]*`
115 for t in [yn]-[0-9]*; do echo $t; done \
116 | sed 's/.*/TESTS += &/' >> Makefile.am
118 cat Makefile.am # For debugging.
120 cat > dummy-driver <<'END'
123 while test $# -gt 0; do
125 --log-file) log_file=$2; shift;;
126 --trs-file) trs_file=$2; shift;;
127 --test-name) test_name=$2; shift;;
128 --expect-failure|--color-tests|--enable-hard-errors) shift;;
130 *) echo "$0: invalid option/argument: '$1'" >&2; exit 2;;
138 chmod a+x dummy-driver
146 # The ':test-result:' fields should be ignored by "make recheck",
147 # but should cause the testsuite report to detect errors.
148 $MAKE check && Exit 1
150 for t in $tests; do test -f $t.run; done
153 # But now the tests that actually get re-run have only ':test-result:'
154 # fields indicating success, so "make recheck" must pass. Still, the
155 # next "make recheck" call should still re-run the same set of tests.
156 for iteration in 1 2; do
159 for t in $rechecked; do test -f $t.run; done
160 find . -name 'n-*.run' | grep . && Exit 1
161 : For shells with busted 'set -e'.