X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2FTEST;h=c601e45977bbd531ead7a6f69d780e91adb68c0f;hb=2a5d9b1d41e4bafaa26126c5dea2f6ff0b72b6a7;hp=f724ecd83ca79869543a3231218df2e596f0c191;hpb=a58906773179c9740172c13629670adffd875da4;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/TEST b/t/TEST index f724ecd..c601e45 100755 --- a/t/TEST +++ b/t/TEST @@ -17,6 +17,7 @@ $ENV{PERL_CORE} = 1; # remove empty elements due to insertion of empty symbols via "''p1'" syntax @ARGV = grep($_,@ARGV) if $^O eq 'VMS'; +our $show_elapsed_time = $ENV{HARNESS_TIMER} || 0; # Cheesy version of Getopt::Std. Maybe we should replace it with that. { @@ -28,8 +29,6 @@ $ENV{PERL_CORE} = 1; $::torture = 1 if $1 eq 'torture'; $::with_utf8 = 1 if $1 eq 'utf8'; $::with_utf16 = 1 if $1 eq 'utf16'; - $::bytecompile = 1 if $1 eq 'bytecompile'; - $::compile = 1 if $1 eq 'compile'; $::taintwarn = 1 if $1 eq 'taintwarn'; $ENV{PERL_CORE_MINITEST} = 1 if $1 eq 'minitest'; if ($1 =~ /^deparse(,.+)?$/) { @@ -68,6 +67,7 @@ $ENV{EMXSHELL} = 'sh'; # For OS/2 # Roll your own File::Find! use TestInit; use File::Spec; +if ($show_elapsed_time) { require Time::HiRes } my $curdir = File::Spec->curdir; my $updir = File::Spec->updir; @@ -75,14 +75,14 @@ sub _find_tests { my($dir) = @_; opendir DIR, $dir or die "Trouble opening $dir: $!"; foreach my $f (sort { $a cmp $b } readdir DIR) { - next if $f eq $curdir or $f eq $updir or + next if $f eq $curdir or $f eq $updir or $f =~ /^(?:CVS|RCS|SCCS|\.svn)$/; - my $fullpath = File::Spec->catfile($dir, $f); + 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$/; + _find_tests($fullpath) if -d $fullpath; + $fullpath = VMS::Filespec::unixify($fullpath) if $^O eq 'VMS'; + push @ARGV, $fullpath if $f =~ /\.t$/; } } @@ -105,7 +105,7 @@ sub _populate_hash { unless (@ARGV) { foreach my $dir (qw(base comp cmd run io op uni)) { - _find_tests($dir); + _find_tests($dir); } _find_tests("lib") unless $::core; # Config.pm may be broken for make minitest. And this is only a refinement @@ -140,8 +140,9 @@ unless (@ARGV) { } my $mani = File::Spec->catfile($updir, "MANIFEST"); if (open(MANI, $mani)) { - while () { # similar code in t/harness - if (m!^(ext/(\S+)/+(?:[^/\s]+\.t|test\.pl)|lib/\S+?(?:\.t|test\.pl))\s!) { + my $ext_pat = $^O eq 'MSWin32' ? '(?:win32/)?ext' : 'ext'; + while () { # similar code in t/harness + if (m!^($ext_pat/(\S+)/+(?:[^/\s]+\.t|test\.pl)|lib/\S+?(?:\.t|test\.pl))\s!) { my $t = $1; my $extension = $2; if (!$::core || $t =~ m!^lib/[a-z]!) @@ -159,7 +160,7 @@ unless (@ARGV) { } close MANI; } else { - warn "$0: cannot open $mani: $!\n"; + warn "$0: cannot open $mani: $!\n"; } unless ($::core) { _find_tests('pod'); @@ -168,19 +169,9 @@ unless (@ARGV) { } } -# Tests known to cause infinite loops for the perlcc tests. -# %::infinite = ( 'comp/require.t', 1, 'op/bop.t', 1, 'lib/hostname.t', 1 ); -%::infinite = (); - if ($::deparse) { _testprogs('deparse', '', @ARGV); } -elsif( $::compile ) { - _testprogs('compile', '', @ARGV); -} -elsif( $::bytecompile ) { - _testprogs('bytecompile', '', @ARGV); -} elsif ($::with_utf16) { for my $e (0, 1) { for my $b (0, 1) { @@ -208,41 +199,25 @@ elsif ($::with_utf16) { } } else { - _testprogs('compile', '', @ARGV) if -e "../testcompile"; _testprogs('perl', '', @ARGV); } sub _testprogs { my ($type, $args, @tests) = @_; - print <<'EOT' if ($type eq 'compile'); ------------------------------------------------------------------------------- -TESTING COMPILER ------------------------------------------------------------------------------- -EOT - print <<'EOT' if ($type eq 'deparse'); ------------------------------------------------------------------------------ TESTING DEPARSER ------------------------------------------------------------------------------ EOT - print <catfile('t',$t); - $tname = VMS::Filespec::unixify($tname) if $^O eq 'VMS'; - $::path_to_name{$t} = $tname; + my $tname = File::Spec->catfile('t',$t); + $tname = VMS::Filespec::unixify($tname) if $^O eq 'VMS'; + $::path_to_name{$t} = $tname; } } my $maxlen = 0; @@ -259,14 +234,11 @@ EOT my $good_files = 0; my $tested_files = 0; my $totmax = 0; + my %failed_tests; - my $test; - while ($test = shift @tests) { + while (my $test = shift @tests) { + my $test_start_time = $show_elapsed_time ? Time::HiRes::time() : 0; - if ( $::infinite{$test} && $type eq 'compile' ) { - print STDERR "$test creates infinite loop! Skipping.\n"; - next; - } if ($test =~ /^$/) { next; } @@ -291,17 +263,17 @@ EOT # XXX DAPM %OVER not defined anywhere # $test = $OVER{$test} if exists $OVER{$test}; - open(SCRIPT,"<$test") or die "Can't run $test.\n"; - $_ =