diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2005-04-07 08:07:14 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2005-04-07 08:07:14 +0000 |
commit | 7292dc67d9d3871d00ae8272949316f40122092b (patch) | |
tree | a3746b11dba7cde6b8865d7b7d14bd693a97e874 /t | |
parent | aeef272316a199aeddb8b9a9713adffbef5806b1 (diff) | |
download | perl-7292dc67d9d3871d00ae8272949316f40122092b.tar.gz |
Upgrade to ExtUtils::MakeMaker 6.27,
plus a patch to restore functioning of 'distclean'
for the perl core
p4raw-id: //depot/perl@24185
Diffstat (limited to 't')
-rw-r--r-- | t/lib/MakeMaker/Test/Setup/BFD.pm | 37 | ||||
-rw-r--r-- | t/lib/MakeMaker/Test/Setup/PL_FILES.pm | 78 | ||||
-rw-r--r-- | t/lib/MakeMaker/Test/Setup/Recurs.pm | 4 | ||||
-rw-r--r-- | t/lib/MakeMaker/Test/Utils.pm | 68 |
4 files changed, 164 insertions, 23 deletions
diff --git a/t/lib/MakeMaker/Test/Setup/BFD.pm b/t/lib/MakeMaker/Test/Setup/BFD.pm index 2509a2cfb0..c540708529 100644 --- a/t/lib/MakeMaker/Test/Setup/BFD.pm +++ b/t/lib/MakeMaker/Test/Setup/BFD.pm @@ -7,7 +7,9 @@ require Exporter; use strict; use File::Path; use File::Basename; +use MakeMaker::Test::Utils; +my $Is_VMS = $^O eq 'VMS'; my %Files = ( 'Big-Dummy/lib/Big/Dummy.pm' => <<'END', @@ -33,12 +35,25 @@ printf "Current package is: %s\n", __PACKAGE__ unless "@ARGV" =~ /PREREQ/; WriteMakefile( NAME => 'Big::Dummy', VERSION_FROM => 'lib/Big/Dummy.pm', + EXE_FILES => [qw(bin/program)], PREREQ_PM => { strict => 0 }, ABSTRACT_FROM => 'lib/Big/Dummy.pm', AUTHOR => 'Michael G Schwern <schwern@pobox.com>', ); END + 'Big-Dummy/bin/program' => <<'END', +#!/usr/bin/perl -w + +=head1 NAME + +program - this is a program + +=cut + +1; +END + 'Big-Dummy/t/compile.t' => <<'END', print "1..2\n"; @@ -80,27 +95,9 @@ END ); -sub _setup_bfd_test_root { - 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'; - } -} - sub setup_recurs { - _setup_bfd_test_root(); + setup_mm_test_root(); + chdir 'MM_TEST_ROOT:[t]' if $Is_VMS; while(my($file, $text) = each %Files) { # Convert to a relative, native file path. diff --git a/t/lib/MakeMaker/Test/Setup/PL_FILES.pm b/t/lib/MakeMaker/Test/Setup/PL_FILES.pm new file mode 100644 index 0000000000..73b77e3a7f --- /dev/null +++ b/t/lib/MakeMaker/Test/Setup/PL_FILES.pm @@ -0,0 +1,78 @@ +package MakeMaker::Test::Setup::PL_FILES; + +@ISA = qw(Exporter); +require Exporter; +@EXPORT = qw(setup teardown); + +use strict; +use File::Path; +use File::Basename; +use File::Spec; +use MakeMaker::Test::Utils; + +my %Files = ( + 'PL_FILES-Module/Makefile.PL' => <<'END', +use ExtUtils::MakeMaker; + +# A module for testing PL_FILES +WriteMakefile( + NAME => 'PL_FILES::Module', + PL_FILES => { 'single.PL' => 'single.out', + 'multi.PL' => [qw(1.out 2.out)] + } +); +END + + 'PL_FILES-Module/single.PL' => _gen_pl_files(), + 'PL_FILES-Module/multi.PL' => _gen_pl_files(), +); + + +sub _gen_pl_files { + my $test = <<'END'; +#!/usr/bin/perl -w + +# Had a bug where PL_FILES weren't sent the file to generate +die "argv empty\n" unless @ARGV; +die "too many in argv: @ARGV\n" unless @ARGV == 1; + +my $file = $ARGV[0]; +open OUT, ">$file" or die $!; + +print OUT "Testing\n"; +close OUT +END + + $test =~ s/^\n//; + + return $test; +} + + +sub setup { + setup_mm_test_root(); + chdir 'MM_TEST_ROOT:[t]' if $^O eq 'VMS'; + + 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") || die "Can't create $file: $!"; + print FILE $text; + close FILE; + } + + return 1; +} + +sub teardown { + foreach my $file (keys %Files) { + my $dir = dirname($file); + if( -e $dir ) { + rmtree($dir) || return; + } + } + return 1; +} diff --git a/t/lib/MakeMaker/Test/Setup/Recurs.pm b/t/lib/MakeMaker/Test/Setup/Recurs.pm index 805be94db3..c8b7379348 100644 --- a/t/lib/MakeMaker/Test/Setup/Recurs.pm +++ b/t/lib/MakeMaker/Test/Setup/Recurs.pm @@ -7,6 +7,7 @@ require Exporter; use strict; use File::Path; use File::Basename; +use MakeMaker::Test::Utils; my %Files = ( 'Recurs/Makefile.PL' => <<'END', @@ -29,6 +30,9 @@ END ); sub setup_recurs { + setup_mm_test_root(); + chdir 'MM_TEST_ROOT:[t]' if $^O eq 'VMS'; + while(my($file, $text) = each %Files) { # Convert to a relative, native file path. $file = File::Spec->catfile(File::Spec->curdir, split m{\/}, $file); diff --git a/t/lib/MakeMaker/Test/Utils.pm b/t/lib/MakeMaker/Test/Utils.pm index be3ec73d74..0d6afc33ab 100644 --- a/t/lib/MakeMaker/Test/Utils.pm +++ b/t/lib/MakeMaker/Test/Utils.pm @@ -9,10 +9,12 @@ use vars qw($VERSION @ISA @EXPORT); require Exporter; @ISA = qw(Exporter); -$VERSION = 0.02; +$VERSION = 0.03; @EXPORT = qw(which_perl perl_lib makefile_name makefile_backup make make_run run make_macro calibrate_mtime + setup_mm_test_root + have_compiler ); my $Is_VMS = $^O eq 'VMS'; @@ -41,6 +43,9 @@ MakeMaker::Test::Utils - Utility routines for testing MakeMaker my $out = run($cmd); + my $have_compiler = have_compiler(); + + =head1 DESCRIPTION A consolidation of little utility functions used through out the @@ -144,7 +149,7 @@ Makefile. sub makefile_backup { my $makefile = makefile_name; - return $Is_VMS ? $makefile : "$makefile.old"; + return $Is_VMS ? "$makefile".'_old' : "$makefile.old"; } =item B<make> @@ -258,7 +263,64 @@ sub run { else { return `$cmd`; } -} +} + +=item B<setup_mm_test_root> + +Creates a rooted logical to avoid the 8-level limit on older VMS systems. +No action taken on non-VMS systems. + +=cut + +sub setup_mm_test_root { + if( $Is_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( MMTMP, '>mmtesttmp.com' ) || + die "Error creating command file; $!"; + print MMTMP <<'COMMAND'; +$ MM_TEST_ROOT = F$PARSE("SYS$DISK:[-]",,,,"NO_CONCEAL")-".][000000"-"]["-"].;"+".]" +$ DEFINE/JOB/NOLOG/TRANSLATION=CONCEALED MM_TEST_ROOT 'MM_TEST_ROOT' +COMMAND + close MMTMP; + + system '@mmtesttmp.com'; + 1 while unlink 'mmtesttmp.com'; + } +} + +=item have_compiler + + $have_compiler = have_compiler; + +Returns true if there is a compiler available for XS builds. + +=cut + +sub have_compiler { + my $have_compiler = 0; + + # ExtUtils::CBuilder prints its compilation lines to the screen. + # Shut it up. + require TieOut; + local *STDOUT = *STDOUT; + local *STDERR = *STDERR; + + tie *STDOUT, 'TieOut'; + tie *STDERR, 'TieOut'; + + eval { + require ExtUtils::CBuilder; + my $cb = ExtUtils::CBuilder->new; + + $have_compiler = $cb->have_compiler; + }; + + return $have_compiler; +} + =back |