summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/perl/cpan/ExtUtils-MakeMaker/t/basic.t
diff options
context:
space:
mode:
authorafresh1 <afresh1@openbsd.org>2019-02-13 21:15:00 +0000
committerafresh1 <afresh1@openbsd.org>2019-02-13 21:15:00 +0000
commit9f11ffb7133c203312a01e4b986886bc88c7d74b (patch)
tree6618511204c614b20256e4ef9dea39a7b311d638 /gnu/usr.bin/perl/cpan/ExtUtils-MakeMaker/t/basic.t
parentImport perl-5.28.1 (diff)
downloadwireguard-openbsd-9f11ffb7133c203312a01e4b986886bc88c7d74b.tar.xz
wireguard-openbsd-9f11ffb7133c203312a01e4b986886bc88c7d74b.zip
Fix merge issues, remove excess files - match perl-5.28.1 dist
looking good sthen@, Great! bluhm@
Diffstat (limited to 'gnu/usr.bin/perl/cpan/ExtUtils-MakeMaker/t/basic.t')
-rwxr-xr-xgnu/usr.bin/perl/cpan/ExtUtils-MakeMaker/t/basic.t127
1 files changed, 91 insertions, 36 deletions
diff --git a/gnu/usr.bin/perl/cpan/ExtUtils-MakeMaker/t/basic.t b/gnu/usr.bin/perl/cpan/ExtUtils-MakeMaker/t/basic.t
index f58211ae00d..534bf219f6c 100755
--- a/gnu/usr.bin/perl/cpan/ExtUtils-MakeMaker/t/basic.t
+++ b/gnu/usr.bin/perl/cpan/ExtUtils-MakeMaker/t/basic.t
@@ -20,11 +20,11 @@ use utf8;
use MakeMaker::Test::Utils;
use MakeMaker::Test::Setup::BFD;
use Config;
-use Test::More;
use ExtUtils::MM;
-plan !MM->can_run(make()) && $ENV{PERL_CORE} && $Config{'usecrosscompile'}
+use Test::More
+ !MM->can_run(make()) && $ENV{PERL_CORE} && $Config{'usecrosscompile'}
? (skip_all => "cross-compiling and make not available")
- : (tests => 171);
+ : (tests => 188);
use File::Find;
use File::Spec;
use File::Path;
@@ -55,28 +55,31 @@ END {
}
}
-my $tmpdir = tempdir( DIR => 't', CLEANUP => 1 );
-chdir $tmpdir;
+chdir 't';
+perl_lib; # sets $ENV{PERL5LIB} relative to t/
-perl_lib;
+my $tmpdir = tempdir( DIR => '../t', CLEANUP => 1 );
+use Cwd; my $cwd = getcwd; END { chdir $cwd } # so File::Temp can cleanup
+chdir $tmpdir;
my $Touch_Time = calibrate_mtime();
$| = 1;
ok( setup_recurs(), 'setup' );
-END {
- ok chdir File::Spec->updir or die;
- ok teardown_recurs, "teardown";
-}
ok( chdir('Big-Dummy'), "chdir'd to Big-Dummy" ) ||
diag("chdir failed: $!");
-sub extrachar { $] > 5.008 && !$ENV{PERL_CORE} ? utf8::decode(my $c='š') : 's' }
+sub extrachar {
+ return 's'
+ if 1; # until Perl gains native support for Unicode filenames
+# if $] <= 5.008 || $ENV{PERL_CORE}
+# || $^O =~ /bsd|dragonfly|mswin32/i;
+ 'š';
+}
my $DUMMYINST = '../dummy-in'.extrachar().'tall';
my @mpl_out = run(qq{$perl Makefile.PL "PREFIX=$DUMMYINST"});
-END { rmtree $DUMMYINST; }
cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) ||
diag(@mpl_out);
@@ -96,8 +99,6 @@ ok( -e $makefile, 'Makefile exists' );
my $mtime = (stat($makefile))[9];
cmp_ok( $Touch_Time, '<=', $mtime, ' been touched' );
-END { unlink makefile_name(), makefile_backup() }
-
my $make = make_run();
{
@@ -108,8 +109,6 @@ my $make = make_run();
ok( -s 'MANIFEST', ' not empty' );
}
-END { unlink 'MANIFEST'; }
-
my $ppd_out = run("$make ppd");
is( $?, 0, ' exited normally' ) || diag $ppd_out;
ok( open(PPD, 'Big-Dummy.ppd'), ' .ppd file generated' );
@@ -138,8 +137,6 @@ like( $ppd_html, qr{^\s*<ARCHITECTURE NAME="$archname" />}m,
like( $ppd_html, qr{^\s*<CODEBASE HREF="" />}m, ' <CODEBASE>');
like( $ppd_html, qr{^\s*</IMPLEMENTATION>}m, ' </IMPLEMENTATION>');
like( $ppd_html, qr{^\s*</SOFTPKG>}m, ' </SOFTPKG>');
-END { unlink 'Big-Dummy.ppd' }
-
my $test_out = run("$make test");
like( $test_out, qr/All tests successful/, 'make test' );
@@ -150,10 +147,28 @@ is( $?, 0, ' exited normally' ) ||
my $make_test_verbose = make_macro($make, 'test', TEST_VERBOSE => 1);
$test_out = run("$make_test_verbose");
like( $test_out, qr/ok \d+ - TEST_VERBOSE/, 'TEST_VERBOSE' );
+like( $test_out, qr/ok \d+ - testing test.pl/, 'test.pl' ); # in test.pl
+like( $test_out, qr/ok \d+ - testing t\/\*.t/, 't/*.t' ); # in *.t
like( $test_out, qr/All tests successful/, ' successful' );
is( $?, 0, ' exited normally' ) ||
diag $test_out;
+# Test 'make testdb TEST_FILE=t/compile.t'
+# TESTDB_SW override is because perl -d is too clever for me to outwit
+my $make_testdb_file = make_macro(
+ $make,
+ 'testdb',
+ TEST_FILE => 't/compile.t',
+ TESTDB_SW => '-Ixyzzy',
+);
+$test_out = run($make_testdb_file);
+unlike( $test_out, qr/harness/, 'no harness' );
+unlike( $test_out, qr/sanity\.t/, 'no wrong test' );
+like( $test_out, qr/compile\.t/, 'get right test' );
+like( $test_out, qr/xyzzy/, 'signs of TESTDB_SW' );
+is( $?, 0, ' exited normally' ) ||
+ diag $test_out;
+
# now simulate what Module::Install does, and edit $(PERL) to add flags
open my $fh, '<', $makefile;
my $mtext = join '', <$fh>;
@@ -168,7 +183,7 @@ is( $?, 0, 'install' ) || diag $install_out;
like( $install_out, qr/^Installing /m );
sub check_dummy_inst {
- my $loc = shift;
+ my ($loc, $skipsubdir) = @_;
my %files = ();
find( sub {
# do it case-insensitive for non-case preserving OSs
@@ -178,7 +193,7 @@ sub check_dummy_inst {
$files{$file} = $File::Find::name;
}, $loc );
ok( $files{'dummy.pm'}, ' Dummy.pm installed' );
- ok( $files{'liar.pm'}, ' Liar.pm installed' );
+ ok( $files{'liar.pm'}, ' Liar.pm installed' ) unless $skipsubdir;
ok( $files{'program'}, ' program installed' );
ok( $files{'.packlist'}, ' packlist created' );
ok( $files{'perllocal.pod'},' perllocal.pod created' );
@@ -249,22 +264,28 @@ SKIP: {
rmtree('other');
}
+my ($dist_test_out, $distdir, $meta_yml, $mymeta_yml, $meta_json, $mymeta_json);
+SKIP: {
+ skip 'disttest depends on metafile, which is not run in core', 1 if $ENV{PERL_CORE};
+ $dist_test_out = run("$make disttest");
+ is( $?, 0, 'disttest' ) || diag($dist_test_out);
+
+ # Test META.yml generation
+ use ExtUtils::Manifest qw(maniread);
+
+ $distdir = 'Big-Dummy-0.01';
+ $distdir =~ s/\./_/g if $Is_VMS;
+ $meta_yml = "$distdir/META.yml";
+ $mymeta_yml = "$distdir/MYMETA.yml";
+ $meta_json = "$distdir/META.json";
+ $mymeta_json = "$distdir/MYMETA.json";
+}
-my $dist_test_out = run("$make disttest");
-is( $?, 0, 'disttest' ) || diag($dist_test_out);
-
-# Test META.yml generation
-use ExtUtils::Manifest qw(maniread);
-
-my $distdir = 'Big-Dummy-0.01';
-$distdir =~ s/\./_/g if $Is_VMS;
-my $meta_yml = "$distdir/META.yml";
-my $mymeta_yml = "$distdir/MYMETA.yml";
-my $meta_json = "$distdir/META.json";
-my $mymeta_json = "$distdir/MYMETA.json";
+note "META file validity"; SKIP: {
+ skip 'disttest depends on metafile, which is not run in core', 104 if $ENV{PERL_CORE};
-note "META file validity"; {
- require CPAN::Meta;
+ eval { require CPAN::Meta; };
+ skip 'Loading CPAN::Meta failed', 104 if $@;
ok( !-f 'META.yml', 'META.yml not written to source dir' );
ok( -f $meta_yml, 'META.yml written to dist dir' );
@@ -346,7 +367,7 @@ note "META file validity"; {
"MANIFEST has META.yml"
);
is( $manifest->{'meta.json'}, 'Module JSON meta-data (added by MakeMaker)',
- "MANFIEST has META.json"
+ "MANIFEST has META.json"
);
# Test NO_META META.yml suppression
@@ -417,8 +438,12 @@ note "META file validity"; {
}
-
# Make sure init_dirscan doesn't go into the distdir
+# also with a "messup.PL" that will make a build fail
+open $fh, '>', 'messup.PL' or die "messup.PL: $!";
+print $fh 'print "Extracting messup (with variable substitutions)\n";' . "\n";
+print $fh 'die';
+close $fh;
@mpl_out = run(qq{$perl Makefile.PL "PREFIX=$DUMMYINST"});
cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || diag(@mpl_out);
@@ -427,6 +452,14 @@ ok( grep(/^Writing $makefile for Big::Dummy/, @mpl_out) == 1,
'init_dirscan skipped distdir') ||
diag(@mpl_out);
+# "make test" straight after "perl Makefile.PL" is expected to work same as
+# "make all test" so check that with "messup.PL" that will make the
+# build step fail
+$test_out = run("$make test");
+unlike( $test_out, qr/All tests successful/, 'make test caused build' );
+isnt( $?, 0, ' build should fail' ) ||
+ diag $test_out;
+
# I know we'll get ignored errors from make here, that's ok.
# Send STDERR off to oblivion.
open(SAVERR, ">&STDERR") or die $!;
@@ -434,10 +467,32 @@ open(STDERR, ">",File::Spec->devnull) or die $!;
my $realclean_out = run("$make realclean");
is( $?, 0, 'realclean' ) || diag($realclean_out);
+1 while unlink 'messup.PL'; # also zap deliberate build-breaker
open(STDERR, ">&SAVERR") or die $!;
close SAVERR;
+# test linkext=>{LINKTYPE=>''} still installs a pure-perl installation
+# warning, edits the Makefile.PL so either rewrite after this or do this last
+my $file = 'Makefile.PL';
+my $text = slurp $file;
+ok(($text =~ s#\);# linkext=>{LINKTYPE=>''},\n$&#), 'successful M.PL edit');
+open $fh, '>', $file or die "$file: $!";
+print $fh $text;
+close $fh;
+# now do with "Liar" subdir still there
+rmtree $DUMMYINST; # so no false positive from before
+@mpl_out = run(qq{$perl Makefile.PL "PREFIX=$DUMMYINST"});
+$install_out = run("$make install");
+check_dummy_inst($DUMMYINST);
+# now clean, delete "Liar" subdir, do again
+$realclean_out = run("$make realclean");
+rmtree 'Liar';
+rmtree $DUMMYINST; # so no false positive from before
+@mpl_out = run(qq{$perl Makefile.PL "PREFIX=$DUMMYINST"});
+$install_out = run("$make install");
+check_dummy_inst($DUMMYINST, 1);
+
sub _normalize {
my $hash = shift;