summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2008-05-12 14:39:55 +0200
committerJim Meyering <meyering@redhat.com>2008-05-16 10:10:34 +0200
commitea54b6f47c92525267861e15314c61db83a86352 (patch)
tree71339a1ffa397b0be5301ee78bdd6529857933be /tests
parent4a4fe636dcef1c71c6aef423be0c6788f9d46c40 (diff)
downloadcoreutils-ea54b6f47c92525267861e15314c61db83a86352.tar.xz
tests: allow to run Perl tests more cleanly
Before this change, perl tests were run via a #!/bin/sh script in which perl was invoked via $(PERL) ... -- - <<\EOF. That made some stty tests fail due to the way stdin was usurped. * build-aux/check.mk (am__check_pre): Don't append $(SHELL) to this nominally automake-internal variable. * tests/check.mk (TESTS_ENVIRONMENT): Instead, define a shell function here, and append it to the more user-visible $(TESTS_ENVIRONMENT).
Diffstat (limited to 'tests')
-rw-r--r--tests/check.mk17
1 files changed, 16 insertions, 1 deletions
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)