diff options
author | David Mitchell <davem@iabyn.com> | 2017-04-07 08:46:13 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2017-04-07 09:00:34 +0100 |
commit | 19641fd71ab87a4234f86f69f958b61278dbdade (patch) | |
tree | c2fc291222861315f090d1b375616351c44820f8 /t/TEST | |
parent | 4b05bc8ea5a106c203e7154f3cbae72e133c9c80 (diff) | |
download | perl-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/TEST')
-rwxr-xr-x | t/TEST | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -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 |