X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2F1_compile.t;h=72628c30a797ffa2114cffa26de4a4ae0b604b56;hb=d9f203a5233af6609a4b98c6d12d865eadc274ea;hp=3613639119c08f4100be822bb5edeb9a74c5f40f;hpb=cdd2acaae915a9f5f9a37899f0692aacc1942539;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/lib/1_compile.t b/t/lib/1_compile.t index 3613639..72628c3 100644 --- a/t/lib/1_compile.t +++ b/t/lib/1_compile.t @@ -1,72 +1,71 @@ #!./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 Config; -use File::Find; - -my %Core_Modules; - -find(sub { - if ($File::Find::name =~ m!^lib\W+(.+)\.pm$!i) { - my $module = $1; - $module =~ s/[^\w-]/::/g; - $Core_Modules{$module}++; - } - }, "lib"); +use File::Spec::Functions; -# Delete stuff that can't be tested here. - -sub delete_unless_in_extensions { - delete $Core_Modules{$_[0]} unless $Config{extensions} =~ /\b$_[0]\b/; -} +# Okay, this is the list. -foreach my $known_extension (split(' ', $Config{known_extensions})) { - delete_unless_in_extensions($known_extension); -} +my @Core_Modules = grep /\S/, ; +chomp @Core_Modules; -sub delete_by_prefix { - delete @Core_Modules{grep { /^$_[0]/ } keys %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); + } } -delete $Core_Modules{'CGI::Fast'}; # won't load without FCGI - -delete $Core_Modules{'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 -$Core_Modules{'File::Spec::Functions'}++; # put this back +@Core_Modules = sort @Core_Modules; -delete_by_prefix('Thread::') unless $Config{extensions} =~ /\bThread\b/; +print "1..".(1+@Core_Modules)."\n"; -delete_by_prefix('unicode::'); -$Core_Modules{'unicode::distinct'}++; # put this back - -# Okay, this is the list. - -my @Core_Modules = sort keys %Core_Modules; - -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 = 1; +my $test_num = 2; foreach my $module (@Core_Modules) { + 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\n"; + print "ok $test_num $todo\n"; $test_num++; } - -# We do this as a separate 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://www.pobox.com/~schwern/cgi-bin/perl-qa-wiki.cgi?UntestedModules +# and vice-versa. The list should only shrink. +__DATA__