Integrate mainline
[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;
17use Test::More tests => 15;
18use MakeMaker::Test::Utils;
19use File::Spec;
20use TieOut;
21
22my $perl = which_perl;
23
24$ENV{PERL_CORE} ? chdir '../lib/ExtUtils/t' : chdir 't';
25
26perl_lib;
27
28$| = 1;
29
30ok( chdir 'Big-Fat-Dummy', "chdir'd to Big-Fat-Dummy" ) ||
31 diag("chdir failed: $!");
32
33
34# The perl core test suite will run any .t file in the MANIFEST.
35# So we have to generate this on the fly.
36mkdir 't';
37open(TEST, ">t/compile.t") or die "Can't open t/compile.t: $!";
38print TEST <DATA>;
39close TEST;
40
41END { unlink 't/compile.t' }
42
43my @mpl_out = `$perl Makefile.PL PREFIX=dummy-install`;
44
45cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) ||
46 diag(@mpl_out);
47
48my $makefile = makefile_name();
49ok( grep(/^Writing $makefile for Big::Fat::Dummy/,
50 @mpl_out) == 1,
51 'Makefile.PL output looks right');
52
53ok( grep(/^Current package is: main$/,
54 @mpl_out) == 1,
55 'Makefile.PL run in package main');
56
57ok( -e $makefile, 'Makefile exists' );
58
59# -M is flakey on VMS, flat out broken on Tru64 5.6.0
60SKIP: {
61 skip "stat a/mtime broken on Tru64 5.6.0", 1 if $^O eq 'dec_osf' and
62 $] >= 5.006;
63
64 my $mtime = (stat($makefile))[9];
65 cmp_ok( $^T, '<=', $mtime, ' its been touched' );
66}
67
68END { unlink makefile_name(), makefile_backup() }
69
70my $make = make_run();
71
72{
73 # Supress 'make manifest' noise
74 local $ENV{PERL_MM_MANIFEST_VERBOSE} = 0;
75 my $manifest_out = `$make manifest`;
76 ok( -e 'MANIFEST', 'make manifest created a MANIFEST' );
77 ok( -s 'MANIFEST', ' its not empty' );
78}
79
80END { unlink 'MANIFEST'; }
81
82my $test_out = `$make test`;
83like( $test_out, qr/All tests successful/, 'make test' );
84is( $?, 0 );
85
86# Test 'make test TEST_VERBOSE=1'
87my $make_test_verbose = make_macro($make, 'test', TEST_VERBOSE => 1);
88$test_out = `$make_test_verbose`;
89like( $test_out, qr/ok \d+ - TEST_VERBOSE/, 'TEST_VERBOSE' );
90like( $test_out, qr/All tests successful/, ' successful' );
91is( $?, 0 );
92
93my $dist_test_out = `$make disttest`;
94is( $?, 0, 'disttest' ) || diag($dist_test_out);
95
96my $realclean_out = `$make realclean`;
97is( $?, 0, 'realclean' ) || diag($realclean_out);
98
99__DATA__
100print "1..2\n";
101
102print eval "use Big::Fat::Dummy; 1;" ? "ok 1\n" : "not ok 1\n";
103print "ok 2 - TEST_VERBOSE\n";