summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-06-19 21:44:37 +0200
committerNicholas Clark <nick@ccl4.org>2011-06-22 22:41:18 +0200
commit7eccb5a9a1fbf12db8dc44deb2f31e15c934326b (patch)
tree418aa30d3b29962db15181cc9c50d9a155196d5a /t
parent7cadc1d05427224f84d0bb7974e4f6f348841038 (diff)
downloadperl-7eccb5a9a1fbf12db8dc44deb2f31e15c934326b.tar.gz
find_git_or_skip() will now follow symlinks and chdir to the real source tree.
porting{authors,cmp_version,manifest}.t now use TestInit qw(T A) to set @INC and $^X to absolute paths, in case find_git_or_skip() changes directory. As $^X is now absolute, there's no need to choose between '/' and '\\' based on $^O.
Diffstat (limited to 't')
-rw-r--r--t/porting/authors.t5
-rw-r--r--t/porting/cmp_version.t6
-rw-r--r--t/porting/manifest.t2
-rw-r--r--t/test.pl12
4 files changed, 17 insertions, 8 deletions
diff --git a/t/porting/authors.t b/t/porting/authors.t
index 8777986c55..f67e93094c 100644
--- a/t/porting/authors.t
+++ b/t/porting/authors.t
@@ -4,13 +4,12 @@
BEGIN {
@INC = '..' if -f '../TestInit.pm';
}
-use TestInit 'T'; # T is chdir to the top level
+use TestInit qw(T A); # T is chdir to the top level, A makes paths absolute
use strict;
require 't/test.pl';
find_git_or_skip('all');
-my $dotslash = $^O eq "MSWin32" ? ".\\" : "./";
-system("git log --pretty=fuller | ${dotslash}perl Porting/checkAUTHORS.pl --tap -");
+system("git log --pretty=fuller | $^X Porting/checkAUTHORS.pl --tap -");
# EOF
diff --git a/t/porting/cmp_version.t b/t/porting/cmp_version.t
index 2e3f15da2d..6204c57612 100644
--- a/t/porting/cmp_version.t
+++ b/t/porting/cmp_version.t
@@ -8,12 +8,10 @@
BEGIN {
@INC = '..' if -f '../TestInit.pm';
}
-use TestInit 'T'; # T is chdir to the top level
+use TestInit qw(T A); # T is chdir to the top level, A makes paths absolute
use strict;
require 't/test.pl';
find_git_or_skip('all');
-my $dotslash = $^O eq "MSWin32" ? ".\\" : "./";
-
-system "${dotslash}perl Porting/cmpVERSION.pl --exclude --tap";
+system "$^X Porting/cmpVERSION.pl --exclude --tap";
diff --git a/t/porting/manifest.t b/t/porting/manifest.t
index caad26561f..292631ee2b 100644
--- a/t/porting/manifest.t
+++ b/t/porting/manifest.t
@@ -5,7 +5,7 @@
BEGIN {
@INC = '..' if -f '../TestInit.pm';
}
-use TestInit 'T'; # T is chdir to the top level
+use TestInit qw(T A); # T is chdir to the top level, A makes paths absolute
require 't/test.pl';
diff --git a/t/test.pl b/t/test.pl
index c11d0b88f3..5a43da38b6 100644
--- a/t/test.pl
+++ b/t/test.pl
@@ -154,6 +154,18 @@ sub skip_all_without_config {
sub find_git_or_skip {
return if -d '.git';
+ if (-l 'MANIFEST' && -l 'AUTHORS') {
+ my $where = readlink 'MANIFEST';
+ die "Can't readling MANIFEST: $!" unless defined $where;
+ die "Confusing symlink target for MANIFEST, '$where'"
+ unless $where =~ s!/MANIFEST\z!!;
+ if (-d "$where/.git") {
+ # Looks like we are in a symlink tree
+ chdir $where or die "Can't chdir '$where': $!";
+ note("Found source tree at $where");
+ return;
+ }
+ }
my $reason = 'not being run from a git checkout';
skip_all($reason) if $_[0] && $_[0] eq 'all';
skip($reason, @_);