use strict;
use warnings;
+use Config;
-# This list really needs to be dynamic.
-
-my @Core_Modules = (
- 'AnyDBM_File',
- 'AutoLoader',
- 'AutoSplit',
- 'B', # Do all these B things compile everywhere?
- 'B::Asmdata',
- 'B::Assembler',
- 'B::Bblock',
- 'B::Bytecode',
- 'B::C',
- 'B::CC',
- 'B::Concise',
- 'B::Debug',
- 'B::Deparse',
- 'B::Disassembler',
- 'B::Lint',
- 'B::Showlex',
- 'B::Stackobj',
- 'B::Stash',
- 'B::Terse',
- 'B::Xref',
- 'Benchmark',
- 'ByteLoader',
- 'CGI',
- 'CGI::Apache',
- 'CGI::Carp',
- 'CGI::Cookie',
- # 'CGI::Fast', # won't load without FCGI
- 'CGI::Pretty',
- 'CGI::Push',
- 'CGI::Switch',
- 'CGI::Util',
- 'CPAN',
- 'CPAN::FirstTime',
- 'CPAN::Nox',
- 'Carp',
- 'Carp::Heavy',
- 'Class::Struct',
- 'Config',
- 'Cwd',
- 'DB',
- # DB_File # config specific
- 'Data::Dumper',
- # 'Devel::DProf', # needs to run as -d:DProf
- 'Devel::Peek',
- 'Devel::SelfStubber',
- 'DirHandle',
- 'Dumpvalue',
- 'DynaLoader', # config specific?
- 'English',
- 'Encode',
- 'Env',
- 'Errno',
- 'Exporter',
- 'Exporter::Heavy',
- 'ExtUtils::Command',
- 'ExtUtils::Embed',
- 'ExtUtils::Install',
- 'ExtUtils::Installed',
- 'ExtUtils::Liblist',
- # ExtUtils::MM_Cygwin # ExtUtils::MakeMaker takes
- # ExtUtils::MM_OS2 # care of testing these.
- # ExtUtils::MM_Unix
- # ExtUtils::MM_VMS
- # ExtUtils::MM_Win32
- 'ExtUtils::MakeMaker',
- 'ExtUtils::Manifest',
- 'ExtUtils::Mkbootstrap',
- 'ExtUtils::Mksymlists',
- 'ExtUtils::Packlist',
- 'ExtUtils::testlib',
- 'Fatal',
- 'Fcntl', # config specific?
- 'File::Basename',
- 'File::CheckTree',
- 'File::Compare',
- 'File::Copy',
- 'File::DosGlob',
- 'File::Find',
- 'File::Glob',
- 'File::Path',
- 'File::Spec',
- 'File::Spec::Functions',
- # File::Spec::EPOC # File::Spec will take care of
- # File::Spec::Mac # testing these compile.
- # File::Spec::OS2
- # File::Spec::Unix
- # File::Spec::VMS
- # File::Spec::Win32
- 'File::stat',
- 'FileCache',
- 'FileHandle',
- 'Filter::Simple',
- 'Filter::Util::Call',
- 'FindBin',
- 'Getopt::Long',
- 'Getopt::Std',
- 'I18N::Collate',
- 'IO',
- 'IO::Dir',
- 'IO::File',
- 'IO::Handle',
- 'IO::Pipe',
- 'IO::Poll',
- 'IO::Seekable',
- 'IO::Select',
- 'IO::Socket',
- 'IO::Socket::INET',
- # IO::Socket::UNIX # config specific
- 'IPC::Msg',
- 'IPC::Open2',
- 'IPC::Open3',
- 'IPC::Semaphore', # config specific?
- 'IPC::SysV', # config specific?
- 'Math::BigFloat',
- 'Math::BigInt',
- 'Math::Complex',
- 'Math::Trig',
- 'Net::Ping',
- 'Net::hostent',
- 'Net::netent',
- 'Net::protoent',
- 'Net::servent',
- 'O',
- 'Opcode',
- 'POSIX', # config specific?
- 'Pod::Checker',
- 'Pod::Find',
- 'Pod::Functions',
- 'Pod::Html',
- 'Pod::InputObjects',
- 'Pod::Man',
- 'Pod::ParseUtils',
- 'Pod::Parser',
- 'Pod::Plainer',
- 'Pod::Select',
- 'Pod::Text',
- 'Pod::Text::Color',
- 'Pod::Text::Overstrike',
- 'Pod::Text::Termcap',
- 'Pod::Usage',
- 'SDBM_File',
- 'Safe',
- 'Search::Dict',
- 'SelectSaver',
- 'SelfLoader',
- 'Shell',
- 'Socket',
- 'Symbol',
- 'Sys::Hostname',
- 'Sys::Syslog',
- 'Term::ANSIColor',
- 'Term::Cap',
- 'Term::Complete',
- 'Term::ReadLine',
- 'Test',
- 'Test::Harness',
- 'Text::Abbrev',
- 'Text::ParseWords',
- 'Text::Soundex',
- 'Text::Tabs',
- 'Text::Wrap',
- 'Tie::Array',
- 'Tie::Hash',
- 'Tie::RefHash',
- 'Tie::Scalar',
- 'Tie::SubstrHash',
- 'Time::Local',
- 'Time::gmtime',
- 'Time::localtime',
- 'Time::tm',
- 'UNIVERSAL',
- 'User::grent',
- 'User::pwent',
- 'XSLoader',
- 'attributes',
- 'attrs',
- 'autouse',
- 'blib',
- 'bytes',
- 'charnames',
- 'constant',
- 'diagnostics',
- 'filetest',
- 'integer',
- 'less',
- 'lib',
- 'locale',
- 'open',
- 'ops',
- 'overload',
- 're',
- 'sigtrap',
- 'strict',
- 'subs',
- 'unicode::distinct',
- 'utf8',
- 'vars',
- 'warnings',
- 'warnings::register',
- );
+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
+
+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 "not " unless compile_module($module);
+ print "# $module compile failed\nnot " unless compile_module($module);
print "ok $test_num\n";
$test_num++;
}
-
-# We do this as a seperate process else we'll blow the hell out of our
-# namespace.
+# We do this as a separate process else we'll blow the hell
+# out of our namespace.
sub compile_module {
- my($module) = @_;
+ my ($module) = $_[0];
- return scalar `./perl -Ilib t/lib/compmod.pl $module` =~ /^ok/;
+ 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
+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::Copy
+File::DosGlob
+File::Find
+File::Glob
+File::Path
+File::Spec
+File::Spec::Functions
+File::Temp
+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
+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
+UNIVERSAL
+XS::Typemap
+attrs
+autouse
+base
+bytes
+charnames
+constant
+diagnostics
+fields
+integer
+locale
+ops
+overload
+strict
+subs
+utf8
+warnings
+warnings::register