%OVER was removed in October 2001 with 6ff868ee and 73ddec28.
[p5sagit/p5-mst-13.2.git] / t / harness
index 9e3af04..afd4b6f 100644 (file)
--- a/t/harness
+++ b/t/harness
@@ -11,11 +11,11 @@ delete $ENV{PERL5LIB};
 
 my $torture; # torture testing?
 
-use Test::Harness;
+use TAP::Harness 3.13;
 use strict;
 
-$Test::Harness::switches = "";    # Too much noise otherwise
-$Test::Harness::Verbose++ while @ARGV && $ARGV[0] eq '-v' && shift;
+my $Verbose = 0;
+$Verbose++ while @ARGV && $ARGV[0] eq '-v' && shift;
 
 if ($ARGV[0] && $ARGV[0] eq '-torture') {
     shift;
@@ -88,17 +88,14 @@ if ($ARGV[0] && $ARGV[0]=~/^-re/) {
 }
 
 my $jobs = $ENV{TEST_JOBS};
-my ($fork, $rules, $state);
+my ($rules, $state, $color);
 if ($ENV{HARNESS_OPTIONS}) {
     for my $opt ( split /:/, $ENV{HARNESS_OPTIONS} ) {
         if ( $opt =~ /^j(\d*)$/ ) {
             $jobs ||= $1 || 9;
         }
-        elsif ( $opt eq 'f' ) {
-            $fork = 1;
-        }
         elsif ( $opt eq 'c' ) {
-#            $args->{color} = 1;
+            $color = 1;
         }
         else {
             die "Unknown HARNESS_OPTIONS item: $opt\n";
@@ -132,7 +129,7 @@ if (@ARGV) {
     unless (@tests) {
        my @seq = <base/*.t>;
 
-       my @next = qw(comp cmd run io op uni mro lib porting);
+       my @next = qw(comp run cmd io op uni mro lib porting);
        push @next, 'japh' if $torture;
        push @next, 'win32' if $^O eq 'MSWin32';
        push @next, 'benchmark' if $ENV{PERL_BENCHMARK};
@@ -212,7 +209,10 @@ if (@ARGV) {
        my %total_time;
 
        for (@last) {
-           m!(.*/)! or die "'$_'";
+           if ($^O eq 'MSWin32') {
+               s,\\,/,g; # canonicalize path
+           };
+           m!(.*[/])! or die "'$_'";
            push @{$dir{$1}}, $_;
            $total_time{$1} += $times{$_} || 0;
        }
@@ -235,32 +235,31 @@ if ($^O eq 'MSWin32') {
 @tests=grep /$re/, @tests 
     if $re;
 
-if ($jobs) {
-    eval 'use TAP::Harness 3.13; 1' or die $@;
+my $h = TAP::Harness->new({
+    rules       => $rules,
+    color       => $color,
+    jobs        => $jobs,
+    verbosity   => $Verbose,
+});
 
-    # Test::Harness parses $ENV{HARNESS_OPTIONS}, TAP::Harness does not
-    local $ENV{HARNESS_OPTIONS};
-    my $h = TAP::Harness->new({ jobs => $jobs, rules => $rules, ($fork ? (fork => $fork) : ())});
-    if ($state) {
-       $h->callback(
-                    after_test => sub {
-                        $state->observe_test(@_);
-                    }
-                   );
-       $h->callback(
-                    after_runtests => sub {
-                        $state->commit(@_);
-                    }
-                   );
-    }
+if ($state) {
     $h->callback(
-                parser_args => sub {
-                    my ( $args, $test ) = @_;
-                    push @{ $args->{switches} }, '-I../lib';
+                after_test => sub {
+                    $state->observe_test(@_);
                 }
-               );
-    $h->runtests(@tests);
-} else {
-    Test::Harness::runtests @tests;
+                );
+    $h->callback(
+                after_runtests => sub {
+                    $state->commit(@_);
+                }
+                );
 }
+
+$h->callback(
+            parser_args => sub {
+                my ( $args, $test ) = @_;
+                push @{ $args->{switches} }, '-I../lib';
+            }
+            );
+$h->runtests(@tests);
 exit(0);