gl_INIT
coreutils_MACROS
+# The test suite needs to know if we have a working perl.
+# FIXME: this is suboptimal. Ideally, we would be able to call gl_PERL
+# with an ACTION-IF-NOT-FOUND argument ...
+cu_have_perl=yes
+case $PERL in *"/missing ") cu_have_perl=no;; esac
+AM_CONDITIONAL([HAVE_PERL], [test $cu_have_perl = yes])
+
AC_ARG_ENABLE([gcc-warnings],
[AS_HELP_STRING([--enable-gcc-warnings],
[turn on lots of GCC warnings (for developers)])],
TEST_EXTENSIONS = .xpl
+if HAVE_PERL
+TESTSUITE_PERL = $(PERL)
+else
+TESTSUITE_PERL = $(SHELL) $(srcdir)/no-perl
+endif
+
# '$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
LOG_COMPILER = \
$(SHELL) $(srcdir)/shell-or-perl \
--test-name "$$f" --srcdir '$(srcdir)' \
- --shell '$(SHELL)' --perl '$(PERL)' --
+ --shell '$(SHELL)' --perl '$(TESTSUITE_PERL)' --
# Perl scripts that must be run in tainted mode.
XPL_LOG_COMPILER = \
- $(PERL) -wT -I$(srcdir) -MCoreutils -MCuSkip -M"CuTmpdir qw($$f)"
+ $(TESTSUITE_PERL) -wT -I$(srcdir) -MCoreutils -MCuSkip -M"CuTmpdir qw($$f)"
# Note that the first lines are statements. They ensure that environment
# variables that can perturb tests are unset or set to expected values.
init.cfg \
init.sh \
lang-default \
+ no-perl \
other-fs-tmpdir \
sample-test \
shell-or-perl \
--- /dev/null
+#! /bin/sh
+# Perl is not available, the test should be considered skipped.
+# FD 9 should have been opened by the test suite harness, pointing
+# to the original stderr (usually, the user's terminal).
+echo "test skipped: no usable version of Perl found" >&9
+exit 77
case $shebang_line in
'#!/usr/bin/perl'*)
# The test is a perl script.
- if $cu_PERL -e 'use warnings' > /dev/null 2>&1; then
- exec $cu_PERL -w -I"$srcdir" -MCoreutils -MCuSkip \
- -M"CuTmpdir qw($test_name)" \
- -- "$test_script" ${1+"$@"}
- else
- # Perl is not available, skip the test.
- echo "$test_name: skip: no usable version of Perl found"
- exit 77
- fi
+ exec $cu_PERL -w -I"$srcdir" -MCoreutils -MCuSkip \
+ -M"CuTmpdir qw($test_name)" -- "$test_script" ${1+"$@"}
;;
*)
# Assume the test is a shell script.