From 7eccb5a9a1fbf12db8dc44deb2f31e15c934326b Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Sun, 19 Jun 2011 21:44:37 +0200 Subject: [PATCH] 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. --- t/porting/authors.t | 5 ++--- t/porting/cmp_version.t | 6 ++---- t/porting/manifest.t | 2 +- t/test.pl | 12 ++++++++++++ 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/t/porting/authors.t b/t/porting/authors.t index 8777986..f67e930 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 2e3f15d..6204c57 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 caad265..292631e 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 c11d0b8..5a43da3 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, @_); -- 2.7.4