summaryrefslogtreecommitdiff
path: root/t/lib/1_compile.t
blob: a713c6c6e03ab01cf3bcb75528ef94e373b4c247 (plain)
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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
#!./perl

BEGIN {
    chdir '..' if -d '../pod' && -d '../t';
    @INC = 'lib';
}

use strict;
use warnings;
use Config;

my %Core_Modules;

unless (open(MANIFEST, "MANIFEST")) {
    die "$0: failed to open 'MANIFEST': $!\n";
}

sub add_by_name {
    $Core_Modules{$_[0]}++;
}

while (<MANIFEST>) {
    next unless m!^lib/(\S+?)\.pm!;
    my $module = $1;
    $module =~ s!/!::!g;
    add_by_name($module);
}

close(MANIFEST);

# Delete stuff that can't be tested here.

sub delete_by_name {
    delete $Core_Modules{$_[0]};
}

sub has_extension {
    $Config{extensions} =~ /\b$_[0]\b/i;
}

sub delete_unless_has_extension {
    delete $Core_Modules{$_[0]} unless has_extension($_[0]);
}

foreach my $known_extension (split(' ', $Config{known_extensions})) {
    delete_unless_has_extension($known_extension);
}

sub delete_by_prefix {
    for my $match (grep { /^$_[0]/ } keys %Core_Modules) {
	delete_by_name($match);
    }
}

delete_by_name('CGI::Fast');		# won't load without FCGI

delete_by_name('Devel::DProf');		# needs to be run as -d:DProf

delete_by_prefix('ExtUtils::MM_');	# ExtUtils::MakeMaker's domain

delete_by_prefix('File::Spec::');	# File::Spec's domain
add_by_name('File::Spec::Functions');	# put this back

delete_by_prefix('Attribute::Handlers');# we test this, and we have demos

sub using_feature {
    my $use = "use$_[0]";
    exists $Config{$use} &&
	defined $Config{$use} &&
	$Config{$use} eq 'define';
}

unless (using_feature('threads') && has_extension('Thread')) {
    delete_by_name('Thread');
    delete_by_prefix('Thread::');
}

delete_by_prefix('unicode::');
add_by_name('unicode::distinct');	# put this back

# Delete all modules which have their own tests.
# This makes this test a lot faster.
foreach my $mod (<DATA>) {
    chomp $mod;
    delete_by_name($mod);
}

# Okay, this is the list.

my @Core_Modules = sort keys %Core_Modules;

print "1..".@Core_Modules."\n";

my $test_num = 1;

foreach my $module (@Core_Modules) {
    print "# $module compile failed\nnot " unless compile_module($module);
    print "ok $test_num\n";
    $test_num++;
}

# We do this as a separate process else we'll blow the hell
# out of our namespace.
sub compile_module {
    my ($module) = $_[0];
    
    return scalar `$^X "-Ilib" t/lib/compmod.pl $module` =~ /^ok/;
}

# Add here modules that have their own test scripts and therefore
# need not be test-compiled by 1_compile.t.
__DATA__
AnyDBM_File
Attribute::Handlers
AutoLoader
B
B::Debug
B::Deparse
B::ShowLex
B::Stash
Benchmark
CGI
CGI::Pretty
CGI::Util
Carp
Carp::Heavy
Class::ISA
Class::Struct
CPAN
Cwd
DB_File
Data::Dumper
Devel::DProf
Devel::Peek
Devel::SelfStubber
Digest
Digest::MD5
DirHandle
Dumpvalue
Encode
English
Env
Errno
Exporter
Exporter::Heavy
ExtUtils::Constant
ExtUtils::MakeMaker
Fatal
Fcntl
File::Basename
File::CheckTree
File::Compare
File::Copy
File::DosGlob
File::Find
File::Glob
File::Path
File::Spec
File::Spec::Functions
File::Temp
File::stat
FileCache
FileHandle
Filter::Simple
Filter::Util::Call
FindBin
GDBM_File
Getopt::Long
Getopt::Std
I18N::LangTags
I18N::Collate
IO::Dir
IO::File
IO::Handle
IO::Pipe
IO::Poll
IO::Seekable
IO::Select
IO::Socket
IO::Socket::INET
IO::Socket::UNIX
IPC::Open2
IPC::Open3
IPC::SysV
List::Util
Locale::Constants
Locale::Country
Locale::Currency
Locale::Language
Locale::Maketext
MIME::Base64
MIME::QuotedPrint
Math::BigFloat
Math::BigInt
Math::Complex
Math::Trig
NDBM_File
NEXT
Net::hostent
Net::netent
Net::protoent
Net::servent
ODBM_File
Opcode
PerlIO
POSIX
Pod::Checker
Pod::Find
Pod::Text
Pod::Usage
SDBM_File
Safe
Scalar::Util
Search::Dict
SelectSaver
SelfLoader
Socket
Storable
Switch
Symbol
Sys::Hostname
Sys::Syslog
Term::ANSIColor
Test
Test::Harness
Test::ParseWords
Text::Abbrev
Text::Balanced
Text::ParseWords
Text::Soundex
Text::Tabs
Text::Wrap
Thread
Tie::Array
Tie::Handle
Tie::Hash
Tie::RefHash
Tie::Scalar
Tie::SubstrHash
Time::HiRes
Time::Local
Time::Piece
Time::gmtime
Time::localtime
Time::tm
UNIVERSAL
User::grent
User::pwent
XS::Typemap
attrs
autouse
base
bytes
charnames
constant
diagnostics
fields
integer
locale
ops
overload
strict
subs
utf8
warnings
warnings::register