This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
EBCDIC cleanup for B test
[perl5.git] / t / lib / 1_compile.t
CommitLineData
7200bc44
JH
1#!./perl
2
3BEGIN {
4 chdir '..' if -d '../pod' && -d '../t';
5 @INC = 'lib';
6}
7
8use strict;
9use warnings;
cdd2acaa
JH
10use Config;
11use File::Find;
7200bc44 12
cdd2acaa
JH
13my %Core_Modules;
14
15find(sub {
16 if ($File::Find::name =~ m!^lib\W+(.+)\.pm$!i) {
17 my $module = $1;
18 $module =~ s/[^\w-]/::/g;
19 $Core_Modules{$module}++;
20 }
21 }, "lib");
22
23# Delete stuff that can't be tested here.
24
25sub delete_unless_in_extensions {
26 delete $Core_Modules{$_[0]} unless $Config{extensions} =~ /\b$_[0]\b/;
27}
28
29foreach my $known_extension (split(' ', $Config{known_extensions})) {
30 delete_unless_in_extensions($known_extension);
31}
32
33sub delete_by_prefix {
34 delete @Core_Modules{grep { /^$_[0]/ } keys %Core_Modules};
35}
36
37delete $Core_Modules{'CGI::Fast'}; # won't load without FCGI
38
39delete $Core_Modules{'Devel::DProf'}; # needs to be run as -d:DProf
40
41delete_by_prefix('ExtUtils::MM_'); # ExtUtils::MakeMaker's domain
42
43delete_by_prefix('File::Spec::'); # File::Spec's domain
44$Core_Modules{'File::Spec::Functions'}++; # put this back
45
eba8ff18
JH
46unless ($Config{extensions} =~ /\bThread\b/) {
47 delete $Core_Modules{Thread};
290a1446 48 delete_by_prefix('Thread::');
eba8ff18 49}
cdd2acaa
JH
50
51delete_by_prefix('unicode::');
52$Core_Modules{'unicode::distinct'}++; # put this back
53
54# Okay, this is the list.
55
56my @Core_Modules = sort keys %Core_Modules;
7200bc44
JH
57
58print "1..".@Core_Modules."\n";
59
60my $test_num = 1;
cdd2acaa 61
7200bc44 62foreach my $module (@Core_Modules) {
cdd2acaa 63 print "# $module compile failed\nnot " unless compile_module($module);
7200bc44
JH
64 print "ok $test_num\n";
65 $test_num++;
66}
67
68
cdd2acaa 69# We do this as a separate process else we'll blow the hell out of our
7200bc44
JH
70# namespace.
71sub compile_module {
72 my($module) = @_;
73
74 return scalar `./perl -Ilib t/lib/compmod.pl $module` =~ /^ok/;
75}