In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/82421f5fa2a51fb4bd947506f3a05c320f7a8641?hp=4b05bc8ea5a106c203e7154f3cbae72e133c9c80>
- Log ----------------------------------------------------------------- commit 82421f5fa2a51fb4bd947506f3a05c320f7a8641 Merge: 4b05bc8ea5 75e93afae6 Author: David Mitchell <[email protected]> Date: Fri Apr 7 14:55:37 2017 +0100 [MERGE] make tests run without '.' in @INC Update TestInuit.pm etc so that tests are no longer invoked with '.' in @INC. Then fix up all the tests that break because of this. Then fix up some bad usage of 'do' that's not detected by tests. commit 75e93afae6b608208886fb603f96c3b3c4ced9bd Author: David Mitchell <[email protected]> Date: Fri Apr 7 12:51:19 2017 +0100 Safe.pm: document rdo()'s usage of @INC M dist/Safe/Safe.pm commit 2e6f1ae9c4f7857e86f85fde07fe1af1254c4600 Author: David Mitchell <[email protected]> Date: Fri Apr 7 12:39:53 2017 +0100 fix and test execution of non-empty .bs files During the build of XS modules, an empty Foo.bs file is normally created for each Foo.so file. If a Foo_BS file is present, instead this triggers the auto-generatation of a .bs file which may have executable perl content. However, nothing in core currently generates a non-empty .bs file. So add a test that this mechanism works, and fix up the three dynamic lib loaders which implement the 'do $bs if -s $bs' mechanism to not rely on the process having '.' present in @INC. As it happens this already works currently, because the name of the .bs file to load will usually be something like ../../lib/auto/Foo/Foo.bs and the presence of the leading '..' causes 'do' to load the file directly rather than via @INC. But locally fix up @INC anyway, in case '../' isn't always the case. M MANIFEST M dist/XSLoader/XSLoader_pm.PL M ext/DynaLoader/DynaLoader_pm.PL A ext/XS-APItest/APItest_BS A ext/XS-APItest/t/bootstrap.t M win32/ce-helpers/makedist.pl commit 24263f7d0899237e9133f040d7554d932e4cc397 Author: David Mitchell <[email protected]> Date: Fri Apr 7 12:05:34 2017 +0100 dist/Unicode-Normalize/Makefile.PL: fix 'do' It 'do's a file in the current directory, which fails without '.' in @INC. This doesn't matter in core at the moment, but CPAN releases should be fixed. M dist/Unicode-Normalize/Makefile.PL commit 8b69401c2ba8d1ced2e17c24d6b51a7ce3882664 Author: James E Keenan <[email protected]> Date: Mon Mar 27 19:31:34 2017 -0400 fix cases where 'do file' should be 'do ./file'. These are some cases which weren't picked up by the test suite [ This is a subset of a set of fixes originally submitted by James as 2 commits - DAPM] M dist/Time-HiRes/Makefile.PL M t/loc_tools.pl M t/run/dtrace.t commit 3cf6d6323b374dd6f32717ffa188a6ed9aa3f2d3 Author: David Mitchell <[email protected]> Date: Mon Apr 3 17:32:58 2017 +0100 utils/libnetcfg: fix 'do' without '.' in @INC Note that this isn't normally executed during build, so it wasn't spotted earlier. M utils/libnetcfg.PL commit ea572010a87173fe35caf8ebdb714741677b42b6 Author: David Mitchell <[email protected]> Date: Mon Apr 3 17:03:42 2017 +0100 Porting/bench.pl: fix 'do' without '.' in @INC The --benchfile arg (default t/perf/benchmarks) is supposed to be loaded via 'do'. With '.' no longer in @INC by default, it doesn't find files with relative paths. M Porting/bench.pl commit 4c9bc717a2836a3d36cd817c16939349043504aa Author: David Mitchell <[email protected]> Date: Mon Apr 3 16:20:22 2017 +0100 fixup regen/regcharclass.pl for no '.'in @INC Note that this isn't normally executed during build, so it wasn't spotted earlier. M regcharclass.h M regen/regcharclass.pl commit 487009229cf01ff28778f225bf859e2fc950092c Author: David Mitchell <[email protected]> Date: Fri Apr 7 11:41:25 2017 +0100 fix dist/Safe/t/*.t that assumed '.' in @INC M dist/Safe/t/safe3.t commit 465db51d030aeae89adbf18378f2e5192974517c Author: David Mitchell <[email protected]> Date: Fri Apr 7 11:24:33 2017 +0100 fix dist/Time-HiRes/t/*.t that assumed '.' in @INC M dist/Time-HiRes/t/alarm.t M dist/Time-HiRes/t/clock.t M dist/Time-HiRes/t/gettimeofday.t M dist/Time-HiRes/t/itimer.t M dist/Time-HiRes/t/nanosleep.t M dist/Time-HiRes/t/sleep.t M dist/Time-HiRes/t/stat.t M dist/Time-HiRes/t/time.t M dist/Time-HiRes/t/ualarm.t M dist/Time-HiRes/t/usleep.t M dist/Time-HiRes/t/utime.t commit 62b01c09f95477292e86289b27438aa97e5b8df0 Author: David Mitchell <[email protected]> Date: Fri Apr 7 11:18:22 2017 +0100 fix ExtUtils-ParseXS/t/*.t that needed '.' in @INC M dist/ExtUtils-ParseXS/t/001-basic.t M dist/ExtUtils-ParseXS/t/002-more.t M dist/ExtUtils-ParseXS/t/003-usage.t commit 11ec6dcdb52bdeee530d0d726261e4ae64c4be8f Author: David Mitchell <[email protected]> Date: Fri Apr 7 11:14:24 2017 +0100 fix dist/base/t/*.t that assumed '.' in @INC M dist/base/t/base-open-chunk.t M dist/base/t/base-open-line.t commit 851f7bb3a8fec7678bfe30829bb53df7d9f8e05f Author: David Mitchell <[email protected]> Date: Fri Apr 7 11:12:22 2017 +0100 fix lib/B/Deparse.t that assumed '.' in @INC M lib/B/Deparse.t commit ea329caf2a7bbe63f859e7dbcc83c23281785b84 Author: David Mitchell <[email protected]> Date: Fri Apr 7 09:57:12 2017 +0100 fix ext/Pod-Html/t/*.t that assumed '.' in @INC M ext/Pod-Html/t/crossref.t M ext/Pod-Html/t/crossref2.t M ext/Pod-Html/t/crossref3.t M ext/Pod-Html/t/feature.t M ext/Pod-Html/t/feature2.t M ext/Pod-Html/t/htmldir1.t M ext/Pod-Html/t/htmldir2.t M ext/Pod-Html/t/htmldir3.t M ext/Pod-Html/t/htmldir4.t M ext/Pod-Html/t/htmldir5.t M ext/Pod-Html/t/htmlescp.t M ext/Pod-Html/t/htmllink.t M ext/Pod-Html/t/htmlview.t M ext/Pod-Html/t/poderr.t M ext/Pod-Html/t/podnoerr.t commit 78e598646a4e2ad3c50b865018b53b05092944c6 Author: David Mitchell <[email protected]> Date: Fri Apr 7 09:45:10 2017 +0100 fix ext/arybase/t/*.t that assumed '.' in @INC M ext/arybase/t/scope.t commit 8cb8a7a1611c87b9dcd9384bc036193bc56c3695 Author: David Mitchell <[email protected]> Date: Fri Apr 7 09:42:37 2017 +0100 fix ext/XS-APItest/t/*.t that assumed '.' in @INC M ext/XS-APItest/t/blockhooks.t M ext/XS-APItest/t/labelconst.t commit 5051ccfe60d1e4a46b98d4ac72fb2b70f7c54444 Author: David Mitchell <[email protected]> Date: Fri Apr 7 09:32:01 2017 +0100 fixup tests under t/ that assumed '.' in @INC M Porting/bench.pl M Porting/manisort M t/porting/bench.t M t/porting/copyright.t M t/thread_it.pl M t/uni/lower.t M t/uni/title.t M t/uni/upper.t commit 19641fd71ab87a4234f86f69f958b61278dbdade Author: David Mitchell <[email protected]> Date: Fri Apr 7 08:46:13 2017 +0100 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. M TestInit.pm M t/TEST M t/harness ----------------------------------------------------------------------- Summary of changes: MANIFEST | 2 ++ Porting/bench.pl | 12 +++++++++--- Porting/manisort | 2 +- TestInit.pm | 35 +++++++++++++++++++++++++++++------ dist/ExtUtils-ParseXS/t/001-basic.t | 1 + dist/ExtUtils-ParseXS/t/002-more.t | 1 + dist/ExtUtils-ParseXS/t/003-usage.t | 1 + dist/Safe/Safe.pm | 5 ++++- dist/Safe/t/safe3.t | 2 +- dist/Time-HiRes/Makefile.PL | 2 +- dist/Time-HiRes/t/alarm.t | 1 + dist/Time-HiRes/t/clock.t | 1 + dist/Time-HiRes/t/gettimeofday.t | 1 + dist/Time-HiRes/t/itimer.t | 1 + dist/Time-HiRes/t/nanosleep.t | 1 + dist/Time-HiRes/t/sleep.t | 1 + dist/Time-HiRes/t/stat.t | 1 + dist/Time-HiRes/t/time.t | 1 + dist/Time-HiRes/t/ualarm.t | 1 + dist/Time-HiRes/t/usleep.t | 1 + dist/Time-HiRes/t/utime.t | 1 + dist/Unicode-Normalize/Makefile.PL | 2 +- dist/XSLoader/XSLoader_pm.PL | 4 ++-- dist/base/t/base-open-chunk.t | 2 +- dist/base/t/base-open-line.t | 2 +- ext/DynaLoader/DynaLoader_pm.PL | 4 ++-- ext/Pod-Html/t/crossref.t | 2 +- ext/Pod-Html/t/crossref2.t | 2 +- ext/Pod-Html/t/crossref3.t | 2 +- ext/Pod-Html/t/feature.t | 2 +- ext/Pod-Html/t/feature2.t | 2 +- ext/Pod-Html/t/htmldir1.t | 2 +- ext/Pod-Html/t/htmldir2.t | 2 +- ext/Pod-Html/t/htmldir3.t | 2 +- ext/Pod-Html/t/htmldir4.t | 2 +- ext/Pod-Html/t/htmldir5.t | 2 +- ext/Pod-Html/t/htmlescp.t | 2 +- ext/Pod-Html/t/htmllink.t | 2 +- ext/Pod-Html/t/htmlview.t | 2 +- ext/Pod-Html/t/poderr.t | 2 +- ext/Pod-Html/t/podnoerr.t | 2 +- ext/XS-APItest/APItest_BS | 7 +++++++ ext/XS-APItest/t/blockhooks.t | 3 +++ ext/XS-APItest/t/bootstrap.t | 17 +++++++++++++++++ ext/XS-APItest/t/labelconst.t | 4 ++-- ext/arybase/t/scope.t | 1 + lib/B/Deparse.t | 2 +- regcharclass.h | 2 +- regen/regcharclass.pl | 2 +- t/TEST | 20 +++++++++++++++++++- t/harness | 3 --- t/loc_tools.pl | 4 ++-- t/porting/bench.t | 9 ++------- t/porting/copyright.t | 6 +----- t/run/dtrace.t | 2 +- t/thread_it.pl | 2 +- t/uni/lower.t | 2 +- t/uni/title.t | 2 +- t/uni/upper.t | 2 +- utils/libnetcfg.PL | 2 +- win32/ce-helpers/makedist.pl | 1 + 61 files changed, 147 insertions(+), 64 deletions(-) create mode 100644 ext/XS-APItest/APItest_BS create mode 100644 ext/XS-APItest/t/bootstrap.t diff --git a/MANIFEST b/MANIFEST index 185766cbb5..ebad534a42 100644 --- a/MANIFEST +++ b/MANIFEST @@ -4189,6 +4189,7 @@ ext/Win32CORE/Win32CORE.c Win32CORE extension ext/Win32CORE/Win32CORE.pm Win32CORE extension (stubs for Win32 CORE subs) ext/XS-APItest/APItest.pm XS::APItest extension ext/XS-APItest/APItest.xs XS::APItest extension +ext/XS-APItest/APItest_BS autogenerate APItest.bs ext/XS-APItest/core.c Test API functions when PERL_CORE is defined ext/XS-APItest/core_or_not.inc Code common to core.c and notcore.c ext/XS-APItest/exception.c XS::APItest extension @@ -4203,6 +4204,7 @@ ext/XS-APItest/t/Block.pm Helper for ./blockhooks.t ext/XS-APItest/t/blockasexpr.t test recursive descent block parsing ext/XS-APItest/t/blockhooks.t XS::APItest: tests for PL_blockhooks ext/XS-APItest/t/blockhooks-csc.t XS::APItest: more tests for PL_blockhooks +ext/XS-APItest/t/bootstrap.t XS::APItest: test APItest.bs ext/XS-APItest/t/call.t Test calling perl from C ext/XS-APItest/t/call_checker.t test call checker plugin API ext/XS-APItest/t/caller.t XS::APItest: tests for caller_cx diff --git a/Porting/bench.pl b/Porting/bench.pl index 62c6aaff54..efff214e7a 100755 --- a/Porting/bench.pl +++ b/Porting/bench.pl @@ -504,7 +504,11 @@ sub filter_tests { sub read_tests_file { my ($file) = @_; - my $ta = do $file; + my $ta; + { + local @INC = ('.'); + $ta = do $file; + } unless ($ta) { die "Error: can't parse '$file': $@\n" if $@; die "Error: can't read '$file': $!\n"; @@ -1421,8 +1425,10 @@ EOF }, ); - for ('t', '.') { - last if require "$_/test.pl"; + for ('./t', '.') { + my $t = "$_/test.pl"; + next unless -f $t; + require $t; } plan(@tests / 3 * keys %VALID_FIELDS); diff --git a/Porting/manisort b/Porting/manisort index 3d698e2743..167aada734 100644 --- a/Porting/manisort +++ b/Porting/manisort @@ -14,7 +14,7 @@ $| = 1; # Get command line options use Getopt::Long; -require "Porting/manifest_lib.pl"; +require "./Porting/manifest_lib.pl"; my $outfile; my $check_only = 0; my $quiet = 0; diff --git a/TestInit.pm b/TestInit.pm index f9a5e916cc..bded831e08 100644 --- a/TestInit.pm +++ b/TestInit.pm @@ -1,6 +1,5 @@ # This is a replacement for the old BEGIN preamble which heads (or -# should head) up every core test program to prepare it for running. -# Now instead of: +# should head) up every core test program to prepare it for running: # # BEGIN { # chdir 't' if -d 't'; @@ -10,8 +9,28 @@ # Its primary purpose is to clear @INC so core tests don't pick up # modules from an installed Perl. # -# t/TEST will use -MTestInit. You may "use TestInit" in the test -# programs but it is not required. +# t/TEST and t/harness will invoke each test script with +# perl -MTestInit[=arg,arg,..] some/test.t +# You may "use TestInit" in the test # programs but it is not required. +# +# TestInit will completely empty the current @INC and replace it with +# new entries based on the args: +# +# U2T: adds ../../lib and ../../t; +# U1: adds ../lib; +# T: adds lib and chdir's to the top-level directory. +# +# In the absence of any of the above options, it chdir's to +# t/ or cpan/Foo-Bar/ etc as appropriate and correspondingly +# sets @INC to (../lib) or ( ../../lib, ../../t) +# +# In addition, +# +# A: converts any added @INC entries to absolute paths; +# NC: unsets $ENV{PERL_CORE}; +# DOT: unconditionally appends '.' to @INC. +# +# Any trailing '.' in @INC present on entry will be preserved. # # P.S. This documentation is not in POD format in order to avoid # problems when there are fundamental bugs in perl. @@ -29,6 +48,8 @@ $ENV{PERL_CORE} = $^X; $0 =~ s/\.dp$//; # for the test.deparse make target +my $add_dot = (@INC && $INC[-1] eq '.'); # preserve existing, + sub import { my $self = shift; my @up_2_t = ('../../lib', '../../t'); @@ -47,8 +68,10 @@ sub import { } elsif ($_ eq 'T') { $chdir = '..' unless -f 't/TEST' && -f 'MANIFEST' && -d 'lib' && -d 'ext'; - @INC = qw/ lib . /; + @INC = 'lib'; $setopt = 1; + } elsif ($_ eq 'DOT') { + $add_dot = 1; } else { die "Unknown option '$_'"; } @@ -118,7 +141,7 @@ sub import { } } - push @INC, '.' unless ${^TAINT}; + push @INC, '.' if $add_dot; } 1; diff --git a/dist/ExtUtils-ParseXS/t/001-basic.t b/dist/ExtUtils-ParseXS/t/001-basic.t index 9b2d204040..04ba981919 100644 --- a/dist/ExtUtils-ParseXS/t/001-basic.t +++ b/dist/ExtUtils-ParseXS/t/001-basic.t @@ -11,6 +11,7 @@ my ($source_file, $obj_file, $lib_file); require_ok( 'ExtUtils::ParseXS' ); chdir('t') if -d 't'; +push @INC, '.'; use Carp; $SIG{__WARN__} = \&Carp::cluck; diff --git a/dist/ExtUtils-ParseXS/t/002-more.t b/dist/ExtUtils-ParseXS/t/002-more.t index e4a68f2fb0..4aaa3ab081 100644 --- a/dist/ExtUtils-ParseXS/t/002-more.t +++ b/dist/ExtUtils-ParseXS/t/002-more.t @@ -17,6 +17,7 @@ require_ok( 'ExtUtils::ParseXS' ); ExtUtils::ParseXS->import('process_file'); chdir 't' if -d 't'; +push @INC, '.'; use Carp; $SIG{__WARN__} = \&Carp::cluck; diff --git a/dist/ExtUtils-ParseXS/t/003-usage.t b/dist/ExtUtils-ParseXS/t/003-usage.t index bfe10ac476..00dfe0b2d8 100644 --- a/dist/ExtUtils-ParseXS/t/003-usage.t +++ b/dist/ExtUtils-ParseXS/t/003-usage.t @@ -18,6 +18,7 @@ my ($source_file, $obj_file, $lib_file, $module); require_ok( 'ExtUtils::ParseXS' ); chdir('t') if -d 't'; +push @INC, '.'; use Carp; $SIG{__WARN__} = \&Carp::cluck; diff --git a/dist/Safe/Safe.pm b/dist/Safe/Safe.pm index d78fcc54f6..1ee3ea8bea 100644 --- a/dist/Safe/Safe.pm +++ b/dist/Safe/Safe.pm @@ -3,7 +3,7 @@ package Safe; use 5.003_11; use Scalar::Util qw(reftype refaddr); -$Safe::VERSION = "2.39"; +$Safe::VERSION = "2.40"; # *** Don't declare any lexicals above this point *** # @@ -717,6 +717,9 @@ called from a compartment but not compiled within it. =head2 rdo (FILENAME) This evaluates the contents of file FILENAME inside the compartment. +It uses the same rules a perl's build-in C<do> to locate the file, +poossiblly using C<@INC>. + See above documentation on the B<reval> method for further details. =head2 root (NAMESPACE) diff --git a/dist/Safe/t/safe3.t b/dist/Safe/t/safe3.t index 1f99f49ed9..c1b59c07f4 100644 --- a/dist/Safe/t/safe3.t +++ b/dist/Safe/t/safe3.t @@ -38,7 +38,7 @@ print $fh <<EOF; \$_[1] = "\0" x $masksize; EOF close $fh; -$safe2->rdo('nasty.pl'); +$safe2->rdo('./nasty.pl'); $safe2->reval( q{$x + $y} ); # Written this way to keep the Test::More that comes with perl 5.6.2 happy ok( $@ =~ /^'?addition \(\+\)'? trapped by operation mask/, diff --git a/dist/Time-HiRes/Makefile.PL b/dist/Time-HiRes/Makefile.PL index ccad6a3e6f..ca4d4dc420 100644 --- a/dist/Time-HiRes/Makefile.PL +++ b/dist/Time-HiRes/Makefile.PL @@ -417,7 +417,7 @@ sub DEFINE { } sub init { - my $hints = File::Spec->catfile("hints", "$^O.pl"); + my $hints = File::Spec->catfile(".", "hints", "$^O.pl"); if (-f $hints) { print "Using hints $hints...\n"; local $self; diff --git a/dist/Time-HiRes/t/alarm.t b/dist/Time-HiRes/t/alarm.t index 4935410d36..7bdc6da20a 100644 --- a/dist/Time-HiRes/t/alarm.t +++ b/dist/Time-HiRes/t/alarm.t @@ -1,6 +1,7 @@ use strict; use Test::More tests => 10; +BEGIN { push @INC, '.' } use t::Watchdog; BEGIN { require_ok "Time::HiRes"; } diff --git a/dist/Time-HiRes/t/clock.t b/dist/Time-HiRes/t/clock.t index 346ca57fbf..7686500f06 100644 --- a/dist/Time-HiRes/t/clock.t +++ b/dist/Time-HiRes/t/clock.t @@ -1,6 +1,7 @@ use strict; use Test::More tests => 5; +BEGIN { push @INC, '.' } use t::Watchdog; BEGIN { require_ok "Time::HiRes"; } diff --git a/dist/Time-HiRes/t/gettimeofday.t b/dist/Time-HiRes/t/gettimeofday.t index 69defe8672..9f2fd7e9f7 100644 --- a/dist/Time-HiRes/t/gettimeofday.t +++ b/dist/Time-HiRes/t/gettimeofday.t @@ -9,6 +9,7 @@ BEGIN { } use Test::More tests => 6; +BEGIN { push @INC, '.' } use t::Watchdog; my @one = Time::HiRes::gettimeofday(); diff --git a/dist/Time-HiRes/t/itimer.t b/dist/Time-HiRes/t/itimer.t index 31cdd674ae..e196b1648c 100644 --- a/dist/Time-HiRes/t/itimer.t +++ b/dist/Time-HiRes/t/itimer.t @@ -26,6 +26,7 @@ BEGIN { } use Test::More tests => 2; +BEGIN { push @INC, '.' } use t::Watchdog; my $limit = 0.25; # 25% is acceptable slosh for testing timers diff --git a/dist/Time-HiRes/t/nanosleep.t b/dist/Time-HiRes/t/nanosleep.t index c17a7e4790..5ea8ff7a1b 100644 --- a/dist/Time-HiRes/t/nanosleep.t +++ b/dist/Time-HiRes/t/nanosleep.t @@ -9,6 +9,7 @@ BEGIN { } use Test::More tests => 3; +BEGIN { push @INC, '.' } use t::Watchdog; eval { Time::HiRes::nanosleep(-5) }; diff --git a/dist/Time-HiRes/t/sleep.t b/dist/Time-HiRes/t/sleep.t index b84b4c6725..0ab634072d 100644 --- a/dist/Time-HiRes/t/sleep.t +++ b/dist/Time-HiRes/t/sleep.t @@ -1,6 +1,7 @@ use strict; use Test::More tests => 4; +BEGIN { push @INC, '.' } use t::Watchdog; BEGIN { require_ok "Time::HiRes"; } diff --git a/dist/Time-HiRes/t/stat.t b/dist/Time-HiRes/t/stat.t index a59a342e20..d5e22acb46 100644 --- a/dist/Time-HiRes/t/stat.t +++ b/dist/Time-HiRes/t/stat.t @@ -14,6 +14,7 @@ BEGIN { } use Test::More tests => 43; +BEGIN { push @INC, '.' } use t::Watchdog; my @atime; diff --git a/dist/Time-HiRes/t/time.t b/dist/Time-HiRes/t/time.t index 6f219f9e0c..5db016f4cf 100644 --- a/dist/Time-HiRes/t/time.t +++ b/dist/Time-HiRes/t/time.t @@ -1,6 +1,7 @@ use strict; use Test::More tests => 2; +BEGIN { push @INC, '.' } use t::Watchdog; BEGIN { require_ok "Time::HiRes"; } diff --git a/dist/Time-HiRes/t/ualarm.t b/dist/Time-HiRes/t/ualarm.t index b50a175f44..0f9a829a1a 100644 --- a/dist/Time-HiRes/t/ualarm.t +++ b/dist/Time-HiRes/t/ualarm.t @@ -9,6 +9,7 @@ BEGIN { } use Test::More tests => 12; +BEGIN { push @INC, '.' } use t::Watchdog; use Config; diff --git a/dist/Time-HiRes/t/usleep.t b/dist/Time-HiRes/t/usleep.t index bdf372bd16..9322458b80 100644 --- a/dist/Time-HiRes/t/usleep.t +++ b/dist/Time-HiRes/t/usleep.t @@ -9,6 +9,7 @@ BEGIN { } use Test::More tests => 6; +BEGIN { push @INC, '.' } use t::Watchdog; eval { Time::HiRes::usleep(-2) }; diff --git a/dist/Time-HiRes/t/utime.t b/dist/Time-HiRes/t/utime.t index f84bccfbfb..22fd48e703 100644 --- a/dist/Time-HiRes/t/utime.t +++ b/dist/Time-HiRes/t/utime.t @@ -48,6 +48,7 @@ BEGIN { } use Test::More tests => 18; +BEGIN { push @INC, '.' } use t::Watchdog; use File::Temp qw( tempfile ); diff --git a/dist/Unicode-Normalize/Makefile.PL b/dist/Unicode-Normalize/Makefile.PL index 44a4b8ded8..18bc2e2d28 100644 --- a/dist/Unicode-Normalize/Makefile.PL +++ b/dist/Unicode-Normalize/Makefile.PL @@ -8,7 +8,7 @@ my $mm_ver = ExtUtils::MakeMaker->VERSION; if (-f "Normalize.xs") { print STDERR "Making header files for XS...\n"; - do 'mkheader' or die $@ || "mkheader: $!"; + do './mkheader' or die $@ || "mkheader: $!"; $clean = { FILES => 'unfcan.h unfcmb.h unfcmp.h unfcpt.h unfexc.h' }; } diff --git a/dist/XSLoader/XSLoader_pm.PL b/dist/XSLoader/XSLoader_pm.PL index ddf68f8818..8012e35e32 100644 --- a/dist/XSLoader/XSLoader_pm.PL +++ b/dist/XSLoader/XSLoader_pm.PL @@ -11,7 +11,7 @@ print OUT <<'EOT'; package XSLoader; -$VERSION = "0.26"; +$VERSION = "0.27"; #use strict; @@ -145,7 +145,7 @@ print OUT <<'EOT'; if (-s $bs) { # only read file if it's not empty # print STDERR "BS: $bs ($^O, $dlsrc)\n" if $dl_debug; - eval { do $bs; }; + eval { local @INC = ('.'); do $bs; }; warn "$bs: $@\n" if $@; goto \&XSLoader::bootstrap_inherit; } diff --git a/dist/base/t/base-open-chunk.t b/dist/base/t/base-open-chunk.t index ef6c25d201..9bc707bfae 100644 --- a/dist/base/t/base-open-chunk.t +++ b/dist/base/t/base-open-chunk.t @@ -7,7 +7,7 @@ $/ = \1; <$fh>; (my $test_file = $file) =~ s/-open-chunk//; -unless (my $return = do $test_file) { +unless (my $return = do "./$test_file") { warn "couldn't parse $test_file: $@" if $@; warn "couldn't do $test_file: $!" unless defined $return; warn "couldn't run $test_file" unless $return; diff --git a/dist/base/t/base-open-line.t b/dist/base/t/base-open-line.t index ce6cf1538d..fa49ee72ff 100644 --- a/dist/base/t/base-open-line.t +++ b/dist/base/t/base-open-line.t @@ -5,7 +5,7 @@ open my $fh, '<', $file or die "Can't open $file: $!"; <$fh>; (my $test_file = $file) =~ s/-open-line//; -unless (my $return = do $test_file) { +unless (my $return = do "./$test_file") { warn "couldn't parse $test_file: $@" if $@; warn "couldn't do $test_file: $!" unless defined $return; warn "couldn't run $test_file" unless $return; diff --git a/ext/DynaLoader/DynaLoader_pm.PL b/ext/DynaLoader/DynaLoader_pm.PL index 24c8bea36c..bd95625822 100644 --- a/ext/DynaLoader/DynaLoader_pm.PL +++ b/ext/DynaLoader/DynaLoader_pm.PL @@ -85,7 +85,7 @@ package DynaLoader; # [email protected], August 1994 BEGIN { - $VERSION = '1.41'; + $VERSION = '1.42'; } EOT @@ -373,7 +373,7 @@ sub bootstrap { $bs =~ s/(\.\w+)?(;\d*)?$/\.bs/; # look for .bs 'beside' the library if (-s $bs) { # only read file if it's not empty print STDERR "BS: $bs ($^O, $dlsrc)\n" if $dl_debug; - eval { do $bs; }; + eval { local @INC = ('.'); do $bs; }; warn "$bs: $@\n" if $@; } diff --git a/ext/Pod-Html/t/crossref.t b/ext/Pod-Html/t/crossref.t index bc033c46e2..49309d9f7d 100644 --- a/ext/Pod-Html/t/crossref.t +++ b/ext/Pod-Html/t/crossref.t @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # -*- perl -*- BEGIN { - require "t/pod2html-lib.pl"; + require "./t/pod2html-lib.pl"; } END { diff --git a/ext/Pod-Html/t/crossref2.t b/ext/Pod-Html/t/crossref2.t index 70eae7e2bb..06dfcc2880 100644 --- a/ext/Pod-Html/t/crossref2.t +++ b/ext/Pod-Html/t/crossref2.t @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # -*- perl -*- BEGIN { - require "t/pod2html-lib.pl"; + require "./t/pod2html-lib.pl"; } END { diff --git a/ext/Pod-Html/t/crossref3.t b/ext/Pod-Html/t/crossref3.t index cfa0abcfcf..eb6c834858 100644 --- a/ext/Pod-Html/t/crossref3.t +++ b/ext/Pod-Html/t/crossref3.t @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # -*- perl -*- BEGIN { - require "t/pod2html-lib.pl"; + require "./t/pod2html-lib.pl"; } END { diff --git a/ext/Pod-Html/t/feature.t b/ext/Pod-Html/t/feature.t index 94354c75f9..313928117f 100644 --- a/ext/Pod-Html/t/feature.t +++ b/ext/Pod-Html/t/feature.t @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # -*- perl -*- BEGIN { - require "t/pod2html-lib.pl"; + require "./t/pod2html-lib.pl"; } use strict; diff --git a/ext/Pod-Html/t/feature2.t b/ext/Pod-Html/t/feature2.t index 0cc0072505..dfafbe9e40 100644 --- a/ext/Pod-Html/t/feature2.t +++ b/ext/Pod-Html/t/feature2.t @@ -2,7 +2,7 @@ BEGIN { - require "t/pod2html-lib.pl"; + require "./t/pod2html-lib.pl"; } use strict; diff --git a/ext/Pod-Html/t/htmldir1.t b/ext/Pod-Html/t/htmldir1.t index 6a0857bd2b..88d02a5087 100644 --- a/ext/Pod-Html/t/htmldir1.t +++ b/ext/Pod-Html/t/htmldir1.t @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # -*- perl -*- BEGIN { - require "t/pod2html-lib.pl"; + require "./t/pod2html-lib.pl"; } END { diff --git a/ext/Pod-Html/t/htmldir2.t b/ext/Pod-Html/t/htmldir2.t index d9aab5efb7..bf2d02c715 100644 --- a/ext/Pod-Html/t/htmldir2.t +++ b/ext/Pod-Html/t/htmldir2.t @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # -*- perl -*- BEGIN { - require "t/pod2html-lib.pl"; + require "./t/pod2html-lib.pl"; } use strict; diff --git a/ext/Pod-Html/t/htmldir3.t b/ext/Pod-Html/t/htmldir3.t index 8006bf017c..843620be6c 100644 --- a/ext/Pod-Html/t/htmldir3.t +++ b/ext/Pod-Html/t/htmldir3.t @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # -*- perl -*- BEGIN { - require "t/pod2html-lib.pl"; + require "./t/pod2html-lib.pl"; } END { diff --git a/ext/Pod-Html/t/htmldir4.t b/ext/Pod-Html/t/htmldir4.t index 31e7bdee70..01b4f57408 100644 --- a/ext/Pod-Html/t/htmldir4.t +++ b/ext/Pod-Html/t/htmldir4.t @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # -*- perl -*- BEGIN { - require "t/pod2html-lib.pl"; + require "./t/pod2html-lib.pl"; } use strict; diff --git a/ext/Pod-Html/t/htmldir5.t b/ext/Pod-Html/t/htmldir5.t index 820590f2da..bf03e5e377 100644 --- a/ext/Pod-Html/t/htmldir5.t +++ b/ext/Pod-Html/t/htmldir5.t @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # -*- perl -*- BEGIN { - require "t/pod2html-lib.pl"; + require "./t/pod2html-lib.pl"; } END { diff --git a/ext/Pod-Html/t/htmlescp.t b/ext/Pod-Html/t/htmlescp.t index bb85e83935..655b521909 100644 --- a/ext/Pod-Html/t/htmlescp.t +++ b/ext/Pod-Html/t/htmlescp.t @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # -*- perl -*- BEGIN { - require "t/pod2html-lib.pl"; + require "./t/pod2html-lib.pl"; } use strict; diff --git a/ext/Pod-Html/t/htmllink.t b/ext/Pod-Html/t/htmllink.t index b13bf0cdf8..e9aade506e 100644 --- a/ext/Pod-Html/t/htmllink.t +++ b/ext/Pod-Html/t/htmllink.t @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # -*- perl -*- BEGIN { - require "t/pod2html-lib.pl"; + require "./t/pod2html-lib.pl"; } use strict; diff --git a/ext/Pod-Html/t/htmlview.t b/ext/Pod-Html/t/htmlview.t index 06914d10c0..a95a0abf77 100644 --- a/ext/Pod-Html/t/htmlview.t +++ b/ext/Pod-Html/t/htmlview.t @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # -*- perl -*- BEGIN { - require "t/pod2html-lib.pl"; + require "./t/pod2html-lib.pl"; } use strict; diff --git a/ext/Pod-Html/t/poderr.t b/ext/Pod-Html/t/poderr.t index f83057eceb..ae1a751f95 100644 --- a/ext/Pod-Html/t/poderr.t +++ b/ext/Pod-Html/t/poderr.t @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # -*- perl -*- BEGIN { - require "t/pod2html-lib.pl"; + require "./t/pod2html-lib.pl"; } use strict; diff --git a/ext/Pod-Html/t/podnoerr.t b/ext/Pod-Html/t/podnoerr.t index b49a3ac1cf..3679a7b1fd 100644 --- a/ext/Pod-Html/t/podnoerr.t +++ b/ext/Pod-Html/t/podnoerr.t @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # -*- perl -*- BEGIN { - require "t/pod2html-lib.pl"; + require "./t/pod2html-lib.pl"; } use strict; diff --git a/ext/XS-APItest/APItest_BS b/ext/XS-APItest/APItest_BS new file mode 100644 index 0000000000..270dc9c682 --- /dev/null +++ b/ext/XS-APItest/APItest_BS @@ -0,0 +1,7 @@ +# +# test that non-empty .bs files get executed + +$bscode = <<'EOF'; +$::bs_file_got_executed = 1; +EOF + diff --git a/ext/XS-APItest/t/blockhooks.t b/ext/XS-APItest/t/blockhooks.t index 37590bc7ab..a2a5486aed 100644 --- a/ext/XS-APItest/t/blockhooks.t +++ b/ext/XS-APItest/t/blockhooks.t @@ -5,6 +5,9 @@ use strict; use Test::More tests => 17; use XS::APItest; + +BEGIN { push @INC, '.' } # t/BHK.pm is in ext/XS-APItest/ directory + use t::BHK (); # make sure it gets compiled early BEGIN { package XS::APItest; *main::bhkav = \@XS::APItest::bhkav } diff --git a/ext/XS-APItest/t/bootstrap.t b/ext/XS-APItest/t/bootstrap.t new file mode 100644 index 0000000000..6992b10850 --- /dev/null +++ b/ext/XS-APItest/t/bootstrap.t @@ -0,0 +1,17 @@ +#!perl -w +# +# check that .bs files are loaded and executed. +# During build of XS::APItest, the presence of APItest_BS should +# cause a non-empty APItest.bs file to auto-generated. When loading +# APItest.so, the .bs should be automatically executed, which should +# set $::bs_file_got_executed. + +use strict; + +use Test::More; +use XS::APItest; + +is $::bs_file_got_executed, 1, "BS file was executed"; + +done_testing(); + diff --git a/ext/XS-APItest/t/labelconst.t b/ext/XS-APItest/t/labelconst.t index f3a7d9c9cd..aed3afbd1a 100644 --- a/ext/XS-APItest/t/labelconst.t +++ b/ext/XS-APItest/t/labelconst.t @@ -89,7 +89,7 @@ isnt $@, ""; is $t, ""; $t = ""; -$t = do("t/labelconst.aux"); +$t = do("./t/labelconst.aux"); is $@, ""; is $t, "FOOBARBAZQUUX"; @@ -163,7 +163,7 @@ is $t, "FOOBARBAZQUUX"; { use utf8; $t = ""; - $t = do("t/labelconst_utf8.aux"); + $t = do("./t/labelconst_utf8.aux"); is $@, ""; is $t, "FÇÇBÃRáÃZQÃÃX"; } diff --git a/ext/arybase/t/scope.t b/ext/arybase/t/scope.t index 07b4176977..5fca19610c 100644 --- a/ext/arybase/t/scope.t +++ b/ext/arybase/t/scope.t @@ -30,6 +30,7 @@ is $t[3], "a"; is $t[3], "e"; } is $t[3], "a"; +BEGIN { push @INC, '.' } use t::scope_0; is scope0_test(), "d"; diff --git a/lib/B/Deparse.t b/lib/B/Deparse.t index c378fec15a..7eeb4f813b 100644 --- a/lib/B/Deparse.t +++ b/lib/B/Deparse.t @@ -7,7 +7,7 @@ BEGIN { print "1..0 # Skip -- Perl configured without B module\n"; exit 0; } - require 'test.pl'; + require './test.pl'; } use warnings; diff --git a/regcharclass.h b/regcharclass.h index f66d1479e9..273176af22 100644 --- a/regcharclass.h +++ b/regcharclass.h @@ -1900,6 +1900,6 @@ * 79a7216aceb1d291f2857085545fdda289518bc540a09bc0a15cde105d76028d lib/unicore/mktables * cdecb300baad839a6f62791229f551a4fa33f3cbdca08e378dc976466354e778 lib/unicore/version * 913d2f93f3cb6cdf1664db888bf840bc4eb074eef824e082fceda24a9445e60c regen/charset_translations.pl - * 1d27ae8b75d81a082b1fc594673e08540280f8169309a7b5047015c8091a2bfb regen/regcharclass.pl + * c468aea5062ef84422219d74e83b6f3216f2823544b445f53ee1af71deeb2044 regen/regcharclass.pl * 393f8d882713a3ba227351ad0f00ea4839fda74fcf77dcd1cdf31519925adba5 regen/regcharclass_multi_char_folds.pl * ex: set ro: */ diff --git a/regen/regcharclass.pl b/regen/regcharclass.pl index 0009994bb0..510fb8931d 100755 --- a/regen/regcharclass.pl +++ b/regen/regcharclass.pl @@ -13,7 +13,7 @@ $|=1 if DEBUG; require './regen/regen_lib.pl'; require './regen/charset_translations.pl'; -require "regen/regcharclass_multi_char_folds.pl"; +require "./regen/regcharclass_multi_char_folds.pl"; =head1 NAME 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 diff --git a/t/loc_tools.pl b/t/loc_tools.pl index 4b99c45618..ed24c37c7f 100644 --- a/t/loc_tools.pl +++ b/t/loc_tools.pl @@ -342,9 +342,9 @@ sub find_locales ($;$) { # Locales whose name differs if the utf8 bit is on are stored in these two # files with appropriate encodings. if ($^H & 0x08 || (${^OPEN} || "") =~ /:utf8/) { - @Data = do "lib/locale/utf8"; + @Data = do "./lib/locale/utf8"; } else { - @Data = do "lib/locale/latin1"; + @Data = do "./lib/locale/latin1"; } # The rest of the locales are in this file. diff --git a/t/porting/bench.t b/t/porting/bench.t index bbebd377b8..d15474c1c8 100644 --- a/t/porting/bench.t +++ b/t/porting/bench.t @@ -2,14 +2,9 @@ # run Porting/bench.pl's selftest -BEGIN { - @INC = '..' if -f '../TestInit.pm'; -} -use TestInit qw(T A); # T is chdir to the top level, A makes paths absolute use strict; +chdir '..' if -f 'test.pl' && -f 'thread_it.pl'; require './t/test.pl'; -my $source = find_git_or_skip('all'); -chdir $source or die "Can't chdir to $source: $!"; -system "$^X Porting/bench.pl --action=selftest"; +system "$^X -I. -MTestInit Porting/bench.pl --action=selftest"; diff --git a/t/porting/copyright.t b/t/porting/copyright.t index daa95f806e..8a469cda89 100644 --- a/t/porting/copyright.t +++ b/t/porting/copyright.t @@ -18,13 +18,9 @@ working on older releases. It should be run before making a new release. =cut -BEGIN { - unshift @INC, '.' if -f 'TestInit.pm'; -} -use TestInit; use strict; use Config; -BEGIN { require 'test.pl' } +BEGIN { require './test.pl' } if ( $Config{usecrosscompile} ) { skip_all( "Not all files are available during cross-compilation" ); diff --git a/t/run/dtrace.t b/t/run/dtrace.t index 21409738ab..b66736ff19 100644 --- a/t/run/dtrace.t +++ b/t/run/dtrace.t @@ -136,7 +136,7 @@ dtrace_like(<< 'PERL_SCRIPT', BEGIN {@INC = '../lib'} use strict; require HTTP::Tiny; - do "run/dtrace.pl"; + do "./run/dtrace.pl"; PERL_SCRIPT << 'D_SCRIPT', loading-file { printf("loading-file <%s>\n", copyinstr(arg0)) } diff --git a/t/thread_it.pl b/t/thread_it.pl index 4a0cbdcd8a..6389df2907 100644 --- a/t/thread_it.pl +++ b/t/thread_it.pl @@ -19,7 +19,7 @@ my $caller = (caller)[1]; die "Can't figure out which test to run from filename '$caller'" unless $caller =~ m!((?:op|re)/[-_a-z0-9A-Z]+)_thr\.t\z!; -my $file = "$1.t"; +my $file = "./$1.t"; $::running_as_thread = "running tests in a new thread"; require $file; diff --git a/t/uni/lower.t b/t/uni/lower.t index 31fd1f7159..a215f60bc7 100644 --- a/t/uni/lower.t +++ b/t/uni/lower.t @@ -4,7 +4,7 @@ BEGIN { print("1..0 # miniperl: no Unicode::Normalize"); exit(0); } - require "uni/case.pl"; + require "./uni/case.pl"; } use feature 'unicode_strings'; diff --git a/t/uni/title.t b/t/uni/title.t index 458ca8efd1..45c895f709 100644 --- a/t/uni/title.t +++ b/t/uni/title.t @@ -4,7 +4,7 @@ BEGIN { print("1..0 # miniperl: no Unicode::Normalize"); exit(0); } - require "uni/case.pl"; + require "./uni/case.pl"; } use feature 'unicode_strings'; diff --git a/t/uni/upper.t b/t/uni/upper.t index 532f4bdd7b..252b51ce39 100644 --- a/t/uni/upper.t +++ b/t/uni/upper.t @@ -4,7 +4,7 @@ BEGIN { print("1..0 # miniperl: no Unicode::Normalize"); exit(0); } - require "uni/case.pl"; + require "./uni/case.pl"; } use feature 'unicode_strings'; diff --git a/utils/libnetcfg.PL b/utils/libnetcfg.PL index f66e9b0acb..e1e9ee270f 100644 --- a/utils/libnetcfg.PL +++ b/utils/libnetcfg.PL @@ -343,7 +343,7 @@ my %oldcfg = (); $Net::Config::CONFIGURE = 1; # Suppress load of user overrides if( -f $libnet_cfg_in ) { - %oldcfg = ( %{ do $libnet_cfg_in } ); + %oldcfg = ( %{ local @INC = '.'; do $libnet_cfg_in } ); } elsif (eval { require Net::Config }) { diff --git a/win32/ce-helpers/makedist.pl b/win32/ce-helpers/makedist.pl index 2ad0f70c9f..daf4f3e96c 100644 --- a/win32/ce-helpers/makedist.pl +++ b/win32/ce-helpers/makedist.pl @@ -237,6 +237,7 @@ sub bootstrap { my $bs = $file; $bs =~ s/(\.\w+)?(;\d*)?$/\.bs/; if (-s $bs) { # only read file if it's not empty + local @INC = ('.'); do $bs; warn "$bs: $@\n" if $@; } -- Perl5 Master Repository
