Re: Why t/lib/extutils.t is failing (was Re: [PATCH] Re: [PATCH] Re: [SPAM] Re:...
[p5sagit/p5-mst-13.2.git] / t / lib / 1_compile.t
CommitLineData
7200bc44 1#!./perl
2
3BEGIN {
4 chdir '..' if -d '../pod' && -d '../t';
5 @INC = 'lib';
6}
7
8use strict;
9use warnings;
cdd2acaa 10use Config;
7200bc44 11
cdd2acaa 12my %Core_Modules;
13
656b9f42 14unless (open(MANIFEST, "MANIFEST")) {
15 die "$0: failed to open 'MANIFEST': $!\n";
16}
17
18sub add_by_name {
19 $Core_Modules{$_[0]}++;
20}
21
22while (<MANIFEST>) {
23 next unless m!^lib/(\S+?)\.pm!;
24 my $module = $1;
25 $module =~ s!/!::!g;
26 add_by_name($module);
27}
28
29close(MANIFEST);
cdd2acaa 30
31# Delete stuff that can't be tested here.
32
656b9f42 33sub delete_by_name {
34 delete $Core_Modules{$_[0]};
35}
36
37sub has_extension {
38 $Config{extensions} =~ /\b$_[0]\b/i;
39}
40
41sub delete_unless_has_extension {
42 delete $Core_Modules{$_[0]} unless has_extension($_[0]);
cdd2acaa 43}
44
45foreach my $known_extension (split(' ', $Config{known_extensions})) {
656b9f42 46 delete_unless_has_extension($known_extension);
cdd2acaa 47}
48
49sub delete_by_prefix {
656b9f42 50 for my $match (grep { /^$_[0]/ } keys %Core_Modules) {
51 delete_by_name($match);
52 }
cdd2acaa 53}
54
656b9f42 55delete_by_name('CGI::Fast'); # won't load without FCGI
cdd2acaa 56
656b9f42 57delete_by_name('Devel::DProf'); # needs to be run as -d:DProf
cdd2acaa 58
59delete_by_prefix('ExtUtils::MM_'); # ExtUtils::MakeMaker's domain
60
61delete_by_prefix('File::Spec::'); # File::Spec's domain
656b9f42 62add_by_name('File::Spec::Functions'); # put this back
cdd2acaa 63
656b9f42 64sub using_feature {
65 my $use = "use$_[0]";
66 exists $Config{$use} &&
67 defined $Config{$use} &&
68 $Config{$use} eq 'define';
69}
70
71unless (using_feature('threads') && has_extension('Thread')) {
72 delete_by_name('Thread');
290a1446 73 delete_by_prefix('Thread::');
eba8ff18 74}
cdd2acaa 75
76delete_by_prefix('unicode::');
656b9f42 77add_by_name('unicode::distinct'); # put this back
cdd2acaa 78
6b40b044 79
80# Delete all modules which have their own tests. This makes
46700524 81# this test a lot faster.
6b40b044 82foreach my $mod (<DATA>) {
83 chomp $mod;
84 delete_by_name($mod);
85}
86
cdd2acaa 87# Okay, this is the list.
88
89my @Core_Modules = sort keys %Core_Modules;
7200bc44 90
91print "1..".@Core_Modules."\n";
92
93my $test_num = 1;
cdd2acaa 94
7200bc44 95foreach my $module (@Core_Modules) {
cdd2acaa 96 print "# $module compile failed\nnot " unless compile_module($module);
7200bc44 97 print "ok $test_num\n";
98 $test_num++;
99}
100
656b9f42 101# We do this as a separate process else we'll blow the hell
102# out of our namespace.
7200bc44 103sub compile_module {
656b9f42 104 my ($module) = $_[0];
7200bc44 105
bdc55ba4 106 return scalar `$^X "-Ilib" t/lib/compmod.pl $module` =~ /^ok/;
7200bc44 107}
6b40b044 108
20e80008 109# Add here modules that have their own test scripts and therefore
110# need not be test-compiled by 1_compile.t.
6b40b044 111__DATA__
112AnyDBM_File
113AutoLoader
114B
115B::Debug
116B::Deparse
117B::ShowLex
118B::Stash
119Benchmark
120CGI
121CGI::Pretty
122CGI::Util
123Carp
20e80008 124Carp::Heavy
6b40b044 125Class::ISA
126Class::Struct
46700524 127CPAN
6b40b044 128Cwd
129DB_File
130Data::Dumper
131Devel::DProf
132Devel::Peek
7f4f6daf 133Devel::SelfStubber
6b40b044 134Digest
135Digest::MD5
136DirHandle
137Dumpvalue
138Encode
139English
140Env
141Errno
142Exporter
143Exporter::Heavy
20e80008 144ExtUtils::Constant
145ExtUtils::MakeMaker
6b40b044 146Fatal
147Fcntl
148File::Basename
149File::CheckTree
02c8fbd5 150File::Compare
6b40b044 151File::Copy
152File::DosGlob
153File::Find
154File::Glob
155File::Path
156File::Spec
157File::Spec::Functions
158File::Temp
f7a45afb 159File::stat
6b40b044 160FileCache
161FileHandle
7eade29f 162Filter::Simple
6b40b044 163Filter::Util::Call
164FindBin
165GDBM_File
166Getopt::Long
167Getopt::Std
20e80008 168I18N::LangTags
169I18N::Collate
6b40b044 170IO::Dir
171IO::File
172IO::Handle
173IO::Pipe
174IO::Poll
175IO::Seekable
176IO::Select
177IO::Socket
178IO::Socket::INET
179IO::Socket::UNIX
180IPC::Open2
181IPC::Open3
182IPC::SysV
183List::Util
184Locale::Constants
185Locale::Country
186Locale::Currency
187Locale::Language
20e80008 188Locale::Maketext
6b40b044 189MIME::Base64
190MIME::QuotedPrint
191Math::BigFloat
192Math::BigInt
193Math::Complex
194Math::Trig
195NDBM_File
7eade29f 196NEXT
6b40b044 197Net::hostent
cdbd8744 198Net::netent
6fa754df 199Net::protoent
200Net::servent
6b40b044 201ODBM_File
202Opcode
20e80008 203PerlIO
6b40b044 204POSIX
205Pod::Checker
206Pod::Find
207Pod::Text
208Pod::Usage
209SDBM_File
210Safe
211Scalar::Util
212Search::Dict
213SelectSaver
214SelfLoader
215Socket
216Storable
217Switch
218Symbol
219Sys::Hostname
220Sys::Syslog
221Term::ANSIColor
222Test
223Test::Harness
224Test::ParseWords
225Text::Abbrev
226Text::Balanced
227Text::ParseWords
228Text::Soundex
229Text::Tabs
230Text::Wrap
231Thread
232Tie::Array
233Tie::Handle
234Tie::Hash
235Tie::RefHash
236Tie::Scalar
237Tie::SubstrHash
238Time::HiRes
239Time::Local
240Time::Piece
2857d2f7 241Time::gmtime
242Time::localtime
243Time::tm
6b40b044 244UNIVERSAL
6888c95f 245User::grent
c7506216 246User::pwent
6b40b044 247XS::Typemap
248attrs
20e80008 249autouse
6b40b044 250base
251bytes
252charnames
253constant
254diagnostics
255fields
256integer
257locale
258ops
259overload
260strict
261subs
262utf8
6b40b044 263warnings
264warnings::register