+# Roll your own File::Find!
+use TestInit;
+use File::Spec;
+my $curdir = File::Spec->curdir;
+my $updir = File::Spec->updir;
+
+sub _find_tests {
+ my($dir) = @_;
+ opendir DIR, $dir || die "Trouble opening $dir: $!";
+ foreach my $f (sort { $a cmp $b } readdir DIR) {
+ next if $f eq $curdir or $f eq $updir;
+
+ my $fullpath = File::Spec->catfile($dir, $f);
+
+ _find_tests($fullpath) if -d $fullpath;
+ $fullpath = VMS::Filespec::unixify($fullpath) if $^O eq 'VMS';
+ push @ARGV, $fullpath if $f =~ /\.t$/;
+ }
+}
+
+sub _quote_args {
+ my ($args) = @_;
+ my $argstring = '';
+
+ foreach (split(/\s+/,$args)) {
+ # In VMS protect with doublequotes because otherwise
+ # DCL will lowercase -- unless already doublequoted.
+ $_ = q(").$_.q(") if ($^O eq 'VMS') && !/^\"/ && length($_) > 0;
+ $argstring .= ' ' . $_;
+ }
+ return $argstring;
+}
+
+unless (@ARGV) {
+ foreach my $dir (qw(base comp cmd run io op uni)) {
+ _find_tests($dir);
+ }
+ _find_tests("lib") unless $core;
+ my $mani = File::Spec->catfile($updir, "MANIFEST");
+ if (open(MANI, $mani)) {
+ while (<MANI>) { # similar code in t/harness
+ if (m!^(ext/\S+/?([^/]+\.t|test\.pl)|lib/\S+?(\.t|test\.pl))\s!) {
+ $t = $1;
+ if (!$core || $t =~ m!^lib/[a-z]!)
+ {
+ $path = File::Spec->catfile($updir, $t);
+ push @ARGV, $path;
+ $name{$path} = $t;
+ }
+ }
+ }
+ close MANI;
+ } else {
+ warn "$0: cannot open $mani: $!\n";
+ }
+ unless ($core) {
+ _find_tests('pod');
+ _find_tests('x2p');
+ _find_tests('japh') if $torture;
+ }