Bump the version to 5.7.2.
[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
04070b92 64delete_by_prefix('Attribute::Handlers');# we test this, and we have demos
65
656b9f42 66sub using_feature {
67 my $use = "use$_[0]";
68 exists $Config{$use} &&
69 defined $Config{$use} &&
70 $Config{$use} eq 'define';
71}
72
73unless (using_feature('threads') && has_extension('Thread')) {
74 delete_by_name('Thread');
290a1446 75 delete_by_prefix('Thread::');
eba8ff18 76}
cdd2acaa 77
a0cb3900 78unless (has_extension('NDBM_File')) {
79 delete_by_name('Memoize::NDBM_File');
80}
81
cdd2acaa 82delete_by_prefix('unicode::');
cdd2acaa 83
04070b92 84# Delete all modules which have their own tests.
85# This makes this test a lot faster.
6b40b044 86foreach my $mod (<DATA>) {
87 chomp $mod;
88 delete_by_name($mod);
89}
90
cdd2acaa 91# Okay, this is the list.
92
93my @Core_Modules = sort keys %Core_Modules;
7200bc44 94
95print "1..".@Core_Modules."\n";
96
97my $test_num = 1;
cdd2acaa 98
7200bc44 99foreach my $module (@Core_Modules) {
cdd2acaa 100 print "# $module compile failed\nnot " unless compile_module($module);
7200bc44 101 print "ok $test_num\n";
102 $test_num++;
103}
104
656b9f42 105# We do this as a separate process else we'll blow the hell
106# out of our namespace.
7200bc44 107sub compile_module {
656b9f42 108 my ($module) = $_[0];
7200bc44 109
1189d1e4 110 my $out = scalar `$^X "-Ilib" t/lib/compmod.pl $module`;
111 print "# $out";
112 return $out =~ /^ok/;
7200bc44 113}
6b40b044 114
20e80008 115# Add here modules that have their own test scripts and therefore
116# need not be test-compiled by 1_compile.t.
6b40b044 117__DATA__
118AnyDBM_File
dc6b6eef 119Attribute::Handlers
6b40b044 120AutoLoader
121B
122B::Debug
123B::Deparse
124B::ShowLex
125B::Stash
126Benchmark
127CGI
128CGI::Pretty
129CGI::Util
130Carp
20e80008 131Carp::Heavy
6b40b044 132Class::ISA
133Class::Struct
46700524 134CPAN
6b40b044 135Cwd
136DB_File
137Data::Dumper
138Devel::DProf
139Devel::Peek
7f4f6daf 140Devel::SelfStubber
6b40b044 141Digest
142Digest::MD5
143DirHandle
144Dumpvalue
145Encode
146English
147Env
148Errno
149Exporter
150Exporter::Heavy
20e80008 151ExtUtils::Constant
152ExtUtils::MakeMaker
6b40b044 153Fatal
154Fcntl
155File::Basename
156File::CheckTree
02c8fbd5 157File::Compare
6b40b044 158File::Copy
159File::DosGlob
160File::Find
161File::Glob
162File::Path
163File::Spec
164File::Spec::Functions
165File::Temp
f7a45afb 166File::stat
6b40b044 167FileCache
168FileHandle
7eade29f 169Filter::Simple
6b40b044 170Filter::Util::Call
171FindBin
172GDBM_File
173Getopt::Long
174Getopt::Std
d763e2de 175I18N::Langinfo
20e80008 176I18N::LangTags
0e6c72d5 177I18N::LangTags::List
20e80008 178I18N::Collate
6b40b044 179IO::Dir
180IO::File
181IO::Handle
182IO::Pipe
183IO::Poll
184IO::Seekable
185IO::Select
186IO::Socket
187IO::Socket::INET
188IO::Socket::UNIX
189IPC::Open2
190IPC::Open3
191IPC::SysV
192List::Util
193Locale::Constants
194Locale::Country
195Locale::Currency
196Locale::Language
20e80008 197Locale::Maketext
6b40b044 198MIME::Base64
199MIME::QuotedPrint
200Math::BigFloat
201Math::BigInt
0e6c72d5 202Math::BigInt::Calc
6b40b044 203Math::Complex
204Math::Trig
0e6c72d5 205Memoize
206Memoize::AnyDBM_File
207Memoize::Expire
208Memoize::ExpireFile
209Memoize::ExpireTest
210Memoize::NDBM_File
211Memoize::SDBM_File
212Memoize::Storable
6b40b044 213NDBM_File
7eade29f 214NEXT
6b40b044 215Net::hostent
cdbd8744 216Net::netent
6fa754df 217Net::protoent
218Net::servent
6b40b044 219ODBM_File
220Opcode
20e80008 221PerlIO
6b40b044 222POSIX
223Pod::Checker
224Pod::Find
225Pod::Text
226Pod::Usage
227SDBM_File
228Safe
229Scalar::Util
230Search::Dict
231SelectSaver
232SelfLoader
233Socket
234Storable
235Switch
236Symbol
237Sys::Hostname
238Sys::Syslog
239Term::ANSIColor
240Test
241Test::Harness
0e6c72d5 242Test::More
243Test::Simple
6b40b044 244Test::ParseWords
245Text::Abbrev
246Text::Balanced
247Text::ParseWords
248Text::Soundex
249Text::Tabs
250Text::Wrap
251Thread
252Tie::Array
253Tie::Handle
254Tie::Hash
255Tie::RefHash
256Tie::Scalar
257Tie::SubstrHash
258Time::HiRes
259Time::Local
260Time::Piece
2857d2f7 261Time::gmtime
262Time::localtime
263Time::tm
0e6c72d5 264UnicodeCD
6b40b044 265UNIVERSAL
6888c95f 266User::grent
c7506216 267User::pwent
6b40b044 268XS::Typemap
601f2d16 269attributes
6b40b044 270attrs
20e80008 271autouse
6b40b044 272base
273bytes
274charnames
275constant
276diagnostics
277fields
278integer
279locale
280ops
281overload
282strict
283subs
284utf8
6b40b044 285warnings
286warnings::register