summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2012-08-30 14:13:10 +0200
committerJim Meyering <meyering@redhat.com>2012-08-30 18:55:59 +0200
commite44178c59028e3c085a5c89014d44a4f647f3deb (patch)
treeeadc6784c01e69ef7dce7173a032c858f0a14a7e
parent8381e35e240361dd7e0cd08edc6e619205d545a2 (diff)
downloadcoreutils-e44178c59028e3c085a5c89014d44a4f647f3deb.tar.xz
tests: avoid use of '-T' in shebang line to enable perl taint mode
* tests/rm/fail-eperm: Rename ... * tests/rm/fail-eperm.xpl: ... like this * tests/Makefile.am (TESTS): Adjust. (TEST_EXTENSIONS): New, list '.xpl'. (XPL_TEST_LOGS): New, run a perl test in tainted mode. * tests/shell-or-perl: Simplify this script: we no longer need to parse the shebang line and adjust the flags in the perl invocation accordingly.
-rw-r--r--tests/Makefile.am8
-rwxr-xr-xtests/rm/fail-eperm.xpl (renamed from tests/rm/fail-eperm)0
-rw-r--r--tests/shell-or-perl9
3 files changed, 9 insertions, 8 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 983903007..581f803e7 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -45,6 +45,8 @@ check_DATA = .built-programs
&& MAKEFLAGS= $(MAKE) -s built_programs.list) \
> $@-t && mv $@-t $@
+TEST_EXTENSIONS = .xpl
+
# '$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
@@ -55,6 +57,10 @@ LOG_COMPILER = \
--test-name "$$f" --srcdir '$(srcdir)' \
--shell '$(SHELL)' --perl '$(PERL)' --
+# Perl scripts that must be run in tainted mode.
+XPL_LOG_COMPILER = \
+ $(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.
# The rest are envvar settings that propagate build-related Makefile
@@ -207,7 +213,7 @@ TESTS = \
rm/empty-name \
rm/f-1 \
rm/fail-eacces \
- rm/fail-eperm \
+ rm/fail-eperm.xpl \
tail-2/assert \
rm/hash \
rm/i-1 \
diff --git a/tests/rm/fail-eperm b/tests/rm/fail-eperm.xpl
index 6e34d5d3e..6e34d5d3e 100755
--- a/tests/rm/fail-eperm
+++ b/tests/rm/fail-eperm.xpl
diff --git a/tests/shell-or-perl b/tests/shell-or-perl
index 58c80e360..cb80edf67 100644
--- a/tests/shell-or-perl
+++ b/tests/shell-or-perl
@@ -1,7 +1,6 @@
#! /bin/sh
# Run a test script of the coreutils test scripts, picking up the right
-# interpreter (i.e., perl or the shell) and the right flags for it (e.g.,
-# perl '-T' flag for perl scripts that must run in tainted mode).
+# interpreter (i.e., perl or the shell) and the right flags for it.
#
# Copyright (C) 2011-2012 Free Software Foundation, Inc.
#
@@ -96,11 +95,7 @@ case $shebang_line in
'#!/usr/bin/perl'*)
# The test is a perl script.
if $cu_PERL -e 'use warnings' > /dev/null 2>&1; then
- # Perl is available, see if we must run the test with taint
- # mode on or not.
- case $shebang_line in *\ -T*) T_=T;; *) T_=;; esac
- # Now run it.
- exec $cu_PERL -w$T_ -I"$srcdir" -MCoreutils -MCuSkip \
+ exec $cu_PERL -w -I"$srcdir" -MCoreutils -MCuSkip \
-M"CuTmpdir qw($test_name)" \
-- "$test_script" ${1+"$@"}
else