#! /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 . # Test the "make recheck" semantics for custom test drivers, as documented # in the Automake manual. . test-init.sh cat >> configure.ac << 'END' AC_OUTPUT END cat > Makefile.am << 'END' LOG_DRIVER = ./dummy-driver TEST_EXTENSIONS = TESTS = END # # Tests to be re-run by "make recheck" # : > y-1 echo "foo bar" > y-2 echo ":recheck:" > y-3 echo ":recheck:yes" > y-4 echo ":recheck: who cares" > y-5 echo ":recheck: $tab y" > y-6 echo ":recheck: yeah!$tab$tab " > y-7 cat > y-10 < y-11 < y-12 < 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-100 echo "PASS: y-101" cat > y-102 < n-1 echo ":recheck: no " > n-2 echo ":recheck: $tab no" > n-3 echo ":recheck: no $tab$tab " > n-4 cat > n-5 < n-6 < n-7 < 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 <> Makefile.am cat Makefile.am # For debugging. cat > dummy-driver <<'END' #!/bin/sh set -e; set -u while 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 shift done : > $test_name.run : > $log_file cp $1 $trs_file END chmod 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 1 ls -l for t in $tests; do test -f $t.run; done rm -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 :