1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
|
#!/usr/bin/perl -w
# This test puts MakeMaker through the paces of a basic perl module
# build, test and installation of the Big::Fat::Dummy module.
BEGIN {
if( $ENV{PERL_CORE} ) {
chdir 't' if -d 't';
@INC = ('../lib', 'lib');
}
else {
unshift @INC, 't/lib';
}
}
use strict;
use Config;
use Test::More tests => 48;
use MakeMaker::Test::Utils;
use File::Find;
use File::Spec;
my $perl = which_perl();
my $Is_VMS = $^O eq 'VMS';
my $root_dir = 't';
if( $^O eq 'VMS' ) {
# On older systems we might exceed the 8-level directory depth limit
# imposed by RMS. We get around this with a rooted logical, but we
# can't create logical names with attributes in Perl, so we do it
# in a DCL subprocess and put it in the job table so the parent sees it.
open( BFDTMP, '>bfdtesttmp.com' ) || die "Error creating command file; $!";
print BFDTMP <<'COMMAND';
$ IF F$TRNLNM("PERL_CORE") .EQS. "" .AND. F$TYPE(PERL_CORE) .EQS. ""
$ THEN
$! building CPAN version
$ BFD_TEST_ROOT = F$PARSE("SYS$DISK:[]",,,,"NO_CONCEAL")-".][000000"-"]["-"].;"+".]"
$ ELSE
$! we're in the core
$ BFD_TEST_ROOT = F$PARSE("SYS$DISK:[-]",,,,"NO_CONCEAL")-".][000000"-"]["-"].;"+".]"
$ ENDIF
$ DEFINE/JOB/NOLOG/TRANSLATION=CONCEALED BFD_TEST_ROOT 'BFD_TEST_ROOT'
COMMAND
close BFDTMP;
system '@bfdtesttmp.com';
END { 1 while unlink 'bfdtesttmp.com' }
$root_dir = 'BFD_TEST_ROOT:[t]';
}
chdir $root_dir;
perl_lib;
my $Touch_Time = calibrate_mtime();
$| = 1;
ok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) ||
diag("chdir failed: $!");
my @mpl_out = `$perl Makefile.PL PREFIX=dummy-install`;
cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) ||
diag(@mpl_out);
my $makefile = makefile_name();
ok( grep(/^Writing $makefile for Big::Dummy/,
@mpl_out) == 1,
'Makefile.PL output looks right');
ok( grep(/^Current package is: main$/,
@mpl_out) == 1,
'Makefile.PL run in package main');
ok( -e $makefile, 'Makefile exists' );
# -M is flakey on VMS
my $mtime = (stat($makefile))[9];
cmp_ok( $Touch_Time, '<=', $mtime, ' its been touched' );
END { unlink makefile_name(), makefile_backup() }
my $make = make_run();
{
# Supress 'make manifest' noise
local $ENV{PERL_MM_MANIFEST_VERBOSE} = 0;
my $manifest_out = `$make manifest`;
ok( -e 'MANIFEST', 'make manifest created a MANIFEST' );
ok( -s 'MANIFEST', ' its not empty' );
}
END { unlink 'MANIFEST'; }
`$make ppd`;
is( $?, 0, ' exited normally' );
ok( open(PPD, 'Big-Dummy.ppd'), ' .ppd file generated' );
my $ppd_html;
{ local $/; $ppd_html = <PPD> }
close PPD;
like( $ppd_html, qr{^<SOFTPKG NAME="Big-Dummy" VERSION="0,01,0,0">}m,
' <SOFTPKG>' );
like( $ppd_html, qr{^\s*<TITLE>Big-Dummy</TITLE>}m, ' <TITLE>' );
like( $ppd_html, qr{^\s*<ABSTRACT>Try "our" hot dog's</ABSTRACT>}m,
' <ABSTRACT>');
like( $ppd_html,
qr{^\s*<AUTHOR>Michael G Schwern <schwern\@pobox.com></AUTHOR>}m,
' <AUTHOR>' );
like( $ppd_html, qr{^\s*<IMPLEMENTATION>}m, ' <IMPLEMENTATION>');
like( $ppd_html, qr{^\s*<DEPENDENCY NAME="strict" VERSION="0,0,0,0" />}m,
' <DEPENDENCY>' );
like( $ppd_html, qr{^\s*<OS NAME="$Config{osname}" />}m,
' <OS>' );
like( $ppd_html, qr{^\s*<ARCHITECTURE NAME="$Config{archname}" />}m,
' <ARCHITECTURE>');
like( $ppd_html, qr{^\s*<CODEBASE HREF="" />}m, ' <CODEBASE>');
like( $ppd_html, qr{^\s*</IMPLEMENTATION>}m, ' </IMPLEMENTATION>');
like( $ppd_html, qr{^\s*</SOFTPKG>}m, ' </SOFTPKG>');
END { unlink 'Big-Dummy.ppd' }
my $test_out = `$make test`;
like( $test_out, qr/All tests successful/, 'make test' );
is( $?, 0, ' exited normally' );
# Test 'make test TEST_VERBOSE=1'
my $make_test_verbose = make_macro($make, 'test', TEST_VERBOSE => 1);
$test_out = `$make_test_verbose`;
like( $test_out, qr/ok \d+ - TEST_VERBOSE/, 'TEST_VERBOSE' );
like( $test_out, qr/All tests successful/, ' successful' );
is( $?, 0, ' exited normally' );
my $install_out = `$make install`;
is( $?, 0, 'install' ) || diag $install_out;
like( $install_out, qr/^Installing /m );
like( $install_out, qr/^Writing /m );
ok( -r 'dummy-install', ' install dir created' );
my %files = ();
find( sub {
# do it case-insensitive for non-case preserving OSs
$files{lc $_} = $File::Find::name;
}, 'dummy-install' );
ok( $files{'dummy.pm'}, ' Dummy.pm installed' );
ok( $files{'liar.pm'}, ' Liar.pm installed' );
ok( $files{'.packlist'}, ' packlist created' );
ok( $files{'perllocal.pod'},' perllocal.pod created' );
SKIP: {
skip "VMS install targets do not preserve PREFIX", 8 if $Is_VMS;
$install_out = `$make install PREFIX=elsewhere`;
is( $?, 0, 'install with PREFIX override' ) || diag $install_out;
like( $install_out, qr/^Installing /m );
like( $install_out, qr/^Writing /m );
ok( -r 'elsewhere', ' install dir created' );
%files = ();
find( sub { $files{$_} = $File::Find::name; }, 'elsewhere' );
ok( $files{'Dummy.pm'}, ' Dummy.pm installed' );
ok( $files{'Liar.pm'}, ' Liar.pm installed' );
ok( $files{'.packlist'}, ' packlist created' );
ok( $files{'perllocal.pod'},' perllocal.pod created' );
}
my $dist_test_out = `$make disttest`;
is( $?, 0, 'disttest' ) || diag($dist_test_out);
# Test META.yml generation
use ExtUtils::Manifest qw(maniread);
ok( -f 'META.yml', 'META.yml written' );
my $manifest = maniread();
# VMS is non-case preserving, so we can't know what the MANIFEST will
# look like. :(
_normalize($manifest);
is( $manifest->{'meta.yml'}, 'Module meta-data in YAML' );
# Make sure init_dirscan doesn't go into the distdir
@mpl_out = `$perl Makefile.PL "PREFIX=dummy-install"`;
cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) ||
diag(@mpl_out);
ok( grep(/^Writing $makefile for Big::Dummy/, @mpl_out) == 1,
'init_dirscan skipped distdir') ||
diag(@mpl_out);
# I know we'll get ignored errors from make here, that's ok.
# Send STDERR off to oblivion.
open(SAVERR, ">&STDERR") or die $!;
open(STDERR, ">".File::Spec->devnull) or die $!;
my $realclean_out = `$make realclean`;
is( $?, 0, 'realclean' ) || diag($realclean_out);
open(STDERR, ">&SAVERR") or die $!;
close SAVERR;
sub _normalize {
my $hash = shift;
while(my($k,$v) = each %$hash) {
delete $hash->{$k};
$hash->{lc $k} = $v;
}
}
|