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