X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2FTEST;h=59c8fa52829c87cd93b262e9c67f2cdf828fd55c;hb=18eaf740981d16295448f4e0ae82e559be636a26;hp=f724ecd83ca79869543a3231218df2e596f0c191;hpb=a58906773179c9740172c13629670adffd875da4;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/TEST b/t/TEST index f724ecd..59c8fa5 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. { @@ -68,6 +69,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 +77,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 +107,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,7 +142,7 @@ unless (@ARGV) { } my $mani = File::Spec->catfile($updir, "MANIFEST"); if (open(MANI, $mani)) { - while () { # similar code in t/harness + while () { # similar code in t/harness if (m!^(ext/(\S+)/+(?:[^/\s]+\.t|test\.pl)|lib/\S+?(?:\.t|test\.pl))\s!) { my $t = $1; my $extension = $2; @@ -159,7 +161,7 @@ unless (@ARGV) { } close MANI; } else { - warn "$0: cannot open $mani: $!\n"; + warn "$0: cannot open $mani: $!\n"; } unless ($::core) { _find_tests('pod'); @@ -175,7 +177,7 @@ unless (@ARGV) { if ($::deparse) { _testprogs('deparse', '', @ARGV); } -elsif( $::compile ) { +elsif( $::compile ) { _testprogs('compile', '', @ARGV); } elsif( $::bytecompile ) { @@ -234,15 +236,15 @@ TESTING BYTECODE COMPILER EOT $ENV{PERLCC_TIMEOUT} = 120 - if ($type eq 'compile' && !$ENV{PERLCC_TIMEOUT}); + if ($type eq 'compile' && !$ENV{PERLCC_TIMEOUT}); $::bad_files = 0; foreach my $t (@tests) { unless (exists $::path_to_name{$t}) { - my $tname = File::Spec->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; @@ -260,12 +262,12 @@ EOT my $tested_files = 0; my $totmax = 0; - 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; + next; } if ($test =~ /^$/) { next; @@ -291,17 +293,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"; - $_ =