More VMS tweaks from Craig A. Berry.
[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
dc6b6eef 113Attribute::Handlers
6b40b044 114AutoLoader
115B
116B::Debug
117B::Deparse
118B::ShowLex
119B::Stash
120Benchmark
121CGI
122CGI::Pretty
123CGI::Util
124Carp
20e80008 125Carp::Heavy
6b40b044 126Class::ISA
127Class::Struct
46700524 128CPAN
6b40b044 129Cwd
130DB_File
131Data::Dumper
132Devel::DProf
133Devel::Peek
7f4f6daf 134Devel::SelfStubber
6b40b044 135Digest
136Digest::MD5
137DirHandle
138Dumpvalue
139Encode
140English
141Env
142Errno
143Exporter
144Exporter::Heavy
20e80008 145ExtUtils::Constant
146ExtUtils::MakeMaker
6b40b044 147Fatal
148Fcntl
149File::Basename
150File::CheckTree
02c8fbd5 151File::Compare
6b40b044 152File::Copy
153File::DosGlob
154File::Find
155File::Glob
156File::Path
157File::Spec
158File::Spec::Functions
159File::Temp
f7a45afb 160File::stat
6b40b044 161FileCache
162FileHandle
7eade29f 163Filter::Simple
6b40b044 164Filter::Util::Call
165FindBin
166GDBM_File
167Getopt::Long
168Getopt::Std
20e80008 169I18N::LangTags
170I18N::Collate
6b40b044 171IO::Dir
172IO::File
173IO::Handle
174IO::Pipe
175IO::Poll
176IO::Seekable
177IO::Select
178IO::Socket
179IO::Socket::INET
180IO::Socket::UNIX
181IPC::Open2
182IPC::Open3
183IPC::SysV
184List::Util
185Locale::Constants
186Locale::Country
187Locale::Currency
188Locale::Language
20e80008 189Locale::Maketext
6b40b044 190MIME::Base64
191MIME::QuotedPrint
192Math::BigFloat
193Math::BigInt
194Math::Complex
195Math::Trig
196NDBM_File
7eade29f 197NEXT
6b40b044 198Net::hostent
cdbd8744 199Net::netent
6fa754df 200Net::protoent
201Net::servent
6b40b044 202ODBM_File
203Opcode
20e80008 204PerlIO
6b40b044 205POSIX
206Pod::Checker
207Pod::Find
208Pod::Text
209Pod::Usage
210SDBM_File
211Safe
212Scalar::Util
213Search::Dict
214SelectSaver
215SelfLoader
216Socket
217Storable
218Switch
219Symbol
220Sys::Hostname
221Sys::Syslog
222Term::ANSIColor
223Test
224Test::Harness
225Test::ParseWords
226Text::Abbrev
227Text::Balanced
228Text::ParseWords
229Text::Soundex
230Text::Tabs
231Text::Wrap
232Thread
233Tie::Array
234Tie::Handle
235Tie::Hash
236Tie::RefHash
237Tie::Scalar
238Tie::SubstrHash
239Time::HiRes
240Time::Local
241Time::Piece
2857d2f7 242Time::gmtime
243Time::localtime
244Time::tm
6b40b044 245UNIVERSAL
6888c95f 246User::grent
c7506216 247User::pwent
6b40b044 248XS::Typemap
249attrs
20e80008 250autouse
6b40b044 251base
252bytes
253charnames
254constant
255diagnostics
256fields
257integer
258locale
259ops
260overload
261strict
262subs
263utf8
6b40b044 264warnings
265warnings::register