test failure: lib/ExtUtils/t/Installed.t
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / t / basic.t
CommitLineData
75e2e551 1#!/usr/bin/perl -w
2
3# This test puts MakeMaker through the paces of a basic perl module
4# build, test and installation of the Big::Fat::Dummy module.
5
6BEGIN {
7 if( $ENV{PERL_CORE} ) {
8 chdir 't' if -d 't';
9 @INC = ('../lib', 'lib');
10 }
11 else {
12 unshift @INC, 't/lib';
13 }
14}
15
16use strict;
e0678a30 17use Test::More tests => 17;
75e2e551 18use MakeMaker::Test::Utils;
19use File::Spec;
20use TieOut;
21
e0678a30 22my $perl = which_perl();
75e2e551 23
57b1a898 24my $root_dir = 't';
25
26if( $^O eq 'VMS' ) {
27 # On older systems we might exceed the 8-level directory depth limit
28 # imposed by RMS. We get around this with a rooted logical, but we
29 # can't create logical names with attributes in Perl, so we do it
30 # in a DCL subprocess and put it in the job table so the parent sees it.
31 open( BFDTMP, '>bfdtesttmp.com' ) || die "Error creating command file; $!";
32 print BFDTMP <<'COMMAND';
a67d7a01 33$ IF F$TRNLNM("PERL_CORE") .EQS. "" .AND. F$TYPE(PERL_CORE) .EQS. ""
34$ THEN
35$! building CPAN version
7a069417 36$ BFD_TEST_ROOT = F$PARSE("SYS$DISK:[]",,,,"NO_CONCEAL")-".][000000"-"]["-"].;"+".]"
a67d7a01 37$ ELSE
38$! we're in the core
7a069417 39$ BFD_TEST_ROOT = F$PARSE("SYS$DISK:[-]",,,,"NO_CONCEAL")-".][000000"-"]["-"].;"+".]"
a67d7a01 40$ ENDIF
57b1a898 41$ DEFINE/JOB/NOLOG/TRANSLATION=CONCEALED BFD_TEST_ROOT 'BFD_TEST_ROOT'
42COMMAND
43 close BFDTMP;
44
45 system '@bfdtesttmp.com';
46 END { 1 while unlink 'bfdtesttmp.com' }
7a069417 47 $root_dir = 'BFD_TEST_ROOT:[t]';
57b1a898 48}
49
50chdir $root_dir;
51
75e2e551 52
53perl_lib;
54
e0678a30 55my $Touch_Time = calibrate_mtime();
56
75e2e551 57$| = 1;
58
45bc4d3a 59ok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) ||
75e2e551 60 diag("chdir failed: $!");
61
75e2e551 62my @mpl_out = `$perl Makefile.PL PREFIX=dummy-install`;
63
64cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) ||
65 diag(@mpl_out);
66
67my $makefile = makefile_name();
45bc4d3a 68ok( grep(/^Writing $makefile for Big::Dummy/,
75e2e551 69 @mpl_out) == 1,
70 'Makefile.PL output looks right');
71
72ok( grep(/^Current package is: main$/,
73 @mpl_out) == 1,
74 'Makefile.PL run in package main');
75
76ok( -e $makefile, 'Makefile exists' );
77
e0678a30 78# -M is flakey on VMS
79my $mtime = (stat($makefile))[9];
80cmp_ok( $Touch_Time, '<=', $mtime, ' its been touched' );
75e2e551 81
82END { unlink makefile_name(), makefile_backup() }
83
84my $make = make_run();
85
86{
87 # Supress 'make manifest' noise
88 local $ENV{PERL_MM_MANIFEST_VERBOSE} = 0;
89 my $manifest_out = `$make manifest`;
90 ok( -e 'MANIFEST', 'make manifest created a MANIFEST' );
91 ok( -s 'MANIFEST', ' its not empty' );
92}
93
94END { unlink 'MANIFEST'; }
95
96my $test_out = `$make test`;
97like( $test_out, qr/All tests successful/, 'make test' );
98is( $?, 0 );
99
100# Test 'make test TEST_VERBOSE=1'
101my $make_test_verbose = make_macro($make, 'test', TEST_VERBOSE => 1);
102$test_out = `$make_test_verbose`;
103like( $test_out, qr/ok \d+ - TEST_VERBOSE/, 'TEST_VERBOSE' );
104like( $test_out, qr/All tests successful/, ' successful' );
105is( $?, 0 );
106
45bc4d3a 107my $dist_test_out = `$make disttest`;
75e2e551 108is( $?, 0, 'disttest' ) || diag($dist_test_out);
109
e0678a30 110
111# Make sure init_dirscan doesn't go into the distdir
112@mpl_out = `$perl Makefile.PL "PREFIX=dummy-install"`;
113
114cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) ||
115 diag(@mpl_out);
116
45bc4d3a 117ok( grep(/^Writing $makefile for Big::Dummy/,
e0678a30 118 @mpl_out) == 1,
119 'init_dirscan skipped distdir') ||
120 diag(@mpl_out);
121
122# I know we'll get ignored errors from make here, that's ok.
123# Send STDERR off to oblivion.
124open(SAVERR, ">&STDERR") or die $!;
125open(STDERR, ">".File::Spec->devnull) or die $!;
126
75e2e551 127my $realclean_out = `$make realclean`;
128is( $?, 0, 'realclean' ) || diag($realclean_out);
129
e0678a30 130open(STDERR, ">&SAVERR") or die $!;
131close SAVERR;