| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 | #! /bin/sh# Copyright (C) 2011-2017 Free Software Foundation, Inc.## This program is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 2, or (at your option)# any later version.## This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# GNU General Public License for more details.## You should have received a copy of the GNU General Public License# along with this program.  If not, see <http://www.gnu.org/licenses/>.# Test the "make recheck" semantics for custom test drivers, as documented# in the Automake manual.. test-init.shcat >> configure.ac << 'END'AC_OUTPUTENDcat > Makefile.am << 'END'LOG_DRIVER = ./dummy-driverTEST_EXTENSIONS =TESTS =END## Tests to be re-run by "make recheck"#: > y-1echo "foo bar" > y-2echo ":recheck:" > y-3echo ":recheck:yes" > y-4echo ":recheck: who cares" > y-5echo ":recheck: $tab   y" > y-6echo ":recheck: yeah!$tab$tab " > y-7cat > y-10 <<END:foo::recheck: ???ENDcat > y-11 <<END:recheck: YES:foo:ENDcat > y-12 <<ENDfoo:recheck:yesbarzardozENDecho "  $tab $tab$tab    :recheck: yes" > y-8# The :test-result: fields and the fist line of the log should be# irrelevant for the decision of whether "make recheck" should or# should not re-run a test.echo ":test-result: PASS" > y-100echo "PASS: y-101"cat > y-102 <<ENDPASS: y-102===========:test-result: PASSEND## Tests *not* to be re-run by "make recheck"#echo ":recheck:no" > n-1echo ":recheck: no " > n-2echo ":recheck: $tab   no" > n-3echo ":recheck: no $tab$tab " > n-4cat > n-5 <<END:foo::recheck:noENDcat > n-6 <<END:recheck: no:foo:ENDcat > n-7 <<ENDfoo:recheck: no$tab$tabbarzardozENDecho "  $tab $tab$tab    :recheck: no" > n-8# The :test-result: fields should be irrelevant for the decision of# whether "make recheck" should or should not re-run a test.cat > n-100 <<END:test-result: FAIL:test-result: XPASS:test-result: ERROR:test-result: UNKNOWN:recheck: noENDrechecked=$(echo y-[0-9]*)for t in [yn]-[0-9]*; do echo $t; done \  | sed 's/.*/TESTS += &/' >> Makefile.amcat Makefile.am # For debugging.cat > dummy-driver <<'END'#!/bin/shset -e; set -uwhile test $# -gt 0; do  case $1 in    --log-file) log_file=$2; shift;;    --trs-file) trs_file=$2; shift;;    --test-name) test_name=$2; shift;;    --expect-failure|--color-tests|--enable-hard-errors) shift;;    --) shift; break;;     *) echo "$0: invalid option/argument: '$1'" >&2; exit 2;;  esac  shiftdone: > $test_name.run: > $log_filecp $1 $trs_fileENDchmod a+x dummy-driver$ACLOCAL$AUTOCONF$AUTOMAKE./configure# The ':test-result:' fields should be ignored by "make recheck",# but should cause the testsuite report to detect errors.$MAKE check && exit 1ls -lfor t in $tests; do test -f $t.run; donerm -f *.run# But now the tests that actually get re-run have only ':test-result:'# fields indicating success, so "make recheck" must pass.  Still, the# next "make recheck" call should still re-run the same set of tests.for iteration in 1 2; do  using_gmake || $sleep # Required by BSD make.  $MAKE recheck  ls -l  for t in $rechecked; do test -f $t.run; done  find . -name 'n-*.run' | grep . && exit 1  : For shells with busted 'set -e'.done:
 |