| 1 | package TAP::Harness; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 21 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 21 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 21 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 21 | ▶ | use File::Spec; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 21 | ▶ | use File::Path; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 21 | ▶ | use IO::Handle; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 21 | ▶ | use base 'TAP::Base'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | TAP::Harness - Run test scripts with statistics | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | Version 3.52 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 21 | our $VERSION = '3.52'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 21 | $ENV{HARNESS_ACTIVE} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 21 | $ENV{HARNESS_VERSION} = $VERSION; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 21 | ▶ | END { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
END: called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | # For VMS. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | ▶ | delete $ENV{HARNESS_ACTIVE}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
END: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | delete $ENV{HARNESS_VERSION}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | This is a simple test harness which allows tests to be run and results | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | automatically aggregated and output to STDOUT. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | use TAP::Harness; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | my $harness = TAP::Harness->new( \%args ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | $harness->runtests(@tests); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 21 | my %VALIDATION_FOR; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | my @FORMATTER_ARGS; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 169 | ▶ | sub _error { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_error: called CC=2 SCAR=12.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_error: not called CC=2 SCAR=12.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | ▶ | return $self->{error} unless @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | $self->{error} = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 21 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=5 SCAR=17.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 21 | @FORMATTER_ARGS = qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | directives verbosity timer failures comments errors stdout color | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | show_count normalize | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | %VALIDATION_FOR = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 46 | ▶ | lib => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 46 | my ( $self, $libs ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 46 | ▶ | $libs = [$libs] unless 'ARRAY' eq ref $libs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 46 | return [ map {"-I$_"} @$libs ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 45 | ▶ | switches => sub { shift; shift }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 7 | ▶ | exec => sub { shift; shift }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 1 | ▶ | merge => sub { shift; shift }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 3 | ▶ | aggregator_class => sub { shift; shift }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 8 | ▶ | formatter_class => sub { shift; shift }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 3 | ▶ | multiplexer_class => sub { shift; shift }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 3 | ▶ | parser_class => sub { shift; shift }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 3 | ▶ | scheduler_class => sub { shift; shift }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | ▶ | formatter => sub { shift; shift }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 4 | ▶ | jobs => sub { shift; shift }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 2 | ▶ | test_args => sub { shift; shift }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 41 | ▶ | ignore_exit => sub { shift; shift }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | ▶ | rules => sub { shift; shift }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 1 | ▶ | rulesfile => sub { shift; shift }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 2 | ▶ | sources => sub { shift; shift }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | version => sub { shift; shift }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | ▶ | trap => sub { shift; shift }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 21 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 21 | for my $method ( keys %VALIDATION_FOR ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 21 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 378 | ▶ | if ( $method eq 'lib' || $method eq 'switches' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$method eq "lib" or $method eq "switches"
MC/DC100%2/2
$method eq "lib" or $method eq "switches"
$method eq "lib"
$method eq "switches"
Truth table100%3/3
A or B
A= $method eq "lib"B= $method eq "switches"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 42 | ▶ | *{$method} = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=6 SCAR=23.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=6 SCAR=23.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | ▶ | unless (@_) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | ▶ | $self->{$method} ||= []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$self->{$method} ||= []
$self->{$method} ||= []
MC/DC100%1/1
$self->{$method} ||= []
$self->{$method}
MC/DC0%0/1
$self->{$method} ||= []
$self->{$method}
Truth table100%2/2
A
A= $self->{$method}
Truth table0%0/2
A
A= $self->{$method}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | return wantarray | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | ? @{ $self->{$method} } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | ▶ | : $self->{$method}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | ▶ | $self->_croak("Too many arguments to method '$method'") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | if @_ > 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | my $args = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | ▶ | $args = [$args] unless ref $args; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | $self->{$method} = $args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 42 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 336 | ▶ | *{$method} = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=8.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=9.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | ▶ | return $self->{$method} unless @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | $self->{$method} = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 336 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 21 | for my $method (@FORMATTER_ARGS) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 21 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 210 | ▶ | *{$method} = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | return $self->formatter->$method(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 210 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | =head2 Class Methods | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | =head3 C<new> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | my %args = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | verbosity => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | lib => [ 'lib', 'blib/lib', 'blib/arch' ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | my $harness = TAP::Harness->new( \%args ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | The constructor returns a new C<TAP::Harness> object. It accepts an | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | optional hashref whose allowed keys are: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | =item * C<verbosity> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | Set the verbosity level: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 1 verbose Print individual test results to STDOUT. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 normal | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | -1 quiet Suppress some test output (mostly failures | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | while tests are running). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | -2 really quiet Suppress everything but the tests summary. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | -3 silent Suppress everything. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | =item * C<timer> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | Append run time for each test to output. Uses L<Time::HiRes> if | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | available. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | =item * C<failures> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | Show test failures (this is a no-op if C<verbose> is selected). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | =item * C<comments> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | Show test comments (this is a no-op if C<verbose> is selected). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | =item * C<show_count> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | Update the running test count during testing. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | =item * C<normalize> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | Set to a true value to normalize the TAP that is emitted in verbose modes. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | =item * C<lib> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | Accepts a scalar value or array ref of scalar values indicating which | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | paths to allowed libraries should be included if Perl tests are | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | executed. Naturally, this only makes sense in the context of tests | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | written in Perl. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | =item * C<switches> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | Accepts a scalar value or array ref of scalar values indicating which | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | switches should be included if Perl tests are executed. Naturally, this | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | only makes sense in the context of tests written in Perl. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | =item * C<test_args> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | A reference to an C<@INC> style array of arguments to be passed to each | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | test program. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | test_args => ['foo', 'bar'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | if you want to pass different arguments to each test then you should | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | pass a hash of arrays, keyed by the alias for each test: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | test_args => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | my_test => ['foo', 'bar'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | other_test => ['baz'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | =item * C<color> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | Attempt to produce color output. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | =item * C<exec> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | Typically, Perl tests are run through this. However, anything which | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | spits out TAP is fine. You can use this argument to specify the name of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | the program (and optional switches) to run your tests with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | exec => ['/usr/bin/ruby', '-w'] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | You can also pass a subroutine reference in order to determine and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | return the proper program to run based on a given test script. The | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | subroutine reference should expect the TAP::Harness object itself as the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | first argument, and the file name as the second argument. It should | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | return an array reference containing the command to be run and including | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | the test file name. It can also simply return C<undef>, in which case | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | TAP::Harness will fall back on executing the test script in Perl: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | exec => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | my ( $harness, $test_file ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | # Let Perl tests run. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | return undef if $test_file =~ /[.]t$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | return [ qw( /usr/bin/ruby -w ), $test_file ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | if $test_file =~ /[.]rb$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | If the subroutine returns a scalar with a newline or a filehandle, it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | will be interpreted as raw TAP or as a TAP stream, respectively. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | =item * C<merge> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | If C<merge> is true the harness will create parsers that merge STDOUT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | and STDERR together for any processes they start. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | =item * C<sources> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | I<NEW to 3.18>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | If set, C<sources> must be a hashref containing the names of the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | L<TAP::Parser::SourceHandler>s to load and/or configure. The values are a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | hash of configuration that will be accessible to the source handlers via | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | L<TAP::Parser::Source/config_for>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | For example: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | sources => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | Perl => { exec => '/path/to/custom/perl' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | File => { extensions => [ '.tap', '.txt' ] }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | MyCustom => { some => 'config' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | The C<sources> parameter affects how C<source>, C<tap> and C<exec> parameters | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | are handled. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | For more details, see the C<sources> parameter in L<TAP::Parser/new>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | L<TAP::Parser::Source>, and L<TAP::Parser::IteratorFactory>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | =item * C<aggregator_class> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | The name of the class to use to aggregate test results. The default is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | L<TAP::Parser::Aggregator>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | =item * C<version> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | I<NEW to 3.22>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | Assume this TAP version for L<TAP::Parser> instead of default TAP | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | version 12. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | =item * C<formatter_class> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | The name of the class to use to format output. The default is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | L<TAP::Formatter::Console>, or L<TAP::Formatter::File> if the output | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | isn't a TTY. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | =item * C<multiplexer_class> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | The name of the class to use to multiplex tests during parallel testing. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | The default is L<TAP::Parser::Multiplexer>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | =item * C<parser_class> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | The name of the class to use to parse TAP. The default is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | L<TAP::Parser>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | =item * C<scheduler_class> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | The name of the class to use to schedule test execution. The default is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | L<TAP::Parser::Scheduler>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | =item * C<formatter> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | If set C<formatter> must be an object that is capable of formatting the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | TAP output. See L<TAP::Formatter::Console> for an example. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | =item * C<errors> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | If parse errors are found in the TAP output, a note of this will be | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | made in the summary report. To see all of the parse errors, set this | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | argument to true: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | errors => 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | =item * C<directives> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | If set to a true value, only test results with directives will be | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | displayed. This overrides other settings such as C<verbose> or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | C<failures>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | =item * C<ignore_exit> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | If set to a true value instruct C<TAP::Parser> to ignore exit and wait | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | status from test scripts. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | =item * C<jobs> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | The maximum number of parallel tests to run at any time. Which tests | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | can be run in parallel is controlled by C<rules>. The default is to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | run only one test at a time. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | =item * C<rules> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | A reference to a hash of rules that control which tests may be executed in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | parallel. If no rules are declared and L<CPAN::Meta::YAML> is available, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | C<TAP::Harness> attempts to load rules from a YAML file specified by the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | C<rulesfile> parameter. If no rules file exists, the default is for all | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | tests to be eligible to be run in parallel. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | Here some simple examples. For the full details of the data structure | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | and the related glob-style pattern matching, see | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | L<TAP::Parser::Scheduler/"Rules data structure">. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | # Run all tests in sequence, except those starting with "p" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | $harness->rules({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | par => 't/p*.t' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | # Equivalent YAML file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | --- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | par: t/p*.t | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | # Run all tests in parallel, except those starting with "p" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | $harness->rules({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | seq => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | { seq => 't/p*.t' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | { par => '**' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | # Equivalent YAML file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | --- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | seq: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | - seq: t/p*.t | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | - par: ** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | # Run some startup tests in sequence, then some parallel tests than some | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | # teardown tests in sequence. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | $harness->rules({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | seq => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | { seq => 't/startup/*.t' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | { par => ['t/a/*.t','t/b/*.t','t/c/*.t'], } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | { seq => 't/shutdown/*.t' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | # Equivalent YAML file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | --- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | seq: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | - seq: t/startup/*.t | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | - par: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | - t/a/*.t | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | - t/b/*.t | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | - t/c/*.t | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | - seq: t/shutdown/*.t | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | This is an experimental feature and the interface may change. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | =item * C<rulesfiles> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | This specifies where to find a YAML file of test scheduling rules. If not | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | provided, it looks for a default file to use. It first checks for a file given | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | in the C<HARNESS_RULESFILE> environment variable, then it checks for | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | F<testrules.yml> and then F<t/testrules.yml>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | =item * C<stdout> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | A filehandle for catching standard output. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | =item * C<trap> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | Attempt to print summary information if run is interrupted by | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | SIGINT (Ctrl-C). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | Any keys for which the value is C<undef> will be ignored. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | # new supplied by TAP::Base | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 21 | my @legal_callback = qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | parser_args | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | made_parser | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | before_runtests | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | after_runtests | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | after_test | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 21 | my %default_class = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | aggregator_class => 'TAP::Parser::Aggregator', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | formatter_class => 'TAP::Formatter::Console', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | multiplexer_class => 'TAP::Parser::Multiplexer', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | parser_class => 'TAP::Parser', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | scheduler_class => 'TAP::Parser::Scheduler', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 91 | ▶ | sub _initialize { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_initialize: called CC=16 SCAR=41.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 0 | ▶ | my ( $self, $arg_for ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_initialize: not called CC=16 SCAR=41.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 0 | ▶ | $arg_for ||= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$arg_for ||= {}
$arg_for ||= {}
MC/DC100%1/1
$arg_for ||= {}
$arg_for
MC/DC0%0/1
$arg_for ||= {}
$arg_for
Truth table100%2/2
A
A= $arg_for
Truth table0%0/2
A
A= $arg_for
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | $self->SUPER::_initialize( $arg_for, \@legal_callback ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | my %arg_for = %$arg_for; # force a shallow copy | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 0 | for my $name ( keys %VALIDATION_FOR ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 0 | my $property = delete $arg_for{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | ▶ | if ( defined $property ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 0 | my $validate = $VALIDATION_FOR{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 0 | my $value = $self->$validate($property); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 0 | ▶ | if ( $self->_error ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 0 | $self->_croak; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 0 | $self->$name($value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 0 | ▶ | $self->jobs(1) unless defined $self->jobs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 0 | ▶ | if ( ! defined $self->rules ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 0 | $self->_maybe_load_rulesfile; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | local $default_class{formatter_class} = 'TAP::Formatter::File' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | ▶ | unless -t ( $arg_for{stdout} || \*STDOUT ) && !$ENV{HARNESS_NOTTY}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition30%3/10
-t ($arg_for{"stdout"} || \*STDOUT) and not $ENV{"HARNESS_NOTTY"}
$arg_for{'stdout'} || \*STDOUT
-t ($arg_for{"stdout"} || \*STDOUT) and not $ENV{"HARNESS_NOTTY"}
$arg_for{'stdout'} || \*STDOUT
MC/DC0%0/2
-t ($arg_for{"stdout"} || \*STDOUT) and not $ENV{"HARNESS_NOTTY"}
$arg_for{'stdout'}
not $ENV{"HARNESS_NOTTY"}
MC/DC0%0/2
-t ($arg_for{"stdout"} || \*STDOUT) and not $ENV{"HARNESS_NOTTY"}
$arg_for{'stdout'}
not $ENV{"HARNESS_NOTTY"}
Truth table33%1/3
A and not(B)
A= $arg_for{'stdout'}B= not $ENV{"HARNESS_NOTTY"}
Truth table0%0/3
A and not(B)
A= $arg_for{'stdout'}B= not $ENV{"HARNESS_NOTTY"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 0 | ▶ | while ( my ( $attr, $class ) = each %default_class ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 0 | ▶ | $self->$attr( $self->$attr() || $class ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
$self->$attr || $class
$self->$attr || $class
MC/DC0%0/2
$self->$attr || $class
$self->$attr
$class
MC/DC0%0/2
$self->$attr || $class
$self->$attr
$class
Truth table66%2/3
A || B
A= $self->$attrB= $class
Truth table0%0/3
A || B
A= $self->$attrB= $class
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 0 | ▶ | unless ( $self->formatter ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | # This is a little bodge to preserve legacy behaviour. It's | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | # pretty horrible that we know which args are destined for | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | # the formatter. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 0 | my %formatter_args = ( jobs => $self->jobs ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 0 | for my $name (@FORMATTER_ARGS) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 0 | ▶ | if ( defined( my $property = delete $arg_for{$name} ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | $formatter_args{$name} = $property; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | $self->formatter( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 0 | $self->_construct( $self->formatter_class, \%formatter_args ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 0 | ▶ | if ( my @props = keys %arg_for ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 0 | $self->_croak('Unknown arguments to TAP::Harness::new ('.join(' ',sort @props).')'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 91 | ▶ | sub _maybe_load_rulesfile { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_maybe_load_rulesfile: called CC=9 SCAR=32.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_maybe_load_rulesfile: not called CC=9 SCAR=32.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | my ($rulesfile) = defined $self->rulesfile ? $self->rulesfile : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | defined($ENV{HARNESS_RULESFILE}) ? $ENV{HARNESS_RULESFILE} : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 0 | ▶ | grep { -r } qw(./testrules.yml t/testrules.yml); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 0 | ▶ | if ( defined $rulesfile && -r $rulesfile ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%2/6
defined $rulesfile and -r $rulesfile
defined $rulesfile and -r $rulesfile
MC/DC50%1/2
defined $rulesfile and -r $rulesfile
defined $rulesfile
-r $rulesfile
MC/DC0%0/2
defined $rulesfile and -r $rulesfile
defined $rulesfile
-r $rulesfile
Truth table66%2/3
A and B
A= defined $rulesfileB= -r $rulesfile
Truth table0%0/3
A and B
A= defined $rulesfileB= -r $rulesfile
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 0 | ▶ | if ( ! eval { require CPAN::Meta::YAML; 1} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | warn "CPAN::Meta::YAML required to process $rulesfile" ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 0 | ▶ | my $layer = "$]" < "5.008" ? "" : ":encoding(UTF-8)"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | ▶ | open my $fh, "<$layer", $rulesfile | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | or die "Couldn't open $rulesfile: $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 0 | my $yaml_text = do { local $/; <$fh> }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 0 | ▶ | my $yaml = CPAN::Meta::YAML->read_string($yaml_text) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | or die CPAN::Meta::YAML->errstr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 0 | $self->rules( $yaml->[0] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | =head2 Instance Methods | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | =head3 C<runtests> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | $harness->runtests(@tests); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | Accepts an array of C<@tests> to be run. This should generally be the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | names of test files, but this is not required. Each element in C<@tests> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | will be passed to C<TAP::Parser::new()> as a C<source>. See | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | L<TAP::Parser> for more information. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | It is possible to provide aliases that will be displayed in place of the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | test name by supplying the test as a reference to an array containing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | C<< [ $test, $alias ] >>: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | $harness->runtests( [ 't/foo.t', 'Foo Once' ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | [ 't/foo.t', 'Foo Twice' ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | Normally it is an error to attempt to run the same test twice. Aliases | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | allow you to overcome this limitation by giving each run of the test a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | unique name. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | Tests will be run in the order found. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | If the environment variable C<PERL_TEST_HARNESS_DUMP_TAP> is defined it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | should name a directory into which a copy of the raw TAP for each test | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | will be written. TAP is written to files named for each test. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | Subdirectories will be created as needed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | Returns a L<TAP::Parser::Aggregator> containing the test results. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 21 | ▶ | sub runtests { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
runtests: called CC=2 SCAR=10.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | 0 | ▶ | my ( $self, @tests ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
runtests: not called CC=2 SCAR=10.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 0 | my $aggregate = $self->_construct( $self->aggregator_class ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 0 | $self->_make_callback( 'before_runtests', $aggregate ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 0 | $aggregate->start; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 47 | ▶ | my $finish = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 0 | ▶ | my $interrupted = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 0 | $aggregate->stop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 0 | $self->summary( $aggregate, $interrupted ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 0 | $self->_make_callback( 'after_runtests', $aggregate ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 47 | ▶ | my $run = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=18.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 0 | ▶ | my $bailout; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=18.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 0 | eval { $self->aggregate_tests( $aggregate, @tests ); 1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 0 | ▶ | or do { $bailout = $@ || 'unknown_error' }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition25%1/4
$@ || 'unknown_error'
$@ || 'unknown_error'
MC/DC0%0/1
$@ || 'unknown_error'
$@
MC/DC0%0/1
$@ || 'unknown_error'
$@
Truth table50%1/2
A
A= $@
Truth table0%0/2
A
A= $@
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 0 | ▶ | die $bailout if defined $bailout; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 0 | $finish->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 2 | ▶ | $self->{bail_summary} = sub{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 0 | ▶ | print "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 0 | $finish->(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 0 | ▶ | if ( $self->trap ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | 0 | ▶ | local $SIG{INT} = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 0 | ▶ | print "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 0 | $finish->(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 0 | exit; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 0 | $run->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 0 | $run->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 0 | return $aggregate; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | =head3 C<summary> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | $harness->summary( $aggregator ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | Output the summary for a L<TAP::Parser::Aggregator>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 47 | ▶ | sub summary { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
summary: called CC=1 SCAR=1.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 0 | ▶ | my ( $self, @args ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
summary: not called CC=1 SCAR=1.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 0 | $self->formatter->summary(@args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 108 | ▶ | sub _after_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_after_test: called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 0 | ▶ | my ( $self, $aggregate, $job, $parser ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_after_test: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 0 | $self->_make_callback( 'after_test', $job->as_array_ref, $parser ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 0 | $aggregate->add( $job->description, $parser ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 2 | ▶ | sub _bailout { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_bailout: called CC=3 SCAR=15.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 0 | ▶ | my ( $self, $result, $parser, $session, $aggregate, $job ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_bailout: not called CC=3 SCAR=15.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 0 | $self->finish_parser( $parser, $session ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 0 | $self->_after_test( $aggregate, $job, $parser ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | 0 | $job->finish; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | 0 | my $explanation = $result->explanation; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 0 | ▶ | $self->{bail_summary}() if $self->{bail_summary}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | 0 | ▶ | die "FAILED--Further testing stopped" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | . ( $explanation ? ": $explanation\n" : ".\n" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | 1 | ▶ | sub _aggregate_parallel { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_aggregate_parallel: called CC=7 SCAR=27.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 0 | ▶ | my ( $self, $aggregate, $scheduler ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_aggregate_parallel: not called CC=7 SCAR=27.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 0 | my $jobs = $self->jobs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 0 | my $mux = $self->_construct( $self->multiplexer_class ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | RESULT: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | # Keep multiplexer topped up | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | 0 | FILL: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | 0 | ▶ | while ( $mux->parsers < $jobs ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | 0 | my $job = $scheduler->get_job; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | # If we hit a spinner stop filling and start running. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | 0 | ▶ | last FILL if !defined $job || $job->is_spinner; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition16%1/6
not defined $job or $job->is_spinner
not defined $job or $job->is_spinner
MC/DC0%0/2
not defined $job or $job->is_spinner
not defined $job
$job->is_spinner
MC/DC0%0/2
not defined $job or $job->is_spinner
not defined $job
$job->is_spinner
Truth table33%1/3
not(A) or B
A= not defined $jobB= $job->is_spinner
Truth table0%0/3
not(A) or B
A= not defined $jobB= $job->is_spinner
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | 0 | my ( $parser, $session ) = $self->make_parser($job); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 0 | $mux->add( $parser, [ $session, $job ] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | # The job has started: begin the timers | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 0 | $parser->start_time( $parser->get_time ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 0 | $parser->start_times( $parser->get_times ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 0 | ▶ | if ( my ( $parser, $stash, $result ) = $mux->next ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | 0 | my ( $session, $job ) = @$stash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | 0 | ▶ | if ( defined $result ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | 0 | $session->result($result); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | 0 | ▶ | $self->_bailout($result, $parser, $session, $aggregate, $job ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | if $result->is_bailout; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | # End of parser. Automatically removed from the mux. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | 0 | $self->finish_parser( $parser, $session ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | 0 | $self->_after_test( $aggregate, $job, $parser ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | 0 | $job->finish; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 0 | redo RESULT; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | 77 | ▶ | sub _aggregate_single { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_aggregate_single: called CC=6 SCAR=24.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | 0 | ▶ | my ( $self, $aggregate, $scheduler ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_aggregate_single: not called CC=6 SCAR=24.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | JOB: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | 0 | ▶ | while ( my $job = $scheduler->get_job ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | 0 | ▶ | next JOB if $job->is_spinner; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 0 | my ( $parser, $session ) = $self->make_parser($job); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | 0 | ▶ | while ( defined( my $result = $parser->next ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | 0 | $session->result($result); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | 0 | ▶ | if ( $result->is_bailout ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | # Keep reading until input is exhausted in the hope | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | # of allowing any pending diagnostics to show up. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | 0 | ▶ | 1 while $parser->next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | 0 | $self->_bailout($result, $parser, $session, $aggregate, $job ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | 0 | $self->finish_parser( $parser, $session ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 0 | $self->_after_test( $aggregate, $job, $parser ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 0 | $job->finish; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | =head3 C<aggregate_tests> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | $harness->aggregate_tests( $aggregate, @tests ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | Run the named tests and display a summary of result. Tests will be run | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | in the order found. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | Test results will be added to the supplied L<TAP::Parser::Aggregator>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | C<aggregate_tests> may be called multiple times to run several sets of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | tests. Multiple C<Test::Harness> instances may be used to pass results | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | to a single aggregator so that different parts of a complex test suite | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | may be run using different C<TAP::Harness> settings. This is useful, for | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | example, in the case where some tests should run in parallel but others | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | are unsuitable for parallel execution. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | my $formatter = TAP::Formatter::Console->new; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | my $ser_harness = TAP::Harness->new( { formatter => $formatter } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | my $par_harness = TAP::Harness->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | { formatter => $formatter, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | jobs => 9 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | my $aggregator = TAP::Parser::Aggregator->new; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | $aggregator->start(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | $ser_harness->aggregate_tests( $aggregator, @ser_tests ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | $par_harness->aggregate_tests( $aggregator, @par_tests ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | $aggregator->stop(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | $formatter->summary($aggregator); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | Note that for simpler testing requirements it will often be possible to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | replace the above code with a single call to C<runtests>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | Each element of the C<@tests> array is either: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | =over | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | =item * the source name of a test to run | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | =item * a reference to a [ source name, display name ] array | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | In the case of a perl test suite, typically I<source names> are simply the file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | names of the test scripts to run. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | When you supply a separate display name it becomes possible to run a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | test more than once; the display name is effectively the alias by which | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | the test is known inside the harness. The harness doesn't care if it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | runs the same test more than once when each invocation uses a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | different name. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | 78 | ▶ | sub aggregate_tests { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
aggregate_tests: called CC=3 SCAR=14.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | 0 | ▶ | my ( $self, $aggregate, @tests ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
aggregate_tests: not called CC=3 SCAR=14.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | 0 | my $jobs = $self->jobs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | 0 | my $scheduler = $self->make_scheduler(@tests); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | # #12458 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | 0 | ▶ | local $ENV{HARNESS_IS_VERBOSE} = 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | if $self->formatter->verbosity > 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | # Formatter gets only names. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | 0 | $self->formatter->prepare( map { $_->description } $scheduler->get_all ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | 0 | ▶ | if ( $self->jobs > 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | 0 | $self->_aggregate_parallel( $aggregate, $scheduler ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | 0 | $self->_aggregate_single( $aggregate, $scheduler ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | 83 | ▶ | sub _add_descriptions { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add_descriptions: called CC=3 SCAR=14.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add_descriptions: not called CC=3 SCAR=14.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | # Turn unwrapped scalars into anonymous arrays and copy the name as | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | # the description for tests that have only a name. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | 0 | ▶ | return map { @$_ == 1 ? [ $_->[0], $_->[0] ] : $_ } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | 0 | ▶ | map { 'ARRAY' eq ref $_ ? $_ : [$_] } @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | =head3 C<make_scheduler> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | Called by the harness when it needs to create a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | L<TAP::Parser::Scheduler>. Override in a subclass to provide an | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | alternative scheduler. C<make_scheduler> is passed the list of tests | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | that was passed to C<aggregate_tests>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | 78 | ▶ | sub make_scheduler { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_scheduler: called CC=1 SCAR=1.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | 0 | ▶ | my ( $self, @tests ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_scheduler: not called CC=1 SCAR=1.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | 0 | return $self->_construct( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | $self->scheduler_class, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | tests => [ $self->_add_descriptions(@tests) ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | rules => $self->rules | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | =head3 C<jobs> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | Gets or sets the number of concurrent test runs the harness is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | handling. By default, this value is 1 -- for parallel testing, this | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | should be set higher. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | 109 | ▶ | sub _get_parser_args { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_parser_args: called CC=13 SCAR=37.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | 0 | ▶ | my ( $self, $job ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_parser_args: not called CC=13 SCAR=37.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | 0 | my $test_prog = $job->filename; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | 0 | my %args = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | 0 | ▶ | $args{sources} = $self->sources if $self->sources; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | 0 | my @switches; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | 0 | ▶ | @switches = $self->lib if $self->lib; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | 0 | ▶ | push @switches => $self->switches if $self->switches; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | 0 | $args{switches} = \@switches; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | 0 | $args{spool} = $self->_open_spool($test_prog); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | 0 | $args{merge} = $self->merge; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | 0 | $args{ignore_exit} = $self->ignore_exit; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | 0 | ▶ | $args{version} = $self->version if $self->version; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | 0 | ▶ | if ( my $exec = $self->exec ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | $args{exec} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | 0 | ▶ | = ref $exec eq 'CODE' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | ? $exec->( $self, $test_prog ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | : [ @$exec, $test_prog ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | 0 | ▶ | if ( not defined $args{exec} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | 0 | $args{source} = $test_prog; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | ▶ | elsif ( ( ref( $args{exec} ) || "" ) ne "ARRAY" ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
ref $args{'exec'} || ''
ref $args{'exec'} || ''
MC/DC100%1/1
ref $args{'exec'} || ''
ref $args{'exec'}
MC/DC0%0/1
ref $args{'exec'} || ''
ref $args{'exec'}
Truth table100%2/2
A
A= ref $args{'exec'}
Truth table0%0/2
A
A= ref $args{'exec'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | 0 | $args{source} = delete $args{exec}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | 0 | $args{source} = $test_prog; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | 0 | ▶ | if ( defined( my $test_args = $self->test_args ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | 0 | ▶ | if ( ref($test_args) eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | # different args for each test | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | 0 | ▶ | if ( exists( $test_args->{ $job->description } ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | 0 | $test_args = $test_args->{ $job->description }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | 0 | $self->_croak( "TAP::Harness Can't find test_args for " | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | . $job->description ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | 0 | $args{test_args} = $test_args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | 0 | return \%args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | =head3 C<make_parser> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | Make a new parser and display formatter session. Typically used and/or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | overridden in subclasses. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | my ( $parser, $session ) = $harness->make_parser; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | 109 | ▶ | sub make_parser { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_parser: called CC=1 SCAR=1.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | 0 | ▶ | my ( $self, $job ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_parser: not called CC=1 SCAR=1.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | 0 | my $args = $self->_get_parser_args($job); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | 0 | $self->_make_callback( 'parser_args', $args, $job->as_array_ref ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | 0 | my $parser = $self->_construct( $self->parser_class, $args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | 0 | $self->_make_callback( 'made_parser', $parser, $job->as_array_ref ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | 0 | my $session = $self->formatter->open_test( $job->description, $parser ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | 0 | return ( $parser, $session ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | =head3 C<finish_parser> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | Terminate use of a parser. Typically used and/or overridden in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | subclasses. The parser isn't destroyed as a result of this. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | 108 | ▶ | sub finish_parser { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
finish_parser: called CC=1 SCAR=1.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | 0 | ▶ | my ( $self, $parser, $session ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
finish_parser: not called CC=1 SCAR=1.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | 0 | $session->close_test; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | 0 | $self->_close_spool($parser); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | 0 | return $parser; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | 110 | ▶ | sub _open_spool { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_open_spool: called CC=4 SCAR=18.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_open_spool: not called CC=4 SCAR=18.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | 0 | my $test = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | 0 | ▶ | if ( my $spool_dir = $ENV{PERL_TEST_HARNESS_DUMP_TAP} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | 0 | my $spool = File::Spec->catfile( $spool_dir, $test ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | # Make the directory | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | 0 | my ( $vol, $dir, undef ) = File::Spec->splitpath($spool); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | 0 | my $path = File::Spec->catpath( $vol, $dir, '' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | 0 | eval { mkpath($path) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | 0 | ▶ | $self->_croak($@) if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | 0 | my $spool_handle = IO::Handle->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | 0 | ▶ | open( $spool_handle, ">$spool" ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | or $self->_croak(" Can't write $spool ( $! ) "); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | 0 | return $spool_handle; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | 109 | ▶ | sub _close_spool { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_close_spool: called CC=3 SCAR=14.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_close_spool: not called CC=3 SCAR=14.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | 0 | my ($parser) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | 0 | ▶ | if ( my $spool_handle = $parser->delete_spool ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | 0 | ▶ | close($spool_handle) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | or $self->_croak(" Error closing TAP spool file( $! ) \n "); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | 4 | ▶ | sub _croak { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_croak: called CC=2 SCAR=12.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | 0 | ▶ | my ( $self, $message ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_croak: not called CC=2 SCAR=12.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | 0 | ▶ | unless ($message) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | 0 | $message = $self->_error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | 0 | $self->SUPER::_croak($message); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | 21 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||