# guaranteed to work on my machine.
syntax_check_rules = \
$(sc_tests_plain_check_rules) \
-sc_test_names \
sc_diff_automake_in_automake \
sc_diff_aclocal_in_automake \
sc_perl_syntax \
sc_perl_local \
sc_AMDEP_TRUE_in_automake_in \
sc_tests_make_without_am_makeflags \
+$(sc_obsolete_requirements_rules) \
sc_tests_obsolete_variables \
sc_tests_here_document_format \
+ sc_tests_command_subst \
sc_tests_Exit_not_exit \
sc_tests_automake_fails \
sc_tests_required_after_defs \
sc_tabs_in_texi \
sc_at_in_texi
-## Look for test whose names can cause spurious failures when used as
-## first argument to AC_INIT (chiefly because they might contain an
-## m4/m4sugar builtin or macro name).
-m4_builtins = \
- __gnu__ \
- __unix__ \
- bpatsubst \
- bregexp \
- builtin \
- changecom \
- changequote \
- changeword \
- debugfile \
- debugmode \
- decr \
- define \
- defn \
- divert \
- divnum \
- dnl \
- dumpdef \
- errprint \
- esyscmd \
- eval \
- format \
- ifdef \
- ifelse \
- include \
- incr \
- index \
- indir \
- len \
- m4exit \
- m4wrap \
- maketemp \
- mkstemp \
- patsubst \
- popdef \
- pushdef \
- regexp \
- shift \
- sinclude \
- substr \
- symbols \
- syscmd \
- sysval \
- traceoff \
- traceon \
- translit \
- undefine \
- undivert
-sc_test_names:
- @m4_builtin_rx=`echo $(m4_builtins) | sed 's/ /|/g'`; \
- m4_macro_rx="\\<($$m4_builtin_rx)\\>|\\<_?(A[CUMHS]|m4)_"; \
- if { \
- for t in $(xtests); do echo $$t; done \
- | LC_ALL=C grep -E "$$m4_macro_rx"; \
- }; then \
- echo "the names of the tests above can be problematic" 1>&2; \
- echo "Avoid test names that contain names of m4 macros" 1>&2; \
- exit 1; \
- fi
-
## These check avoids accidental configure substitutions in the source.
## There are exactly 9 lines that should be modified from automake.in to
## automake, and 10 lines that should be modified from aclocal.in to
exit 1; \
else :; fi
+## Look out for obsolete requirements specified in the test cases.
+sc_obsolete_requirements_rules = sc_no_texi2dvi-o sc_no_makeinfo-html
+modern-requirement.texi2dvi-o = texi2dvi
+modern-requirement.makeinfo-html = makeinfo
+
+$(sc_obsolete_requirements_rules): sc_no_% :
+ @if grep -E 'required=.*\b$*\b' $(xtests); then \
+ echo "Requirement '$*' is obsolete and shouldn't" \
+ "be used anymore." >&2; \
+ echo "You should use '$(modern-requirement.$*)' instead." >&2; \
+ exit 1; \
+ fi
+
## Tests should never call some programs directly, but only through the
## corresponding variable (e.g., '$MAKE', not 'make'). This will allow
## the programs to be overridden at configure time (for less brittleness)
exit 1; \
fi
+ ## Our test case should use the $(...) POSIX form for command substitution,
+ ## rather than the older `...` form.
+ ## The point of ignoring text on here-documents is that we want to exempt
+ ## Makefile.am rules, configure.ac code and helper shell script created and
+ ## used by out shell scripts, because Autoconf (as of version 2.69) does not
+ ## yet ensure that $CONFIG_SHELL will be set to a proper POSIX shell.
+ sc_tests_command_subst:
+ @found=false; \
+ scan () { \
+ sed -n -e '/^#/d' \
+ -e '/<<.*END/,/^END/b' -e '/<<.*EOF/,/^EOF/b' \
+ -e 's/\\`/\\{backtick}/' \
+ -e "s/[^\\]'\([^']*\`[^']*\)*'/'{quoted-text}'/g" \
+ -e '/`/p' $$*; \
+ }; \
+ for file in $(xtests); do \
+ res=`scan $$file`; \
+ if test -n "$$res"; then \
+ echo "$$file:$$res"; \
+ found=true; \
+ fi; \
+ done; \
+ if $$found; then \
+ echo 'Use $$(...), not `...`, for command substitutions.' >&2; \
+ exit 1; \
+ fi
+
## Tests should never call exit directly, but use Exit.
## This is so that the exit status is transported correctly across the 0 trap.
## Ignore comments and our testsuite's own self tests.
cat > configure.ac <<END
AC_INIT([GNU AutoTAP], [5.12], [bug-automake@gnu.org])
-AM_INIT_AUTOMAKE([parallel-tests])
+AM_INIT_AUTOMAKE
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
END
}
if test $use_colors = yes; then
- red='\e[0;31m'
- grn='\e[0;32m'
- lgn='\e[1;32m'
- blu='\e[1;34m'
- mgn='\e[0;35m'
- brg='\e[1m'
- std='\e[m'
+ red="$esc[0;31m"
+ grn="$esc[0;32m"
+ lgn="$esc[1;32m"
+ blu="$esc[1;34m"
+ mgn="$esc[0;35m"
+ brg="$esc[1m"
+ std="$esc[m"
echo AUTOMAKE_OPTIONS = color-tests >> Makefile.am
else
red= grn= lgn= blu= mgn= brg= std=
# Test scripts can override it if they need to (but this should
# be done carefully).
if test -z "$me"; then
- # Guard against failure to spawn sed (seen on MSYS), or empty $argv0.
- me=`echo "$argv0" | sed -e 's,.*[\\/],,;s/\.sh$//;s/\.tap$//'` \
- && test -n "$me" \
- || { echo "$argv0: failed to define \$me" >&2; exit 99; }
+ # Strip all directory components.
+ me=${argv0##*/}
+ # Strip test suffix.
+ case $me in
+ *.tap) me=${me%.tap};;
+ *.sh) me=${me%.sh} ;;
+ esac
fi
# A newline character.
nl='
'
+ # A literal escape character. Used by test checking colored output.
+ esc='\e'
# As autoconf-generated configure scripts do, ensure that IFS
# is defined initially, so that saving and restoring $IFS works.
*) FC=$F77 FCFLAGS=$FFLAGS; export FC FCFLAGS;;
esac
;;
+ grep-nonprint)
+ # Check that grep can parse nonprinting characters correctly.
+ # BSD 'grep' works from a pipe, but not a seekable file.
+ # GNU or BSD 'grep -a' works on files, but is not portable.
+ case $(echo "$esc" | grep .)$(echo "$esc" | grep "$esc") in
+ "$esc$esc") ;;
+ *) skip_ "grep can't handle nonprinting characters correctly";;
+ esac
+ ;;
javac)
# The Java compiler from JDK 1.5 (and presumably earlier versions)
# cannot handle the '-version' option by itself: it bails out
makedepend -f- \
|| skip_all_ "required program 'makedepend' not available"
;;
- makeinfo-html)
- # Make sure we have makeinfo, and it understands '--html'.
- echo "$me: running makeinfo --html --version"
- makeinfo --html --version \
- || skip_all_ "cannot find a makeinfo program that groks" \
- "the '--html' option"
- ;;
mingw)
uname_s=$(uname -s || echo UNKNOWN)
echo "$me: system name: $uname_s"
skip_all_ "TeX is required, but it wasn't found by configure"
fi
;;
- texi2dvi-o)
- # Texi2dvi supports '-o' since Texinfo 4.1.
- echo "$me: running texi2dvi -o /dev/null --version"
- texi2dvi -o /dev/null --version \
- || skip_all_ "required program 'texi2dvi' not available"
- ;;
lex)
test x"$LEX" = x"false" && skip_all_ "lex not found or disabled"
export LEX
{
echo "AC_INIT([$me], [1.0])"
if test x"$am_serial_tests" = x"yes"; then
- echo "AM_INIT_AUTOMAKE"
+ echo "AM_INIT_AUTOMAKE([serial-tests])"
else
- echo "AM_INIT_AUTOMAKE([parallel-tests])"
+ echo "AM_INIT_AUTOMAKE"
fi
echo "AC_CONFIG_FILES([Makefile])"
} >configure.ac || framework_failure_ "creating configure.ac skeleton"
# Colorized output from the testsuite report shouldn't end up in log files.
+ required='grep-nonprint'
. ./defs || Exit 1
- esc='\e'
-
- # Check that grep can parse nonprinting characters.
- # BSD 'grep' works from a pipe, but not a seekable file.
- # GNU or BSD 'grep -a' works on files, but is not portable.
- case `echo "$esc" | $FGREP "$esc"` in
- "$esc") ;;
- # Creative quoting below to please maintainer-check.
- *) echo "$me: f""grep can't parse nonprinting characters" >&2; Exit 77;;
- esac
-
TERM=ansi; export TERM
cat >>configure.ac <<END
cat >Makefile.am <<'END'
LOG_COMPILER = $(SHELL)
-AUTOMAKE_OPTIONS = color-tests parallel-tests
+AUTOMAKE_OPTIONS = color-tests
TESTS = pass fail skip xpass xfail error
XFAIL_TESTS = xpass xfail
END
./configure
mv config.log config-log # Avoid possible false positives below.
AM_COLOR_TESTS=always $MAKE -e check && Exit 1
- $FGREP "$esc" *.log && Exit 1
+ # Not a useless use of cat; see above comments "grep-nonprinting"
+ # requirement in 'test-init.sh'.
+ cat *.log | grep "$esc" && Exit 1
:
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Check that the parallel-tests driver correctly handle overrides of the
+# Check that the testsuite harness correctly handle overrides of the
# TERM variable by either TESTS_ENVIRONMENT and AM_TESTS_ENVIRONMENT.
+ required='grep-nonprint'
. ./defs || Exit 1
- esc='\e['
-
TERM=ansi; export TERM
- # Check that grep can parse nonprinting characters.
- # BSD 'grep' works from a pipe, but not a seekable file.
- # GNU or BSD 'grep -a' works on files, but is not portable.
- case `echo "$esc" | $FGREP "$esc"` in
- "$esc") ;;
- *) skip_ "$FGREP can't parse nonprinting characters" ;;
- esac
-
cat >> configure.ac << 'END'
AC_OUTPUT
END
./configure
mkcheck TESTS_ENVIRONMENT='TERM=dumb'
- cat stdout | grep "PASS.*foobar" | $FGREP "$esc"
+ cat stdout | grep "PASS.*foobar" | grep "$esc\\["
mkcheck AM_TESTS_ENVIRONMENT='TERM=dumb'
- cat stdout | grep "PASS.*foobar" | $FGREP "$esc"
+ cat stdout | grep "PASS.*foobar" | grep "$esc\\["
:
# for more vers*.texi files, and does not require makeinfo, tex and
# texi2dvi.
- required='makeinfo tex texi2dvi'
-required='makeinfo tex texi2dvi-o grep-nonprint'
++required='makeinfo tex texi2dvi grep-nonprint'
. ./defs || Exit 1
test $(LC_ALL=C date '+%u') -gt 0 && test $(LC_ALL=C date '+%u') -lt 8 \
|| skip_ "'date' is not POSIX-compliant enough"
day=$(echo "$day" | sed 's/^0//')
- (echo '\ex\a' | grep x) \
- || skip_ "grep doesn't work on input that is not pure text"
-
cat > configure.ac << END
AC_INIT([$me], [123.456])
AM_INIT_AUTOMAKE
include defs.am
info_TEXINFOS = foo.texi
test-grepinfo:
- ## Not useless uses of cat: we only tested that grep worked on
+ ## Not useless uses of cat: we only tested that grep works on
## non-text input when that's given from a pipe.
cat $(srcdir)/foo.info | grep 'GREPVERSION=$(my_version_rx)='
cat $(srcdir)/foo.info | grep 'GREPEDITION=$(my_version_rx)='