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'; |
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' |
42 | COMMAND |
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 | |
50 | chdir $root_dir; |
51 | |
75e2e551 |
52 | |
53 | perl_lib; |
54 | |
e0678a30 |
55 | my $Touch_Time = calibrate_mtime(); |
56 | |
75e2e551 |
57 | $| = 1; |
58 | |
45bc4d3a |
59 | ok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) || |
75e2e551 |
60 | diag("chdir failed: $!"); |
61 | |
75e2e551 |
62 | my @mpl_out = `$perl Makefile.PL PREFIX=dummy-install`; |
63 | |
64 | cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || |
65 | diag(@mpl_out); |
66 | |
67 | my $makefile = makefile_name(); |
45bc4d3a |
68 | ok( grep(/^Writing $makefile for Big::Dummy/, |
75e2e551 |
69 | @mpl_out) == 1, |
70 | 'Makefile.PL output looks right'); |
71 | |
72 | ok( grep(/^Current package is: main$/, |
73 | @mpl_out) == 1, |
74 | 'Makefile.PL run in package main'); |
75 | |
76 | ok( -e $makefile, 'Makefile exists' ); |
77 | |
e0678a30 |
78 | # -M is flakey on VMS |
79 | my $mtime = (stat($makefile))[9]; |
80 | cmp_ok( $Touch_Time, '<=', $mtime, ' its been touched' ); |
75e2e551 |
81 | |
82 | END { unlink makefile_name(), makefile_backup() } |
83 | |
84 | my $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 | |
94 | END { unlink 'MANIFEST'; } |
95 | |
96 | my $test_out = `$make test`; |
97 | like( $test_out, qr/All tests successful/, 'make test' ); |
98 | is( $?, 0 ); |
99 | |
100 | # Test 'make test TEST_VERBOSE=1' |
101 | my $make_test_verbose = make_macro($make, 'test', TEST_VERBOSE => 1); |
102 | $test_out = `$make_test_verbose`; |
103 | like( $test_out, qr/ok \d+ - TEST_VERBOSE/, 'TEST_VERBOSE' ); |
104 | like( $test_out, qr/All tests successful/, ' successful' ); |
105 | is( $?, 0 ); |
106 | |
45bc4d3a |
107 | my $dist_test_out = `$make disttest`; |
75e2e551 |
108 | is( $?, 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 | |
114 | cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || |
115 | diag(@mpl_out); |
116 | |
45bc4d3a |
117 | ok( 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. |
124 | open(SAVERR, ">&STDERR") or die $!; |
125 | open(STDERR, ">".File::Spec->devnull) or die $!; |
126 | |
75e2e551 |
127 | my $realclean_out = `$make realclean`; |
128 | is( $?, 0, 'realclean' ) || diag($realclean_out); |
129 | |
e0678a30 |
130 | open(STDERR, ">&SAVERR") or die $!; |
131 | close SAVERR; |