MakeMaker sync 5.48_03 -> 5.53_01
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / t / basic.t
CommitLineData
f6d6199c 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$ENV{PERL_CORE} ? chdir '../lib/ExtUtils/t' : chdir 't';
16
17use strict;
18use Test::More tests => 15;
19use MakeMaker::Test::Utils;
20use File::Spec;
21use TieOut;
22
23my $perl = which_perl;
24perl_lib;
25
26$| = 1;
27
28ok( chdir 'Big-Fat-Dummy', "chdir'd to Big-Fat-Dummy" ) ||
29 diag("chdir failed: $!");
30
31my @mpl_out = `$perl Makefile.PL PREFIX=dummy-install`;
32
33cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) ||
34 diag(@mpl_out);
35
36my $makefile = makefile_name();
37ok( grep(/^Writing $makefile for Big::Fat::Dummy/,
38 @mpl_out) == 1,
39 'Makefile.PL output looks right');
40
41ok( grep(/^Current package is: main$/,
42 @mpl_out) == 1,
43 'Makefile.PL run in package main');
44
45ok( -e $makefile, 'Makefile exists' );
46
47# -M is flakey on VMS.
48my $mtime = (stat($makefile))[9];
49ok( ($^T - $mtime) <= 0, ' its been touched' );
50
51END { unlink makefile_name(), makefile_backup() }
52
53# Supress 'make manifest' noise
54open(SAVERR, ">&STDERR") || die $!;
55close(STDERR);
56my $make = make_run();
57my $manifest_out = `$make manifest`;
58ok( -e 'MANIFEST', 'make manifest created a MANIFEST' );
59ok( -s 'MANIFEST', ' its not empty' );
60open(STDERR, ">&SAVERR") || die $!;
61
62END { unlink 'MANIFEST'; }
63
64my $test_out = `$make test`;
65like( $test_out, qr/All tests successful/, 'make test' );
66is( $?, 0 );
67
68# Test 'make test TEST_VERBOSE=1'
69my $make_test_verbose = make_macro($make, 'test', TEST_VERBOSE => 1);
70$test_out = `$make_test_verbose`;
71like( $test_out, qr/ok \d+ - TEST_VERBOSE/, 'TEST_VERBOSE' );
72like( $test_out, qr/All tests successful/, ' successful' );
73is( $?, 0 );
74
75my $dist_test_out = `$make disttest`;
76is( $?, 0, 'disttest' ) || diag($dist_test_out);
77
78my $realclean_out = `$make realclean`;
79is( $?, 0, 'realclean' ) || diag($realclean_out);
80
81close SAVERR;