summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2017-04-07 08:46:13 +0100
committerDavid Mitchell <davem@iabyn.com>2017-04-07 09:00:34 +0100
commit19641fd71ab87a4234f86f69f958b61278dbdade (patch)
treec2fc291222861315f090d1b375616351c44820f8 /t
parent4b05bc8ea5a106c203e7154f3cbae72e133c9c80 (diff)
downloadperl-19641fd71ab87a4234f86f69f958b61278dbdade.tar.gz
stop passing '.' in @INC to tests
Currently TestInit.pm adds '.' to @INC (except if running under taint). Since *all* tests run from the perl core are invoked as perl -MTestInit[=arg,arg,..] some/test.t this means that all test scripts (including those under cpan/ etc) are excuted with dot present, regardless of the settings of $PERL_USE_UNSAFE_INC and -Ddefault_inc_excludes_dot. This commit changes it so that: 1) TestInit.pm transparently passes though a trailing dot in @INC if present (so it now honours $PERL_USE_UNSAFE_INC and -Ddefault_inc_excludes_dot) 2) Adds a 'DOT' arg (e.g. -MTestInit=DOT) which unconditionally adds '.'; 3) Updates t/TEST so that it (and t/harness which requires t/TEST) have a whitelist of cpan/ modules which need '.'; test scripts for these are invoked with -MTestInit=DOT. 4) Removes the $PERL_USE_UNSAFE_INC unsetting in t/TEST and t/harness; now that environmant variable is passed unchanged to all perl processes involved in running the test suite. As of this commit, lots of tests will fail on a dotless perl build; the next few commits will fix up any tests scripts and non cpan/ distributions which relied on dot being present.
Diffstat (limited to 't')
-rwxr-xr-xt/TEST20
-rw-r--r--t/harness3
2 files changed, 19 insertions, 4 deletions
diff --git a/t/TEST b/t/TEST
index 6d842d0859..6dc958791c 100755
--- a/t/TEST
+++ b/t/TEST
@@ -76,13 +76,28 @@ my %temp_no_core =
'../dist/Unicode-Normalize' => 1,
);
+# temporary workaround Apr 2017. These need '.' in @INC.
+# Ideally this # list will eventually be empty
+
+my %temp_needs_dot = map { $_ => 1 } qw(
+ ../cpan/ExtUtils-Install
+ ../cpan/Filter-Util-Call
+ ../cpan/libnet
+ ../cpan/Locale-Codes
+ ../cpan/Math-BigInt
+ ../cpan/Math-BigRat
+ ../cpan/Test-Harness
+ ../cpan/Test-Simple
+ ../cpan/version
+);
+
+
# delete env vars that may influence the results
# but allow override via *_TEST env var if wanted
# (e.g. PERL5OPT_TEST=-d:NYTProf)
my @bad_env_vars = qw(
PERL5LIB PERLLIB PERL5OPT
PERL_YAML_BACKEND PERL_JSON_BACKEND
- PERL_USE_UNSAFE_INC
);
for my $envname (@bad_env_vars) {
@@ -245,6 +260,9 @@ sub _scan_test {
if ($temp_no_core{$run_dir}) {
$testswitch = $testswitch . ',NC';
}
+ if($temp_needs_dot{$run_dir}) {
+ $testswitch = $testswitch . ',DOT';
+ }
}
} elsif ($test =~ m!^\.\./lib!) {
$testswitch = '-I.. -MTestInit=U1'; # -T will remove . from @INC
diff --git a/t/harness b/t/harness
index e06c3f8009..b46582ddd9 100644
--- a/t/harness
+++ b/t/harness
@@ -34,9 +34,6 @@ if ($ARGV[0] && $ARGV[0] eq '-torture') {
# which live dual lives on CPAN.
$ENV{PERL_CORE} = 1;
-# All our tests should work without . in @INC
-delete $ENV{PERL_USE_UNSAFE_INC};
-
my (@tests, $re);
# [.VMS]TEST.COM calls harness with empty arguments, so clean-up @ARGV