Commit | Line | Data |
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 | |
6 | BEGIN { |
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 | |
16 | use strict; |
e0678a30 |
17 | use Test::More tests => 17; |
75e2e551 |
18 | use MakeMaker::Test::Utils; |
19 | use File::Spec; |
20 | use TieOut; |
21 | |
e0678a30 |
22 | my $perl = which_perl(); |
75e2e551 |
23 | |
57b1a898 |
24 | my $root_dir = 't'; |
25 | |
26 | if( $^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'; |
33 | $ BFD_TEST_ROOT = F$PARSE("[.t]",,,,"NO_CONCEAL")-".][000000"-"]["-"].;"+".]" |
34 | $ DEFINE/JOB/NOLOG/TRANSLATION=CONCEALED BFD_TEST_ROOT 'BFD_TEST_ROOT' |
35 | COMMAND |
36 | close BFDTMP; |
37 | |
38 | system '@bfdtesttmp.com'; |
39 | END { 1 while unlink 'bfdtesttmp.com' } |
40 | $root_dir = 'BFD_TEST_ROOT:[000000]'; |
41 | } |
42 | |
43 | chdir $root_dir; |
44 | |
75e2e551 |
45 | |
46 | perl_lib; |
47 | |
e0678a30 |
48 | my $Touch_Time = calibrate_mtime(); |
49 | |
75e2e551 |
50 | $| = 1; |
51 | |
45bc4d3a |
52 | ok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) || |
75e2e551 |
53 | diag("chdir failed: $!"); |
54 | |
75e2e551 |
55 | my @mpl_out = `$perl Makefile.PL PREFIX=dummy-install`; |
56 | |
57 | cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || |
58 | diag(@mpl_out); |
59 | |
60 | my $makefile = makefile_name(); |
45bc4d3a |
61 | ok( grep(/^Writing $makefile for Big::Dummy/, |
75e2e551 |
62 | @mpl_out) == 1, |
63 | 'Makefile.PL output looks right'); |
64 | |
65 | ok( grep(/^Current package is: main$/, |
66 | @mpl_out) == 1, |
67 | 'Makefile.PL run in package main'); |
68 | |
69 | ok( -e $makefile, 'Makefile exists' ); |
70 | |
e0678a30 |
71 | # -M is flakey on VMS |
72 | my $mtime = (stat($makefile))[9]; |
73 | cmp_ok( $Touch_Time, '<=', $mtime, ' its been touched' ); |
75e2e551 |
74 | |
75 | END { unlink makefile_name(), makefile_backup() } |
76 | |
77 | my $make = make_run(); |
78 | |
79 | { |
80 | # Supress 'make manifest' noise |
81 | local $ENV{PERL_MM_MANIFEST_VERBOSE} = 0; |
82 | my $manifest_out = `$make manifest`; |
83 | ok( -e 'MANIFEST', 'make manifest created a MANIFEST' ); |
84 | ok( -s 'MANIFEST', ' its not empty' ); |
85 | } |
86 | |
87 | END { unlink 'MANIFEST'; } |
88 | |
89 | my $test_out = `$make test`; |
90 | like( $test_out, qr/All tests successful/, 'make test' ); |
91 | is( $?, 0 ); |
92 | |
93 | # Test 'make test TEST_VERBOSE=1' |
94 | my $make_test_verbose = make_macro($make, 'test', TEST_VERBOSE => 1); |
95 | $test_out = `$make_test_verbose`; |
96 | like( $test_out, qr/ok \d+ - TEST_VERBOSE/, 'TEST_VERBOSE' ); |
97 | like( $test_out, qr/All tests successful/, ' successful' ); |
98 | is( $?, 0 ); |
99 | |
45bc4d3a |
100 | my $dist_test_out = `$make disttest`; |
75e2e551 |
101 | is( $?, 0, 'disttest' ) || diag($dist_test_out); |
102 | |
e0678a30 |
103 | |
104 | # Make sure init_dirscan doesn't go into the distdir |
105 | @mpl_out = `$perl Makefile.PL "PREFIX=dummy-install"`; |
106 | |
107 | cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || |
108 | diag(@mpl_out); |
109 | |
45bc4d3a |
110 | ok( grep(/^Writing $makefile for Big::Dummy/, |
e0678a30 |
111 | @mpl_out) == 1, |
112 | 'init_dirscan skipped distdir') || |
113 | diag(@mpl_out); |
114 | |
115 | # I know we'll get ignored errors from make here, that's ok. |
116 | # Send STDERR off to oblivion. |
117 | open(SAVERR, ">&STDERR") or die $!; |
118 | open(STDERR, ">".File::Spec->devnull) or die $!; |
119 | |
75e2e551 |
120 | my $realclean_out = `$make realclean`; |
121 | is( $?, 0, 'realclean' ) || diag($realclean_out); |
122 | |
e0678a30 |
123 | open(STDERR, ">&SAVERR") or die $!; |
124 | close SAVERR; |