The new TAP driver is finally starting to pay some dividends, allowing a couple of nice simplifications in the testsuite. See the two attached patches, already pushed to the 'tap-testsuite-work'.
Regards, Stefano
From 8b4dfc2d2923fd5d232b4b20ce147168b3532ab3 Mon Sep 17 00:00:00 2001 Message-Id: <8b4dfc2d2923fd5d232b4b20ce147168b3532ab3.1312647476.git.stefano.lattar...@gmail.com> From: Stefano Lattarini <[email protected]> Date: Sat, 6 Aug 2011 12:35:05 +0200 Subject: [PATCH 1/2] testsuite: use TAP for `instspc*' tests, related simplifications * tests/instspc-tests.sh: Delete this complex and multifarious script, moving all it checks it used to perform into ... * tests/instspc.tap: ... this TAP-based test script. * tests/instspc-data.test: Deleted. * tests/Makefile.am ($(srcdir)/instspc-tests.am): Don't include nor generate it anymore. (EXTRA_DIST): Don't distribute instspc-tests.sh anymore. (TEST_EXTENSIONS): Remove '.instspc'. (INSTSPC_LOG_COMPILER): Deleted. (XFAIL_TESTS): Remove $(instspc_xfail_tests). (instspc-data.log, $(instspc_tests:.instspc=.log)): Delete dependencies for these files, which are not used anymore. ($(instspc_tests)): Delete this dummy dependency declaration. (TESTS): Remove $(instspc_tests). (handwritten_tests): Remove instspc-data.test, add instspc.tap. * bootstrap: Don't generate tests/instspc-tests.am anymore. --- ChangeLog | 20 +++ bootstrap | 1 - tests/Makefile.am | 29 +--- tests/Makefile.in | 119 +++------------ tests/instspc-data.test | 31 ---- tests/{instspc-tests.sh => instspc.tap} | 245 +++++++++++-------------------- 6 files changed, 133 insertions(+), 312 deletions(-) delete mode 100755 tests/instspc-data.test rename tests/{instspc-tests.sh => instspc.tap} (53%) diff --git a/ChangeLog b/ChangeLog index 6f58794..2af559c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,25 @@ 2011-08-06 Stefano Lattarini <[email protected]> + testsuite: use TAP for `instspc*' tests, related simplifications + * tests/instspc-tests.sh: Delete this complex and multifarious + script, moving all it checks it used to perform into ... + * tests/instspc.tap: ... this TAP-based test script. + * tests/instspc-data.test: Deleted. + * tests/Makefile.am ($(srcdir)/instspc-tests.am): Don't include + nor generate it anymore. + (EXTRA_DIST): Don't distribute instspc-tests.sh anymore. + (TEST_EXTENSIONS): Remove '.instspc'. + (INSTSPC_LOG_COMPILER): Deleted. + (XFAIL_TESTS): Remove $(instspc_xfail_tests). + (instspc-data.log, $(instspc_tests:.instspc=.log)): Delete + dependencies for these files, which are not used anymore. + ($(instspc_tests)): Delete this dummy dependency declaration. + (TESTS): Remove $(instspc_tests). + (handwritten_tests): Remove instspc-data.test, add instspc.tap. + * bootstrap: Don't generate tests/instspc-tests.am anymore. + +2011-08-06 Stefano Lattarini <[email protected]> + testsuite: do fd redirections with $(AM_TESTS_FD_REDIRECT) * tests/Makefile.am: The redirections of file descriptors needed by our test scripts is now done using the $(AM_TESTS_FD_REDIRECT) diff --git a/bootstrap b/bootstrap index aafc6eb..1abf39b 100755 --- a/bootstrap +++ b/bootstrap @@ -107,7 +107,6 @@ dosubst automake.in automake.tmp cd tests $BOOTSTRAP_SHELL ./gen-parallel-tests > parallel-tests.am $BOOTSTRAP_SHELL ./gen-config-shell-tests > config-shell-tests.am -$BOOTSTRAP_SHELL ./instspc-tests.sh --generate-makefile > instspc-tests.am $BOOTSTRAP_SHELL ./depmod-tests.sh --generate-makefile > depmod-tests.am cd .. diff --git a/tests/Makefile.am b/tests/Makefile.am index 6a404c7..182e987 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -66,28 +66,6 @@ $(parallel_tests:.ptest=.log): parallel-tests.sh $(parallel_tests): -include $(srcdir)/instspc-tests.am - -TEST_EXTENSIONS += .instspc -INSTSPC_LOG_COMPILER = $(SHELL) $(srcdir)/instspc-tests.sh -EXTRA_DIST += instspc-tests.sh - -$(srcdir)/instspc-tests.am: instspc-tests.sh Makefile.am - $(AM_V_GEN)($(am__cd) $(srcdir) \ - && $(SHELL) ./instspc-tests.sh --generate-makefile) >$@ - -# All `*.instspc' tests work by calling the script `instspc-tests.sh'. -# Also, they all use shared data generated by the `instspc-data.test' -# helper test (for reasons of speed). -instspc-data.log: instspc-tests.sh -$(instspc_tests:.instspc=.log): instspc-tests.sh instspc-data.log -# This dummy declaration is required to have make actually produce -# expected log files from the `.instspc.log' suffix rule. -$(instspc_tests): - -XFAIL_TESTS += $(instspc_xfail_tests) - - include $(srcdir)/depmod-tests.am $(srcdir)/depmod-tests.am: depmod-tests.sh Makefile.am @@ -149,12 +127,14 @@ TESTS = \ $(handwritten_tests) \ $(config_shell_tests) \ $(parallel_tests) \ - $(depmod_tests) \ - $(instspc_tests) + $(depmod_tests) EXTRA_DIST += $(handwritten_tests) handwritten_tests = \ +## This test should take a long time, so put it first to improve +## performance on concurrent testsuite runs. +instspc.tap \ aclocal.test \ aclocal3.test \ aclocal4.test \ @@ -577,7 +557,6 @@ instman2.test \ instmany.test \ instmany-mans.test \ instmany-python.test \ -instspc-data.test \ interp.test \ interp2.test \ java.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index c79e523..47a1b69 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -53,8 +53,7 @@ DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/aclocal.in $(srcdir)/automake.in \ $(srcdir)/config-shell-tests.am $(srcdir)/defs \ $(srcdir)/defs-static.in $(srcdir)/depmod-tests.am \ - $(srcdir)/instspc-tests.am $(srcdir)/parallel-tests.am \ - $(top_srcdir)/CheckListOfTests.am + $(srcdir)/parallel-tests.am $(top_srcdir)/CheckListOfTests.am subdir = tests ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/amversion.m4 \ @@ -187,15 +186,11 @@ am__test_logs4 = $(am__test_logs3:.ptest.log=.log) PTEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/lib/test-driver PTEST_LOG_COMPILE = $(PTEST_LOG_COMPILER) $(AM_PTEST_LOG_FLAGS) \ $(PTEST_LOG_FLAGS) -am__test_logs5 = $(am__test_logs4:.instspc.log=.log) -INSTSPC_LOG_DRIVER = $(SHELL) $(top_srcdir)/lib/test-driver -INSTSPC_LOG_COMPILE = $(INSTSPC_LOG_COMPILER) $(AM_INSTSPC_LOG_FLAGS) \ - $(INSTSPC_LOG_FLAGS) -am__test_logs6 = $(am__test_logs5:.depmod.log=.log) +am__test_logs5 = $(am__test_logs4:.depmod.log=.log) DEPMOD_LOG_DRIVER = $(SHELL) $(top_srcdir)/lib/test-driver DEPMOD_LOG_COMPILE = $(DEPMOD_LOG_COMPILER) $(AM_DEPMOD_LOG_FLAGS) \ $(DEPMOD_LOG_FLAGS) -TEST_LOGS = $(am__test_logs6:.shtst.log=.log) +TEST_LOGS = $(am__test_logs5:.shtst.log=.log) SHTST_LOG_DRIVER = $(SHELL) $(top_srcdir)/lib/test-driver SHTST_LOG_COMPILE = $(SHTST_LOG_COMPILER) $(AM_SHTST_LOG_FLAGS) \ $(SHTST_LOG_FLAGS) @@ -298,25 +293,32 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -TEST_EXTENSIONS = .test .tap .ptest .instspc .depmod .shtst +TEST_EXTENSIONS = .test .tap .ptest .depmod .shtst TAP_LOG_DRIVER = $(PERL) $(top_srcdir)/lib/tap-driver TAP_LOG_DRIVER_FLAGS = --merge --comments --diagnostic-string `printf \ '\043%%\043\n'` MAINTAINERCLEANFILES = EXTRA_DIST = ChangeLog-old gen-parallel-tests parallel-tests.sh \ - instspc-tests.sh depmod-tests.sh gen-config-shell-tests \ - config-shell-tests.sh $(handwritten_tests) tap-functions.sh \ - plain-functions.sh trivial-test-driver \ - testsuite-summary-checks.sh extract-testsuite-summary \ - tap-setup.sh tap-summary-aux.sh + depmod-tests.sh gen-config-shell-tests config-shell-tests.sh \ + $(handwritten_tests) tap-functions.sh plain-functions.sh \ + trivial-test-driver testsuite-summary-checks.sh \ + extract-testsuite-summary tap-setup.sh tap-summary-aux.sh # Run the tests with the shell detected at configure time. TEST_LOG_COMPILER = $(SHELL) -XFAIL_TESTS = all.test auxdir2.test cond17.test gcj6.test \ - override-conditional-2.test pr8365-remake-timing.test \ - yacc-dist-nobuild-subdir.test tap-plan-corner2.test \ - tap-message-0.test tap-signal.test txinfo5.test \ - $(instspc_xfail_tests) +XFAIL_TESTS = \ +all.test \ +auxdir2.test \ +cond17.test \ +gcj6.test \ +override-conditional-2.test \ +pr8365-remake-timing.test \ +yacc-dist-nobuild-subdir.test \ +tap-plan-corner2.test \ +tap-message-0.test \ +tap-signal.test \ +txinfo5.test + parallel_tests = backcompat5-p.ptest check-exported-srcdir-p.ptest \ check-fd-redirect-p.ptest check-subst-prog-p.ptest \ check-subst-p.ptest check-tests-in-builddir-p.ptest \ @@ -327,58 +329,6 @@ parallel_tests = backcompat5-p.ptest check-exported-srcdir-p.ptest \ maken3-p.ptest maken4-p.ptest posixsubst-tests-p.ptest \ tests-environment-p.ptest PTEST_LOG_COMPILER = $(SHELL) $(srcdir)/parallel-tests.sh -instspc_tests = build-squote.instspc install-squote.instspc \ - build-dquote.instspc install-dquote.instspc \ - build-bquote.instspc install-bquote.instspc \ - build-sharp.instspc install-sharp.instspc build-dollar.instspc \ - install-dollar.instspc build-bang.instspc install-bang.instspc \ - build-bslash.instspc install-bslash.instspc \ - build-ampersand.instspc install-ampersand.instspc \ - build-percent.instspc install-percent.instspc \ - build-leftpar.instspc install-leftpar.instspc \ - build-rightpar.instspc install-rightpar.instspc \ - build-pipe.instspc install-pipe.instspc build-caret.instspc \ - install-caret.instspc build-tilde.instspc \ - install-tilde.instspc build-qmark.instspc \ - install-qmark.instspc build-star.instspc install-star.instspc \ - build-plus.instspc install-plus.instspc build-minus.instspc \ - install-minus.instspc build-comma.instspc \ - install-comma.instspc build-colon.instspc \ - install-colon.instspc build-semicol.instspc \ - install-semicol.instspc build-equal.instspc \ - install-equal.instspc build-less.instspc install-less.instspc \ - build-more.instspc install-more.instspc build-at.instspc \ - install-at.instspc build-lqbrack.instspc \ - install-lqbrack.instspc build-rqbrack.instspc \ - install-rqbrack.instspc build-lcbrack.instspc \ - install-lcbrack.instspc build-rcbrack.instspc \ - install-rcbrack.instspc build-space.instspc \ - install-space.instspc build-tab.instspc install-tab.instspc \ - build-linefeed.instspc install-linefeed.instspc \ - build-backspace.instspc install-backspace.instspc \ - build-formfeed.instspc install-formfeed.instspc \ - build-carriageret.instspc install-carriageret.instspc \ - build-quadrigraph0.instspc install-quadrigraph0.instspc \ - build-quadrigraph1.instspc install-quadrigraph1.instspc \ - build-quadrigraph2.instspc install-quadrigraph2.instspc \ - build-quadrigraph3.instspc install-quadrigraph3.instspc \ - build-quadrigraph4.instspc install-quadrigraph4.instspc \ - build-a_b.instspc install-a_b.instspc build-a__b.instspc \ - install-a__b.instspc build-a_lf_b.instspc \ - install-a_lf_b.instspc build-dotdotdot.instspc \ - install-dotdotdot.instspc build-dosdrive.instspc \ - install-dosdrive.instspc build-miscglob1.instspc \ - install-miscglob1.instspc build-miscglob2.instspc \ - install-miscglob2.instspc -instspc_xfail_tests = build-squote.instspc build-dquote.instspc \ - build-bquote.instspc build-sharp.instspc build-dollar.instspc \ - build-bslash.instspc build-ampersand.instspc \ - build-linefeed.instspc build-quadrigraph0.instspc \ - build-a_lf_b.instspc install-squote.instspc \ - install-dquote.instspc install-bquote.instspc \ - install-sharp.instspc install-dollar.instspc \ - install-linefeed.instspc install-a_lf_b.instspc -INSTSPC_LOG_COMPILER = $(SHELL) $(srcdir)/instspc-tests.sh depmod_tests = depcomp-gcc3.depmod depcomp-gcc.depmod \ depcomp-hp.depmod depcomp-sgi.depmod depcomp-aix.depmod \ depcomp-icc.depmod depcomp-hp2.depmod depcomp-tru64.depmod \ @@ -416,10 +366,10 @@ TESTS = \ $(handwritten_tests) \ $(config_shell_tests) \ $(parallel_tests) \ - $(depmod_tests) \ - $(instspc_tests) + $(depmod_tests) handwritten_tests = \ +instspc.tap \ aclocal.test \ aclocal3.test \ aclocal4.test \ @@ -842,7 +792,6 @@ instman2.test \ instmany.test \ instmany-mans.test \ instmany-python.test \ -instspc-data.test \ interp.test \ interp2.test \ java.test \ @@ -1508,8 +1457,8 @@ am__tdf = diff-in-tests-lists.tmp all: all-am .SUFFIXES: -.SUFFIXES: .depmod .html .instspc .log .ptest .shtst .tap .test .trs -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/parallel-tests.am $(srcdir)/instspc-tests.am $(srcdir)/depmod-tests.am $(srcdir)/config-shell-tests.am $(top_srcdir)/CheckListOfTests.am $(am__configure_deps) +.SUFFIXES: .depmod .html .log .ptest .shtst .tap .test .trs +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/parallel-tests.am $(srcdir)/depmod-tests.am $(srcdir)/config-shell-tests.am $(top_srcdir)/CheckListOfTests.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -1732,11 +1681,6 @@ recheck recheck-html: --log-file '$*.log' --trs-file '$*.trs' \ $(am__common_driver_flags) $(AM_PTEST_LOG_DRIVER_FLAGS) $(PTEST_LOG_DRIVER_FLAGS) -- $(PTEST_LOG_COMPILE) "$$tst" \ $(AM_TESTS_FD_REDIRECT) -.instspc.log: - @p='$<'; $(am__check_pre) $(INSTSPC_LOG_DRIVER) --test-name "$$f" \ - --log-file '$*.log' --trs-file '$*.trs' \ - $(am__common_driver_flags) $(AM_INSTSPC_LOG_DRIVER_FLAGS) $(INSTSPC_LOG_DRIVER_FLAGS) -- $(INSTSPC_LOG_COMPILE) "$$tst" \ - $(AM_TESTS_FD_REDIRECT) .depmod.log: @p='$<'; $(am__check_pre) $(DEPMOD_LOG_DRIVER) --test-name "$$f" \ --log-file '$*.log' --trs-file '$*.trs' \ @@ -1933,19 +1877,6 @@ $(parallel_tests:.ptest=.log): parallel-tests.sh # expected log files from the `.ptest.log' suffix rule. $(parallel_tests): -$(srcdir)/instspc-tests.am: instspc-tests.sh Makefile.am - $(AM_V_GEN)($(am__cd) $(srcdir) \ - && $(SHELL) ./instspc-tests.sh --generate-makefile) >$@ - -# All `*.instspc' tests work by calling the script `instspc-tests.sh'. -# Also, they all use shared data generated by the `instspc-data.test' -# helper test (for reasons of speed). -instspc-data.log: instspc-tests.sh -$(instspc_tests:.instspc=.log): instspc-tests.sh instspc-data.log -# This dummy declaration is required to have make actually produce -# expected log files from the `.instspc.log' suffix rule. -$(instspc_tests): - $(srcdir)/depmod-tests.am: depmod-tests.sh Makefile.am $(AM_V_GEN)($(am__cd) $(srcdir) \ && $(SHELL) ./depmod-tests.sh --generate-makefile) >$@ diff --git a/tests/instspc-data.test b/tests/instspc-data.test deleted file mode 100755 index 7b222ff..0000000 --- a/tests/instspc-data.test +++ /dev/null @@ -1,31 +0,0 @@ -#! /bin/sh -# Copyright (C) 2011 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/>. - -# Helper testcase which generate input data for the `*.instspc' tests. -# It basically delegates the work to the driver script `instspc-test.sh'. - -# Ensure proper definition of $testsrcdir. -# FIXME: we employ useless quoting below to please maintainer-check. -. ./defs-static || 'exit' 99 - -# Sanity check. -if test x"$testsrcdir" = x; then - echo "$0: \$testsrcdir not set after sourcing of ./defs-static" >&2 - # FIXME: we employ useless quoting below to please maintainer-check. - 'exit' 99 -fi - -exec $SHELL $testsrcdir/instspc-tests.sh --generate-data diff --git a/tests/instspc-tests.sh b/tests/instspc.tap similarity index 53% rename from tests/instspc-tests.sh rename to tests/instspc.tap index 9c6c968..ed57eb2 100755 --- a/tests/instspc-tests.sh +++ b/tests/instspc.tap @@ -14,70 +14,18 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -# -# Driver script to run tests checking that building from, or installing -# to, directories with shell metacharacters succeed. -# +# Check that building from, or installing to, directories with shell +# metacharacters succeed. # Original report from James Amundson about file names with spaces. # Other characters added by Paul Eggert. -# -# This script fulfills a threefold role: -# 1. It is called to generate a Makefile.am snippet, containing the -# definition of proper lists of tests. -# 2. It is called to set up a directory containing some common data -# files and autotools-generated files used by the aforementioned -# tests (this is done for speed reasons only). -# 3. It is called to properly run those tests, one at a time. -# -# Be more Bourne compatible (snippet copied from `tests/defs'). -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac -fi - -set -e - -# We need this early. It will be overridden when we source ./defs below, -# which will offer a more proper implementation. -fatal_ () { echo "$0: $*" >&2; exit 99; } - -case $# in - 0) fatal_ "missing argument";; - 1) ;; - *) fatal_ "too many arguments";; -esac - -case $1 in - --generate-makefile|--generate-data) - instspc_action=`expr x"$1" : x'--\(.*\)'` - ;; - build-*.instspc|*/build-*.instspc) - instspc_action=test-build - instspc_test_name=`expr /"$1" : '.*/build-\(.*\)\.instspc'` - ;; - install-*.instspc|*/install-*.instspc) - instspc_action=test-install - instspc_test_name=`expr /"$1" : '.*/install-\(.*\)\.instspc'` - ;; - *) - fatal_ "invalid argument '$1'" - ;; -esac +. ./defs || Exit 99 # Helper subroutine for test data definition. # Usage: define_problematic_string NAME STRING define_problematic_string () { - tst=$1 - shift + tst=$1; shift eval "instspc__$tst=\$1" \ || fatal_ "define_problematic_string: bad argument: '$tst'" shift @@ -94,16 +42,34 @@ define_problematic_string () esac } -# Helper subroutines for creation of input data files. +# Be sure to avoid interferences from the environment. +instspc_names_list='' +instspc_xfail_builds_list='' +instspc_xfail_installs_list='' + +expected_to_fail () +{ + case $1 in + build) + case " $instspc_xfail_builds_list " in + *" $2 "*) return 0 ;; + *) return 1 ;; + esac;; + dest) + case " $instspc_xfail_installs_list " in + *" $2 "*) return 0 ;; + *) return 1 ;; + esac;; + esac + fatal_ "incorrect 'expected_to_fail' usage" +} +# Helper subroutines for creation of input data files. create_input_data () { mkdir sub - unindent > configure.in << 'EOF' - AC_INIT([instspc], [1.0]) - AM_INIT_AUTOMAKE - AC_CONFIG_FILES([Makefile]) + unindent >> configure.in << 'EOF' AC_PROG_CC AC_PROG_RANLIB AC_OUTPUT @@ -147,8 +113,8 @@ EOF sub_libbase_a_SOURCES = source.c sub_libnobase_a_SOURCES = source.c - .PHONY: test-install-sep - test-install-sep: install + .PHONY: test-inst + test-inst: install test -f '$(DESTDIR)/$(file)-prefix/foo/sub/nobase.h' test ! -f '$(DESTDIR)/$(file)-prefix/foo/nobase.h' test -f '$(DESTDIR)/$(file)-prefix/foo/base.h' @@ -169,16 +135,8 @@ EOF $ACLOCAL $AUTOCONF $AUTOMAKE -a - - : > success } -# Be sure to avoid interferences from the environment. -instspc_names_list='' -instspc_xfail_builds_list='' -instspc_xfail_installs_list='' - - # ================= # # Test data begin # # ----------------- # @@ -248,96 +206,61 @@ unset def # Test data end # # =============== # +ocwd=`pwd` || fatal_ "cannot get current working directory" -if test x"$instspc_action" = x"generate-makefile"; then - # We must generate a makefile fragment on stdout. It must refer - # to all tests at once, hence the loop below. - echo '## Generated by instspc-tests.sh. DO NOT EDIT!' - echo 'instspc_tests =' - echo 'instspc_xfail_tests =' - for test_name in $instspc_names_list; do - echo "instspc_tests += build-$test_name.instspc" - echo "instspc_tests += install-$test_name.instspc" - done - for test_name in $instspc_xfail_builds_list; do - echo "instspc_xfail_tests += build-$test_name.instspc" - done - for test_name in $instspc_xfail_installs_list; do - echo "instspc_xfail_tests += install-$test_name.instspc" - done - exit 0 -fi - -# We'll need the full setup provided by `tests/defs'. Temporarily disable -# the errexit flag, since the setup code might not be prepared to deal -# with it. Also pre-set `$me' for `tests/defs', so that different calls -# to `instspc-tests.sh' won't try to use the same temporary directory. -# The actual tests require a C compiler, so require it for them; but do -# not require it when generating data, as it's not needed then. -if test x"$instspc_action" = x"generate-data"; then - me=instspc-data -else - required=cc - me=$instspc_action-$instspc_test_name -fi -set +e -. ./defs || Exit 99 -set -e - -# The directory set up by the `generate-data' action should contain all -# the files we need. So remove the other files created by ./defs. And -# check we really are in a temporary `*.dir' directory in the build tree, -# since the last thing we want is to remove some random user files! -test -f ../defs-static && test -f ../defs \ - && case `pwd` in *.dir) :;; *) false;; esac \ - || fatal_ "running from the wrong directory" -rm -f * - -if test x"$instspc_action" = x"generate-data"; then - # We must *not* remove the test directory, since its contents must be - # used by following dependent tests. - keep_testdirs=yes - create_input_data - Exit 0 -fi - -### If we are still here, we have to run a test ... - -eval "instspc_test_string=\${instspc__$instspc_test_name}" \ - && test x"$instspc_test_string" != x \ - || fatal_ "invalid test name: '$instspc_test_name'" - -if test ! -f ../instspc-data.dir/success; then - framework_failure_ "instspc-data.test failure" -fi - -# Skip if this system doesn't support these characters in file names. -mkdir "./$instspc_test_string" || Exit 77 - -case $instspc_action in - test-build) - dest=`pwd`/_dest - relbuilddir=../.. - cd "./$instspc_test_string" - ;; - test-install) - dest=`pwd`/$instspc_test_string - relbuilddir=.. - ;; - *) - fatal_ "invalid action '$instspc_action'" - ;; -esac - -$relbuilddir/instspc-data.dir/configure \ - --prefix "/$instspc_test_string-prefix" -$MAKE -# Some make implementations eliminate leading and trailing whitespace -# from macros passed on the command line, and some eliminate leading -# whitespace from macros set from environment variables, so prepend -# './' and use the latter here. -# Tru64 sh -e needs '|| Exit' in order to work correctly. -DESTDIR="$dest" file="./$instspc_test_string" $MAKE -e test-install-sep \ - || Exit 1 +create_input_data + +for test_name in $instspc_names_list; do + + eval "instspc_test_string=\${instspc__$test_name}" \ + && test x"$instspc_test_string" != x \ + || fatal_ "invalid test name: '$test_name'" + + # Skip the next checks if this system doesn't support the required + # characters in file names. + + mkdir "./$instspc_test_string" || \ + skip_row_ 2 -r "mkdir failed" "$test_name" + + for where in build dest; do + + case $where in + build) + build=./$instspc_test_string + dest=$ocwd/dest-$test_name + ;; + dest) + build=build-$test_name + dest=$ocwd/$instspc_test_string + mkdir "$build" || fatal_ "cannot create '$build'" + ;; + *) + fatal_ "invalid where '$where'" + ;; + esac + + cd "$build" || fatal_ "cannot chdir into '$build'" + + # Some make implementations eliminate leading and trailing whitespace + # from macros passed on the command line, and some eliminate leading + # whitespace from macros set from environment variables, so prepend + # './' and use the latter here. + r=ok + ../configure --prefix "/$instspc_test_string-prefix" \ + && $MAKE all \ + && DESTDIR="$dest" file="./$instspc_test_string" $MAKE -e test-inst \ + || r='not ok' + + tap_text="$test_name in ${where}dir" + if expected_to_fail "$where" "$test_name"; then + tap_text="$tap_text # TODO long-standing limitation" + fi + result_ "$r" "$tap_text" + + cd "$ocwd" || fatal_ "cannot chdir back to test directory" + + done # $instspc_action + +done # $test_name : -- 1.7.2.3
From 3ea0d41765a7f80a1a75e07151f015b793c363fe Mon Sep 17 00:00:00 2001 Message-Id: <3ea0d41765a7f80a1a75e07151f015b793c363fe.1312647476.git.stefano.lattar...@gmail.com> In-Reply-To: <8b4dfc2d2923fd5d232b4b20ce147168b3532ab3.1312647476.git.stefano.lattar...@gmail.com> References: <8b4dfc2d2923fd5d232b4b20ce147168b3532ab3.1312647476.git.stefano.lattar...@gmail.com> From: Stefano Lattarini <[email protected]> Date: Sat, 6 Aug 2011 14:20:08 +0200 Subject: [PATCH 2/2] testsuite: use TAP for `depmod*' tests, related simplifications * tests/depmod-tests.sh: Delete this complex and multifarious script, moving all it checks it used to perform into ... * tests/depmod.tap: ... this TAP-based test script. And extend it quite a bit, since the new form of the test was papering over some pre-existing failures (this was due to the fact that the values used for the VPATH were shorter in the new test script). * tests/depmod-data.test: Deleted. * tests/Makefile.am ($(srcdir)/depmod-tests.am): Don't include nor generate it anymore. (EXTRA_DIST): Don't distribute depmod-tests.sh anymore. (TEST_EXTENSIONS): Remove '.depmod'. (DEPMOD_LOG_COMPILER): Deleted. (depmod-data.log, $(depmod_tests:.depmod=.log)): Delete dependencies for these files, which are not used anymore. ($(depmod_tests)): Delete this dummy dependency declaration. (TESTS): Remove $(depmod_tests). (handwritten_tests): Remove depmod-data.test, add depmod.tap. * bootstrap: Don't generate tests/depmod-tests.am anymore. --- ChangeLog | 22 +++++ bootstrap | 1 - tests/Makefile.am | 30 +------ tests/Makefile.in | 50 ++--------- tests/depmod-data.test | 32 ------- tests/depmod-tests.sh | 226 ------------------------------------------------ tests/depmod.tap | 169 ++++++++++++++++++++++++++++++++++++ 7 files changed, 205 insertions(+), 325 deletions(-) delete mode 100755 tests/depmod-data.test delete mode 100755 tests/depmod-tests.sh create mode 100755 tests/depmod.tap diff --git a/ChangeLog b/ChangeLog index 2af559c..6509605 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,27 @@ 2011-08-06 Stefano Lattarini <[email protected]> + testsuite: use TAP for `depmod*' tests, related simplifications + * tests/depmod-tests.sh: Delete this complex and multifarious + script, moving all it checks it used to perform into ... + * tests/depmod.tap: ... this TAP-based test script. And extend + it quite a bit, since the new form of the test was papering over + some pre-existing failures (this was due to the fact that the + values used for the VPATH were shorter in the new test script). + * tests/depmod-data.test: Deleted. + * tests/Makefile.am ($(srcdir)/depmod-tests.am): Don't include + nor generate it anymore. + (EXTRA_DIST): Don't distribute depmod-tests.sh anymore. + (TEST_EXTENSIONS): Remove '.depmod'. + (DEPMOD_LOG_COMPILER): Deleted. + (depmod-data.log, $(depmod_tests:.depmod=.log)): Delete + dependencies for these files, which are not used anymore. + ($(depmod_tests)): Delete this dummy dependency declaration. + (TESTS): Remove $(depmod_tests). + (handwritten_tests): Remove depmod-data.test, add depmod.tap. + * bootstrap: Don't generate tests/depmod-tests.am anymore. + +2011-08-06 Stefano Lattarini <[email protected]> + testsuite: use TAP for `instspc*' tests, related simplifications * tests/instspc-tests.sh: Delete this complex and multifarious script, moving all it checks it used to perform into ... diff --git a/bootstrap b/bootstrap index 1abf39b..d289bdf 100755 --- a/bootstrap +++ b/bootstrap @@ -107,7 +107,6 @@ dosubst automake.in automake.tmp cd tests $BOOTSTRAP_SHELL ./gen-parallel-tests > parallel-tests.am $BOOTSTRAP_SHELL ./gen-config-shell-tests > config-shell-tests.am -$BOOTSTRAP_SHELL ./depmod-tests.sh --generate-makefile > depmod-tests.am cd .. # Run the autotools. diff --git a/tests/Makefile.am b/tests/Makefile.am index 182e987..4fd4b79 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -66,26 +66,6 @@ $(parallel_tests:.ptest=.log): parallel-tests.sh $(parallel_tests): -include $(srcdir)/depmod-tests.am - -$(srcdir)/depmod-tests.am: depmod-tests.sh Makefile.am - $(AM_V_GEN)($(am__cd) $(srcdir) \ - && $(SHELL) ./depmod-tests.sh --generate-makefile) >$@ - -TEST_EXTENSIONS += .depmod -DEPMOD_LOG_COMPILER = $(SHELL) $(srcdir)/depmod-tests.sh -EXTRA_DIST += depmod-tests.sh - -# All `*.depmod' tests work by calling the script `depmod-tests.sh'. -# Also, they all use shared data generated by the `depmod-data.test' -# helper test (for reasons of speed). -depmod-data.log: depmod-tests.sh -$(depmod_tests:.depmod=.log): depmod-tests.sh depmod-data.log -# This dummy declaration is required to have make actually produce -# expected log files from the `.depmod.log' suffix rule. -$(depmod_tests): - - include $(srcdir)/config-shell-tests.am $(srcdir)/config-shell-tests.am: gen-config-shell-tests Makefile.am @@ -126,14 +106,15 @@ AM_TESTS_ENVIRONMENT += stderr_fileno_=9; export stderr_fileno_; TESTS = \ $(handwritten_tests) \ $(config_shell_tests) \ - $(parallel_tests) \ - $(depmod_tests) + $(parallel_tests) EXTRA_DIST += $(handwritten_tests) handwritten_tests = \ -## This test should take a long time, so put it first to improve -## performance on concurrent testsuite runs. +## This tests might quite a long time, since they run various checks +## sequentially; so place them early first to improve performance on +## concurrent testsuite runs. +depmod.tap \ instspc.tap \ aclocal.test \ aclocal3.test \ @@ -410,7 +391,6 @@ depcomp6.test \ depcomp7.test \ depcomp8a.test \ depcomp8b.test \ -depmod-data.test \ depdist.test \ depend.test \ depend2.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 47a1b69..a0c553f 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -52,8 +52,8 @@ host_triplet = @host@ DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/aclocal.in $(srcdir)/automake.in \ $(srcdir)/config-shell-tests.am $(srcdir)/defs \ - $(srcdir)/defs-static.in $(srcdir)/depmod-tests.am \ - $(srcdir)/parallel-tests.am $(top_srcdir)/CheckListOfTests.am + $(srcdir)/defs-static.in $(srcdir)/parallel-tests.am \ + $(top_srcdir)/CheckListOfTests.am subdir = tests ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/amversion.m4 \ @@ -186,11 +186,7 @@ am__test_logs4 = $(am__test_logs3:.ptest.log=.log) PTEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/lib/test-driver PTEST_LOG_COMPILE = $(PTEST_LOG_COMPILER) $(AM_PTEST_LOG_FLAGS) \ $(PTEST_LOG_FLAGS) -am__test_logs5 = $(am__test_logs4:.depmod.log=.log) -DEPMOD_LOG_DRIVER = $(SHELL) $(top_srcdir)/lib/test-driver -DEPMOD_LOG_COMPILE = $(DEPMOD_LOG_COMPILER) $(AM_DEPMOD_LOG_FLAGS) \ - $(DEPMOD_LOG_FLAGS) -TEST_LOGS = $(am__test_logs5:.shtst.log=.log) +TEST_LOGS = $(am__test_logs4:.shtst.log=.log) SHTST_LOG_DRIVER = $(SHELL) $(top_srcdir)/lib/test-driver SHTST_LOG_COMPILE = $(SHTST_LOG_COMPILER) $(AM_SHTST_LOG_FLAGS) \ $(SHTST_LOG_FLAGS) @@ -293,13 +289,13 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -TEST_EXTENSIONS = .test .tap .ptest .depmod .shtst +TEST_EXTENSIONS = .test .tap .ptest .shtst TAP_LOG_DRIVER = $(PERL) $(top_srcdir)/lib/tap-driver TAP_LOG_DRIVER_FLAGS = --merge --comments --diagnostic-string `printf \ '\043%%\043\n'` MAINTAINERCLEANFILES = EXTRA_DIST = ChangeLog-old gen-parallel-tests parallel-tests.sh \ - depmod-tests.sh gen-config-shell-tests config-shell-tests.sh \ + gen-config-shell-tests config-shell-tests.sh \ $(handwritten_tests) tap-functions.sh plain-functions.sh \ trivial-test-driver testsuite-summary-checks.sh \ extract-testsuite-summary tap-setup.sh tap-summary-aux.sh @@ -329,15 +325,6 @@ parallel_tests = backcompat5-p.ptest check-exported-srcdir-p.ptest \ maken3-p.ptest maken4-p.ptest posixsubst-tests-p.ptest \ tests-environment-p.ptest PTEST_LOG_COMPILER = $(SHELL) $(srcdir)/parallel-tests.sh -depmod_tests = depcomp-gcc3.depmod depcomp-gcc.depmod \ - depcomp-hp.depmod depcomp-sgi.depmod depcomp-aix.depmod \ - depcomp-icc.depmod depcomp-hp2.depmod depcomp-tru64.depmod \ - depcomp-msvc7.depmod depcomp-msvc7msys.depmod \ - depcomp-nosideeffect.depmod depcomp-dashmstdout.depmod \ - depcomp-dashXmstdout.depmod depcomp-makedepend.depmod \ - depcomp-cpp.depmod depcomp-msvisualcpp.depmod \ - depcomp-msvcmsys.depmod -DEPMOD_LOG_COMPILER = $(SHELL) $(srcdir)/depmod-tests.sh config_shell_tests = ar-lib-w.shtst compile-w.shtst compile2-w.shtst \ compile3-w.shtst compile4-w.shtst compile5-w.shtst \ compile6-w.shtst instsh2-w.shtst instsh3-w.shtst \ @@ -365,10 +352,10 @@ AM_TESTS_FD_REDIRECT = 9>&2 TESTS = \ $(handwritten_tests) \ $(config_shell_tests) \ - $(parallel_tests) \ - $(depmod_tests) + $(parallel_tests) handwritten_tests = \ +depmod.tap \ instspc.tap \ aclocal.test \ aclocal3.test \ @@ -645,7 +632,6 @@ depcomp6.test \ depcomp7.test \ depcomp8a.test \ depcomp8b.test \ -depmod-data.test \ depdist.test \ depend.test \ depend2.test \ @@ -1457,8 +1443,8 @@ am__tdf = diff-in-tests-lists.tmp all: all-am .SUFFIXES: -.SUFFIXES: .depmod .html .log .ptest .shtst .tap .test .trs -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/parallel-tests.am $(srcdir)/depmod-tests.am $(srcdir)/config-shell-tests.am $(top_srcdir)/CheckListOfTests.am $(am__configure_deps) +.SUFFIXES: .html .log .ptest .shtst .tap .test .trs +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/parallel-tests.am $(srcdir)/config-shell-tests.am $(top_srcdir)/CheckListOfTests.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -1681,11 +1667,6 @@ recheck recheck-html: --log-file '$*.log' --trs-file '$*.trs' \ $(am__common_driver_flags) $(AM_PTEST_LOG_DRIVER_FLAGS) $(PTEST_LOG_DRIVER_FLAGS) -- $(PTEST_LOG_COMPILE) "$$tst" \ $(AM_TESTS_FD_REDIRECT) -.depmod.log: - @p='$<'; $(am__check_pre) $(DEPMOD_LOG_DRIVER) --test-name "$$f" \ - --log-file '$*.log' --trs-file '$*.trs' \ - $(am__common_driver_flags) $(AM_DEPMOD_LOG_DRIVER_FLAGS) $(DEPMOD_LOG_DRIVER_FLAGS) -- $(DEPMOD_LOG_COMPILE) "$$tst" \ - $(AM_TESTS_FD_REDIRECT) .shtst.log: @p='$<'; $(am__check_pre) $(SHTST_LOG_DRIVER) --test-name "$$f" \ --log-file '$*.log' --trs-file '$*.trs' \ @@ -1876,19 +1857,6 @@ $(parallel_tests:.ptest=.log): parallel-tests.sh # This dummy declaration is required to have make actually produce # expected log files from the `.ptest.log' suffix rule. $(parallel_tests): - -$(srcdir)/depmod-tests.am: depmod-tests.sh Makefile.am - $(AM_V_GEN)($(am__cd) $(srcdir) \ - && $(SHELL) ./depmod-tests.sh --generate-makefile) >$@ - -# All `*.depmod' tests work by calling the script `depmod-tests.sh'. -# Also, they all use shared data generated by the `depmod-data.test' -# helper test (for reasons of speed). -depmod-data.log: depmod-tests.sh -$(depmod_tests:.depmod=.log): depmod-tests.sh depmod-data.log -# This dummy declaration is required to have make actually produce -# expected log files from the `.depmod.log' suffix rule. -$(depmod_tests): ar-lib-w.log: ar-lib.test compile-w.log: compile.test compile2-w.log: compile2.test diff --git a/tests/depmod-data.test b/tests/depmod-data.test deleted file mode 100755 index 297c739..0000000 --- a/tests/depmod-data.test +++ /dev/null @@ -1,32 +0,0 @@ -#! /bin/sh -# Copyright (C) 2011 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/>. - -# Helper testcase which generate input data for the other tests -# `*.depmod'. It basically delegates the work to the helper script -# `depmod-test.sh'. - -# Ensure proper definition of $testsrcdir. -# FIXME: we employ useless quoting below to please maintainer-check. -. ./defs-static || 'exit' 99 - -# Sanity check. -if test x"$testsrcdir" = x; then - echo "$0: \$testsrcdir not set after sourcing of ./defs-static" >&2 - # FIXME: we employ useless quoting below to please maintainer-check. - 'exit' 99 -fi - -exec $SHELL $testsrcdir/depmod-tests.sh --generate-data diff --git a/tests/depmod-tests.sh b/tests/depmod-tests.sh deleted file mode 100755 index a21f618..0000000 --- a/tests/depmod-tests.sh +++ /dev/null @@ -1,226 +0,0 @@ -#! /bin/sh -# Copyright (C) 2011 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/>. - -# Driver script to generate and run tests checking that dependency -# tracking in various flavours works with VPATH builds. -# -# This script fulfills a threefold role: -# 1. It is called to generate a Makefile.am snippet, containing the -# definition of proper lists of tests. -# 2. It is called to set up a directory containing some common data -# files and autotools-generated files used by the aforementioned -# tests (this is done for speed reasons only). -# 3. It is called to properly run those tests, one at a time. -# -# Examples of reported failures follows ... - -# <http://lists.gnu.org/archive/html/automake-patches/2011-04/msg00028.html> -# -# Here's the bug: makedepend will prefix VPATH to the object file name, -# thus the second make will invoke depcomp with object='../../src/foo.o', -# causing errors such as: -# touch: cannot touch `../../src/.deps/foo.TPo': No such file or directory -# makedepend: error: cannot open "../../src/.deps/foo.TPo" -# ../../depcomp: line 560: ../../src/.deps/foo.TPo: No such file or directory - -# <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8473> -# <http://lists.gnu.org/archive/html/automake-patches/2011-04/msg00079.html> -# -# Here's the bug: hp depmode will prefix VPATH to the object file name, -# thus the second gmake will invoke depcomp with object='../../src/foo.o', -# causing errors such as (broken on multiple lines for clarity): -# cpp: "", line 0: error 4066: Cannot create -# "../../gllib/.deps/nonblocking.TPo" file for -# "-M../../gllib/.deps/nonblocking.TPo" option. -# (No such file or directory[errno=2]) - -# Be more Bourne compatible (snippet copied from `tests/defs'). -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac -fi - -set -e - -# We need this early. It will be overridden when we source ./defs below, -# which will offer a more proper implementation. -fatal_ () { echo "$0: $*" >&2; exit 99; } - -case $# in - 0) fatal_ "missing argument";; - 1) ;; - *) fatal_ "too many arguments";; -esac - -case $1 in - --generate-makefile|--generate-data) - action=`expr x"$1" : x'--\(.*\)'` - ;; - depcomp-*.depmod|*/depcomp-*.depmod) - action=run-test - depmode=`expr /"$1" : '.*/depcomp-\(.*\)\.depmod'` - ;; - *) - fatal_ "invalid argument '$1'" - ;; -esac - -# Helper subroutines for creation of input data files. - -create_input_data () -{ - mkdir src src/sub - - unindent > configure.in << 'END' - AC_INIT([depcomp], [1.0]) - AM_INIT_AUTOMAKE - AC_CONFIG_FILES([Makefile src/Makefile]) - AC_PROG_CC - AM_PROG_CC_C_O - AC_OUTPUT -END - - echo 'SUBDIRS = src' > Makefile.am - - unindent > src/Makefile.am << 'END' - AUTOMAKE_OPTIONS = subdir-objects - bin_PROGRAMS = foo - foo_SOURCES = foo.c foo.h sub/subfoo.c -END - - echo 'extern int subfoo (void);' > src/foo.h - - unindent > src/foo.c << 'END' - #include "foo.h" - int main (void) - { - return subfoo (); - } -END - - # We include subfoo only to be sure that we don't remove too much - # from the object file name. - unindent > src/sub/subfoo.c << 'END' - #include "foo.h" - int subfoo (void) - { - return 0; - } -END - - $ACLOCAL - $AUTOCONF - $AUTOMAKE -a - - # Sanity check: make sure the cache variable we force is used - # by configure. - grep am_cv_CC_dependencies_compiler_type configure - - : > success -} - -# Usage: get_depmodes DEPCOMP-FILE -get_depmodes () -{ - # Keep this in sync with the contents of depend.m4. - all_depmodes=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < "$1" \ - | grep -v '^none$'` \ - && : Turn newlines and tabs into spaces, and strip extra whitespace. \ - && all_depmodes=`echo $all_depmodes` \ - && test -n "$all_depmodes" \ - || fatal_ "can't extract list of valid depmodes from '$1'" -} - -if test x"$action" = x"generate-makefile"; then - # We must generate a makefile fragment on stdout. It must refer - # to all tests at once, hence the loop below. - get_depmodes ../lib/depcomp - echo '## Generated by depmode-tests.sh. DO NOT EDIT!' - echo 'depmod_tests =' - for depmode in $all_depmodes; do - echo "depmod_tests += depcomp-$depmode.depmod" - done - exit 0 -fi - -# We'll need the full setup provided by `tests/defs'. Temporarily disable -# the errexit flag, since the setup code might not be prepared to deal -# with it. Also pre-set `$me' for `tests/defs', so that different calls -# to `depmod-tests.sh' won't try to use the same temporary directory. -# The actual tests require a C compiler, so require it for them; but do -# not require it when generating data, as it's not needed then. -if test x"$action" = x"generate-data"; then - me=depmod-data -else - required=cc - me=depcomp-$depmode -fi -set +e -. ./defs || Exit 99 -set -e - -# The directory set up by the `generate-data' action should contain all -# the files we need. So remove the other files created by ./defs. And -# check we really are in a temporary `*.dir' directory in the build tree, -# since the last thing we want is to remove some random user files! -test -f ../defs-static && test -f ../defs \ - && case `pwd` in *.dir) :;; *) false;; esac \ - || fatal_ "running from the wrong directory" -rm -f * - -if test x"$action" = x"generate-data"; then - # We must *not* remove the test directory, since its contents must be - # used by following dependent tests. - keep_testdirs=yes - create_input_data - Exit 0 -fi - -get_depmodes "$top_testsrcdir/lib/depcomp" -case " $all_depmodes " in - *" $depmode "*) ;; - *) fatal_ "invalid depmode '$depmode'";; -esac - -### If we are still here, we have to run a test ... - -if test ! -f ../depmod-data.dir/success; then - framework_failure_ "depmod-data.test failure" -fi - -../depmod-data.dir/configure am_cv_CC_dependencies_compiler_type=$depmode - -# Do not error out with the first make, as the depmode we've forced might -# not actually work, but we have overridden the _AM_DEPENDENCIES tests. -$MAKE || skip_ "forced depmode '$depmode' doesn't work" - -# We must clean and rebuild, as the actual error only happens the second -# time the objects are built because 'depcomp' has silently messed up the -# .Po files the first time. -$MAKE clean - -$MAKE >out 2>&1 || { cat out; Exit 1; } -cat out -grep 'src/[._]deps' out && Exit 1 - -: diff --git a/tests/depmod.tap b/tests/depmod.tap new file mode 100755 index 0000000..4470fdd --- /dev/null +++ b/tests/depmod.tap @@ -0,0 +1,169 @@ +#! /bin/sh +# Copyright (C) 2011 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/>. + +# Check that dependency tracking in various flavours works with VPATH +# builds. Examples of reported failures follows ... + +# <http://lists.gnu.org/archive/html/automake-patches/2011-04/msg00028.html> +# +# Here's the bug: makedepend will prefix VPATH to the object file name, +# thus the second make will invoke depcomp with object='../../src/foo.o', +# causing errors such as: +# touch: cannot touch `../../src/.deps/foo.TPo': No such file or directory +# makedepend: error: cannot open "../../src/.deps/foo.TPo" +# ../../depcomp: line 560: ../../src/.deps/foo.TPo: No such file or directory + +# <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8473> +# <http://lists.gnu.org/archive/html/automake-patches/2011-04/msg00079.html> +# +# Here's the bug: hp depmode will prefix VPATH to the object file name, +# thus the second gmake will invoke depcomp with object='../../src/foo.o', +# causing errors such as (broken on multiple lines for clarity): +# cpp: "", line 0: error 4066: Cannot create +# "../../gllib/.deps/nonblocking.TPo" file for +# "-M../../gllib/.deps/nonblocking.TPo" option. +# (No such file or directory[errno=2]) +# + +# <http://lists.gnu.org/archive/html/automake-patches/2011-04/msg00140.html> +# <http://lists.gnu.org/archive/html/automake-patches/2011-05/msg00019.html> +# +# A partial failure of an earlier version of this test; some bad +# post-processing of the `*.Po' files led to the following broken +# contents of `src/sub/.deps/subfoo.Po': +# > sub/subfoo.o: ../../depmod-data.dir/src/sub/subfoo.c \ +# > ../../depmod-data.dir/src/foo.h +# > ../../depmod-data.dir/src/sub/subfoo.c \: +# > ../../depmod-data.dir/src/foo.h: +# which caused make to die with an error like: +# "sub/.deps/subfoo.Po:3: *** missing separator. Stop." + +required=cc +. ./defs || Exit 99 + +ocwd=`pwd` || fatal_ "cannot get current working directory" + +# Keep this in sync with the contents of depend.m4. +all_depmodes=`\ + sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < "$top_testsrcdir/lib/depcomp" \ + | grep -v '^none$'` \ + && : Turn newlines and tabs into spaces, and strip extra whitespace. \ + && all_depmodes=`echo $all_depmodes` \ + && test -n "$all_depmodes" \ + || fatal_ "can't extract list of valid depmodes" + +srctree=depmod-1.0 +mkdir $srctree +mv missing install-sh depcomp configure.in $srctree +cd $srctree + +mkdir src src/sub + +cat >> configure.in << 'END' +AC_CONFIG_FILES([src/Makefile]) +AC_PROG_CC +AM_PROG_CC_C_O +AC_OUTPUT +END + +echo 'SUBDIRS = src' > Makefile.am + +cat > src/Makefile.am << 'END' +AUTOMAKE_OPTIONS = subdir-objects +bin_PROGRAMS = foo +foo_SOURCES = foo.c foo.h sub/subfoo.c +END + +echo 'extern int subfoo (void);' > src/foo.h + +cat > src/foo.c << 'END' +#include "foo.h" +int main (void) +{ + return subfoo (); +} +END + +# We include subfoo only to be sure that we don't remove too much +# from the object file name. +cat > src/sub/subfoo.c << 'END' +#include "foo.h" +int subfoo (void) +{ + return 0; +} +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE -a + +# Sanity check: make sure the cache variable we force is used +# by configure. +grep am_cv_CC_dependencies_compiler_type configure \ + || fatal_ "configure lacks required cache variable" + +cd "$ocwd" || fatal_ "cannot chdir back to top directory" + +longpath=this-is/a-path/which-have/quite-a/long_long_name +$srctree/install-sh -d $longpath || fatal_ "cannot create long path" +cp -pR $srctree/* $longpath || fatal_ "cannot populate long path" +cp -pR $srctree/* . || fatal_ "cannot populate top-level directory" + +for vpath in simple long absolute; do + for depmode in $all_depmodes; do + case $vpath in + simple) + srcdir=..;; + long) + srcdir=../$longpath;; + absolute) + srcdir=$ocwd;; + *) + fatal_ "bad \$vpath value '$vpath'";; + esac + + pfx="$depmode [$vpath VPATH]" + + mkdir $depmode-$vpath.d + cd $depmode-$vpath.d + + command_ok_ "$pfx configure" \ + "$srcdir"/configure am_cv_CC_dependencies_compiler_type=$depmode + + # Do not fail with the first call to make fails, as the depmode + # we've forced might not actually work, but we have overridden the + # _AM_DEPENDENCIES tests. + if $MAKE; then + # We must clean and rebuild, as the actual error only happens the + # second time the objects are built because 'depcomp' has silently + # messed up the .Po files the first time. + r=ok + $MAKE clean \ + && { e=0; $MAKE >output 2>&1 || e=1; cat output; test $e -eq 0; } \ + && { if grep 'src/[._]deps' output; then false; else :; fi; } \ + || r='not ok' + result_ "$r" "$pfx make & remake" + else + skip_ -r "can't force depmode" "$pfx make & remake" + fi + + cd "$ocwd" || fatal_ "cannot chdir back to top directory" + + done +done + +: -- 1.7.2.3
