Commit | Line | Data |
---|---|---|
7200bc44 JH |
1 | #!./perl |
2 | ||
41f7d568 MS |
3 | # Modules should have their own tests. For historical reasons, some |
4 | # do not. This does basic compile tests on modules that have no tests | |
5 | # of their own. | |
6 | ||
7200bc44 | 7 | BEGIN { |
41f7d568 MS |
8 | chdir 't'; |
9 | @INC = '../lib'; | |
7200bc44 JH |
10 | } |
11 | ||
12 | use strict; | |
13 | use warnings; | |
dc459aad | 14 | use File::Spec::Functions; |
6b40b044 | 15 | |
cdd2acaa JH |
16 | # Okay, this is the list. |
17 | ||
d36c8744 | 18 | my @Core_Modules = grep /\S/, <DATA>; |
41f7d568 | 19 | chomp @Core_Modules; |
7200bc44 | 20 | |
7374aa61 | 21 | if (eval { require Socket }) { |
7374aa61 JH |
22 | # Two Net:: modules need the Convert::EBCDIC if in EBDCIC. |
23 | if (ord("A") != 193 || eval { require Convert::EBCDIC }) { | |
24 | push @Core_Modules, qw(Net::Cmd Net::POP3); | |
25 | } | |
d36c8744 | 26 | } |
b3bfad09 NC |
27 | if(eval { require B }) { |
28 | push @Core_Modules, qw(B::C B::CC B::Stackobj); | |
29 | } | |
d36c8744 JH |
30 | |
31 | @Core_Modules = sort @Core_Modules; | |
32 | ||
4c4ccc83 | 33 | print "1..".(1+@Core_Modules)."\n"; |
7200bc44 | 34 | |
4c4ccc83 NC |
35 | my $message |
36 | = "ok 1 - All modules should have tests # TODO Make Schwern Poorer\n"; | |
37 | if (@Core_Modules) { | |
38 | print "not $message"; | |
39 | } else { | |
40 | print $message; | |
41 | } | |
983d1c14 NC |
42 | print <<'EOREWARD'; |
43 | # http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2001-04/msg01223.html | |
44 | # 20010421230349.P2946@blackrider.blackstar.co.uk | |
45 | EOREWARD | |
4c4ccc83 NC |
46 | |
47 | my $test_num = 2; | |
cdd2acaa | 48 | |
7200bc44 | 49 | foreach my $module (@Core_Modules) { |
b328b501 CB |
50 | my $todo = ''; |
51 | $todo = "# TODO $module needs porting on $^O" if $module eq 'ByteLoader' && $^O eq 'VMS'; | |
52 | print "# $module compile failed\nnot " unless compile_module($module); | |
53 | print "ok $test_num $todo\n"; | |
7200bc44 JH |
54 | $test_num++; |
55 | } | |
56 | ||
656b9f42 JH |
57 | # We do this as a separate process else we'll blow the hell |
58 | # out of our namespace. | |
7200bc44 | 59 | sub compile_module { |
656b9f42 | 60 | my ($module) = $_[0]; |
41f7d568 | 61 | |
dc459aad JH |
62 | my $compmod = catfile(curdir(), 'lib', 'compmod.pl'); |
63 | my $lib = '-I' . catdir(updir(), 'lib'); | |
64 | ||
65 | my $out = scalar `$^X $lib $compmod $module`; | |
1189d1e4 JH |
66 | print "# $out"; |
67 | return $out =~ /^ok/; | |
7200bc44 | 68 | } |
6b40b044 | 69 | |
41f7d568 MS |
70 | # These modules have no tests of their own. |
71 | # Keep up to date with | |
72 | # http://www.pobox.com/~schwern/cgi-bin/perl-qa-wiki.cgi?UntestedModules | |
73 | # and vice-versa. The list should only shrink. | |
6b40b044 | 74 | __DATA__ |
41f7d568 | 75 | DynaLoader |