summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/perl/lib/ExtUtils/t
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2002-10-27 22:14:39 +0000
committermillert <millert@openbsd.org>2002-10-27 22:14:39 +0000
commit55745691c11d58794cc2bb4d620ee3985f4381e6 (patch)
treed570f77ae0fda2ab3c9daa80b06a330c16cfe79f /gnu/usr.bin/perl/lib/ExtUtils/t
parentremove MD bits from test. (diff)
downloadwireguard-openbsd-55745691c11d58794cc2bb4d620ee3985f4381e6.tar.xz
wireguard-openbsd-55745691c11d58794cc2bb4d620ee3985f4381e6.zip
stock perl 5.8.0 from CPAN
Diffstat (limited to 'gnu/usr.bin/perl/lib/ExtUtils/t')
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/00setup_dummy.t109
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/Command.t192
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/Constant.t703
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/Embed.t185
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/INST.t141
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/INST_PREFIX.t134
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/Installed.t251
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/MM_BeOS.t48
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/MM_Cygwin.t124
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/MM_NW5.t324
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/MM_OS2.t275
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/MM_Unix.t252
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/MM_VMS.t79
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/MM_Win32.t324
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/Manifest.t193
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/Mkbootstrap.t155
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/Packlist.t174
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/VERSION_FROM.t39
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/backwards.t25
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/basic.t131
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/hints.t48
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/prefixify.t40
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/problems.t40
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/testlib.t37
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/writemakefile_args.t116
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/zz_cleanup_dummy.t21
26 files changed, 4160 insertions, 0 deletions
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/00setup_dummy.t b/gnu/usr.bin/perl/lib/ExtUtils/t/00setup_dummy.t
new file mode 100644
index 00000000000..2d5b1ee5c1b
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/00setup_dummy.t
@@ -0,0 +1,109 @@
+#!/usr/bin/perl -w
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ @INC = ('../lib', 'lib');
+ }
+ else {
+ unshift @INC, 't/lib';
+ }
+}
+chdir 't';
+
+use strict;
+use Test::More tests => 9;
+use File::Basename;
+use File::Path;
+use File::Spec;
+
+my %Files = (
+ 'Big-Dummy/lib/Big/Dummy.pm' => <<'END',
+package Big::Dummy;
+
+$VERSION = 0.01;
+
+1;
+END
+
+ 'Big-Dummy/Makefile.PL' => <<'END',
+use ExtUtils::MakeMaker;
+
+printf "Current package is: %s\n", __PACKAGE__;
+
+WriteMakefile(
+ NAME => 'Big::Dummy',
+ VERSION_FROM => 'lib/Big/Dummy.pm',
+ PREREQ_PM => {},
+);
+END
+
+ 'Big-Dummy/t/compile.t' => <<'END',
+print "1..2\n";
+
+print eval "use Big::Dummy; 1;" ? "ok 1\n" : "not ok 1\n";
+print "ok 2 - TEST_VERBOSE\n";
+END
+
+ 'Big-Dummy/Liar/t/sanity.t' => <<'END',
+print "1..3\n";
+
+print eval "use Big::Dummy; 1;" ? "ok 1\n" : "not ok 1\n";
+print eval "use Big::Liar; 1;" ? "ok 2\n" : "not ok 2\n";
+print "ok 3 - TEST_VERBOSE\n";
+END
+
+ 'Big-Dummy/Liar/lib/Big/Liar.pm' => <<'END',
+package Big::Liar;
+
+$VERSION = 0.01;
+
+1;
+END
+
+ 'Big-Dummy/Liar/Makefile.PL' => <<'END',
+use ExtUtils::MakeMaker;
+
+my $mm = WriteMakefile(
+ NAME => 'Big::Liar',
+ VERSION_FROM => 'lib/Big/Liar.pm',
+ _KEEP_AFTER_FLUSH => 1
+ );
+
+print "Big::Liar's vars\n";
+foreach my $key (qw(INST_LIB INST_ARCHLIB)) {
+ print "$key = $mm->{$key}\n";
+}
+END
+
+ 'Problem-Module/Makefile.PL' => <<'END',
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+ NAME => 'Problem::Module',
+);
+END
+
+ 'Problem-Module/subdir/Makefile.PL' => <<'END',
+printf "\@INC %s .\n", (grep { $_ eq '.' } @INC) ? "has" : "doesn't have";
+
+warn "I think I'm going to be sick\n";
+die "YYYAaaaakkk\n";
+END
+
+ );
+
+while(my($file, $text) = each %Files) {
+ # Convert to a relative, native file path.
+ $file = File::Spec->catfile(File::Spec->curdir, split m{\/}, $file);
+
+ my $dir = dirname($file);
+ mkpath $dir;
+ open(FILE, ">$file");
+ print FILE $text;
+ close FILE;
+
+ ok( -e $file, "$file created" );
+}
+
+
+pass("Setup done");
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/Command.t b/gnu/usr.bin/perl/lib/ExtUtils/t/Command.t
new file mode 100644
index 00000000000..ff9eec1da42
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/Command.t
@@ -0,0 +1,192 @@
+#!/usr/bin/perl -w
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't';
+ @INC = ('../lib', 'lib/');
+ }
+ else {
+ unshift @INC, 't/lib/';
+ }
+}
+chdir 't';
+
+BEGIN {
+ 1 while unlink 'ecmdfile';
+ # forcibly remove ecmddir/temp2, but don't import mkpath
+ use File::Path ();
+ File::Path::rmtree( 'ecmddir' );
+}
+
+BEGIN {
+ use Test::More tests => 24;
+ use File::Spec;
+}
+
+{
+ # bad neighbor, but test_f() uses exit()
+ *CORE::GLOBAL::exit = ''; # quiet 'only once' warning.
+ *CORE::GLOBAL::exit = sub { return @_ };
+
+ use_ok( 'ExtUtils::Command' );
+
+ # get a file in the current directory, replace last char with wildcard
+ my $file;
+ {
+ local *DIR;
+ opendir(DIR, File::Spec->curdir());
+ while ($file = readdir(DIR)) {
+ $file =~ s/\.\z// if $^O eq 'VMS';
+ last if $file =~ /^\w/;
+ }
+ }
+
+
+ # % means 'match one character' on VMS. Everything else is ?
+ my $match_char = $^O eq 'VMS' ? '%' : '?';
+ ($ARGV[0] = $file) =~ s/.\z/$match_char/;
+
+ # this should find the file
+ ExtUtils::Command::expand_wildcards();
+
+ is( scalar @ARGV, 1, 'found one file' );
+ like( $ARGV[0], qr/$file/, 'expanded wildcard ? successfully' );
+
+ # try it with the asterisk now
+ ($ARGV[0] = $file) =~ s/.{3}\z/\*/;
+ ExtUtils::Command::expand_wildcards();
+
+ ok( (grep { qr/$file/ } @ARGV), 'expanded wildcard * successfully' );
+
+ # 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) {
+ my ($vol, $dirs, $file) = File::Spec->splitpath($self);
+ my @dirs = File::Spec->splitdir($dirs);
+ unshift(@dirs, File::Spec->updir);
+ $dirs = File::Spec->catdir(@dirs);
+ $self = File::Spec->catpath($vol, $dirs, $file);
+ }
+ @ARGV = ($self, $self);
+
+ cat();
+ is( scalar( $$out =~ s/use_ok\( 'ExtUtils::Command'//g), 2,
+ 'concatenation worked' );
+
+ # the truth value here is reversed -- Perl true is C false
+ @ARGV = ( 'ecmdfile' );
+ ok( test_f(), 'testing non-existent file' );
+
+ @ARGV = ( 'ecmdfile' );
+ cmp_ok( ! test_f(), '==', (-f 'ecmdfile'), 'testing non-existent file' );
+
+ # these are destructive, have to keep setting @ARGV
+ @ARGV = ( 'ecmdfile' );
+ touch();
+
+ @ARGV = ( 'ecmdfile' );
+ ok( test_f(), 'now creating that file' );
+
+ @ARGV = ( 'ecmdfile' );
+ ok( -e $ARGV[0], 'created!' );
+
+ my ($now) = time;
+ utime ($now, $now, $ARGV[0]);
+ sleep 2;
+
+ # Just checking modify time stamp, access time stamp is set
+ # to the beginning of the day in Win95.
+ # There's a small chance of a 1 second flutter here.
+ my $stamp = (stat($ARGV[0]))[9];
+ cmp_ok( abs($now - $stamp), '<=', 1, 'checking modify time stamp' ) ||
+ diag "mtime == $stamp, should be $now";
+
+ SKIP: {
+ if ($^O eq 'amigaos' || $^O eq 'os2' || $^O eq 'MSWin32' ||
+ $^O eq 'NetWare' || $^O eq 'dos' || $^O eq 'cygwin' ||
+ $^O eq 'MacOS'
+ ) {
+ skip( "different file permission semantics on $^O", 3);
+ }
+
+ # change a file to execute-only
+ @ARGV = ( 0100, 'ecmdfile' );
+ ExtUtils::Command::chmod();
+
+ is( ((stat('ecmdfile'))[2] & 07777) & 0700,
+ 0100, 'change a file to execute-only' );
+
+ # change a file to read-only
+ @ARGV = ( 0400, 'ecmdfile' );
+ ExtUtils::Command::chmod();
+
+ is( ((stat('ecmdfile'))[2] & 07777) & 0700,
+ ($^O eq 'vos' ? 0500 : 0400), 'change a file to read-only' );
+
+ # change a file to write-only
+ @ARGV = ( 0200, 'ecmdfile' );
+ ExtUtils::Command::chmod();
+
+ is( ((stat('ecmdfile'))[2] & 07777) & 0700,
+ ($^O eq 'vos' ? 0700 : 0200), 'change a file to write-only' );
+ }
+
+ # change a file to read-write
+ @ARGV = ( 0600, 'ecmdfile' );
+ ExtUtils::Command::chmod();
+
+ is( ((stat('ecmdfile'))[2] & 07777) & 0700,
+ ($^O eq 'vos' ? 0700 : 0600), 'change a file to read-write' );
+
+ # mkpath
+ @ARGV = ( File::Spec->join( 'ecmddir', 'temp2' ) );
+ ok( ! -e $ARGV[0], 'temp directory not there yet' );
+
+ mkpath();
+ ok( -e $ARGV[0], 'temp directory created' );
+
+ # copy a file to a nested subdirectory
+ unshift @ARGV, 'ecmdfile';
+ cp();
+
+ ok( -e File::Spec->join( 'ecmddir', 'temp2', 'ecmdfile' ), 'copied okay' );
+
+ # cp should croak if destination isn't directory (not a great warning)
+ @ARGV = ( 'ecmdfile' ) x 3;
+ eval { cp() };
+
+ like( $@, qr/Too many arguments/, 'cp croaks on error' );
+
+ # move a file to a subdirectory
+ @ARGV = ( 'ecmdfile', 'ecmddir' );
+ mv();
+
+ ok( ! -e 'ecmdfile', 'moved file away' );
+ ok( -e File::Spec->join( 'ecmddir', 'ecmdfile' ), 'file in new location' );
+
+ # mv should also croak with the same wacky warning
+ @ARGV = ( 'ecmdfile' ) x 3;
+
+ eval { mv() };
+ like( $@, qr/Too many arguments/, 'mv croaks on error' );
+
+ # remove some files
+ my @files = @ARGV = ( File::Spec->catfile( 'ecmddir', 'ecmdfile' ),
+ File::Spec->catfile( 'ecmddir', 'temp2', 'ecmdfile' ) );
+ rm_f();
+
+ ok( ! -e $_, "removed $_ successfully" ) for (@ARGV);
+
+ # rm_f dir
+ @ARGV = my $dir = File::Spec->catfile( 'ecmddir' );
+ rm_rf();
+ ok( ! -e $dir, "removed $dir successfully" );
+}
+
+END {
+ 1 while unlink 'ecmdfile';
+ File::Path::rmtree( 'ecmddir' );
+}
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/Constant.t b/gnu/usr.bin/perl/lib/ExtUtils/t/Constant.t
new file mode 100644
index 00000000000..25d705585e2
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/Constant.t
@@ -0,0 +1,703 @@
+#!/usr/bin/perl -w
+
+print "1..51\n";
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+ }
+}
+
+# use warnings;
+use strict;
+use ExtUtils::MakeMaker;
+use ExtUtils::Constant qw (constant_types C_constant XS_constant autoload);
+use Config;
+use File::Spec::Functions qw(catfile rel2abs);
+# Because were are going to be changing directory before running Makefile.PL
+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
+# us the same as our child will see.
+$^X = $perl;
+
+print "# perl=$perl\n";
+my $runperl = "$perl \"-I../../lib\"";
+
+$| = 1;
+
+my $dir = "ext-$$";
+my @files;
+
+print "# $dir being created...\n";
+mkdir $dir, 0777 or die "mkdir: $!\n";
+
+my $output = "output";
+
+# For debugging set this to 1.
+my $keep_files = 0;
+
+END {
+ use File::Path;
+ print "# $dir being removed...\n";
+ rmtree($dir) unless $keep_files;
+}
+
+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
+);
+
+my $parent_rfc1149 =
+ 'A Standard for the Transmission of IP Datagrams on Avian Carriers';
+# Check that 8 bit and unicode names don't cause problems.
+my $pound;
+if (ord('A') == 193) { # EBCDIC platform
+ $pound = chr 177; # A pound sign. (Currency)
+} else { # ASCII platform
+ $pound = chr 163; # A pound sign. (Currency)
+}
+my $inf = chr 0x221E;
+# Check that we can distiguish the pathological case of a string, and the
+# utf8 representation of that string.
+my $pound_bytes = my $pound_utf8 = $pound . '1';
+utf8::encode ($pound_bytes);
+
+my @names = ("FIVE", {name=>"OK6", type=>"PV",},
+ {name=>"OK7", type=>"PVN",
+ value=>['"not ok 7\\n\\0ok 7\\n"', 15]},
+ {name => "FARTHING", type=>"NV"},
+ {name => "NOT_ZERO", type=>"UV", value=>"~(UV)0"},
+ {name => "OPEN", type=>"PV", value=>'"/*"', macro=>1},
+ {name => "CLOSE", type=>"PV", value=>'"*/"',
+ macro=>["#if 1\n", "#endif\n"]},
+ {name => "ANSWER", default=>["UV", 42]}, "NOTDEF",
+ {name => "Yes", type=>"YES"},
+ {name => "No", type=>"NO"},
+ {name => "Undef", type=>"UNDEF"},
+# OK. It wasn't really designed to allow the creation of dual valued constants.
+# It was more for INADDR_ANY INADDR_BROADCAST INADDR_LOOPBACK INADDR_NONE
+ {name=>"RFC1149", type=>"SV", value=>"sv_2mortal(temp_sv)",
+ pre=>"SV *temp_sv = newSVpv(RFC1149, 0); "
+ . "(void) SvUPGRADE(temp_sv,SVt_PVIV); SvIOK_on(temp_sv); "
+ . "SvIVX(temp_sv) = 1149;"},
+ {name=>"perl", type=>"PV",},
+);
+
+push @names, $_ foreach keys %compass;
+
+# Automatically compile the list of all the macro names, and make them
+# exported constants.
+my @names_only = map {(ref $_) ? $_->{name} : $_} @names;
+
+# Exporter::Heavy (currently) isn't able to export these names:
+push @names, ({name=>"*/", type=>"PV", value=>'"CLOSE"', macro=>1},
+ {name=>"/*", type=>"PV", value=>'"OPEN"', macro=>1},
+ {name=>$pound, type=>"PV", value=>'"Sterling"', macro=>1},
+ {name=>$inf, type=>"PV", value=>'"Infinity"', macro=>1},
+ {name=>$pound_utf8, type=>"PV", value=>'"1 Pound"', macro=>1},
+ {name=>$pound_bytes, type=>"PV", value=>'"1 Pound (as bytes)"',
+ macro=>1},
+ );
+
+=pod
+
+The above set of names seems to produce a suitably bad set of compile
+problems on a Unicode naive version of ExtUtils::Constant (ie 0.11):
+
+nick@thinking-cap 15439-32-utf$ PERL_CORE=1 ./perl lib/ExtUtils/t/Constant.t
+1..33
+# perl=/stuff/perl5/15439-32-utf/perl
+# ext-30370 being created...
+Wide character in print at lib/ExtUtils/t/Constant.t line 140.
+ok 1
+ok 2
+# make = 'make'
+ExtTest.xs: In function `constant_1':
+ExtTest.xs:80: warning: multi-character character constant
+ExtTest.xs:80: warning: case value out of range
+ok 3
+
+=cut
+
+my $types = {};
+my $constant_types = constant_types(); # macro defs
+my $C_constant = join "\n",
+ C_constant ($package, undef, "IV", $types, undef, undef, @names);
+my $XS_constant = XS_constant ($package, $types); # XS for ExtTest::constant
+
+################ Header
+my $header = catfile($dir, "test.h");
+push @files, "test.h";
+open FH, ">$header" or die "open >$header: $!\n";
+print FH <<"EOT";
+#define FIVE 5
+#define OK6 "ok 6\\n"
+#define OK7 1
+#define FARTHING 0.25
+#define NOT_ZERO 1
+#define Yes 0
+#define No 1
+#define Undef 1
+#define RFC1149 "$parent_rfc1149"
+#undef NOTDEF
+#define perl "rules"
+EOT
+
+while (my ($point, $bearing) = each %compass) {
+ print FH "#define $point $bearing\n"
+}
+close FH or die "close $header: $!\n";
+
+################ XS
+my $xs = catfile($dir, "$package.xs");
+push @files, "$package.xs";
+open FH, ">$xs" or die "open >$xs: $!\n";
+
+print FH <<'EOT';
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+EOT
+
+print FH "#include \"test.h\"\n\n";
+print FH $constant_types;
+print FH $C_constant, "\n";
+print FH "MODULE = $package PACKAGE = $package\n";
+print FH "PROTOTYPES: ENABLE\n";
+print FH $XS_constant;
+close FH or die "close $xs: $!\n";
+
+################ PM
+my $pm = catfile($dir, "$package.pm");
+push @files, "$package.pm";
+open FH, ">$pm" or die "open >$pm: $!\n";
+print FH "package $package;\n";
+print FH "use $];\n";
+
+print FH <<'EOT';
+
+use strict;
+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 $AUTOLOAD);
+
+$VERSION = '0.01';
+@ISA = qw(Exporter DynaLoader);
+@EXPORT_OK = qw(
+EOT
+
+# Print the names of all our autoloaded constants
+print FH "\t$_\n" foreach (@names_only);
+print FH ");\n";
+# Print the AUTOLOAD subroutine ExtUtils::Constant generated for us
+print FH autoload ($package, $]);
+print FH "bootstrap $package \$VERSION;\n1;\n__END__\n";
+close FH or die "close $pm: $!\n";
+
+################ test.pl
+my $testpl = catfile($dir, "test.pl");
+push @files, "test.pl";
+open FH, ">$testpl" or die "open >$testpl: $!\n";
+
+print FH "use strict;\n";
+print FH "use $package qw(@names_only);\n";
+print FH <<"EOT";
+
+use utf8;
+
+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) {
+ print "ok 5\n";
+} else {
+ print "not ok 5 # $five\n";
+}
+
+# PV
+print OK6;
+
+# PVN containing embedded \0s
+$_ = OK7;
+s/.*\0//s;
+print;
+
+# NV
+my $farthing = FARTHING;
+if ($farthing == 0.25) {
+ print "ok 8\n";
+} else {
+ print "not ok 8 # $farthing\n";
+}
+
+# UV
+my $not_zero = NOT_ZERO;
+if ($not_zero > 0 && $not_zero == ~0) {
+ print "ok 9\n";
+} else {
+ print "not ok 9 # \$not_zero=$not_zero ~0=" . (~0) . "\n";
+}
+
+# Value includes a "*/" in an attempt to bust out of a C comment.
+# Also tests custom cpp #if clauses
+my $close = CLOSE;
+if ($close eq '*/') {
+ print "ok 10\n";
+} else {
+ print "not ok 10 # \$close='$close'\n";
+}
+
+# Default values if macro not defined.
+my $answer = ANSWER;
+if ($answer == 42) {
+ print "ok 11\n";
+} else {
+ print "not ok 11 # What do you get if you multiply six by nine? '$answer'\n";
+}
+
+# not defined macro
+my $notdef = eval { NOTDEF; };
+if (defined $notdef) {
+ print "not ok 12 # \$notdef='$notdef'\n";
+} elsif ($@ !~ /Your vendor has not defined ExtTest macro NOTDEF/) {
+ print "not ok 12 # \$@='$@'\n";
+} else {
+ print "ok 12\n";
+}
+
+# not a macro
+my $notthere = eval { &ExtTest::NOTTHERE; };
+if (defined $notthere) {
+ print "not ok 13 # \$notthere='$notthere'\n";
+} elsif ($@ !~ /NOTTHERE is not a valid ExtTest macro/) {
+ chomp $@;
+ print "not ok 13 # \$@='$@'\n";
+} else {
+ print "ok 13\n";
+}
+
+# Truth
+my $yes = Yes;
+if ($yes) {
+ print "ok 14\n";
+} else {
+ print "not ok 14 # $yes='\$yes'\n";
+}
+
+# Falsehood
+my $no = No;
+if (defined $no and !$no) {
+ print "ok 15\n";
+} else {
+ print "not ok 15 # \$no=" . defined ($no) ? "'$no'\n" : "undef\n";
+}
+
+# Undef
+my $undef = Undef;
+unless (defined $undef) {
+ print "ok 16\n";
+} else {
+ print "not ok 16 # \$undef='$undef'\n";
+}
+
+
+# invalid macro (chosen to look like a mix up between No and SW)
+$notdef = eval { &ExtTest::So };
+if (defined $notdef) {
+ print "not ok 17 # \$notdef='$notdef'\n";
+} elsif ($@ !~ /^So is not a valid ExtTest macro/) {
+ print "not ok 17 # \$@='$@'\n";
+} else {
+ print "ok 17\n";
+}
+
+# invalid defined macro
+$notdef = eval { &ExtTest::EW };
+if (defined $notdef) {
+ print "not ok 18 # \$notdef='$notdef'\n";
+} elsif ($@ !~ /^EW is not a valid ExtTest macro/) {
+ print "not ok 18 # \$@='$@'\n";
+} else {
+ print "ok 18\n";
+}
+
+my %compass = (
+EOT
+
+while (my ($point, $bearing) = each %compass) {
+ print FH "'$point' => $bearing, "
+}
+
+print FH <<'EOT';
+
+);
+
+my $fail;
+while (my ($point, $bearing) = each %compass) {
+ my $val = eval $point;
+ if ($@) {
+ print "# $point: \$@='$@'\n";
+ $fail = 1;
+ } elsif (!defined $bearing) {
+ print "# $point: \$val=undef\n";
+ $fail = 1;
+ } elsif ($val != $bearing) {
+ print "# $point: \$val=$val, not $bearing\n";
+ $fail = 1;
+ }
+}
+if ($fail) {
+ print "not ok 19\n";
+} else {
+ print "ok 19\n";
+}
+
+EOT
+
+print FH <<"EOT";
+my \$rfc1149 = RFC1149;
+if (\$rfc1149 ne "$parent_rfc1149") {
+ print "not ok 20 # '\$rfc1149' ne '$parent_rfc1149'\n";
+} else {
+ print "ok 20\n";
+}
+
+if (\$rfc1149 != 1149) {
+ printf "not ok 21 # %d != 1149\n", \$rfc1149;
+} else {
+ print "ok 21\n";
+}
+
+EOT
+
+print FH <<'EOT';
+# test macro=>1
+my $open = OPEN;
+if ($open eq '/*') {
+ print "ok 22\n";
+} else {
+ print "not ok 22 # \$open='$open'\n";
+}
+EOT
+
+# Do this in 7 bit in case someone is testing with some settings that cause
+# 8 bit files incapable of storing this character.
+my @values
+ = map {"'" . join (",", unpack "U*", $_) . "'"}
+ ($pound, $inf, $pound_bytes, $pound_utf8);
+# Values is a list of strings, such as ('194,163,49', '163,49')
+
+print FH <<'EOT';
+
+# I can see that this child test program might be about to use parts of
+# Test::Builder
+
+my $test = 23;
+my ($pound, $inf, $pound_bytes, $pound_utf8) = map {eval "pack 'U*', $_"}
+EOT
+
+print FH join ",", @values;
+
+print FH << 'EOT';
+;
+
+foreach (["perl", "rules", "rules"],
+ ["/*", "OPEN", "OPEN"],
+ ["*/", "CLOSE", "CLOSE"],
+ [$pound, 'Sterling', []],
+ [$inf, 'Infinity', []],
+ [$pound_utf8, '1 Pound', '1 Pound (as bytes)'],
+ [$pound_bytes, '1 Pound (as bytes)', []],
+ ) {
+ # Flag an expected error with a reference for the expect string.
+ my ($string, $expect, $expect_bytes) = @$_;
+ (my $name = $string) =~ s/([^ -~])/sprintf '\x{%X}', ord $1/ges;
+ print "# \"$name\" => \'$expect\'\n";
+ # Try to force this to be bytes if possible.
+ utf8::downgrade ($string, 1);
+EOT
+
+print FH "my (\$error, \$got) = ${package}::constant (\$string);\n";
+
+print FH <<'EOT';
+ if ($error or $got ne $expect) {
+ print "not ok $test # error '$error', got '$got'\n";
+ } else {
+ print "ok $test\n";
+ }
+ $test++;
+ print "# Now upgrade '$name' to utf8\n";
+ utf8::upgrade ($string);
+EOT
+
+print FH "my (\$error, \$got) = ${package}::constant (\$string);\n";
+
+print FH <<'EOT';
+ if ($error or $got ne $expect) {
+ print "not ok $test # error '$error', got '$got'\n";
+ } else {
+ print "ok $test\n";
+ }
+ $test++;
+ if (defined $expect_bytes) {
+ print "# And now with the utf8 byte sequence for name\n";
+ # Try the encoded bytes.
+ utf8::encode ($string);
+EOT
+
+print FH "my (\$error, \$got) = ${package}::constant (\$string);\n";
+
+print FH <<'EOT';
+ if (ref $expect_bytes) {
+ # Error expected.
+ if ($error) {
+ print "ok $test # error='$error' (as expected)\n";
+ } else {
+ print "not ok $test # expected error, got no error and '$got'\n";
+ }
+ } elsif ($got ne $expect_bytes) {
+ print "not ok $test # error '$error', expect '$expect_bytes', got '$got'\n";
+ } else {
+ print "ok $test\n";
+ }
+ $test++;
+ }
+}
+EOT
+
+close FH or die "close $testpl: $!\n";
+
+# This is where the test numbers carry on after the test number above are
+# relayed
+my $test = 44;
+
+################ Makefile.PL
+# We really need a Makefile.PL because make test for a no dynamic linking perl
+# will run Makefile.PL again as part of the "make perl" target.
+my $makefilePL = catfile($dir, "Makefile.PL");
+push @files, "Makefile.PL";
+open FH, ">$makefilePL" or die "open >$makefilePL: $!\n";
+print FH <<"EOT";
+#!$perl -w
+use ExtUtils::MakeMaker;
+WriteMakefile(
+ 'NAME' => "$package",
+ 'VERSION_FROM' => "$package.pm", # finds \$VERSION
+ (\$] >= 5.005 ?
+ (#ABSTRACT_FROM => "$package.pm", # XXX add this
+ AUTHOR => "$0") : ())
+ );
+EOT
+
+close FH or die "close $makefilePL: $!\n";
+
+################ MANIFEST
+# We really need a MANIFEST because make distclean checks it.
+my $manifest = catfile($dir, "MANIFEST");
+push @files, "MANIFEST";
+open FH, ">$manifest" or die "open >$manifest: $!\n";
+print FH "$_\n" foreach @files;
+close FH or die "close $manifest: $!\n";
+
+chdir $dir or die $!; push @INC, '../../lib';
+END {chdir ".." or warn $!};
+
+my @perlout = `$runperl Makefile.PL PERL_CORE=1`;
+if ($?) {
+ print "not ok 1 # $runperl Makefile.PL failed: $?\n";
+ print "# $_" foreach @perlout;
+ exit($?);
+} else {
+ print "ok 1\n";
+}
+
+
+my $makefile = ($^O eq 'VMS' ? 'descrip' : 'Makefile');
+my $makefile_ext = ($^O eq 'VMS' ? '.mms' : '');
+if (-f "$makefile$makefile_ext") {
+ print "ok 2\n";
+} else {
+ print "not ok 2\n";
+}
+
+# Renamed by make clean
+my $makefile_rename = $makefile . ($^O eq 'VMS' ? '.mms' : '.old');
+
+my $make = $Config{make};
+
+$make = $ENV{MAKE} if exists $ENV{MAKE};
+
+if ($^O eq 'MSWin32' && $make eq 'nmake') { $make .= " -nologo"; }
+
+my @makeout;
+
+if ($^O eq 'VMS') { $make .= ' all'; }
+print "# make = '$make'\n";
+@makeout = `$make`;
+if ($?) {
+ print "not ok 3 # $make failed: $?\n";
+ print "# $_" foreach @makeout;
+ exit($?);
+} else {
+ print "ok 3\n";
+}
+
+if ($^O eq 'VMS') { $make =~ s{ all}{}; }
+
+if ($Config{usedl}) {
+ print "ok 4\n";
+} else {
+ my $makeperl = "$make perl";
+ print "# make = '$makeperl'\n";
+ @makeout = `$makeperl`;
+ if ($?) {
+ print "not ok 4 # $makeperl failed: $?\n";
+ print "# $_" foreach @makeout;
+ exit($?);
+ } else {
+ print "ok 4\n";
+ }
+}
+
+my $maketest = "$make test";
+print "# make = '$maketest'\n";
+
+@makeout = `$maketest`;
+
+if (open OUTPUT, "<$output") {
+ print while <OUTPUT>;
+ close OUTPUT or print "# Close $output failed: $!\n";
+} else {
+ # Harness will report missing test results at this point.
+ print "# Open <$output failed: $!\n";
+}
+
+if ($?) {
+ print "not ok $test # $maketest failed: $?\n";
+ print "# $_" foreach @makeout;
+} else {
+ print "ok $test - maketest\n";
+}
+$test++;
+
+
+# -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(<XS>) {
+ $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 -x $package.xs failed: $?\n";
+} else {
+ print "ok $test - regen\n";
+}
+$test++;
+
+my $expect = $constant_types . $C_constant .
+ "\n#### XS Section:\n" . $XS_constant;
+
+if ($expect eq $regen) {
+ print "ok $test - regen worked\n";
+} else {
+ print "not ok $test - regen worked\n";
+ # open FOO, ">expect"; print FOO $expect;
+ # open FOO, ">regen"; print FOO $regen; close FOO;
+}
+$test++;
+
+my $makeclean = "$make clean";
+print "# make = '$makeclean'\n";
+@makeout = `$makeclean`;
+if ($?) {
+ print "not ok $test # $make failed: $?\n";
+ print "# $_" foreach @makeout;
+} else {
+ print "ok $test\n";
+}
+$test++;
+
+sub check_for_bonus_files {
+ my $dir = shift;
+ my %expect = map {($^O eq 'VMS' ? lc($_) : $_), 1} @_;
+
+ my $fail;
+ opendir DIR, $dir or die "opendir '$dir': $!";
+ while (defined (my $entry = readdir DIR)) {
+ $entry =~ s/\.$// if $^O eq 'VMS'; # delete trailing dot that indicates no extension
+ next if $expect{$entry};
+ print "# Extra file '$entry'\n";
+ $fail = 1;
+ }
+
+ closedir DIR or warn "closedir '.': $!";
+ if ($fail) {
+ print "not ok $test\n";
+ } else {
+ print "ok $test\n";
+ }
+ $test++;
+}
+
+check_for_bonus_files ('.', @files, $output, $makefile_rename, '.', '..');
+
+rename $makefile_rename, $makefile
+ or die "Can't rename '$makefile_rename' to '$makefile': $!";
+
+unlink $output or warn "Can't unlink '$output': $!";
+
+# Need to make distclean to remove ../../lib/ExtTest.pm
+my $makedistclean = "$make distclean";
+print "# make = '$makedistclean'\n";
+@makeout = `$makedistclean`;
+if ($?) {
+ print "not ok $test # $make failed: $?\n";
+ print "# $_" foreach @makeout;
+} else {
+ print "ok $test\n";
+}
+$test++;
+
+check_for_bonus_files ('.', @files, '.', '..');
+
+unless ($keep_files) {
+ foreach (@files) {
+ unlink $_ or warn "unlink $_: $!";
+ }
+}
+
+check_for_bonus_files ('.', '.', '..');
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/Embed.t b/gnu/usr.bin/perl/lib/ExtUtils/t/Embed.t
new file mode 100644
index 00000000000..5460a254bd6
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/Embed.t
@@ -0,0 +1,185 @@
+#!/usr/bin/perl
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+ }
+}
+chdir 't';
+
+use Config;
+use ExtUtils::Embed;
+use File::Spec;
+
+open(my $fh,">embed_test.c") || die "Cannot open embed_test.c:$!";
+print $fh <DATA>;
+close($fh);
+
+$| = 1;
+print "1..9\n";
+my $cc = $Config{'cc'};
+my $cl = ($^O eq 'MSWin32' && $cc eq 'cl');
+my $borl = ($^O eq 'MSWin32' && $cc eq 'bcc32');
+my $skip_exe = $^O eq 'os2' && $Config{ldflags} =~ /(?<!\S)-Zexe\b/;
+my $exe = 'embed_test';
+$exe .= $Config{'exe_ext'} unless $skip_exe; # Linker will auto-append it
+my $obj = 'embed_test' . $Config{'obj_ext'};
+my $inc = File::Spec->updir;
+my $lib = File::Spec->updir;
+my $libperl_copied;
+my $testlib;
+my @cmd;
+my (@cmd2) if $^O eq 'VMS';
+
+if ($^O eq 'VMS') {
+ push(@cmd,$cc,"/Obj=$obj");
+ my (@incs) = ($inc);
+ my $crazy = ccopts();
+ if ($crazy =~ s#/inc[^=/]*=([\w\$\_\-\.\[\]\:]+)##i) {
+ push(@incs,$1);
+ }
+ if ($crazy =~ s/-I([a-zA-Z0-9\$\_\-\.\[\]\:]*)//) {
+ push(@incs,$1);
+ }
+ $crazy =~ s#/Obj[^=/]*=[\w\$\_\-\.\[\]\:]+##i;
+ push(@cmd,"/Include=(".join(',',@incs).")");
+ push(@cmd,$crazy);
+ push(@cmd,"embed_test.c");
+
+ push(@cmd2,$Config{'ld'}, $Config{'ldflags'}, "/exe=$exe");
+ push(@cmd2,"$obj,[-]perlshr.opt/opt,[-]perlshr_attr.opt/opt");
+
+} else {
+ if ($cl) {
+ push(@cmd,$cc,"-Fe$exe");
+ }
+ elsif ($borl) {
+ push(@cmd,$cc,"-o$exe");
+ }
+ else {
+ push(@cmd,$cc,'-o' => $exe);
+ }
+ push(@cmd,"-I$inc",ccopts(),'embed_test.c');
+ if ($^O eq 'MSWin32') {
+ $inc = File::Spec->catdir($inc,'win32');
+ push(@cmd,"-I$inc");
+ $inc = File::Spec->catdir($inc,'include');
+ push(@cmd,"-I$inc");
+ if ($cc eq 'cl') {
+ push(@cmd,'-link',"-libpath:$lib",$Config{'libperl'},$Config{'libs'});
+ }
+ else {
+ push(@cmd,"-L$lib",File::Spec->catfile($lib,$Config{'libperl'}),$Config{'libc'});
+ }
+ }
+ else { # Not MSWin32.
+ push(@cmd,"-L$lib",'-lperl');
+ local $SIG{__WARN__} = sub {
+ warn $_[0] unless $_[0] =~ /No library found for .*perl/
+ };
+ push(@cmd, '-Zlinker', '/PM:VIO') # Otherwise puts a warning to STDOUT!
+ if $^O eq 'os2' and $Config{ldflags} =~ /(?<!\S)-Zomf\b/;
+ push(@cmd,ldopts());
+ }
+ if ($borl) {
+ @cmd = ($cmd[0],(grep{/^-[LI]/}@cmd[1..$#cmd]),(grep{!/^-[LI]/}@cmd[1..$#cmd]));
+ }
+
+ if ($^O eq 'aix') { # AIX needs an explicit symbol export list.
+ my ($perl_exp) = grep { -f } qw(perl.exp ../perl.exp);
+ die "where is perl.exp?\n" unless defined $perl_exp;
+ for (@cmd) {
+ s!-bE:(\S+)!-bE:$perl_exp!;
+ }
+ }
+ elsif ($^O eq 'cygwin') { # Cygwin needs the shared libperl copied
+ my $v_e_r_s = $Config{version};
+ $v_e_r_s =~ tr/./_/;
+ system("cp ../cygperl$v_e_r_s.dll ./"); # for test 1
+ }
+ elsif ($Config{'libperl'} !~ /\Alibperl\./) {
+ # Everyone needs libperl copied if it's not found by '-lperl'.
+ $testlib = $Config{'libperl'};
+ my $srclib = $testlib;
+ $testlib =~ s/^[^.]+/libperl/;
+ $testlib = File::Spec::->catfile($lib, $testlib);
+ $srclib = File::Spec::->catfile($lib, $srclib);
+ if (-f $srclib) {
+ unlink $testlib if -f $testlib;
+ my $ln_or_cp = $Config{'ln'} || $Config{'cp'};
+ my $lncmd = "$ln_or_cp $srclib $testlib";
+ #print "# $lncmd\n";
+ $libperl_copied = 1 unless system($lncmd);
+ }
+ }
+}
+my $status;
+# On OS/2 the linker will always emit an empty line to STDOUT; filter these
+my $cmd = join ' ', @cmd;
+chomp($cmd); # where is the newline coming from? ldopts()?
+print "# $cmd\n";
+my @out = `$cmd`;
+$status = $?;
+print "# $_\n" foreach @out;
+
+if ($^O eq 'VMS' && !$status) {
+ print "# @cmd2\n";
+ $status = system(join(' ',@cmd2));
+}
+print (($status? 'not ': '')."ok 1\n");
+
+my $embed_test = File::Spec->catfile(File::Spec->curdir, $exe);
+$embed_test = "run/nodebug $exe" if $^O eq 'VMS';
+print "# embed_test = $embed_test\n";
+$status = system($embed_test);
+print (($status? 'not ':'')."ok 9 # system returned $status\n");
+unlink($exe,"embed_test.c",$obj);
+unlink("$exe$Config{exe_ext}") if $skip_exe;
+unlink("embed_test.map","embed_test.lis") if $^O eq 'VMS';
+unlink(glob("./*.dll")) if $^O eq 'cygwin';
+unlink($testlib) if $libperl_copied;
+
+# gcc -g -I.. -L../ -o perl_test perl_test.c -lperl `../perl -I../lib -MExtUtils::Embed -I../ -e ccopts -e ldopts`
+
+__END__
+
+/* perl_test.c */
+
+#include <EXTERN.h>
+#include <perl.h>
+
+#define my_puts(a) if(puts(a) < 0) exit(666)
+
+static char *cmds[] = { "perl","-e", "print qq[ok 5\\n]", NULL };
+
+int main(int argc, char **argv, char **env)
+{
+ PerlInterpreter *my_perl = perl_alloc();
+
+ my_puts("ok 2");
+
+ perl_construct(my_perl);
+
+ my_puts("ok 3");
+
+ perl_parse(my_perl, NULL, (sizeof(cmds)/sizeof(char *))-1, cmds, env);
+
+ my_puts("ok 4");
+
+ fflush(stdout);
+
+ perl_run(my_perl);
+
+ my_puts("ok 6");
+
+ perl_destruct(my_perl);
+
+ my_puts("ok 7");
+
+ perl_free(my_perl);
+
+ my_puts("ok 8");
+
+ return 0;
+}
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/INST.t b/gnu/usr.bin/perl/lib/ExtUtils/t/INST.t
new file mode 100644
index 00000000000..d6780ac6744
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/INST.t
@@ -0,0 +1,141 @@
+#!/usr/bin/perl -w
+
+# Wherein we ensure the INST_* and INSTALL* variables are set correctly
+# in a default Makefile.PL run
+#
+# Essentially, this test is a Makefile.PL.
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't' if -d 't';
+ @INC = ('../lib', 'lib');
+ }
+ else {
+ unshift @INC, 't/lib';
+ }
+}
+
+use strict;
+use Test::More tests => 23;
+use MakeMaker::Test::Utils;
+use ExtUtils::MakeMaker;
+use File::Spec;
+use TieOut;
+use Config;
+
+chdir 't';
+
+perl_lib;
+
+$| = 1;
+
+my $Makefile = makefile_name;
+my $Curdir = File::Spec->curdir;
+my $Updir = File::Spec->updir;
+
+ok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) ||
+ diag("chdir failed: $!");
+
+my $stdout = tie *STDOUT, 'TieOut' or die;
+my $mm = WriteMakefile(
+ NAME => 'Big::Dummy',
+ VERSION_FROM => 'lib/Big/Dummy.pm',
+ PREREQ_PM => {},
+ PERL_CORE => $ENV{PERL_CORE},
+);
+like( $stdout->read, qr{
+ Writing\ $Makefile\ for\ Big::Liar\n
+ Big::Liar's\ vars\n
+ INST_LIB\ =\ \S+\n
+ INST_ARCHLIB\ =\ \S+\n
+ Writing\ $Makefile\ for\ Big::Dummy\n
+}x );
+undef $stdout;
+untie *STDOUT;
+
+isa_ok( $mm, 'ExtUtils::MakeMaker' );
+
+is( $mm->{NAME}, 'Big::Dummy', 'NAME' );
+is( $mm->{VERSION}, 0.01, 'VERSION' );
+
+my $config_prefix = $Config{installprefixexp} || $Config{installprefix} ||
+ $Config{prefixexp} || $Config{prefix};
+is( $mm->{PREFIX}, $config_prefix, 'PREFIX' );
+
+is( !!$mm->{PERL_CORE}, !!$ENV{PERL_CORE}, 'PERL_CORE' );
+
+my($perl_src, $mm_perl_src);
+if( $ENV{PERL_CORE} ) {
+ $perl_src = File::Spec->catdir($Updir, $Updir);
+ $perl_src = File::Spec->canonpath($perl_src);
+ $mm_perl_src = File::Spec->canonpath($mm->{PERL_SRC});
+}
+else {
+ $mm_perl_src = $mm->{PERL_SRC};
+}
+
+is( $mm_perl_src, $perl_src, 'PERL_SRC' );
+
+
+# PERM_*
+is( $mm->{PERM_RW}, 644, 'PERM_RW' );
+is( $mm->{PERM_RWX}, 755, 'PERM_RWX' );
+
+
+# INST_*
+is( $mm->{INST_ARCHLIB},
+ $mm->{PERL_CORE} ? $mm->{PERL_ARCHLIB}
+ : File::Spec->catdir($Curdir, 'blib', 'arch'),
+ 'INST_ARCHLIB');
+is( $mm->{INST_BIN}, File::Spec->catdir($Curdir, 'blib', 'bin'),
+ 'INST_BIN' );
+
+is( keys %{$mm->{CHILDREN}}, 1 );
+my($child_pack) = keys %{$mm->{CHILDREN}};
+my $c_mm = $mm->{CHILDREN}{$child_pack};
+is( $c_mm->{INST_ARCHLIB},
+ $c_mm->{PERL_CORE} ? $c_mm->{PERL_ARCHLIB}
+ : File::Spec->catdir($Updir, 'blib', 'arch'),
+ 'CHILD INST_ARCHLIB');
+is( $c_mm->{INST_BIN}, File::Spec->catdir($Updir, 'blib', 'bin'),
+ 'CHILD INST_BIN' );
+
+
+my $inst_lib = File::Spec->catdir($Curdir, 'blib', 'lib');
+is( $mm->{INST_LIB},
+ $mm->{PERL_CORE} ? $mm->{PERL_LIB} : $inst_lib, 'INST_LIB' );
+
+
+# INSTALL*
+is( $mm->{INSTALLDIRS}, 'site', 'INSTALLDIRS' );
+
+
+
+# Make sure the INSTALL*MAN*DIR variables work. We forgot them
+# at one point.
+$stdout = tie *STDOUT, 'TieOut' or die;
+$mm = WriteMakefile(
+ NAME => 'Big::Dummy',
+ VERSION_FROM => 'lib/Big/Dummy.pm',
+ PERL_CORE => $ENV{PERL_CORE},
+ INSTALLMAN1DIR => 'none',
+ INSTALLSITEMAN3DIR => 'none',
+ INSTALLVENDORMAN1DIR => 'none',
+ INST_MAN1DIR => 'none',
+);
+like( $stdout->read, qr{
+ Writing\ $Makefile\ for\ Big::Liar\n
+ Big::Liar's\ vars\n
+ INST_LIB\ =\ \S+\n
+ INST_ARCHLIB\ =\ \S+\n
+ Writing\ $Makefile\ for\ Big::Dummy\n
+}x );
+undef $stdout;
+untie *STDOUT;
+
+isa_ok( $mm, 'ExtUtils::MakeMaker' );
+
+is ( $mm->{INSTALLMAN1DIR}, 'none' );
+is ( $mm->{INSTALLSITEMAN3DIR}, 'none' );
+is ( $mm->{INSTALLVENDORMAN1DIR}, 'none' );
+is ( $mm->{INST_MAN1DIR}, 'none' );
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/INST_PREFIX.t b/gnu/usr.bin/perl/lib/ExtUtils/t/INST_PREFIX.t
new file mode 100644
index 00000000000..8af8c307fa8
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/INST_PREFIX.t
@@ -0,0 +1,134 @@
+#!/usr/bin/perl -w
+
+# Wherein we ensure the INST_* and INSTALL* variables are set correctly
+# when various PREFIX variables are set.
+#
+# Essentially, this test is a Makefile.PL.
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't' if -d 't';
+ @INC = ('../lib', 'lib');
+ }
+ else {
+ unshift @INC, 't/lib';
+ }
+}
+
+use strict;
+use Test::More tests => 26;
+use MakeMaker::Test::Utils;
+use ExtUtils::MakeMaker;
+use File::Spec;
+use TieOut;
+use Config;
+
+my $Is_VMS = $^O eq 'VMS';
+
+chdir 't';
+
+perl_lib;
+
+$| = 1;
+
+my $Makefile = makefile_name;
+my $Curdir = File::Spec->curdir;
+my $Updir = File::Spec->updir;
+
+ok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) ||
+ diag("chdir failed: $!");
+
+my $PREFIX = File::Spec->catdir('foo', 'bar');
+my $stdout = tie *STDOUT, 'TieOut' or die;
+my $mm = WriteMakefile(
+ NAME => 'Big::Dummy',
+ VERSION_FROM => 'lib/Big/Dummy.pm',
+ PREREQ_PM => {},
+ PERL_CORE => $ENV{PERL_CORE},
+ PREFIX => $PREFIX,
+);
+like( $stdout->read, qr{
+ Writing\ $Makefile\ for\ Big::Liar\n
+ Big::Liar's\ vars\n
+ INST_LIB\ =\ \S+\n
+ INST_ARCHLIB\ =\ \S+\n
+ Writing\ $Makefile\ for\ Big::Dummy\n
+}x );
+undef $stdout;
+untie *STDOUT;
+
+isa_ok( $mm, 'ExtUtils::MakeMaker' );
+
+is( $mm->{NAME}, 'Big::Dummy', 'NAME' );
+is( $mm->{VERSION}, 0.01, 'VERSION' );
+
+is( $mm->{PREFIX}, $PREFIX, 'PREFIX' );
+
+is( !!$mm->{PERL_CORE}, !!$ENV{PERL_CORE}, 'PERL_CORE' );
+
+my($perl_src, $mm_perl_src);
+if( $ENV{PERL_CORE} ) {
+ $perl_src = File::Spec->catdir($Updir, $Updir);
+ $perl_src = File::Spec->canonpath($perl_src);
+ $mm_perl_src = File::Spec->canonpath($mm->{PERL_SRC});
+}
+else {
+ $mm_perl_src = $mm->{PERL_SRC};
+}
+
+is( $mm_perl_src, $perl_src, 'PERL_SRC' );
+
+
+# Every INSTALL* variable must start with some PREFIX.
+my @Perl_Install = qw(archlib privlib bin script
+ man1dir man3dir);
+my @Site_Install = qw(sitearch sitelib sitebin
+ siteman1dir siteman3dir);
+my @Vend_Install = qw(vendorarch vendorlib vendorbin
+ vendorman1dir vendorman3dir);
+
+foreach my $var (@Perl_Install) {
+ my $prefix = $Is_VMS ? '[.foo.bar' : File::Spec->catdir(qw(foo bar));
+
+ # support for man page skipping
+ $prefix = 'none' if $var =~ /man/ && !$Config{"install$var"};
+ like( $mm->{uc "install$var"}, qr/^\Q$prefix\E/, "PREFIX + $var" );
+}
+
+foreach my $var (@Site_Install) {
+ my $prefix = $Is_VMS ? '[.foo.bar' : File::Spec->catdir(qw(foo bar));
+
+ like( $mm->{uc "install$var"}, qr/^\Q$prefix\E/,
+ "SITEPREFIX + $var" );
+}
+
+foreach my $var (@Vend_Install) {
+ my $prefix = $Is_VMS ? '[.foo.bar' : File::Spec->catdir(qw(foo bar));
+
+ like( $mm->{uc "install$var"}, qr/^\Q$prefix\E/,
+ "VENDORPREFIX + $var" );
+}
+
+
+# Check that when installman*dir isn't set in Config no man pages
+# are generated.
+{
+ undef *ExtUtils::MM_Unix::Config;
+ %ExtUtils::MM_Unix::Config = %Config;
+ $ExtUtils::MM_Unix::Config{installman1dir} = '';
+ $ExtUtils::MM_Unix::Config{installman3dir} = '';
+
+ my $wibble = File::Spec->catdir(qw(wibble and such));
+ my $stdout = tie *STDOUT, 'TieOut' or die;
+ my $mm = WriteMakefile(
+ NAME => 'Big::Dummy',
+ VERSION_FROM => 'lib/Big/Dummy.pm',
+ PREREQ_PM => {},
+ PERL_CORE => $ENV{PERL_CORE},
+ PREFIX => $PREFIX,
+ INSTALLMAN1DIR=> $wibble,
+ );
+
+ is( $mm->{INSTALLMAN1DIR}, $wibble );
+ is( $mm->{INSTALLMAN3DIR}, 'none' );
+}
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/Installed.t b/gnu/usr.bin/perl/lib/ExtUtils/t/Installed.t
new file mode 100644
index 00000000000..d62afba4348
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/Installed.t
@@ -0,0 +1,251 @@
+#!/usr/bin/perl -w
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+ }
+ else {
+ unshift @INC, 't/lib/';
+ }
+}
+chdir 't';
+
+
+use strict;
+
+use Config;
+use Cwd;
+use File::Path;
+use File::Basename;
+use File::Spec;
+
+use Test::More tests => 46;
+
+BEGIN { use_ok( 'ExtUtils::Installed' ) }
+
+my $mandirs = !!$Config{man1direxp} + !!$Config{man3direxp};
+
+# saves having to qualify package name for class methods
+my $ei = bless( {}, 'ExtUtils::Installed' );
+
+# _is_prefix
+ok( $ei->_is_prefix('foo/bar', 'foo'),
+ '_is_prefix() should match valid path prefix' );
+ok( !$ei->_is_prefix('\foo\bar', '\bar'),
+ '... should not match wrong prefix' );
+
+# _is_type
+ok( $ei->_is_type(0, 'all'), '_is_type() should be true for type of "all"' );
+
+foreach my $path (qw( man1dir man3dir )) {
+SKIP: {
+ my $dir = $Config{$path.'exp'};
+ skip("no man directory $path on this system", 2 ) unless $dir;
+
+ my $file = $dir . '/foo';
+ ok( $ei->_is_type($file, 'doc'), "... should find doc file in $path" );
+ ok( !$ei->_is_type($file, 'prog'), "... but not prog file in $path" );
+ }
+}
+
+# VMS 5.6.1 doesn't seem to have $Config{prefixexp}
+my $prefix = $Config{prefix} || $Config{prefixexp};
+
+# You can concatenate /foo but not foo:, which defaults in the current
+# directory
+$prefix = VMS::Filespec::unixify($prefix) if $^O eq 'VMS';
+
+# ActivePerl 5.6.1/631 has $Config{prefixexp} as 'p:' for some reason
+$prefix = $Config{prefix} if $prefix eq 'p:' && $^O eq 'MSWin32';
+
+ok( $ei->_is_type( File::Spec->catfile($prefix, 'bar'), 'prog'),
+ "... should find prog file under $prefix" );
+
+SKIP: {
+ skip('no man directories on this system', 1) unless $mandirs;
+ is( $ei->_is_type('bar', 'doc'), 0,
+ '... should not find doc file outside path' );
+}
+
+ok( !$ei->_is_type('bar', 'prog'),
+ '... nor prog file outside path' );
+ok( !$ei->_is_type('whocares', 'someother'), '... nor other type anywhere' );
+
+# _is_under
+ok( $ei->_is_under('foo'), '_is_under() should return true with no dirs' );
+
+my @under = qw( boo bar baz );
+ok( !$ei->_is_under('foo', @under), '... should find no file not under dirs');
+ok( $ei->_is_under('baz', @under), '... should find file under dir' );
+
+
+my $wrotelist;
+
+rmtree 'auto/FakeMod';
+ok( mkpath('auto/FakeMod') );
+END { rmtree 'auto/FakeMod' }
+
+ok(open(PACKLIST, '>auto/FakeMod/.packlist'));
+print PACKLIST 'list';
+close PACKLIST;
+
+ok(open(FAKEMOD, '>auto/FakeMod/FakeMod.pm'));
+
+print FAKEMOD <<'FAKE';
+package FakeMod;
+use vars qw( $VERSION );
+$VERSION = '1.1.1';
+1;
+FAKE
+
+close FAKEMOD;
+
+{
+ # avoid warning and death by localizing glob
+ local *ExtUtils::Installed::Config;
+ my $fake_mod_dir = File::Spec->catdir(cwd(), 'auto', 'FakeMod');
+ %ExtUtils::Installed::Config = (
+ %Config,
+ archlibexp => cwd(),
+ sitearchexp => $fake_mod_dir,
+ );
+
+ # necessary to fool new()
+ push @INC, $fake_mod_dir;
+
+ my $realei = ExtUtils::Installed->new();
+ isa_ok( $realei, 'ExtUtils::Installed' );
+ isa_ok( $realei->{Perl}{packlist}, 'ExtUtils::Packlist' );
+ is( $realei->{Perl}{version}, $Config{version},
+ 'new() should set Perl version from %Config' );
+
+ ok( exists $realei->{FakeMod}, 'new() should find modules with .packlists');
+ isa_ok( $realei->{FakeMod}{packlist}, 'ExtUtils::Packlist' );
+ is( $realei->{FakeMod}{version}, '1.1.1',
+ '... should find version in modules' );
+}
+
+# modules
+$ei->{$_} = 1 for qw( abc def ghi );
+is( join(' ', $ei->modules()), 'abc def ghi',
+ 'modules() should return sorted keys' );
+
+# This didn't work for a long time due to a sort in scalar context oddity.
+is( $ei->modules, 3, 'modules() in scalar context' );
+
+# files
+$ei->{goodmod} = {
+ packlist => {
+ ($Config{man1direxp} ?
+ (File::Spec->catdir($Config{man1direxp}, 'foo') => 1) :
+ ()),
+ ($Config{man3direxp} ?
+ (File::Spec->catdir($Config{man3direxp}, 'bar') => 1) :
+ ()),
+ File::Spec->catdir($prefix, 'foobar') => 1,
+ foobaz => 1,
+ },
+};
+
+eval { $ei->files('badmod') };
+like( $@, qr/badmod is not installed/,'files() should croak given bad modname');
+eval { $ei->files('goodmod', 'badtype' ) };
+like( $@, qr/type must be/,'files() should croak given bad type' );
+
+my @files;
+SKIP: {
+ skip('no man directory man1dir on this system', 2)
+ unless $Config{man1direxp};
+ @files = $ei->files('goodmod', 'doc', $Config{man1direxp});
+ is( scalar @files, 1, '... should find doc file under given dir' );
+ is( (grep { /foo$/ } @files), 1, '... checking file name' );
+}
+SKIP: {
+ skip('no man directories on this system', 1) unless $mandirs;
+ @files = $ei->files('goodmod', 'doc');
+ is( scalar @files, $mandirs, '... should find all doc files with no dir' );
+}
+
+@files = $ei->files('goodmod', 'prog', 'fake', 'fake2');
+is( scalar @files, 0, '... should find no doc files given wrong dirs' );
+@files = $ei->files('goodmod', 'prog');
+is( scalar @files, 1, '... should find doc file in correct dir' );
+like( $files[0], qr/foobar[>\]]?$/, '... checking file name' );
+@files = $ei->files('goodmod');
+is( scalar @files, 2 + $mandirs, '... should find all files with no type specified' );
+my %dirnames = map { lc($_) => dirname($_) } @files;
+
+# directories
+my @dirs = $ei->directories('goodmod', 'prog', 'fake');
+is( scalar @dirs, 0, 'directories() should return no dirs if no files found' );
+
+SKIP: {
+ skip('no man directories on this system', 1) unless $mandirs;
+ @dirs = $ei->directories('goodmod', 'doc');
+ is( scalar @dirs, $mandirs, '... should find all files files() would' );
+}
+@dirs = $ei->directories('goodmod');
+is( scalar @dirs, 2 + $mandirs, '... should find all files files() would, again' );
+@files = sort map { exists $dirnames{lc($_)} ? $dirnames{lc($_)} : '' } @files;
+is( join(' ', @files), join(' ', @dirs), '... should sort output' );
+
+# directory_tree
+my $expectdirs =
+ ($mandirs == 2) &&
+ (dirname($Config{man1direxp}) eq dirname($Config{man3direxp}))
+ ? 3 : 2;
+
+SKIP: {
+ skip('no man directories on this system', 1) unless $mandirs;
+ @dirs = $ei->directory_tree('goodmod', 'doc', $Config{man1direxp} ?
+ dirname($Config{man1direxp}) : dirname($Config{man3direxp}));
+ is( scalar @dirs, $expectdirs,
+ 'directory_tree() should report intermediate dirs to those requested' );
+}
+
+my $fakepak = Fakepak->new(102);
+
+$ei->{yesmod} = {
+ version => 101,
+ packlist => $fakepak,
+};
+
+# these should all croak
+foreach my $sub (qw( validate packlist version )) {
+ eval { $ei->$sub('nomod') };
+ like( $@, qr/nomod is not installed/,
+ "$sub() should croak when asked about uninstalled module" );
+}
+
+# validate
+is( $ei->validate('yesmod'), 'validated',
+ 'validate() should return results of packlist validate() call' );
+
+# packlist
+is( ${ $ei->packlist('yesmod') }, 102,
+ 'packlist() should report installed mod packlist' );
+
+# version
+is( $ei->version('yesmod'), 101,
+ 'version() should report installed mod version' );
+
+END {
+ if ($wrotelist) {
+ for my $file (qw( .packlist FakePak.pm )) {
+ 1 while unlink $file;
+ }
+ File::Path::rmtree('auto') or warn "Couldn't rmtree auto: $!";
+ }
+}
+
+package Fakepak;
+
+sub new {
+ my $class = shift;
+ bless(\(my $scalar = shift), $class);
+}
+
+sub validate {
+ 'validated'
+}
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/MM_BeOS.t b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_BeOS.t
new file mode 100644
index 00000000000..870e8d47fe7
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_BeOS.t
@@ -0,0 +1,48 @@
+#!/usr/bin/perl
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+ }
+ else {
+ unshift @INC, 't/lib';
+ }
+}
+chdir 't';
+
+use Test::More;
+
+BEGIN {
+ if ($^O =~ /beos/i) {
+ plan tests => 2;
+ } else {
+ plan skip_all => 'This is not BeOS';
+ }
+}
+
+use Config;
+use File::Spec;
+use File::Basename;
+
+# tels - Taken from MM_Win32.t - I must not understand why this works, right?
+# 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 {}
+}
+
+require_ok( 'ExtUtils::MM_BeOS' );
+
+# perl_archive()
+{
+ my $libperl = $Config{libperl} || 'libperl.a';
+ is( MM->perl_archive(), File::Spec->catfile('$(PERL_INC)', $libperl ),
+ 'perl_archive() should respect libperl setting' );
+}
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Cygwin.t b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Cygwin.t
new file mode 100644
index 00000000000..03641d33f22
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Cygwin.t
@@ -0,0 +1,124 @@
+#!/usr/bin/perl
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+ }
+ else {
+ unshift @INC, 't/lib';
+ }
+}
+chdir 't';
+
+use Test::More;
+
+BEGIN {
+ if ($^O =~ /cygwin/i) {
+ plan tests => 13;
+ } else {
+ plan skip_all => "This is not cygwin";
+ }
+}
+
+use Config;
+use File::Spec;
+use ExtUtils::MM;
+
+use_ok( 'ExtUtils::MM_Cygwin' );
+
+# test canonpath
+my $path = File::Spec->canonpath('/a/../../c');
+is( MM->canonpath('/a/../../c'), $path,
+ 'canonpath() method should work just like the one in File::Spec' );
+
+# test cflags, with the fake package below
+my $args = bless({
+ CFLAGS => 'fakeflags',
+ CCFLAGS => '',
+}, MM);
+
+# with CFLAGS set, it should be returned
+is( $args->cflags(), 'fakeflags',
+ 'cflags() should return CFLAGS member data, if set' );
+
+delete $args->{CFLAGS};
+
+# ExtUtils::MM_Cygwin::cflags() calls this, fake the output
+{
+ local $SIG{__WARN__} = sub {
+ # no warnings 'redefine';
+ warn @_ unless $_[0] =~ /^Subroutine .* redefined/;
+ };
+ sub ExtUtils::MM_Unix::cflags { return $_[1] };
+}
+
+# respects the config setting, should ignore whitespace around equal sign
+my $ccflags = $Config{useshrplib} eq 'true' ? ' -DUSEIMPORTLIB' : '';
+{
+ local $args->{NEEDS_LINKING} = 1;
+ $args->cflags(<<FLAGS);
+OPTIMIZE = opt
+PERLTYPE =pt
+FLAGS
+}
+
+like( $args->{CFLAGS}, qr/OPTIMIZE = opt/, '... should set OPTIMIZE' );
+like( $args->{CFLAGS}, qr/PERLTYPE = pt/, '... should set PERLTYPE' );
+like( $args->{CFLAGS}, qr/CCFLAGS = $ccflags/, '... should set CCFLAGS' );
+
+# test manifypods
+$args = bless({
+ NOECHO => 'noecho',
+ MAN3PODS => {},
+ MAN1PODS => {},
+ MAKEFILE => 'Makefile',
+}, 'MM');
+like( $args->manifypods(), qr/pure_all\n\tnoecho/,
+ 'manifypods() should return without PODS values set' );
+
+$args->{MAN3PODS} = { foo => 1 };
+my $out = tie *STDOUT, 'FakeOut';
+{
+ local $SIG{__WARN__} = sub {
+ # no warnings 'redefine';
+ warn @_ unless $_[0] =~ /used only once/;
+ };
+ no warnings 'once';
+ local *MM::perl_script = sub { return };
+ my $res = $args->manifypods();
+ like( $$out, qr/could not locate your pod2man/,
+ '... should warn if pod2man cannot be located' );
+ like( $res, qr/POD2MAN_EXE = -S pod2man/,
+ '... should use default pod2man target' );
+ like( $res, qr/pure_all.+foo/, '... should add MAN3PODS targets' );
+}
+
+SKIP: {
+ skip "Only relevent in the core", 2 unless $ENV{PERL_CORE};
+ $args->{PERL_SRC} = File::Spec->updir;
+ $args->{MAN1PODS} = { bar => 1 };
+ $$out = '';
+ $res = $args->manifypods();
+ is( $$out, '', '... should not warn if PERL_SRC provided' );
+ like( $res, qr/bar \\\n\t1 \\\n\tfoo/,
+ '... should join MAN1PODS and MAN3PODS');
+}
+
+# test perl_archive
+my $libperl = $Config{libperl} || 'libperl.a';
+$libperl =~ s/\.a/.dll.a/;
+is( $args->perl_archive(), "\$(PERL_INC)/$libperl",
+ 'perl_archive() should respect libperl setting' );
+
+
+package FakeOut;
+
+sub TIEHANDLE {
+ bless(\(my $scalar), $_[0]);
+}
+
+sub PRINT {
+ my $self = shift;
+ $$self .= shift;
+}
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/MM_NW5.t b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_NW5.t
new file mode 100644
index 00000000000..d2046eeebbf
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_NW5.t
@@ -0,0 +1,324 @@
+#!/usr/bin/perl
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't' if -d 't';
+ unshift @INC, '../lib';
+ }
+ else {
+ unshift @INC, 't/lib';
+ }
+}
+chdir 't';
+
+
+use Test::More;
+
+BEGIN {
+ if ($^O =~ /NetWare/i) {
+ plan tests => 40;
+ } else {
+ plan skip_all => 'This is not NW5';
+ }
+}
+
+use Config;
+use File::Spec;
+use File::Basename;
+use ExtUtils::MM;
+
+require_ok( 'ExtUtils::MM_NW5' );
+
+# Dummy MM object until we have a real MM init method.
+my $MM = bless {
+ DIR => [],
+ NOECHO => '@',
+ XS => {},
+ MAKEFILE => 'Makefile',
+ RM_RF => 'rm -rf',
+ MV => 'mv',
+ }, 'MM';
+
+
+# replace_manpage_separator() => tr|/|.|s ?
+{
+ my $man = 'a/path/to//something';
+ ( my $replaced = $man ) =~ tr|/|.|s;
+ is( $MM->replace_manpage_separator( $man ),
+ $replaced, 'replace_manpage_separator()' );
+}
+
+# maybe_command()
+SKIP: {
+ skip( '$ENV{COMSPEC} not set', 2 )
+ unless $ENV{COMSPEC} =~ m!((?:[a-z]:)?[^|<>]+)!i;
+ my $comspec = $1;
+ is( $MM->maybe_command( $comspec ),
+ $comspec, 'COMSPEC is a maybe_command()' );
+ ( my $comspec2 = $comspec ) =~ s|\..{3}$||;
+ like( $MM->maybe_command( $comspec2 ),
+ qr/\Q$comspec/i,
+ 'maybe_command() without extension' );
+}
+
+my $had_pathext = exists $ENV{PATHEXT};
+{
+ local $ENV{PATHEXT} = '.exe';
+ ok( ! $MM->maybe_command( 'not_a_command.com' ),
+ 'not a maybe_command()' );
+}
+# Bug in Perl. local $ENV{FOO} won't delete the key afterward.
+delete $ENV{PATHEXT} unless $had_pathext;
+
+# file_name_is_absolute() [Does not support UNC-paths]
+{
+ ok( $MM->file_name_is_absolute( 'SYS:/' ),
+ 'file_name_is_absolute()' );
+ ok( ! $MM->file_name_is_absolute( 'some/path/' ),
+ 'not file_name_is_absolute()' );
+
+}
+
+# find_perl()
+# Should be able to find running perl... $^X is OK on NW5
+{
+ my $my_perl = $1 if $^X =~ /(.*)/; # are we in -T or -t?
+ my( $perl, $path ) = fileparse( $my_perl );
+ like( $MM->find_perl( $], [ $perl ], [ $path ] ),
+ qr/^\Q$my_perl\E$/i, 'find_perl() finds this perl' );
+}
+
+# catdir() (calls MM_NW5->canonpath)
+{
+ my @path_eg = qw( SYS trick dir/now_OK );
+
+ is( $MM->catdir( @path_eg ),
+ 'SYS\\trick\\dir\\now_OK', 'catdir()' );
+ is( $MM->catdir( @path_eg ),
+ File::Spec->catdir( @path_eg ),
+ 'catdir() eq File::Spec->catdir()' );
+
+# catfile() (calls MM_NW5->catdir)
+ push @path_eg, 'file.ext';
+
+ is( $MM->catfile( @path_eg ),
+ 'SYS\\trick\\dir\\now_OK\\file.ext', 'catfile()' );
+
+ is( $MM->catfile( @path_eg ),
+ File::Spec->catfile( @path_eg ),
+ 'catfile() eq File::Spec->catfile()' );
+}
+
+# init_others(): check if all keys are created and set?
+# qw( TOUCH CHMOD CP RM_F RM_RF MV NOOP TEST_F LD AR LDLOADLIBS DEV_NUL )
+{
+ my $mm_w32 = bless( {}, 'MM' );
+ $mm_w32->init_others();
+ my @keys = qw( TOUCH CHMOD CP RM_F RM_RF MV NOOP
+ TEST_F LD AR LDLOADLIBS DEV_NULL );
+ for my $key ( @keys ) {
+ ok( $mm_w32->{ $key }, "init_others: $key" );
+ }
+}
+
+# constants()
+{
+ my $mm_w32 = bless {
+ NAME => 'TestMM_NW5',
+ VERSION => '1.00',
+ VERSION_FROM => 'TestMM_NW5',
+ PM => { 'MM_NW5.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_NW5\s+VERSION\ =\ 1\.00.+
+ MAKEMAKER\ =\ \Q$INC{'ExtUtils/MakeMaker.pm'}\E\s+
+ MM_VERSION\ =\ \Q$ExtUtils::MakeMaker::VERSION\E.+
+ VERSION_FROM\ =\ TestMM_NW5.+
+ TO_INST_PM\ =\ \Q$s_PM\E\s+
+ PM_TO_BLIB\ =\ \Q$k_PM\E
+ |xs, 'constants()' );
+
+}
+
+# path()
+my $had_path = exists $ENV{PATH};
+{
+ my @path_eg = ( qw( . .. ), 'SYS:\\Program Files' );
+ local $ENV{PATH} = join ';', @path_eg;
+ ok( eq_array( [ $MM->path() ], [ @path_eg ] ),
+ 'path() [preset]' );
+}
+# Bug in Perl. local $ENV{FOO} will not delete key afterwards.
+delete $ENV{PATH} unless $had_path;
+
+# static_lib() should look into that
+# dynamic_bs() should look into that
+# dynamic_lib() should look into that
+
+# clean()
+{
+ my $clean = $Config{cc} =~ /^gcc/i ? 'dll.base dll.exp' : '*.pdb';
+ like( $MM->clean(), qr/^clean ::\s+\Q-$(RM_F) $clean\E\s+$/m,
+ 'clean() Makefile target' );
+}
+
+# perl_archive()
+{
+ my $libperl = $Config{libperl} || 'libperl.a';
+ is( $MM->perl_archive(), File::Spec->catfile('$(PERL_INC)', $libperl ),
+ 'perl_archive() should respect libperl setting' );
+}
+
+# export_list
+{
+ my $mm_w32 = bless { BASEEXT => 'someext' }, 'MM';
+ is( $mm_w32->export_list(), 'someext.def', 'export_list()' );
+}
+
+# canonpath()
+{
+ my $path = 'SYS:/TEMP';
+ is( $MM->canonpath( $path ), File::Spec->canonpath( $path ),
+ 'canonpath() eq File::Spec->canonpath' );
+}
+
+# perl_script()
+my $script_ext = '';
+my $script_name = 'mm_w32tmp';
+SKIP: {
+ local *SCRIPT;
+ skip( "Can't create temp file: $!", 4 )
+ unless open SCRIPT, "> $script_name";
+ print SCRIPT <<'EOSCRIPT';
+#! perl
+__END__
+EOSCRIPT
+ skip( "Can't write to temp file: $!", 4 )
+ unless close SCRIPT;
+ # now start tests:
+ is( $MM->perl_script( $script_name ),
+ "${script_name}$script_ext", "perl_script ($script_ext)" );
+
+ skip( "Can't rename temp file: $!", 3 )
+ unless rename $script_name, "${script_name}.pl";
+ $script_ext = '.pl';
+ is( $MM->perl_script( $script_name ),
+ "${script_name}$script_ext", "perl_script ($script_ext)" );
+
+ skip( "Can't rename temp file: $!", 2 )
+ unless rename "${script_name}$script_ext", "${script_name}.bat";
+ $script_ext = '.bat';
+ is( $MM->perl_script( $script_name ),
+ "${script_name}$script_ext", "perl_script ($script_ext)" );
+
+ skip( "Can't rename temp file: $!", 1 )
+ unless rename "${script_name}$script_ext", "${script_name}.noscript";
+ $script_ext = '.noscript';
+
+ isnt( $MM->perl_script( $script_name ),
+ "${script_name}$script_ext",
+ "not a perl_script anymore ($script_ext)" );
+ is( $MM->perl_script( $script_name ), undef,
+ "perl_script ($script_ext) returns empty" );
+}
+unlink "${script_name}$script_ext" if -f "${script_name}$script_ext";
+
+
+# pm_to_blib()
+{
+ like( $MM->pm_to_blib(),
+ qr/^pm_to_blib: \Q$(TO_INST_PM)\E.+\Q$(TOUCH) \E\$@\s+$/ms,
+ 'pm_to_blib' );
+}
+
+# tool_autosplit()
+{
+ my %attribs = ( MAXLEN => 255 );
+ like( $MM->tool_autosplit( %attribs ),
+ qr/^\#\ Usage:\ \$\(AUTOSPLITFILE\)
+ \ FileToSplit\ AutoDirToSplitInto.+
+ AUTOSPLITFILE\ =\ \$\(PERLRUN\)\ .+
+ \$AutoSplit::Maxlen=$attribs{MAXLEN};
+ /xms,
+ 'tool_autosplit()' );
+}
+
+# tools_other()
+{
+ ( my $mm_w32 = bless { }, 'MM' )->init_others();
+
+ my $bin_sh = ( $Config{make} =~ /^dmake/i
+ ? "" : ($Config{sh} || 'cmd /c') . "\n" );
+ $bin_sh = "SHELL = $bin_sh" if $bin_sh;
+
+ my $tools = join "\n", map "$_ = $mm_w32->{ $_ }"
+ => qw(CHMOD CP LD MV NOOP RM_F RM_RF TEST_F TOUCH UMASK_NULL DEV_NULL);
+
+ like( $mm_w32->tools_other(),
+ qr/^\Q$bin_sh$tools/m,
+ 'tools_other()' );
+};
+
+# xs_o() should look into that
+# top_targets() should look into that
+
+# manifypods()
+{
+ my $mm_w32 = bless { NOECHO => '' }, 'MM';
+ like( $mm_w32->manifypods(),
+ qr/^\nmanifypods :\n\t\$\Q(NOOP)\E\n$/,
+ 'manifypods() Makefile target' );
+}
+
+# dist_ci() should look into that
+# dist_core() should look into that
+
+# pasthru()
+{
+ my $pastru = "PASTHRU = " . ($Config{make} =~ /^nmake/i ? "-nologo" : "");
+ is( $MM->pasthru(), $pastru, 'pasthru()' );
+}
+
+package FakeOut;
+
+sub TIEHANDLE {
+ bless(\(my $scalar), $_[0]);
+}
+
+sub PRINT {
+ my $self = shift;
+ $$self .= shift;
+}
+
+__END__
+
+=head1 NAME
+
+MM_NW5.t - Tests for ExtUtils::MM_NW5
+
+=head1 TODO
+
+ - Methods to still be checked:
+ # static_lib() should look into that
+ # dynamic_bs() should look into that
+ # dynamic_lib() should look into that
+ # xs_o() should look into that
+ # top_targets() should look into that
+ # dist_ci() should look into that
+ # dist_core() should look into that
+
+=head1 AUTHOR
+
+20011228 Abe Timmerman <abe@ztreet.demon.nl>
+
+=cut
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/MM_OS2.t b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_OS2.t
new file mode 100644
index 00000000000..53b83f3f855
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_OS2.t
@@ -0,0 +1,275 @@
+#!/usr/bin/perl -w
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+ }
+ else {
+ unshift @INC, 't/lib';
+ }
+}
+chdir 't';
+
+use strict;
+use Test::More;
+if ($^O =~ /os2/i) {
+ plan( tests => 32 );
+} else {
+ plan( skip_all => "This is not OS/2" );
+}
+
+# for dlsyms, overridden in tests
+BEGIN {
+ package ExtUtils::MM_OS2;
+ use subs 'system', 'unlink';
+}
+
+# for maybe_command
+use File::Spec;
+
+use_ok( 'ExtUtils::MM_OS2' );
+ok( grep( 'ExtUtils::MM_OS2', @MM::ISA),
+ 'ExtUtils::MM_OS2 should be parent of MM' );
+
+# dlsyms
+my $mm = bless({
+ SKIPHASH => {
+ dynamic => 1
+ },
+ NAME => 'foo:bar::',
+}, 'ExtUtils::MM_OS2');
+
+is( $mm->dlsyms(), '',
+ 'dlsyms() should return nothing with dynamic flag set' );
+
+$mm->{BASEEXT} = 'baseext';
+delete $mm->{SKIPHASH};
+my $res = $mm->dlsyms();
+like( $res, qr/baseext\.def: Makefile/,
+ '... without flag, should return make targets' );
+like( $res, qr/"DL_FUNCS" => { }/,
+ '... should provide empty hash refs where necessary' );
+like( $res, qr/"DL_VARS" => \[]/, '... and empty array refs too' );
+
+$mm->{FUNCLIST} = 'funclist';
+$res = $mm->dlsyms( IMPORTS => 'imports' );
+like( $res, qr/"FUNCLIST" => .+funclist/,
+ '... should pick up values from object' );
+like( $res, qr/"IMPORTS" => .+imports/, '... and allow parameter options too' );
+
+my $can_write;
+{
+ local *OUT;
+ $can_write = open(OUT, '>tmp_imp');
+}
+
+SKIP: {
+ skip("Cannot write test files: $!", 7) unless $can_write;
+
+ $mm->{IMPORTS} = { foo => 'bar' };
+
+ local $@;
+ eval { $mm->dlsyms() };
+ like( $@, qr/Can.t mkdir tmp_imp/,
+ '... should die if directory cannot be made' );
+
+ unlink('tmp_imp') or skip("Cannot remove test file: $!", 9);
+ eval { $mm->dlsyms() };
+ like( $@, qr/Malformed IMPORT/, 'should die from malformed import symbols');
+
+ $mm->{IMPORTS} = { foo => 'bar.baz' };
+
+ my @sysfail = ( 1, 0, 1 );
+ my ($sysargs, $unlinked);
+
+ *ExtUtils::MM_OS2::system = sub {
+ $sysargs = shift;
+ return shift @sysfail;
+ };
+
+ *ExtUtils::MM_OS2::unlink = sub {
+ $unlinked++;
+ };
+
+ eval { $mm->dlsyms() };
+
+ like( $sysargs, qr/^emximp/, '... should try to call system() though' );
+ like( $@, qr/Cannot make import library/,
+ '... should die if emximp syscall fails' );
+
+ # sysfail is 0 now, call emximp call should succeed
+ eval { $mm->dlsyms() };
+ is( $unlinked, 1, '... should attempt to unlink temp files' );
+ like( $@, qr/Cannot extract import/,
+ '... should die if other syscall fails' );
+
+ # make both syscalls succeed
+ @sysfail = (0, 0);
+ local $@;
+ eval { $mm->dlsyms() };
+ is( $@, '', '... should not die if both syscalls succeed' );
+}
+
+# static_lib
+{
+ my $called = 0;
+
+ # avoid "used only once"
+ local *ExtUtils::MM_Unix::static_lib;
+ *ExtUtils::MM_Unix::static_lib = sub {
+ $called++;
+ return "\n\ncalled static_lib\n\nline2\nline3\n\nline4";
+ };
+
+ my $args = bless({ IMPORTS => {}, }, 'MM');
+
+ # without IMPORTS as a populated hash, there will be no extra data
+ my $ret = ExtUtils::MM_OS2::static_lib( $args );
+ is( $called, 1, 'static_lib() should call parent method' );
+ like( $ret, qr/^called static_lib/m,
+ '... should return parent data unless IMPORTS exists' );
+
+ $args->{IMPORTS} = { foo => 1};
+ $ret = ExtUtils::MM_OS2::static_lib( $args );
+ is( $called, 2, '... should call parent method if extra imports passed' );
+ like( $ret, qr/^called static_lib\n\t\$\(AR\) \$\(AR_STATIC_ARGS\)/m,
+ '... should append make tags to first line from parent method' );
+ like( $ret, qr/\$@\n\n\nline2\nline3\n\nline4/m,
+ '... should include remaining data from parent method' );
+
+}
+
+# replace_manpage_separator
+my $sep = '//a///b//c/de';
+is( ExtUtils::MM_OS2->replace_manpage_separator($sep), '.a.b.c.de',
+ 'replace_manpage_separator() should turn multiple slashes into periods' );
+
+# maybe_command
+{
+ local *DIR;
+ my ($dir, $noext, $exe, $cmd);
+ my $found = 0;
+
+ my ($curdir, $updir) = (File::Spec->curdir, File::Spec->updir);
+
+ # we need:
+ # 1) a directory
+ # 2) an executable file with no extension
+ # 3) an executable file with the .exe extension
+ # 4) an executable file with the .cmd extension
+ # we assume there will be one somewhere in the path
+ # in addition, we need them to be unique enough they do not trip
+ # an earlier file test in maybe_command(). Portability.
+
+ foreach my $path (split(/:/, $ENV{PATH})) {
+ opendir(DIR, $path) or next;
+ while (defined(my $file = readdir(DIR))) {
+ next if $file eq $curdir or $file eq $updir;
+ $file = File::Spec->catfile($path, $file);
+ unless (defined $dir) {
+ if (-d $file) {
+ next if ( -x $file . '.exe' or -x $file . '.cmd' );
+
+ $dir = $file;
+ $found++;
+ }
+ }
+ if (-x $file) {
+ my $ext;
+ if ($file =~ s/\.(exe|cmd)\z//) {
+ $ext = $1;
+
+ # skip executable files with names too similar
+ next if -x $file;
+ $file .= '.' . $ext;
+
+ } else {
+ unless (defined $noext) {
+ $noext = $file;
+ $found++;
+ }
+ next;
+ }
+
+ unless (defined $exe) {
+ if ($ext eq 'exe') {
+ $exe = $file;
+ $found++;
+ next;
+ }
+ }
+ unless (defined $cmd) {
+ if ($ext eq 'cmd') {
+ $cmd = $file;
+ $found++;
+ next;
+ }
+ }
+ }
+ last if $found == 4;
+ }
+ last if $found == 4;
+ }
+
+ SKIP: {
+ skip('No appropriate directory found', 1) unless defined $dir;
+ is( ExtUtils::MM_OS2->maybe_command( $dir ), undef,
+ 'maybe_command() should ignore directories' );
+ }
+
+ SKIP: {
+ skip('No non-exension command found', 1) unless defined $noext;
+ is( ExtUtils::MM_OS2->maybe_command( $noext ), $noext,
+ 'maybe_command() should find executable lacking file extension' );
+ }
+
+ SKIP: {
+ skip('No .exe command found', 1) unless defined $exe;
+ (my $noexe = $exe) =~ s/\.exe\z//;
+ is( ExtUtils::MM_OS2->maybe_command( $noexe ), $exe,
+ 'maybe_command() should find .exe file lacking extension' );
+ }
+
+ SKIP: {
+ skip('No .cmd command found', 1) unless defined $cmd;
+ (my $nocmd = $cmd) =~ s/\.cmd\z//;
+ is( ExtUtils::MM_OS2->maybe_command( $nocmd ), $cmd,
+ 'maybe_command() should find .cmd file lacking extension' );
+ }
+}
+
+# file_name_is_absolute
+ok( ExtUtils::MM_OS2->file_name_is_absolute( 's:/' ),
+ 'file_name_is_absolute() should be true for paths with volume and slash' );
+ok( ExtUtils::MM_OS2->file_name_is_absolute( '\foo' ),
+ '... and for paths with leading slash but no volume' );
+ok( ! ExtUtils::MM_OS2->file_name_is_absolute( 'arduk' ),
+ '... but not for paths with no leading slash or volume' );
+
+# perl_archive
+is( ExtUtils::MM_OS2->perl_archive(), '$(PERL_INC)/libperl$(LIB_EXT)',
+ 'perl_archive() should return a static string' );
+
+# perl_archive_after
+{
+ my $aout = 0;
+ local *OS2::is_aout;
+ *OS2::is_aout = \$aout;
+
+ isnt( ExtUtils::MM_OS2->perl_archive_after(), '',
+ 'perl_archive_after() should return string without $is_aout set' );
+ $aout = 1;
+ is( ExtUtils::MM_OS2->perl_archive_after(), '',
+ '... and blank string if it is set' );
+}
+
+# export_list
+is( ExtUtils::MM_OS2::export_list({ BASEEXT => 'foo' }), 'foo.def',
+ 'export_list() should add .def to BASEEXT member' );
+
+END {
+ use File::Path;
+ rmtree('tmp_imp');
+ unlink 'tmpimp.imp';
+}
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Unix.t b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Unix.t
new file mode 100644
index 00000000000..1e47f1bc370
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Unix.t
@@ -0,0 +1,252 @@
+#!/usr/bin/perl -w
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+ }
+ else {
+ unshift @INC, 't/lib';
+ }
+}
+chdir 't';
+
+BEGIN {
+ use Test::More;
+
+ if( $^O =~ /^VMS|os2|MacOS|MSWin32|cygwin|beos|netware$/i ) {
+ plan skip_all => 'Non-Unix platform';
+ }
+ else {
+ plan tests => 112;
+ }
+}
+
+BEGIN { use_ok( 'ExtUtils::MM_Unix' ); }
+
+use vars qw($VERSION);
+$VERSION = '0.02';
+use strict;
+use File::Spec;
+
+my $class = 'ExtUtils::MM_Unix';
+
+# only one of the following can be true
+# test should be removed if MM_Unix ever stops handling other OS than Unix
+my $os = ($ExtUtils::MM_Unix::Is_OS2 || 0)
+ + ($ExtUtils::MM_Unix::Is_Mac || 0)
+ + ($ExtUtils::MM_Unix::Is_Win32 || 0)
+ + ($ExtUtils::MM_Unix::Is_Dos || 0)
+ + ($ExtUtils::MM_Unix::Is_VMS || 0);
+ok ( $os <= 1, 'There can be only one (or none)');
+
+cmp_ok ($ExtUtils::MM_Unix::VERSION, '>=', '1.12606', 'Should be at least version 1.12606');
+
+# when the following calls like canonpath, catdir etc are replaced by
+# File::Spec calls, the test's become a bit pointless
+
+foreach ( qw( xx/ ./xx/ xx/././xx xx///xx) )
+ {
+ is ($class->canonpath($_), File::Spec->canonpath($_), "canonpath $_");
+ }
+
+is ($class->catdir('xx','xx'), File::Spec->catdir('xx','xx'),
+ 'catdir(xx, xx) => xx/xx');
+is ($class->catfile('xx','xx','yy'), File::Spec->catfile('xx','xx','yy'),
+ 'catfile(xx, xx) => xx/xx');
+
+is ($class->file_name_is_absolute('Bombdadil'),
+ File::Spec->file_name_is_absolute('Bombdadil'),
+ 'file_name_is_absolute()');
+
+is ($class->path(), File::Spec->path(), 'path() same as File::Spec->path()');
+
+foreach (qw/updir curdir rootdir/)
+ {
+ is ($class->$_(), File::Spec->$_(), $_ );
+ }
+
+foreach ( qw /
+ c_o
+ clean
+ const_cccmd
+ const_config
+ const_loadlibs
+ constants
+ depend
+ dir_target
+ dist
+ dist_basics
+ dist_ci
+ dist_core
+ dist_dir
+ dist_test
+ dlsyms
+ dynamic
+ dynamic_bs
+ dynamic_lib
+ exescan
+ export_list
+ extliblist
+ find_perl
+ fixin
+ force
+ guess_name
+ init_dirscan
+ init_main
+ init_others
+ install
+ installbin
+ linkext
+ lsdir
+ macro
+ makeaperl
+ makefile
+ manifypods
+ maybe_command_in_dirs
+ needs_linking
+ pasthru
+ perldepend
+ pm_to_blib
+ ppd
+ prefixify
+ processPL
+ quote_paren
+ realclean
+ static
+ static_lib
+ staticmake
+ subdir_x
+ subdirs
+ test
+ test_via_harness
+ test_via_script
+ tool_autosplit
+ tool_xsubpp
+ tools_other
+ top_targets
+ writedoc
+ xs_c
+ xs_cpp
+ xs_o
+ xsubpp_version
+ / )
+ {
+ can_ok($class, $_);
+ }
+
+###############################################################################
+# some more detailed tests for the methods above
+
+ok ( join (' ', $class->dist_basics()), 'distclean :: realclean distcheck');
+
+###############################################################################
+# has_link_code tests
+
+my $t = bless { NAME => "Foo" }, $class;
+$t->{HAS_LINK_CODE} = 1;
+is ($t->has_link_code(),1,'has_link_code'); is ($t->{HAS_LINK_CODE},1);
+
+$t->{HAS_LINK_CODE} = 0;
+is ($t->has_link_code(),0); is ($t->{HAS_LINK_CODE},0);
+
+delete $t->{HAS_LINK_CODE}; delete $t->{OBJECT};
+is ($t->has_link_code(),0); is ($t->{HAS_LINK_CODE},0);
+
+delete $t->{HAS_LINK_CODE}; $t->{OBJECT} = 1;
+is ($t->has_link_code(),1); is ($t->{HAS_LINK_CODE},1);
+
+delete $t->{HAS_LINK_CODE}; delete $t->{OBJECT}; $t->{MYEXTLIB} = 1;
+is ($t->has_link_code(),1); is ($t->{HAS_LINK_CODE},1);
+
+delete $t->{HAS_LINK_CODE}; delete $t->{MYEXTLIB}; $t->{C} = [ 'Gloin' ];
+is ($t->has_link_code(),1); is ($t->{HAS_LINK_CODE},1);
+
+###############################################################################
+# libscan
+
+is ($t->libscan('RCS'),'','libscan on RCS');
+is ($t->libscan('CVS'),'','libscan on CVS');
+is ($t->libscan('SCCS'),'','libscan on SCCS');
+is ($t->libscan('Fatty'),'Fatty','libscan on something not RCS, CVS or SCCS');
+
+###############################################################################
+# maybe_command
+
+is ($t->maybe_command('blargel'),undef,"'blargel' isn't a command");
+
+###############################################################################
+# nicetext (dummy method)
+
+is ($t->nicetext('LOTR'),'LOTR','nicetext');
+
+###############################################################################
+# parse_version
+
+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');
+
+my %versions = (
+ '$VERSION = 0.0' => 0.0,
+ '$VERSION = -1.0' => -1.0,
+ '$VERSION = undef' => 'undef',
+ '$wibble = 1.0' => 'undef',
+ );
+
+while( my($code, $expect) = each %versions ) {
+ open(FILE, ">VERSION.tmp") || die $!;
+ print FILE "$code\n";
+ close FILE;
+
+ is( $t->parse_version('VERSION.tmp'), $expect, $code );
+
+ unlink "VERSION.tmp";
+}
+
+
+###############################################################################
+# perl_script (on unix any ordinary, readable file)
+
+is ($t->perl_script($self_name),$self_name, 'we pass as a perl_script()');
+
+###############################################################################
+# perm_rw perm_rwx
+
+is ($t->perm_rw(),'644', 'perm_rw() is 644');
+is ($t->perm_rwx(),'755', 'perm_rwx() is 755');
+
+###############################################################################
+# post_constants, postamble, post_initialize
+
+foreach (qw/ post_constants postamble post_initialize/)
+ {
+ is ($t->$_(),'', "$_() is an empty string");
+ }
+
+###############################################################################
+# replace_manpage_separator
+
+is ($t->replace_manpage_separator('Foo/Bar'),'Foo::Bar','manpage_separator');
+
+###############################################################################
+# export_list, perl_archive, perl_archive_after
+
+foreach (qw/ export_list perl_archive perl_archive_after/)
+ {
+ is ($t->$_(),'',"$_() is empty string on Unix");
+ }
+
+
+{
+ $t->{CCFLAGS} = '-DMY_THING';
+ $t->{LIBPERL_A} = 'libperl.a';
+ $t->{LIB_EXT} = '.a';
+ local $t->{NEEDS_LINKING} = 1;
+ $t->cflags();
+
+ # Brief bug where CCFLAGS was being blown away
+ is( $t->{CCFLAGS}, '-DMY_THING', 'cflags retains CCFLAGS' );
+}
+
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/MM_VMS.t b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_VMS.t
new file mode 100644
index 00000000000..303a599798d
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_VMS.t
@@ -0,0 +1,79 @@
+#!/usr/bin/perl -w
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+ }
+ else {
+ unshift @INC, 't/lib';
+ }
+}
+chdir 't';
+
+BEGIN {
+ @Methods = (qw(wraplist
+ rootdir
+ ext
+ guess_name
+ find_perl
+ path
+ maybe_command
+ maybe_command_in_dirs
+ perl_script
+ file_name_is_absolute
+ replace_manpage_separator
+ init_others
+ constants
+ cflags
+ const_cccmd
+ pm_to_blib
+ tool_autosplit
+ tool_xsubpp
+ xsubpp_version
+ tools_other
+ dist
+ c_o
+ xs_c
+ xs_o
+ top_targets
+ dlsyms
+ dynamic_lib
+ dynamic_bs
+ static_lib
+ manifypods
+ processPL
+ installbin
+ subdir_x
+ clean
+ realclean
+ dist_basics
+ dist_core
+ dist_dir
+ dist_test
+ install
+ perldepend
+ makefile
+ test
+ test_via_harness
+ test_via_script
+ makeaperl
+ nicetext
+ ));
+}
+
+BEGIN {
+ use Test::More;
+ if ($^O eq 'VMS') {
+ plan( tests => @Methods + 1 );
+ }
+ else {
+ plan( skip_all => "This is not VMS" );
+ }
+}
+
+use_ok( 'ExtUtils::MM_VMS' );
+
+foreach my $meth (@Methods) {
+ can_ok( 'ExtUtils::MM_VMS', $meth);
+}
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Win32.t b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Win32.t
new file mode 100644
index 00000000000..8e2b52c03c4
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Win32.t
@@ -0,0 +1,324 @@
+#!/usr/bin/perl
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+ }
+ else {
+ unshift @INC, 't/lib';
+ }
+}
+chdir 't';
+
+use strict;
+use Test::More;
+
+BEGIN {
+ if ($^O =~ /MSWin32/i) {
+ plan tests => 40;
+ } else {
+ plan skip_all => 'This is not Win32';
+ }
+}
+
+use Config;
+use File::Spec;
+use File::Basename;
+use ExtUtils::MM;
+
+require_ok( 'ExtUtils::MM_Win32' );
+
+# Dummy MM object until we have a real MM init method.
+my $MM = bless {
+ DIR => [],
+ NOECHO => '@',
+ XS => {},
+ MAKEFILE => 'Makefile',
+ RM_RF => 'rm -rf',
+ MV => 'mv',
+ }, 'MM';
+
+
+# replace_manpage_separator() => tr|/|.|s ?
+{
+ my $man = 'a/path/to//something';
+ ( my $replaced = $man ) =~ tr|/|.|s;
+ is( $MM->replace_manpage_separator( $man ),
+ $replaced, 'replace_manpage_separator()' );
+}
+
+# maybe_command()
+SKIP: {
+ skip( '$ENV{COMSPEC} not set', 2 )
+ unless $ENV{COMSPEC} =~ m!((?:[a-z]:)?[^|<>]+)!i;
+ my $comspec = $1;
+ is( $MM->maybe_command( $comspec ),
+ $comspec, 'COMSPEC is a maybe_command()' );
+ ( my $comspec2 = $comspec ) =~ s|\..{3}$||;
+ like( $MM->maybe_command( $comspec2 ),
+ qr/\Q$comspec/i,
+ 'maybe_command() without extension' );
+}
+
+my $had_pathext = exists $ENV{PATHEXT};
+{
+ local $ENV{PATHEXT} = '.exe';
+ ok( ! $MM->maybe_command( 'not_a_command.com' ),
+ 'not a maybe_command()' );
+}
+# Bug in Perl. local $ENV{FOO} won't delete the key afterward.
+delete $ENV{PATHEXT} unless $had_pathext;
+
+# file_name_is_absolute() [Does not support UNC-paths]
+{
+ ok( $MM->file_name_is_absolute( 'C:/' ),
+ 'file_name_is_absolute()' );
+ ok( ! $MM->file_name_is_absolute( 'some/path/' ),
+ 'not file_name_is_absolute()' );
+
+}
+
+# find_perl()
+# Should be able to find running perl... $^X is OK on Win32
+{
+ my $my_perl = $1 if $^X =~ /(.*)/; # are we in -T or -t?
+ my( $perl, $path ) = fileparse( $my_perl );
+ like( $MM->find_perl( $], [ $perl ], [ $path ] ),
+ qr/^\Q$my_perl\E$/i, 'find_perl() finds this perl' );
+}
+
+# catdir() (calls MM_Win32->canonpath)
+{
+ my @path_eg = qw( c: trick dir/now_OK );
+
+ is( $MM->catdir( @path_eg ),
+ 'C:\\trick\\dir\\now_OK', 'catdir()' );
+ is( $MM->catdir( @path_eg ),
+ File::Spec->catdir( @path_eg ),
+ 'catdir() eq File::Spec->catdir()' );
+
+# catfile() (calls MM_Win32->catdir)
+ push @path_eg, 'file.ext';
+
+ is( $MM->catfile( @path_eg ),
+ 'C:\\trick\\dir\\now_OK\\file.ext', 'catfile()' );
+
+ is( $MM->catfile( @path_eg ),
+ File::Spec->catfile( @path_eg ),
+ 'catfile() eq File::Spec->catfile()' );
+}
+
+# init_others(): check if all keys are created and set?
+# qw( TOUCH CHMOD CP RM_F RM_RF MV NOOP TEST_F LD AR LDLOADLIBS DEV_NUL )
+{
+ my $mm_w32 = bless( {}, 'MM' );
+ $mm_w32->init_others();
+ my @keys = qw( TOUCH CHMOD CP RM_F RM_RF MV NOOP
+ TEST_F LD AR LDLOADLIBS DEV_NULL );
+ for my $key ( @keys ) {
+ ok( $mm_w32->{ $key }, "init_others: $key" );
+ }
+}
+
+# constants()
+{
+ my $mm_w32 = bless {
+ NAME => 'TestMM_Win32',
+ VERSION => '1.00',
+ 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\ =\ \Q$INC{'ExtUtils/MakeMaker.pm'}\E\s+
+ MM_VERSION\ =\ \Q$ExtUtils::MakeMaker::VERSION\E.+
+ VERSION_FROM\ =\ TestMM_Win32.+
+ TO_INST_PM\ =\ \Q$s_PM\E\s+
+ PM_TO_BLIB\ =\ \Q$k_PM\E
+ |xs, 'constants()' );
+
+}
+
+# path()
+my $had_path = exists $ENV{PATH};
+{
+ my @path_eg = ( qw( . .. ), 'C:\\Program Files' );
+ local $ENV{PATH} = join ';', @path_eg;
+ ok( eq_array( [ $MM->path() ], [ @path_eg ] ),
+ 'path() [preset]' );
+}
+# Bug in Perl. local $ENV{FOO} will not delete key afterwards.
+delete $ENV{PATH} unless $had_path;
+
+# static_lib() should look into that
+# dynamic_bs() should look into that
+# dynamic_lib() should look into that
+
+# clean()
+{
+ my $clean = $Config{cc} =~ /^gcc/i ? 'dll.base dll.exp' : '*.pdb';
+ like( $MM->clean(), qr/^clean ::\s+\Q-$(RM_F) $clean\E\s+$/m,
+ 'clean() Makefile target' );
+}
+
+# perl_archive()
+{
+ my $libperl = $Config{libperl} || 'libperl.a';
+ is( $MM->perl_archive(), File::Spec->catfile('$(PERL_INC)', $libperl ),
+ 'perl_archive() should respect libperl setting' );
+}
+
+# export_list
+{
+ my $mm_w32 = bless { BASEEXT => 'someext' }, 'MM';
+ is( $mm_w32->export_list(), 'someext.def', 'export_list()' );
+}
+
+# canonpath()
+{
+ my $path = 'c:\\Program Files/SomeApp\\Progje.exe';
+ is( $MM->canonpath( $path ), File::Spec->canonpath( $path ),
+ 'canonpath() eq File::Spec->canonpath' );
+}
+
+# perl_script()
+my $script_ext = '';
+my $script_name = 'mm_w32tmp';
+SKIP: {
+ local *SCRIPT;
+ skip( "Can't create temp file: $!", 4 )
+ unless open SCRIPT, "> $script_name";
+ print SCRIPT <<'EOSCRIPT';
+#! perl
+__END__
+EOSCRIPT
+ skip( "Can't write to temp file: $!", 4 )
+ unless close SCRIPT;
+ # now start tests:
+ is( $MM->perl_script( $script_name ),
+ "${script_name}$script_ext", "perl_script ($script_ext)" );
+
+ skip( "Can't rename temp file: $!", 3 )
+ unless rename $script_name, "${script_name}.pl";
+ $script_ext = '.pl';
+ is( $MM->perl_script( $script_name ),
+ "${script_name}$script_ext", "perl_script ($script_ext)" );
+
+ skip( "Can't rename temp file: $!", 2 )
+ unless rename "${script_name}$script_ext", "${script_name}.bat";
+ $script_ext = '.bat';
+ is( $MM->perl_script( $script_name ),
+ "${script_name}$script_ext", "perl_script ($script_ext)" );
+
+ skip( "Can't rename temp file: $!", 1 )
+ unless rename "${script_name}$script_ext", "${script_name}.noscript";
+ $script_ext = '.noscript';
+
+ isnt( $MM->perl_script( $script_name ),
+ "${script_name}$script_ext",
+ "not a perl_script anymore ($script_ext)" );
+ is( $MM->perl_script( $script_name ), undef,
+ "perl_script ($script_ext) returns empty" );
+}
+unlink "${script_name}$script_ext" if -f "${script_name}$script_ext";
+
+
+# pm_to_blib()
+{
+ like( $MM->pm_to_blib(),
+ qr/^pm_to_blib: \Q$(TO_INST_PM)\E.+\Q$(TOUCH) \E\$@\s+$/ms,
+ 'pm_to_blib' );
+}
+
+# tool_autosplit()
+{
+ my %attribs = ( MAXLEN => 255 );
+ like( $MM->tool_autosplit( %attribs ),
+ qr/^\#\ Usage:\ \$\(AUTOSPLITFILE\)
+ \ FileToSplit\ AutoDirToSplitInto.+
+ AUTOSPLITFILE\ =\ \$\(PERLRUN\)\ .+
+ \$AutoSplit::Maxlen=$attribs{MAXLEN};
+ /xms,
+ 'tool_autosplit()' );
+}
+
+# tools_other()
+{
+ ( my $mm_w32 = bless { }, 'MM' )->init_others();
+
+ my $bin_sh = ( $Config{make} =~ /^dmake/i
+ ? "" : ($Config{sh} || 'cmd /c') . "\n" );
+ $bin_sh = "SHELL = $bin_sh" if $bin_sh;
+
+ my $tools = join "\n", map "$_ = $mm_w32->{ $_ }"
+ => qw(CHMOD CP LD MV NOOP RM_F RM_RF TEST_F TOUCH UMASK_NULL DEV_NULL);
+
+ like( $mm_w32->tools_other(),
+ qr/^\Q$bin_sh$tools/m,
+ 'tools_other()' );
+};
+
+# xs_o() should look into that
+# top_targets() should look into that
+
+# manifypods()
+{
+ my $mm_w32 = bless { NOECHO => '' }, 'MM';
+ like( $mm_w32->manifypods(),
+ qr/^\nmanifypods :\n\t\$\Q(NOOP)\E\n$/,
+ 'manifypods() Makefile target' );
+}
+
+# dist_ci() should look into that
+# dist_core() should look into that
+
+# pasthru()
+{
+ my $pastru = "PASTHRU = " . ($Config{make} =~ /^nmake/i ? "-nologo" : "");
+ is( $MM->pasthru(), $pastru, 'pasthru()' );
+}
+
+package FakeOut;
+
+sub TIEHANDLE {
+ bless(\(my $scalar), $_[0]);
+}
+
+sub PRINT {
+ my $self = shift;
+ $$self .= shift;
+}
+
+__END__
+
+=head1 NAME
+
+MM_Win32.t - Tests for ExtUtils::MM_Win32
+
+=head1 TODO
+
+ - Methods to still be checked:
+ # static_lib() should look into that
+ # dynamic_bs() should look into that
+ # dynamic_lib() should look into that
+ # xs_o() should look into that
+ # top_targets() should look into that
+ # dist_ci() should look into that
+ # dist_core() should look into that
+
+=head1 AUTHOR
+
+20011228 Abe Timmerman <abe@ztreet.demon.nl>
+
+=cut
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/Manifest.t b/gnu/usr.bin/perl/lib/ExtUtils/t/Manifest.t
new file mode 100644
index 00000000000..7a488be0937
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/Manifest.t
@@ -0,0 +1,193 @@
+#!/usr/bin/perl -w
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't' if -d 't';
+ unshift @INC, '../lib';
+ }
+ else {
+ unshift @INC, 't/lib';
+ }
+}
+chdir 't';
+
+use strict;
+
+# these files help the test run
+use Test::More tests => 33;
+use Cwd;
+
+# these files are needed for the module itself
+use File::Spec;
+use File::Path;
+
+# We're going to be chdir'ing and modules are sometimes loaded on the
+# fly in this test, so we need an absolute @INC.
+@INC = map { File::Spec->rel2abs($_) } @INC;
+
+# keep track of everything added so it can all be deleted
+my %files;
+sub add_file {
+ my ($file, $data) = @_;
+ $data ||= 'foo';
+ unlink $file; # or else we'll get multiple versions on VMS
+ open( T, '>'.$file) or return;
+ print T $data;
+ ++$files{$file};
+ close T;
+}
+
+sub read_manifest {
+ open( M, 'MANIFEST' ) or return;
+ chomp( my @files = <M> );
+ close M;
+ return @files;
+}
+
+sub catch_warning {
+ my $warn;
+ local $SIG{__WARN__} = sub { $warn .= $_[0] };
+ return join('', $_[0]->() ), $warn;
+}
+
+sub remove_dir {
+ ok( rmdir( $_ ), "remove $_ directory" ) for @_;
+}
+
+# use module, import functions
+BEGIN {
+ use_ok( 'ExtUtils::Manifest',
+ qw( mkmanifest manicheck filecheck fullcheck
+ maniread manicopy skipcheck ) );
+}
+
+my $cwd = Cwd::getcwd();
+
+# Just in case any old files were lying around.
+rmtree('mantest');
+
+ok( mkdir( 'mantest', 0777 ), 'make mantest directory' );
+ok( chdir( 'mantest' ), 'chdir() to mantest' );
+ok( add_file('foo'), 'add a temporary file' );
+
+# there shouldn't be a MANIFEST there
+my ($res, $warn) = catch_warning( \&mkmanifest );
+# Canonize the order.
+$warn = join("", map { "$_|" }
+ sort { lc($a) cmp lc($b) } split /\r?\n/, $warn);
+is( $warn, "Added to MANIFEST: foo|Added to MANIFEST: MANIFEST|",
+ "mkmanifest() displayed its additions" );
+
+# and now you see it
+ok( -e 'MANIFEST', 'create MANIFEST file' );
+
+my @list = read_manifest();
+is( @list, 2, 'check files in MANIFEST' );
+ok( ! ExtUtils::Manifest::filecheck(), 'no additional files in directory' );
+
+# after adding bar, the MANIFEST is out of date
+ok( add_file( 'bar' ), 'add another file' );
+ok( ! manicheck(), 'MANIFEST now out of sync' );
+
+# it reports that bar has been added and throws a warning
+($res, $warn) = catch_warning( \&filecheck );
+
+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
+($res, $warn) = do { local $ExtUtils::Manifest::Quiet = 1;
+ catch_warning( \&skipcheck )
+ };
+cmp_ok( $warn, 'eq', '', 'disabled warnings' );
+
+# add a skip file with a rule to skip itself (and the nonexistent glob '*baz*')
+add_file( 'MANIFEST.SKIP', "baz\n.SKIP" );
+
+# this'll skip the new file
+($res, $warn) = catch_warning( \&skipcheck );
+like( $warn, qr/^Skipping MANIFEST\.SKIP/i, 'got skipping warning' );
+
+my @skipped;
+catch_warning( sub {
+ @skipped = skipcheck()
+});
+
+is( join( ' ', @skipped ), 'MANIFEST.SKIP', 'listed skipped files' );
+
+{
+ local $ExtUtils::Manifest::Quiet = 1;
+ is( join(' ', filecheck() ), 'bar', 'listing skipped with filecheck()' );
+}
+
+# add a subdirectory and a file there that should be found
+ok( mkdir( 'moretest', 0777 ), 'created moretest directory' );
+add_file( File::Spec->catfile('moretest', 'quux'), 'quux' );
+ok( exists( ExtUtils::Manifest::manifind()->{'moretest/quux'} ),
+ "manifind found moretest/quux" );
+
+# only MANIFEST and foo are in the manifest
+my $files = maniread();
+is( keys %$files, 2, 'two files found' );
+is( join(' ', sort { lc($a) cmp lc($b) } keys %$files), 'foo MANIFEST',
+ 'both files found' );
+
+# poison the manifest, and add a comment that should be reported
+add_file( 'MANIFEST', 'none #none' );
+is( ExtUtils::Manifest::maniread()->{none}, '#none',
+ 'maniread found comment' );
+
+ok( mkdir( 'copy', 0777 ), 'made copy directory' );
+
+$files = maniread();
+eval { (undef, $warn) = catch_warning( sub {
+ manicopy( $files, 'copy', 'cp' ) })
+};
+like( $@, qr/^Can't read none: /, 'croaked about none' );
+
+# a newline comes through, so get rid of it
+chomp($warn);
+
+# the copy should have given one warning and one error
+like($warn, qr/^Skipping MANIFEST.SKIP/i, 'warned about MANIFEST.SKIP' );
+
+# tell ExtUtils::Manifest to use a different file
+{
+ local $ExtUtils::Manifest::MANIFEST = 'albatross';
+ ($res, $warn) = catch_warning( \&mkmanifest );
+ like( $warn, qr/Added to albatross: /, 'using a new manifest file' );
+
+ # add the new file to the list of files to be deleted
+ $files{'albatross'}++;
+}
+
+
+# Make sure MANIFEST.SKIP is using complete relative paths
+add_file( 'MANIFEST.SKIP' => "^moretest/q\n" );
+
+# This'll skip moretest/quux
+($res, $warn) = catch_warning( \&skipcheck );
+like( $warn, qr{^Skipping moretest/quux$}i, 'got skipping warning again' );
+
+
+# There was a bug where entries in MANIFEST would be blotted out
+# by MANIFEST.SKIP rules.
+add_file( 'MANIFEST.SKIP' => 'foo' );
+add_file( 'MANIFEST' => 'foobar' );
+add_file( 'foobar' => '123' );
+($res, $warn) = catch_warning( \&manicheck );
+is( $res, '', 'MANIFEST overrides MANIFEST.SKIP' );
+is( $warn, undef, 'MANIFEST overrides MANIFEST.SKIP, no warnings' );
+
+
+END {
+ # the args are evaluated in scalar context
+ is( unlink( keys %files ), keys %files, 'remove all added files' );
+ remove_dir( 'moretest', 'copy' );
+
+ # now get rid of the parent directory
+ ok( chdir( $cwd ), 'return to parent directory' );
+ unlink('mantest/MANIFEST');
+ remove_dir( 'mantest' );
+}
+
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/Mkbootstrap.t b/gnu/usr.bin/perl/lib/ExtUtils/t/Mkbootstrap.t
new file mode 100644
index 00000000000..fe07ddfca5e
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/Mkbootstrap.t
@@ -0,0 +1,155 @@
+#!/usr/bin/perl -w
+
+BEGIN {
+ 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;
+
+BEGIN { use_ok( 'ExtUtils::Mkbootstrap' ) }
+
+# Mkbootstrap makes a backup copy of "$_[0].bs" if it exists and is non-zero
+my $file_is_ready;
+local *OUT;
+if (open(OUT, '>mkboot.bs')) {
+ $file_is_ready = 1;
+ print OUT 'meaningless text';
+ close OUT;
+}
+
+SKIP: {
+ skip("could not make dummy .bs file: $!", 2) unless $file_is_ready;
+
+ Mkbootstrap('mkboot');
+ ok( -s 'mkboot.bso', 'Mkbootstrap should backup the .bs file' );
+ local *IN;
+ if (open(IN, 'mkboot.bso')) {
+ chomp ($file_is_ready = <IN>);
+ close IN;
+ }
+
+ is( $file_is_ready, 'meaningless text', 'backup should be a perfect copy' );
+}
+
+
+# if it doesn't exist or is zero bytes in size, it won't be backed up
+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
+$ExtUtils::Mkbootstrap::Verbose = 1;
+Mkbootstrap('');
+is( $out->read, "\tbsloadlibs=\n", 'should report libraries in Verbose mode' );
+
+Mkbootstrap('', 'foo');
+like( $out->read, qr/bsloadlibs=foo/, 'should still report libraries' );
+
+
+# if ${_[0]}_BS exists, require it
+$file_is_ready = open(OUT, '>boot_BS');
+
+SKIP: {
+ skip("cannot open boot_BS for writing: $!", 1) unless $file_is_ready;
+
+ print OUT '$main::required = 1';
+ close OUT;
+ Mkbootstrap('boot');
+
+ ok( $required, 'baseext_BS file should be require()d' );
+}
+
+
+# if there are any arguments, open a file named baseext.bs
+$file_is_ready = open(OUT, '>dasboot.bs');
+
+SKIP: {
+ skip("cannot make dasboot.bs: $!", 5) unless $file_is_ready;
+
+ # if it can't be opened for writing, we want to prove that it'll die
+ close OUT;
+ chmod 0444, 'dasboot.bs';
+
+ SKIP: {
+ skip("cannot write readonly files", 1) if -w 'dasboot.bs';
+
+ eval{ Mkbootstrap('dasboot', 1) };
+ like( $@, qr/Unable to open dasboot\.bs/, 'should die given bad filename' );
+ }
+
+ # now put it back like it was
+ chmod 0777, 'dasboot.bs';
+ eval{ Mkbootstrap('dasboot', 'myarg') };
+ is( $@, '', 'should not die, given good filename' );
+
+ # red and reed (a visual pun makes tests worth reading)
+ my $read = $out->read();
+ like( $read, qr/Writing dasboot.bs/, 'should print status' );
+ like( $read, qr/containing: my/, 'should print verbose status on request' );
+
+ # now be tricky, and set the status for the next skip block
+ $file_is_ready = open(IN, 'dasboot.bs');
+ ok( $file_is_ready, 'should have written a new .bs file' );
+}
+
+
+SKIP: {
+ skip("cannot read .bs file: $!", 2) unless $file_is_ready;
+
+ my $file = do { local $/ = <IN> };
+
+ # filename should be in header
+ like( $file, qr/# dasboot DynaLoader/, 'file should have boilerplate' );
+
+ # should print arguments within this array
+ like( $file, qr/qw\(myarg\);/, 'should have written array to file' );
+}
+
+
+# overwrite this file (may whack portability, but the name's too good to waste)
+$file_is_ready = open(OUT, '>dasboot.bs');
+
+SKIP: {
+ skip("cannot make dasboot.bs again: $!", 1) unless $file_is_ready;
+ close OUT;
+
+ # if $DynaLoader::bscode is set, write its contents to the file
+ local $DynaLoader::bscode;
+ $DynaLoader::bscode = 'Wall';
+ $ExtUtils::Mkbootstrap::Verbose = 0;
+
+ # if arguments contain '-l' or '-L' or '-R' print dl_findfile message
+ eval{ Mkbootstrap('dasboot', '-Larry') };
+ is( $@, '', 'should be able to open a file again');
+
+ $file_is_ready = open(IN, 'dasboot.bs');
+}
+
+SKIP: {
+ skip("cannot open dasboot.bs for reading: $!", 3) unless $file_is_ready;
+
+ my $file = do { local $/ = <IN> };
+ is( $out->read, "Writing dasboot.bs\n", 'should hush without Verbose set' );
+
+ # and find our hidden tribute to a fine example
+ like( $file, qr/dl_findfile.+Larry/s, 'should load libraries if needed' );
+ like( $file, qr/Wall\n1;\n/ms, 'should write $DynaLoader::bscode if set' );
+}
+
+close IN;
+close OUT;
+
+END {
+ # clean things up, even on VMS
+ 1 while unlink(qw( mkboot.bso boot_BS dasboot.bs .bs ));
+}
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/Packlist.t b/gnu/usr.bin/perl/lib/ExtUtils/t/Packlist.t
new file mode 100644
index 00000000000..58eaf8f6795
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/Packlist.t
@@ -0,0 +1,174 @@
+#!/usr/bin/perl -w
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+ }
+ else {
+ unshift @INC, 't/lib';
+ }
+}
+chdir 't';
+
+use Test::More tests => 34;
+
+use_ok( 'ExtUtils::Packlist' );
+
+is( ref(ExtUtils::Packlist::mkfh()), 'GLOB', 'mkfh() should return a FH' );
+
+# new calls tie()
+my $pl = ExtUtils::Packlist->new();
+isa_ok( $pl, 'ExtUtils::Packlist' );
+is( ref tied %$pl, 'ExtUtils::Packlist', 'obj should be tied underneath' );
+
+
+$pl = ExtUtils::Packlist::TIEHASH( 'tieclass', 'packfile' );
+is( ref($pl), 'tieclass', 'TIEHASH() should bless into class' );
+is( $pl->{packfile}, 'packfile', 'TIEHASH() should store packfile name' );
+
+
+ExtUtils::Packlist::STORE($pl, 'key', 'value');
+is( $pl->{data}{key}, 'value', 'STORE() should stuff stuff in data member' );
+
+
+$pl->{data}{foo} = 'bar';
+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 keys %{ $pl->{data} } > 2;
+
+ # get the first and second key
+ my ($first, $second) = keys %{ $pl->{data} };
+
+ # now get a couple of extra keys, to mess with the hash iterator
+ my $i = 0;
+ for (keys %{ $pl->{data} } ) {
+ last if $i++;
+ }
+
+ # finally, see if it really can get the first key again
+ is( ExtUtils::Packlist::FIRSTKEY($pl), $first,
+ 'FIRSTKEY() should be consistent' );
+
+ is( ExtUtils::Packlist::NEXTKEY($pl), $second,
+ 'and NEXTKEY() should also be consistent' );
+}
+
+
+ok( ExtUtils::Packlist::EXISTS($pl, 'bar'), 'EXISTS() should find keys' );
+
+
+ExtUtils::Packlist::DELETE($pl, 'bar');
+ok( !(exists $pl->{data}{bar}), 'DELETE() should delete cleanly' );
+
+
+ExtUtils::Packlist::CLEAR($pl);
+is( keys %{ $pl->{data} }, 0, 'CLEAR() should wipe out data' );
+
+
+# DESTROY does nothing...
+can_ok( 'ExtUtils::Packlist', 'DESTROY' );
+
+
+# write is a little more complicated
+eval { ExtUtils::Packlist::write({}) };
+like( $@, qr/No packlist filename/, 'write() should croak without packfile' );
+
+eval { ExtUtils::Packlist::write({}, 'eplist') };
+my $file_is_ready = $@ ? 0 : 1;
+ok( $file_is_ready, 'write() can write a file' );
+
+local *IN;
+
+SKIP: {
+ skip('cannot write files, some tests difficult', 3) unless $file_is_ready;
+
+ # set this file to read-only
+ chmod 0444, 'eplist';
+
+ SKIP: {
+ skip("cannot write readonly files", 1) if -w 'eplist';
+
+ eval { ExtUtils::Packlist::write({}, 'eplist') };
+ like( $@, qr/Can't open file/, 'write() should croak on open failure' );
+ }
+
+ #'now set it back (tick here fixes vim syntax highlighting ;)
+ chmod 0777, 'eplist';
+
+ # and some test data to be read
+ $pl->{data} = {
+ single => 1,
+ hash => {
+ foo => 'bar',
+ baz => 'bup',
+ },
+ '/./abc' => '',
+ };
+ eval { ExtUtils::Packlist::write($pl, 'eplist') };
+ is( $@, '', 'write() should normally succeed' );
+ is( $pl->{packfile}, 'eplist', 'write() should set packfile name' );
+
+ $file_is_ready = open(IN, 'eplist');
+}
+
+
+eval { ExtUtils::Packlist::read({}) };
+like( $@, qr/^No packlist filename/, 'read() should croak without packfile' );
+
+
+eval { ExtUtils::Packlist::read({}, 'abadfilename') };
+like( $@, qr/^Can't open file/, 'read() should croak with bad packfile name' );
+#'open packfile for reading
+
+
+# and more read() tests
+SKIP: {
+ skip("cannot open file for reading: $!", 5) unless $file_is_ready;
+ my $file = do { local $/ = <IN> };
+
+ like( $file, qr/single\n/, 'key with value should be available' );
+ like( $file, qr!/\./abc\n!, 'key with no value should also be present' );
+ like( $file, qr/hash.+baz=bup/, 'key with hash value should be present' );
+ like( $file, qr/hash.+foo=bar/, 'second embedded hash value should appear');
+ close IN;
+
+ eval{ ExtUtils::Packlist::read($pl, 'eplist') };
+ is( $@, '', 'read() should normally succeed' );
+ is( $pl->{data}{single}, undef, 'single keys should have undef value' );
+ is( ref($pl->{data}{hash}), 'HASH', 'multivalue keys should become hashes');
+
+ is( $pl->{data}{hash}{foo}, 'bar', 'hash values should be set' );
+ ok( exists $pl->{data}{'/abc'}, 'read() should resolve /./ to / in keys' );
+
+ # give validate a valid and an invalid file to find
+ $pl->{data} = {
+ eplist => 1,
+ fake => undef,
+ };
+
+ is( ExtUtils::Packlist::validate($pl), 1,
+ 'validate() should find missing files' );
+ ExtUtils::Packlist::validate($pl, 1);
+ ok( !exists $pl->{data}{fake},
+ 'validate() should remove missing files when prompted' );
+
+ # one more new() test, to see if it calls read() successfully
+ $pl = ExtUtils::Packlist->new('eplist');
+}
+
+
+# packlist_file, $pl should be set from write test
+is( ExtUtils::Packlist::packlist_file({ packfile => 'pl' }), 'pl',
+ 'packlist_file() should fetch packlist from passed hash' );
+is( ExtUtils::Packlist::packlist_file($pl), 'eplist',
+ 'packlist_file() should fetch packlist from ExtUtils::Packlist object' );
+
+END {
+ 1 while unlink qw( eplist );
+}
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/VERSION_FROM.t b/gnu/usr.bin/perl/lib/ExtUtils/t/VERSION_FROM.t
new file mode 100644
index 00000000000..332b7231623
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/VERSION_FROM.t
@@ -0,0 +1,39 @@
+#!/usr/bin/perl -w
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't' if -d 't';
+ @INC = ('../lib', 'lib');
+ }
+ else {
+ unshift @INC, 't/lib';
+ }
+}
+
+chdir 't';
+
+use strict;
+use Test::More tests => 1;
+use MakeMaker::Test::Utils;
+use ExtUtils::MakeMaker;
+use TieOut;
+use File::Path;
+
+perl_lib();
+
+mkdir('Odd-Version', 0777);
+END { chdir File::Spec->updir; rmtree 'Odd-Version' }
+chdir 'Odd-Version';
+
+open(MPL, ">Version") || die $!;
+print MPL "\$VERSION = 0\n";
+close MPL;
+END { unlink 'Version' }
+
+my $stdout = tie *STDOUT, 'TieOut' or die;
+my $mm = WriteMakefile(
+ NAME => 'Version',
+ VERSION_FROM => 'Version'
+);
+
+is( $mm->{VERSION}, 0, 'VERSION_FROM when $VERSION = 0' );
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/backwards.t b/gnu/usr.bin/perl/lib/ExtUtils/t/backwards.t
new file mode 100644
index 00000000000..95b1e160e7e
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/backwards.t
@@ -0,0 +1,25 @@
+#!/usr/bin/perl -w
+
+# This is a test for all the odd little backwards compatible things
+# MakeMaker has to support. And we do mean backwards.
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't' if -d 't';
+ @INC = ('../lib', 'lib');
+ }
+ else {
+ unshift @INC, 't/lib';
+ }
+}
+
+use strict;
+use Test::More tests => 2;
+
+require ExtUtils::MakeMaker;
+
+# CPAN.pm wants MM.
+can_ok('MM', 'new');
+
+# Pre 5.8 ExtUtils::Embed wants MY.
+can_ok('MY', 'catdir');
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/basic.t b/gnu/usr.bin/perl/lib/ExtUtils/t/basic.t
new file mode 100644
index 00000000000..9080434333c
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/basic.t
@@ -0,0 +1,131 @@
+#!/usr/bin/perl -w
+
+# This test puts MakeMaker through the paces of a basic perl module
+# build, test and installation of the Big::Fat::Dummy module.
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't' if -d 't';
+ @INC = ('../lib', 'lib');
+ }
+ else {
+ unshift @INC, 't/lib';
+ }
+}
+
+use strict;
+use Test::More tests => 17;
+use MakeMaker::Test::Utils;
+use File::Spec;
+use TieOut;
+
+my $perl = which_perl();
+
+my $root_dir = 't';
+
+if( $^O eq 'VMS' ) {
+ # On older systems we might exceed the 8-level directory depth limit
+ # imposed by RMS. We get around this with a rooted logical, but we
+ # can't create logical names with attributes in Perl, so we do it
+ # in a DCL subprocess and put it in the job table so the parent sees it.
+ open( BFDTMP, '>bfdtesttmp.com' ) || die "Error creating command file; $!";
+ print BFDTMP <<'COMMAND';
+$ IF F$TRNLNM("PERL_CORE") .EQS. "" .AND. F$TYPE(PERL_CORE) .EQS. ""
+$ THEN
+$! building CPAN version
+$ BFD_TEST_ROOT = F$PARSE("SYS$DISK:[]",,,,"NO_CONCEAL")-".][000000"-"]["-"].;"+".]"
+$ ELSE
+$! we're in the core
+$ BFD_TEST_ROOT = F$PARSE("SYS$DISK:[-]",,,,"NO_CONCEAL")-".][000000"-"]["-"].;"+".]"
+$ ENDIF
+$ DEFINE/JOB/NOLOG/TRANSLATION=CONCEALED BFD_TEST_ROOT 'BFD_TEST_ROOT'
+COMMAND
+ close BFDTMP;
+
+ system '@bfdtesttmp.com';
+ END { 1 while unlink 'bfdtesttmp.com' }
+ $root_dir = 'BFD_TEST_ROOT:[t]';
+}
+
+chdir $root_dir;
+
+
+perl_lib;
+
+my $Touch_Time = calibrate_mtime();
+
+$| = 1;
+
+ok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) ||
+ diag("chdir failed: $!");
+
+my @mpl_out = `$perl Makefile.PL PREFIX=dummy-install`;
+
+cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) ||
+ diag(@mpl_out);
+
+my $makefile = makefile_name();
+ok( grep(/^Writing $makefile for Big::Dummy/,
+ @mpl_out) == 1,
+ 'Makefile.PL output looks right');
+
+ok( grep(/^Current package is: main$/,
+ @mpl_out) == 1,
+ 'Makefile.PL run in package main');
+
+ok( -e $makefile, 'Makefile exists' );
+
+# -M is flakey on VMS
+my $mtime = (stat($makefile))[9];
+cmp_ok( $Touch_Time, '<=', $mtime, ' its been touched' );
+
+END { unlink makefile_name(), makefile_backup() }
+
+my $make = make_run();
+
+{
+ # Supress 'make manifest' noise
+ local $ENV{PERL_MM_MANIFEST_VERBOSE} = 0;
+ my $manifest_out = `$make manifest`;
+ ok( -e 'MANIFEST', 'make manifest created a MANIFEST' );
+ ok( -s 'MANIFEST', ' its not empty' );
+}
+
+END { unlink 'MANIFEST'; }
+
+my $test_out = `$make test`;
+like( $test_out, qr/All tests successful/, 'make test' );
+is( $?, 0 );
+
+# Test 'make test TEST_VERBOSE=1'
+my $make_test_verbose = make_macro($make, 'test', TEST_VERBOSE => 1);
+$test_out = `$make_test_verbose`;
+like( $test_out, qr/ok \d+ - TEST_VERBOSE/, 'TEST_VERBOSE' );
+like( $test_out, qr/All tests successful/, ' successful' );
+is( $?, 0 );
+
+my $dist_test_out = `$make disttest`;
+is( $?, 0, 'disttest' ) || diag($dist_test_out);
+
+
+# Make sure init_dirscan doesn't go into the distdir
+@mpl_out = `$perl Makefile.PL "PREFIX=dummy-install"`;
+
+cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) ||
+ diag(@mpl_out);
+
+ok( grep(/^Writing $makefile for Big::Dummy/,
+ @mpl_out) == 1,
+ 'init_dirscan skipped distdir') ||
+ diag(@mpl_out);
+
+# I know we'll get ignored errors from make here, that's ok.
+# Send STDERR off to oblivion.
+open(SAVERR, ">&STDERR") or die $!;
+open(STDERR, ">".File::Spec->devnull) or die $!;
+
+my $realclean_out = `$make realclean`;
+is( $?, 0, 'realclean' ) || diag($realclean_out);
+
+open(STDERR, ">&SAVERR") or die $!;
+close SAVERR;
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/hints.t b/gnu/usr.bin/perl/lib/ExtUtils/t/hints.t
new file mode 100644
index 00000000000..62608d7bbb6
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/hints.t
@@ -0,0 +1,48 @@
+#!/usr/bin/perl -w
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't';
+ @INC = ('../lib', 'lib/');
+ }
+ else {
+ unshift @INC, 't/lib/';
+ }
+}
+chdir 't';
+
+use Test::More tests => 3;
+
+mkdir('hints', 0777);
+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" );
+
+open(HINT, ">$hint_file") || die "Can't write dummy hints file $hint_file: $!";
+print HINT <<'CLOO';
+die "Argh!\n";
+CLOO
+close HINT;
+
+$mm->check_hints;
+is( $out->read, <<OUT, 'hint files produce errors' );
+Processing hints file $hint_file
+Argh!
+OUT
+
+END {
+ use File::Path;
+ rmtree ['hints'];
+}
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/prefixify.t b/gnu/usr.bin/perl/lib/ExtUtils/t/prefixify.t
new file mode 100644
index 00000000000..0f92a4a8b24
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/prefixify.t
@@ -0,0 +1,40 @@
+#!/usr/bin/perl -w
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't' if -d 't';
+ @INC = ('../lib', 'lib');
+ }
+ else {
+ unshift @INC, 't/lib';
+ }
+}
+
+use strict;
+use Test::More;
+
+if( $^O eq 'VMS' ) {
+ plan skip_all => 'prefixify works differently on VMS';
+}
+else {
+ plan tests => 2;
+}
+use File::Spec;
+use ExtUtils::MM;
+
+my $mm = bless {}, 'MM';
+
+my $default = File::Spec->catdir(qw(this that));
+$mm->prefixify('installbin', 'wibble', 'something', $default);
+
+is( $mm->{INSTALLBIN}, File::Spec->catdir('something', $default),
+ 'prefixify w/defaults');
+
+{
+ undef *ExtUtils::MM_Unix::Config;
+ $ExtUtils::MM_Unix::Config{wibble} = 'C:\opt\perl\wibble';
+ $mm->prefixify('wibble', 'C:\opt\perl', 'C:\yarrow');
+
+ is( $mm->{WIBBLE}, 'C:\yarrow\wibble', 'prefixify Win32 paths' );
+ { package ExtUtils::MM_Unix; Config->import }
+}
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/problems.t b/gnu/usr.bin/perl/lib/ExtUtils/t/problems.t
new file mode 100644
index 00000000000..e9162d20325
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/problems.t
@@ -0,0 +1,40 @@
+# Test problems in Makefile.PL's and hint files.
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't' if -d 't';
+ @INC = ('../lib', 'lib');
+ }
+ else {
+ unshift @INC, 't/lib';
+ }
+}
+chdir 't';
+
+use strict;
+use Test::More tests => 3;
+use ExtUtils::MM;
+use TieOut;
+
+my $MM = bless { DIR => ['subdir'] }, 'MM';
+
+ok( chdir 'Problem-Module', "chdir'd to Problem-Module" ) ||
+ diag("chdir failed: $!");
+
+
+# Make sure when Makefile.PL's break, they issue a warning.
+# Also make sure Makefile.PL's in subdirs still have '.' in @INC.
+{
+ my $stdout = tie *STDOUT, 'TieOut' or die;
+
+ my $warning = '';
+ local $SIG{__WARN__} = sub { $warning = join '', @_ };
+ eval { $MM->eval_in_subdirs; };
+
+ is( $stdout->read, qq{\@INC has .\n}, 'cwd in @INC' );
+ like( $@,
+ qr{^ERROR from evaluation of .*subdir.*Makefile.PL: YYYAaaaakkk},
+ 'Makefile.PL death in subdir warns' );
+
+ untie *STDOUT;
+}
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/testlib.t b/gnu/usr.bin/perl/lib/ExtUtils/t/testlib.t
new file mode 100644
index 00000000000..6f496a4136d
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/testlib.t
@@ -0,0 +1,37 @@
+#!/usr/bin/perl -Tw
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+ }
+ else {
+ # ./lib is there so t/lib can be seen even after we chdir.
+ unshift @INC, 't/lib', './lib';
+ }
+}
+chdir 't';
+
+use Test::More tests => 5;
+
+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' );
+
+@blib_paths = grep { /blib/ } @INC;
+is( @blib_paths, 2, 'ExtUtils::testlib added two @INC dirs!' );
+ok( !(grep !File::Spec->file_name_is_absolute($_), @blib_paths),
+ ' and theyre absolute');
+
+eval { eval "# @INC"; };
+is( $@, '', '@INC is not tainted' );
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/writemakefile_args.t b/gnu/usr.bin/perl/lib/ExtUtils/t/writemakefile_args.t
new file mode 100644
index 00000000000..f4b4daf6e39
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/writemakefile_args.t
@@ -0,0 +1,116 @@
+#!/usr/bin/perl -w
+
+# This is a test of the verification of the arguments to
+# WriteMakefile.
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't' if -d 't';
+ @INC = ('../lib', 'lib');
+ }
+ else {
+ unshift @INC, 't/lib';
+ }
+}
+
+use strict;
+use Test::More tests => 13;
+
+use TieOut;
+use MakeMaker::Test::Utils;
+
+use ExtUtils::MakeMaker;
+
+chdir 't';
+
+perl_lib();
+
+ok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) ||
+ diag("chdir failed: $!");
+
+{
+ ok( my $stdout = tie *STDOUT, 'TieOut' );
+ my $warnings = '';
+ local $SIG{__WARN__} = sub {
+ $warnings .= join '', @_;
+ };
+
+ my $mm;
+
+ eval {
+ $mm = WriteMakefile(
+ NAME => 'Big::Dummy',
+ VERSION_FROM => 'lib/Big/Dummy.pm',
+ MAN3PODS => ' ', # common mistake
+ );
+ };
+
+ is( $warnings, <<VERIFY );
+WARNING: MAN3PODS takes a hash reference not a string/number.
+ Please inform the author.
+VERIFY
+
+ $warnings = '';
+ eval {
+ $mm = WriteMakefile(
+ NAME => 'Big::Dummy',
+ VERSION_FROM => 'lib/Big/Dummy.pm',
+ AUTHOR => sub {},
+ );
+ };
+
+ is( $warnings, <<VERIFY );
+WARNING: AUTHOR takes a string/number not a code reference.
+ Please inform the author.
+VERIFY
+
+ # LIBS accepts *both* a string or an array ref. The first cut of
+ # our verification did not take this into account.
+ $warnings = '';
+ $mm = WriteMakefile(
+ NAME => 'Big::Dummy',
+ VERSION_FROM => 'lib/Big/Dummy.pm',
+ LIBS => '-lwibble -lwobble',
+ );
+
+ # We'll get warnings about the bogus libs, that's ok.
+ unlike( $warnings, qr/WARNING: .* takes/ );
+ is_deeply( $mm->{LIBS}, ['-lwibble -lwobble'] );
+
+ $warnings = '';
+ $mm = WriteMakefile(
+ NAME => 'Big::Dummy',
+ VERSION_FROM => 'lib/Big/Dummy.pm',
+ LIBS => ['-lwibble', '-lwobble'],
+ );
+
+ # We'll get warnings about the bogus libs, that's ok.
+ unlike( $warnings, qr/WARNING: .* takes/ );
+ is_deeply( $mm->{LIBS}, ['-lwibble', '-lwobble'] );
+
+ $warnings = '';
+ eval {
+ $mm = WriteMakefile(
+ NAME => 'Big::Dummy',
+ VERSION_FROM => 'lib/Big/Dummy.pm',
+ LIBS => { wibble => "wobble" },
+ );
+ };
+
+ # We'll get warnings about the bogus libs, that's ok.
+ like( $warnings, qr{^WARNING: LIBS takes a array reference or string/number not a hash reference}m );
+
+
+ $warnings = '';
+ $mm = WriteMakefile(
+ NAME => 'Big::Dummy',
+ WIBBLE => 'something',
+ wump => { foo => 42 },
+ );
+
+ like( $warnings, qr{^WARNING: WIBBLE is not a known parameter.\n}m );
+ like( $warnings, qr{^WARNING: wump is not a known parameter.\n}m );
+
+ is( $mm->{WIBBLE}, 'something' );
+ is_deeply( $mm->{wump}, { foo => 42 } );
+}
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/zz_cleanup_dummy.t b/gnu/usr.bin/perl/lib/ExtUtils/t/zz_cleanup_dummy.t
new file mode 100644
index 00000000000..69738445966
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/zz_cleanup_dummy.t
@@ -0,0 +1,21 @@
+#!/usr/bin/perl -w
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ @INC = ('../lib', 'lib');
+ }
+ else {
+ unshift @INC, 't/lib';
+ }
+}
+chdir 't';
+
+
+use strict;
+use Test::More tests => 2;
+use File::Path;
+
+rmtree('Big-Dummy');
+ok(!-d 'Big-Dummy', 'Big-Dummy cleaned up');
+rmtree('Problem-Module');
+ok(!-d 'Problem-Module', 'Problem-Module cleaned up');