$| = 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};
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 {
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";
}
}
$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;