X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2FTEST;h=f2f623df797b556a6864b185e27adb235ecfdb90;hb=4cd2bd1f390724a103e72b993d7f67fb405628ad;hp=37a2e70ae4e20aa157129f5d7254d3e0072f73e2;hpb=c5117498be098729dc2af28089bd130c88c8d42b;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/TEST b/t/TEST index 37a2e70..f2f623d 100755 --- a/t/TEST +++ b/t/TEST @@ -1,122 +1,414 @@ #!./perl -# $RCSfile: TEST,v $$Revision: 4.1 $$Date: 92/08/07 18:27:00 $ - # This is written in a peculiar style, since we're trying to avoid # most of the constructs we'll be testing for. $| = 1; -if ($ARGV[0] eq '-v') { - $verbose = 1; - shift; +# Let tests know they're running in the perl core. Useful for modules +# which live dual lives on CPAN. +$ENV{PERL_CORE} = 1; + +# remove empty elements due to insertion of empty symbols via "''p1'" syntax +@ARGV = grep($_,@ARGV) if $^O eq 'VMS'; + +# Cheesy version of Getopt::Std. Maybe we should replace it with that. +@argv = (); +if ($#ARGV >= 0) { + foreach my $idx (0..$#ARGV) { + push( @argv, $ARGV[$idx] ), next unless $ARGV[$idx] =~ /^-(\S+)$/; + $core = 1 if $1 eq 'core'; + $verbose = 1 if $1 eq 'v'; + $torture = 1 if $1 eq 'torture'; + $with_utf= 1 if $1 eq 'utf8'; + $byte_compile = 1 if $1 eq 'bytecompile'; + $compile = 1 if $1 eq 'compile'; + if ($1 =~ /^deparse(,.+)?$/) { + $deparse = 1; + $deparse_opts = $1; + } + } } +@ARGV = @argv; chdir 't' if -f 't/TEST'; -die "You need to run \"make test\" first to set things up.\n" - unless -e 'perl' or -e 'perl.exe'; +die "You need to run \"make test\" first to set things up.\n" + unless -e 'perl' or -e 'perl.exe' or -e 'perl.pm'; + +if ($ENV{PERL_3LOG}) { # Tru64 third(1) tool, see perlhack + unless (-x 'perl.third') { + unless (-x '../perl.third') { + die "You need to run \"make perl.third first.\n"; + } + else { + print "Symlinking ../perl.third as perl.third...\n"; + die "Failed to symlink: $!\n" + unless symlink("../perl.third", "perl.third"); + die "Symlinked but no executable perl.third: $!\n" + unless -x 'perl.third'; + } + } +} + +# check leakage for embedders +$ENV{PERL_DESTRUCT_LEVEL} = 2 unless exists $ENV{PERL_DESTRUCT_LEVEL}; $ENV{EMXSHELL} = 'sh'; # For OS/2 -if ($ARGV[0] eq '') { - @ARGV = split(/[ \n]/, - `echo base/*.t comp/*.t cmd/*.t io/*.t; echo op/*.t lib/*.t`); +# 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$/; + } } -open(CONFIG,"../config.sh"); -while () { - if (/sharpbang='(.*)'/) { - $sharpbang = ($1 eq '#!'); - last; +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; } -$sharpbang = 0 if $ENV{OS2_SHELL}; # OS/2 -$sharpbang = 0 if ($^O eq 'qnx'); # QNX -$bad = 0; -$good = 0; -$total = @ARGV; -while ($test = shift) { - if ($test =~ /^$/) { - next; + +unless (@ARGV) { + foreach my $dir (qw(base comp cmd run io op uni)) { + _find_tests($dir); } - $te = $test; - chop($te); - print "$te" . '.' x (18 - length($te)); - if ($sharpbang) { - open(results,"./$test |") || (print "can't run.\n"); - } else { - open(script,"$test") || die "Can't run $test.\n"; - $_ =