EXTRA_DIST += \
$(AUTOMAKESOURCES) \
- bootstrap \
+ bootstrap.sh \
GNUmakefile \
syntax-checks.mk \
HACKING
## Testsuite. ##
## ------------ ##
-# Run the tests with the shell detected at configure time.
-LOG_COMPILER = $(SHELL)
+# Run the tests with a proper shell detected at configure time.
+LOG_COMPILER = $(AM_TEST_RUNNER_SHELL)
TEST_EXTENSIONS = .pl .sh .tap
SH_LOG_COMPILER = $(LOG_COMPILER)
AM_TAP_LOG_DRIVER_FLAGS = --merge
-EXTRA_DIST += t/ax/is
+EXTRA_DIST += t/README t/ax/is t/ax/is_newest
TESTS = ## Will be updated later.
# Some testsuite-influential variables should be overridable from the
# test scripts, but not from the environment.
+# Keep this in sync with the similar list in 'runtest.in'.
AM_TESTS_ENVIRONMENT = \
for v in \
- me \
required \
- am_using_tap \
- am_parallel_tests \
+ am_test_protocol \
+ am_serial_tests \
am_test_prefer_config_shell \
am_original_AUTOMAKE \
am_original_ACLOCAL \
+ am_test_lib_sourced \
+ test_lib_sourced \
; do \
eval test x"\$${$$v}" = x || unset $$v; \
done;
-# The 'AM_TESTS_REEXEC=no' setting tells the tests not to needlessly
-# re-execute themselves with the shell detected at configure time, since
-# we are already running them under it explicitly in our setup (see e.g.
-# the definition of TEST_LOG_COMPILER above).
-AM_TESTS_ENVIRONMENT += AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC;
# We want warning messages and explanations for skipped tests to go to
# the console if possible, so set up 'stderr_fileno_' properly.
AM_TESTS_FD_REDIRECT = 9>&2
AM_TESTS_ENVIRONMENT += stderr_fileno_=9; export stderr_fileno_;
+# 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;
+
# Hand-written tests.
include $(srcdir)/t/list-of-tests.mk
$(AM_V_at)mv -f t/testsuite-part.tmp $@
EXTRA_DIST += gen-testsuite-part
-$(generated_TESTS) $(srcdir)/t/testsuite-part.am: \
- $(srcdir)/gen-testsuite-part \
- t/list-of-tests.mk \
- Makefile.am \
- $(handwritten_TESTS)
+## The dependecies 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
+
+# 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)
-# Static dependencies valid for each test case.
-check_SCRIPTS = t/wrap/aclocal-$(APIVERSION) t/wrap/automake-$(APIVERSION)
-dist_check_DATA = t/ax/plain-functions.sh t/ax/tap-functions.sh
-check_DATA = defs defs-static
+dist_noinst_DATA = \
+ t/ax/test-init.sh \
+ t/ax/test-lib.sh \
+ t/ax/am-test-lib.sh \
+ t/ax/tap-functions.sh
# 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_at)$(MKDIR_P) t/ax
+ $(AM_V_GEN)in=t/ax/test-defs.in \
+ && $(do_subst) <$(srcdir)/$$in >$@-t
+ $(generated_file_finalize)
+EXTRA_DIST += t/ax/test-defs.in
+CLEANFILES += t/ax/test-defs.sh
+nodist_noinst_DATA = t/ax/test-defs.sh
+
+noinst_SCRIPTS = # Will be updated soon.
+
+t/ax/shell-no-trail-bslash: t/ax/shell-no-trail-bslash.in Makefile
$(AM_V_at)rm -f $@ $@-t
- $(AM_V_GEN)in=defs-static.in\
- && $(do_subst) <$(srcdir)/defs-static.in >$@-t
+ $(AM_V_GEN)in=t/ax/shell-no-trail-bslash.in \
+ && $(MKDIR_P) t/ax \
+ && $(do_subst) <$(srcdir)/$$in >$@-t \
+ && chmod a+x $@-t
$(generated_file_finalize)
-EXTRA_DIST += defs-static.in
-CLEANFILES += defs-static
+EXTRA_DIST += t/ax/shell-no-trail-bslash.in
+CLEANFILES += t/ax/shell-no-trail-bslash
+noinst_SCRIPTS += t/ax/shell-no-trail-bslash
+
+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
+ $(generated_file_finalize)
+EXTRA_DIST += runtest.in
+CLEANFILES += runtest
+noinst_SCRIPTS += runtest
# If two test scripts have the same basename, they will end up sharing
# the same log file, leading to all sort of undefined and undesired
check-local: check-no-repeated-test-name
.PHONY: check-no-repeated-test-name
+# Check that our test cases are syntactically correct.
+# See automake bug#11898.
+check-tests-syntax:
+ @st=0; \
+ err () { echo "$@: $$*" >&2; st=1; }; \
+## The user might do something like "make check TESTS=t/foo" or
+## "make check TESTS_LOGS=t/foo.log" and expect (say) the test
+## 't/foo.sh' to be run; this has worked well until today, and
+## we want to continue supporting this use case.
+ bases=`for log in : $(TEST_LOGS); do echo $$log; done \
+ | sed -e '/^:$$/d' -e 's/\.log$$//'`; \
+ for bas in $$bases; do \
+ for suf in sh tap pl; do \
+ tst=$$bas.$$suf; \
+## Emulate VPATH search.
+ if test -f $$tst; then \
+ break; \
+ elif test -f $(srcdir)/$$tst; then \
+ tst=$(srcdir)/$$tst; \
+ break; \
+ else \
+ tst=''; \
+ fi; \
+ done; \
+ test -n "$$tst" || err "couldn't find test '$$bas'"; \
+## Don't check that perl tests are valid shell scripts!
+ test $$suf = pl && continue; \
+ $(AM_V_P) && echo " $(AM_TEST_RUNNER_SHELL) -n $$tst"; \
+ $(AM_TEST_RUNNER_SHELL) -n "$$tst" \
+ || err "test '$$tst' syntactically invalid"; \
+ done; \
+ exit $$st
+check-local: check-tests-syntax
+.PHONY: check-tests-syntax
+
+# Recipes with a trailing backslash character (possibly followed by
+# blank characters only) can cause spurious syntax errors with at
+# least older bash versions (e.g., bash 2.05b), and can be potentially
+# be unportable to other weaker shells. Run the testsuite in a way
+# that helps catching such problems in Automake-generated recipes.
+# See automake bug#10436.
+check-no-trailing-backslash-in-recipes:
+ $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) check \
+ CONFIG_SHELL='$(abs_top_builddir)/t/ax/shell-no-trail-bslash'
+.PHONY: check-no-trailing-backslash-in-recipes
+
## Checking the list of tests.
test_subdirs = t t/pm
include $(srcdir)/t/CheckListOfTests.am
installcheck-testsuite:
am_running_installcheck=yes $(MAKE) $(AM_MAKEFLAGS) check
+# Performance tests.
+.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:
missing \
src/Makefile.in
-dist_noinst_DATA = $(amhello_sources)
+dist_noinst_DATA += $(amhello_sources)
dist_doc_DATA = $(srcdir)/doc/amhello-1.0.tar.gz
# We depend on configure.ac so that we regenerate the tarball
exit 1; \
fi
-# Ensure tests are world-executable.
-# FIXME: this should be turned into a maintainer check...
-dist-hook:
- $(am__cd) $(distdir)/t && chmod a+rx *.sh *.tap
-
## --------------------------- ##
## Perl coverage statistics. ##
esac; \
$(determine_release_type); \
$(git_must_have_clean_workdir); \
-## Make sure the NEWS file is up-to-date.
- sed 1q $(srcdir)/NEWS | grep '$(VERSION)' >/dev/null \
- || fatal "NEWS not updated"; \
## If all was successful, tag the release in the local repository.
$$run $(GIT) tag -s "v$(VERSION)" -m "$$release_type $(VERSION)"
&& $(am__cd) tmp \
&& $(GIT) checkout -q "$$rev" \
&& echo "$@: bootstrapping $$rev" \
- && $(SHELL) ./bootstrap \
+ && $(SHELL) ./bootstrap.sh \
&& echo "$@: copying files from $$rev" \
&& makefile_ins=`find . -name Makefile.in` \
&& (tar cf - configure aclocal.m4 $$makefile_ins) | \
.PHONY: update-copyright
update-copyright:
- $(AM_V_GEN)excluded_re=`echo $(FETCHFILES) \
+ $(AM_V_GEN)set -e; \
+ current_year=`date +%Y` && test -n "$$current_year" \
+ || { echo "$@: cannot get current year" >&2; exit 1; }; \
+ sed -i "/^RELEASE_YEAR=/s/=.*$$/=$$current_year/" \
+ bootstrap.sh configure.ac; \
+ excluded_re=`echo $(FETCHFILES) \
| sed -e 's|^|lib/|' -e 's| | lib/|g' -e 's, ,|,g'`; \
$(GIT) ls-files \
| grep -Ev '^(lib/)?(COPYING|INSTALL)$$' \