line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Yath; |
2
|
22
|
|
|
22
|
|
138951
|
use strict; |
|
22
|
|
|
|
|
43
|
|
|
22
|
|
|
|
|
463
|
|
3
|
22
|
|
|
22
|
|
66
|
use warnings; |
|
22
|
|
|
|
|
22
|
|
|
22
|
|
|
|
|
662
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.000013'; |
6
|
|
|
|
|
|
|
|
7
|
22
|
|
|
22
|
|
7941
|
use Test2::Util::HashBase qw/args harness files exclude renderers/; |
|
22
|
|
|
|
|
30746
|
|
|
22
|
|
|
|
|
110
|
|
8
|
22
|
|
|
22
|
|
10778
|
use Test2::Util qw/pkg_to_file/; |
|
22
|
|
|
|
|
20161
|
|
|
22
|
|
|
|
|
1029
|
|
9
|
|
|
|
|
|
|
|
10
|
22
|
|
|
22
|
|
6673
|
use Test2::Harness; |
|
22
|
|
|
|
|
65
|
|
|
22
|
|
|
|
|
483
|
|
11
|
22
|
|
|
22
|
|
90
|
use Test2::Harness::Parser; |
|
22
|
|
|
|
|
22
|
|
|
22
|
|
|
|
|
285
|
|
12
|
22
|
|
|
22
|
|
66
|
use Test2::Harness::Runner; |
|
22
|
|
|
|
|
22
|
|
|
22
|
|
|
|
|
354
|
|
13
|
|
|
|
|
|
|
|
14
|
22
|
|
|
22
|
|
12979
|
use Getopt::Long qw/GetOptionsFromArray/; |
|
22
|
|
|
|
|
158427
|
|
|
22
|
|
|
|
|
67
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub run { |
17
|
44
|
|
|
44
|
1
|
7000
|
my $self = shift; |
18
|
44
|
|
|
|
|
136
|
my $results = $self->{+HARNESS}->run(@{$self->{+FILES}}); |
|
44
|
|
|
|
|
238
|
|
19
|
|
|
|
|
|
|
|
20
|
24
|
|
|
|
|
1114
|
$_->summary($results) for @{$self->{+RENDERERS}}; |
|
24
|
|
|
|
|
314
|
|
21
|
|
|
|
|
|
|
|
22
|
24
|
|
|
|
|
158
|
my $failed = grep {!$_->passed} @$results; |
|
420
|
|
|
|
|
752
|
|
23
|
24
|
|
|
|
|
57210
|
return $failed; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub init { |
27
|
56
|
|
|
56
|
0
|
139292
|
my $self = shift; |
28
|
56
|
|
100
|
|
|
309
|
$self->{+ARGS} ||= []; |
29
|
56
|
|
|
|
|
56
|
my @args = @{$self->{+ARGS}}; |
|
56
|
|
|
|
|
283
|
|
30
|
|
|
|
|
|
|
|
31
|
56
|
|
|
|
|
99
|
my (%env, @libs, @switches); |
32
|
56
|
|
|
|
|
448
|
my %harness_args = ( |
33
|
|
|
|
|
|
|
env_vars => \%env, |
34
|
|
|
|
|
|
|
libs => \@libs, |
35
|
|
|
|
|
|
|
switches => \@switches, |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
parser_class => '+Test2::Harness::Parser', |
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
|
40
|
56
|
|
|
|
|
101
|
my (@exclude, @render, @preload); |
41
|
56
|
50
|
|
|
|
278
|
my $color = -t STDOUT ? 1 : 0; |
42
|
56
|
|
|
|
|
116
|
my $jobs = 1; |
43
|
56
|
|
|
|
|
53
|
my $merge = 0; |
44
|
56
|
|
|
|
|
100
|
my $verbose = 0; |
45
|
56
|
|
|
|
|
75
|
my $quiet = 0; |
46
|
56
|
|
|
|
|
53
|
my $timeout = 0; |
47
|
|
|
|
|
|
|
|
48
|
56
|
|
|
|
|
95
|
my $runner_class = '+Test2::Harness::Runner'; |
49
|
|
|
|
|
|
|
|
50
|
56
|
|
|
|
|
340
|
Getopt::Long::Configure("bundling"); |
51
|
|
|
|
|
|
|
GetOptionsFromArray \@args => ( |
52
|
|
|
|
|
|
|
'l|lib' => sub { |
53
|
2
|
|
|
2
|
|
1396
|
push @libs, 'lib'; |
54
|
|
|
|
|
|
|
}, |
55
|
|
|
|
|
|
|
'b|blib' => sub { |
56
|
2
|
|
|
2
|
|
113
|
push @libs, 'blib/lib', 'blib/arch'; |
57
|
|
|
|
|
|
|
}, |
58
|
|
|
|
|
|
|
'I|include=s@' => \@libs, |
59
|
|
|
|
|
|
|
'R|renderer=s@' => \@render, |
60
|
|
|
|
|
|
|
'L|preload=s@' => \@preload, |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
'c|color=i' => \$color, |
63
|
|
|
|
|
|
|
'h|help' => \&help, |
64
|
|
|
|
|
|
|
'j|jobs=i' => \$jobs, |
65
|
|
|
|
|
|
|
'm|merge' => \$merge, |
66
|
|
|
|
|
|
|
'q|quiet' => \$quiet, |
67
|
|
|
|
|
|
|
'v|verbose' => \$verbose, |
68
|
|
|
|
|
|
|
'x|exclude=s@' => \@exclude, |
69
|
|
|
|
|
|
|
't|timeout=i' => \$timeout, |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
'parser|parser_class=s' => \$harness_args{parser_class}, |
72
|
|
|
|
|
|
|
'runner|runner_class=s' => \$runner_class, |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
'S|switch=s@' => sub { |
75
|
6
|
|
|
6
|
|
2924
|
push @switches => split '=', $_[1]; |
76
|
|
|
|
|
|
|
}, |
77
|
56
|
50
|
|
|
|
2964
|
) or die "Could not parse the command line options given.\n"; |
78
|
|
|
|
|
|
|
|
79
|
56
|
100
|
100
|
|
|
64106
|
die "You cannot combine preload (-L) with switches (-S).\n" |
80
|
|
|
|
|
|
|
if @preload && @switches; |
81
|
|
|
|
|
|
|
|
82
|
54
|
100
|
|
|
|
217
|
unshift @render => 'EventStream' |
83
|
|
|
|
|
|
|
unless $quiet; |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
{ |
86
|
54
|
|
|
|
|
52
|
local $ENV{TB_NO_EARLY_INIT} = 1; |
|
54
|
|
|
|
|
400
|
|
87
|
54
|
|
|
|
|
432
|
local @INC = (@libs, @INC); |
88
|
54
|
|
|
|
|
170
|
load_module('', $_) for @preload; |
89
|
54
|
50
|
|
|
|
1189
|
load_module('Test2::Harness::Runner::', $runner_class) if $runner_class; |
90
|
54
|
50
|
|
|
|
1411
|
load_module('Test2::Harness::Parser::', $harness_args{parser_class}) if $harness_args{parser_class}; |
91
|
54
|
|
|
|
|
1039
|
load_module('Test2::Harness::Renderer::', $_) for @render; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
54
|
|
|
|
|
1232
|
$harness_args{timeout} = $timeout; |
95
|
54
|
|
|
|
|
98
|
$harness_args{jobs} = $jobs; |
96
|
54
|
100
|
|
|
|
625
|
$harness_args{runner} = $runner_class->new(merge => $merge, via => @preload ? 'do' : 'open3'); |
97
|
|
|
|
|
|
|
|
98
|
54
|
|
|
|
|
220
|
my @renderers; |
99
|
54
|
|
|
|
|
123
|
for my $r (@render) { |
100
|
58
|
|
|
|
|
359
|
push @renderers => $r->new( |
101
|
|
|
|
|
|
|
color => $color, |
102
|
|
|
|
|
|
|
parallel => $jobs, |
103
|
|
|
|
|
|
|
verbose => $verbose, |
104
|
|
|
|
|
|
|
); |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
54
|
|
|
|
|
258
|
$harness_args{listeners} = [ map { $_->listen } @renderers ]; |
|
58
|
|
|
|
|
238
|
|
108
|
|
|
|
|
|
|
|
109
|
54
|
|
|
|
|
156
|
$self->{+RENDERERS} = \@renderers; |
110
|
54
|
|
|
|
|
374
|
$self->{+HARNESS} = Test2::Harness->new(%harness_args, verbose => $verbose); |
111
|
|
|
|
|
|
|
|
112
|
54
|
|
|
|
|
204
|
$self->{+EXCLUDE} = \@exclude; |
113
|
54
|
|
|
|
|
193
|
$self->{+FILES} = $self->expand_files(@args); |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
sub load_module { |
117
|
191
|
|
|
191
|
1
|
2312
|
my $prefix = shift; |
118
|
191
|
100
|
|
|
|
600
|
$prefix = '' if $_[0] =~ s/^\+//; |
119
|
191
|
100
|
|
|
|
365
|
$_[0] = "${prefix}$_[0]" if $prefix; |
120
|
191
|
|
|
|
|
481
|
require(pkg_to_file($_[0])); |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub expand_files { |
124
|
62
|
|
|
62
|
1
|
797
|
my $self = shift; |
125
|
|
|
|
|
|
|
|
126
|
62
|
|
|
|
|
135
|
my @in = @_; |
127
|
62
|
100
|
66
|
|
|
16135
|
push @in => 't' if !@in && -d 't'; |
128
|
|
|
|
|
|
|
|
129
|
62
|
|
|
|
|
103
|
my (@files, @dirs); |
130
|
62
|
|
|
|
|
110
|
for my $f (@in) { |
131
|
104
|
100
|
50
|
|
|
1210
|
push @files => $f and next if -f $f; |
132
|
100
|
50
|
50
|
|
|
644
|
push @dirs => $f and next if -d $f; |
133
|
0
|
|
|
|
|
0
|
die "'$f' is not a valid test file or directory" |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
|
136
|
62
|
100
|
|
|
|
140
|
if (@dirs) { |
137
|
58
|
|
|
|
|
321
|
require File::Find; |
138
|
|
|
|
|
|
|
File::Find::find( |
139
|
|
|
|
|
|
|
sub { |
140
|
22
|
|
|
22
|
|
14923
|
no warnings 'once'; |
|
22
|
|
|
|
|
22
|
|
|
22
|
|
|
|
|
4056
|
|
141
|
2224
|
100
|
|
2224
|
|
56987
|
push @files => $File::Find::name if -f $_ & m/\.t2?$/; |
142
|
|
|
|
|
|
|
}, |
143
|
|
|
|
|
|
|
@dirs |
144
|
58
|
|
|
|
|
4212
|
); |
145
|
|
|
|
|
|
|
} |
146
|
|
|
|
|
|
|
|
147
|
62
|
|
|
|
|
276
|
my $exclude = $self->{+EXCLUDE}; |
148
|
62
|
100
|
|
|
|
181
|
if (@$exclude) { |
149
|
|
|
|
|
|
|
@files = grep { |
150
|
46
|
|
|
|
|
70
|
my $file = $_; |
|
872
|
|
|
|
|
568
|
|
151
|
872
|
|
|
|
|
629
|
grep { $file !~ m/$_/ } @$exclude; |
|
874
|
|
|
|
|
1475
|
|
152
|
|
|
|
|
|
|
} @files; |
153
|
|
|
|
|
|
|
} |
154
|
|
|
|
|
|
|
|
155
|
62
|
|
|
|
|
462
|
return \@files; |
156
|
|
|
|
|
|
|
} |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
sub help { |
159
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
160
|
|
|
|
|
|
|
|
161
|
0
|
|
|
|
|
|
print <<" EOT"; |
162
|
|
|
|
|
|
|
Usage: $0 [OPTIONS] File1 File2 Directory ... |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
Common Options: |
165
|
|
|
|
|
|
|
-l --lib Add lib/ to \@INC. |
166
|
|
|
|
|
|
|
-b --blib Add blib/lib and blib/arch to \@INC. |
167
|
|
|
|
|
|
|
-I[dir] --include="dir" Add directories to \@INC. |
168
|
|
|
|
|
|
|
-L[Module] --preload="Module" Add a module to preload. (Prefork) |
169
|
|
|
|
|
|
|
-R[name] --renderer="name" Add a renderer. (See [name] section) |
170
|
|
|
|
|
|
|
-S[s=val] --switch="s=val" Add switches to use when executing perl. |
171
|
|
|
|
|
|
|
-c[n] --color=n Override the default color level. (0=off) |
172
|
|
|
|
|
|
|
-h --help Show this usage help. |
173
|
|
|
|
|
|
|
-j[n] --jobs=n How many tests to run concurrently. |
174
|
|
|
|
|
|
|
-m --merge Merge STDERR and STDOUT from test files. |
175
|
|
|
|
|
|
|
-q --quiet Do not use the default renderer. |
176
|
|
|
|
|
|
|
-v --verbose Show every event, not just failures and diag. |
177
|
|
|
|
|
|
|
-t --timeout=n Event timeout, kill tests that stall too long. |
178
|
|
|
|
|
|
|
-x[pattern] --exclude=[pattern] Exclude any files that match the pattern. |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
Other Options: |
181
|
|
|
|
|
|
|
--parser=[name] --parser_class=[name] Override the default parser. |
182
|
|
|
|
|
|
|
--runner=[name] --runner_class=[name] Override the default runner. |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
[name] |
185
|
|
|
|
|
|
|
-R[name] --renderer="name" |
186
|
|
|
|
|
|
|
'Test2::Harness::Renderer::[name]' is implied. Prefix with '+' to give an |
187
|
|
|
|
|
|
|
absolute module name. |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
--parser=[name] --parser_class="name" |
190
|
|
|
|
|
|
|
'Test2::Harness::Parser::[name]' is implied. Prefix with '+' to give an |
191
|
|
|
|
|
|
|
absolute module name. |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
--runner=[name] --runner_class="name" |
194
|
|
|
|
|
|
|
'Test2::Harness::Runner::[name]' is implied. Prefix with '+' to give an |
195
|
|
|
|
|
|
|
absolute module name. |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
EOT |
198
|
|
|
|
|
|
|
|
199
|
0
|
|
|
|
|
|
exit 0; |
200
|
|
|
|
|
|
|
} |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
1; |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
__END__ |