* master: (39 commits)
typofix: in a comment in Makefile.am
maintcheck: fixup list of files in $(xdefs)
tests: never source test-defs.sh directly, source test-lib.sh instead
runtest: sanitize test environment
tests: remove an obsolescent self test
tests: "am_using_tap=yes" -> "am_test_protocol=tap"
tests: protect test libs against multiple inclusion
configure: testsuite shell can return early from "dot-sourced" files
tests: move sanitization and "Bournification" in the generic test lib
tests: source test defs in the generic test lib
test defs: no need to re-add $srcdir/t/ax to $PATH
tests: split test libs into "generic" and "automake-specific"
test setup: move actual calling of testsuite setup in ./defs
test setup: merge definitions of function for simple tests
test init: refactor: new function 'am_test_setup'
test init: refactor: move displaying of debugging info later
test init: refactor: new function 'am_setup_testdir'
test init: refactor: new function 'am_set_exit_traps'
configure: testsuite shell set exit traps in shell functions
test init: refactor: new function 'am_exit_trap'
...
+ Extra non-trivial edits:
* Makefile.am (perf_TESTS): Define here, as 't/list-of-tests.mk' is gone
in the 'ng/master' branch.
(all_TESTS): Don't list tests in 't/perf'; this reflects the removal of
$(perf_TESTS) from $(handwritten_TESTS) done in 't/list-of-tests.mk' on
the 'master' branch.
* t/depcomp-shuffle.sh: Source 'test-lib.sh', not './defs-static'.
Also, simply use:
. depcomp-shuffle.sh
instead of:
. "$am_testauxdir"/depcomp-shuffle.sh
to source the helper shell script 'depcomp-shuffle.sh'. See recent
commit '
v1.12.2-49-g42fb45b' for a rationale.
* t/depcomp-shuffle-sub-vpath.sh: Likewise.
* t/depcomp-shuffle-sub.sh: Likewise.
* t/depcomp-shuffle-vpath.sh: Likewise.
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
/test-suite.log
/t/wrap/aclocal-1.*
/t/wrap/automake-1.*
- /defs-static
+ /t/ax/test-defs.sh
-/t/testsuite-part.am
+/testsuite-autodeps.am
/t/*-w.tap
/t/*-w.sh
/t/depcomp-*.tap
EXTRA_DIST += t/README t/ax/is t/ax/is_newest
-TESTS = ## Will be updated later.
+# Hand-written tests for stuff in 'contrib/'.
+include $(srcdir)/contrib/t/local.am
+
+# All tests, both hand-written and autogenerated.
+# IMPORTANT: This assumes that the autogenerated tests are placed
+# in the $(srcdir) as well!
+all_TESTS = \
+ $(wildcard $(srcdir)/t/*.sh) \
+ $(wildcard $(srcdir)/t/*.tap) \
- $(wildcard $(srcdir)/t/pm/*.pl) \
- $(wildcard $(srcdir)/t/perf/*.sh)
++ $(wildcard $(srcdir)/t/pm/*.pl)
+
+# This is to ensure longer-running tests will be run earlier, which is
+# useful when running the testsuite in parallel on multicore machines.
+# Here too we assume that the autogenerated tests are placed in $(srcdir).
+long_running_TESTS = \
+ $(srcdir)/t/dist-many.sh \
+ $(srcdir)/t/parallel-tests-many.sh \
+ $(srcdir)/t/add-missing.tap \
+ $(srcdir)/t/instspc.tap \
+ $(wildcard $(srcdir)/t/depcomp-*.tap) \
+ $(wildcard $(srcdir)/t/*libtool*.sh) \
+ $(wildcard $(srcdir)/t/lt*.sh) \
+ $(wildcard $(srcdir)/t/remake*.sh)
+
+TESTS = \
+ $(long_running_TESTS) \
+ $(filter-out $(long_running_TESTS), $(all_TESTS)) \
+ $(contrib_TESTS)
+
+EXTRA_DIST += $(TESTS)
+
+# FIXME: this "expected failures" are in truth an hack used to
+# FIXME: to verify that some incorrect usages of our perl libraries
+# FIXME: raise an error. We should find a cleaner way to check that.
+perl_fake_XFAIL_TESTS = \
+ t/pm/Cond2.pl \
+ t/pm/Cond3.pl \
+ t/pm/DisjCon2.pl \
+ t/pm/DisjCon3.pl \
+ t/pm/Version2.pl \
+ t/pm/Version3.pl
+
+XFAIL_TESTS = \
+ t/all.sh \
+ t/override-suggest-local.sh \
+ t/comments-in-var-def.sh \
+ t/cond17.sh \
+ t/dist-srcdir2.sh \
+ t/gcj6.sh \
+ t/override-conditional-2.sh \
+ t/dist-pr109765.sh \
+ t/instdir-cond2.sh \
+ t/interp3.sh \
+ t/java-nobase.sh \
+ t/objext-pr10128.sh \
+ t/pr8365-remake-timing.sh \
+ t/remake-am-pr10111.sh \
+ t/remake-m4-pr10111.sh \
+ t/var-undef-append.sh \
+ $(perl_fake_XFAIL_TESTS)
# Some testsuite-influential variables should be overridable from the
# test scripts, but not from the environment.
AM_TESTS_FD_REDIRECT = 9>&2
AM_TESTS_ENVIRONMENT += stderr_fileno_=9; export stderr_fileno_;
-# Hand-written tests.
-
-include $(srcdir)/t/list-of-tests.mk
-
-TESTS += $(handwritten_TESTS)
-EXTRA_DIST += $(handwritten_TESTS)
-
-# Automatically-generated tests wrapping hand-written ones.
-# Also, automatically-computed dependencies for tests.
-
-include $(srcdir)/t/testsuite-part.am
-
-TESTS += $(generated_TESTS)
-EXTRA_DIST += $(generated_TESTS)
+ # For sourcing of extra "shell libraries" by our test scripts. As per
+ # POSIX, sourcing a file with '.' will cause it to be looked up in $PATH
+ # in case it is given with a relative name containing no slashes.
+ AM_TESTS_ENVIRONMENT += \
+ if test $(srcdir) != .; then \
+ PATH='$(abs_srcdir)/t/ax'$(PATH_SEPARATOR)$$PATH; \
+ fi; \
+ PATH='$(abs_builddir)/t/ax'$(PATH_SEPARATOR)$$PATH; \
+ export PATH;
+
+# Automatically-computed dependencies for tests.
+include $(srcdir)/testsuite-autodeps.am
-$(srcdir)/t/testsuite-part.am:
- $(AM_V_at)rm -f t/testsuite-part.tmp $@
- $(AM_V_GEN)$(PERL) $(srcdir)/gen-testsuite-part \
- --srcdir $(srcdir) > t/testsuite-part.tmp
- $(AM_V_at)chmod a-w t/testsuite-part.tmp
- $(AM_V_at)mv -f t/testsuite-part.tmp $@
-EXTRA_DIST += gen-testsuite-part
-
-## The dependecies declared here are not truly complete, but such
+## The dependencies declared here are not truly complete, but such
## completeness would cause more issues than it would solve. See
## automake bug#11347.
-$(generated_TESTS): $(srcdir)/gen-testsuite-part
-$(srcdir)/t/testsuite-part.am: $(srcdir)/gen-testsuite-part Makefile.am
-
-# Hand-written tests for stuff in 'contrib/'.
-include $(srcdir)/contrib/t/local.am
-TESTS += $(contrib_TESTS)
-EXTRA_DIST += $(contrib_TESTS)
+$(srcdir)/testsuite-autodeps.am: $(srcdir)/gen-testsuite-part
+ $(AM_V_at)rm -f $(@F)-t $@
+ $(AM_V_GEN)$(PERL) $< --srcdir $(srcdir) > $(@F)-t
+ $(AM_V_at)chmod a-w $(@F)-t && mv -f $(@F)-t $@
+EXTRA_DIST += gen-testsuite-part
- # Static dependencies valid for each test case.
- check_SCRIPTS = t/wrap/aclocal-$(APIVERSION) t/wrap/automake-$(APIVERSION)
- dist_check_DATA = \
- t/ax/test-init.sh \
- t/ax/plain-functions.sh \
+ # Static dependencies valid for each test case (also further
+ # extended later). Note that use 'noinst_' rather than 'check_'
+ # as the prefix, because we really want them to be built by
+ # "make all". This makes it easier to run the test cases by
+ # hand after having simply configured and built the package.
+
+ nodist_noinst_SCRIPTS = \
+ t/wrap/aclocal-$(APIVERSION) \
+ t/wrap/automake-$(APIVERSION)
+
+ dist_noinst_DATA = \
+ t/ax/test-lib.sh \
+ t/ax/am-test-lib.sh \
t/ax/tap-functions.sh
- nodist_check_DATA = defs-static
# Few more static dependencies.
t/distcheck-missing-m4.log: t/ax/distcheck-hook-m4.am
t/distcheck-outdated-m4.log: t/ax/distcheck-hook-m4.am
EXTRA_DIST += t/ax/distcheck-hook-m4.am
- defs-static: defs-static.in Makefile
+ t/ax/test-defs.sh: t/ax/test-defs.in Makefile
$(AM_V_at)rm -f $@ $@-t
- $(AM_V_GEN)in=t/ax/test-defs.in \
- && $(do_subst) <$(srcdir)/$$in >$@-t
+ $(AM_V_GEN)$(do_subst)
$(generated_file_finalize)
- EXTRA_DIST += defs-static.in
- CLEANFILES += defs-static
+ EXTRA_DIST += t/ax/test-defs.in
+ CLEANFILES += t/ax/test-defs.sh
+ nodist_noinst_DATA = t/ax/test-defs.sh
runtest: runtest.in Makefile
$(AM_V_at)rm -f $@ $@-t
-- $(AM_V_GEN)in=runtest.in \
-- && $(MKDIR_P) t/ax \
-- && $(do_subst) <$(srcdir)/runtest.in >$@-t \
-- && chmod a+x $@-t
++ $(AM_V_GEN)$(do_subst)
++ $(AM_V_at)chmod a+x $@-t
$(generated_file_finalize)
EXTRA_DIST += runtest.in
CLEANFILES += runtest
# Run the testsuite with the installed aclocal and automake.
installcheck-local: installcheck-testsuite
installcheck-testsuite:
- am_running_installcheck=yes $(MAKE) $(AM_MAKEFLAGS) check
+ am_running_installcheck=yes $(MAKE) check
+ # Performance tests.
++perf_TESTS = $(wildcard $(srcdir)/t/perf/*.sh) \
++ $(wildcard $(srcdir)/t/perf/*.tap)
+ .PHONY: perf
+ perf: all
+ $(MAKE) $(AM_MAKEFLAGS) TEST_SUITE_LOG='$(PERF_TEST_SUITE_LOG)' \
+ TESTS='$(perf_TESTS)' check
+ PERF_TEST_SUITE_LOG = t/perf/test-suite.log
+ CLEANFILES += $(PERF_TEST_SUITE_LOG)
+ EXTRA_DIST += $(perf_TESTS)
+
clean-local: clean-local-check
.PHONY: clean-local-check
clean-local-check:
print $file_handle unindent <<EOF;
#! /bin/sh
# This file has been automatically generated. DO NOT EDIT BY HAND!
- . ./defs-static || exit 1
+ . test-lib.sh
$shell_setup_code
- # In the spirit of VPATH, we prefer a test in the build tree
- # over one in the source tree.
- for dir in . "\$am_top_srcdir"; do
- if test -f "\$dir/$wrapped_test"; then
- echo "\$0: will source \$dir/$wrapped_test"
- . "\$dir/$wrapped_test"; exit \$?
- fi
- done
- echo "\$0: cannot find wrapped test '$wrapped_test'" >&2
+ w="\$am_top_srcdir/$wrapped_test"
+ if test -f "\$w"; then
+ echo "\$0: will source '\$w'"
+ . "\$w"
+ exit \$?
+ fi
+ echo "\$0: cannot find wrapped test '\$w'" >&2
exit 99
EOF
}
sub get_list_of_tests ()
{
- my @tests_list = split /\s+/, `cd '$srcdir' && ls t/*.sh t/*.tap`;
- my $make = defined $ENV{MAKE} ? $ENV{MAKE} : "make";
- # Unset MAKEFLAGS, for when we are called from make itself.
- my $cmd = "MAKEFLAGS= && unset MAKEFLAGS && cd '$srcdir' && "
- . "$make -s -f $testdir/list-of-tests.mk print-list-of-tests";
- my @tests_list = split /\s+/, `$cmd`;
++ my @tests_list = split /\s+/,
++ `cd '$srcdir' && echo $testdir/*.sh $testdir/*.tap`;
+ # Tests whose names matches this pattern are already autogenerated,
+ # so we shouldn't re-process them.
+ @tests_list = grep { !/-w[0-9]*\.(sh|tap)$/ } @tests_list;
die "$me: cannot get list of tests\n" unless $? == 0 && @tests_list;
my $ok = 1;
foreach my $test (@tests_list)
use_trivial_test_driver =>
{
line_matcher => qr/\btrivial-test-driver\b/,
- dist_prereqs => "t/$auxdir/trivial-test-driver",
+ dist_prereqs => "$testauxdir/trivial-test-driver",
},
- dist_prereqs => "t/$auxdir/depcomp-shuffle.sh",
+ depcomp_shuffle =>
+ {
+ line_matcher => qr/\bdepcomp-shuffle\.sh\b/,
++ dist_prereqs => "$testauxdir/depcomp-shuffle.sh",
+ },
check_testsuite_summary =>
{
line_matcher => qr/\btestsuite-summary-checks\.sh\b/,
"depmode=$m",
"depcomp_with_libtool=" . ($lt ? "yes" : "no"),
);
- my $test = "$testdir/depcomp" . ($lt ? "-lt-" : "-") . "$m.tap";
- # Register wrapper test as "autogenerated" ...
- push @generated_tests, $test;
- # ... and create it.
- atomic_write ($test, sub
+ my $testname = "depcomp" . ($lt ? "-lt-" : "-") . $m . ".tap";
+ # Create wrapper test.
- atomic_write ("$srcdir/t/$testname", sub
++ atomic_write ("$srcdir/$testdir/$testname", sub
{
my $file_handle = shift;
print $file_handle unindent <<EOF;
done; \
done | sort)
- xdefs = $(srcdir)/t/ax/test-init.sh $(srcdir)/defs $(srcdir)/defs-static.in
+ xdefs = \
+ $(srcdir)/t/ax/am-test-lib.sh \
+ $(srcdir)/t/ax/test-lib.sh \
+ $(srcdir)/t/ax/test-defs.in \
+ $(srcdir)/defs
-ams := $(shell find $(srcdir) -name '*.dir' -prune -o -name '*.am' -print)
+ams := $(shell find $(srcdir) -name '*.dir' -prune -o -name '?*.am' -a -print)
+pms := $(dist_perllib_DATA)
# Some simple checks, and then ordinary check. These are only really
# guaranteed to work on my machine.
`echo $filename | ...`.
* Make sure your test script can be used to faithfully check an
- installed version of automake (as with "make installcheck"). For
- example, if you need to copy or grep an automake-provided script,
+ installed version of Automake-NG (as with "make installcheck"). For
+ example, if you need to copy or grep an Automake-NG provided script,
do not assume that they can be found in the '$top_srcdir/lib'
directory, but use '$am_scriptdir' instead. The complete list of
- such "$am_...dir" variables can be found in the 'defs-static.in'
+ such "$am_...dir" variables can be found in the 't/ax/test-defs.in'
file.
* When writing input for lex, include the following in the definitions
$EGREP "$2" am--our-help || exit 1
}
- # seq_ - print a sequence of numbers
- # ----------------------------------
- # This function simulates GNU seq(1) portably. Valid usages:
- # - seq LAST
- # - seq FIRST LAST
- # - seq FIRST INCREMENT LAST
- seq_ ()
-# using_gmake
-# -----------
-# Return success if $MAKE is GNU make, return failure otherwise.
-# Caches the result for speed reasons.
-using_gmake ()
--{
- case $# in
- 0) fatal_ "seq_: missing argument";;
- 1) seq_first=1 seq_incr=1 seq_last=$1;;
- 2) seq_first=$1 seq_incr=1 seq_last=$2;;
- 3) seq_first=$1 seq_incr=$2 seq_last=$3;;
- *) fatal_ "seq_: too many arguments";;
- case $am__using_gmake in
- yes)
- return 0;;
- no)
- return 1;;
- '')
- # Use --version AND -v, because SGI Make doesn't fail on --version.
- # Also grep for GNU because newer versions of FreeBSD make do
- # not complain about --version (they seem to silently ignore it).
- if $MAKE --version -v | grep GNU; then
- am__using_gmake=yes
- return 0
- else
- am__using_gmake=no
- return 1
- fi;;
- *)
- fatal_ "invalid value for \$am__using_gmake: '$am__using_gmake'";;
-- esac
- i=$seq_first
- while test $i -le $seq_last; do
- echo $i
- i=$(($i + $seq_incr))
- done
--}
-am__using_gmake="" # Avoid interferences from the environment.
--
- # rm_rf_ [FILES OR DIRECTORIES ...]
- # ---------------------------------
- # Recursively remove the given files or directory, also handling the case
- # of non-writable subdirectories.
- rm_rf_ ()
-# make_can_chain_suffix_rules
-# ---------------------------
-# Return 0 if $MAKE is a make implementation that can chain suffix rules
-# automatically, return 1 otherwise. Caches the result for speed reasons.
-make_can_chain_suffix_rules ()
--{
- test $# -gt 0 || return 0
- # Ignore failures in find, we are only interested in failures of the
- # final rm.
- find "$@" -type d ! -perm -700 -exec chmod u+rwx {} \; || :
- rm -rf "$@"
- if test -z "$am__can_chain_suffix_rules"; then
- if using_gmake; then
- am__can_chain_suffix_rules=yes
- return 0
- else
- mkdir am__chain.dir$$
- cd am__chain.dir$$
- unindent > Makefile << 'END'
- .SUFFIXES: .u .v .w
- .u.v: ; cp $< $@
- .v.w: ; cp $< $@
-END
- echo make can chain suffix rules > foo.u
- if $MAKE foo.w && diff foo.u foo.w; then
- am__can_chain_suffix_rules=yes
- else
- am__can_chain_suffix_rules=no
- fi
- cd ..
- rm -rf am__chain.dir$$
- fi
- fi
- case $am__can_chain_suffix_rules in
- yes) return 0;;
- no) return 1;;
- *) fatal_ "make_can_chain_suffix_rules: internal error";;
- esac
-}
-am__can_chain_suffix_rules="" # Avoid interferences from the environment.
-
-# useless_vpath_rebuild
-# ---------------------
-# Tell whether $MAKE suffers of the bug triggering automake bug#7884.
-# For example, this happens with FreeBSD make, since in a VPATH build
-# it tends to rebuilt files for which there is an explicit or even just
-# a suffix rule, even if said files are already available in the VPATH
-# directory.
-useless_vpath_rebuild ()
-{
- if test -z "$am__useless_vpath_rebuild"; then
- if using_gmake; then
- am__useless_vpath_rebuild=no
- return 1
- fi
- mkdir am__vpath.dir$$
- cd am__vpath.dir$$
- touch foo.a foo.b bar baz
- mkdir build
- cd build
- unindent > Makefile << 'END'
- .SUFFIXES: .a .b
- VPATH = ..
- all: foo.b baz
- .PHONY: all
- .a.b: ; cp $< $@
- baz: bar ; cp ../baz bar
-END
- if $MAKE all && test ! -e foo.b && test ! -e bar; then
- am__useless_vpath_rebuild=no
- else
- am__useless_vpath_rebuild=yes
- fi
- cd ../..
- rm -rf am__vpath.dir$$
- fi
- case $am__useless_vpath_rebuild in
- yes) return 0;;
- no) return 1;;
- "") ;;
- *) fatal_ "no_useless_builddir_remake: internal error";;
- esac
--}
-am__useless_vpath_rebuild=""
-
-yl_distcheck () { useless_vpath_rebuild || $MAKE distcheck ${1+"$@"}; }
--
# count_test_results total=N pass=N fail=N xpass=N xfail=N skip=N error=N
# -----------------------------------------------------------------------
# Check that a testsuite run driven by the parallel-tests harness has
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# A test for missing _SOURCES variable.
+# Dependency tracking in the face of added/removed/renamed files.
+# - VPATH build
+# - use of subdir objects
- . ./defs-static || exit '99'
-. ./defs || exit 1
-
-cat >> configure.ac << 'END'
-AC_PROG_CC
-END
-
-cat > Makefile.am << 'END'
-bin_PROGRAMS = pavel
-END
-
-$ACLOCAL
-$AUTOMAKE
-
-grep 'pavel\.[co]' Makefile.in
++. test-lib.sh
+xdir='sub' vpath='yes'
- . "$am_testauxdir"/depcomp-shuffle.sh
++. depcomp-shuffle.sh
# 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 for error for bad syntax.
+# Dependency tracking in the face of added/removed/renamed files.
+# - in-tree build
+# - use of subdir objects
- . ./defs-static || exit 99
-. ./defs || exit 1
-
-cat > Makefile.am << 'END'
-foo = q \
-
-bin_SCRIPTS = foo.sh
-END
-
-$ACLOCAL
-AUTOMAKE_fails -Wnone
-grep '^Makefile\.am:2:.*blank line following trailing backslash' stderr
-
-:
++. test-lib.sh
+xdir='sub' vpath='no'
- . "$am_testauxdir"/depcomp-shuffle.sh
++. depcomp-shuffle.sh
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Make sure comments following trailing backslashes are diagnosed.
-# Report from Harald Dunkel.
+# Dependency tracking in the face of added/removed/renamed files.
+# - VPATH build
+# - no use of subdir objects
- . ./defs-static || exit 99
-. ./defs || exit 1
-
-cat > Makefile.am << 'END'
-SUBDIRS = foo \
-# bar
-
-END
-
-mkdir foo
-
-$ACLOCAL
-AUTOMAKE_fails
-grep backslash stderr
++. test-lib.sh
+xdir='' vpath='yes'
- . "$am_testauxdir"/depcomp-shuffle.sh
++. depcomp-shuffle.sh
--- /dev/null
- . ./defs-static || exit 99
+#! /bin/sh
+# Copyright (C) 2012 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/>.
+
+# Dependency tracking in the face of added/removed/renamed files.
+# - in-tree build
+# - no use of subdir objects
+
- . "$am_testauxdir"/depcomp-shuffle.sh
++. test-lib.sh
+xdir='' vpath='no'
++. depcomp-shuffle.sh