This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
stop passing '.' in @INC to tests
authorDavid Mitchell <davem@iabyn.com>
Fri, 7 Apr 2017 07:46:13 +0000 (08:46 +0100)
committerDavid Mitchell <davem@iabyn.com>
Fri, 7 Apr 2017 08:00:34 +0000 (09:00 +0100)
commit19641fd71ab87a4234f86f69f958b61278dbdade
treec2fc291222861315f090d1b375616351c44820f8
parent4b05bc8ea5a106c203e7154f3cbae72e133c9c80
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.
TestInit.pm
t/TEST
t/harness