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.
22 cat >> configure.ac << 'END'
26 cat > Makefile.am << 'END'
27 LOG_DRIVER = ./dummy-driver
33 # Tests to be re-run by "make recheck"
38 echo ":recheck:" > y-3
39 echo ":recheck:yes" > y-4
40 echo ":recheck: who cares" > y-5
41 echo ":recheck: $tab y" > y-6
42 echo ":recheck: yeah!$tab$tab " > y-7
59 echo " $tab $tab$tab :recheck: yes" > y-8
61 # The :test-result: fields and the fist line of the log should be
62 # irrelevant for the decision of whether "make recheck" should or
63 # should not re-run a test.
65 echo ":test-result: PASS" > y-100
77 # Tests *not* to be re-run by "make recheck"
80 echo ":recheck:no" > n-1
81 echo ":recheck: no " > n-2
82 echo ":recheck: $tab no" > n-3
83 echo ":recheck: no $tab$tab " > n-4
100 echo " $tab $tab$tab :recheck: no" > n-8
102 # The :test-result: fields should be irrelevant for the decision of
103 # whether "make recheck" should or should not re-run a test.
108 :test-result: UNKNOWN
112 rechecked=$(echo y-[0-9]*)
114 for t in [yn]-[0-9]*; do echo $t; done \
115 | sed 's/.*/TESTS += &/' >> Makefile.am
117 cat Makefile.am # For debugging.
119 cat > dummy-driver <<'END'
122 while test $# -gt 0; do
124 --log-file) log_file=$2; shift;;
125 --trs-file) trs_file=$2; shift;;
126 --test-name) test_name=$2; shift;;
127 --expect-failure|--color-tests|--enable-hard-errors) shift;;
129 *) echo "$0: invalid option/argument: '$1'" >&2; exit 2;;
137 chmod a+x dummy-driver
145 # The ':test-result:' fields should be ignored by "make recheck",
146 # but should cause the testsuite report to detect errors.
147 $MAKE check && Exit 1
149 for t in $tests; do test -f $t.run; done
152 # But now the tests that actually get re-run have only ':test-result:'
153 # fields indicating success, so "make recheck" must pass. Still, the
154 # next "make recheck" call should still re-run the same set of tests.
155 for iteration in 1 2; do
158 for t in $rechecked; do test -f $t.run; done
159 find . -name 'n-*.run' | grep . && Exit 1
160 : For shells with busted 'set -e'.