summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2010-12-17 17:18:33 +0000
committerNicholas Clark <nick@ccl4.org>2010-12-17 17:20:28 +0000
commitd5fbd9dd00e27f435423fd4898ed0e5804de0fd6 (patch)
treefbeda16331b4c8783bfb0d2357f3891401cd369c
parent3e92488813b7b571b0de139f466ad8ec01152995 (diff)
downloadperl-d5fbd9dd00e27f435423fd4898ed0e5804de0fd6.tar.gz
Refactor ExtUtils::Constant's tests to pass cleanly on older versions.
Work round bugs with the value of ~0 on 5.005 built on 64 bit systems. Convert @INC to absolute paths on 5.6.x so that ExtUtils::Constant::Aaargh56Hash will load from blib. Remove $runperl, which is no longer needed.
-rw-r--r--cpan/ExtUtils-Constant/t/Constant.t35
1 files changed, 24 insertions, 11 deletions
diff --git a/cpan/ExtUtils-Constant/t/Constant.t b/cpan/ExtUtils-Constant/t/Constant.t
index 58053879b9..5cc6f498db 100644
--- a/cpan/ExtUtils-Constant/t/Constant.t
+++ b/cpan/ExtUtils-Constant/t/Constant.t
@@ -20,20 +20,19 @@ my $keep_files = 0;
$| = 1;
# Because were are going to be changing directory before running Makefile.PL
-my $perl = $^X;
# 5.005 doesn't have new enough File::Spec to have rel2abs. But actually we
# only need it when $^X isn't absolute, which is going to be 5.8.0 or later
# (where ExtUtils::Constant is in the core, and tests against the uninstalled
# perl)
-$perl = File::Spec->rel2abs ($perl) unless $] < 5.006;
+my $perl = $] < 5.006 ? $^X : File::Spec->rel2abs($^X);
# ExtUtils::Constant::C_constant uses $^X inside a comment, and we want to
# compare output to ensure that it is the same. We were probably run as ./perl
# whereas we will run the child with the full path in $perl. So make $^X for
# us the same as our child will see.
$^X = $perl;
-my $lib = $ENV{PERL_CORE} ? '../../../lib' : '../../blib/lib';
-my $runperl = "$perl \"-I$lib\"";
-print "# perl=$perl\n";
+# 5.005 doesn't have rel2abs, but also doesn't need to load an uninstalled
+# module from blib
+@INC = map {File::Spec->rel2abs($_)} @INC if $] < 5.007 && $] >= 5.006;
my $make = $Config{make};
$make = $ENV{MAKE} if exists $ENV{MAKE};
@@ -149,9 +148,9 @@ sub check_for_bonus_files {
sub build_and_run {
my ($tests, $expect, $files) = @_;
my $core = $ENV{PERL_CORE} ? ' PERL_CORE=1' : '';
- my @perlout = `$runperl Makefile.PL $core`;
+ my @perlout = `$perl Makefile.PL $core`;
if ($?) {
- print "not ok $realtest # $runperl Makefile.PL failed: $?\n";
+ print "not ok $realtest # $perl Makefile.PL failed: $?\n";
print "# $_" foreach @perlout;
exit($?);
} else {
@@ -261,14 +260,14 @@ sub build_and_run {
print REGENTMP $_ if $saw_shebang;
}
close XS; close REGENTMP;
- $regen = `$runperl regentmp`;
+ $regen = `$perl regentmp`;
unlink 'regentmp';
}
else {
- $regen = `$runperl -x $package.xs`;
+ $regen = `$perl -x $package.xs`;
}
if ($?) {
- print "not ok $realtest # $runperl -x $package.xs failed: $?\n";
+ print "not ok $realtest # $perl -x $package.xs failed: $?\n";
} else {
print "ok $realtest - regen\n";
}
@@ -636,15 +635,29 @@ if ($farthing == 0.25) {
}
$test++;
+EOT
+
+ my $cond;
+ if ($] >= 5.006 || $Config{longsize} < 8) {
+ $cond = '$not_zero > 0 && $not_zero == ~0';
+ } else {
+ $cond = q{pack 'Q', $not_zero eq ~pack 'Q', 0};
+ }
+
+ $test_body .= sprintf <<'EOT', $cond;
# UV
my $not_zero = NOT_ZERO;
-if ($not_zero > 0 && $not_zero == ~0) {
+if (%s) {
print "ok $test\n";
} else {
print "not ok $test # \$not_zero=$not_zero ~0=" . (~0) . "\n";
}
$test++;
+EOT
+
+ $test_body .= <<'EOT';
+
# Value includes a "*/" in an attempt to bust out of a C comment.
# Also tests custom cpp #if clauses
my $close = CLOSE;