This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perly.y: Remove MYSUB
[perl5.git] / t / lib / 1_compile.t
index 2e7bc33..a4dea83 100644 (file)
 #!./perl
 
+# Modules should have their own tests.  For historical reasons, some
+# do not.  This does basic compile tests on modules that have no tests
+# of their own.
+
 BEGIN {
-    chdir '..' if -d '../pod' && -d '../t';
-    @INC = 'lib';
+    chdir 't';
+    @INC = '../lib';
 }
 
 use strict;
 use warnings;
+use File::Spec::Functions;
+
+# Okay, this is the list.
+
+my @Core_Modules = grep /\S/, <DATA>;
+chomp @Core_Modules;
+
+if (eval { require Socket }) {
+  # Two Net:: modules need the Convert::EBCDIC if in EBDCIC.
+  if (ord("A") != 193 || eval { require Convert::EBCDIC }) {
+      push @Core_Modules, qw(Net::Cmd Net::POP3);
+  }
+}
+
+@Core_Modules = sort @Core_Modules;
 
-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::Overstrike',
-                    'Pod::ParseUtils',
-                    'Pod::Parser',
-                    'Pod::Plainer',
-                    'Pod::Select',
-                    'Pod::Text',
-                    'Pod::Text::Color',
-                    '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',
-                   );         
+print "1..".(1+@Core_Modules)."\n";
 
-print "1..".@Core_Modules."\n";
+my $message
+  = "ok 1 - All modules should have tests # TODO Make Schwern Poorer\n";
+if (@Core_Modules) {
+  print "not $message";
+} else {
+  print $message;
+}
+print <<'EOREWARD';
+# http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2001-04/msg01223.html
+# 20010421230349.P2946@blackrider.blackstar.co.uk
+EOREWARD
+
+my $test_num = 2;
 
-my $test_num = 1;
 foreach my $module (@Core_Modules) {
-    print "not " unless compile_module($module);
-    print "ok $test_num\n";
+    my $todo = '';
+    $todo = "# TODO $module needs porting on $^O" if $module eq 'ByteLoader' && $^O eq 'VMS';
+    print "# $module compile failed\nnot " unless compile_module($module);
+    print "ok $test_num $todo\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) = @_;
-    
-    return scalar `./perl -Ilib t/lib/compmod.pl $module` =~ /^ok/;
+    my ($module) = $_[0];
+
+    my $compmod = catfile(curdir(), 'lib', 'compmod.pl');
+    my $lib     = '-I' . catdir(updir(), 'lib');
+
+    my $out = scalar `$^X $lib $compmod $module`;
+    print "# $out";
+    return $out =~ /^ok/;
 }
+
+# These modules have no tests of their own.
+# Keep up to date with
+# http://perl-qa.hexten.net/wiki/index.php/Untested_Core_Modules
+# and vice-versa.  The list should only shrink.
+__DATA__