diff options
author | Stefano Lattarini <stefano.lattarini@gmail.com> | 2011-06-18 10:26:15 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2011-06-19 21:57:43 +0200 |
commit | a51c6e0356e5c66fd9c2539f220c6cd2ad2de1e7 (patch) | |
tree | 140be66a3b761344c06a19cac4fc92d84eec7ca5 /tests/check.mk | |
parent | e23f179557bc17bb7d2d72728d3b730d21aa41d8 (diff) | |
download | coreutils-a51c6e0356e5c66fd9c2539f220c6cd2ad2de1e7.tar.xz |
tests: make test runner a script, not a shell function
This change implements a more correct and idiomatic use of the
features of the Automake-provided 'parallel-tests' harness.
Moreover, this change is required in order for the testsuite to
continue to work with the new testsuite harness that is planned
to be introduced in Automake 1.12 (which, as of the writing date,
is still under development and in alpha state).
* tests/shell-or-perl: New auxiliary script.
* tests/Makefile.am (EXTRA_DIST): Distribute it.
* tests/check.mk (TESTS_ENVIRONMENT): Remove definition of the
`shell_or_perl_' shell function, whose code has been moved in
the new script above (with a few improvements and extensions).
Do not use it to run the test scripts.
(LOG_COMPILER): New, properly invoking `shell-or-perl'.
Diffstat (limited to 'tests/check.mk')
-rw-r--r-- | tests/check.mk | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/tests/check.mk b/tests/check.mk index 9db96af5a..d45c2885f 100644 --- a/tests/check.mk +++ b/tests/check.mk @@ -48,6 +48,16 @@ check-am: .built-programs && MAKEFLAGS= $(MAKE) -s built_programs.list) \ > $@-t && mv $@-t $@ +## `$f' is set by the Automake-generated test harness to the path of the +## current test script stripped of VPATH components, and is used by the +## shell-or-perl script to determine the name of the temporary files to be +## used. Note that $f is a shell variable, not a make macro, so the use of +## `$$f' below is correct, and not a typo. +LOG_COMPILER = \ + $(SHELL) $(srcdir)/shell-or-perl \ + --test-name "$$f" --srcdir '$(srcdir)' \ + --shell '$(SHELL)' --perl '$(PERL)' -- + # Note that the first lines are statements. They ensure that environment # variables that can perturb tests are unset or set to expected values. # The rest are envvar settings that propagate build-related Makefile @@ -58,21 +68,6 @@ TESTS_ENVIRONMENT = \ test -d "$$tmp__" && test -w "$$tmp__" || tmp__=.; \ . $(srcdir)/envvar-check; \ TMPDIR=$$tmp__; export TMPDIR; \ - shell_or_perl_() { \ - if grep '^\#!/usr/bin/perl' "$$1" > /dev/null; then \ - if $(PERL) -e 'use warnings' > /dev/null 2>&1; then \ - grep '^\#!/usr/bin/perl -T' "$$1" > /dev/null && T_=T || T_=; \ - $(PERL) -w$$T_ -I$(srcdir) -MCoreutils -MCuSkip \ - -M"CuTmpdir qw($$f)" -- "$$1"; \ - else \ - echo 1>&2 "$$tst: configure did not find a usable version of Perl," \ - "so skipping this test"; \ - (exit 77); \ - fi; \ - else \ - $(SHELL) "$$1"; \ - fi; \ - }; \ export \ VERSION='$(VERSION)' \ LOCALE_FR='$(LOCALE_FR)' \ @@ -99,6 +94,6 @@ TESTS_ENVIRONMENT = \ REPLACE_GETCWD=$(REPLACE_GETCWD) \ ; test -d /usr/xpg4/bin && PATH='/usr/xpg4/bin$(PATH_SEPARATOR)'"$$PATH"; \ PATH='$(abs_top_builddir)/src$(PATH_SEPARATOR)'"$$PATH" \ - ; shell_or_perl_ 9>&2 + ; 9>&2 VERBOSE = yes |