19 Commits

Author SHA1 Message Date
Tony Cook
afe3e67fb0 allow some basic infrastructure to load with -Dusedefaultstrict
The changes to t/test.pl appear to be real bugs.

This allows `make test_harness` to run, but many tests will still
fail under -Dusedefaultstrict

This addresses #21732 but does not fix it.  I'm unsure how
supported that build option is.
2024-01-04 14:24:53 +11:00
Max Maischein
0e9a4b8509 Mailling list archaeology, restoring old content
http://xray.mpe.mpg.de does not serve the mailing list archives anymore
and is not available via the Wayback machine either.

This patch restores the content of a link to an URL "we" hopefully control
better. The message ID correlates to a patch that git blame
identified as being replaced by the current state in the time range.
2019-10-11 12:34:54 +02:00
Slaven Rezic
524a2f33c8 more places where -I. for -MTestInit is needed 2018-09-13 08:29:36 -04:00
David Mitchell
19641fd71a 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.
2017-04-07 09:00:34 +01:00
H.Merijn Brand
3d7c117d52 Patch unit tests to explicitly insert "." into @INC when needed.
require calls now require ./ to be prepended to the file since . is no
longer guaranteed to be in @INC.
2016-11-11 16:27:20 +01:00
Father Chrysostomos
e1498de268 Get closure.t working under minitest
minitest can run before everything is built.  Hence, we need to make sure
the directories that buildcustomize.pl puts in @INC are not clobbered by
the test script.  Also, we need to make sure that, when run from TEST, we
do actually include buildcustomize.pl.
2014-09-02 20:11:14 -07:00
Nicholas Clark
6bb18b5407 Two small tidying refactors for TestInit.pm
Make the order of backslash and forward slash in character classes consistent.
Move the top level modification of $0 adjacent to the top level modification of
$ENV{PERL_CORE}.
2011-06-22 22:41:24 +02:00
Nicholas Clark
d36b6fc666 Fix a (back)slash bug in a regex, added with the regex itself.
8fcfece7bab67639 added code to TestInit to set the CWD and @INC for tests in
ext. However, the regex used to distinguish where a test was had one forward
slash where a backslash should have been, hence the intended Win32 support
would not work. I'm assuming that no-one has noticed this because no-one has
tried to run tests from the command line on Win32 directly, or if they have
they always use forward slashes in their pathnames.
2011-06-22 22:41:23 +02:00
Nicholas Clark
09e28dd9a3 In TestInit, eliminate @new_inc, by assigning to @INC directly.
To decide whether to default, we can test $set_opt instead of whether @new_inc
is empty, as all places that assign to @new_inc (now to @INC) also set
$set_opt.
2011-06-22 22:41:21 +02:00
Nicholas Clark
db6ebcbf60 In TestInit, inline new_inc() and set_opt() into import(), their only caller. 2011-06-22 22:41:20 +02:00
Nicholas Clark
a14453b94f Add an import option 'T' to TestInit, for tests that run at the top level.
This sets @INC to 'lib, and unless we're already at the top level will
chdir '..' [on the assumption that we are starting in t].
2011-06-22 22:41:13 +02:00
Nicholas Clark
b6800926e4 In TestInit.pm, move the default chdir and @INC code into import().
The behaviour is consistent with previous behaviour, as the equivalent of the
new code used to be run at the top level, hence would happen (unconditionally)
before import() was called.
2011-06-22 22:41:12 +02:00
Nicholas Clark
5c9e8bc6ba In TestInit.pm, merge two substitutions into one.
Both are intended to transform ./perl into ../../perl, one for forward slashes,
one for backslashes.
2011-06-22 22:41:10 +02:00
Nicholas Clark
76cc22ec8d When running tests from lib/, set @INC and $ENV{PERL5LIB} to ../lib
This ensures (reasonable) consistency with tests in cpan/, dist/ and ext/,
which set this to qw(../../lib ../../t), but are not from t/, hence don't have
t/ implicitly in @INC as '.'
2011-02-07 16:33:12 +00:00
Nicholas Clark
a193a2dbe3 Support building extensions in dist/ as well as cpan/ and ext/ 2009-09-26 21:29:26 +01:00
Nicholas Clark
fe0fb48b9e TestInit at the command line should treat tests in cpan/ the same as in ext/ 2009-09-26 21:21:30 +01:00
Nicholas Clark
25a883e141 Anchor a regexp, else paths including /Text/ are mistaken for tests in ext/ 2009-08-31 22:07:18 +01:00
Nicholas Clark
982c4793f4 Correctly munge the path of $^X when running interactively, and set PERL5LIB. 2009-08-30 13:43:08 +01:00
Nicholas Clark
30b6e59101 Move TestInit.pm to the top level of the distribution, to make it easier to use. 2009-08-30 11:16:40 +01:00