In perl.git, the branch smoke-me/cmpVERSION has been updated <http://perl5.git.perl.org/perl.git/commitdiff/ff5df33403d55c9558fac101ad38cc0776a1fb4f?hp=c7c9147205076b0248c3c87a53e6e970dcc557aa>
- Log ----------------------------------------------------------------- commit ff5df33403d55c9558fac101ad38cc0776a1fb4f Author: Nicholas Clark <[email protected]> Date: Tue Jun 5 16:07:40 2012 +0200 Avoid tests converting @INC to abs paths where no longer necessary. As find_git_or_skip() no longer changes directory, no need to make paths in @INC absolute in the various tests that use it. M t/porting/authors.t M t/porting/manifest.t M t/porting/pending-author.t commit 8e481da070d5c4c7502db0204e802ec69019a51e Author: Nicholas Clark <[email protected]> Date: Tue Jun 5 15:55:22 2012 +0200 Set GIT_DIR instead of changing directory in find_git_or_skip() in test.pl Return the directory of the source tree, so that tests can change directory to it if necessary. Modify t/porting/cmp_version.t to change directory. This gets t/porting/utils.t passing again under -Dmksymlinks, without breaking t/porting/cmp_version.t. The former needs to run in the build tree as it inspects various build products. The latter needs to run in the (real) checkout tree, else it thinks that every single file has changed (into a symlink). M t/porting/cmp_version.t M t/test.pl ----------------------------------------------------------------------- Summary of changes: t/porting/authors.t | 2 +- t/porting/cmp_version.t | 3 ++- t/porting/manifest.t | 2 +- t/porting/pending-author.t | 2 +- t/test.pl | 18 +++++++++++------- 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/t/porting/authors.t b/t/porting/authors.t index 9b9ba7c..bc69e3a 100644 --- a/t/porting/authors.t +++ b/t/porting/authors.t @@ -4,7 +4,7 @@ BEGIN { @INC = '..' if -f '../TestInit.pm'; } -use TestInit qw(T A); # T is chdir to the top level, A makes paths absolute +use TestInit qw(T); # T is chdir to the top level use strict; require 't/test.pl'; diff --git a/t/porting/cmp_version.t b/t/porting/cmp_version.t index 6204c57..e7627e4 100644 --- a/t/porting/cmp_version.t +++ b/t/porting/cmp_version.t @@ -12,6 +12,7 @@ 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 $source = find_git_or_skip('all'); +chdir $source or die "Can't chdir to $source: $!"; system "$^X Porting/cmpVERSION.pl --exclude --tap"; diff --git a/t/porting/manifest.t b/t/porting/manifest.t index 068540c..ea4fe83 100644 --- a/t/porting/manifest.t +++ b/t/porting/manifest.t @@ -5,7 +5,7 @@ BEGIN { @INC = '..' if -f '../TestInit.pm'; } -use TestInit qw(T A); # T is chdir to the top level, A makes paths absolute +use TestInit qw(T); # T is chdir to the top level require 't/test.pl'; diff --git a/t/porting/pending-author.t b/t/porting/pending-author.t index 6bc392b..3506115 100644 --- a/t/porting/pending-author.t +++ b/t/porting/pending-author.t @@ -23,7 +23,7 @@ BEGIN { @INC = '..' if -f '../TestInit.pm'; } -use TestInit qw(T A); # T is chdir to the top level, A makes paths absolute +use TestInit qw(T); # T is chdir to the top level use strict; require 't/test.pl'; diff --git a/t/test.pl b/t/test.pl index b33c634..9d1da29 100644 --- a/t/test.pl +++ b/t/test.pl @@ -153,9 +153,9 @@ sub skip_all_without_config { } sub find_git_or_skip { - my ($found_dir, $reason); + my ($source_dir, $reason); if (-d '.git') { - $found_dir = 1; + $source_dir = '.'; } elsif (-l 'MANIFEST' && -l 'AUTHORS') { my $where = readlink 'MANIFEST'; die "Can't readling MANIFEST: $!" unless defined $where; @@ -163,16 +163,20 @@ sub find_git_or_skip { 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"); - $found_dir = 1; + if (exists $ENV{GIT_DIR}) { + diag("Found source tree at $where, but \$ENV{GIT_DIR} is $ENV{GIT_DIR}. Not changing it"); + } else { + note("Found source tree at $where, setting \$ENV{GIT_DIR}"); + $ENV{GIT_DIR} = "$where/.git"; + } + $source_dir = $where; } } - if ($found_dir) { + if ($source_dir) { my $version_string = `git --version`; if (defined $version_string && $version_string =~ /\Agit version (\d+\.\d+\.\d+)(.*)/) { - return if eval "v$1 ge v1.5.0"; + return $source_dir if eval "v$1 ge v1.5.0"; # If you have earlier than 1.5.0 and it works, change this test $reason = "in git checkout, but git version '$1$2' too old"; } else { -- Perl5 Master Repository
