3 # We suppose that perl _mostly_ works at this moment, so may use
4 # sophisticated testing.
8 @INC = '../lib'; # pick up only this build's lib
9 $ENV{PERL5LIB} = '../lib'; # so children will see it too
12 my $torture; # torture testing?
16 $Test::Harness::switches = ""; # Too much noise otherwise
17 $Test::Harness::verbose = shift if @ARGV && $ARGV[0] eq '-v';
19 if ($ARGV[0] && $ARGV[0] eq '-torture') {
24 # Let tests know they're running in the perl core. Useful for modules
25 # which live dual lives on CPAN.
44 foreach (keys %datahandle) {
50 # [.VMS]TEST.COM calls harness with empty arguments, so clean-up @ARGV
51 @ARGV = grep $_ && length( $_ ) => @ARGV;
54 return map {$_, 1} split /\s+/, $_[0];
57 if ($ARGV[0] && $ARGV[0]=~/^-re/) {
63 (undef,$re)=split/=/,shift;
68 if ($^O eq 'MSWin32') {
69 @tests = map(glob($_),@ARGV);
76 push @tests, <base/*.t>;
77 push @tests, <comp/*.t>;
78 push @tests, <cmd/*.t>;
79 push @tests, <run/*.t>;
80 push @tests, <io/*.t>;
81 push @tests, <op/*.t>;
82 push @tests, <uni/*.t>;
83 push @tests, <lib/*.t>;
84 push @tests, <japh/*.t> if $torture;
85 push @tests, <win32/*.t> if $^O eq 'MSWin32';
89 my %extensions = _populate_hash $Config{'extensions'};
90 my %known_extensions = _populate_hash $Config{'known_extensions'};
91 foreach (keys %known_extensions) {
92 $skip{$_}++ unless $extensions{$_};
96 my $updir = File::Spec->updir;
97 my $mani = File::Spec->catfile(File::Spec->updir, "MANIFEST");
98 if (open(MANI, $mani)) {
100 while (<MANI>) { # similar code in t/TEST
101 if (m!^(ext/(\S+)/+(?:[^/\s]+\.t|test\.pl)|lib/\S+?(?:\.t|test\.pl))\s!) {
102 my ($test, $extension) = ($1, $2);
103 if (defined $extension) {
104 $extension =~ s!/t$!!;
105 # XXX Do I want to warn that I'm skipping these?
106 next if $skip{$extension};
108 push @manitests, File::Spec->catfile($updir, $test);
112 # Sort the list of test files read from MANIFEST into a sensible
113 # order instead of using the order in which they are listed there
114 push @tests, sort { lc $a cmp lc $b } @manitests;
116 warn "$0: cannot open $mani: $!\n";
118 push @tests, <pod/*.t>;
119 push @tests, <x2p/*.t>;
122 if ($^O eq 'MSWin32') {
125 @tests=grep /$re/, @tests
127 Test::Harness::runtests @tests;
128 exit(0) unless -e "../testcompile";
137 my $dhwrapper = <<'EOT';
138 open DATA,"<".__FILE__;
139 until (($_=<DATA>) =~ /^__END__/) {};
142 @tests = grep (!$infinite{$_}, @tests);
145 if ($datahandle{$_} && !( -f "$new.t") ) {
148 open(F,"<$_") or die "Can't open $_: $!";
149 open(T,">$new") or die "Can't open $new: $!";
150 print T $dhwrapper, <F>;
157 print "The tests ", join(' ', keys(%infinite)),
158 " generate infinite loops! Skipping!\n";
160 $ENV{'HARNESS_COMPILE_TEST'} = 1;
161 $ENV{'PERLCC_TIMEOUT'} = 120 unless $ENV{'PERLCC_TIMEOUT'};
163 Test::Harness::runtests @tests;
164 foreach (keys %datahandle) {