Front page | perl.perl5.changes |
Postings from August 2009
[perl.git] branch blead, updated. GitLive-blead-1978-g30b6e59
From:
Nicholas Clark
Date:
August 30, 2009 03:17
Subject:
[perl.git] branch blead, updated. GitLive-blead-1978-g30b6e59
Message ID:
E1MhhT5-0007PC-74@camel.booking.com
In perl.git, the branch blead has been updated
<http://perl5.git.perl.org/perl.git/commitdiff/30b6e59101b252c20a6b50b95203d1e2c6016604?hp=a241c56a76208c420809bef87d887e6be7da1487>
- Log -----------------------------------------------------------------
commit 30b6e59101b252c20a6b50b95203d1e2c6016604
Author: Nicholas Clark <nick@ccl4.org>
Date: Sun Aug 30 11:16:40 2009 +0100
Move TestInit.pm to the top level of the distribution, to make it easier to use.
M MANIFEST
A TestInit.pm
M t/TEST
D t/TestInit.pm
commit 8fcfece7bab676394365d24dfa216bd2e885e268
Author: Nicholas Clark <nick@ccl4.org>
Date: Sun Aug 30 10:22:51 2009 +0100
TestInit now also sets up the CWD and @INC for tests in ext.
M t/TestInit.pm
-----------------------------------------------------------------------
Summary of changes:
MANIFEST | 2 +-
t/TestInit.pm => TestInit.pm | 25 ++++++++++++++++++++-----
t/TEST | 6 +++---
3 files changed, 24 insertions(+), 9 deletions(-)
rename t/TestInit.pm => TestInit.pm (76%)
diff --git a/MANIFEST b/MANIFEST
index 0c20ae4..e492462 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -3986,6 +3986,7 @@ t/comp/term.t See if more terms work
t/comp/uproto.t See if the _ prototype works
t/comp/use.t See if pragmata work
t/comp/utf.t See if UTFs work
+TestInit.pm Preamble library for tests
t/harness Finer diagnostics from test suite
thread.h Threading header
time64.c 64 bit clean time.h (code)
@@ -4406,7 +4407,6 @@ t/run/switchx2.aux Data for switchx.t
t/run/switchx.aux Data for switchx.t
t/run/switchx.t Test the -x switch
t/TEST The regression tester
-t/TestInit.pm Preamble library for core tests
t/test.pl Simple testing library
t/thread_it.pl Run regression tests in a new thread
t/uni/cache.t See if Unicode swash caching works
diff --git a/t/TestInit.pm b/TestInit.pm
similarity index 76%
rename from t/TestInit.pm
rename to TestInit.pm
index 253de71..3d03ed8 100644
--- a/t/TestInit.pm
+++ b/TestInit.pm
@@ -20,9 +20,6 @@ package TestInit;
$VERSION = 1.02;
-# This is incompatible with the import options.
-chdir 't' if -f 't/TestInit.pm';
-
# Let tests know they're running in the perl core. Useful for modules
# which live dual lives on CPAN.
# Don't interfere with the taintedness of %ENV, this could perturbate tests.
@@ -56,14 +53,32 @@ sub set_opt {
}
}
-new_inc('../lib');
+my @up_2_t = ('../../lib', '../../t');
+# This is incompatible with the import options.
+if (-f 't/TEST' && -f 'MANIFEST' && -d 'lib' && -d 'ext') {
+ # We're being run from the top level. Try to change directory, and set
+ # things up correctly. This is a 90% solution, but for hand-running tests,
+ # that's good enough
+ if ($0 =~ s!(ext[\\/][^\\/]+)[\//](.*\.t)$!$2!) {
+ # Looks like a test in ext.
+ chdir $1 or die "Can't chdir '$1': $!";
+ new_inc(@up_2_t);
+ $^X =~ s!^\./!../../perl!;
+ $^X =~ s!^\.\\!..\\..\\perl!;
+ } else {
+ chdir 't' or die "Can't chdir 't': $!";
+ new_inc('../lib');
+ }
+} else {
+ new_inc('../lib');
+}
sub import {
my $self = shift;
my $abs;
foreach (@_) {
if ($_ eq 'U2T') {
- @new_inc = ('../../lib', '../../t');
+ @new_inc = @up_2_t;
} elsif ($_ eq 'NC') {
delete $ENV{PERL_CORE}
} elsif ($_ eq 'A') {
diff --git a/t/TEST b/t/TEST
index 912e4ef..0231332 100755
--- a/t/TEST
+++ b/t/TEST
@@ -20,7 +20,7 @@ my %dir_to_switch =
(base => '',
comp => '',
run => '',
- '../ext/File-Glob/t' => '-I. -MTestInit', # FIXME - tests assume t/
+ '../ext/File-Glob/t' => '-I.. -MTestInit', # FIXME - tests assume t/
);
my %temp_no_core =
@@ -198,13 +198,13 @@ sub _run_test {
$return_dir = '../../t';
$lib = '../../lib';
$perl = '../../t/perl';
- $testswitch = "-I$return_dir -MTestInit=U2T,A";
+ $testswitch = "-I../.. -MTestInit=U2T,A";
if ($temp_no_core{$ext_dir}) {
$testswitch = $testswitch . ',NC';
}
chdir $ext_dir or die "Can't chdir to '$ext_dir': $!";
} else {
- $testswitch = '-I. -MTestInit'; # -T will remove . from @INC
+ $testswitch = '-I.. -MTestInit'; # -T will remove . from @INC
}
}
--
Perl5 Master Repository
-
[perl.git] branch blead, updated. GitLive-blead-1978-g30b6e59
by Nicholas Clark