From: Stefano Lattarini Date: Sat, 6 Aug 2011 12:20:08 +0000 (+0200) Subject: testsuite: use TAP for `depmod*' tests, related simplifications X-Git-Tag: ng-0.5a~89^2~144 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3ea0d41765a7f80a1a75e07151f015b793c363fe;p=thirdparty%2Fautomake.git 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. --- diff --git a/ChangeLog b/ChangeLog index 2af559c04..65096053a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2011-08-06 Stefano Lattarini + + 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 testsuite: use TAP for `instspc*' tests, related simplifications diff --git a/bootstrap b/bootstrap index 1abf39b63..d289bdf71 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 182e98714..4fd4b792d 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 47a1b695b..a0c553f56 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 297c73955..000000000 --- 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 . - -# 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 a21f6182f..000000000 --- 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 . - -# 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 ... - -# -# -# 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 - -# -# -# -# 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 000000000..4470fdd36 --- /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 . + +# Check that dependency tracking in various flavours works with VPATH +# builds. Examples of reported failures follows ... + +# +# +# 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 + +# +# +# +# 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]) +# + +# +# +# +# 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 + +: