diff options
-rw-r--r-- | build-aux/check.mk | 2 | ||||
-rw-r--r-- | tests/check.mk | 17 |
2 files changed, 17 insertions, 2 deletions
diff --git a/build-aux/check.mk b/build-aux/check.mk index 9cd1b3397..165ea366b 100644 --- a/build-aux/check.mk +++ b/build-aux/check.mk @@ -113,7 +113,7 @@ if test -f "./$$src"; then dir=./; \ elif test -f "$$src"; then dir=; \ else dir="$(srcdir)/"; fi; \ __SAVED_TERM=$$TERM; \ -$(TESTS_ENVIRONMENT) $(SHELL) +$(TESTS_ENVIRONMENT) # To be appended to the command running the test. Handles the stdout # and stderr redirection, and catch the exit status. diff --git a/tests/check.mk b/tests/check.mk index bbf22ed93..945d543dc 100644 --- a/tests/check.mk +++ b/tests/check.mk @@ -50,6 +50,20 @@ built_programs = \ TESTS_ENVIRONMENT = \ . $(top_srcdir)/tests/lang-default; \ . $(top_srcdir)/tests/envvar-check; \ + shell_or_perl_() { \ + if grep '^\#!/usr/bin/perl' "$$1" > /dev/null; then \ + if $(PERL) -e 'use warnings' > /dev/null 2>&1; then \ + $(PERL) -w -I$(top_srcdir)/tests -MCoreutils \ + -M"CuTmpdir qw($$tst)" -- "$$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; \ + }; \ LOCALE_FR='$(LOCALE_FR)' \ abs_top_builddir='$(abs_top_builddir)' \ abs_top_srcdir='$(abs_top_srcdir)' \ @@ -67,7 +81,8 @@ TESTS_ENVIRONMENT = \ PACKAGE_VERSION=$(PACKAGE_VERSION) \ PERL='$(PERL)' \ REPLACE_GETCWD=$(REPLACE_GETCWD) \ - PATH='$(abs_top_builddir)/src$(PATH_SEPARATOR)'"$$PATH" + PATH='$(abs_top_builddir)/src$(PATH_SEPARATOR)'"$$PATH" \ + shell_or_perl_ TEST_LOGS = $(TESTS:=.log) |