From: Dan Brook Date: Sun, 31 Oct 2010 17:59:58 +0000 (+0000) Subject: Bootstrap test fixes. X-Git-Tag: 0.002007~16 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FGitalist.git;a=commitdiff_plain;h=bc33a9b1ad2ff2573fb6b2cb5184cefa002f5354 Bootstrap test fixes. The author tests were failing in a bootstrapped environment as the env script only looked at the current or the parent directory for local-lib5. Also fixed the POD tests to look under lib so as to avoid trawling local-lib5 for unrelated modules. Fixed the tag and head tests to make use of env. --- diff --git a/.gitignore b/.gitignore index d939243..2dae08f 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,5 @@ MANIFEST.bak *~ .#* *# +local-lib5/* +*.orig diff --git a/script/env b/script/env index 7f96991..cfa7493 100755 --- a/script/env +++ b/script/env @@ -30,14 +30,25 @@ use warnings; use Carp; use lib; use FindBin; +use File::Spec (); -my $basedir; -if (-r "$FindBin::Bin/Makefile.PL") { - $basedir = $FindBin::Bin; -} -elsif (-r "$FindBin::Bin/../Makefile.PL") { - $basedir = "$FindBin::Bin/.."; -} +# Look up to see find Makefile.PL aka the base of the local::lib install. +my $lookup; $lookup = sub { + my $dir = $_[0] || '.'; + + my(undef, $dirbit) = File::Spec->splitpath($FindBin::Bin); + my $trydir = File::Spec->catdir($dirbit, $dir); + + return '' unless -d $trydir; + + my $tryfile = File::Spec->catfile($trydir, "Makefile.PL"); + + return $trydir if -r $tryfile; + + return $lookup->( File::Spec->catdir($dir, File::Spec->updir) ); +}; + +my $basedir = $lookup->(); $basedir ||= ''; my $target = "$basedir/local-lib5"; diff --git a/t/02git_head.t b/t/02git_head.t index be92102..8c6ffdd 100644 --- a/t/02git_head.t +++ b/t/02git_head.t @@ -1,3 +1,11 @@ +use FindBin qw/$Bin/; +BEGIN { + my $env = "$FindBin::Bin/../script/env"; + if (-r $env) { + do $env or die $@; + } +} + use strict; use warnings; use Test::More qw/no_plan/; diff --git a/t/02git_tag.t b/t/02git_tag.t index 3647cb1..baa9983 100644 --- a/t/02git_tag.t +++ b/t/02git_tag.t @@ -1,3 +1,10 @@ +use FindBin qw/$Bin/; +BEGIN { + my $env = "$FindBin::Bin/../script/env"; + if (-r $env) { + do $env or die $@; + } +} use strict; use warnings; use Test::More qw/no_plan/; diff --git a/t/author/notabs.t b/t/author/notabs.t index 693e048..004c15f 100644 --- a/t/author/notabs.t +++ b/t/author/notabs.t @@ -1,3 +1,10 @@ +use FindBin qw/$Bin/; +BEGIN { + my $env = "$FindBin::Bin/../../script/env"; + if (-r $env) { + do $env or die $@; + } +} use Test::NoTabs; all_perl_files_ok(qw(t lib)); diff --git a/t/author/pod.t b/t/author/pod.t index 3c6d16f..6b914af 100644 --- a/t/author/pod.t +++ b/t/author/pod.t @@ -1,8 +1,16 @@ #!/usr/bin/env perl +use FindBin qw/$Bin/; +BEGIN { + my $env = "$FindBin::Bin/../../script/env"; + if (-r $env) { + do $env or die $@; + } +} + use strict; use warnings; use Test::More; use Test::Pod 1.14; -all_pod_files_ok(); +all_pod_files_ok( all_pod_files('lib') ); diff --git a/t/author/podcoverage.t b/t/author/podcoverage.t index 1e43732..7cb9f58 100644 --- a/t/author/podcoverage.t +++ b/t/author/podcoverage.t @@ -1,14 +1,21 @@ -#!/usr/bin/env perl +use FindBin qw/$Bin/; +BEGIN { + my $env = "$FindBin::Bin/../../script/env"; + if (-r $env) { + do $env or die $@; + } +} + use strict; use warnings; use Test::More; use Test::Pod::Coverage 1.04; -all_pod_coverage_ok({ +pod_coverage_ok($_, { also_private => [qw/ BUILD BUILDARGS build_per_context_instance /], -}); +}) for all_modules('lib');