0N/A#!./perl
0N/A
0N/A# We suppose that perl _mostly_ works at this moment, so may use
0N/A# sophisticated testing.
0N/A
0N/ABEGIN {
0N/A chdir 't' if -d 't';
0N/A @INC = '../lib'; # pick up only this build's lib
0N/A $ENV{PERL5LIB} = '../lib'; # so children will see it too
0N/A}
0N/A
0N/Amy $torture; # torture testing?
0N/A
0N/Ause Test::Harness;
0N/A
0N/A$Test::Harness::switches = ""; # Too much noise otherwise
0N/A$Test::Harness::verbose = shift if @ARGV && $ARGV[0] eq '-v';
0N/A
0N/Aif ($ARGV[0] eq '-torture') {
0N/A shift;
0N/A $torture = 1;
0N/A}
0N/A
0N/A# Let tests know they're running in the perl core. Useful for modules
0N/A# which live dual lives on CPAN.
0N/A$ENV{PERL_CORE} = 1;
0N/A
0N/A#fudge DATA for now.
0N/A%datahandle = qw(
0N/A lib/bigint.t 1
0N/A lib/bigintpm.t 1
0N/A lib/bigfloat.t 1
0N/A lib/bigfloatpm.t 1
0N/A op/gv.t 1
0N/A lib/complex.t 1
0N/A lib/ph.t 1
0N/A lib/soundex.t 1
0N/A op/misc.t 1
0N/A op/runlevel.t 1
0N/A op/tie.t 1
0N/A op/lex_assign.t 1
0N/A );
0N/A
0N/Aforeach (keys %datahandle) {
0N/A unlink "$_.t";
0N/A}
0N/A
0N/Amy @tests = ();
0N/A
0N/Aif (@ARGV) {
0N/A if ($^O eq 'MSWin32') {
0N/A @tests = map(glob($_),@ARGV);
0N/A }
0N/A else {
0N/A @tests = @ARGV;
0N/A }
0N/A} else {
0N/A unless (@tests) {
0N/A push @tests, <base/*.t>;
0N/A push @tests, <comp/*.t>;
0N/A push @tests, <cmd/*.t>;
0N/A push @tests, <run/*.t>;
0N/A push @tests, <io/*.t>;
0N/A push @tests, <op/*.t>;
0N/A push @tests, <uni/*.t>;
0N/A push @tests, <lib/*.t>;
0N/A push @tests, <japh/*.t> if $torture;
0N/A push @tests, <win32/*.t> if $^O eq 'MSWin32';
0N/A use File::Spec;
0N/A my $updir = File::Spec->updir;
0N/A my $mani = File::Spec->catfile(File::Spec->updir, "MANIFEST");
0N/A if (open(MANI, $mani)) {
while (<MANI>) { # similar code in t/TEST
if (m!^(ext/\S+/?(?:[^/\s]+\.t|test\.pl)|lib/\S+?(?:\.t|test\.pl))\s!) {
push @tests, File::Spec->catfile($updir, $1);
}
}
close MANI;
} else {
warn "$0: cannot open $mani: $!\n";
}
push @tests, <pod/*.t>;
push @tests, <x2p/*.t>;
}
}
if ($^O eq 'MSWin32') {
s,\\,/,g for @tests;
}
Test::Harness::runtests @tests;
exit(0) unless -e "../testcompile";
# %infinite = qw (
# op/bop.t 1
# lib/hostname.t 1
# op/lex_assign.t 1
# lib/ph.t 1
# );
my $dhwrapper = <<'EOT';
open DATA,"<".__FILE__;
until (($_=<DATA>) =~ /^__END__/) {};
EOT
@tests = grep (!$infinite{$_}, @tests);
@tests = map {
my $new = $_;
if ($datahandle{$_} && !( -f "$new.t") ) {
$new .= '.t';
local(*F, *T);
open(F,"<$_") or die "Can't open $_: $!";
open(T,">$new") or die "Can't open $new: $!";
print T $dhwrapper, <F>;
close F;
close T;
}
$new;
} @tests;
print "The tests ", join(' ', keys(%infinite)),
" generate infinite loops! Skipping!\n";
$ENV{'HARNESS_COMPILE_TEST'} = 1;
$ENV{'PERLCC_TIMEOUT'} = 120 unless $ENV{'PERLCC_TIMEOUT'};
Test::Harness::runtests @tests;
foreach (keys %datahandle) {
unlink "$_.t";
}