summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/perl/lib/ExtUtils/t
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2009-10-12 18:10:27 +0000
committermillert <millert@openbsd.org>2009-10-12 18:10:27 +0000
commit43003dfe3ad45d1698bed8a37f2b0f5b14f20d4f (patch)
tree1abc677556fd1cb82189030802130c0f670a32d9 /gnu/usr.bin/perl/lib/ExtUtils/t
parentMore inodes by default on the ramdisk, because otherwise a many-disk (diff)
downloadwireguard-openbsd-43003dfe3ad45d1698bed8a37f2b0f5b14f20d4f.tar.xz
wireguard-openbsd-43003dfe3ad45d1698bed8a37f2b0f5b14f20d4f.zip
import perl 5.10.1
Diffstat (limited to 'gnu/usr.bin/perl/lib/ExtUtils/t')
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/00compile.t21
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/Constant.t27
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/Embed.t29
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/INSTALL_BASE.t3
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/Install.t56
-rwxr-xr-xgnu/usr.bin/perl/lib/ExtUtils/t/InstallWithMM.t95
-rwxr-xr-xgnu/usr.bin/perl/lib/ExtUtils/t/Installapi2.t238
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/Installed.t2
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/MM_BeOS.t2
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/MM_Cygwin.t27
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/MM_Unix.t45
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/MM_Win32.t33
-rwxr-xr-xgnu/usr.bin/perl/lib/ExtUtils/t/MakeMaker_Parameters.t74
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/Manifest.t139
-rwxr-xr-xgnu/usr.bin/perl/lib/ExtUtils/t/arch_check.t89
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/basic.t74
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/build_man.t2
-rwxr-xr-xgnu/usr.bin/perl/lib/ExtUtils/t/can_write_dir.t61
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/cd.t13
-rwxr-xr-xgnu/usr.bin/perl/lib/ExtUtils/t/cp.t33
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/eu_command.t9
-rwxr-xr-xgnu/usr.bin/perl/lib/ExtUtils/t/fix_libs.t36
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/fixin.t80
-rwxr-xr-xgnu/usr.bin/perl/lib/ExtUtils/t/installed_file.t51
-rwxr-xr-xgnu/usr.bin/perl/lib/ExtUtils/t/is_of_type.t40
-rwxr-xr-xgnu/usr.bin/perl/lib/ExtUtils/t/metafile_data.t315
-rwxr-xr-xgnu/usr.bin/perl/lib/ExtUtils/t/metafile_file.t314
-rwxr-xr-xgnu/usr.bin/perl/lib/ExtUtils/t/min_perl_version.t201
-rwxr-xr-xgnu/usr.bin/perl/lib/ExtUtils/t/miniperl.t57
-rwxr-xr-xgnu/usr.bin/perl/lib/ExtUtils/t/pm_to_blib.t77
-rwxr-xr-xgnu/usr.bin/perl/lib/ExtUtils/t/pod2man.t54
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/prefixify.t6
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/prereq.t4
-rwxr-xr-xgnu/usr.bin/perl/lib/ExtUtils/t/test_boilerplate.t26
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/testdata/reallylongdirectoryname/arch1/Config.pm0
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/testdata/reallylongdirectoryname/arch2/Config.pm0
-rw-r--r--gnu/usr.bin/perl/lib/ExtUtils/t/writemakefile_args.t65
-rwxr-xr-xgnu/usr.bin/perl/lib/ExtUtils/t/xs.t15
38 files changed, 2266 insertions, 147 deletions
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/00compile.t b/gnu/usr.bin/perl/lib/ExtUtils/t/00compile.t
index e2995dc4a2e..20f7ded6f44 100644
--- a/gnu/usr.bin/perl/lib/ExtUtils/t/00compile.t
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/00compile.t
@@ -10,8 +10,6 @@ BEGIN {
}
chdir 't';
-use File::Find;
-use File::Spec;
use Test::More;
my $Has_Test_Pod;
@@ -19,22 +17,23 @@ BEGIN {
$Has_Test_Pod = eval 'use Test::Pod 0.95; 1';
}
-chdir File::Spec->updir;
-my $manifest = File::Spec->catfile('MANIFEST');
-open(MANIFEST, $manifest) or die "Can't open $manifest: $!";
+chdir "..";
+my $manifest = "MANIFEST";
+open(my $manifest_fh, "<", $manifest) or die "Can't open $manifest: $!";
my @modules = map { m{^lib/(\S+)}; $1 }
grep { m{^lib/ExtUtils/\S*\.pm} }
- grep { !m{/t/} } <MANIFEST>;
+ grep { !m{/t/} } <$manifest_fh>;
chomp @modules;
-close MANIFEST;
+close $manifest_fh;
chdir 'lib';
plan tests => scalar @modules * 2;
foreach my $file (@modules) {
- # 5.8.0 has a bug about require alone in an eval. Thus the extra
- # statement.
- eval { require($file); 1 };
- is( $@, '', "require $file" );
+ # Make sure we look at the local files and do not reload them if
+ # they're already loaded. This avoids recompilation warnings.
+ local @INC = @INC;
+ unshift @INC, ".";
+ ok eval { require($file); 1 } or diag "require $file failed.\n$@";
SKIP: {
skip "Test::Pod not installed", 1 unless $Has_Test_Pod;
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/Constant.t b/gnu/usr.bin/perl/lib/ExtUtils/t/Constant.t
index 7c997fe21ba..02b7528bcb4 100644
--- a/gnu/usr.bin/perl/lib/ExtUtils/t/Constant.t
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/Constant.t
@@ -47,8 +47,29 @@ if ($^O eq 'MSWin32' && $make eq 'nmake') { $make .= " -nologo"; }
# VMS may be using something other than MMS/MMK
my $mms_or_mmk = 0;
+my $vms_lc = 0;
+my $vms_nodot = 0;
if ($^O eq 'VMS') {
- $mms_or_mmk = 1 if (($make eq 'MMK') || ($make eq 'MMS'));
+ $mms_or_mmk = 1 if (($make eq 'MMK') || ($make eq 'MMS'));
+ $vms_lc = 1;
+ $vms_nodot = 1;
+ my $vms_unix_rpt = 0;
+ my $vms_efs = 0;
+ my $vms_efs_case = 0;
+ if (eval 'require VMS::Feature') {
+ $vms_unix_rpt = VMS::Feature::current("filename_unix_report");
+ $vms_efs = VMS::Feature::current("efs_case_preserve");
+ $vms_efs_case = VMS::Feature::current("efs_charset");
+ } else {
+ my $unix_rpt = $ENV{'DECC$FILENAME_UNIX_REPORT'} || '';
+ my $efs_charset = $ENV{'DECC$EFS_CHARSET'} || '';
+ my $efs_case = $ENV{'DECC$EFS_CASE_PRESERVE'} || '';
+ $vms_unix_rpt = $unix_rpt =~ /^[ET1]/i;
+ $vms_efs = $efs_charset =~ /^[ET1]/i;
+ $vms_efs_case = $efs_case =~ /^[ET1]/i;
+ }
+ $vms_lc = 0 if $vms_efs_case;
+ $vms_nodot = 0 if $vms_unix_rpt;
}
# Renamed by make clean
@@ -111,12 +132,12 @@ package main;
sub check_for_bonus_files {
my $dir = shift;
- my %expect = map {($^O eq 'VMS' ? lc($_) : $_), 1} @_;
+ my %expect = map {($vms_lc ? 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
+ $entry =~ s/\.$// if $vms_nodot; # delete trailing dot that indicates no extension
next if $expect{$entry};
print "# Extra file '$entry'\n";
$fail = 1;
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/Embed.t b/gnu/usr.bin/perl/lib/ExtUtils/t/Embed.t
index e3321ecd471..2aece548bfb 100644
--- a/gnu/usr.bin/perl/lib/ExtUtils/t/Embed.t
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/Embed.t
@@ -105,10 +105,8 @@ if ($^O eq 'VMS') {
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 ($^O eq 'cygwin') { # Cygwin needs no special treatment like below
+ ;
}
elsif ($Config{'libperl'} !~ /\Alibperl\./) {
# Everyone needs libperl copied if it's not found by '-lperl'.
@@ -137,7 +135,7 @@ print "# $_\n" foreach @out;
if ($^O eq 'VMS' && !$status) {
print "# @cmd2\n";
- $status = system(join(' ',@cmd2));
+ $status = system(join(' ',@cmd2));
}
print (($status? 'not ': '')."ok 1\n");
@@ -163,7 +161,7 @@ __END__
#define my_puts(a) if(puts(a) < 0) exit(666)
-static char *cmds[] = { "perl","-e", "$|=1; print qq[ok 5\\n]", NULL };
+static const char * cmds [] = { "perl", "-e", "$|=1; print qq[ok 5\\n]", NULL };
#ifdef PERL_GLOBAL_STRUCT_PRIVATE
static struct perl_vars *my_plvarsp;
@@ -171,12 +169,11 @@ struct perl_vars* Perl_GetVarsPrivate(void) { return my_plvarsp; }
#endif
#ifdef NO_ENV_ARRAY_IN_MAIN
-extern char **environ;
-int main(int argc, char **argv)
+int main(int argc, char **argv) {
+ char **env;
#else
-int main(int argc, char **argv, char **env)
+int main(int argc, char **argv, char **env) {
#endif
-{
PerlInterpreter *my_perl;
#ifdef PERL_GLOBAL_STRUCT
dVAR;
@@ -188,11 +185,7 @@ int main(int argc, char **argv, char **env)
(void)argc; /* PERL_SYS_INIT3 may #define away their use */
(void)argv;
-#ifdef NO_ENV_ARRAY_IN_MAIN
- PERL_SYS_INIT3(&argc,&argv,&environ);
-#else
- PERL_SYS_INIT3(&argc,&argv,&env);
-#endif
+ PERL_SYS_INIT3(&argc, &argv, &env);
my_perl = perl_alloc();
@@ -202,11 +195,7 @@ int main(int argc, char **argv, char **env)
my_puts("ok 3");
-#ifdef NO_ENV_ARRAY_IN_MAIN
- perl_parse(my_perl, NULL, (sizeof(cmds)/sizeof(char *))-1, cmds, environ);
-#else
- perl_parse(my_perl, NULL, (sizeof(cmds)/sizeof(char *))-1, cmds, env);
-#endif
+ perl_parse(my_perl, NULL, (sizeof(cmds)/sizeof(char *))-1, (char **)cmds, env);
my_puts("ok 4");
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/INSTALL_BASE.t b/gnu/usr.bin/perl/lib/ExtUtils/t/INSTALL_BASE.t
index cac65f266f0..95c62cc060d 100644
--- a/gnu/usr.bin/perl/lib/ExtUtils/t/INSTALL_BASE.t
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/INSTALL_BASE.t
@@ -16,7 +16,7 @@ use strict;
use File::Path;
use Config;
-use Test::More tests => 21;
+use Test::More tests => 20;
use MakeMaker::Test::Utils;
use MakeMaker::Test::Setup::BFD;
@@ -51,7 +51,6 @@ run("$make"); # this is necessary due to a dmake bug.
my $install_out = run("$make install");
is( $?, 0, ' make install exited normally' ) || diag $install_out;
like( $install_out, qr/^Installing /m );
-like( $install_out, qr/^Writing /m );
ok( -r '../dummy-install', ' install dir created' );
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/Install.t b/gnu/usr.bin/perl/lib/ExtUtils/t/Install.t
index ae8d7811047..a30515ea949 100644
--- a/gnu/usr.bin/perl/lib/ExtUtils/t/Install.t
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/Install.t
@@ -17,11 +17,14 @@ use TieOut;
use File::Path;
use File::Spec;
-use Test::More tests => 38;
+use Test::More tests => 52;
use MakeMaker::Test::Setup::BFD;
BEGIN { use_ok('ExtUtils::Install') }
+# ensure the env doesnt pollute our tests
+local $ENV{EU_INSTALL_ALWAYS_COPY};
+local $ENV{EU_ALWAYS_COPY};
# Check exports.
foreach my $func (qw(install uninstall pm_to_blib install_default)) {
@@ -122,6 +125,56 @@ close DUMMY;
' UNINST=0 left different' );
}
+# Test UNINST=1 only warning when failing to remove an irrelevent shadow file
+{
+ my $tfile='install-test/lib/perl/Big/Dummy.pm';
+ local $ExtUtils::Install::Testing = $tfile;
+ local @INC = ('install-test/other_lib/perl','install-test/lib/perl');
+ local $ENV{PERL5LIB} = '';
+ ok( -r $tfile, 'different install exists' );
+ my @warn;
+ local $SIG{__WARN__}=sub { push @warn, @_; return };
+ my $ok=eval {
+ install( { 'blib/lib' => 'install-test/other_lib/perl',
+ read => 'install-test/packlist',
+ write => 'install-test/packlist'
+ },
+ 0, 0, 1);
+ 1
+ };
+ ok($ok,' we didnt die');
+ ok(0+@warn," we did warn");
+ ok( -d 'install-test/other_lib/perl', 'install made other dir' );
+ ok( -r 'install-test/other_lib/perl/Big/Dummy.pm', ' .pm file installed' );
+ ok( -r 'install-test/packlist', ' packlist exists' );
+ ok( -r $tfile, ' UNINST=1 failed to remove different' );
+
+}
+
+# Test UNINST=1 dieing when failing to remove an relevent shadow file
+{
+ my $tfile='install-test/lib/perl/Big/Dummy.pm';
+ local $ExtUtils::Install::Testing = $tfile;
+ local @INC = ('install-test/lib/perl','install-test/other_lib/perl');
+ local $ENV{PERL5LIB} = '';
+ ok( -r $tfile, 'different install exists' );
+ my @warn;
+ local $SIG{__WARN__}=sub { push @warn,@_; return };
+ my $ok=eval {
+ install( { 'blib/lib' => 'install-test/other_lib/perl',
+ read => 'install-test/packlist',
+ write => 'install-test/packlist'
+ },
+ 0, 0, 1);
+ 1
+ };
+ ok(!$ok,' we did die');
+ ok(!@warn," we didnt warn");
+ ok( -d 'install-test/other_lib/perl', 'install made other dir' );
+ ok( -r 'install-test/other_lib/perl/Big/Dummy.pm', ' .pm file installed' );
+ ok( -r 'install-test/packlist', ' packlist exists' );
+ ok( -r $tfile,' UNINST=1 failed to remove different' );
+}
# Test UNINST=1 removing other versions in other dirs.
{
@@ -138,3 +191,4 @@ close DUMMY;
ok( !-r 'install-test/lib/perl/Big/Dummy.pm',
' UNINST=1 removed different' );
}
+
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/InstallWithMM.t b/gnu/usr.bin/perl/lib/ExtUtils/t/InstallWithMM.t
new file mode 100755
index 00000000000..354b8f4d352
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/InstallWithMM.t
@@ -0,0 +1,95 @@
+#!/usr/bin/perl -w
+
+# Make sure EUI works with MakeMaker
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't' if -d 't';
+ @INC = ('../lib', 'lib');
+ }
+ else {
+ unshift @INC, 't/lib';
+ }
+}
+
+use strict;
+use Config;
+use ExtUtils::MakeMaker;
+
+use Test::More tests => 15;
+use MakeMaker::Test::Utils;
+use MakeMaker::Test::Setup::BFD;
+use File::Find;
+use File::Spec;
+use File::Path;
+
+my $make = make_run();
+
+# Environment variables which interfere with our testing.
+delete @ENV{qw(PREFIX LIB MAKEFLAGS)};
+
+# Run Makefile.PL
+{
+ my $perl = which_perl();
+ my $Is_VMS = $^O eq 'VMS';
+
+ chdir 't';
+
+ perl_lib;
+
+ my $Touch_Time = calibrate_mtime();
+
+ $| = 1;
+
+ ok( setup_recurs(), 'setup' );
+ END {
+ ok( chdir File::Spec->updir );
+ ok( teardown_recurs(), 'teardown' );
+ }
+
+ ok( chdir('Big-Dummy'), "chdir'd to Big-Dummy" ) ||
+ diag("chdir failed: $!");
+
+ my @mpl_out = run(qq{$perl Makefile.PL "PREFIX=../dummy-install"});
+ END { rmtree '../dummy-install'; }
+
+ cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) ||
+ diag(@mpl_out);
+
+ END { unlink makefile_name(), makefile_backup() }
+}
+
+
+# make
+{
+ my $make_out = run($make);
+ is( $?, 0, 'make ran ok' ) ||
+ diag($make_out);
+}
+
+
+# Test 'make install VERBINST=1'
+{
+ my $make_install_verbinst = make_macro($make, 'install', VERBINST => 1);
+ my $install_out = run($make_install_verbinst);
+ is( $?, 0, 'install' ) || diag $install_out;
+ like( $install_out, qr/^Installing /m );
+ like( $install_out, qr/^Writing /m );
+
+ ok( -r '../dummy-install', ' install dir created' );
+ my %files = ();
+ find( sub {
+ # do it case-insensitive for non-case preserving OSs
+ my $file = lc $_;
+
+ # VMS likes to put dots on the end of things that don't have them.
+ $file =~ s/\.$// if $Is_VMS;
+
+ $files{$file} = $File::Find::name;
+ }, '../dummy-install' );
+ ok( $files{'dummy.pm'}, ' Dummy.pm installed' );
+ ok( $files{'liar.pm'}, ' Liar.pm installed' );
+ ok( $files{'program'}, ' program installed' );
+ ok( $files{'.packlist'}, ' packlist created' );
+ ok( $files{'perllocal.pod'},' perllocal.pod created' );
+}
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/Installapi2.t b/gnu/usr.bin/perl/lib/ExtUtils/t/Installapi2.t
new file mode 100755
index 00000000000..c59b8abb389
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/Installapi2.t
@@ -0,0 +1,238 @@
+#!/usr/bin/perl -w
+
+# Test ExtUtils::Install.
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ @INC = ('../../lib', '../lib', 'lib');
+ }
+ else {
+ unshift @INC, 't/lib';
+ }
+}
+chdir 't';
+
+use strict;
+use TieOut;
+use File::Path;
+use File::Spec;
+
+use Test::More tests => 70;
+
+use MakeMaker::Test::Setup::BFD;
+
+BEGIN { use_ok('ExtUtils::Install') }
+
+# Check exports.
+foreach my $func (qw(install uninstall pm_to_blib install_default)) {
+ can_ok(__PACKAGE__, $func);
+}
+
+
+ok( setup_recurs(), 'setup' );
+END {
+ ok( chdir File::Spec->updir );
+ ok( teardown_recurs(), 'teardown' );
+}
+# ensure the env doesnt pollute our tests
+local $ENV{EU_INSTALL_ALWAYS_COPY};
+local $ENV{EU_ALWAYS_COPY};
+
+chdir 'Big-Dummy';
+
+my $stdout = tie *STDOUT, 'TieOut';
+pm_to_blib( { 'lib/Big/Dummy.pm' => 'blib/lib/Big/Dummy.pm' },
+ 'blib/lib/auto'
+ );
+END { rmtree 'blib' }
+
+ok( -d 'blib/lib', 'pm_to_blib created blib dir' );
+ok( -r 'blib/lib/Big/Dummy.pm', ' copied .pm file' );
+ok( -r 'blib/lib/auto', ' created autosplit dir' );
+is( $stdout->read, "cp lib/Big/Dummy.pm blib/lib/Big/Dummy.pm\n" );
+
+pm_to_blib( { 'lib/Big/Dummy.pm' => 'blib/lib/Big/Dummy.pm' },
+ 'blib/lib/auto'
+ );
+ok( -d 'blib/lib', 'second run, blib dir still there' );
+ok( -r 'blib/lib/Big/Dummy.pm', ' .pm file still there' );
+ok( -r 'blib/lib/auto', ' autosplit still there' );
+is( $stdout->read, "Skip blib/lib/Big/Dummy.pm (unchanged)\n" );
+
+install( [
+ from_to=>{ 'blib/lib' => 'install-test/lib/perl',
+ read => 'install-test/packlist',
+ write => 'install-test/packlist'
+ },
+ dry_run=>1]);
+ok( ! -d 'install-test/lib/perl', 'install made dir (dry run)');
+ok( ! -r 'install-test/lib/perl/Big/Dummy.pm',
+ ' .pm file installed (dry run)');
+ok( ! -r 'install-test/packlist', ' packlist exists (dry run)');
+
+install([ from_to=> { 'blib/lib' => 'install-test/lib/perl',
+ read => 'install-test/packlist',
+ write => 'install-test/packlist'
+ } ]);
+ok( -d 'install-test/lib/perl', 'install made dir' );
+ok( -r 'install-test/lib/perl/Big/Dummy.pm', ' .pm file installed' );
+ok(!-r 'install-test/lib/perl/Big/Dummy.SKIP', ' ignored .SKIP file' );
+ok( -r 'install-test/packlist', ' packlist exists' );
+
+open(PACKLIST, 'install-test/packlist' );
+my %packlist = map { chomp; ($_ => 1) } <PACKLIST>;
+close PACKLIST;
+
+# On case-insensitive filesystems (ie. VMS), the keys of the packlist might
+# be lowercase. :(
+my $native_dummy = File::Spec->catfile(qw(install-test lib perl Big Dummy.pm));
+is( keys %packlist, 1 );
+is( lc((keys %packlist)[0]), lc $native_dummy, 'packlist written' );
+
+
+# Test UNINST=1 preserving same versions in other dirs.
+install([from_to=> { 'blib/lib' => 'install-test/other_lib/perl',
+ read => 'install-test/packlist',
+ write => 'install-test/packlist'
+ },uninstall_shadows=>1]);
+ok( -d 'install-test/other_lib/perl', 'install made other dir' );
+ok( -r 'install-test/other_lib/perl/Big/Dummy.pm', ' .pm file installed' );
+ok( -r 'install-test/packlist', ' packlist exists' );
+ok( -r 'install-test/lib/perl/Big/Dummy.pm', ' UNINST=1 preserved same' );
+
+
+chmod 0644, 'blib/lib/Big/Dummy.pm' or die $!;
+open(DUMMY, ">>blib/lib/Big/Dummy.pm") or die $!;
+print DUMMY "Extra stuff\n";
+close DUMMY;
+
+
+# Test UNINST=0 does not remove other versions in other dirs.
+{
+ ok( -r 'install-test/lib/perl/Big/Dummy.pm', 'different install exists' );
+
+ local @INC = ('install-test/lib/perl');
+ local $ENV{PERL5LIB} = '';
+ install([from_to=> { 'blib/lib' => 'install-test/other_lib/perl',
+ read => 'install-test/packlist',
+ write => 'install-test/packlist'
+ }]);
+ ok( -d 'install-test/other_lib/perl', 'install made other dir' );
+ ok( -r 'install-test/other_lib/perl/Big/Dummy.pm', ' .pm file installed' );
+ ok( -r 'install-test/packlist', ' packlist exists' );
+ ok( -r 'install-test/lib/perl/Big/Dummy.pm',
+ ' UNINST=0 left different' );
+}
+
+# Test UNINST=1 only warning when failing to remove an irrelevent shadow file
+{
+ my $tfile='install-test/lib/perl/Big/Dummy.pm';
+ local $ExtUtils::Install::Testing = $tfile;
+ local @INC = ('install-test/other_lib/perl','install-test/lib/perl');
+ local $ENV{PERL5LIB} = '';
+ ok( -r $tfile, 'different install exists' );
+ my @warn;
+ local $SIG{__WARN__}=sub { push @warn, @_; return };
+ my $ok=eval {
+ install([from_to=> { 'blib/lib' => 'install-test/other_lib/perl',
+ read => 'install-test/packlist',
+ write => 'install-test/packlist'
+ },
+ uninstall_shadows=>1]);
+ 1
+ };
+ ok($ok,' we didnt die');
+ ok(0+@warn," we did warn");
+ ok( -d 'install-test/other_lib/perl', 'install made other dir' );
+ ok( -r 'install-test/other_lib/perl/Big/Dummy.pm', ' .pm file installed' );
+ ok( -r 'install-test/packlist', ' packlist exists' );
+ ok( -r $tfile, ' UNINST=1 failed to remove different' );
+
+}
+
+# Test UNINST=1 dieing when failing to remove an relevent shadow file
+{
+ my $tfile='install-test/lib/perl/Big/Dummy.pm';
+ local $ExtUtils::Install::Testing = $tfile;
+ local @INC = ('install-test/lib/perl','install-test/other_lib/perl');
+ local $ENV{PERL5LIB} = '';
+ ok( -r $tfile, 'different install exists' );
+ my @warn;
+ local $SIG{__WARN__}=sub { push @warn,@_; return };
+ my $ok=eval {
+ install([from_to=> { 'blib/lib' => 'install-test/other_lib/perl',
+ read => 'install-test/packlist',
+ write => 'install-test/packlist'
+ },uninstall_shadows=>1]);
+ 1
+ };
+ ok(!$ok,' we did die');
+ ok(!@warn," we didnt warn");
+ ok( -d 'install-test/other_lib/perl', 'install made other dir' );
+ ok( -r 'install-test/other_lib/perl/Big/Dummy.pm', ' .pm file installed' );
+ ok( -r 'install-test/packlist', ' packlist exists' );
+ ok( -r $tfile,' UNINST=1 failed to remove different' );
+}
+
+# Test UNINST=1 removing other versions in other dirs.
+{
+ local @INC = ('install-test/lib/perl');
+ local $ENV{PERL5LIB} = '';
+ ok( -r 'install-test/lib/perl/Big/Dummy.pm','different install exists' );
+ install([from_to=>{ 'blib/lib' => 'install-test/other_lib/perl',
+ read => 'install-test/packlist',
+ write => 'install-test/packlist'
+ },uninstall_shadows=>1]);
+ ok( -d 'install-test/other_lib/perl', 'install made other dir' );
+ ok( -r 'install-test/other_lib/perl/Big/Dummy.pm', ' .pm file installed' );
+ ok( -r 'install-test/packlist', ' packlist exists' );
+ ok( !-r 'install-test/lib/perl/Big/Dummy.pm',
+ ' UNINST=1 removed different' );
+}
+
+# Test EU_ALWAYS_COPY triggers copy.
+{
+ local @INC = ('install-test/lib/perl');
+ local $ENV{PERL5LIB} = '';
+ local $ENV{EU_INSTALL_ALWAYS_COPY}=1;
+ my $tfile='install-test/other_lib/perl/Big/Dummy.pm';
+ my $sfile='blib/lib/Big/Dummy.pm';
+ ok(-r $tfile,"install file already exists");
+ ok(-r $sfile,"source file already exists");
+ utime time-600, time-600, $sfile or die "utime '$sfile' failed:$!";
+ ok( (stat $tfile)[9]!=(stat $sfile)[9],' Times are different');
+ install([from_to=>{ 'blib/lib' => 'install-test/other_lib/perl',
+ read => 'install-test/packlist',
+ write => 'install-test/packlist'
+ },result=>\my %result]);
+ ok( -d 'install-test/other_lib/perl', 'install made other dir' );
+ ok( -r 'install-test/other_lib/perl/Big/Dummy.pm', ' .pm file installed' );
+ ok( -r 'install-test/packlist', ' packlist exists' );
+SKIP: {
+ skip "Times not preserved during copy by default", 1 if $^O eq 'VMS';
+ ok( (stat $tfile)[9]==(stat $sfile)[9],' Times are same');
+}
+ ok( !$result{install_unchanged},' $result{install_unchanged} should be empty');
+}
+# Test nothing is copied.
+{
+ local @INC = ('install-test/lib/perl');
+ local $ENV{PERL5LIB} = '';
+ local $ENV{EU_INSTALL_ALWAYS_COPY}=0;
+ my $tfile='install-test/other_lib/perl/Big/Dummy.pm';
+ my $sfile='blib/lib/Big/Dummy.pm';
+ ok(-r $tfile,"install file already exists");
+ ok(-r $sfile,"source file already exists");
+ utime time-1200, time-1200, $sfile or die "utime '$sfile' failed:$!";
+ ok( (stat $tfile)[9]!=(stat $sfile)[9],' Times are different');
+ install([from_to=>{ 'blib/lib' => 'install-test/other_lib/perl',
+ read => 'install-test/packlist',
+ write => 'install-test/packlist'
+ },result=>\my %result]);
+ ok( -d 'install-test/other_lib/perl', 'install made other dir' );
+ ok( -r 'install-test/other_lib/perl/Big/Dummy.pm', ' .pm file installed' );
+ ok( -r 'install-test/packlist', ' packlist exists' );
+ ok( (stat $tfile)[9]!=(stat$sfile)[9],' Times are different');
+ ok( !$result{install},' nothing should have been installed');
+ ok( $result{install_unchanged},' install_unchanged should be populated');
+}
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/Installed.t b/gnu/usr.bin/perl/lib/ExtUtils/t/Installed.t
index f820ef49c61..dd492c2d1d9 100644
--- a/gnu/usr.bin/perl/lib/ExtUtils/t/Installed.t
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/Installed.t
@@ -45,7 +45,7 @@ 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'};
+ my $dir = File::Spec->canonpath($Config{$path.'exp'});
skip("no man directory $path on this system", 2 ) unless $dir;
my $file = $dir . '/foo';
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/MM_BeOS.t b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_BeOS.t
index 6587ced6e5e..bb9583d51b8 100644
--- a/gnu/usr.bin/perl/lib/ExtUtils/t/MM_BeOS.t
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_BeOS.t
@@ -14,7 +14,7 @@ chdir 't';
use Test::More;
BEGIN {
- if ($^O =~ /beos/i) {
+ if ($^O =~ /beos/i or $^O eq 'haiku') {
plan tests => 4;
} else {
plan skip_all => 'This is not BeOS';
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Cygwin.t b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Cygwin.t
index 266c4659400..d952188c442 100644
--- a/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Cygwin.t
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Cygwin.t
@@ -16,7 +16,7 @@ use Test::More;
BEGIN {
if ($^O =~ /cygwin/i) {
- plan tests => 11;
+ plan tests => 14;
} else {
plan skip_all => "This is not cygwin";
}
@@ -25,6 +25,7 @@ BEGIN {
use Config;
use File::Spec;
use ExtUtils::MM;
+use Config;
use_ok( 'ExtUtils::MM_Cygwin' );
@@ -97,6 +98,30 @@ like( $res, qr/pure_all.*foo.*foo.1/s, '... should add MAN3PODS targets' );
is( $MM->{EXPORT_LIST}, $export, 'EXPORT_LIST' );
}
+# Tests for correct handling of maybe_command in /cygdrive/*
+# and c:/*. $ENV{COMSPEC}, if it exists, should always be executable.
+SKIP: {
+ skip "Needs Cygwin::win_to_posix_path()", 2 unless defined &Cygwin::win_to_posix_path;
+
+ SKIP: {
+ my $comspec = $ENV{COMSPEC};
+ skip(q[$ENV{COMSPEC} does not exist], 1) unless $comspec;
+
+ $comspec = Cygwin::win_to_posix_path($comspec);
+
+ ok(MM->maybe_command($comspec), qq{'$comspec' should be executable"});
+ }
+
+ # 'C:/' should *never* be executable, it's a directory.
+ {
+ my $cdrive = Cygwin::win_to_posix_path("C:/");
+
+ ok(!MM->maybe_command($cdrive), qq{'$cdrive' should never be executable});
+ }
+}
+
+# Our copy of Perl (with a unix-path) should always be executable.
+ok(MM->maybe_command($Config{perlpath}), qq{'$Config{perlpath}' should be executable});
package FakeOut;
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Unix.t b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Unix.t
index ffcfd295de3..ed23d60bdfd 100644
--- a/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Unix.t
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Unix.t
@@ -18,7 +18,7 @@ BEGIN {
plan skip_all => 'Non-Unix platform';
}
else {
- plan tests => 109;
+ plan tests => 110;
}
}
@@ -31,21 +31,20 @@ 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_Win32 || 0)
- + ($ExtUtils::MM_Unix::Is_Dos || 0)
- + ($ExtUtils::MM_Unix::Is_VMS || 0);
-ok ( $os <= 1, 'There can be only one (or none)');
+my $os = ($ExtUtils::MM_Unix::Is{OS2} || 0)
+ + ($ExtUtils::MM_Unix::Is{Win32} || 0)
+ + ($ExtUtils::MM_Unix::Is{Dos} || 0)
+ + ($ExtUtils::MM_Unix::Is{VMS} || 0);
+cmp_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');
+is($ExtUtils::MM_Unix::VERSION, $ExtUtils::MakeMaker::VERSION, 'MM_Unix has a $VERSION');
# 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 $_");
- }
+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');
@@ -171,9 +170,14 @@ is ($t->libscan('Fatty'), 'Fatty', 'libscan on something not a VC file' );
# maybe_command
open(FILE, ">command"); print FILE "foo"; close FILE;
-ok (!$t->maybe_command('command') ,"non executable file isn't a command");
-chmod 0755, "command";
-ok ($t->maybe_command('command'), "executable file is a command");
+SKIP: {
+ skip("no separate execute mode on VOS", 2) if $^O eq "vos";
+
+ ok !$t->maybe_command('command') ,"non executable file isn't a command";
+
+ chmod 0755, "command";
+ ok ($t->maybe_command('command'), "executable file is a command");
+}
unlink "command";
@@ -185,19 +189,20 @@ my $self_name = $ENV{PERL_CORE} ? '../lib/ExtUtils/t/MM_Unix.t'
is ($t->perl_script($self_name),$self_name, 'we pass as a perl_script()');
###############################################################################
-# perm_rw perm_rwx
+# PERM_RW and PERM_RWX
$t->init_PERM;
-is ($t->perm_rw(),'644', 'perm_rw() is 644');
-is ($t->perm_rwx(),'755', 'perm_rwx() is 755');
+is ($t->{PERM_RW},'644', 'PERM_RW is 644');
+is ($t->{PERM_RWX},'755', 'PERM_RWX is 755');
+is ($t->{PERM_DIR},'755', 'PERM_DIR is 755');
+
###############################################################################
# post_constants, postamble, post_initialize
-foreach (qw/ post_constants postamble post_initialize/)
- {
+foreach (qw/ post_constants postamble post_initialize/) {
is ($t->$_(),'', "$_() is an empty string");
- }
+}
###############################################################################
# replace_manpage_separator
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Win32.t b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Win32.t
index 866c135bc56..c779da2c4e9 100644
--- a/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Win32.t
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Win32.t
@@ -16,7 +16,7 @@ use Test::More;
BEGIN {
if ($^O =~ /MSWin32/i) {
- plan tests => 41;
+ plan tests => 49;
} else {
plan skip_all => 'This is not Win32';
}
@@ -234,6 +234,37 @@ EOSCRIPT
}
unlink "${script_name}$script_ext" if -f "${script_name}$script_ext";
+# is_make_type()
+{
+ # Check for literal nmake
+ SKIP: {
+ skip("Not using 'nmake'", 2) unless $Config{make} eq 'nmake';
+ ok( $MM->is_make_type('nmake'), '->is_make_type(nmake) true' );
+ ok( ! $MM->is_make_type('dmake'), '->is_make_type(dmake) false' );
+ }
+
+ # Check for literal nmake
+ SKIP: {
+ skip("Not using /nmake/", 2) unless $Config{make} =~ /nmake/;
+ ok( $MM->is_make_type('nmake'), '->is_make_type(nmake) true' );
+ ok( ! $MM->is_make_type('dmake'), '->is_make_type(dmake) false' );
+ }
+
+ # Check for literal dmake
+ SKIP: {
+ skip("Not using 'dmake'", 2) unless $Config{make} eq 'dmake';
+ ok( $MM->is_make_type('dmake'), '->is_make_type(dmake) true' );
+ ok( ! $MM->is_make_type('nmake'), '->is_make_type(nmake) false' );
+ }
+
+ # Check for literal dmake
+ SKIP: {
+ skip("Not using /dmake/", 2) unless $Config{make} =~ /dmake/;
+ ok( $MM->is_make_type('dmake'), '->is_make_type(dmake) true' );
+ ok( ! $MM->is_make_type('nmake'), '->is_make_type(nmake) false' );
+ }
+
+}
# xs_o() should look into that
# top_targets() should look into that
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/MakeMaker_Parameters.t b/gnu/usr.bin/perl/lib/ExtUtils/t/MakeMaker_Parameters.t
new file mode 100755
index 00000000000..3518d584653
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/MakeMaker_Parameters.t
@@ -0,0 +1,74 @@
+#!/usr/bin/perl -w
+
+# Things like the CPAN shell rely on the "MakeMaker Parameters" section of the
+# Makefile to learn a module's dependencies so we'd damn well better test it.
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't' if -d 't';
+ @INC = ('../lib', 'lib');
+ }
+ else {
+ unshift @INC, 't/lib';
+ }
+}
+
+use strict;
+use warnings;
+
+use ExtUtils::MakeMaker;
+use Test::More;
+
+my $mm = bless {}, "MM";
+
+sub extract_params {
+ my $text = join "\n", @_;
+
+ $text =~ s{^\s* \# \s+ MakeMaker\ Parameters: \s*\n}{}x;
+ $text =~ s{^#}{}gms;
+ $text =~ s{\n}{,\n}g;
+
+ no strict 'subs';
+ return { eval "$text" };
+}
+
+sub test_round_trip {
+ my $args = shift;
+ my $want = @_ ? shift : $args;
+
+ my $have = extract_params($mm->_MakeMaker_Parameters_section($args));
+
+ local $Test::Builder::Level = $Test::Builder::Level + 1;
+ is_deeply $have, $want or diag explain $have, "\n", $want;
+}
+
+is join("", $mm->_MakeMaker_Parameters_section()), <<'EXPECT', "nothing";
+# MakeMaker Parameters:
+EXPECT
+
+test_round_trip({ NAME => "Foo" });
+test_round_trip({ NAME => "Foo", PREREQ_PM => { "Foo::Bar" => 0 } });
+test_round_trip({ NAME => "Foo", PREREQ_PM => { "Foo::Bar" => 1.23 } });
+
+# Test the special case for BUILD_REQUIRES
+{
+ my $have = {
+ NAME => "Foo",
+ PREREQ_PM => { "Foo::Bar" => 1.23 },
+ BUILD_REQUIRES => { "Baz" => 0.12 },
+ };
+
+ my $want = {
+ NAME => "Foo",
+ PREREQ_PM => {
+ "Foo::Bar" => 1.23,
+ "Baz" => 0.12,
+ },
+ BUILD_REQUIRES => { "Baz" => 0.12 },
+ };
+
+ test_round_trip( $have, $want );
+}
+
+done_testing();
+
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/Manifest.t b/gnu/usr.bin/perl/lib/ExtUtils/t/Manifest.t
index e8732ad9fc1..3aca61dfbf2 100644
--- a/gnu/usr.bin/perl/lib/ExtUtils/t/Manifest.t
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/Manifest.t
@@ -13,7 +13,7 @@ chdir 't';
use strict;
-use Test::More tests => 66;
+use Test::More tests => 94;
use Cwd;
use File::Spec;
@@ -22,6 +22,18 @@ use File::Find;
use Config;
my $Is_VMS = $^O eq 'VMS';
+my $Is_VMS_noefs = $Is_VMS;
+if ($Is_VMS) {
+ my $vms_efs = 0;
+ if (eval 'require VMS::Feature') {
+ $vms_efs = VMS::Feature::current("efs_charset");
+ } else {
+ my $efs_charset = $ENV{'DECC$EFS_CHARSET'} || '';
+ $vms_efs = $efs_charset =~ /^[ET1]/i;
+ }
+ $Is_VMS_noefs = 0 if $vms_efs;
+}
+
# We're going to be chdir'ing and modules are sometimes loaded on the
# fly in this test, so we need an absolute @INC.
@@ -33,10 +45,11 @@ sub add_file {
my ($file, $data) = @_;
$data ||= 'foo';
1 while unlink $file; # or else we'll get multiple versions on VMS
- open( T, '>'.$file) or return;
+ open( T, '> '.$file) or return;
print T $data;
- ++$Files{$file};
close T;
+ return 0 unless -e $file; # exists under the name we gave it ?
+ ++$Files{$file};
}
sub read_manifest {
@@ -60,7 +73,7 @@ sub remove_dir {
BEGIN {
use_ok( 'ExtUtils::Manifest',
qw( mkmanifest manicheck filecheck fullcheck
- maniread manicopy skipcheck maniadd) );
+ maniread manicopy skipcheck maniadd maniskip) );
}
my $cwd = Cwd::getcwd();
@@ -173,12 +186,12 @@ $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
+# the copy should have given a warning
+like($warn, qr/^none not found/, 'carped about none' );
+($res, $warn) = catch_warning( \&skipcheck );
like($warn, qr/^Skipping MANIFEST.SKIP/i, 'warned about MANIFEST.SKIP' );
# tell ExtUtils::Manifest to use a different file
@@ -218,13 +231,67 @@ is( $files->{wibble}, '', 'maniadd() with undef comment' );
is( $files->{yarrow}, 'hock',' with comment' );
is( $files->{foobar}, '', ' preserved old entries' );
+my %funky_files;
+# test including a filename with a space
+SKIP: {
+ add_file( 'foo bar' => "space" )
+ or skip "couldn't create spaced test file", 2;
+ local $ExtUtils::Manifest::MANIFEST = "albatross";
+ maniadd({ 'foo bar' => "contains space"});
+ is( maniread()->{'foo bar'}, "contains space",
+ 'spaced manifest filename' );
+ add_file( 'albatross.bak', '' );
+ ($res, $warn) = catch_warning( \&mkmanifest );
+ like( $warn, qr/\A(Added to.*\n)+\z/m,
+ 'no warnings about funky filename' );
+ $funky_files{'space'} = 'foo bar';
+}
+
+# test including a filename with a space and a quote
+SKIP: {
+ add_file( 'foo\' baz\'quux' => "quote" )
+ or skip "couldn't create quoted test file", 1;
+ local $ExtUtils::Manifest::MANIFEST = "albatross";
+ maniadd({ 'foo\' baz\'quux' => "contains quote"});
+ is( maniread()->{'foo\' baz\'quux'}, "contains quote",
+ 'quoted manifest filename' );
+ $funky_files{'space_quote'} = 'foo\' baz\'quux';
+}
+
+# test including a filename with a space and a backslash
+SKIP: {
+ add_file( 'foo bar\\baz' => "backslash" )
+ or skip "couldn't create backslash test file", 1;
+ local $ExtUtils::Manifest::MANIFEST = "albatross";
+ maniadd({ 'foo bar\\baz' => "contains backslash"});
+ is( maniread()->{'foo bar\\baz'}, "contains backslash",
+ 'backslashed manifest filename' );
+ $funky_files{'space_backslash'} = 'foo bar\\baz';
+}
+
+# test including a filename with a space, quote, and a backslash
+SKIP: {
+ add_file( 'foo bar\\baz\'quux' => "backslash/quote" )
+ or skip "couldn't create backslash/quote test file", 1;
+ local $ExtUtils::Manifest::MANIFEST = "albatross";
+ maniadd({ 'foo bar\\baz\'quux' => "backslash and quote"});
+ is( maniread()->{'foo bar\\baz\'quux'}, "backslash and quote",
+ 'backslashed and quoted manifest filename' );
+ $funky_files{'space_quote_backslash'} = 'foo bar\\baz\'quux';
+}
+
+my @funky_keys = qw(space space_quote space_backslash space_quote_backslash);
# test including an external manifest.skip file in MANIFEST.SKIP
{
maniadd({ foo => undef , albatross => undef,
'mymanifest.skip' => undef, 'mydefault.skip' => undef});
+ for (@funky_keys) {
+ maniadd( {$funky_files{$_} => $_} ) if defined $funky_files{$_};
+ }
+
add_file('mymanifest.skip' => "^foo\n");
add_file('mydefault.skip' => "^my\n");
- $ExtUtils::Manifest::DEFAULT_MSKIP =
+ local $ExtUtils::Manifest::DEFAULT_MSKIP =
File::Spec->catfile($cwd, qw(mantest mydefault.skip));
my $skip = File::Spec->catfile($cwd, qw(mantest mymanifest.skip));
add_file('MANIFEST.SKIP' =>
@@ -234,11 +301,27 @@ is( $files->{foobar}, '', ' preserved old entries' );
like( $warn, qr/Skipping \b$_\b/,
"Skipping $_" );
}
+ for my $funky_key (@funky_keys) {
+ SKIP: {
+ my $funky_file = $funky_files{$funky_key};
+ skip "'$funky_key' not created", 1 unless $funky_file;
+ like( $warn, qr/Skipping \b\Q$funky_file\E\b/,
+ "Skipping $funky_file");
+ }
+ }
($res, $warn) = catch_warning( \&mkmanifest );
for (qw(albatross foo foobar mymanifest.skip mydefault.skip)) {
like( $warn, qr/Removed from MANIFEST: \b$_\b/,
"Removed $_ from MANIFEST" );
}
+ for my $funky_key (@funky_keys) {
+ SKIP: {
+ my $funky_file = $funky_files{$funky_key};
+ skip "'$funky_key' not created", 1 unless $funky_file;
+ like( $warn, qr/Removed from MANIFEST: \b\Q$funky_file\E\b/,
+ "Removed $funky_file from MANIFEST");
+ }
+ }
my $files = maniread;
ok( ! exists $files->{albatross}, 'albatross excluded via MANIFEST.SKIP' );
ok( exists $files->{yarrow}, 'yarrow included in MANIFEST' );
@@ -249,7 +332,45 @@ is( $files->{foobar}, '', ' preserved old entries' );
'mymanifest.skip excluded via mydefault.skip' );
ok( ! exists $files->{'mydefault.skip'},
'mydefault.skip excluded via mydefault.skip' );
- my $extsep = $Is_VMS ? '_' : '.';
+
+ # test exclusion of funky files
+ for my $funky_key (@funky_keys) {
+ SKIP: {
+ my $funky_file = $funky_files{$funky_key};
+ skip "'$funky_key' not created", 1 unless $funky_file;
+ ok( ! exists $files->{$funky_file},
+ "'$funky_file' excluded via mymanifest.skip" );
+ }
+ }
+
+ # tests for maniskip
+ my $skipchk = maniskip();
+ is ( $skipchk->('albatross'), 1,
+ 'albatross excluded via MANIFEST.SKIP' );
+ is( $skipchk->('yarrow'), '',
+ 'yarrow included in MANIFEST' );
+ is( $skipchk->('bar'), '',
+ 'bar included in MANIFEST' );
+ $skipchk = maniskip('mymanifest.skip');
+ is( $skipchk->('foobar'), 1,
+ 'foobar excluded via mymanifest.skip' );
+ is( $skipchk->('foo'), 1,
+ 'foo excluded via mymanifest.skip' );
+ is( $skipchk->('mymanifest.skip'), '',
+ 'mymanifest.skip included via mydefault.skip' );
+ is( $skipchk->('mydefault.skip'), '',
+ 'mydefault.skip included via mydefault.skip' );
+ $skipchk = maniskip('mydefault.skip');
+ is( $skipchk->('foobar'), '',
+ 'foobar included via mydefault.skip' );
+ is( $skipchk->('foo'), '',
+ 'foo included via mydefault.skip' );
+ is( $skipchk->('mymanifest.skip'), 1,
+ 'mymanifest.skip excluded via mydefault.skip' );
+ is( $skipchk->('mydefault.skip'), 1,
+ 'mydefault.skip excluded via mydefault.skip' );
+
+ my $extsep = $Is_VMS_noefs ? '_' : '.';
$Files{"$_.bak"}++ for ('MANIFEST', "MANIFEST${extsep}SKIP");
}
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/arch_check.t b/gnu/usr.bin/perl/lib/ExtUtils/t/arch_check.t
new file mode 100755
index 00000000000..deb289a1ad3
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/arch_check.t
@@ -0,0 +1,89 @@
+#!/usr/bin/perl -w
+
+BEGIN {
+ if ($ENV{PERL_CORE}) {
+ chdir 't' if -d 't';
+ @INC = qw(../lib lib);
+ }
+}
+
+use strict;
+use lib 't/lib';
+
+use TieOut;
+use Test::More 'no_plan';
+
+use Config;
+use ExtUtils::MakeMaker;
+
+ok( my $stdout = tie *STDOUT, 'TieOut' );
+
+# Create a normalized MM object to test with
+my $mm = bless {}, "MM";
+$mm->{PERL_SRC} = 0;
+$mm->{UNINSTALLED_PERL} = 0;
+
+my $rel2abs = sub { $mm->rel2abs($mm->catfile(@_)) };
+
+ok $mm->arch_check(
+ $rel2abs->(qw(. t testdata reallylongdirectoryname arch1 Config.pm)),
+ $rel2abs->(qw(. t testdata reallylongdirectoryname arch1 Config.pm)),
+);
+
+
+# Different architecures.
+{
+ ok !$mm->arch_check(
+ $rel2abs->(qw(. t testdata reallylongdirectoryname arch1 Config.pm)),
+ $rel2abs->(qw(. t testdata reallylongdirectoryname arch2 Config.pm)),
+ );
+
+ like $stdout->read, qr{\Q
+Your perl and your Config.pm seem to have different ideas about the
+architecture they are running on.
+Perl thinks: [arch1]
+Config says: [$Config{archname}]
+This may or may not cause problems. Please check your installation of perl
+if you have problems building this extension.
+};
+
+}
+
+
+# Different file path separators [rt.cpan.org 46416]
+SKIP: {
+ require File::Spec;
+ skip "Win32 test", 1 unless File::Spec->isa("File::Spec::Win32");
+
+ ok $mm->arch_check(
+ "/_64/perl1004/lib/Config.pm",
+ '\\_64\\perl1004\\lib\\Config.pm',
+ );
+}
+
+
+# PERL_SRC is set, no check is done
+{
+ # Clear our log
+ $stdout->read;
+
+ local $mm->{PERL_SRC} = 1;
+ ok $mm->arch_check(
+ $rel2abs->(qw(. t testdata reallylongdirectoryname arch1 Config.pm)),
+ $rel2abs->(qw(. t testdata reallylongdirectoryname arch2 Config.pm)),
+ );
+
+ is $stdout->read, '';
+}
+
+
+# UNINSTALLED_PERL is set, no message is sent
+{
+ local $mm->{UNINSTALLED_PERL} = 1;
+ ok !$mm->arch_check(
+ $rel2abs->(qw(. t testdata reallylongdirectoryname arch1 Config.pm)),
+ $rel2abs->(qw(. t testdata reallylongdirectoryname arch2 Config.pm)),
+ );
+
+ like $stdout->read, qr{^Have .*\nWant .*$};
+}
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/basic.t b/gnu/usr.bin/perl/lib/ExtUtils/t/basic.t
index 64352d85cbd..67d39f578d3 100644
--- a/gnu/usr.bin/perl/lib/ExtUtils/t/basic.t
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/basic.t
@@ -17,23 +17,16 @@ use strict;
use Config;
use ExtUtils::MakeMaker;
-use Test::More tests => 83;
+use Test::More tests => 79;
use MakeMaker::Test::Utils;
use MakeMaker::Test::Setup::BFD;
use File::Find;
use File::Spec;
use File::Path;
-# 'make disttest' sets a bunch of environment variables which interfere
-# with our testing.
-delete @ENV{qw(PREFIX LIB MAKEFLAGS)};
-
my $perl = which_perl();
my $Is_VMS = $^O eq 'VMS';
-# GNV logical interferes with testing
-$ENV{'bin'} = '[.bin]' if $Is_VMS;
-
chdir 't';
perl_lib;
@@ -93,21 +86,21 @@ ok( open(PPD, 'Big-Dummy.ppd'), ' .ppd file generated' );
my $ppd_html;
{ local $/; $ppd_html = <PPD> }
close PPD;
-like( $ppd_html, qr{^<SOFTPKG NAME="Big-Dummy" VERSION="0,01,0,0">}m,
+like( $ppd_html, qr{^<SOFTPKG NAME="Big-Dummy" VERSION="0.01">}m,
' <SOFTPKG>' );
-like( $ppd_html, qr{^\s*<TITLE>Big-Dummy</TITLE>}m, ' <TITLE>' );
like( $ppd_html, qr{^\s*<ABSTRACT>Try "our" hot dog's</ABSTRACT>}m,
' <ABSTRACT>');
like( $ppd_html,
qr{^\s*<AUTHOR>Michael G Schwern &lt;schwern\@pobox.com&gt;</AUTHOR>}m,
' <AUTHOR>' );
like( $ppd_html, qr{^\s*<IMPLEMENTATION>}m, ' <IMPLEMENTATION>');
-like( $ppd_html, qr{^\s*<DEPENDENCY NAME="strict" VERSION="0,0,0,0" />}m,
- ' <DEPENDENCY>' );
-like( $ppd_html, qr{^\s*<OS NAME="$Config{osname}" />}m,
- ' <OS>' );
+like( $ppd_html, qr{^\s*<REQUIRE NAME="strict::" />}m, ' <REQUIRE>' );
+
my $archname = $Config{archname};
-$archname .= "-". substr($Config{version},0,3) if $] >= 5.008;
+if( $] >= 5.008 ) {
+ # XXX This is a copy of the internal logic, so it's not a great test
+ $archname .= "-$Config{PERL_REVISION}.$Config{PERL_VERSION}";
+}
like( $ppd_html, qr{^\s*<ARCHITECTURE NAME="$archname" />}m,
' <ARCHITECTURE>');
like( $ppd_html, qr{^\s*<CODEBASE HREF="" />}m, ' <CODEBASE>');
@@ -133,7 +126,6 @@ is( $?, 0, ' exited normally' ) ||
my $install_out = run("$make install");
is( $?, 0, 'install' ) || diag $install_out;
like( $install_out, qr/^Installing /m );
-like( $install_out, qr/^Writing /m );
ok( -r '../dummy-install', ' install dir created' );
my %files = ();
@@ -154,12 +146,11 @@ ok( $files{'perllocal.pod'},' perllocal.pod created' );
SKIP: {
- skip 'VMS install targets do not preserve $(PREFIX)', 9 if $Is_VMS;
+ skip 'VMS install targets do not preserve $(PREFIX)', 8 if $Is_VMS;
$install_out = run("$make install PREFIX=elsewhere");
is( $?, 0, 'install with PREFIX override' ) || diag $install_out;
like( $install_out, qr/^Installing /m );
- like( $install_out, qr/^Writing /m );
ok( -r 'elsewhere', ' install dir created' );
%files = ();
@@ -174,13 +165,12 @@ SKIP: {
SKIP: {
- skip 'VMS install targets do not preserve $(DESTDIR)', 11 if $Is_VMS;
+ skip 'VMS install targets do not preserve $(DESTDIR)', 10 if $Is_VMS;
$install_out = run("$make install PREFIX= DESTDIR=other");
is( $?, 0, 'install with DESTDIR' ) ||
diag $install_out;
like( $install_out, qr/^Installing /m );
- like( $install_out, qr/^Writing /m );
ok( -d 'other', ' destdir created' );
%files = ();
@@ -215,13 +205,12 @@ SKIP: {
SKIP: {
- skip 'VMS install targets do not preserve $(PREFIX)', 10 if $Is_VMS;
+ skip 'VMS install targets do not preserve $(PREFIX)', 9 if $Is_VMS;
$install_out = run("$make install PREFIX=elsewhere DESTDIR=other/");
is( $?, 0, 'install with PREFIX override and DESTDIR' ) ||
diag $install_out;
like( $install_out, qr/^Installing /m );
- like( $install_out, qr/^Writing /m );
ok( !-d 'elsewhere', ' install dir not created' );
ok( -d 'other/elsewhere', ' destdir created' );
@@ -250,25 +239,42 @@ ok( !-f 'META.yml', 'META.yml not written to source dir' );
ok( -f $meta_yml, 'META.yml written to dist dir' );
ok( !-e "META_new.yml", 'temp META.yml file not left around' );
+SKIP: {
+ # META.yml spec 1.4 was added in 0.11
+ skip "Test::YAML::Meta >= 0.11 required", 2
+ unless eval { require Test::YAML::Meta } and
+ Test::YAML::Meta->VERSION >= 0.11;
+
+ Test::YAML::Meta::meta_spec_ok($meta_yml);
+}
+
ok open META, $meta_yml or diag $!;
my $meta = join '', <META>;
ok close META;
is $meta, <<"END";
--- #YAML:1.0
-name: Big-Dummy
-version: 0.01
-abstract: Try "our" hot dog's
-license: ~
-author:
+name: Big-Dummy
+version: 0.01
+abstract: Try "our" hot dog's
+author:
- Michael G Schwern <schwern\@pobox.com>
-generated_by: ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION
-distribution_type: module
-requires:
- strict: 0
+license: unknown
+distribution_type: module
+configure_requires:
+ ExtUtils::MakeMaker: 0
+build_requires:
+ ExtUtils::MakeMaker: 0
+requires:
+ strict: 0
+no_index:
+ directory:
+ - t
+ - inc
+generated_by: ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION
meta-spec:
- url: http://module-build.sourceforge.net/META-spec-v1.3.html
- version: 1.3
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: 1.4
END
my $manifest = maniread("$distdir/MANIFEST");
@@ -300,7 +306,7 @@ ok( grep(/^Writing $makefile for Big::Dummy/, @mpl_out) == 1,
# 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 $!;
+open(STDERR, ">",File::Spec->devnull) or die $!;
my $realclean_out = run("$make realclean");
is( $?, 0, 'realclean' ) || diag($realclean_out);
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/build_man.t b/gnu/usr.bin/perl/lib/ExtUtils/t/build_man.t
index 4a544fbb53d..9732c3806f2 100644
--- a/gnu/usr.bin/perl/lib/ExtUtils/t/build_man.t
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/build_man.t
@@ -60,7 +60,7 @@ ok( my $stdout = tie *STDOUT, 'TieOut' );
INSTALLMAN3DIR => 'none'
);
- ok( !keys %{ $mm->{MAN3PODS} } );
+ is_deeply( $mm->{MAN3PODS}, {} );
}
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/can_write_dir.t b/gnu/usr.bin/perl/lib/ExtUtils/t/can_write_dir.t
new file mode 100755
index 00000000000..be6fb1896db
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/can_write_dir.t
@@ -0,0 +1,61 @@
+#!/usr/bin/perl -w
+
+# Test the private _can_write_dir() function.
+
+use strict;
+use ExtUtils::Install;
+use File::Spec;
+{ package FS; our @ISA = qw(File::Spec); }
+
+# Alias it for easier access
+*can_write_dir = \&ExtUtils::Install::_can_write_dir;
+
+use Test::More 'no_plan';
+
+
+my $dne = FS->catdir(qw(does not exist));
+ok ! -e $dne;
+is_deeply [can_write_dir($dne)],
+ [1,
+ FS->curdir,
+ FS->catdir('does'),
+ FS->catdir('does', 'not'),
+ FS->catdir('does', 'not', 'exist')
+ ];
+
+
+my $abs_dne = FS->rel2abs($dne);
+ok ! -e $abs_dne;
+is_deeply [can_write_dir($abs_dne)],
+ [1,
+ FS->rel2abs(FS->curdir),
+ FS->rel2abs(FS->catdir('does')),
+ FS->rel2abs(FS->catdir('does', 'not')),
+ FS->rel2abs(FS->catdir('does', 'not', 'exist')),
+ ];
+
+SKIP: {
+ my $exists = FS->catdir(qw(exists));
+ my $subdir = FS->catdir(qw(exists subdir));
+
+
+ ok mkdir $exists;
+ END { rmdir $exists }
+
+ ok chmod 0555, $exists, 'make read only';
+
+ skip "Current user or OS cannot create directories that they cannot read", 6
+ if -w $exists; # these tests require a directory we cant read
+
+ is_deeply [can_write_dir($exists)], [0, $exists];
+ is_deeply [can_write_dir($subdir)], [0, $exists, $subdir];
+
+ ok chmod 0777, $exists, 'make writable';
+ ok -w $exists;
+ is_deeply [can_write_dir($exists)], [1, $exists];
+ is_deeply [can_write_dir($subdir)],
+ [1,
+ $exists,
+ $subdir
+ ];
+} \ No newline at end of file
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/cd.t b/gnu/usr.bin/perl/lib/ExtUtils/t/cd.t
index 9d62d139e7c..dfd3ce44e4a 100644
--- a/gnu/usr.bin/perl/lib/ExtUtils/t/cd.t
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/cd.t
@@ -17,7 +17,8 @@ use File::Spec;
use Test::More tests => 4;
-my @cd_args = ("some/dir", "command1", "command2");
+my $dir = File::Spec->catdir("some", "dir");
+my @cd_args = ($dir, "command1", "command2");
{
package Test::MM_Win32;
@@ -33,7 +34,7 @@ my @cd_args = ("some/dir", "command1", "command2");
my $expected_updir = File::Spec->catdir(@dirs);
::is $mm->cd(@cd_args),
-qq{cd some/dir
+qq{cd $dir
command1
command2
cd $expected_updir};
@@ -43,15 +44,15 @@ qq{cd some/dir
local *make = sub { "dmake" };
::is $mm->cd(@cd_args),
-q{cd some/dir && command1
- cd some/dir && command2};
+qq{cd $dir && command1
+ cd $dir && command2};
}
}
{
is +ExtUtils::MM_Unix->cd(@cd_args),
-q{cd some/dir && command1
- cd some/dir && command2};
+qq{cd $dir && command1
+ cd $dir && command2};
}
SKIP: {
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/cp.t b/gnu/usr.bin/perl/lib/ExtUtils/t/cp.t
new file mode 100755
index 00000000000..3d7ba6e2886
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/cp.t
@@ -0,0 +1,33 @@
+#!/usr/bin/perl -w
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't';
+ @INC = ('../lib', 'lib/');
+ }
+ else {
+ unshift @INC, 't/lib/';
+ }
+}
+chdir 't';
+
+use ExtUtils::Command;
+use Test::More tests => 1;
+
+open FILE, ">source" or die $!;
+print FILE "stuff\n";
+close FILE;
+
+# Instead of sleeping to make the file time older
+utime time - 900, time - 900, "source";
+
+END { 1 while unlink "source", "dest"; }
+
+# Win32 bug, cp wouldn't update mtime.
+{
+ local @ARGV = qw(source dest);
+ cp();
+ my $mtime = (stat("dest"))[9];
+ my $now = time;
+ cmp_ok( abs($mtime - $now), '<=', 1, 'cp updated mtime' );
+}
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/eu_command.t b/gnu/usr.bin/perl/lib/ExtUtils/t/eu_command.t
index 2d2fdbae223..99e45aa9595 100644
--- a/gnu/usr.bin/perl/lib/ExtUtils/t/eu_command.t
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/eu_command.t
@@ -22,10 +22,8 @@ BEGIN {
File::Path::rmtree( 'ecmddir' );
}
-BEGIN {
- use Test::More tests => 41;
- use File::Spec;
-}
+use Test::More tests => 40;
+use File::Spec;
BEGIN {
# bad neighbor, but test_f() uses exit()
@@ -57,9 +55,6 @@ BEGIN {
@ARGV = ( $Testfile );
is( test_f(), 1, 'testing non-existent file' );
- @ARGV = ( $Testfile );
- is( ! test_f(), '', 'testing non-existent file' );
-
# these are destructive, have to keep setting @ARGV
@ARGV = ( $Testfile );
touch();
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/fix_libs.t b/gnu/usr.bin/perl/lib/ExtUtils/t/fix_libs.t
new file mode 100755
index 00000000000..2a9bf0cf463
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/fix_libs.t
@@ -0,0 +1,36 @@
+#!/usr/bin/perl -w
+
+# Unit test the code which fixes up $self->{LIBS}
+
+BEGIN {
+ chdir 't' if -d 't';
+
+ if( $ENV{PERL_CORE} ) {
+ @INC = '../lib';
+ }
+}
+
+use strict;
+use lib './lib';
+use Test::More 'no_plan';
+
+use ExtUtils::MakeMaker;
+
+my @tests = (
+ # arg # want
+ [ undef, [''] ],
+ [ "foo", ['foo'] ],
+ [ [], [''] ],
+ [ ["foo"], ['foo'] ],
+ [ [1, 2, 3], [1, 2, 3] ],
+ [ [0], [0] ],
+ [ [''], [''] ],
+ [ " ", [' '] ],
+);
+
+for my $test (@tests) {
+ my($arg, $want) = @$test;
+
+ my $display = defined $arg ? $arg : "undef";
+ is_deeply( MM->_fix_libs($arg), $want, "fix_libs($display)" );
+}
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/fixin.t b/gnu/usr.bin/perl/lib/ExtUtils/t/fixin.t
index 69c0ac722b8..e0291e600f7 100644
--- a/gnu/usr.bin/perl/lib/ExtUtils/t/fixin.t
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/fixin.t
@@ -1,5 +1,8 @@
#!/usr/bin/perl -w
+# Try to test fixin. I say "try" because what fixin will actually do
+# is highly variable from system to system.
+
BEGIN {
if( $ENV{PERL_CORE} ) {
chdir 't';
@@ -13,8 +16,9 @@ chdir 't';
use File::Spec;
-use Test::More tests => 6;
+use Test::More tests => 22;
+use Config;
use TieOut;
use MakeMaker::Test::Utils;
use MakeMaker::Test::Setup::BFD;
@@ -43,3 +47,77 @@ ok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) ||
is $\, "bar", '$\ not clobbered';
}
+
+sub test_fixin {
+ my($code, $test) = @_;
+
+ my $file = "fixin_test";
+ ok(open(my $fh, ">", $file), "write $file") or diag "Can't write $file: $!";
+ print $fh $code;
+ close $fh;
+
+ MY->fixin($file);
+
+ ok(open($fh, "<", $file), "read $file") or diag "Can't read $file: $!";
+ my @lines = <$fh>;
+ close $fh;
+
+ $test->(@lines);
+
+ 1 while unlink $file;
+ ok !-e $file, "cleaned up $file";
+}
+
+
+# A simple test of fixin
+test_fixin(<<END,
+#!/foo/bar/perl -w
+
+blah blah blah
+END
+ sub {
+ my @lines = @_;
+ unlike $lines[0], qr[/foo/bar/perl], "#! replaced";
+ like $lines[0], qr[ -w\b], "switch retained";
+
+ # In between might be that "not running under some shell" madness.
+
+ is $lines[-1], "blah blah blah\n", "Program text retained";
+ }
+);
+
+
+# [rt.cpan.org 29442]
+test_fixin(<<END,
+#!/foo/bar/perl5.8.8 -w
+
+blah blah blah
+END
+
+ sub {
+ my @lines = @_;
+ unlike $lines[0], qr[/foo/bar/perl5.8.8], "#! replaced";
+ like $lines[0], qr[ -w\b], "switch retained";
+
+ # In between might be that "not running under some shell" madness.
+
+ is $lines[-1], "blah blah blah\n", "Program text retained";
+ }
+);
+
+
+# fixin shouldn't pick this up.
+test_fixin(<<END,
+#!/foo/bar/perly -w
+
+blah blah blah
+END
+
+ sub {
+ is join("", @_), <<END;
+#!/foo/bar/perly -w
+
+blah blah blah
+END
+ }
+);
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/installed_file.t b/gnu/usr.bin/perl/lib/ExtUtils/t/installed_file.t
new file mode 100755
index 00000000000..c2dfce734a2
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/installed_file.t
@@ -0,0 +1,51 @@
+#!/usr/bin/perl -w
+
+# Test MM->_installed_file_for_module()
+
+BEGIN {
+ chdir 't' if -d 't';
+
+ if( $ENV{PERL_CORE} ) {
+ @INC = '../lib';
+ }
+}
+
+use strict;
+use warnings;
+
+use lib './lib';
+use ExtUtils::MakeMaker;
+use Test::More;
+use File::Spec;
+
+
+sub path_is {
+ my($have, $want, $name) = @_;
+
+ $have = File::Spec->canonpath($have);
+ $want = File::Spec->canonpath($want);
+
+ my $builder = Test::More->builder;
+ return $builder->is_eq( $have, $want, $name );
+}
+
+# Test when a module is not installed
+{
+ ok !MM->_installed_file_for_module("aaldkfjaldj"), "Module not installed";
+ ok !MM->_installed_file_for_module("aaldkfjaldj::dlajldkj");
+}
+
+# Try a single name module
+{
+ my $want = $INC{'strict.pm'};
+ path_is( MM->_installed_file_for_module("strict"), $want, "single name module" );
+}
+
+# And a tuple
+{
+ my $want = $INC{"Test/More.pm"};
+ path_is( MM->_installed_file_for_module("Test::More"), $want, "Foo::Bar style" );
+}
+
+
+done_testing(4);
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/is_of_type.t b/gnu/usr.bin/perl/lib/ExtUtils/t/is_of_type.t
new file mode 100755
index 00000000000..8a95d0d6a0f
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/is_of_type.t
@@ -0,0 +1,40 @@
+#!/usr/bin/perl -w
+
+# Test _is_of_type()
+
+BEGIN {
+ chdir 't' if -d 't';
+
+ if( $ENV{PERL_CORE} ) {
+ @INC = '../lib';
+ }
+}
+
+use lib './lib';
+use strict;
+use ExtUtils::MakeMaker;
+
+use Test::More "no_plan";
+
+my $is_of_type = \&ExtUtils::MakeMaker::_is_of_type;
+
+my @tests = (
+ [23, "", 1],
+ [[], "", 0],
+ [{}, "", 0],
+ [[], "HASH", 0],
+ [{}, "HASH", 1],
+ [bless({}, "Foo"), "Foo", 1],
+ [bless({}, "Bar"), "Foo", 0],
+ [bless([], "Foo"), "", 0],
+ [bless([], "Foo"), "HASH", 0],
+ [bless([], "Foo"), "ARRAY", 1],
+);
+
+for my $test (@tests) {
+ my($thing, $type, $want) = @$test;
+
+ # [rt.cpan.org 41060]
+ local $SIG{__DIE__} = sub { fail("sigdie should be ignored") };
+ is !!$is_of_type->($thing, $type), !!$want, qq[_is_of_type($thing, '$type'): $want];
+}
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/metafile_data.t b/gnu/usr.bin/perl/lib/ExtUtils/t/metafile_data.t
new file mode 100755
index 00000000000..29d271cfce7
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/metafile_data.t
@@ -0,0 +1,315 @@
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't' if -d 't';
+ @INC = ('../lib', 'lib');
+ }
+ else {
+ unshift @INC, 't/lib';
+ }
+}
+
+use strict;
+use Test::More tests => 7;
+
+use Data::Dumper;
+
+require ExtUtils::MM_Any;
+
+my $new_mm = sub {
+ return bless { ARGS => {@_}, @_ }, 'ExtUtils::MM_Any';
+};
+
+{
+ my $mm = $new_mm->(
+ DISTNAME => 'Foo-Bar',
+ VERSION => 1.23,
+ PM => {
+ "Foo::Bar" => 'lib/Foo/Bar.pm',
+ },
+ );
+
+ is_deeply [$mm->metafile_data], [
+ name => 'Foo-Bar',
+ version => 1.23,
+ abstract => undef,
+ author => [],
+ license => 'unknown',
+ distribution_type => 'module',
+
+ configure_requires => {
+ 'ExtUtils::MakeMaker' => 0,
+ },
+ build_requires => {
+ 'ExtUtils::MakeMaker' => 0,
+ },
+
+ no_index => {
+ directory => [qw(t inc)],
+ },
+
+ generated_by => "ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION",
+ 'meta-spec' => {
+ url => 'http://module-build.sourceforge.net/META-spec-v1.4.html',
+ version => 1.4
+ },
+ ];
+
+
+ is_deeply [$mm->metafile_data({}, { no_index => { directory => [qw(foo)] } })], [
+ name => 'Foo-Bar',
+ version => 1.23,
+ abstract => undef,
+ author => [],
+ license => 'unknown',
+ distribution_type => 'module',
+
+ configure_requires => {
+ 'ExtUtils::MakeMaker' => 0,
+ },
+ build_requires => {
+ 'ExtUtils::MakeMaker' => 0,
+ },
+
+ no_index => {
+ directory => [qw(t inc foo)],
+ },
+
+ generated_by => "ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION",
+ 'meta-spec' => {
+ url => 'http://module-build.sourceforge.net/META-spec-v1.4.html',
+ version => 1.4
+ },
+ ], 'rt.cpan.org 39348';
+}
+
+
+{
+ my $mm = $new_mm->(
+ DISTNAME => 'Foo-Bar',
+ VERSION => 1.23,
+ AUTHOR => 'Some Guy',
+ PREREQ_PM => {
+ Foo => 2.34,
+ Bar => 4.56,
+ },
+ );
+
+ is_deeply [$mm->metafile_data(
+ {
+ configure_requires => {
+ Stuff => 2.34
+ },
+ wobble => 42
+ },
+ {
+ no_index => {
+ package => "Thing"
+ },
+ wibble => 23
+ },
+ )],
+ [
+ name => 'Foo-Bar',
+ version => 1.23,
+ abstract => undef,
+ author => ['Some Guy'],
+ license => 'unknown',
+ distribution_type => 'script',
+
+ configure_requires => {
+ Stuff => 2.34,
+ },
+ build_requires => {
+ 'ExtUtils::MakeMaker' => 0,
+ },
+
+ requires => {
+ Foo => 2.34,
+ Bar => 4.56,
+ },
+
+ no_index => {
+ directory => [qw(t inc)],
+ package => 'Thing',
+ },
+
+ generated_by => "ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION",
+ 'meta-spec' => {
+ url => 'http://module-build.sourceforge.net/META-spec-v1.4.html',
+ version => 1.4
+ },
+
+ wibble => 23,
+ wobble => 42,
+ ];
+}
+
+
+# Test MIN_PERL_VERSION
+{
+ my $mm = $new_mm->(
+ DISTNAME => 'Foo-Bar',
+ VERSION => 1.23,
+ PM => {
+ "Foo::Bar" => 'lib/Foo/Bar.pm',
+ },
+ MIN_PERL_VERSION => 5.006,
+ );
+
+ is_deeply [$mm->metafile_data], [
+ name => 'Foo-Bar',
+ version => 1.23,
+ abstract => undef,
+ author => [],
+ license => 'unknown',
+ distribution_type => 'module',
+
+ configure_requires => {
+ 'ExtUtils::MakeMaker' => 0,
+ },
+ build_requires => {
+ 'ExtUtils::MakeMaker' => 0,
+ },
+
+ requires => {
+ perl => '5.006',
+ },
+
+ no_index => {
+ directory => [qw(t inc)],
+ },
+
+ generated_by => "ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION",
+ 'meta-spec' => {
+ url => 'http://module-build.sourceforge.net/META-spec-v1.4.html',
+ version => 1.4
+ },
+ ];
+}
+
+
+# Test MIN_PERL_VERSION
+{
+ my $mm = $new_mm->(
+ DISTNAME => 'Foo-Bar',
+ VERSION => 1.23,
+ PM => {
+ "Foo::Bar" => 'lib/Foo/Bar.pm',
+ },
+ MIN_PERL_VERSION => 5.006,
+ PREREQ_PM => {
+ 'Foo::Bar' => 1.23,
+ },
+ );
+
+ is_deeply [$mm->metafile_data], [
+ name => 'Foo-Bar',
+ version => 1.23,
+ abstract => undef,
+ author => [],
+ license => 'unknown',
+ distribution_type => 'module',
+
+ configure_requires => {
+ 'ExtUtils::MakeMaker' => 0,
+ },
+ build_requires => {
+ 'ExtUtils::MakeMaker' => 0,
+ },
+
+ requires => {
+ perl => '5.006',
+ 'Foo::Bar' => 1.23,
+ },
+
+ no_index => {
+ directory => [qw(t inc)],
+ },
+
+ generated_by => "ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION",
+ 'meta-spec' => {
+ url => 'http://module-build.sourceforge.net/META-spec-v1.4.html',
+ version => 1.4
+ },
+ ];
+}
+
+# Test CONFIGURE_REQUIRES
+{
+ my $mm = $new_mm->(
+ DISTNAME => 'Foo-Bar',
+ VERSION => 1.23,
+ CONFIGURE_REQUIRES => {
+ "Fake::Module1" => 1.01,
+ },
+ PM => {
+ "Foo::Bar" => 'lib/Foo/Bar.pm',
+ },
+ );
+
+ is_deeply [$mm->metafile_data], [
+ name => 'Foo-Bar',
+ version => 1.23,
+ abstract => undef,
+ author => [],
+ license => 'unknown',
+ distribution_type => 'module',
+
+ configure_requires => {
+ 'Fake::Module1' => 1.01,
+ },
+ build_requires => {
+ 'ExtUtils::MakeMaker' => 0,
+ },
+
+ no_index => {
+ directory => [qw(t inc)],
+ },
+
+ generated_by => "ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION",
+ 'meta-spec' => {
+ url => 'http://module-build.sourceforge.net/META-spec-v1.4.html',
+ version => 1.4
+ },
+ ],'CONFIGURE_REQUIRES';
+}
+
+# Test BUILD_REQUIRES
+{
+ my $mm = $new_mm->(
+ DISTNAME => 'Foo-Bar',
+ VERSION => 1.23,
+ BUILD_REQUIRES => {
+ "Fake::Module1" => 1.01,
+ },
+ PM => {
+ "Foo::Bar" => 'lib/Foo/Bar.pm',
+ },
+ );
+
+ is_deeply [$mm->metafile_data], [
+ name => 'Foo-Bar',
+ version => 1.23,
+ abstract => undef,
+ author => [],
+ license => 'unknown',
+ distribution_type => 'module',
+
+ configure_requires => {
+ 'ExtUtils::MakeMaker' => 0,
+ },
+ build_requires => {
+ 'Fake::Module1' => 1.01,
+ },
+
+ no_index => {
+ directory => [qw(t inc)],
+ },
+
+ generated_by => "ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION",
+ 'meta-spec' => {
+ url => 'http://module-build.sourceforge.net/META-spec-v1.4.html',
+ version => 1.4
+ },
+ ],'CONFIGURE_REQUIRES';
+}
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/metafile_file.t b/gnu/usr.bin/perl/lib/ExtUtils/t/metafile_file.t
new file mode 100755
index 00000000000..842a249717e
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/metafile_file.t
@@ -0,0 +1,314 @@
+#!/usr/bin/perl -w
+
+# This is a test of the fake YAML dumper implemented by EUMM:
+# ExtUtils::MM_Any::metafile_file
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't' if -d 't';
+ @INC = ('../lib', 'lib');
+ }
+ else {
+ unshift @INC, 't/lib';
+ }
+}
+
+use strict;
+use Test::More tests => 16;
+
+require ExtUtils::MM_Any;
+
+my $mm = bless {}, 'ExtUtils::MM_Any';
+
+{
+ my @meta = ( a => 1, b => 2 );
+ my $expected = <<YAML;
+--- #YAML:1.0
+a: 1
+b: 2
+YAML
+
+ is($mm->metafile_file(@meta), $expected, "dump for flat hashes works ok");
+}
+
+{
+ my @meta = ( k1 => 'some key and value', k2 => undef, k3 => 1 );
+ my $expected = <<YAML;
+--- #YAML:1.0
+k1: some key and value
+k2: ~
+k3: 1
+YAML
+
+ is($mm->metafile_file(@meta), $expected, "dumping strings and undefs is ok");
+}
+
+{
+ my @meta = ( a => 1, b => 2, h => { hh => 1 } );
+ my $expected = <<YAML;
+--- #YAML:1.0
+a: 1
+b: 2
+h:
+ hh: 1
+YAML
+
+ is($mm->metafile_file(@meta), $expected, "dump for nested hashes works ok");
+}
+
+{
+ my @meta = ( a => 1, b => 2, h => { h1 => 'x', h2 => 'z' } );
+ my $expected = <<YAML;
+--- #YAML:1.0
+a: 1
+b: 2
+h:
+ h1: x
+ h2: z
+YAML
+
+ is($mm->metafile_file(@meta), $expected, "nested hashes sort ascii-betically");
+ # to tell the truth, they sort case-insensitively
+ # that's hard to test for Perl with unstable sort's
+}
+
+{
+ my @meta = ( a => 1, b => 2, h => { hh => { hhh => 1 } } );
+ my $expected = <<YAML;
+--- #YAML:1.0
+a: 1
+b: 2
+h:
+ hh:
+ hhh: 1
+YAML
+
+ is($mm->metafile_file(@meta), $expected, "dump for hashes (with more nesting) works ok");
+}
+
+{
+ my @meta = ( a => 1, k => [ qw(w y z) ] );
+ my $expected = <<YAML;
+--- #YAML:1.0
+a: 1
+k:
+ - w
+ - y
+ - z
+YAML
+
+ is($mm->metafile_file(@meta), $expected, "array of strings are handled ok");
+}
+
+is($mm->metafile_file( a => {}, b => [], c => undef ), <<'YAML', 'empty hashes and arrays');
+--- #YAML:1.0
+a: {}
+b: []
+c: ~
+YAML
+
+
+{
+ my @meta = (
+ name => 'My-Module',
+ version => '0.1',
+ version_from => 'lib/My/Module.pm',
+ installdirs => 'site',
+ abstract => 'A does-it-all module',
+ license => 'perl',
+ generated_by => 'myself',
+ author => 'John Doe <doe@doeland.org>',
+ distribution_type => 'module',
+ requires => {
+ 'My::Module::Helper' => 0,
+ 'Your::Module' => '1.5',
+ },
+ 'meta-spec' => {
+ version => '1.1',
+ url => 'http://module-build.sourceforge.net/META-spec-new.html',
+ },
+ );
+ my $expected = <<'YAML';
+--- #YAML:1.0
+name: My-Module
+version: 0.1
+version_from: lib/My/Module.pm
+installdirs: site
+abstract: A does-it-all module
+license: perl
+generated_by: myself
+author: John Doe <doe@doeland.org>
+distribution_type: module
+requires:
+ My::Module::Helper: 0
+ Your::Module: 1.5
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-new.html
+ version: 1.1
+YAML
+
+ is($mm->metafile_file(@meta), $expected, "dump for something like META.yml works");
+}
+
+{
+ my @meta = (
+ name => 'My-Module',
+ version => '0.1',
+ version_from => 'lib/My/Module.pm',
+ installdirs => 'site',
+ abstract => 'A does-it-all module',
+ license => 'perl',
+ generated_by => 'myself',
+ author => 'John Doe <doe@doeland.org>',
+ distribution_type => 'module',
+ requires => {
+ 'My::Module::Helper' => 0,
+ 'Your::Module' => '1.5',
+ },
+ recommends => {
+ 'Test::More' => 0,
+ 'Test::Pod' => 1.18,
+ 'Test::Pod::Coverage' => 1
+ },
+ 'meta-spec' => {
+ version => '1.1',
+ url => 'http://module-build.sourceforge.net/META-spec-new.html',
+ },
+ );
+ my $expected = <<'YAML';
+--- #YAML:1.0
+name: My-Module
+version: 0.1
+version_from: lib/My/Module.pm
+installdirs: site
+abstract: A does-it-all module
+license: perl
+generated_by: myself
+author: John Doe <doe@doeland.org>
+distribution_type: module
+requires:
+ My::Module::Helper: 0
+ Your::Module: 1.5
+recommends:
+ Test::More: 0
+ Test::Pod: 1.18
+ Test::Pod::Coverage: 1
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-new.html
+ version: 1.1
+YAML
+
+ is($mm->metafile_file(@meta), $expected, "META.yml with extra 'recommends' works");
+}
+
+{
+ my @meta = (
+ name => 'My-Module',
+ version => '0.1',
+ version_from => 'lib/My/Module.pm',
+ installdirs => 'site',
+ abstract => 'A does-it-all module',
+ license => 'perl',
+ generated_by => 'myself',
+ author => 'John Doe <doe@doeland.org>',
+ distribution_type => 'module',
+ requires => {
+ 'My::Module::Helper' => 0,
+ 'Your::Module' => '1.5',
+ },
+ recommends => {
+ 'Test::More' => 0,
+ 'Test::Pod' => 1.18,
+ 'Test::Pod::Coverage' => 1
+ },
+ no_index => {
+ dir => [ qw(inc) ],
+ file => [ qw(TODO NOTES) ],
+ },
+ 'meta-spec' => {
+ version => '1.1',
+ url => 'http://module-build.sourceforge.net/META-spec-new.html',
+ },
+ );
+ my $expected = <<'YAML';
+--- #YAML:1.0
+name: My-Module
+version: 0.1
+version_from: lib/My/Module.pm
+installdirs: site
+abstract: A does-it-all module
+license: perl
+generated_by: myself
+author: John Doe <doe@doeland.org>
+distribution_type: module
+requires:
+ My::Module::Helper: 0
+ Your::Module: 1.5
+recommends:
+ Test::More: 0
+ Test::Pod: 1.18
+ Test::Pod::Coverage: 1
+no_index:
+ dir:
+ - inc
+ file:
+ - TODO
+ - NOTES
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-new.html
+ version: 1.1
+YAML
+
+ is($mm->metafile_file(@meta), $expected, "META.yml with extra 'no_index' works");
+
+
+ # Make sure YAML.pm can ready our output
+ SKIP: {
+ skip "Need YAML.pm to test if it can load META.yml", 1
+ unless eval { require YAML };
+
+ my $yaml_load = YAML::Load($mm->metafile_file(@meta));
+ is_deeply( $yaml_load, {@meta}, "META.yml can be read by YAML.pm" );
+ }
+
+
+ SKIP: {
+ skip "Need YAML::Tiny to test if it can load META.yml", 2
+ unless eval { require YAML::Tiny };
+
+ my @yaml_load = YAML::Tiny::Load($mm->metafile_file(@meta));
+ is @yaml_load, 1, "YAML::Tiny saw one document in META.yml";
+ is_deeply( $yaml_load[0], {@meta}, "META.yml can be read by YAML::Tiny" );
+ }
+}
+
+
+{
+ my @meta = ( k => 'a : b', 'x : y' => 1 );
+ my $expected = <<YAML;
+--- #YAML:1.0
+k: a : b
+x : y: 1
+YAML
+ # NOTE: the output is not YAML-equivalent to the input
+
+ is($mm->metafile_file(@meta), $expected, "no quoting is done");
+}
+
+{
+ my @meta = ( k => \*STDOUT );
+ eval { $mm->metafile_file(@meta) };
+
+ like($@, qr/^only nested hashes, arrays and objects are supported/,
+ "we don't like but hash/array refs");
+}
+
+{
+ my @meta = ( k => [ [] ] );
+ eval { $mm->metafile_file(@meta) };
+
+ like($@, qr/^only nested arrays of non-refs are supported/,
+ "we also don't like but array of strings");
+}
+
+# recursive data structures: don't even think about it - endless recursion
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/min_perl_version.t b/gnu/usr.bin/perl/lib/ExtUtils/t/min_perl_version.t
new file mode 100755
index 00000000000..9dc6088bf3e
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/min_perl_version.t
@@ -0,0 +1,201 @@
+#!/usr/bin/perl -w
+
+# This is a test checking various aspects of the optional argument
+# MIN_PERL_VERSION 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 => 33;
+
+use TieOut;
+use MakeMaker::Test::Utils;
+use MakeMaker::Test::Setup::MPV;
+use File::Path;
+
+use ExtUtils::MakeMaker;
+
+# avoid environment variables interfering with our make runs
+delete @ENV{qw(LIB MAKEFLAGS)};
+
+my $perl = which_perl();
+my $make = make_run();
+my $makefile = makefile_name();
+
+chdir 't';
+
+perl_lib();
+
+ok( setup_recurs(), 'setup' );
+END {
+ ok( chdir(File::Spec->updir), 'leaving dir' );
+ ok( teardown_recurs(), 'teardown' );
+}
+
+ok( chdir 'Min-PerlVers', 'entering dir Min-PerlVers' ) ||
+ diag("chdir failed: $!");
+
+{
+ # ----- argument verification -----
+
+ my $stdout = tie *STDOUT, 'TieOut';
+ ok( $stdout, 'capturing stdout' );
+ my $warnings = '';
+ local $SIG{__WARN__} = sub {
+ $warnings .= join '', @_;
+ };
+
+ eval {
+ WriteMakefile(
+ NAME => 'Min::PerlVers',
+ MIN_PERL_VERSION => '5',
+ );
+ };
+ is( $warnings, '', 'MIN_PERL_VERSION=5 does not trigger a warning' );
+ is( $@, '', ' nor a hard failure' );
+
+
+ $warnings = '';
+ eval {
+ WriteMakefile(
+ NAME => 'Min::PerlVers',
+ MIN_PERL_VERSION => '5.4.4',
+ );
+ };
+ is( $warnings, '', 'MIN_PERL_VERSION=X.Y.Z does not trigger a warning' );
+ is( $@, '', ' nor a hard failure' );
+
+
+ $warnings = '';
+ eval {
+ WriteMakefile(
+ NAME => 'Min::PerlVers',
+ MIN_PERL_VERSION => '999999',
+ );
+ };
+ ok( '' ne $warnings, 'MIN_PERL_VERSION=999999 triggers a warning' );
+ is( $warnings,
+ "Warning: Perl version 999999 or higher required. We run $].\n",
+ ' with expected message text' );
+ is( $@, '', ' and without a hard failure' );
+
+ $warnings = '';
+ eval {
+ WriteMakefile(
+ NAME => 'Min::PerlVers',
+ MIN_PERL_VERSION => '999999',
+ PREREQ_FATAL => 1,
+ );
+ };
+ is( $warnings, '', 'MIN_PERL_VERSION=999999 and PREREQ_FATAL: no warning' );
+ is( $@, <<"END", ' correct exception' );
+MakeMaker FATAL: perl version too low for this distribution.
+Required is 999999. We run $].
+END
+
+ $warnings = '';
+ eval {
+ WriteMakefile(
+ NAME => 'Min::PerlVers',
+ MIN_PERL_VERSION => 'foobar',
+ );
+ };
+ ok( '' ne $warnings, 'MIN_PERL_VERSION=foobar triggers a warning' );
+ is( $warnings, <<'END', ' with expected message text' );
+Warning: MIN_PERL_VERSION is not in a recognized format.
+Recommended is a quoted numerical value like '5.005' or '5.008001'.
+END
+
+ is( $@, '', ' and without a hard failure' );
+}
+
+
+# ----- PREREQ_PRINT output -----
+{
+ my $prereq_out = run(qq{$perl Makefile.PL "PREREQ_PRINT=1"});
+ is( $?, 0, 'PREREQ_PRINT exiting normally' );
+ my $prereq_out_sane = $prereq_out =~ /^\s*\$PREREQ_PM\s*=/;
+ ok( $prereq_out_sane, ' and talking like we expect' ) ||
+ diag($prereq_out);
+
+ SKIP: {
+ skip 'not going to evaluate rubbish', 3 if !$prereq_out_sane;
+
+ package _Prereq::Print::WithMPV; ## no critic
+ our($PREREQ_PM, $BUILD_REQUIRES, $MIN_PERL_VERSION, $ERR);
+ $ERR = '';
+ eval {
+ eval $prereq_out; ## no critic
+ $ERR = $@;
+ };
+ ::is( $@ . $ERR, '', 'prereqs evaluable' );
+ ::is_deeply( $PREREQ_PM, { strict => 0 }, ' and looking correct' );
+ ::is( $MIN_PERL_VERSION, '5.005', 'min version also correct' );
+ }
+}
+
+
+# ----- PRINT_PREREQ output -----
+{
+ my $prereq_out = run(qq{$perl Makefile.PL "PRINT_PREREQ=1"});
+ is( $?, 0, 'PRINT_PREREQ exiting normally' );
+ ok( $prereq_out !~ /^warning/i, ' and not complaining loudly' );
+ like( $prereq_out,
+ qr/^perl\(perl\) \s* >= 5\.005 \s+ perl\(strict\) \s* >= \s* 0 \s*$/x,
+ 'dump has prereqs and perl version' );
+}
+
+
+# ----- generated files verification -----
+{
+ unlink $makefile;
+ my @mpl_out = run(qq{$perl Makefile.PL});
+ END { unlink $makefile, makefile_backup() }
+
+ cmp_ok( $?, '==', 0, 'Makefile.PL exiting normally' ) || diag(@mpl_out);
+ ok( -e $makefile, 'Makefile present' );
+}
+
+
+# ----- ppd output -----
+{
+ my $ppd_file = 'Min-PerlVers.ppd';
+ my @make_out = run(qq{$make ppd});
+ END { unlink $ppd_file }
+
+ cmp_ok( $?, '==', 0, 'Make ppd exiting normally' ) || diag(@make_out);
+
+ my $ppd_html = slurp($ppd_file);
+ ok( defined($ppd_html), ' .ppd file present' );
+
+ like( $ppd_html, qr{^\s*<PERLCORE VERSION="5,005,0,0" />}m,
+ ' .ppd file content good' );
+}
+
+
+# ----- META.yml output -----
+{
+ my $distdir = 'Min-PerlVers-0.05';
+ $distdir =~ s{\.}{_}g if $Is_VMS;
+
+ my $meta_yml = "$distdir/META.yml";
+ my @make_out = run(qq{$make metafile});
+ END { rmtree $distdir }
+
+ cmp_ok( $?, '==', 0, 'Make metafile exiting normally' ) || diag(@make_out);
+ my $meta = slurp($meta_yml);
+ ok( defined($meta), ' META.yml present' );
+
+ like( $meta, qr{\nrequires:[^\S\n]*\n\s+perl:\s+5\.005\n\s+strict:\s+0\n},
+ ' META.yml content good');
+}
+
+__END__
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/miniperl.t b/gnu/usr.bin/perl/lib/ExtUtils/t/miniperl.t
new file mode 100755
index 00000000000..fbd801cd346
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/miniperl.t
@@ -0,0 +1,57 @@
+#!/usr/bin/perl -w
+
+# Test that we can build modules as miniperl.
+# This mostly means no XS modules.
+
+BEGIN {
+ if ($ENV{PERL_CORE}) {
+ chdir 't' if -d 't';
+ @INC = qw(../lib lib);
+ }
+}
+
+use strict;
+use lib 't/lib';
+
+use Test::More 'no_plan';
+
+BEGIN {
+ ok !$INC{"ExtUtils/MakeMaker.pm"}, "MakeMaker is not yet loaded";
+}
+
+# Disable all XS from here on
+use MakeMaker::Test::NoXS;
+
+use ExtUtils::MakeMaker;
+
+use MakeMaker::Test::Utils;
+use MakeMaker::Test::Setup::BFD;
+
+
+my $perl = which_perl();
+my $makefile = makefile_name();
+my $make = make_run();
+
+
+# Setup our test environment
+{
+ chdir 't';
+
+ perl_lib;
+
+ ok( setup_recurs(), 'setup' );
+ END {
+ ok( chdir File::Spec->updir );
+ ok( teardown_recurs(), 'teardown' );
+ }
+
+ ok( chdir('Big-Dummy'), "chdir'd to Big-Dummy" ) ||
+ diag("chdir failed: $!");
+}
+
+
+# Run make once
+{
+ run_ok(qq{$perl Makefile.PL});
+ run_ok($make);
+}
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/pm_to_blib.t b/gnu/usr.bin/perl/lib/ExtUtils/t/pm_to_blib.t
new file mode 100755
index 00000000000..7c28781b7d5
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/pm_to_blib.t
@@ -0,0 +1,77 @@
+#!/usr/bin/perl -w
+
+# Ensure pm_to_blib runs at the right times.
+
+BEGIN {
+ if ($ENV{PERL_CORE}) {
+ chdir 't' if -d 't';
+ @INC = qw(../lib lib);
+ }
+}
+
+use strict;
+use lib 't/lib';
+
+use Test::More 'no_plan';
+
+use ExtUtils::MakeMaker;
+
+use MakeMaker::Test::Utils;
+use MakeMaker::Test::Setup::BFD;
+
+
+my $perl = which_perl();
+my $makefile = makefile_name();
+my $make = make_run();
+
+
+# Setup our test environment
+{
+ chdir 't';
+
+ perl_lib;
+
+ ok( setup_recurs(), 'setup' );
+ END {
+ ok( chdir File::Spec->updir );
+ ok( teardown_recurs(), 'teardown' );
+ }
+
+ ok( chdir('Big-Dummy'), "chdir'd to Big-Dummy" ) ||
+ diag("chdir failed: $!");
+}
+
+
+# Run make once
+{
+ run_ok(qq{$perl Makefile.PL});
+ run_ok($make);
+
+ ok( -e "blib/lib/Big/Dummy.pm", "blib copied pm file" );
+}
+
+
+# Change a pm file, it should be copied.
+{
+ # Wait a couple seconds else our changed file will have the same timestamp
+ # as the blib file
+ sleep 2;
+
+ ok( open my $fh, ">>", "lib/Big/Dummy.pm" ) or die $!;
+ print $fh "Something else\n";
+ close $fh;
+
+ run_ok($make);
+ like slurp("blib/lib/Big/Dummy.pm"), qr/Something else\n$/;
+}
+
+
+# Rerun the Makefile.PL, pm_to_blib should rerun
+{
+ run_ok(qq{$perl Makefile.PL});
+
+ # XXX This is a fragile way to check that it reran.
+ like run_ok($make), qr/^Skip /ms;
+
+ ok( -e "blib/lib/Big/Dummy.pm", "blib copied pm file" );
+}
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/pod2man.t b/gnu/usr.bin/perl/lib/ExtUtils/t/pod2man.t
new file mode 100755
index 00000000000..c3dd2e23e15
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/pod2man.t
@@ -0,0 +1,54 @@
+#!/usr/bin/perl -w
+
+# Test our simulation of pod2man
+
+BEGIN {
+ if ($ENV{PERL_CORE}) {
+ chdir 't' if -d 't';
+ @INC = qw(../lib lib);
+ }
+}
+
+use strict;
+use lib 't/lib';
+
+use ExtUtils::Command::MM;
+
+use Test::More tests => 3;
+
+# The argument to perm_rw was optional.
+# [rt.cpan.org 35190]
+{
+ my $warnings;
+ local $SIG{__WARN__} = sub {
+ $warnings .= join '', @_;
+ };
+
+ pod2man("--perm_rw");
+
+ like $warnings, qr/^Option perm_rw requires an argument/;
+};
+
+
+# Simulate the failure of Pod::Man loading.
+# pod2man() should react gracefully.
+{
+ local @INC = @INC;
+ unshift @INC, sub {
+ die "Simulated Pod::Man failure\n" if $_[1] eq 'Pod/Man.pm';
+ };
+ local %INC = %INC;
+ delete $INC{"Pod/Man.pm"};
+
+ my $warnings;
+ local $SIG{__WARN__} = sub {
+ $warnings .= join '', @_;
+ };
+
+ is pod2man(), undef;
+ is $warnings, <<'END'
+Pod::Man is not available: Simulated Pod::Man failure
+Man pages will not be generated during this install.
+END
+
+}
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/prefixify.t b/gnu/usr.bin/perl/lib/ExtUtils/t/prefixify.t
index b5bf139a748..011b77cb3c2 100644
--- a/gnu/usr.bin/perl/lib/ExtUtils/t/prefixify.t
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/prefixify.t
@@ -17,7 +17,7 @@ if( $^O eq 'VMS' ) {
plan skip_all => 'prefixify works differently on VMS';
}
else {
- plan tests => 3;
+ plan tests => 4;
}
use ExtUtils::MakeMaker::Config;
use File::Spec;
@@ -38,6 +38,10 @@ $mm->prefixify('installbin', 'wibble', 'something', $default);
is( $mm->{INSTALLBIN}, File::Spec->catdir('something', $default),
'prefixify w/defaults and PREFIX');
+$mm->prefixify('installbin', '../wibble', 'something', $default);
+is( $mm->{INSTALLBIN}, File::Spec->catdir('something', $default),
+ 'relative paths + PREFIX');
+
SKIP: {
skip "Test for DOSish prefixification", 1 unless $Is_Dosish;
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/prereq.t b/gnu/usr.bin/perl/lib/ExtUtils/t/prereq.t
index c690a55a02e..e92e5a01c46 100644
--- a/gnu/usr.bin/perl/lib/ExtUtils/t/prereq.t
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/prereq.t
@@ -59,7 +59,7 @@ ok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) ||
);
is $warnings,
sprintf("Warning: prerequisite strict 99999 not found. We have %s.\n",
- strict->VERSION);
+ $strict::VERSION);
$warnings = '';
WriteMakefile(
@@ -82,7 +82,7 @@ ok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) ||
is $warnings,
"Warning: prerequisite I::Do::Not::Exist 0 not found.\n".
sprintf("Warning: prerequisite strict 99999 not found. We have %s.\n",
- strict->VERSION);
+ $strict::VERSION);
$warnings = '';
eval {
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/test_boilerplate.t b/gnu/usr.bin/perl/lib/ExtUtils/t/test_boilerplate.t
new file mode 100755
index 00000000000..899ad575082
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/test_boilerplate.t
@@ -0,0 +1,26 @@
+#!/usr/bin/perl -w
+
+# <<<Fill in with what this test does.>>>
+# Copy this when writing new tests to avoid forgetting the core boilerplate
+
+# Magic for core
+BEGIN {
+ # Always run in t to unify behavor with core
+ chdir 't' if -d 't';
+
+ # Only use the about to be installed modules
+ if( $ENV{PERL_CORE} ) {
+ @INC = '../lib';
+ }
+}
+
+# Use things from t/lib/
+use lib './lib';
+use strict;
+use ExtUtils::MakeMaker;
+
+use Test::More;
+
+pass("Your test code goes here");
+
+done_testing();
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/testdata/reallylongdirectoryname/arch1/Config.pm b/gnu/usr.bin/perl/lib/ExtUtils/t/testdata/reallylongdirectoryname/arch1/Config.pm
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/testdata/reallylongdirectoryname/arch1/Config.pm
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/testdata/reallylongdirectoryname/arch2/Config.pm b/gnu/usr.bin/perl/lib/ExtUtils/t/testdata/reallylongdirectoryname/arch2/Config.pm
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/testdata/reallylongdirectoryname/arch2/Config.pm
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/writemakefile_args.t b/gnu/usr.bin/perl/lib/ExtUtils/t/writemakefile_args.t
index da274d6cc7c..a0774a8d6b1 100644
--- a/gnu/usr.bin/perl/lib/ExtUtils/t/writemakefile_args.t
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/writemakefile_args.t
@@ -14,7 +14,7 @@ BEGIN {
}
use strict;
-use Test::More tests => 28;
+use Test::More tests => 35;
use TieOut;
use MakeMaker::Test::Utils;
@@ -126,8 +126,8 @@ VERIFY
$warnings = '';
eval {
$mm = WriteMakefile(
- NAME => 'Big::Dummy',
- VERSION => [1,2,3],
+ NAME => 'Big::Dummy',
+ VERSION => [1,2,3],
);
};
like( $warnings, qr{^WARNING: VERSION takes a version object or string/number} );
@@ -135,8 +135,8 @@ VERIFY
$warnings = '';
eval {
$mm = WriteMakefile(
- NAME => 'Big::Dummy',
- VERSION => 1.002_003,
+ NAME => 'Big::Dummy',
+ VERSION => 1.002_003,
);
};
is( $warnings, '' );
@@ -145,8 +145,8 @@ VERIFY
$warnings = '';
eval {
$mm = WriteMakefile(
- NAME => 'Big::Dummy',
- VERSION => '1.002_003',
+ NAME => 'Big::Dummy',
+ VERSION => '1.002_003',
);
};
is( $warnings, '' );
@@ -156,39 +156,66 @@ VERIFY
$warnings = '';
eval {
$mm = WriteMakefile(
- NAME => 'Big::Dummy',
- VERSION => bless {}, "Some::Class",
+ NAME => 'Big::Dummy',
+ VERSION => bless {}, "Some::Class",
);
};
like( $warnings, '/^WARNING: VERSION takes a version object or string/number not a Some::Class object/' );
SKIP: {
- skip("Can't test version objects",6) unless eval { require version };
+ skip("Can't test version objects", 8) unless eval { require version };
version->import;
my $version = version->new("1.2.3");
$warnings = '';
- eval {
+ ok eval {
$mm = WriteMakefile(
- NAME => 'Big::Dummy',
- VERSION => $version,
+ NAME => 'Big::Dummy',
+ VERSION => $version,
);
- };
+ } || diag $@;
is( $warnings, '' );
isa_ok( $mm->{VERSION}, 'version' );
is( $mm->{VERSION}, $version );
$warnings = '';
$version = qv('1.2.3');
- eval {
+ ok eval {
$mm = WriteMakefile(
- NAME => 'Big::Dummy',
- VERSION => $version,
+ NAME => 'Big::Dummy',
+ VERSION => $version,
);
- };
+ } || diag $@;
is( $warnings, '' );
isa_ok( $mm->{VERSION}, 'version' );
is( $mm->{VERSION}, $version );
}
-} \ No newline at end of file
+
+
+ # DISTNAME
+ $warnings = '';
+ eval {
+ $mm = WriteMakefile(
+ NAME => 'Big::Dummy',
+ VERSION => '1.00',
+ DISTNAME => "Hooballa",
+ );
+ };
+ is( $warnings, '' );
+ is( $mm->{DISTNAME}, "Hooballa" );
+ is( $mm->{DISTVNAME}, $Is_VMS ? "Hooballa-1_00" : "Hooballa-1.00" );
+
+
+ # DISTVNAME (rt.cpan.org 43217)
+ $warnings = '';
+ eval {
+ $mm = WriteMakefile(
+ NAME => 'Big::Dummy',
+ VERSION => 1.00,
+ DISTVNAME => "Hooballoo",
+ );
+ };
+ is( $warnings, '' );
+ is( $mm->{DISTVNAME}, 'Hooballoo' );
+}
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/xs.t b/gnu/usr.bin/perl/lib/ExtUtils/t/xs.t
index 1cadc109b77..5a15190d3eb 100755
--- a/gnu/usr.bin/perl/lib/ExtUtils/t/xs.t
+++ b/gnu/usr.bin/perl/lib/ExtUtils/t/xs.t
@@ -11,6 +11,8 @@ BEGIN {
}
chdir 't';
+use strict;
+
use Test::More;
use MakeMaker::Test::Utils;
use MakeMaker::Test::Setup::XS;
@@ -18,19 +20,18 @@ use File::Find;
use File::Spec;
use File::Path;
+my $Skipped = 0;
if( have_compiler() ) {
- plan tests => 7;
+ plan tests => 5;
}
else {
+ $Skipped = 1;
plan skip_all => "ExtUtils::CBuilder not installed or couldn't find a compiler";
}
my $Is_VMS = $^O eq 'VMS';
my $perl = which_perl();
-# GNV logical interferes with testing
-$ENV{'bin'} = '[.bin]' if $Is_VMS;
-
chdir 't';
perl_lib;
@@ -39,8 +40,10 @@ $| = 1;
ok( setup_xs(), 'setup' );
END {
- ok( chdir File::Spec->updir );
- ok( teardown_xs(), 'teardown' );
+ unless( $Skipped ) {
+ chdir File::Spec->updir or die;
+ teardown_xs(), 'teardown' or die;
+ }
}
ok( chdir('XS-Test'), "chdir'd to XS-Test" ) ||