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?
17 $Test::Harness::switches = ""; # Too much noise otherwise
18 $Test::Harness::Verbose++ while @ARGV && $ARGV[0] eq '-v' && shift;
20 if ($ARGV[0] && $ARGV[0] eq '-torture') {
25 # Let tests know they're running in the perl core. Useful for modules
26 # which live dual lives on CPAN.
45 foreach (keys %datahandle) {
51 # [.VMS]TEST.COM calls harness with empty arguments, so clean-up @ARGV
52 @ARGV = grep $_ && length( $_ ) => @ARGV;
55 return map {$_, 1} split /\s+/, $_[0];
58 if ($ARGV[0] && $ARGV[0]=~/^-re/) {
64 (undef,$re)=split/=/,shift;
69 if ($^O eq 'MSWin32') {
70 @tests = map(glob($_),@ARGV);
77 push @tests, <base/*.t>;
78 push @tests, <comp/*.t>;
79 push @tests, <cmd/*.t>;
80 push @tests, <run/*.t>;
81 push @tests, <io/*.t>;
82 push @tests, <op/*.t>;
83 push @tests, <uni/*.t>;
84 push @tests, <mro/*.t>;
85 push @tests, <lib/*.t>;
86 push @tests, <japh/*.t> if $torture;
87 push @tests, <win32/*.t> if $^O eq 'MSWin32';
91 my %extensions = _populate_hash $Config{'extensions'};
92 my %known_extensions = _populate_hash $Config{'known_extensions'};
93 foreach (keys %known_extensions) {
94 $skip{$_}++ unless $extensions{$_};
98 my $updir = File::Spec->updir;
99 my $mani = File::Spec->catfile(File::Spec->updir, "MANIFEST");
100 if (open(MANI, $mani)) {
102 my $ext_pat = $^O eq 'MSWin32' ? '(?:win32/)?ext' : 'ext';
103 while (<MANI>) { # similar code in t/TEST
104 if (m!^($ext_pat/(\S+)/+(?:[^/\s]+\.t|test\.pl)|lib/\S+?(?:\.t|test\.pl))\s!) {
105 my ($test, $extension) = ($1, $2);
106 if (defined $extension) {
107 $extension =~ s!/t$!!;
108 # XXX Do I want to warn that I'm skipping these?
109 next if $skip{$extension};
111 push @manitests, File::Spec->catfile($updir, $test);
115 # Sort the list of test files read from MANIFEST into a sensible
116 # order instead of using the order in which they are listed there
117 push @tests, sort { lc $a cmp lc $b } @manitests;
119 warn "$0: cannot open $mani: $!\n";
121 push @tests, <Module_Pluggable/*.t>;
122 push @tests, <pod/*.t>;
123 push @tests, <x2p/*.t>;
126 if ($^O eq 'MSWin32') {
129 @tests=grep /$re/, @tests
131 Test::Harness::runtests @tests;