Commit | Line | Data |
---|---|---|
7200bc44 | 1 | #!./perl |
2 | ||
3 | BEGIN { | |
8338e367 | 4 | chdir '..' if -d '../pod' && -d '../t'; |
7200bc44 | 5 | @INC = 'lib'; |
6 | } | |
7 | ||
8 | use strict; | |
9 | use warnings; | |
cdd2acaa | 10 | use Config; |
7200bc44 | 11 | |
cdd2acaa | 12 | my %Core_Modules; |
4d0ed6f7 | 13 | my %Test; |
cdd2acaa | 14 | |
656b9f42 | 15 | unless (open(MANIFEST, "MANIFEST")) { |
16 | die "$0: failed to open 'MANIFEST': $!\n"; | |
17 | } | |
18 | ||
19 | sub add_by_name { | |
20 | $Core_Modules{$_[0]}++; | |
21 | } | |
22 | ||
23 | while (<MANIFEST>) { | |
4d0ed6f7 | 24 | if (m!^(lib)/(\S+?)\.pm\s!) { |
25 | # Collecting modules names from under ext/ would be | |
26 | # rather painful since the mapping from filenames | |
27 | # to module names is not 100%. | |
28 | my ($dir, $module) = ($1, $2); | |
29 | $module =~ s!/!::!g; | |
30 | add_by_name($module); | |
31 | } elsif (m!^(lib|ext)/(\S+?)(?:\.t|/test.pl)\s!) { | |
32 | my ($dir, $test) = ($1, $2); | |
33 | $test =~ s!(\w+)/\1$!$1! if $dir eq 'ext'; | |
34 | $test =~ s!/t/[^/]+$!!; | |
35 | $test =~ s!/!::!g; | |
36 | $Test{$test}++; | |
37 | } | |
656b9f42 | 38 | } |
39 | ||
40 | close(MANIFEST); | |
cdd2acaa | 41 | |
42 | # Delete stuff that can't be tested here. | |
43 | ||
656b9f42 | 44 | sub delete_by_name { |
45 | delete $Core_Modules{$_[0]}; | |
46 | } | |
47 | ||
48 | sub has_extension { | |
49 | $Config{extensions} =~ /\b$_[0]\b/i; | |
50 | } | |
51 | ||
52 | sub delete_unless_has_extension { | |
53 | delete $Core_Modules{$_[0]} unless has_extension($_[0]); | |
cdd2acaa | 54 | } |
55 | ||
56 | foreach my $known_extension (split(' ', $Config{known_extensions})) { | |
656b9f42 | 57 | delete_unless_has_extension($known_extension); |
cdd2acaa | 58 | } |
59 | ||
60 | sub delete_by_prefix { | |
656b9f42 | 61 | for my $match (grep { /^$_[0]/ } keys %Core_Modules) { |
62 | delete_by_name($match); | |
63 | } | |
cdd2acaa | 64 | } |
65 | ||
656b9f42 | 66 | delete_by_name('CGI::Fast'); # won't load without FCGI |
cdd2acaa | 67 | |
cdd2acaa | 68 | delete_by_prefix('ExtUtils::MM_'); # ExtUtils::MakeMaker's domain |
69 | ||
70 | delete_by_prefix('File::Spec::'); # File::Spec's domain | |
656b9f42 | 71 | add_by_name('File::Spec::Functions'); # put this back |
cdd2acaa | 72 | |
04070b92 | 73 | delete_by_prefix('Attribute::Handlers');# we test this, and we have demos |
74 | ||
5655ed86 | 75 | delete_by_prefix('Net::') unless has_extension('Socket'); |
76 | ||
656b9f42 | 77 | sub using_feature { |
78 | my $use = "use$_[0]"; | |
79 | exists $Config{$use} && | |
80 | defined $Config{$use} && | |
81 | $Config{$use} eq 'define'; | |
82 | } | |
83 | ||
84 | unless (using_feature('threads') && has_extension('Thread')) { | |
85 | delete_by_name('Thread'); | |
290a1446 | 86 | delete_by_prefix('Thread::'); |
eba8ff18 | 87 | } |
cdd2acaa | 88 | |
a0cb3900 | 89 | unless (has_extension('NDBM_File')) { |
90 | delete_by_name('Memoize::NDBM_File'); | |
91 | } | |
92 | ||
3de3f243 | 93 | if (ord('A') == 193) { |
c8b7969b | 94 | delete_by_prefix('Net::') unless eval { require Convert::EBCDIC }; |
3de3f243 | 95 | } |
96 | ||
04070b92 | 97 | # Delete all modules which have their own tests. |
98 | # This makes this test a lot faster. | |
4d0ed6f7 | 99 | foreach my $mod (sort keys %Test) { |
100 | delete_by_name($mod); | |
101 | } | |
6b40b044 | 102 | foreach my $mod (<DATA>) { |
103 | chomp $mod; | |
0d0c1411 | 104 | print "### $mod has a test but is in DATA of $0\n" if exists $Test{$mod}; |
6b40b044 | 105 | delete_by_name($mod); |
106 | } | |
107 | ||
cdd2acaa | 108 | # Okay, this is the list. |
109 | ||
110 | my @Core_Modules = sort keys %Core_Modules; | |
7200bc44 | 111 | |
112 | print "1..".@Core_Modules."\n"; | |
113 | ||
114 | my $test_num = 1; | |
cdd2acaa | 115 | |
7200bc44 | 116 | foreach my $module (@Core_Modules) { |
17bcccd5 | 117 | print "$module compile failed\nnot " unless compile_module($module); |
7200bc44 | 118 | print "ok $test_num\n"; |
119 | $test_num++; | |
120 | } | |
121 | ||
656b9f42 | 122 | # We do this as a separate process else we'll blow the hell |
123 | # out of our namespace. | |
7200bc44 | 124 | sub compile_module { |
656b9f42 | 125 | my ($module) = $_[0]; |
7200bc44 | 126 | |
1189d1e4 | 127 | my $out = scalar `$^X "-Ilib" t/lib/compmod.pl $module`; |
128 | print "# $out"; | |
129 | return $out =~ /^ok/; | |
7200bc44 | 130 | } |
6b40b044 | 131 | |
20e80008 | 132 | # Add here modules that have their own test scripts and therefore |
133 | # need not be test-compiled by 1_compile.t. | |
6b40b044 | 134 | __DATA__ |
6b40b044 | 135 | B::ShowLex |
79319589 | 136 | CGI::Apache |
137 | CGI::Carp | |
138 | CGI::Cookie | |
139 | CGI::Form | |
6b40b044 | 140 | CGI::Pretty |
0d0c1411 | 141 | CGI::Push |
79319589 | 142 | CGI::Switch |
6b40b044 | 143 | CGI::Util |
20e80008 | 144 | Carp::Heavy |
6ae1853a | 145 | CPAN::Nox |
6b40b044 | 146 | Exporter::Heavy |
20e80008 | 147 | ExtUtils::Constant |
148 | ExtUtils::MakeMaker | |
6b40b044 | 149 | Filter::Util::Call |
6b40b044 | 150 | GDBM_File |
0e6c72d5 | 151 | I18N::LangTags::List |
6b40b044 | 152 | IO::Dir |
153 | IO::File | |
154 | IO::Handle | |
155 | IO::Pipe | |
156 | IO::Poll | |
157 | IO::Seekable | |
158 | IO::Select | |
159 | IO::Socket | |
160 | IO::Socket::INET | |
161 | IO::Socket::UNIX | |
6b40b044 | 162 | Locale::Constants |
163 | Locale::Country | |
164 | Locale::Currency | |
165 | Locale::Language | |
6b40b044 | 166 | MIME::QuotedPrint |
167 | Math::BigFloat | |
0e6c72d5 | 168 | Math::BigInt::Calc |
0e6c72d5 | 169 | Memoize::AnyDBM_File |
170 | Memoize::Expire | |
171 | Memoize::ExpireFile | |
172 | Memoize::ExpireTest | |
173 | Memoize::NDBM_File | |
174 | Memoize::SDBM_File | |
175 | Memoize::Storable | |
6b40b044 | 176 | NDBM_File |
6b40b044 | 177 | ODBM_File |
6b40b044 | 178 | Pod::Checker |
179 | Pod::Find | |
f56fdd80 | 180 | Pod::Html |
fed96050 | 181 | Pod::LaTeX |
f56fdd80 | 182 | Pod::Man |
183 | Pod::ParseLink | |
fed96050 | 184 | Pod::ParseUtils |
6b40b044 | 185 | Pod::Text |
f56fdd80 | 186 | Pod::Text::Overstrike |
187 | Pod::Text::Termcap | |
6b40b044 | 188 | Pod::Usage |
189 | SDBM_File | |
190 | Safe | |
191 | Scalar::Util | |
6b40b044 | 192 | Sys::Syslog |
0e6c72d5 | 193 | Test::More |
6b40b044 | 194 | Test::ParseWords |
6b40b044 | 195 | Text::Tabs |
196 | Text::Wrap | |
197 | Thread | |
198 | Tie::Array | |
199 | Tie::Handle | |
200 | Tie::Hash | |
2857d2f7 | 201 | Time::tm |
6b40b044 | 202 | UNIVERSAL |
601f2d16 | 203 | attributes |
6b40b044 | 204 | base |
6b40b044 | 205 | ops |
d99274ce | 206 | warnings::register |