X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FExtUtils.t;h=24d85d3221d323eb581e425daf44d262632cb6d4;hb=bb2cbcd1ec679f28ec7f1a4f685707a368d32502;hp=50a9fe44f0f574cb4a7fb30842e083124a53e4f5;hpb=b695f709e8a342e35e482b0437eb6cdacdc58b6b;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/ExtUtils.t b/lib/ExtUtils.t index 50a9fe4..24d85d3 100644 --- a/lib/ExtUtils.t +++ b/lib/ExtUtils.t @@ -7,15 +7,15 @@ BEGIN { @INC = '../lib'; } -use warnings; +# use warnings; use strict; use ExtUtils::MakeMaker; use ExtUtils::Constant qw (constant_types C_constant XS_constant autoload); use Config; -use File::Spec::Functions; -use File::Spec; +use File::Spec::Functions qw(catfile rel2abs); # Because were are going to be changing directory before running Makefile.PL -my $perl = File::Spec->rel2abs( $^X ); +my $perl; +$perl = rel2abs( $^X ) unless $] < 5.006; # Hack. Until 5.00503 has rel2abs # 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 @@ -33,6 +33,7 @@ my @files; print "# $dir being created...\n"; mkdir $dir, 0777 or die "mkdir: $!\n"; +my $output = "output"; END { use File::Path; @@ -44,7 +45,7 @@ my $package = "ExtTest"; # Test the code that generates 1 and 2 letter name comparisons. my %compass = ( -N => 0, NE => 45, E => 90, SE => 135, S => 180, SW => 225, W => 270, NW => 315 +N => 0, 'NE' => 45, E => 90, SE => 135, S => 180, SW => 225, W => 270, NW => 315 ); my $parent_rfc1149 = @@ -132,12 +133,14 @@ print FH "use $];\n"; print FH <<'EOT'; use strict; -use warnings; +EOT +printf FH "use warnings;\n" unless $] < 5.006; +print FH <<'EOT'; use Carp; require Exporter; require DynaLoader; -use vars qw ($VERSION @ISA @EXPORT_OK); +use vars qw ($VERSION @ISA @EXPORT_OK $AUTOLOAD); $VERSION = '0.01'; @ISA = qw(Exporter DynaLoader); @@ -157,8 +160,21 @@ open FH, ">$testpl" or die "open >$testpl: $!\n"; print FH "use strict;\n"; print FH "use $package qw(@names_only);\n"; -print FH <<'EOT'; +print FH <<"EOT"; + +print "1..1\n"; +if (open OUTPUT, ">$output") { + print "ok 1\n"; + select OUTPUT; +} else { + print "not ok 1 # Failed to open '$output': $!\n"; + exit 1; +} +EOT +print FH << 'EOT'; + +# What follows goes to the temporary file. # IV my $five = FIVE; if ($five == 5) { @@ -278,7 +294,7 @@ my %compass = ( EOT while (my ($point, $bearing) = each %compass) { - print FH "$point => $bearing, " + print FH "'$point' => $bearing, " } print FH <<'EOT'; @@ -357,7 +373,7 @@ close FH or die "close $makefilePL: $!\n"; chdir $dir or die $!; push @INC, '../../lib'; END {chdir ".." or warn $!}; -my @perlout = `$runperl Makefile.PL`; +my @perlout = `$runperl Makefile.PL PERL_CORE=1`; if ($?) { print "not ok 1 # $runperl Makefile.PL failed: $?\n"; print "# $_" foreach @perlout; @@ -381,12 +397,15 @@ my $make = $Config{make}; $make = $ENV{MAKE} if exists $ENV{MAKE}; -my $makeout; +if ($^O eq 'MSWin32' && $make eq 'nmake') { $make .= " -nologo"; } + +my @makeout; print "# make = '$make'\n"; -$makeout = `$make`; +@makeout = `$make`; if ($?) { print "not ok 3 # $make failed: $?\n"; + print "# $_" foreach @makeout; exit($?); } else { print "ok 3\n"; @@ -395,40 +414,38 @@ if ($?) { if ($Config{usedl}) { print "ok 4\n"; } else { - push @files, "perl$Config{exe_ext}"; my $makeperl = "$make perl"; print "# make = '$makeperl'\n"; - $makeout = `$makeperl`; + @makeout = `$makeperl`; if ($?) { print "not ok 4 # $makeperl failed: $?\n"; + print "# $_" foreach @makeout; exit($?); } else { print "ok 4\n"; } } -my $test = 23; +push @files, $output; + my $maketest = "$make test"; print "# make = '$maketest'\n"; -$makeout = `$maketest`; -# echo of running the test script -$makeout =~ s/^\s*PERL_DL_NONLAZY=.+?\n//m; -$makeout =~ s/^MCR.+test.pl\n//mig if $^O eq 'VMS'; +@makeout = `$maketest`; -# GNU make babblings -$makeout =~ s/^\w*?make.+?(?:entering|leaving) directory.+?\n//mig; - -# Hopefully gets most make's babblings -# make -f Makefile.aperl perl -$makeout =~ s/^\w*?make.+\sperl[^A-Za-z0-9]*\n//mig; -# make[1]: `perl' is up to date. -$makeout =~ s/^\w*?make.+perl.+?is up to date.*?\n//mig; +if (open OUTPUT, "<$output") { + print while ; + close OUTPUT or print "# Close $output failed: $!\n"; +} else { + # Harness will report missing test results at this point. + print "# Open <$output failed: $!\n"; +} -print $makeout; +my $test = 23; if ($?) { print "not ok $test # $maketest failed: $?\n"; + print "# $_" foreach @makeout; } else { print "ok $test\n"; } @@ -456,9 +473,10 @@ $test++; my $makeclean = "$make clean"; print "# make = '$makeclean'\n"; -$makeout = `$makeclean`; +@makeout = `$makeclean`; if ($?) { print "not ok $test # $make failed: $?\n"; + print "# $_" foreach @makeout; } else { print "ok $test\n"; }