summaryrefslogtreecommitdiff
path: root/t/harness
diff options
context:
space:
mode:
authorMichael G. Schwern <schwern@pobox.com>2009-03-03 20:42:55 -0800
committerNicholas Clark <nick@ccl4.org>2009-08-25 21:04:35 +0100
commitabd39864d34fd12aa6be10406c50ba479692b0cd (patch)
treebb32548c9bf29ae4fffc6f84eb0ea491f4a04005 /t/harness
parentc1b78184f1374bafe726cd45d46832499e48eb74 (diff)
downloadperl-abd39864d34fd12aa6be10406c50ba479692b0cd.tar.gz
Refactor t/harness to always use TAP::Harness.
No reason to screw around with half Test::Harness, half TAP::Harness. This normalization will make it easier to adapt the ext/Module tests. [Edited to remove the code related to the fork option, which was dropped from TAP::Harness with version 3.17. The now-unknown fork argument to a constructor generates an error.]
Diffstat (limited to 't/harness')
-rw-r--r--t/harness28
1 files changed, 12 insertions, 16 deletions
diff --git a/t/harness b/t/harness
index 9ea16a560c..e1f423352a 100644
--- 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";
@@ -238,12 +235,13 @@ if ($^O eq 'MSWin32') {
@tests=grep /$re/, @tests
if $re;
+my $h = TAP::Harness->new({
+ rules => $rules,
+ color => $color,
+ jobs => $jobs,
+ verbosity => $Verbose,
+});
if ($jobs) {
- eval 'use TAP::Harness 3.13; 1' or die $@;
-
- # 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 {
@@ -262,8 +260,6 @@ if ($jobs) {
push @{ $args->{switches} }, '-I../lib';
}
);
- $h->runtests(@tests);
-} else {
- Test::Harness::runtests @tests;
}
+$h->runtests(@tests);
exit(0);