summaryrefslogtreecommitdiff
path: root/lib/ExtUtils/t
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ExtUtils/t')
-rw-r--r--lib/ExtUtils/t/00setup_dummy.t135
-rw-r--r--lib/ExtUtils/t/Command.t39
-rw-r--r--lib/ExtUtils/t/INST.t9
-rw-r--r--lib/ExtUtils/t/INST_PREFIX.t135
-rw-r--r--lib/ExtUtils/t/Install.t10
-rw-r--r--lib/ExtUtils/t/MM_Cygwin.t2
-rw-r--r--lib/ExtUtils/t/MM_Unix.t38
-rw-r--r--lib/ExtUtils/t/MM_Win32.t2
-rw-r--r--lib/ExtUtils/t/Manifest.t45
-rw-r--r--lib/ExtUtils/t/basic.t18
-rw-r--r--lib/ExtUtils/t/parse_version.t34
-rw-r--r--lib/ExtUtils/t/postamble.t9
-rw-r--r--lib/ExtUtils/t/prefixify.t7
-rw-r--r--lib/ExtUtils/t/prereq_print.t9
-rw-r--r--lib/ExtUtils/t/problems.t9
-rw-r--r--lib/ExtUtils/t/writemakefile_args.t9
-rw-r--r--lib/ExtUtils/t/zz_cleanup_dummy.t23
17 files changed, 300 insertions, 233 deletions
diff --git a/lib/ExtUtils/t/00setup_dummy.t b/lib/ExtUtils/t/00setup_dummy.t
deleted file mode 100644
index 0b9e58d056..0000000000
--- a/lib/ExtUtils/t/00setup_dummy.t
+++ /dev/null
@@ -1,135 +0,0 @@
-#!/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;
-
-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';
-$ BFD_TEST_ROOT = F$PARSE("SYS$DISK:[-]",,,,"NO_CONCEAL")-".][000000"-"]["-"].;"+".]"
-$ DEFINE/JOB/NOLOG/TRANSLATION=CONCEALED BFD_TEST_ROOT 'BFD_TEST_ROOT'
-COMMAND
- close BFDTMP;
-
- system '@bfdtesttmp.com';
- 1 while unlink 'bfdtesttmp.com';
-}
-
-
-my %Files = (
- 'Big-Dummy/lib/Big/Dummy.pm' => <<'END',
-package Big::Dummy;
-
-$VERSION = 0.01;
-
-=head1 NAME
-
-Big::Dummy - Try "our" hot dog's
-
-=cut
-
-1;
-END
-
- 'Big-Dummy/Makefile.PL' => <<'END',
-use ExtUtils::MakeMaker;
-
-# This will interfere with the PREREQ_PRINT tests.
-printf "Current package is: %s\n", __PACKAGE__ unless "@ARGV" =~ /PREREQ/;
-
-WriteMakefile(
- NAME => 'Big::Dummy',
- VERSION_FROM => 'lib/Big/Dummy.pm',
- PREREQ_PM => { strict => 0 },
- ABSTRACT_FROM => 'lib/Big/Dummy.pm',
- AUTHOR => 'Michael G Schwern <schwern@pobox.com>',
-);
-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/lib/ExtUtils/t/Command.t b/lib/ExtUtils/t/Command.t
index bf7d177889..943296c079 100644
--- a/lib/ExtUtils/t/Command.t
+++ b/lib/ExtUtils/t/Command.t
@@ -23,7 +23,7 @@ BEGIN {
}
BEGIN {
- use Test::More tests => 26;
+ use Test::More tests => 34;
use File::Spec;
}
@@ -66,6 +66,7 @@ BEGIN {
@ARGV = ( $Testfile );
ok( test_f(), 'now creating that file' );
+ is_deeply( \@ARGV, [$Testfile], 'test_f preserves @ARGV' );
@ARGV = ( $Testfile );
ok( -e $ARGV[0], 'created!' );
@@ -134,7 +135,9 @@ BEGIN {
# change a file to read-write
@ARGV = ( '0600', $Testfile );
+ my @orig_argv = @ARGV;
ExtUtils::Command::chmod();
+ is_deeply( \@ARGV, \@orig_argv, 'chmod preserves @ARGV' );
is( ((stat($Testfile))[2] & 07777) & 0700,
($^O eq 'vos' ? 0700 : 0600), 'change a file to read-write' );
@@ -148,7 +151,9 @@ BEGIN {
# copy a file to a nested subdirectory
unshift @ARGV, $Testfile;
+ @orig_argv = @ARGV;
cp();
+ is_deeply( \@ARGV, \@orig_argv, 'cp preserves @ARGV' );
ok( -e File::Spec->join( 'ecmddir', 'temp2', $Testfile ), 'copied okay' );
@@ -160,7 +165,9 @@ BEGIN {
# move a file to a subdirectory
@ARGV = ( $Testfile, 'ecmddir' );
- mv();
+ @orig_argv = @ARGV;
+ ok( mv() );
+ is_deeply( \@ARGV, \@orig_argv, 'mv preserves @ARGV' );
ok( ! -e $Testfile, 'moved file away' );
ok( -e File::Spec->join( 'ecmddir', $Testfile ), 'file in new location' );
@@ -208,7 +215,35 @@ BEGIN {
ok( ! -e $dir, "removed $dir successfully" );
}
+{
+ mkdir 'd2utest';
+ open(FILE, '>d2utest/foo');
+ print FILE "stuff\015\012and thing\015\012";
+ close FILE;
+
+ open(FILE, '>d2utest/bar');
+ binmode(FILE);
+ my $bin = "\c@\c@\c@\c@\c@\c@\cA\c@\c@\c@\015\012".
+ "\@\c@\cA\c@\c@\c@8__LIN\015\012";
+ print FILE $bin;
+ close FILE;
+
+ local @ARGV = 'd2utest';
+ ExtUtils::Command::dos2unix();
+
+ open(FILE, 'd2utest/foo');
+ is( join('', <FILE>), "stuff\012and thing\012", 'dos2unix' );
+ close FILE;
+
+ open(FILE, 'd2utest/bar');
+ binmode(FILE);
+ ok( -B 'd2utest/bar' );
+ is( join('', <FILE>), $bin, 'dos2unix preserves binaries');
+ close FILE;
+}
+
END {
1 while unlink $Testfile, 'newfile';
File::Path::rmtree( 'ecmddir' );
+ File::Path::rmtree( 'd2utest' );
}
diff --git a/lib/ExtUtils/t/INST.t b/lib/ExtUtils/t/INST.t
index 3639acd11b..49938cb0d0 100644
--- a/lib/ExtUtils/t/INST.t
+++ b/lib/ExtUtils/t/INST.t
@@ -16,8 +16,9 @@ BEGIN {
}
use strict;
-use Test::More tests => 23;
+use Test::More tests => 26;
use MakeMaker::Test::Utils;
+use MakeMaker::Test::Setup::BFD;
use ExtUtils::MakeMaker;
use File::Spec;
use TieOut;
@@ -33,6 +34,12 @@ my $Makefile = makefile_name;
my $Curdir = File::Spec->curdir;
my $Updir = File::Spec->updir;
+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: $!");
diff --git a/lib/ExtUtils/t/INST_PREFIX.t b/lib/ExtUtils/t/INST_PREFIX.t
index 2d90a8c472..3c7d922c87 100644
--- a/lib/ExtUtils/t/INST_PREFIX.t
+++ b/lib/ExtUtils/t/INST_PREFIX.t
@@ -16,8 +16,9 @@ BEGIN {
}
use strict;
-use Test::More tests => 36;
+use Test::More tests => 52;
use MakeMaker::Test::Utils;
+use MakeMaker::Test::Setup::BFD;
use ExtUtils::MakeMaker;
use File::Spec;
use TieOut;
@@ -35,6 +36,12 @@ my $Makefile = makefile_name;
my $Curdir = File::Spec->curdir;
my $Updir = File::Spec->updir;
+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: $!");
@@ -55,6 +62,8 @@ like( $stdout->read, qr{
Writing\ $Makefile\ for\ Big::Dummy\n
}x );
+is( $mm->{PREFIX}, '$(SITEPREFIX)', 'PREFIX set based on INSTALLDIRS' );
+
isa_ok( $mm, 'ExtUtils::MakeMaker' );
is( $mm->{NAME}, 'Big::Dummy', 'NAME' );
@@ -112,18 +121,28 @@ my %Install_Vars = (
);
while( my($type, $vars) = each %Install_Vars) {
-
- SKIP: foreach my $var (@$vars) {
+ SKIP: {
skip "VMS must expand macros in INSTALL* vars", scalar @$vars
- if $Is_VMS;
-
- my $prefix = '$('.$type.'PREFIX)';
-
- # support for man page skipping
- $prefix = 'none' if $type eq 'PERL' &&
- $var =~ /man/ &&
- !$Config{"install$var"};
- like( $mm->{uc "install$var"}, qr/^\Q$prefix\E/, "$prefix + $var" );
+ if $Is_VMS;
+ skip '$Config{usevendorprefix} not set', scalar @$vars
+ if $type eq 'VENDOR' and !$Config{usevendorprefix};
+
+ foreach my $var (@$vars) {
+ my $installvar = "install$var";
+ my $prefix = '$('.$type.'PREFIX)';
+
+ SKIP: {
+ skip uc($installvar).' set to another INSTALL variable', 1
+ if $mm->{uc $installvar} =~ /^\$\(INSTALL.*\)$/;
+
+ # support for man page skipping
+ $prefix = 'none' if $type eq 'PERL' &&
+ $var =~ /man/ &&
+ !$Config{$installvar};
+ like( $mm->{uc $installvar}, qr/^\Q$prefix\E/,
+ "$prefix + $var" );
+ }
+ }
}
}
@@ -135,8 +154,8 @@ while( my($type, $vars) = each %Install_Vars) {
%ExtUtils::MM_Unix::Config = %Config;
*ExtUtils::MM_VMS::Config = \%ExtUtils::MM_Unix::Config;
- $ExtUtils::MM_Unix::Config{installman1dir} = '';
- $ExtUtils::MM_Unix::Config{installman3dir} = '';
+ _set_config(installman1dir => '');
+ _set_config(installman3dir => '');
my $wibble = File::Spec->catdir(qw(wibble and such));
my $stdout = tie *STDOUT, 'TieOut' or die;
@@ -163,11 +182,10 @@ while( my($type, $vars) = each %Install_Vars) {
%ExtUtils::MM_Unix::Config = %Config;
*ExtUtils::MM_VMS::Config = \%ExtUtils::MM_Unix::Config;
- $ExtUtils::MM_Unix::Config{installvendorman1dir} =
- File::Spec->catdir('foo','bar');
- $ExtUtils::MM_Unix::Config{installvendorman3dir} = '';
- $ExtUtils::MM_Unix::Config{usevendorprefix} = 1;
- $ExtUtils::MM_Unix::Config{vendorprefixexp} = 'something';
+ _set_config(installvendorman1dir => File::Spec->catdir('foo','bar') );
+ _set_config(installvendorman3dir => '' );
+ _set_config(usevendorprefix => 1 );
+ _set_config(vendorprefixexp => 'something' );
my $stdout = tie *STDOUT, 'TieOut' or die;
my $mm = WriteMakefile(
@@ -186,3 +204,82 @@ while( my($type, $vars) = each %Install_Vars) {
isnt( $mm->{INSTALLVENDORMAN3DIR}, '',
'installvendorman3dir (not in %Config) set' );
}
+
+# Check that when installsiteman*dir isn't set in Config it falls back
+# to installman*dir
+{
+ undef *ExtUtils::MM_Unix::Config;
+ undef *ExtUtils::MM_Unix::Config_Override;
+ %ExtUtils::MM_Unix::Config = %Config;
+ *ExtUtils::MM_VMS::Config = \%ExtUtils::MM_Unix::Config;
+
+ _set_config(installman1dir => File::Spec->catdir('foo', 'bar') );
+ _set_config(installman3dir => File::Spec->catdir('foo', 'baz') );
+ _set_config(installsiteman1dir => '' );
+ _set_config(installsiteman3dir => '' );
+ _set_config(installvendorman1dir => '' );
+ _set_config(installvendorman3dir => '' );
+ _set_config(usevendorprefix => 'define' );
+ _set_config(vendorprefixexp => 'something' );
+
+ 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',
+ PERL_CORE => $ENV{PERL_CORE},
+ );
+
+ is( $mm->{INSTALLMAN1DIR}, File::Spec->catdir('foo', 'bar') );
+ is( $mm->{INSTALLMAN3DIR}, File::Spec->catdir('foo', 'baz') );
+ is( $mm->{INSTALLSITEMAN1DIR}, '$(INSTALLMAN1DIR)' );
+ is( $mm->{INSTALLSITEMAN3DIR}, '$(INSTALLMAN3DIR)' );
+ is( $mm->{INSTALLVENDORMAN1DIR}, '$(INSTALLMAN1DIR)' );
+ is( $mm->{INSTALLVENDORMAN3DIR}, '$(INSTALLMAN3DIR)' );
+}
+
+
+# Check that when usevendoprefix and installvendorman*dir aren't set in
+# Config it leaves them unset.
+{
+ undef *ExtUtils::MM_Unix::Config;
+ undef *ExtUtils::MM_Unix::Config_Override;
+ %ExtUtils::MM_Unix::Config = %Config;
+ *ExtUtils::MM_VMS::Config = \%ExtUtils::MM_Unix::Config;
+
+ _set_config(installman1dir => File::Spec->catdir('foo', 'bar') );
+ _set_config(installman3dir => File::Spec->catdir('foo', 'baz') );
+ _set_config(installsiteman1dir => '' );
+ _set_config(installsiteman3dir => '' );
+ _set_config(installvendorman1dir => '' );
+ _set_config(installvendorman3dir => '' );
+ _set_config(usevendorprefix => '' );
+ _set_config(vendorprefixexp => '' );
+
+ 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',
+ PERL_CORE => $ENV{PERL_CORE},
+ );
+
+ is( $mm->{INSTALLMAN1DIR}, File::Spec->catdir('foo', 'bar') );
+ is( $mm->{INSTALLMAN3DIR}, File::Spec->catdir('foo', 'baz') );
+ is( $mm->{INSTALLSITEMAN1DIR}, '$(INSTALLMAN1DIR)' );
+ is( $mm->{INSTALLSITEMAN3DIR}, '$(INSTALLMAN3DIR)' );
+ is( $mm->{INSTALLVENDORMAN1DIR}, '' );
+ is( $mm->{INSTALLVENDORMAN3DIR}, '' );
+}
+
+
+sub _set_config {
+ my($k,$v) = @_;
+ (my $k_no_install = $k) =~ s/^install//i;
+ $ExtUtils::MM_Unix::Config{$k} = $v;
+
+ # Because VMS's config has traditionally been underpopulated, it will
+ # fall back to the install-less versions in desperation.
+ $ExtUtils::MM_Unix::Config{$k_no_install} = $v if $Is_VMS;
+ return;
+}
diff --git a/lib/ExtUtils/t/Install.t b/lib/ExtUtils/t/Install.t
index 13b3a6779c..6058811c26 100644
--- a/lib/ExtUtils/t/Install.t
+++ b/lib/ExtUtils/t/Install.t
@@ -17,7 +17,9 @@ use TieOut;
use File::Path;
use File::Spec;
-use Test::More tests => 29;
+use Test::More tests => 32;
+
+use MakeMaker::Test::Setup::BFD;
BEGIN { use_ok('ExtUtils::Install') }
@@ -27,6 +29,12 @@ foreach my $func (qw(install uninstall pm_to_blib install_default)) {
}
+ok( setup_recurs(), 'setup' );
+END {
+ ok( chdir File::Spec->updir );
+ ok( teardown_recurs(), 'teardown' );
+}
+
chdir 'Big-Dummy';
my $stdout = tie *STDOUT, 'TieOut';
diff --git a/lib/ExtUtils/t/MM_Cygwin.t b/lib/ExtUtils/t/MM_Cygwin.t
index 5b0b04f6c6..266c465940 100644
--- a/lib/ExtUtils/t/MM_Cygwin.t
+++ b/lib/ExtUtils/t/MM_Cygwin.t
@@ -85,7 +85,7 @@ like( $res, qr/pure_all.*foo.*foo.1/s, '... should add MAN3PODS targets' );
# init_linker
{
my $libperl = $Config{libperl} || 'libperl.a';
- $libperl =~ s/\.a/.dll.a/ if $] >= 5.007;
+ $libperl =~ s/\.a/.dll.a/ if $] >= 5.006002;
$libperl = "\$(PERL_INC)/$libperl";
my $export = '';
diff --git a/lib/ExtUtils/t/MM_Unix.t b/lib/ExtUtils/t/MM_Unix.t
index 6683761995..197f46a931 100644
--- a/lib/ExtUtils/t/MM_Unix.t
+++ b/lib/ExtUtils/t/MM_Unix.t
@@ -18,14 +18,12 @@ BEGIN {
plan skip_all => 'Non-Unix platform';
}
else {
- plan tests => 115;
+ plan tests => 110;
}
}
BEGIN { use_ok( 'ExtUtils::MM_Unix' ); }
-use vars qw($VERSION);
-$VERSION = '0.02';
use strict;
use File::Spec;
@@ -74,7 +72,6 @@ foreach ( qw /
const_loadlibs
constants
depend
- dir_target
dist
dist_basics
dist_ci
@@ -174,42 +171,23 @@ is ($t->libscan('Fatty'), 'Fatty', 'libscan on something not a VC file' );
###############################################################################
# maybe_command
-is ($t->maybe_command('blargel'),undef,"'blargel' isn't a 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");
+unlink "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)
+my $self_name = $ENV{PERL_CORE} ? '../lib/ExtUtils/t/MM_Unix.t'
+ : 'MM_Unix.t';
is ($t->perl_script($self_name),$self_name, 'we pass as a perl_script()');
###############################################################################
diff --git a/lib/ExtUtils/t/MM_Win32.t b/lib/ExtUtils/t/MM_Win32.t
index e980b1a84e..1431ababd0 100644
--- a/lib/ExtUtils/t/MM_Win32.t
+++ b/lib/ExtUtils/t/MM_Win32.t
@@ -84,7 +84,7 @@ delete $ENV{PATHEXT} unless $had_pathext;
{
my $my_perl = $1 if $^X =~ /(.*)/; # are we in -T or -t?
my( $perl, $path ) = fileparse( $my_perl );
- like( $MM->find_perl( $], [ $perl ], [ $path ], 0 ),
+ like( $MM->find_perl( $], [ $perl ], [ $path ], 0 ),
qr/^\Q$my_perl\E$/i, 'find_perl() finds this perl' );
}
diff --git a/lib/ExtUtils/t/Manifest.t b/lib/ExtUtils/t/Manifest.t
index 215a24b14e..396789e7b5 100644
--- a/lib/ExtUtils/t/Manifest.t
+++ b/lib/ExtUtils/t/Manifest.t
@@ -13,13 +13,14 @@ chdir 't';
use strict;
-# these files help the test run
-use Test::More tests => 41;
+use Test::More tests => 49;
use Cwd;
-# these files are needed for the module itself
use File::Spec;
use File::Path;
+use File::Find;
+
+my $Is_VMS = $^O eq 'VMS';
# We're going to be chdir'ing and modules are sometimes loaded on the
# fly in this test, so we need an absolute @INC.
@@ -38,20 +39,20 @@ sub add_file {
}
sub read_manifest {
- open( M, 'MANIFEST' ) or return;
- chomp( my @files = <M> );
+ open( M, 'MANIFEST' ) or return;
+ chomp( my @files = <M> );
close M;
- return @files;
+ return @files;
}
sub catch_warning {
- my $warn;
- local $SIG{__WARN__} = sub { $warn .= $_[0] };
- return join('', $_[0]->() ), $warn;
+ my $warn;
+ local $SIG{__WARN__} = sub { $warn .= $_[0] };
+ return join('', $_[0]->() ), $warn;
}
sub remove_dir {
- ok( rmdir( $_ ), "remove $_ directory" ) for @_;
+ ok( rmdir( $_ ), "remove $_ directory" ) for @_;
}
# use module, import functions
@@ -134,13 +135,33 @@ is( join(' ', sort { lc($a) cmp lc($b) } keys %$files), 'foo MANIFEST',
'both files found' );
is( $_, 'foo', q{maniread() doesn't clobber $_} );
+ok( mkdir( 'copy', 0777 ), 'made copy directory' );
+
+# Check that manicopy copies files.
+manicopy( $files, 'copy', 'cp' );
+my @copies = ();
+find( sub { push @copies, $_ if -f }, 'copy' );
+@copies = map { s/\.$//; $_ } @copies if $Is_VMS; # VMS likes to put dots on
+ # the end of files.
+# Have to compare insensitively for non-case preserving VMS
+is_deeply( [sort map { lc } @copies], [sort map { lc } keys %$files] );
+
+# cp would leave files readonly, so check permissions.
+foreach my $orig (@copies) {
+ my $copy = "copy/$orig";
+ ok( -r $copy, "$copy: must be readable" );
+ is( -w $copy, -w $orig, " writable if original was" );
+ is( -x $copy, -x $orig, " executable if original was" );
+}
+rmtree('copy');
+
+
# 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' ) })
@@ -220,7 +241,7 @@ SKIP: {
chmod( 0600, 'MANIFEST' );
}
-
+
END {
is( unlink( keys %Files ), keys %Files, 'remove all added files' );
diff --git a/lib/ExtUtils/t/basic.t b/lib/ExtUtils/t/basic.t
index 960a75dfdf..c8c2ad33ba 100644
--- a/lib/ExtUtils/t/basic.t
+++ b/lib/ExtUtils/t/basic.t
@@ -16,8 +16,9 @@ BEGIN {
use strict;
use Config;
-use Test::More tests => 73;
+use Test::More tests => 79;
use MakeMaker::Test::Utils;
+use MakeMaker::Test::Setup::BFD;
use File::Find;
use File::Spec;
use File::Path;
@@ -38,6 +39,12 @@ 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: $!");
@@ -226,13 +233,20 @@ my $manifest = maniread();
# look like. :(
_normalize($manifest);
is( $manifest->{'meta.yml'}, 'Module meta-data (added by MakeMaker)' );
+my $meta_mtime = (stat('META.yml'))[9];
+
+sleep 1;
+my $metafile_out = run("$make metafile");
+is( $?, 0, 'metafile' ) || diag($metafile_out);
+is( (stat('META.yml'))[9], $meta_mtime, 'META.yml untouched if not changed' );
+ok( !-e 'META_new.yml', 'temp META.yml file not left around' );
# Test NO_META META.yml suppression
unlink 'META.yml';
ok( !-f 'META.yml', 'META.yml deleted' );
@mpl_out = run(qq{$perl Makefile.PL "NO_META=1"});
cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || diag(@mpl_out);
-my $metafile_out = run("$make metafile");
+$metafile_out = run("$make metafile");
is( $?, 0, 'metafile' ) || diag($metafile_out);
ok( !-f 'META.yml', 'META.yml generation suppressed by NO_META' );
diff --git a/lib/ExtUtils/t/parse_version.t b/lib/ExtUtils/t/parse_version.t
new file mode 100644
index 0000000000..9ddc8a09a4
--- /dev/null
+++ b/lib/ExtUtils/t/parse_version.t
@@ -0,0 +1,34 @@
+#!/usr/bin/perl -w
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't';
+ @INC = '../lib';
+ }
+ else {
+ unshift @INC, 't/lib';
+ }
+}
+chdir 't';
+
+use Test::More 'no_plan';
+use ExtUtils::MakeMaker;
+
+my %versions = ('$VERSION = 0.02' => 0.02,
+ '$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;
+
+ $_ = 'foo';
+ is( MM->parse_version('VERSION.tmp'), $expect, $code );
+ is( $_, 'foo', '$_ not leaked by parse_version' );
+
+ unlink "VERSION.tmp";
+}
diff --git a/lib/ExtUtils/t/postamble.t b/lib/ExtUtils/t/postamble.t
index b8c049277f..2b47b12e4e 100644
--- a/lib/ExtUtils/t/postamble.t
+++ b/lib/ExtUtils/t/postamble.t
@@ -13,8 +13,9 @@ BEGIN {
}
use strict;
-use Test::More tests => 5;
+use Test::More tests => 8;
use MakeMaker::Test::Utils;
+use MakeMaker::Test::Setup::BFD;
use ExtUtils::MakeMaker;
use TieOut;
@@ -24,6 +25,12 @@ $| = 1;
my $Makefile = makefile_name;
+ok( setup_recurs(), 'setup' );
+END {
+ ok( chdir File::Spec->updir );
+ ok( teardown_recurs(), 'teardown' );
+}
+
ok( chdir 'Big-Dummy', q{chdir'd to Big-Dummy} ) ||
diag("chdir failed: $!");
diff --git a/lib/ExtUtils/t/prefixify.t b/lib/ExtUtils/t/prefixify.t
index 644bc00e8a..6faa943ac0 100644
--- a/lib/ExtUtils/t/prefixify.t
+++ b/lib/ExtUtils/t/prefixify.t
@@ -23,6 +23,8 @@ use Config;
use File::Spec;
use ExtUtils::MM;
+my $Is_Dosish = $^O =~ /^(dos|MSWin32)$/;
+
my $mm = bless {}, 'MM';
my $default = File::Spec->catdir(qw(this that));
@@ -36,11 +38,12 @@ $mm->prefixify('installbin', 'wibble', 'something', $default);
is( $mm->{INSTALLBIN}, File::Spec->catdir('something', $default),
'prefixify w/defaults and PREFIX');
-{
+SKIP: {
+ skip "Test for DOSish prefixification", 1 unless $Is_Dosish;
+
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/lib/ExtUtils/t/prereq_print.t b/lib/ExtUtils/t/prereq_print.t
index 78dc6e8e1f..05790e5834 100644
--- a/lib/ExtUtils/t/prereq_print.t
+++ b/lib/ExtUtils/t/prereq_print.t
@@ -13,8 +13,9 @@ BEGIN {
use strict;
use Config;
-use Test::More tests => 8;
+use Test::More tests => 11;
use MakeMaker::Test::Utils;
+use MakeMaker::Test::Setup::BFD;
# 'make disttest' sets a bunch of environment variables which interfere
# with our testing.
@@ -29,6 +30,12 @@ perl_lib;
$| = 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: $!");
diff --git a/lib/ExtUtils/t/problems.t b/lib/ExtUtils/t/problems.t
index e9162d2032..8708532d1b 100644
--- a/lib/ExtUtils/t/problems.t
+++ b/lib/ExtUtils/t/problems.t
@@ -12,12 +12,19 @@ BEGIN {
chdir 't';
use strict;
-use Test::More tests => 3;
+use Test::More tests => 6;
use ExtUtils::MM;
+use MakeMaker::Test::Setup::Problem;
use TieOut;
my $MM = bless { DIR => ['subdir'] }, 'MM';
+ok( setup_recurs(), 'setup' );
+END {
+ ok( chdir File::Spec->updir );
+ ok( teardown_recurs(), 'teardown' );
+}
+
ok( chdir 'Problem-Module', "chdir'd to Problem-Module" ) ||
diag("chdir failed: $!");
diff --git a/lib/ExtUtils/t/writemakefile_args.t b/lib/ExtUtils/t/writemakefile_args.t
index f4b4daf6e3..a19a5ee644 100644
--- a/lib/ExtUtils/t/writemakefile_args.t
+++ b/lib/ExtUtils/t/writemakefile_args.t
@@ -14,10 +14,11 @@ BEGIN {
}
use strict;
-use Test::More tests => 13;
+use Test::More tests => 16;
use TieOut;
use MakeMaker::Test::Utils;
+use MakeMaker::Test::Setup::BFD;
use ExtUtils::MakeMaker;
@@ -25,6 +26,12 @@ 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: $!");
diff --git a/lib/ExtUtils/t/zz_cleanup_dummy.t b/lib/ExtUtils/t/zz_cleanup_dummy.t
deleted file mode 100644
index 1b01f0a5d0..0000000000
--- a/lib/ExtUtils/t/zz_cleanup_dummy.t
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/usr/bin/perl -w
-
-BEGIN {
- if( $ENV{PERL_CORE} ) {
- @INC = ('../lib', 'lib');
- }
- else {
- unshift @INC, 't/lib';
- }
-}
-chdir($^O eq 'VMS' ? 'BFD_TEST_ROOT:[t]' : 't');
-
-
-use strict;
-use Test::More tests => 3;
-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');
-rmtree('dummy-install');
-ok(!-d 'dummy-install', 'dummy-install cleaned up');