From 39234879f5d0d01795f6b444c84aeec3481bcd99 Mon Sep 17 00:00:00 2001 From: "Michael G. Schwern" Date: Thu, 17 Jan 2002 22:04:33 -0500 Subject: [PATCH] Syncing with bleadperl Message-ID: <20020118080432.GC7226@blackrider> p4raw-id: //depot/perl@14325 --- MANIFEST | 4 +++- lib/ExtUtils/Changes | 22 ++++++++++++++++++++++ lib/ExtUtils/Embed.pm | 4 ++-- lib/ExtUtils/Liblist.pm | 2 +- lib/ExtUtils/MM_Win32.pm | 14 ++++++++------ lib/ExtUtils/MakeMaker.pm | 12 ++++++------ lib/ExtUtils/Manifest.pm | 2 +- lib/ExtUtils/Mkbootstrap.pm | 5 ++--- lib/ExtUtils/Mksymlists.pm | 2 +- lib/ExtUtils/{inst => instmodsh} | 0 lib/ExtUtils/t/Command.t | 26 +++++++++++--------------- lib/ExtUtils/t/Embed.t | 10 +++++++--- lib/ExtUtils/t/ExtUtils.t | 39 +++++++++++++++++++++++++++++---------- lib/ExtUtils/t/Installed.t | 28 ++++++++++++++++++++-------- lib/ExtUtils/t/MM_BeOS.t | 13 ++++++------- lib/ExtUtils/t/MM_Cygwin.t | 9 ++++++--- lib/ExtUtils/t/MM_OS2.t | 9 ++++++--- lib/ExtUtils/t/MM_Unix.t | 17 ++++++++--------- lib/ExtUtils/t/MM_VMS.t | 9 ++++++--- lib/ExtUtils/t/MM_Win32.t | 33 +++++++++++++++++---------------- lib/ExtUtils/t/Manifest.t | 22 +++++++++++++--------- lib/ExtUtils/t/Mkbootstrap.t | 35 ++++++++++++----------------------- lib/ExtUtils/t/Packlist.t | 12 ++++++++---- lib/ExtUtils/t/hints.t | 17 +++++++++++++---- lib/ExtUtils/t/testlib.t | 20 ++++++++++++++++---- lib/ExtUtils/testlib.pm | 7 ++++--- t/lib/TieOut.pm | 17 +++++++++++++++++ 27 files changed, 245 insertions(+), 145 deletions(-) create mode 100644 lib/ExtUtils/Changes rename lib/ExtUtils/{inst => instmodsh} (100%) mode change 100755 => 100644 create mode 100644 t/lib/TieOut.pm diff --git a/MANIFEST b/MANIFEST index 1f7078d..68a0e5f 100644 --- a/MANIFEST +++ b/MANIFEST @@ -931,10 +931,11 @@ lib/exceptions.pl catch and throw routines lib/Exporter.pm Exporter base class lib/Exporter.t See if Exporter works lib/Exporter/Heavy.pm Complicated routines for Exporter +lib/ExtUtils/Changes MakeMaker change log lib/ExtUtils/Command.pm Utilities for Make on non-UNIX platforms lib/ExtUtils/Constant.pm generate XS code to import C header constants lib/ExtUtils/Embed.pm Utilities for embedding Perl in C programs -lib/ExtUtils/inst Give information about installed extensions +lib/ExtUtils/instmodsh Give information about installed extensions lib/ExtUtils/Install.pm Handles 'make install' on extensions lib/ExtUtils/Installed.pm Information on installed extensions lib/ExtUtils/Liblist.pm Locates libraries @@ -2154,6 +2155,7 @@ t/lib/Test/Simple/sample_tests/require.plx for exit.t t/lib/Test/Simple/sample_tests/success.plx for exit.t t/lib/Test/Simple/sample_tests/too_few.plx for exit.t t/lib/Test/Simple/sample_tests/two_fail.plx for exit.t +t/lib/TieOut.pm Testing library to capture prints t/lib/warnings/1global Tests of global warnings for warnings.t t/lib/warnings/2use Tests for "use warnings" for warnings.t t/lib/warnings/3both Tests for interaction of $^W and "use warnings" diff --git a/lib/ExtUtils/Changes b/lib/ExtUtils/Changes new file mode 100644 index 0000000..8aee23c --- /dev/null +++ b/lib/ExtUtils/Changes @@ -0,0 +1,22 @@ +5.48_03 Thu Jan 17 23:44:38 EST 2002 + * moved bin/inst to bin/instmodsh + * Some Win32 backporting fixes. The -x switch doesn't seem to + work on Win32/5.6.1. + * Bug on Win32. MAKEMAKER variable not set properly. + * _02 broke hints files. Now fixed. + - Minor prereq error formatting glitch + - ExtUtils::testlib no longer a thin wrapper around blib, now a + thin wrapper around lib like it was. blib is noisy on 5.6.1. + - Nick and chromatic found and fixed some warnings in the tests + +5.48_02 Wed Jan 16 19:11:26 EST 2002 + - Fixed some Win32 warnings. Needs more work. + +5.48_01 Wed Jan 16 15:10:28 EST 200 + * Adapted from bleadperl@14303 + * Backported to 5.6.1 + - inst and xsubpp moved out of lib/ and into bin/ + - ExtUtils::testlib obsoleted. Now a thin wrapper around blib.pm + ***--> Non-Unix platforms not tested at all! Please test and report + back. Tests probably only need minor fixes. + diff --git a/lib/ExtUtils/Embed.pm b/lib/ExtUtils/Embed.pm index 8643d98..1aae288 100644 --- a/lib/ExtUtils/Embed.pm +++ b/lib/ExtUtils/Embed.pm @@ -1,4 +1,4 @@ -# $Id: Embed.pm,v 1.2501 $ +# $Id: Embed.pm,v 1.1.1.1 2002/01/16 19:27:19 schwern Exp $ require 5.002; package ExtUtils::Embed; @@ -18,7 +18,7 @@ use vars qw(@ISA @EXPORT $VERSION ); use strict; -$VERSION = sprintf("%d.%02d", q$Revision: 1.2506_00 $ =~ /(\d+)\.(\d+)/); +$VERSION = 1.2506_01; @ISA = qw(Exporter); @EXPORT = qw(&xsinit &ldopts diff --git a/lib/ExtUtils/Liblist.pm b/lib/ExtUtils/Liblist.pm index c7c6f77..b627867 100644 --- a/lib/ExtUtils/Liblist.pm +++ b/lib/ExtUtils/Liblist.pm @@ -24,7 +24,7 @@ package ExtUtils::Liblist::Kid; use 5.006_001; # Broken out of MakeMaker from version 4.11 -our $VERSION = substr q$Revision: 1.27 $, 10; +our $VERSION = 1.27_01; use Config; use Cwd 'cwd'; diff --git a/lib/ExtUtils/MM_Win32.pm b/lib/ExtUtils/MM_Win32.pm index 4784249..76e1bd1 100644 --- a/lib/ExtUtils/MM_Win32.pm +++ b/lib/ExtUtils/MM_Win32.pm @@ -1,6 +1,6 @@ package ExtUtils::MM_Win32; -our $VERSION = '1.00'; +our $VERSION = '1.00_02'; =head1 NAME @@ -144,6 +144,8 @@ sub file_name_is_absolute { sub find_perl { my($self, $ver, $names, $dirs, $trace) = @_; + $trace ||= 0; + my($name, $dir); if ($trace >= 2){ print "Looking for perl $ver by these names: @@ -263,7 +265,7 @@ XS_DEFINE_VERSION = -D\$(XS_VERSION_MACRO)=\\\"\$(XS_VERSION)\\\" }; push @m, qq{ -MAKEMAKER = $INC{'ExtUtils\MakeMaker.pm'} +MAKEMAKER = $INC{'ExtUtils/MakeMaker.pm'} MM_VERSION = $ExtUtils::MakeMaker::VERSION }; @@ -322,10 +324,10 @@ makemakerdflt: all .SUFFIXES: .xs .c .C .cpp .cxx .cc \$(OBJ_EXT) -# Nick wanted to get rid of .PRECIOUS. I don't remember why. I seem to recall, that -# some make implementations will delete the Makefile when we rebuild it. Because -# we call false(1) when we rebuild it. So make(1) is not completely wrong when it -# does so. Our milage may vary. +# Nick wanted to get rid of .PRECIOUS. I don't remember why. I seem to +# recall, that some make implementations will delete the Makefile when we +# rebuild it. Because we call false(1) when we rebuild it. So make(1) is +# not completely wrong when it does so. Our milage may vary. # .PRECIOUS: Makefile # seems to be not necessary anymore .PHONY: all config static dynamic test linkext manifest diff --git a/lib/ExtUtils/MakeMaker.pm b/lib/ExtUtils/MakeMaker.pm index 1f414af..92a46a8 100644 --- a/lib/ExtUtils/MakeMaker.pm +++ b/lib/ExtUtils/MakeMaker.pm @@ -2,10 +2,10 @@ BEGIN {require 5.002;} # MakeMaker 5.17 was the last MakeMaker that was compatib package ExtUtils::MakeMaker; -$VERSION = "5.48"; +$VERSION = "5.48_03"; $Version_OK = "5.17"; # Makefiles older than $Version_OK will die # (Will be checked from MakeMaker version 4.13 onwards) -($Revision = substr(q$Revision: 1.222 $, 10)) =~ s/\s+$//; +($Revision = substr(q$Revision: 1.4 $, 10)) =~ s/\s+$//; @@ -349,7 +349,7 @@ sub ExtUtils::MakeMaker::new { warn "Warning: prerequisite $prereq $self->{PREREQ_PM}->{$prereq} not found.\n" unless $self->{PREREQ_FATAL}; $unsatisfied{$prereq} = 'not installed'; } elsif ($prereq->VERSION < $self->{PREREQ_PM}->{$prereq} ){ - warn "Warning: prerequisite $prereq $self->{PREREQ_PM}->{$prereq} not found. We have" + warn "Warning: prerequisite $prereq $self->{PREREQ_PM}->{$prereq} not found. We have " . ($prereq->VERSION || 'unknown version') unless $self->{PREREQ_FATAL}; $unsatisfied{$prereq} = $self->{PREREQ_PM}->{$prereq} ? $self->{PREREQ_PM}->{$prereq} : 'unknown version' ; } @@ -681,14 +681,14 @@ sub check_hints { return unless -f $hint_file; # really there # execute the hintsfile: - print STDOUT "Processing hints file $hint_file\n"; + print STDERR "Processing hints file $hint_file\n"; { local *HINT; open(HINT, $hint_file) || die "Can't open $hint_file: $!"; eval join '', ; close HINT; } - print STDOUT $@ if $@; + print STDERR $@ if $@; } sub mv_all_methods { @@ -1857,7 +1857,7 @@ MakeMaker object. The following lines will be parsed o.k.: $VERSION = '1.00'; *VERSION = \'1.01'; - ( $VERSION ) = '$Revision: 1.222 $ ' =~ /\$Revision:\s+([^\s]+)/; + ( $VERSION ) = '$Revision: 1.4 $ ' =~ /\$Revision:\s+([^\s]+)/; $FOO::VERSION = '1.10'; *FOO::VERSION = \'1.11'; our $VERSION = 1.2.3; # new for perl5.6.0 diff --git a/lib/ExtUtils/Manifest.pm b/lib/ExtUtils/Manifest.pm index 8066579..eee57d2 100644 --- a/lib/ExtUtils/Manifest.pm +++ b/lib/ExtUtils/Manifest.pm @@ -12,7 +12,7 @@ our ($VERSION,@ISA,@EXPORT_OK, $Is_MacOS,$Is_VMS, $Debug,$Verbose,$Quiet,$MANIFEST,$found,$DEFAULT_MSKIP); -$VERSION = substr(q$Revision: 1.35 $, 10); +$VERSION = 1.35_00; @ISA=('Exporter'); @EXPORT_OK = ('mkmanifest', 'manicheck', 'fullcheck', 'filecheck', 'skipcheck', 'maniread', 'manicopy'); diff --git a/lib/ExtUtils/Mkbootstrap.pm b/lib/ExtUtils/Mkbootstrap.pm index 323c3ab..45713c3 100644 --- a/lib/ExtUtils/Mkbootstrap.pm +++ b/lib/ExtUtils/Mkbootstrap.pm @@ -1,7 +1,6 @@ package ExtUtils::Mkbootstrap; -$VERSION = substr q$Revision: 1.14 $, 10; -# $Date: 1996/09/03 17:04:43 $ +$VERSION = 1.14_01; use Config; use Exporter; @@ -75,7 +74,7 @@ ExtUtils::Mkbootstrap - make a bootstrap file for use by DynaLoader =head1 SYNOPSIS -C +C =head1 DESCRIPTION diff --git a/lib/ExtUtils/Mksymlists.pm b/lib/ExtUtils/Mksymlists.pm index 0135cda..1b88b3e 100644 --- a/lib/ExtUtils/Mksymlists.pm +++ b/lib/ExtUtils/Mksymlists.pm @@ -10,7 +10,7 @@ use Config; our(@ISA, @EXPORT, $VERSION); @ISA = 'Exporter'; @EXPORT = '&Mksymlists'; -$VERSION = substr q$Revision: 1.18 $, 10; +$VERSION = 1.18_00; sub Mksymlists { my(%spec) = @_; diff --git a/lib/ExtUtils/inst b/lib/ExtUtils/instmodsh old mode 100755 new mode 100644 similarity index 100% rename from lib/ExtUtils/inst rename to lib/ExtUtils/instmodsh diff --git a/lib/ExtUtils/t/Command.t b/lib/ExtUtils/t/Command.t index 3ff59b9..a21661f 100644 --- a/lib/ExtUtils/t/Command.t +++ b/lib/ExtUtils/t/Command.t @@ -1,9 +1,15 @@ -#!./perl -Tw +#!/usr/bin/perl -w BEGIN { - chdir 't' if -d 't'; - @INC = '../lib'; + if( $ENV{PERL_CORE} ) { + chdir 't'; + @INC = ('../lib', 'lib/'); + } + else { + unshift @INC, 't/lib/'; + } } +chdir 't'; BEGIN { 1 while unlink 'ecmdfile'; @@ -18,9 +24,8 @@ BEGIN { } { - use vars qw( *CORE::GLOBAL::exit ); - # bad neighbor, but test_f() uses exit() + *CORE::GLOBAL::exit = ''; # quiet 'only once' warning. *CORE::GLOBAL::exit = sub { return @_ }; use_ok( 'ExtUtils::Command' ); @@ -51,6 +56,7 @@ BEGIN { # concatenate this file with itself # be extra careful the regex doesn't match itself + use TieOut; my $out = tie *STDOUT, 'TieOut'; my $self = $0; unless (-f $self) { @@ -149,13 +155,3 @@ END { 1 while unlink 'ecmdfile'; File::Path::rmtree( 'ecmddir' ); } - -package TieOut; - -sub TIEHANDLE { - bless( \(my $text), $_[0] ); -} - -sub PRINT { - ${ $_[0] } .= join($/, @_); -} diff --git a/lib/ExtUtils/t/Embed.t b/lib/ExtUtils/t/Embed.t index 57ad8d1..bf2d3e7 100644 --- a/lib/ExtUtils/t/Embed.t +++ b/lib/ExtUtils/t/Embed.t @@ -1,9 +1,13 @@ -#!./perl +#!/usr/bin/perl BEGIN { - chdir 't' if -d 't'; - unshift @INC, '../lib'; + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = '../lib'; + } } +chdir 't'; + use Config; use ExtUtils::Embed; use File::Spec; diff --git a/lib/ExtUtils/t/ExtUtils.t b/lib/ExtUtils/t/ExtUtils.t index 24d85d3..e63d117 100644 --- a/lib/ExtUtils/t/ExtUtils.t +++ b/lib/ExtUtils/t/ExtUtils.t @@ -1,10 +1,12 @@ -#!./perl -w +#!/usr/bin/perl -w print "1..27\n"; BEGIN { - chdir 't' if -d 't'; - @INC = '../lib'; + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = '../lib'; + } } # use warnings; @@ -23,7 +25,7 @@ $perl = rel2abs( $^X ) unless $] < 5.006; # Hack. Until 5.00503 has rel2abs $^X = $perl; print "# perl=$perl\n"; -my $runperl = "$perl -x \"-I../../lib\""; +my $runperl = "$perl \"-I../../lib\""; $| = 1; @@ -447,15 +449,32 @@ if ($?) { print "not ok $test # $maketest failed: $?\n"; print "# $_" foreach @makeout; } else { - print "ok $test\n"; + print "ok $test - maketest\n"; } $test++; -my $regen = `$runperl $package.xs`; + +# -x is busted on Win32 < 5.6.1, so we emulate it. +my $regen; +if( $^O eq 'MSWin32' && $] <= 5.006001 ) { + open(REGENTMP, ">regentmp") or die $!; + open(XS, "$package.xs") or die $!; + my $saw_shebang; + while() { + $saw_shebang++ if /^#!.*/i ; + print REGENTMP $_ if $saw_shebang; + } + close XS; close REGENTMP; + $regen = `$runperl regentmp`; + unlink 'regentmp'; +} +else { + $regen = `$runperl -x $package.xs`; +} if ($?) { - print "not ok $test # $runperl $package.xs failed: $?\n"; + print "not ok $test # $runperl -x $package.xs failed: $?\n"; } else { - print "ok $test\n"; + print "ok $test - regen\n"; } $test++; @@ -463,9 +482,9 @@ my $expect = $constant_types . $C_constant . "\n#### XS Section:\n" . $XS_constant; if ($expect eq $regen) { - print "ok $test\n"; + print "ok $test - regen worked\n"; } else { - print "not ok $test\n"; + print "not ok $test - regen worked\n"; # open FOO, ">expect"; print FOO $expect; # open FOO, ">regen"; print FOO $regen; close FOO; } diff --git a/lib/ExtUtils/t/Installed.t b/lib/ExtUtils/t/Installed.t index ca3e9af..17913ec 100644 --- a/lib/ExtUtils/t/Installed.t +++ b/lib/ExtUtils/t/Installed.t @@ -1,4 +1,13 @@ -#!./perl +#!/usr/bin/perl -w + +BEGIN { + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = '../lib'; + } +} +chdir 't'; + use strict; use warnings; @@ -13,14 +22,9 @@ use File::Path; # for directories() tests use File::Basename; -BEGIN { - chdir 't' if -d 't'; - @INC = '../lib'; -} - use Test::More tests => 43; -use_ok( 'ExtUtils::Installed' ); +BEGIN { use_ok( 'ExtUtils::Installed' ) } # saves having to qualify package name for class methods my $ei = bless( {}, 'ExtUtils::Installed' ); @@ -56,7 +60,15 @@ is( $ei->_is_under('foo', @under), 0, '... should find no file not under dirs'); is( $ei->_is_under('baz', @under), 1, '... should find file under dir' ); # new -my $realei = ExtUtils::Installed->new(); +my $realei; +{ + # We're going to get warnings about not being able to find install + # directories if we're not installed. + local $SIG{__WARN__} = sub { + warn @_ unless $ENV{PERL_CORE} && $_[0] =~ /^Can't stat/; + }; + $realei = ExtUtils::Installed->new(); +} isa_ok( $realei, 'ExtUtils::Installed' ); isa_ok( $realei->{Perl}{packlist}, 'ExtUtils::Packlist' ); diff --git a/lib/ExtUtils/t/MM_BeOS.t b/lib/ExtUtils/t/MM_BeOS.t index 4b8ecc4..6fea269 100644 --- a/lib/ExtUtils/t/MM_BeOS.t +++ b/lib/ExtUtils/t/MM_BeOS.t @@ -1,13 +1,12 @@ -#!perl - -# 2001-01-14 Tels v0.01 - -our $VERSION = 0.01; +#!/usr/bin/perl BEGIN { - chdir 't' if -d 't'; - @INC = '../lib'; + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = '../lib'; + } } +chdir 't'; use Test::More; diff --git a/lib/ExtUtils/t/MM_Cygwin.t b/lib/ExtUtils/t/MM_Cygwin.t index eabb608..08b6246 100644 --- a/lib/ExtUtils/t/MM_Cygwin.t +++ b/lib/ExtUtils/t/MM_Cygwin.t @@ -1,9 +1,12 @@ -#!./perl +#!/usr/bin/perl BEGIN { - chdir 't' if -d 't'; - @INC = '../lib'; + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = '../lib'; + } } +chdir 't'; use Test::More; diff --git a/lib/ExtUtils/t/MM_OS2.t b/lib/ExtUtils/t/MM_OS2.t index f80b0fb..ad7d4b5 100644 --- a/lib/ExtUtils/t/MM_OS2.t +++ b/lib/ExtUtils/t/MM_OS2.t @@ -1,11 +1,14 @@ -#!./perl -w +#!/usr/bin/perl -w use strict; BEGIN { - chdir 't' if -d 't'; - @INC = '../lib'; + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = '../lib'; + } } +chdir 't'; use Test::More; if ($^O =~ /os2/i) { diff --git a/lib/ExtUtils/t/MM_Unix.t b/lib/ExtUtils/t/MM_Unix.t index fec24ca..29b5b0a 100644 --- a/lib/ExtUtils/t/MM_Unix.t +++ b/lib/ExtUtils/t/MM_Unix.t @@ -1,14 +1,12 @@ -#!./perl -w - -# 2001-12-16 Tels first version -# 2002-01-13 Tels 0.02 added some tests for various functions, added Andreas -# fix to the version test (>= vs ==) -# 2002-01-14 Tels 0.03 exclude on beos and netware, /i for $^O test +#!/usr/bin/perl -w BEGIN { - chdir 't' if -d 't'; - @INC = '../lib'; + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = '../lib'; + } } +chdir 't'; BEGIN { use Test::More; @@ -182,7 +180,8 @@ is ($t->nicetext('LOTR'),'LOTR','nicetext'); ############################################################################### # parse_version -my $self_name = '../lib/ExtUtils/t/MM_Unix.t'; +my $self_name = $ENV{PERL_CORE} ? '../lib/ExtUtils/t/MM_Unix.t' + : 'MM_Unix.t'; is ($t->parse_version($self_name),'0.02', 'parse_version on ourself'); diff --git a/lib/ExtUtils/t/MM_VMS.t b/lib/ExtUtils/t/MM_VMS.t index 784008a..7768e8d 100644 --- a/lib/ExtUtils/t/MM_VMS.t +++ b/lib/ExtUtils/t/MM_VMS.t @@ -1,9 +1,12 @@ -#!./perl -w +#!/usr/bin/perl -w BEGIN { - chdir 't' if -d 't'; - @INC = '../lib'; + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = '../lib'; + } } +chdir 't'; BEGIN { use Test::More; diff --git a/lib/ExtUtils/t/MM_Win32.t b/lib/ExtUtils/t/MM_Win32.t index 846cca2..4dd697b 100644 --- a/lib/ExtUtils/t/MM_Win32.t +++ b/lib/ExtUtils/t/MM_Win32.t @@ -1,9 +1,12 @@ -#!perl +#!/usr/bin/perl BEGIN { - chdir 't' if -d 't'; - @INC = '../lib'; + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = '../lib'; + } } +chdir 't'; use Test::More; @@ -18,23 +21,14 @@ BEGIN { use Config; use File::Spec; use File::Basename; - -# Does this mimic ExtUtils::MakeMaker ok? -{ - @MM::ISA = qw( - ExtUtils::MM_Unix - ExtUtils::Liblist::Kid - ExtUtils::MakeMaker - ); - # MM package faked up by messy MI entanglement - package MM; - sub DESTROY {} -} +use ExtUtils::MakeMaker; require_ok( 'ExtUtils::MM_Win32' ); # test import of $Verbose and &neatvalue can_ok( 'MM', 'neatvalue' ); +() = $ExtUtils::MM_Win32::Verbose; +() = $ExtUtils::MakeMaker::Verbose; is( $ExtUtils::MM_Win32::Verbose, $ExtUtils::MakeMaker::Verbose, 'ExtUtils::MM_Win32 should import $Verbose from ExtUtils::MakeMaker' ); @@ -126,12 +120,19 @@ SKIP: { VERSION_FROM => 'TestMM_Win32', PM => { 'MM_Win32.pm' => 1 }, }, 'MM'; + + # XXX Hack until we have a proper init method. + # Flesh out some necessary keys in the MM object. + foreach my $key (qw(XS C O_FILES H HTMLLIBPODS HTMLSCRIPTPODS + MAN1PODS MAN3PODS PARENT_NAME)) { + $mm_w32{$key} = ''; + } my $s_PM = join( " \\\n\t", sort keys %{$mm_w32->{PM}} ); my $k_PM = join( " \\\n\t", %{$mm_w32->{PM}} ); like( $mm_w32->constants(), qr/^NAME\ =\ TestMM_Win32\s+VERSION\ =\ 1\.00.+ - MAKEMAKER\ =\ $INC{'ExtUtils\MakeMaker.pm'}\s+ + MAKEMAKER\ =\ $INC{'ExtUtils/MakeMaker.pm'}\s+ MM_VERSION\ =\ $ExtUtils::MakeMaker::VERSION.+ VERSION_FROM\ =\ TestMM_Win32.+ TO_INST_PM\ =\ \Q$s_PM\E\s+ diff --git a/lib/ExtUtils/t/Manifest.t b/lib/ExtUtils/t/Manifest.t index 04c57ea..a0e84e0 100644 --- a/lib/ExtUtils/t/Manifest.t +++ b/lib/ExtUtils/t/Manifest.t @@ -1,9 +1,12 @@ -#!./perl +#!/usr/bin/perl BEGIN { - chdir 't' if -d 't'; - unshift @INC, '../lib'; + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + unshift @INC, '../lib'; + } } +chdir 't'; # these files help the test run use Test::More tests => 31; @@ -41,8 +44,8 @@ sub remove_dir { } # use module, import functions -use_ok( 'ExtUtils::Manifest', - qw( mkmanifest manicheck filecheck fullcheck maniread manicopy) ); +BEGIN { use_ok( 'ExtUtils::Manifest', + qw( mkmanifest manicheck filecheck fullcheck maniread manicopy) ); } my $cwd = Cwd::getcwd(); @@ -78,8 +81,7 @@ like( $warn, qr/^Not in MANIFEST: bar/, 'warning that bar has been added' ); is( $res, 'bar', 'bar reported as new' ); # now quiet the warning that bar was added and test again -use vars qw($ExtUtils::Manifest::Quiet); -$ExtUtils::Manifest::Quiet = 1; +{ package ExtUtils::Manifest; use vars qw($Quiet); $Quiet = 1; } ($res, $warn) = catch_warning( \&ExtUtils::Manifest::skipcheck ); cmp_ok( $warn, ,'eq', '', 'disabled warnings' ); @@ -135,8 +137,10 @@ like( $@, qr/^Can't read none: /, 'carped about none' ); # tell ExtUtils::Manifest to use a different file -use vars qw($ExtUtils::Manifest::MANIFEST); -$ExtUtils::Manifest::MANIFEST = 'albatross'; +{ package ExtUtils::Manifest; + use vars qw($MANIFEST); + $MANIFEST = 'albatross'; +} ($res, $warn) = catch_warning( \&mkmanifest ); like( $warn, qr/Added to albatross: /, 'using a new manifest file' ); diff --git a/lib/ExtUtils/t/Mkbootstrap.t b/lib/ExtUtils/t/Mkbootstrap.t index bbb689a..43de3b2 100644 --- a/lib/ExtUtils/t/Mkbootstrap.t +++ b/lib/ExtUtils/t/Mkbootstrap.t @@ -1,14 +1,20 @@ -#!./perl -w +#!/usr/bin/perl -w BEGIN { - chdir 't' if -d 't'; - @INC = '../lib'; + if( $ENV{PERL_CORE} ) { + chdir 't'; + @INC = ('../lib', 'lib/'); + } + else { + unshift @INC, 't/lib/'; + } } +chdir 't'; use vars qw( $required ); use Test::More tests => 18; -use_ok( 'ExtUtils::Mkbootstrap' ); +BEGIN { use_ok( 'ExtUtils::Mkbootstrap' ) } # Mkbootstrap makes a backup copy of "$_[0].bs" if it exists and is non-zero my $file_is_ready; @@ -38,7 +44,7 @@ SKIP: { Mkbootstrap('fakeboot'); ok( !( -f 'fakeboot.bso' ), 'Mkbootstrap should not backup an empty file' ); - +use TieOut; my $out = tie *STDOUT, 'TieOut'; # with $Verbose set, it should print status messages about libraries @@ -118,8 +124,7 @@ SKIP: { close OUT; # if $DynaLoader::bscode is set, write its contents to the file - # localize the variable to prevent "used only once" - local $DynaLoader::bscode; + local $DynaLoader::bscode; $DynaLoader::bscode = 'Wall'; $ExtUtils::Mkbootstrap::Verbose = 0; @@ -148,19 +153,3 @@ END { # clean things up, even on VMS 1 while unlink(qw( mkboot.bso boot_BS dasboot.bs .bs )); } - -package TieOut; - -sub TIEHANDLE { - bless( \(my $scalar), $_[0]); -} - -sub PRINT { - my $self = shift; - $$self .= join('', @_); -} - -sub read { - my $self = shift; - return substr($$self, 0, length($$self), ''); -} diff --git a/lib/ExtUtils/t/Packlist.t b/lib/ExtUtils/t/Packlist.t index 3e455b7..db8ed59 100644 --- a/lib/ExtUtils/t/Packlist.t +++ b/lib/ExtUtils/t/Packlist.t @@ -1,9 +1,12 @@ -#!./perl +#!/usr/bin/perl -w BEGIN { - chdir 't' if -d 't'; - @INC = '../lib'; + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = '../lib'; + } } +chdir 't'; use Test::More tests => 34; @@ -33,7 +36,8 @@ is( ExtUtils::Packlist::FETCH($pl, 'foo'), 'bar', 'check FETCH()' ); # test FIRSTKEY and NEXTKEY SKIP: { $pl->{data}{bar} = 'baz'; - skip('not enough keys to test FIRSTKEY', 2) unless %{ $pl->{data} } > 2; + skip('not enough keys to test FIRSTKEY', 2) + unless keys %{ $pl->{data} } > 2; # get the first and second key my ($first, $second) = keys %{ $pl->{data} }; diff --git a/lib/ExtUtils/t/hints.t b/lib/ExtUtils/t/hints.t index 7038de9..391b9f7 100644 --- a/lib/ExtUtils/t/hints.t +++ b/lib/ExtUtils/t/hints.t @@ -3,25 +3,34 @@ BEGIN { if( $ENV{PERL_CORE} ) { chdir 't'; - @INC = '../lib'; + @INC = ('../lib', 'lib/'); + } + else { + unshift @INC, 't/lib/'; } } chdir 't'; -use Test::More tests => 1; +use Test::More tests => 2; mkdir 'hints'; -my $hint = $^O; -open(HINT, ">hints/$hint.pl") || die "Can't write dummy hints file: $!"; +my $hint_file = "hints/$^O.pl"; +open(HINT, ">$hint_file") || die "Can't write dummy hints file $hint_file: $!"; print HINT <<'CLOO'; $self->{CCFLAGS} = 'basset hounds got long ears'; CLOO close HINT; +use TieOut; use ExtUtils::MakeMaker; + +my $out = tie *STDERR, 'TieOut'; my $mm = bless {}, 'ExtUtils::MakeMaker'; $mm->check_hints; is( $mm->{CCFLAGS}, 'basset hounds got long ears' ); +is( $out->read, "Processing hints file $hint_file\n" ); + +package Catch; END { diff --git a/lib/ExtUtils/t/testlib.t b/lib/ExtUtils/t/testlib.t index e0ef990..8c1ae11 100644 --- a/lib/ExtUtils/t/testlib.t +++ b/lib/ExtUtils/t/testlib.t @@ -1,13 +1,25 @@ -#!./perl +#!/usr/bin/perl -w BEGIN { - chdir 't' if -d 't'; - @INC = '../lib'; + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = '../lib'; + } } +chdir 't'; use Test::More tests => 3; -my @blib_paths = grep { /blib/ } @INC; +BEGIN { + # non-core tests will have blib in their path. We remove it + # and just use the one in lib/. + unless( $ENV{PERL_CORE} ) { + @INC = grep !/blib/, @INC; + unshift @INC, '../lib'; + } +} + +my @blib_paths = grep /blib/, @INC; is( @blib_paths, 0, 'No blib dirs yet in @INC' ); use_ok( 'ExtUtils::testlib' ); diff --git a/lib/ExtUtils/testlib.pm b/lib/ExtUtils/testlib.pm index d80f2a2..93edfd3 100644 --- a/lib/ExtUtils/testlib.pm +++ b/lib/ExtUtils/testlib.pm @@ -1,6 +1,5 @@ package ExtUtils::testlib; -$VERSION = substr q$Revision: 1.11 $, 10; -# $Id: testlib.pm,v 1.11 1996/05/31 08:27:07 k Exp $ +$VERSION = 1.12_01; use lib qw(blib/arch blib/lib); 1; @@ -12,10 +11,12 @@ ExtUtils::testlib - add blib/* directories to @INC =head1 SYNOPSIS -C + use ExtUtils::testlib; =head1 DESCRIPTION +B Use blib instead. + After an extension has been built and before it is installed it may be desirable to test it bypassing C. By adding diff --git a/t/lib/TieOut.pm b/t/lib/TieOut.pm new file mode 100644 index 0000000..0da80cb --- /dev/null +++ b/t/lib/TieOut.pm @@ -0,0 +1,17 @@ +package TieOut; + +sub TIEHANDLE { + bless( \(my $scalar), $_[0]); +} + +sub PRINT { + my $self = shift; + $$self .= join('', @_); +} + +sub read { + my $self = shift; + return substr($$self, 0, length($$self), ''); +} + +1; -- 2.7.4