3 # This test puts MakeMaker through the paces of a basic perl module
4 # build, test and installation of the Big::Fat::Dummy module.
7 if( $ENV{PERL_CORE} ) {
9 @INC = ('../lib', 'lib');
12 unshift @INC, 't/lib';
17 use Test::More tests => 17;
18 use MakeMaker::Test::Utils;
22 my $perl = which_perl();
24 $ENV{PERL_CORE} ? chdir '../lib/ExtUtils/t' : chdir 't';
28 my $Touch_Time = calibrate_mtime();
32 ok( chdir 'Big-Fat-Dummy', "chdir'd to Big-Fat-Dummy" ) ||
33 diag("chdir failed: $!");
36 # The perl core test suite will run any .t file in the MANIFEST.
37 # So we have to generate this on the fly.
38 mkdir 't' || die "Can't create test dir: $!";
39 open(TEST, ">t/compile.t") or die "Can't open t/compile.t: $!";
40 print TEST <<'COMPILE_T';
43 print eval "use Big::Fat::Dummy; 1;" ? "ok 1\n" : "not ok 1\n";
44 print "ok 2 - TEST_VERBOSE\n";
48 mkdir 'Liar/t' || die "Can't create test dir: $!";
49 open(TEST, ">Liar/t/sanity.t") or die "Can't open Liar/t/sanity.t: $!";
50 print TEST <<'SANITY_T';
53 print eval "use Big::Fat::Dummy; 1;" ? "ok 1\n" : "not ok 1\n";
54 print eval "use Big::Fat::Liar; 1;" ? "ok 2\n" : "not ok 2\n";
55 print "ok 3 - TEST_VERBOSE\n";
59 END { unlink 't/compile.t', 'Liar/t/sanity.t' }
61 my @mpl_out = `$perl Makefile.PL PREFIX=dummy-install`;
63 cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) ||
66 my $makefile = makefile_name();
67 ok( grep(/^Writing $makefile for Big::Fat::Dummy/,
69 'Makefile.PL output looks right');
71 ok( grep(/^Current package is: main$/,
73 'Makefile.PL run in package main');
75 ok( -e $makefile, 'Makefile exists' );
78 my $mtime = (stat($makefile))[9];
79 cmp_ok( $Touch_Time, '<=', $mtime, ' its been touched' );
81 END { unlink makefile_name(), makefile_backup() }
83 my $make = make_run();
86 # Supress 'make manifest' noise
87 local $ENV{PERL_MM_MANIFEST_VERBOSE} = 0;
88 my $manifest_out = `$make manifest`;
89 ok( -e 'MANIFEST', 'make manifest created a MANIFEST' );
90 ok( -s 'MANIFEST', ' its not empty' );
93 END { unlink 'MANIFEST'; }
95 my $test_out = `$make test`;
96 like( $test_out, qr/All tests successful/, 'make test' );
99 # Test 'make test TEST_VERBOSE=1'
100 my $make_test_verbose = make_macro($make, 'test', TEST_VERBOSE => 1);
101 $test_out = `$make_test_verbose`;
102 like( $test_out, qr/ok \d+ - TEST_VERBOSE/, 'TEST_VERBOSE' );
103 like( $test_out, qr/All tests successful/, ' successful' );
106 my $dist_test_out = `$make disttest`;
107 is( $?, 0, 'disttest' ) || diag($dist_test_out);
110 # Make sure init_dirscan doesn't go into the distdir
111 @mpl_out = `$perl Makefile.PL "PREFIX=dummy-install"`;
113 cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) ||
116 ok( grep(/^Writing $makefile for Big::Fat::Dummy/,
118 'init_dirscan skipped distdir') ||
121 # I know we'll get ignored errors from make here, that's ok.
122 # Send STDERR off to oblivion.
123 open(SAVERR, ">&STDERR") or die $!;
124 open(STDERR, ">".File::Spec->devnull) or die $!;
126 my $realclean_out = `$make realclean`;
127 is( $?, 0, 'realclean' ) || diag($realclean_out);
129 open(STDERR, ">&SAVERR") or die $!;