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