blib/lib/Test/Smoke/Reporter.pm

filter: Statementstmt 86.6% 537 / 620 Branchbran 70.6% 205 / 290 Conditioncond 56.2% 94 / 167 MC/DCmcdc 29.6% 27 / 91 Subroutinesub 95.5% 43 / 45 Podpod 100% 27 / 27 totaltotal 75.2% 933 / 1240 CC 225 SCAR 39.9
CC
225
Cov
78%
smokedb_data
380.0
_parse
64.4
_post_process
48.4
CRAP 53.8
« blib/lib/Test/Smoke/App/ConfigSmoke/SmokeEnv.pm ↑ Summary lib/Test/Smoke/Util.pm »
1 package Test::Smoke::Reporter;
2 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 6 our $VERSION = '0.054';
6  
7 6 require File::Path;
8 6 require Test::Smoke;
9 6 ▶use Cwd;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 6 ▶use Encode qw( decode encode );
Subroutine BEGIN: called CC=1 SCAR=0.0
11 6 ▶use File::Spec::Functions;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 6 ▶use Test::Smoke::Util::LoadAJSON;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 6 ▶use POSIX qw( strftime );
Subroutine BEGIN: called CC=1 SCAR=0.0
14 6 ▶use System::Info;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 6 ▶use Test::Smoke::Util qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
16 grepccmsg grepnonfatal get_smoked_Config read_logfile
17 time_in_hhmm get_local_patches
18 6 );
19 6 ▶use Text::ParseWords;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 6 ▶use Test::Smoke::LogMixin;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 6 ▶use constant USERNOTE_ON_TOP => 'top';
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 6 my %CONFIG = (
25 df_ddir => curdir(),
26 df_outfile => 'mktest.out',
27 df_rptfile => 'mktest.rpt',
28 df_jsnfile => 'mktest.jsn',
29 df_cfg => undef,
30 df_lfile => undef,
31 df_showcfg => 0,
32  
33 df_locale => undef,
34 df_defaultenv => undef,
35 df_perlio_only => undef,
36 df_is56x => undef,
37 df_skip_tests => undef,
38  
39 df_harnessonly => undef,
40 df_harness3opts => undef,
41  
42 df_v => 0,
43 df_hostname => undef,
44 df_from => '',
45 df_send_log => 'on_fail',
46 df_send_out => 'never',
47 df_user_note => '',
48 df_un_file => undef,
49 df_un_position => 'bottom', # != USERNOTE_ON_TOP for bottom
50 );
51  
52 =head1 NAME
53  
54 Test::Smoke::Reporter - OO interface for handling the testresults (mktest.out)
55  
56 =head1 SYNOPSIS
57  
58 use Test::Smoke;
59 use Test::Smoke::Reporter;
60  
61 my $reporter = Test::Smoke::Reporter->new( %args );
62 $reporter->write_to_file;
63 $reporter->transport( $url );
64  
65 =head1 DESCRIPTION
66  
67 Handle the parsing of the F<mktest.out> file.
68  
69 =head1 METHODS
70  
71 =head2 Test::Smoke::Reporter->new( %args )
72  
73 [ Constructor | Public ]
74  
75 Initialise a new object.
76  
77 =cut
78  
79 69 ▶sub new {
Subroutine new: called CC=5 SCAR=16.4
Pod documented
80 69 my $proto = shift;
81 69 ▶ my $class = ref $proto ? ref $proto : $proto;
Branch: 1 branch
BranchTrueFalseTotal
ref $proto ? : 0 69 69
82  
83 0 ▶ my %args_raw = @_ ? UNIVERSAL::isa( $_[0], 'HASH' ) ? %{ $_[0] } : @_ : ();
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 69 0 69
UNIVERSAL::isa($_[0], 'HASH') ? : 0 69 69
84  
85 my %args = map {
86 69 ( my $key = $_ ) =~ s/^-?(.+)$/lc $1/e;
87 398 ( $key => $args_raw{ $_ } );
88 } keys %args_raw;
89  
90 my %fields = map {
91 1518 ▶ my $value = exists $args{$_} ? $args{ $_ } : $CONFIG{ "df_$_" };
Branch: 1 branch
BranchTrueFalseTotal
exists $args{$_} ? : 389 1129 1518
92 1518 ( $_ => $value )
93 69 } keys %{ $class->config( 'all_defaults' ) };
94  
95 69 $fields{_conf_args} = { %args_raw };
96 69 my $self = bless \%fields, $class;
97 69 $self->read_parse( );
98 }
99  
100 =head2 $reporter->verbose()
101  
102 Accessor to the C<v> attribute.
103  
104 =cut
105  
106 1157 ▶sub verbose {
Subroutine verbose: called CC=2 SCAR=7.1
Pod documented
107 1157 my $self = shift;
108  
109 1157 ▶ $self->{v} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 1157 1157
110  
111 1157 $self->{v};
112 }
113  
114 =head2 Test::Smoke::Reporter->config( $key[, $value] )
115  
116 [ Accessor | Public ]
117  
118 C<config()> is an interface to the package lexical C<%CONFIG>,
119 which holds all the default values for the C<new()> arguments.
120  
121 With the special key B<all_defaults> this returns a reference
122 to a hash holding all the default values.
123  
124 =cut
125  
126 69 ▶sub config {
Subroutine config: called CC=4 SCAR=17.9
Pod documented
127 69 my $dummy = shift;
128  
129 69 my $key = lc shift;
130  
131 69 ▶ if ( $key eq 'all_defaults' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($key eq "all_defaults") 69 0 69
132 my %default = map {
133 69 my( $pass_key ) = $_ =~ /^df_(.+)/;
134 1518 ( $pass_key => $CONFIG{ $_ } );
135 } grep /^df_/ => keys %CONFIG;
136 69 return \%default;
137 }
138  
139 0 ▶ return undef unless exists $CONFIG{ "df_$key" };
Branch: 1 branch
BranchTrueFalseTotal
unless exists $CONFIG{"df_$key"} 0 0 0
140  
141 0 ▶ $CONFIG{ "df_$key" } = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
142  
143 0 return $CONFIG{ "df_$key" };
144 }
145  
146 =head2 $self->read_parse( [$result_file] )
147  
148 C<read_parse()> reads the smokeresults file and parses it.
149  
150 =cut
151  
152 116 ▶sub read_parse {
Subroutine read_parse: called CC=4 SCAR=13.9
Pod documented
153 116 my $self = shift;
154  
155 my $result_file = @_ ? $_[0] : $self->{outfile}
156 ? catfile( $self->{ddir}, $self->{outfile} )
157 116 ▶ : "";
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 50 66 116
$self->{'outfile'} ? : 16 50 66
158 116 $self->log_debug("[%s::read_parse] found '%s'", ref($self), $result_file);
159  
160 116 ▶ if ( $result_file ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($result_file) 66 50 116
161 66 $self->_read( $result_file );
162 66 $self->_parse;
163 }
164 116 return $self;
165 }
166  
167 =head2 $self->_read( $nameorref )
168  
169 C<_read()> is a private method that handles the reading.
170  
171 =over 8
172  
173 =item B<Reference to a SCALAR> smokeresults are in C<$$nameorref>
174  
175 =item B<Reference to an ARRAY> smokeresults are in C<@$nameorref>
176  
177 =item B<Reference to a GLOB> smokeresults are read from the filehandle
178  
179 =item B<Other values> are taken as the filename for the smokeresults
180  
181 =back
182  
183 =cut
184  
185 66 ▶sub _read {
Subroutine _read: called CC=7 SCAR=24.6
186 66 my $self = shift;
187 66 my( $nameorref ) = @_;
188 66 ▶ $nameorref = '' unless defined $nameorref;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $nameorref 0 66 66
189  
190 66 my $vmsg = "";
191 66 local *SMOKERSLT;
192 66 ▶ if ( ref $nameorref eq 'SCALAR' ) {
Branch: 3 branches
BranchTrueFalseTotal
if (ref $nameorref eq 'SCALAR') { } 50 16 66
elsif (ref $nameorref eq 'ARRAY') { } 0 16 16
elsif (ref $nameorref eq 'GLOB') { } 0 16 16
193 50 $self->{_outfile} = $$nameorref;
194 50 $vmsg = "from internal content";
195 } elsif ( ref $nameorref eq 'ARRAY' ) {
196 0 $self->{_outfile} = join "", @$nameorref;
197 0 $vmsg = "from internal content";
198 } elsif ( ref $nameorref eq 'GLOB' ) {
199 0 *SMOKERSLT = *$nameorref;
200 0 $self->{_outfile} = do { local $/; <SMOKERSLT> };
201 0 $vmsg = "from anonymous filehandle";
202 } else {
203 16 ▶ if ( $nameorref ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nameorref) { } 16 0 16
204 16 $vmsg = "from $nameorref";
205 16 $self->{_outfile} = read_logfile($nameorref, $self->{v});
206 16 ▶ defined($self->{_outfile}) or do {
Branch: 1 branch
BranchTrueFalseTotal
defined $self->{"_outfile"} or do { require Carp; Carp::carp("Cannot read smokeresults ($nameorref): $!"); $vmsg = "did fail" } 16 0 16
207 0 require Carp;
208 0 Carp::carp( "Cannot read smokeresults ($nameorref): $!" );
209 0 $vmsg = "did fail";
210 };
211 } else { # Allow intentional default_buildcfg()
212 0 $self->{_outfile} = undef;
213 0 $vmsg = "did fail";
214 }
215 }
216 66 $self->log_info("Reading smokeresult %s", $vmsg);
217 }
218  
219 =head2 $self->_parse( )
220  
221 Interpret the contents of the outfile and prepare them for processing,
222 so report can be made.
223  
224 =cut
225  
226 66 ▶sub _parse {
Subroutine _parse: called CC=61 SCAR=41.7
227 66 my $self = shift;
228  
229 66 $self->{_rpt} = \my %rpt;
230 66 $self->{_cache} = {};
231 66 $self->{_mani} = [];
232 66 $self->{configs} = \my @new;
233 66 ▶ return $self unless defined $self->{_outfile};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"_outfile"} 0 66 66
234  
235 66 my ($cfgarg, $debug, $tstenv, $start, $statarg, $fcnt);
236 66 $rpt{count} = 0;
237 # reverse and use pop() instead of using unshift()
238 66 my @lines = reverse split m/\n+/, $self->{_outfile};
239 66 my $previous = "";
240 66 my $previous_failed = "";
241  
242 66 ▶ while (defined (local $_ = pop @lines)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(local $_ = pop @lines)) 3439 66 3505
243 3439 ▶ m/^\s*$/ and next;
Branch: 1 branch
BranchTrueFalseTotal
/^\s*$/ and next 258 3181 3439
244 3181 ▶ m/^-+$/ and next;
Branch: 1 branch
BranchTrueFalseTotal
/^-+$/ and next 133 3048 3181
245 3048 s/\s*$//;
246  
247 3048 ▶ if (my ($status, $time) = /(Started|Stopped) smoke at (\d+)/) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = /(Started|Stopped) smoke at (\d+)/) 572 2476 3048
248 572 ▶ if ($status eq "Started") {
Branch: 2 branches
BranchTrueFalseTotal
if ($status eq 'Started') { } 286 286 572
elsif (defined $start) { } 283 3 286
249 286 $start = $time;
250 286 ▶ $rpt{started} ||= $time;
Condition66%2/3
$rpt{"started"} ||= $time
l!l&&r!l&&!r
220660
MC/DC0%0/2
$rpt{"started"} ||= $time
$rpt{"started"} $time
Truth table66%2/3
A ||= B
A= $rpt{"started"}B= $time
ABresult
1X1
011
000
251 }
252 elsif (defined $start) {
253 283 my $elapsed = $time - $start;
254 283 $rpt{secs} += $elapsed;
255 283 ▶ @new and $new[-1]{duration} = $elapsed;
Branch: 1 branch
BranchTrueFalseTotal
@new and $new[-1]{"duration"} = $elapsed 220 63 283
256 }
257 572 next;
258 }
259  
260 2476 ▶ if (my ($patch) = m/^ \s*
Branch: 1 branch
BranchTrueFalseTotal
if (my($patch) = /^ \s* Smoking\ patch\s* ((?:[0-9a-f]+\s+\S+)|(?:\d+\S*)) /x) 66 2410 2476
261 Smoking\ patch\s*
262 ((?:[0-9a-f]+\s+\S+)|(?:\d+\S*))
263 /x )
264 {
265 66 my ($pl, $descr) = split ' ', $patch;
266 66 $rpt{patchlevel} = $patch;
267 66 ▶ $rpt{patch} = $pl || $patch;
Condition33%1/3
$pl || $patch
l!l&&r!l&&!r
6600
MC/DC0%0/2
$pl || $patch
$pl $patch
Truth table33%1/3
A || B
A= $plB= $patch
ABresult
1X1
011
000
268 66 ▶ $rpt{patchdescr} = $descr || $pl;
Condition66%2/3
$descr || $pl
l!l&&r!l&&!r
41250
MC/DC0%0/2
$descr || $pl
$descr $pl
Truth table66%2/3
A || B
A= $descrB= $pl
ABresult
1X1
011
000
269 66 next;
270 }
271 2410 ▶ if (/^Smoking branch (\S+)/) {
Branch: 1 branch
BranchTrueFalseTotal
if (/^Smoking branch (\S+)/) 3 2407 2410
272 3 $rpt{smokebranch} = $1;
273 }
274  
275 2410 ▶ if (/^MANIFEST /) {
Branch: 1 branch
BranchTrueFalseTotal
if (/^MANIFEST /) 19 2391 2410
276 19 push @{$self->{_mani}}, $_;
277 19 next;
278 }
279  
280 2391 ▶ if (s/^\s*Configuration:\s*//) {
Branch: 1 branch
BranchTrueFalseTotal
if (s/^\s*Configuration:\s*//) 229 2162 2391
281  
282 # You might need to do something here with
283 # the previous Configuration: $cfgarg
284 229 ▶ $rpt{statcfg}{$statarg} = $fcnt if defined $statarg;
Branch: 1 branch
BranchTrueFalseTotal
if defined $statarg 163 66 229
285 229 $fcnt = 0;
286  
287 229 $rpt{count}++;
288 229 s/-Dusedevel(\s+|$)//;
289 229 s/\s*-des//;
290 229 $statarg = $_;
291 229 ▶ $debug = s/-D(DEBUGGING|usevmsdebug)\s*// ? "D" : "N";
Branch: 1 branch
BranchTrueFalseTotal
s/-D(DEBUGGING|usevmsdebug)\s*// ? : 90 139 229
292 229 ▶ $debug eq 'D' and $rpt{dbughow} = "-D$1";
Branch: 1 branch
BranchTrueFalseTotal
$debug eq "D" and $rpt{"dbughow"} = "-D$1" 90 139 229
293 229 s/\s+$//;
294  
295 229 ▶ $cfgarg = $_ || "";
Condition100%2/2
$_ || ''
l!l
21415
MC/DC100%1/1
$_ || ''
$_
Truth table100%2/2
A
A= $_
Aresult
11
00
296  
297 229 push(
298 @new,
299 {
300 arguments => $_,
301 debugging => $debug,
302 started => __posixdate($start),
303 results => [],
304 }
305 );
306 229 ▶ push @{$rpt{cfglist}}, $_ unless $rpt{config}->{$cfgarg}++;
Branch: 1 branch
BranchTrueFalseTotal
unless $rpt{"config"}{$cfgarg}++ 139 90 229
307 229 $tstenv = "";
308 229 $previous_failed = "";
309 229 next;
310 }
311  
312 2162 ▶ if (my ($cinfo) = /^Compiler info: (.+)$/) {
Branch: 1 branch
BranchTrueFalseTotal
if (my($cinfo) = /^Compiler info: (.+)$/) 149 2013 2162
313 149 $rpt{$cfgarg}->{cinfo} = $cinfo;
314 149 ▶ $rpt{cinfo} ||= $cinfo;
Condition66%2/3
$rpt{"cinfo"} ||= $cinfo
l!l&&r!l&&!r
132170
MC/DC0%0/2
$rpt{"cinfo"} ||= $cinfo
$rpt{"cinfo"} $cinfo
Truth table66%2/3
A ||= B
A= $rpt{"cinfo"}B= $cinfo
ABresult
1X1
011
000
315 149 @{$new[-1]}{qw( cc ccversion )} = split m/ version / => $cinfo, 2;
316 149 next;
317 }
318  
319 2013 ▶ if (m/(?:PERLIO|TSTENV)\s*=\s*([-\w:.]+)/
Branch: 1 branch
BranchTrueFalseTotal
if (/(?:PERLIO|TSTENV)\s*=\s*([-\w:.]+)/ and !@{$new[-1]{"results"};} || $new[-1]{"results"}[0]{"summary"} ne "M") 344 1669 2013
Condition100%6/6
/(?:PERLIO|TSTENV)\s*=\s*([-\w:.]+)/ and !@{$new[-1]{"results"};} || $new[-1]{"results"}[0]{"summary"} ne "M"
!ll&&!rl&&r
165712344
not @{$new[-1]{"results"};} or $new[-1]{"results"}[0]{"summary"} ne "M"
l!l&&r!l&&!r
20813612
MC/DC100%3/3
/(?:PERLIO|TSTENV)\s*=\s*([-\w:.]+)/ and !@{$new[-1]{"results"};} || $new[-1]{"results"}[0]{"summary"} ne "M"
/(?:PERLIO|TSTENV)\s*=\s*([-\w:.]+)/ not @{$new[-1]{"results"};} $new[-1]{"results"}[0]{"summary"} ne "M"
Truth table100%4/4
A and not(B) or C
A= /(?:PERLIO|TSTENV)\s*=\s*([-\w:.]+)/B= not @{$new[-1]{"results"};}C= $new[-1]{"results"}[0]{"summary"} ne "M"
ABCresult
0XX0
1000
11X1
1011
320 # skip this if it's from a build failure, since the
321 # Unable to build... pushed an M
322 356 && (!@{$new[-1]{results}}
323 || $new[-1]{results}[0]{summary} ne "M")) {
324 344 $tstenv = $1;
325 344 $previous_failed = "";
326 344 ▶ $rpt{$cfgarg}->{summary}{$debug}{$tstenv} ||= "?";
Condition50%1/2
$rpt{$cfgarg}{"summary"}{$debug}{$tstenv} ||= "?"
l!l
0344
MC/DC0%0/1
$rpt{$cfgarg}{"summary"}{$debug}{$tstenv} ||= "?"
$rpt{$cfgarg}{"summary"}{$debug}{$tstenv}
Truth table50%1/2
A
A= $rpt{$cfgarg}{"summary"}{$debug}{$tstenv}
Aresult
11
00
327 344 my ($io_env, $locale) = split m/:/ => $tstenv,
328 2;
329 push(
330 344 @{$new[-1]{results}},
331 {
332 io_env => $io_env,
333 locale => $locale,
334 summary => "?",
335 statistics => undef,
336 stat_tests => undef,
337 stat_cpu_time => undef,
338 failures => [],
339 }
340 );
341  
342 # Deal with harness output
343 344 s/^(?:PERLIO|TSTENV)\s*=\s+[-\w:.]+(?: :crlf)?\s*//;
344 }
345  
346 2013 ▶ if (m/\b(Files=[0-9]+,\s*Tests=([0-9]+),.*?=\s*([0-9.]+)\s*CPU)/) {
Branch: 2 branches
BranchTrueFalseTotal
if (/\b(Files=[0-9]+,\s*Tests=([0-9]+),.*?=\s*([0-9.]+)\s*CPU)/) { } 2 2011 2013
elsif (/\b(u=([0-9.]+)\s+ s=([0-9.]+)\s+ cu=([0-9.]+)\s+ cs=([0-9.]+)\s+ scripts=[0-9]+\s+ tests=([0-9]+))/xi) { } 198 1813 2011
347 2 $new[-1]{results}[-1]{statistics} = $1;
348 2 $new[-1]{results}[-1]{stat_tests} = $2;
349 2 $new[-1]{results}[-1]{stat_cpu_time} = $3;
350 }
351 elsif (
352 m/\b(u=([0-9.]+)\s+
353 s=([0-9.]+)\s+
354 cu=([0-9.]+)\s+
355 cs=([0-9.]+)\s+
356 scripts=[0-9]+\s+
357 tests=([0-9]+))/xi
358 )
359 {
360 198 $new[-1]{results}[-1]{statistics} = $1;
361 198 $new[-1]{results}[-1]{stat_tests} = $6;
362 198 $new[-1]{results}[-1]{stat_cpu_time} = $2 + $3 + $4 + $5;
363 }
364  
365 2013 ▶ if (m/^\s*All tests successful/) {
Branch: 1 branch
BranchTrueFalseTotal
if (/^\s*All tests successful/) 149 1864 2013
366 149 $rpt{$cfgarg}->{summary}{$debug}{$tstenv} = "O";
367 149 $new[-1]{results}[-1]{summary} = "O";
368 149 next;
369 }
370  
371 1864 ▶ if (m/Inconsistent test ?results/) {
Branch: 1 branch
BranchTrueFalseTotal
if (/Inconsistent test ?results/) 39 1825 1864
372 ref $rpt{$cfgarg}->{$debug}{$tstenv}{failed}
373 39 ▶ or $rpt{$cfgarg}->{$debug}{$tstenv}{failed} = [];
Branch: 1 branch
BranchTrueFalseTotal
ref $rpt{$cfgarg}{$debug}{$tstenv}{"failed"} or $rpt{$cfgarg}{$debug}{$tstenv}{"failed"} = [] 15 24 39
374  
375 39 ▶ if (not $rpt{$cfgarg}->{summary}{$debug}{$tstenv}
Branch: 1 branch
BranchTrueFalseTotal
if (not $rpt{$cfgarg}{"summary"}{$debug}{$tstenv} or $rpt{$cfgarg}{"summary"}{$debug}{$tstenv} ne "F") 24 15 39
Condition66%2/3
not $rpt{$cfgarg}{"summary"}{$debug}{$tstenv} or $rpt{$cfgarg}{"summary"}{$debug}{$tstenv} ne "F"
l!l&&r!l&&!r
02415
MC/DC50%1/2
not $rpt{$cfgarg}{"summary"}{$debug}{$tstenv} or $rpt{$cfgarg}{"summary"}{$debug}{$tstenv} ne "F"
not $rpt{$cfgarg}{"summary"}{$debug}{$tstenv} $rpt{$cfgarg}{"summary"}{$debug}{$tstenv} ne "F"
Truth table66%2/3
not(A) or B
A= not $rpt{$cfgarg}{"summary"}{$debug}{$tstenv}B= $rpt{$cfgarg}{"summary"}{$debug}{$tstenv} ne "F"
ABresult
1X1
011
000
376 or $rpt{$cfgarg}->{summary}{$debug}{$tstenv} ne "F")
377 {
378 24 $rpt{$cfgarg}->{summary}{$debug}{$tstenv} = "X";
379 24 $new[-1]{results}[-1]{summary} = "X";
380 }
381 39 push @{$rpt{$cfgarg}->{$debug}{$tstenv}{failed}}, $_;
382 39 ▶ while (m/^ \s* (\S+?) \s* \.+(?:\s+\.+)* \s* (\w.*?) \s*$/xgm) {
Branch: 1 branch
BranchTrueFalseTotal
if (/^ \s* (\S+?) \s* \.+(?:\s+\.+)* \s* (\w.*?) \s*$/gmx) 0 39 39
383 0 my ($_test, $_info) = ($1, $2);
384  
385 push(
386 0 ▶ @{$new[-1]{results}[-1]{failures}},
Branch: 2 branches
BranchTrueFalseTotal
$_info =~ /^ \w+ $/x ? : 0 0 0
$_info =~ /^ (\w+) \s+at\ test\s+ (\d+) \s* $/x || $_info =~ /^ (\w+)--(\S.*\S) \s* $/x ? : 0 0 0
Condition0%0/3
$_info =~ /^ (\w+) \s+at\ test\s+ (\d+) \s* $/x or $_info =~ /^ (\w+)--(\S.*\S) \s* $/x
l!l&&r!l&&!r
000
MC/DC0%0/2
$_info =~ /^ (\w+) \s+at\ test\s+ (\d+) \s* $/x or $_info =~ /^ (\w+)--(\S.*\S) \s* $/x
$_info =~ /^ (\w+) \s+at\ test\s+ (\d+) \s* $/x $_info =~ /^ (\w+)--(\S.*\S) \s* $/x
Truth table0%0/3
A or B
A= $_info =~ /^ (\w+) \s+at\ test\s+ (\d+) \s* $/xB= $_info =~ /^ (\w+)--(\S.*\S) \s* $/x
ABresult
1X1
011
000
387 $_info =~ m/^ \w+ $/x
388 ? {
389 test => $_test,
390 status => $_info,
391 extra => []
392 }
393 : # TEST output from minitest
394 $_info =~ m/^ (\w+) \s+at\ test\s+ (\d+) \s* $/x
395 || $_info =~ m/^ (\w+)--(\S.*\S) \s* $/x
396 ? {
397 test => $_test,
398 status => $1,
399 extra => [ $2 ]
400 }
401 : {
402 test => "?",
403 status => "?",
404 extra => []
405 }
406 );
407 }
408 }
409  
410 1864 ▶ if (/^Finished smoking [\dA-Fa-f]+/) {
Branch: 1 branch
BranchTrueFalseTotal
if (/^Finished smoking [\dA-Fa-f]+/) 63 1801 1864
411 63 $rpt{statcfg}{$statarg} = $fcnt;
412 63 $rpt{finished} = "Finished";
413 63 next;
414 }
415  
416 1801 ▶ if (my ($status, $mini) =
Branch: 1 branch
BranchTrueFalseTotal
if (() = /^ \s* Unable\ to \ (?=([cbmt]))(?:build|configure|make|test) \ (anything\ but\ mini)?perl/x) 18 1783 1801
417 m/^ \s* Unable\ to
418 \ (?=([cbmt]))(?:build|configure|make|test)
419 \ (anything\ but\ mini)?perl/x
420 )
421 {
422 18 ▶ $mini and $status = uc $status; # M for no perl but miniperl
Branch: 1 branch
BranchTrueFalseTotal
$mini and $status = uc $status 12 6 18
423 # $tstenv is only set *after* this
424 18 ▶ $tstenv ||= $mini ? "minitest" : "stdio";
Branch: 1 branch
BranchTrueFalseTotal
$mini ? : 12 6 18
Condition33%1/3
$tstenv ||= $mini ? "minitest" : "stdio"
l!l&&r!l&&!r
0180
MC/DC0%0/2
$tstenv ||= $mini ? "minitest" : "stdio"
$tstenv $mini ? "minitest" : "stdio"
Truth table33%1/3
A ||= B
A= $tstenvB= $mini ? "minitest" : "stdio"
ABresult
1X1
011
000
425 18 $rpt{$cfgarg}->{summary}{$debug}{$tstenv} = $status;
426 push(
427 18 @{$new[-1]{results}},
428 {
429 io_env => $tstenv,
430 locale => undef,
431 summary => $status,
432 statistics => undef,
433 stat_tests => undef,
434 stat_cpu_time => undef,
435 failures => [],
436 }
437 );
438 18 $fcnt++;
439 18 next;
440 }
441  
442 1783 ▶ if (m/FAILED/ || m/DIED/ || m/dubious$/ || m/\?\?\?\?\?\?$/) {
Branch: 1 branch
BranchTrueFalseTotal
if (/FAILED/ or /DIED/ or /dubious$/ or /\?\?\?\?\?\?$/) 624 1159 1783
Condition88%8/9
/FAILED/ or /DIED/ or /dubious$/ or /\?\?\?\?\?\?$/
l!l&&r!l&&!r
61861159
/FAILED/ or /DIED/ or /dubious$/
l!l&&r!l&&!r
606121165
/FAILED/ or /DIED/
l!l&&r!l&&!r
60601177
MC/DC75%3/4
/FAILED/ or /DIED/ or /dubious$/ or /\?\?\?\?\?\?$/
/FAILED/ /DIED/ /dubious$/ /\?\?\?\?\?\?$/
Truth table80%4/5
A or B or C or D
A= /FAILED/B= /DIED/C= /dubious$/D= /\?\?\?\?\?\?$/
ABCDresult
1XXX1
01XX1
001X1
00011
00000
443 ref $rpt{$cfgarg}->{$debug}{$tstenv}{failed}
444 624 ▶ or $rpt{$cfgarg}->{$debug}{$tstenv}{failed} = [];
Branch: 1 branch
BranchTrueFalseTotal
ref $rpt{$cfgarg}{$debug}{$tstenv}{"failed"} or $rpt{$cfgarg}{$debug}{$tstenv}{"failed"} = [] 453 171 624
445  
446 624 ▶ if ($previous_failed ne $_) {
Branch: 1 branch
BranchTrueFalseTotal
if ($previous_failed ne $_) 612 12 624
447 612 ▶ if (not $rpt{$cfgarg}->{summary}{$debug}{$tstenv}
Branch: 1 branch
BranchTrueFalseTotal
unless ($rpt{$cfgarg}{"summary"}{$debug}{$tstenv} and $rpt{$cfgarg}{"summary"}{$debug}{$tstenv} =~ /[XM]/) 582 30 612
Condition66%2/3
$rpt{$cfgarg}{"summary"}{$debug}{$tstenv} and $rpt{$cfgarg}{"summary"}{$debug}{$tstenv} =~ /[XM]/
!ll&&!rl&&r
058230
MC/DC50%1/2
$rpt{$cfgarg}{"summary"}{$debug}{$tstenv} and $rpt{$cfgarg}{"summary"}{$debug}{$tstenv} =~ /[XM]/
$rpt{$cfgarg}{"summary"}{$debug}{$tstenv} $rpt{$cfgarg}{"summary"}{$debug}{$tstenv} =~ /[XM]/
Truth table66%2/3
A and B
A= $rpt{$cfgarg}{"summary"}{$debug}{$tstenv}B= $rpt{$cfgarg}{"summary"}{$debug}{$tstenv} =~ /[XM]/
ABresult
0X0
100
111
448 or $rpt{$cfgarg}->{summary}{$debug}{$tstenv} !~ m/[XM]/)
449 {
450 582 $rpt{$cfgarg}->{summary}{$debug}{$tstenv} = "F";
451 582 $new[-1]{results}[-1]{summary} = "F";
452 }
453 612 push @{$rpt{$cfgarg}->{$debug}{$tstenv}{failed}}, $_;
454 push(
455 612 ▶ @{$new[-1]{results}[-1]{failures}},
Branch: 1 branch
BranchTrueFalseTotal
m(^ \s* # leading space ((?:\S+[/\\])? # Optional leading path to \S(?:[^.]+|\.t)+) # test file name [. ]+ # ....... ...... (\w.*?) # result \s* $)x ? : 612 0 612
456 m{^ \s* # leading space
457 ((?:\S+[/\\])? # Optional leading path to
458 \S(?:[^.]+|\.t)+) # test file name
459 [. ]+ # ....... ......
460 (\w.*?) # result
461 \s* $}x
462 ? {
463 test => $1,
464 status => $2,
465 extra => []
466 }
467 : {
468 test => "?",
469 status => "?",
470 extra => []
471 }
472 );
473  
474 612 $fcnt++;
475 }
476 624 $previous_failed = $_;
477  
478 624 $previous = "failed";
479 624 next;
480 }
481  
482 1159 ▶ if (m/PASSED/) {
Branch: 1 branch
BranchTrueFalseTotal
if (/PASSED/) 132 1027 1159
483 ref $rpt{$cfgarg}->{$debug}{$tstenv}{passed}
484 132 ▶ or $rpt{$cfgarg}->{$debug}{$tstenv}{passed} = [];
Branch: 1 branch
BranchTrueFalseTotal
ref $rpt{$cfgarg}{$debug}{$tstenv}{"passed"} or $rpt{$cfgarg}{$debug}{$tstenv}{"passed"} = [] 66 66 132
485  
486 132 push @{$rpt{$cfgarg}->{$debug}{$tstenv}{passed}}, $_;
487 push(
488 132 ▶ @{$new[-1]{results}[-1]{failures}},
Branch: 1 branch
BranchTrueFalseTotal
/^ \s* (\S+?) \.+(?:\s+\.+)* (\w+) \s* $/x ? : 132 0 132
489 m/^ \s* (\S+?) \.+(?:\s+\.+)* (\w+) \s* $/x
490 ? {
491 test => $1,
492 status => $2,
493 extra => []
494 }
495 : {
496 test => "?",
497 status => "?",
498 extra => []
499 }
500 );
501 132 $previous = "passed";
502 132 next;
503 }
504  
505 1027 my @captures = ();
506 1027 ▶ if (@captures = $_ =~ m/
Branch: 1 branch
BranchTrueFalseTotal
if (@captures = $_ =~ / (?:^|,)\s+ (\d+(?:-\d+)?) /gx) 310 717 1027
507 (?:^|,)\s+
508 (\d+(?:-\d+)?)
509 /gx) {
510 310 ▶ if (ref $rpt{$cfgarg}->{$debug}{$tstenv}{$previous}) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $rpt{$cfgarg}{$debug}{$tstenv}{$previous}) 308 2 310
511 308 push @{$rpt{$cfgarg}->{$debug}{$tstenv}{$previous}}, $_;
512 308 push @{$new[-1]{results}[-1]{failures}[-1]{extra}}, @captures;
513 }
514 310 next;
515 }
516  
517 717 ▶ if (/^\s+(?:Bad plan)|(?:No plan found)|^\s+(?:Non-zero exit status)/) {
Branch: 1 branch
BranchTrueFalseTotal
if (/^\s+(?:Bad plan)|(?:No plan found)|^\s+(?:Non-zero exit status)/) 42 675 717
518 42 ▶ if (ref $rpt{$cfgarg}->{$debug}{$tstenv}{failed}) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $rpt{$cfgarg}{$debug}{$tstenv}{"failed"}) 42 0 42
519 42 push @{$rpt{$cfgarg}->{$debug}{$tstenv}{failed}}, $_;
520 42 s/^\s+//;
521 42 push @{$new[-1]{results}[-1]{failures}[-1]{extra}}, $_;
522 }
523 42 next;
524 }
525 675 next;
526 }
527  
528 66 $rpt{last_cfg} = $statarg;
529 66 ▶ exists $rpt{statcfg}{$statarg} or $rpt{running} = $fcnt;
Branch: 1 branch
BranchTrueFalseTotal
exists $rpt{"statcfg"}{$statarg} or $rpt{"running"} = $fcnt 63 3 66
530 66 ▶ $rpt{avg} = $rpt{count} ? $rpt{secs} / $rpt{count} : 0;
Branch: 1 branch
BranchTrueFalseTotal
$rpt{'count'} ? : 66 0 66
531 66 $self->{_rpt} = \%rpt;
532 66 $self->_post_process;
533 }
534  
535 =head2 $self->_post_process( )
536  
537 C<_post_process()> sets up the report for easy printing. It needs to
538 sort the buildenvironments, statusletters and test failures.
539  
540 =cut
541  
542 66 ▶sub _post_process {
Subroutine _post_process: called CC=48 SCAR=38.8
543 66 my $self = shift;
544  
545 66 ▶ unless (defined $self->{is56x}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"is56x"}) 51 15 66
546 51 $self->{is56x} = 0;
547 # Overly defensive, as .out files might be analyzed outside of the
548 # original smoke environment
549 51 ▶ if ($self->{ddir} && -d $self->{ddir}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"ddir"} and -d $self->{"ddir"}) 51 0 51
Condition33%1/3
$self->{"ddir"} and -d $self->{"ddir"}
!ll&&!rl&&r
0051
MC/DC0%0/2
$self->{"ddir"} and -d $self->{"ddir"}
$self->{"ddir"} -d $self->{"ddir"}
Truth table33%1/3
A and B
A= $self->{"ddir"}B= -d $self->{"ddir"}
ABresult
0X0
100
111
550 51 my %cfg = get_smoked_Config($self->{ddir}, "version");
551 51 ▶ if ($cfg{version} =~ m/^\s* ([0-9]+) \. ([0-9]+) \. ([0-9]+) \s*$/x) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cfg{"version"} =~ /^\s* ([0-9]+) \. ([0-9]+) \. ([0-9]+) \s*$/x) 49 2 51
552 49 my $p_version = sprintf "%d.%03d%03d", $1, $2, $3;
553 49 $self->{is56x} = $p_version < 5.007;
554 }
555 }
556 }
557 66 ▶ $self->{defaultenv} ||= $self->{is56x};
Condition100%3/3
$self->{"defaultenv"} ||= $self->{"is56x"}
l!l&&r!l&&!r
3756
MC/DC100%2/2
$self->{"defaultenv"} ||= $self->{"is56x"}
$self->{"defaultenv"} $self->{"is56x"}
Truth table100%3/3
A ||= B
A= $self->{"defaultenv"}B= $self->{"is56x"}
ABresult
1X1
011
000
558  
559 66 my (%bldenv, %cfgargs);
560 66 my $rpt = $self->{_rpt};
561 66 foreach my $config (@{$rpt->{cfglist}}) {
562  
563 139 foreach my $buildenv (keys %{$rpt->{$config}{summary}{N}}) {
564 244 $bldenv{$buildenv}++;
565 }
566 139 foreach my $buildenv (keys %{$rpt->{$config}{summary}{D}}) {
567 118 $bldenv{$buildenv}++;
568 }
569 139 foreach my $ca (grep defined $_ => quotewords('\s+', 1, $config)) {
570 255 $cfgargs{$ca}++;
571 }
572 }
573 my %common_args =
574 54 ▶ map { ($_ => 1) }
Condition100%3/3
$cfgargs{$_} == @{$rpt->{'cfglist'};} && !/^-[DU]use/
!ll&&!rl&&r
341454
MC/DC100%2/2
$cfgargs{$_} == @{$rpt->{'cfglist'};} && !/^-[DU]use/
$cfgargs{$_} == @{$rpt->{'cfglist'};} !/^-[DU]use/
Truth table100%3/3
A && not(B)
A= $cfgargs{$_} == @{$rpt->{'cfglist'};}B= !/^-[DU]use/
ABresult
0X0
100
111
575 66 grep $cfgargs{$_} == @{$rpt->{cfglist}}
576 && !/^-[DU]use/ => keys %cfgargs;
577  
578 66 $rpt->{_common_args} = \%common_args;
579 66 $rpt->{common_args} = join " ", sort keys %common_args;
580 66 ▶ $rpt->{common_args} ||= 'none';
Condition100%2/2
$rpt->{"common_args"} ||= "none"
l!l
5313
MC/DC100%1/1
$rpt->{"common_args"} ||= "none"
$rpt->{"common_args"}
Truth table100%2/2
A
A= $rpt->{"common_args"}
Aresult
11
00
581  
582 66 $self->{_tstenv} = [reverse sort keys %bldenv];
583 66 my %count = (
584 O => 0,
585 F => 0,
586 X => 0,
587 M => 0,
588 m => 0,
589 c => 0,
590 o => 0,
591 t => 0
592 );
593 66 my (%failures, %order);
594 66 my $ord = 1;
595 66 my (%todo_passed, %order2);
596 66 my $ord2 = 1;
597 66 ▶ my $debugging = $rpt->{dbughow} || '-DDEBUGGING';
Condition100%2/2
$rpt->{'dbughow'} || '-DDEBUGGING'
l!l
2343
MC/DC100%1/1
$rpt->{'dbughow'} || '-DDEBUGGING'
$rpt->{'dbughow'}
Truth table100%2/2
A
A= $rpt->{'dbughow'}
Aresult
11
00
598  
599 66 foreach my $config (@{$rpt->{cfglist}}) {
600 139 foreach my $dbinfo (qw( N D )) {
601 278 my $cfg = $config;
602 278 ▶ ($cfg = $cfg ? "$debugging $cfg" : $debugging)
Branch: 2 branches
BranchTrueFalseTotal
if $dbinfo eq "D" 139 139 278
$cfg ? : 131 8 139
603 if $dbinfo eq "D";
604 278 $self->log_info("Processing [%s]", $cfg);
605 278 my $status = $self->{_rpt}{$config}{summary}{$dbinfo};
606 278 foreach my $tstenv (reverse sort keys %bldenv) {
607 524 ▶ next if $tstenv eq 'minitest' && !exists $status->{$tstenv};
Branch: 1 branch
BranchTrueFalseTotal
if $tstenv eq "minitest" and not exists $status->{$tstenv} 12 512 524
Condition100%3/3
$tstenv eq "minitest" and not exists $status->{$tstenv}
!ll&&!rl&&r
5001212
MC/DC100%2/2
$tstenv eq "minitest" and not exists $status->{$tstenv}
$tstenv eq "minitest" not exists $status->{$tstenv}
Truth table100%3/3
A and not(B)
A= $tstenv eq "minitest"B= not exists $status->{$tstenv}
ABresult
0X0
100
111
608  
609 512 (my $showenv = $tstenv) =~ s/^locale://;
610 512 ▶ if ($tstenv =~ /^locale:/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($tstenv =~ /^locale:/) 54 458 512
611 $self->{_locale_keys}{$showenv}++
612 54 ▶ or push @{$self->{_locale}}, $showenv;
Branch: 1 branch
BranchTrueFalseTotal
$self->{"_locale_keys"}{$showenv}++ or push @{$$self{"_locale"};}, $showenv 40 14 54
613 }
614 $showenv = 'default'
615 512 ▶ if $self->{defaultenv} && $showenv eq 'stdio';
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"defaultenv"} and $showenv eq "stdio" 110 402 512
Condition66%2/3
$self->{"defaultenv"} and $showenv eq "stdio"
!ll&&!rl&&r
4020110
MC/DC50%1/2
$self->{"defaultenv"} and $showenv eq "stdio"
$self->{"defaultenv"} $showenv eq "stdio"
Truth table66%2/3
A and B
A= $self->{"defaultenv"}B= $showenv eq "stdio"
ABresult
0X0
100
111
616  
617 512 ▶ $status->{$tstenv} ||= '-';
Condition100%2/2
$status->{$tstenv} ||= "-"
l!l
362150
MC/DC100%1/1
$status->{$tstenv} ||= "-"
$status->{$tstenv}
Truth table100%2/2
A
A= $status->{$tstenv}
Aresult
11
00
618  
619 512 my $status2 = $self->{_rpt}{$config}{$dbinfo};
620 512 ▶ if (exists $status2->{$tstenv}{failed}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $status2->{$tstenv}{"failed"}) 195 317 512
621 195 my $failed = join "\n", @{$status2->{$tstenv}{failed}};
622 195 ▶ if ( exists $failures{$failed}
Branch: 1 branch
BranchTrueFalseTotal
if (exists $failures{$failed} and @{$failures{$failed};} and $failures{$failed}[-1]{'cfg'} eq $cfg) { } 62 133 195
Condition83%5/6
exists $failures{$failed} and @{$failures{$failed};} and $failures{$failed}[-1]{"cfg"} eq $cfg
!ll&&!rl&&r
765762
exists $failures{$failed} and @{$failures{$failed};}
!ll&&!rl&&r
760119
MC/DC66%2/3
exists $failures{$failed} and @{$failures{$failed};} and $failures{$failed}[-1]{"cfg"} eq $cfg
exists $failures{$failed} @{$failures{$failed};} $failures{$failed}[-1]{"cfg"} eq $cfg
Truth table75%3/4
A and B and C
A= exists $failures{$failed}B= @{$failures{$failed};}C= $failures{$failed}[-1]{"cfg"} eq $cfg
ABCresult
0XX0
10X0
1100
1111
623 119 && @{$failures{$failed}}
624 && $failures{$failed}->[-1]{cfg} eq $cfg)
625 {
626 62 push @{$failures{$failed}->[-1]{env}}, $showenv;
627 }
628 else {
629 133 push @{$failures{$failed}},
630 {
631 cfg => $cfg,
632 env => [$showenv]
633 };
634 133 ▶ $order{$failed} ||= $ord++;
Condition66%2/3
$order{$failed} ||= $ord++
l!l&&r!l&&!r
57760
MC/DC0%0/2
$order{$failed} ||= $ord++
$order{$failed} $ord++
Truth table66%2/3
A ||= B
A= $order{$failed}B= $ord++
ABresult
1X1
011
000
635 }
636 }
637 512 ▶ if (exists $status2->{$tstenv}{passed}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $status2->{$tstenv}{"passed"}) 66 446 512
638 66 my $passed = join "\n", @{$status2->{$tstenv}{passed}};
639 66 ▶ if ( exists $todo_passed{$passed}
Branch: 1 branch
BranchTrueFalseTotal
if (exists $todo_passed{$passed} and @{$todo_passed{$passed};} and $todo_passed{$passed}[-1]{'cfg'} eq $cfg) { } 30 36 66
Condition83%5/6
exists $todo_passed{$passed} and @{$todo_passed{$passed};} and $todo_passed{$passed}[-1]{"cfg"} eq $cfg
!ll&&!rl&&r
33330
exists $todo_passed{$passed} and @{$todo_passed{$passed};}
!ll&&!rl&&r
33033
MC/DC66%2/3
exists $todo_passed{$passed} and @{$todo_passed{$passed};} and $todo_passed{$passed}[-1]{"cfg"} eq $cfg
exists $todo_passed{$passed} @{$todo_passed{$passed};} $todo_passed{$passed}[-1]{"cfg"} eq $cfg
Truth table75%3/4
A and B and C
A= exists $todo_passed{$passed}B= @{$todo_passed{$passed};}C= $todo_passed{$passed}[-1]{"cfg"} eq $cfg
ABCresult
0XX0
10X0
1100
1111
640 33 && @{$todo_passed{$passed}}
641 && $todo_passed{$passed}->[-1]{cfg} eq $cfg)
642 {
643 30 push @{$todo_passed{$passed}->[-1]{env}}, $showenv;
644 }
645 else {
646 push(
647 36 @{$todo_passed{$passed}},
648 {
649 cfg => $cfg,
650 env => [$showenv]
651 }
652 );
653 36 ▶ $order2{$passed} ||= $ord2++;
Condition66%2/3
$order2{$passed} ||= $ord2++
l!l&&r!l&&!r
3330
MC/DC0%0/2
$order2{$passed} ||= $ord2++
$order2{$passed} $ord2++
Truth table66%2/3
A ||= B
A= $order2{$passed}B= $ord2++
ABresult
1X1
011
000
654 }
655  
656 }
657  
658 512 $self->log_debug("\t[%s]: %s", $showenv, $status->{$tstenv});
659 512 ▶ if ($tstenv eq 'minitest') {
Branch: 1 branch
BranchTrueFalseTotal
if ($tstenv eq "minitest") 12 500 512
660 12 $status->{stdio} = "M";
661 12 delete $status->{minitest};
662 }
663 }
664 278 ▶ unless ($self->{defaultenv}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"defaultenv"}) 168 110 278
665 168 ▶ exists $status->{perlio} or $status->{perlio} = '-';
Branch: 1 branch
BranchTrueFalseTotal
exists $status->{"perlio"} or $status->{"perlio"} = "-" 168 0 168
666 168 ▶ my @locales = split ' ', ($self->{locale} || '');
Condition100%2/2
$self->{'locale'} || ''
l!l
18150
MC/DC100%1/1
$self->{'locale'} || ''
$self->{'locale'}
Truth table100%2/2
A
A= $self->{'locale'}
Aresult
11
00
667 168 for my $locale (@locales) {
668 exists $status->{"locale:$locale"}
669 18 ▶ or $status->{"locale:$locale"} = '-';
Branch: 1 branch
BranchTrueFalseTotal
exists $$status{"locale:$locale"} or $$status{"locale:$locale"} = "-" 18 0 18
670 }
671 }
672  
673 $count{$_}++
674 278 ▶ for map { m/[cmMtFXO]/ ? $_ : m/-/ ? 'O' : 'o' }
Branch: 2 branches
BranchTrueFalseTotal
/[cmMtFXO]/ ? : 362 138 500
/-/ ? : 138 0 138
675 map $status->{$_} => keys %$status;
676 }
677 }
678 66 ▶ defined $self->{_locale} or $self->{_locale} = [];
Branch: 1 branch
BranchTrueFalseTotal
defined $self->{"_locale"} or $self->{"_locale"} = [] 13 53 66
679  
680 my @failures = map {
681 {
682 tests => $_,
683 cfgs => [
684 map {
685 133 my $cfg_clean = __rm_common_args($_->{cfg}, \%common_args);
686 133 my $env = join "/", @{$_->{env}};
687 133 "[$env] $cfg_clean";
688 76 } @{$failures{$_}}
689 ],
690 }
691 66 } sort { $order{$a} <=> $order{$b} } keys %failures;
692 66 $self->{_failures} = \@failures;
693  
694 my @todo_passed = map {
695 {
696 tests => $_,
697 cfgs => [
698 map {
699 36 my $cfg_clean = __rm_common_args($_->{cfg}, \%common_args);
700 36 my $env = join "/", @{$_->{env}};
701 36 "[$env] $cfg_clean";
702 33 } @{$todo_passed{$_}}
703 ],
704 }
705 66 } sort { $order2{$a} <=> $order2{$b} } keys %todo_passed;
706 66 $self->{_todo_passed} = \@todo_passed;
707  
708 66 $self->{_counters} = \%count;
709  
710 # Need to rebuild the test-environments as minitest changes into stdio
711 66 my %bldenv2;
712 66 foreach my $config (@{$rpt->{cfglist}}) {
713 139 foreach my $buildenv (keys %{$rpt->{$config}{summary}{N}}) {
714 250 $bldenv2{$buildenv}++;
715 }
716 139 foreach my $buildenv (keys %{$rpt->{$config}{summary}{D}}) {
717 250 $bldenv2{$buildenv}++;
718 }
719 }
720 66 $self->{_tstenvraw} = $self->{_tstenv};
721 66 $self->{_tstenv} = [reverse sort keys %bldenv2];
722 }
723  
724 =head2 __posixdate($time)
725  
726 Returns C<strftime("%F %T %z")>.
727  
728 =cut
729  
730 229 ▶sub __posixdate {
Subroutine __posixdate: called CC=3 SCAR=12.0
731  
732 # Note that the format "%F %T %z" returns:
733 # Linux: 2012-04-02 10:57:58 +0200
734 # HP-UX: April 08:53:32 METDST
735 # ENOTPORTABLE! %F is C99 only!
736 229 ▶ my $stamp = shift || time;
Condition50%1/2
shift() || time
l!l
2290
MC/DC0%0/1
shift() || time
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
737 229 ▶ return $^O eq 'MSWin32'
Branch: 1 branch
BranchTrueFalseTotal
$^O eq 'MSWin32' ? : 0 229 229
738 ? POSIX::strftime("%Y-%m-%d %H:%M:%S Z", gmtime $stamp)
739 : POSIX::strftime("%Y-%m-%d %H:%M:%S %z", localtime $stamp);
740 }
741  
742 =head2 __rm_common_args( $cfg, \%common )
743  
744 Removes the the arguments stored as keys in C<%common> from C<$cfg>.
745  
746 =cut
747  
748 169 ▶sub __rm_common_args {
Subroutine __rm_common_args: called CC=1 SCAR=0.0
749 169 my( $cfg, $common ) = @_;
750  
751 169 require Test::Smoke::BuildCFG;
752 169 my $bcfg = Test::Smoke::BuildCFG::new_configuration( $cfg );
753  
754 169 return $bcfg->rm_arg( keys %$common );
755 }
756  
757 =head2 $reporter->get_logfile()
758  
759 Return the contents of C<< $self->{lfile} >> either by reading the file or
760 returning the cached version.
761  
762 =cut
763  
764 0 ▶sub get_logfile {
Subroutine get_logfile: not called CC=2 SCAR=17.9
Pod documented
765 0 my $self = shift;
766 0 ▶ return $self->{log_file} if $self->{log_file};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"log_file"} 0 0 0
767  
768 0 return $self->{log_file} = read_logfile($self->{lfile}, $self->{v});
769 }
770  
771 =head2 $reporter->get_outfile()
772  
773 Return the contents of C<< $self->{outfile} >> either by reading the file or
774 returning the cached version.
775  
776 =cut
777  
778 121 ▶sub get_outfile {
Subroutine get_outfile: called CC=2 SCAR=9.2
Pod documented
779 121 my $self = shift;
780 121 ▶ return $self->{_outfile} if $self->{_outfile};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_outfile"} 121 0 121
781  
782 0 my $fq_outfile = catfile($self->{ddir}, $self->{outfile});
783 0 return $self->{_outfile} = read_logfile($fq_outfile, $self->{v});
784 }
785  
786 =head2 $reporter->write_to_file( [$name] )
787  
788 Write the C<< $self->report >> to file. If name is omitted it will
789 use C<< catfile( $self->{ddir}, $self->{rptfile} ) >>.
790  
791 =cut
792  
793 1 ▶sub write_to_file {
Subroutine write_to_file: called CC=5 SCAR=19.6
Pod documented
794 1 my $self = shift;
795 1 ▶ return unless defined $self->{_outfile};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"_outfile"} 0 1 1
796 1 ▶ my( $name ) = shift || ( catfile $self->{ddir}, $self->{rptfile} );
Condition33%1/3
shift() || catfile($self->{'ddir'}, $self->{'rptfile'})
l!l&&r!l&&!r
100
MC/DC0%0/2
shift() || catfile($self->{'ddir'}, $self->{'rptfile'})
shift() catfile($self->{'ddir'}, $self->{'rptfile'})
Truth table33%1/3
A || B
A= shift()B= catfile($self->{'ddir'}, $self->{'rptfile'})
ABresult
1X1
011
000
797  
798 1 $self->log_info("Writing report to '%s'", $name);
799 1 local *RPT;
800 1 ▶ open RPT, "> $name" or do {
Branch: 1 branch
BranchTrueFalseTotal
open RPT, "> $name" or do { require Carp; Carp::carp("Error creating '${name}': $!"); return } 1 0 1
801 0 require Carp;
802 0 Carp::carp( "Error creating '$name': $!" );
803 0 return;
804 };
805 1 print RPT $self->report;
806 1 ▶ close RPT or do {
Branch: 1 branch
BranchTrueFalseTotal
close RPT or do { require Carp; Carp::carp("Error writing to '${name}': $!"); return } 1 0 1
807 0 require Carp;
808 0 Carp::carp( "Error writing to '$name': $!" );
809 0 return;
810 };
811 1 $self->log_info("'%s' written OK", $name);
812 1 return 1;
813 }
814  
815 =head2 $reporter->smokedb_data()
816  
817 Transport the report to the gateway. The transported data will also be stored
818 locally in the file mktest.jsn
819  
820 =cut
821  
822 0 ▶sub smokedb_data {
Subroutine smokedb_data: not called CC=19 SCAR=59.4
Pod documented
823 0 my $self = shift;
824 0 $self->log_info("Gathering CoreSmokeDB information...");
825  
826 0 my %rpt = map { $_ => $self->{$_} } keys %$self;
827 0 $rpt{manifest_msgs} = delete $rpt{_mani};
828 0 $rpt{applied_patches} = [$self->registered_patches];
829 0 $rpt{sysinfo} = do {
830 0 my %Conf = get_smoked_Config($self->{ddir} => qw( version lfile ));
831 0 my $si = System::Info->new;
832 0 my ($osname, $osversion) = split m/ - / => $si->os, 2;
833 0 ▶ (my $ncpu = $si->ncpu || "?") =~ s/^\s*(\d+)\s*/$1/;
Condition0%0/2
$si->ncpu || '?'
l!l
00
MC/DC0%0/1
$si->ncpu || '?'
$si->ncpu
Truth table0%0/2
A
A= $si->ncpu
Aresult
11
00
834 0 ▶ (my $user_note = $self->{user_note} || "") =~ s/(\S)[\s\r\n]*\z/$1\n/;
Condition0%0/2
$self->{'user_note'} || ''
l!l
00
MC/DC0%0/1
$self->{'user_note'} || ''
$self->{'user_note'}
Truth table0%0/2
A
A= $self->{'user_note'}
Aresult
11
00
835 {
836 architecture => lc $si->cpu_type,
837 config_count => $self->{_rpt}{count},
838 cpu_count => $ncpu,
839 cpu_description => $si->cpu,
840 duration => $self->{_rpt}{secs},
841 git_describe => $self->{_rpt}{patchdescr},
842 git_id => $self->{_rpt}{patch},
843 smoke_branch => $self->{_rpt}{smokebranch},
844 hostname => $self->{hostname} || $si->host,
845 lang => $ENV{LANG},
846 lc_all => $ENV{LC_ALL},
847 osname => $osname,
848 osversion => $osversion,
849 perl_id => $Conf{version},
850 reporter => $self->{from},
851 reporter_version => $VERSION,
852 smoke_date => __posixdate($self->{_rpt}{started}),
853 smoke_revision => $Test::Smoke::VERSION,
854 smoker_version => $Test::Smoke::Smoker::VERSION,
855 smoke_version => $Test::Smoke::VERSION,
856 test_jobs => $ENV{TEST_JOBS},
857 0 ▶ username => $ENV{LOGNAME} || getlogin || getpwuid($<) || "?",
Branch: 1 branch
BranchTrueFalseTotal
$^V ? : 0 0 0
Condition0%0/11
$self->{'hostname'} || $si->host
l!l&&r!l&&!r
000
$ENV{'LOGNAME'} || getlogin || getpwuid $< || '?'
l!l
00
$ENV{"LOGNAME"} or getlogin or getpwuid $<
l!l&&r!l&&!r
000
$ENV{"LOGNAME"} or getlogin
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{'hostname'} || $si->host
$self->{'hostname'} $si->host
MC/DC0%0/3
$ENV{'LOGNAME'} || getlogin || getpwuid $< || '?'
$ENV{"LOGNAME"} getlogin getpwuid $<
Truth table0%0/3
A || B
A= $self->{'hostname'}B= $si->host
ABresult
1X1
011
000
Truth table0%0/4
A or B or C
A= $ENV{"LOGNAME"}B= getloginC= getpwuid $<
ABCresult
1XX1
01X1
0011
0000
858 user_note => $user_note,
859 smoke_perl => ($^V ? sprintf("%vd", $^V) : $]),
860 };
861 };
862 0 $rpt{compiler_msgs} = [$self->ccmessages];
863 0 $rpt{nonfatal_msgs} = [$self->nonfatalmessages];
864 0 $rpt{skipped_tests} = [$self->user_skipped_tests];
865 0 $rpt{harness_only} = delete $rpt{harnessonly};
866 0 $rpt{summary} = $self->summary;
867  
868 0 $rpt{log_file} = undef;
869 0 ▶ my $rpt_fail = $rpt{summary} eq "PASS" ? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$rpt{'summary'} eq 'PASS' ? : 0 0 0
870 0 ▶ if (my $send_log = $self->{send_log}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $send_log = $self->{"send_log"}) 0 0 0
871 0 ▶ if ( ($send_log eq "always")
Branch: 1 branch
BranchTrueFalseTotal
if ($send_log eq "always" or $send_log eq "on_fail" and $rpt_fail) 0 0 0
Condition0%0/6
$send_log eq "always" or $send_log eq "on_fail" and $rpt_fail
l!l&&r!l&&!r
000
$send_log eq "on_fail" and $rpt_fail
!ll&&!rl&&r
000
MC/DC0%0/3
$send_log eq "always" or $send_log eq "on_fail" and $rpt_fail
$send_log eq "always" $send_log eq "on_fail" $rpt_fail
Truth table0%0/4
A or B and C
A= $send_log eq "always"B= $send_log eq "on_fail"C= $rpt_fail
ABCresult
1XX1
0111
00X0
0100
872 or ($send_log eq "on_fail" && $rpt_fail))
873 {
874 0 $rpt{log_file} = $self->get_logfile();
875 }
876 }
877 0 $rpt{out_file} = undef;
878 0 ▶ if (my $send_out = $self->{send_out}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $send_out = $self->{"send_out"}) 0 0 0
879 0 ▶ if ( ($send_out eq "always")
Branch: 1 branch
BranchTrueFalseTotal
if ($send_out eq "always" or $send_out eq "on_fail" and $rpt_fail) 0 0 0
Condition0%0/6
$send_out eq "always" or $send_out eq "on_fail" and $rpt_fail
l!l&&r!l&&!r
000
$send_out eq "on_fail" and $rpt_fail
!ll&&!rl&&r
000
MC/DC0%0/3
$send_out eq "always" or $send_out eq "on_fail" and $rpt_fail
$send_out eq "always" $send_out eq "on_fail" $rpt_fail
Truth table0%0/4
A or B and C
A= $send_out eq "always"B= $send_out eq "on_fail"C= $rpt_fail
ABCresult
1XX1
0111
00X0
0100
880 or ($send_out eq "on_fail" && $rpt_fail))
881 {
882 0 $rpt{out_file} = $self->get_outfile();
883 }
884 }
885 0 delete $rpt{$_} for qw/from send_log send_out user_note/, grep m/^_/ => keys %rpt;
886  
887 0 my $json = JSON->new->utf8(1)->pretty(1)->encode(\%rpt);
888  
889 # write the json to file:
890 0 my $jsn_file = catfile($self->{ddir}, $self->{jsnfile});
891 0 ▶ if (open my $jsn, ">", $jsn_file) {
Branch: 1 branch
BranchTrueFalseTotal
if (open my $jsn, '>', $jsn_file) { } 0 0 0
892 0 binmode($jsn);
893 0 print {$jsn} $json;
894 0 close $jsn;
895 0 $self->log_info("Write to '%s': ok", $jsn_file);
896 }
897 else {
898 0 $self->log_warn("Error creating '%s': %s", $jsn_file, $!);
899 }
900  
901 0 return $self->{_json} = $json;
902 }
903  
904 =head2 $reporter->report( )
905  
906 Return a string with the full report
907  
908 =cut
909  
910 61 ▶sub report {
Subroutine report: called CC=8 SCAR=21.9
Pod documented
911 61 my $self = shift;
912 61 ▶ return unless defined $self->{_outfile};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"_outfile"} 0 61 61
913 61 $self->_get_usernote();
914  
915 61 my $report = $self->preamble;
916  
917 61 $report .= "Summary: ".$self->summary."\n\n";
918 61 $report .= $self->letter_legend . "\n";
919 61 $report .= $self->smoke_matrix . $self->bldenv_legend;
920  
921 61 $report .= $self->registered_patches;
922  
923 61 $report .= $self->harness3_options;
924  
925 61 $report .= $self->user_skipped_tests;
926  
927 61 ▶ $report .= "\nFailures: (common-args) $self->{_rpt}{common_args}\n"
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_test_failures 44 17 61
928 . $self->failures if $self->has_test_failures;
929 61 ▶ $report .= "\n" . $self->mani_fail if $self->has_mani_failures;
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_mani_failures 6 55 61
930  
931 61 ▶ $report .= "\nPassed Todo tests: (common-args) $self->{_rpt}{common_args}\n"
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_todo_passed 27 34 61
932 . $self->todo_passed if $self->has_todo_passed;
933  
934 61 $report .= $self->ccmessages;
935  
936 61 $report .= $self->nonfatalmessages;
937  
938 61 ▶ if ( $self->{showcfg} && $self->{cfg} && $self->has_test_failures ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"showcfg"} and $self->{"cfg"} and $self->has_test_failures) 0 61 61
Condition33%2/6
$self->{"showcfg"} and $self->{"cfg"} and $self->has_test_failures
!ll&&!rl&&r
6100
$self->{"showcfg"} and $self->{"cfg"}
!ll&&!rl&&r
6100
MC/DC0%0/3
$self->{"showcfg"} and $self->{"cfg"} and $self->has_test_failures
$self->{"showcfg"} $self->{"cfg"} $self->has_test_failures
Truth table25%1/4
A and B and C
A= $self->{"showcfg"}B= $self->{"cfg"}C= $self->has_test_failures
ABCresult
0XX0
10X0
1100
1111
939 0 require Test::Smoke::BuildCFG;
940 0 my $bcfg = Test::Smoke::BuildCFG->new( $self->{cfg} );
941 0 $report .= "\nBuild configurations:\n" . $bcfg->as_string ."=\n";
942 }
943  
944 61 $report .= $self->signature;
945 61 return $report;
946 }
947  
948 =head2 $reporter->_get_usernote()
949  
950 Return $self->{user_note} if exists.
951  
952 Check if C<< $self->{un_file} >> exists, and read contents into C<<
953 $self->{user_note} >>.
954  
955 =cut
956  
957 61 ▶sub _get_usernote {
Subroutine _get_usernote: called CC=5 SCAR=22.5
958 61 my $self = shift;
959  
960 61 ▶ if (!$self->{user_note} && $self->{un_file}) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $self->{'user_note'} and $self->{'un_file'}) { } 0 61 61
elsif (not defined $self->{'user_note'}) { } 0 61 61
Condition66%2/3
not $self->{"user_note"} and $self->{"un_file"}
!ll&&!rl&&r
2590
MC/DC0%0/2
not $self->{"user_note"} and $self->{"un_file"}
not $self->{"user_note"} $self->{"un_file"}
Truth table66%2/3
not(A) and B
A= not $self->{"user_note"}B= $self->{"un_file"}
ABresult
0X0
100
111
961 0 ▶ if (open my $unf, '<', $self->{un_file}) {
Branch: 1 branch
BranchTrueFalseTotal
if (open my $unf, '<', $self->{'un_file'}) { } 0 0 0
962 0 $self->{user_note} = join('', <$unf>);
963 }
964 else {
965 0 $self->log_warn("Cannot read '%s': %s", $self->{un_file}, $!);
966 }
967 }
968 elsif (!defined $self->{user_note}) {
969 0 $self->{user_note} = '';
970 }
971 61 $self->{user_note} =~ s/(?<=\S)\s*\z/\n/;
972 }
973  
974 =head2 $reporter->ccinfo( )
975  
976 Return the string containing the C-compiler info.
977  
978 =cut
979  
980 73 ▶sub ccinfo {
Subroutine ccinfo: called CC=6 SCAR=18.8
Pod documented
981 73 my $self = shift;
982 73 my $cinfo = $self->{_rpt}{cinfo};
983 73 ▶ unless ( $cinfo ) { # Old .out file?
Branch: 1 branch
BranchTrueFalseTotal
unless ($cinfo) 53 20 73
984 53 my %Config = get_smoked_Config( $self->{ddir} => qw(
985 cc ccversion gccversion
986 ));
987 53 $cinfo = "? ";
988 53 ▶ my $ccvers = $Config{gccversion} || $Config{ccversion} || '';
Condition40%2/5
$Config{'gccversion'} || $Config{'ccversion'} || ''
l!l
053
$Config{"gccversion"} or $Config{"ccversion"}
l!l&&r!l&&!r
0053
MC/DC0%0/2
$Config{'gccversion'} || $Config{'ccversion'} || ''
$Config{"gccversion"} $Config{"ccversion"}
Truth table33%1/3
A or B
A= $Config{"gccversion"}B= $Config{"ccversion"}
ABresult
1X1
011
000
989 53 ▶ $cinfo .= ( $Config{cc} || 'unknown cc' ) . " version $ccvers";
Condition50%1/2
$Config{'cc'} || 'unknown cc'
l!l
053
MC/DC0%0/1
$Config{'cc'} || 'unknown cc'
$Config{'cc'}
Truth table50%1/2
A
A= $Config{'cc'}
Aresult
11
00
990 53 ▶ $self->{_ccinfo} = ($Config{cc} || 'cc') . " version $ccvers";
Condition50%1/2
$Config{'cc'} || 'cc'
l!l
053
MC/DC0%0/1
$Config{'cc'} || 'cc'
$Config{'cc'}
Truth table50%1/2
A
A= $Config{'cc'}
Aresult
11
00
991 }
992 73 return $cinfo;
993 }
994  
995 =head2 $reporter->registered_patches()
996  
997 Return a section with the locally applied patches (from patchlevel.h).
998  
999 =cut
1000  
1001 62 ▶sub registered_patches {
Subroutine registered_patches: called CC=5 SCAR=16.4
Pod documented
1002 62 my $self = shift;
1003  
1004 62 my @lpatches = get_local_patches($self->{ddir}, $self->{v});
1005 62 ▶ @lpatches && $lpatches[0] eq "uncommitted-changes" and shift @lpatches;
Branch: 1 branch
BranchTrueFalseTotal
@lpatches and $lpatches[0] eq "uncommitted-changes" and shift @lpatches 0 62 62
Condition66%2/3
@lpatches and $lpatches[0] eq "uncommitted-changes"
!ll&&!rl&&r
5930
MC/DC0%0/2
@lpatches and $lpatches[0] eq "uncommitted-changes"
@lpatches $lpatches[0] eq "uncommitted-changes"
Truth table66%2/3
A and B
A= @lpatchesB= $lpatches[0] eq "uncommitted-changes"
ABresult
0X0
100
111
1006 62 ▶ wantarray and return @lpatches;
Branch: 1 branch
BranchTrueFalseTotal
wantarray and return @lpatches 0 62 62
1007  
1008 62 ▶ @lpatches or return "";
Branch: 1 branch
BranchTrueFalseTotal
@lpatches or return "" 3 59 62
1009  
1010 3 my $list = join "\n", map " $_" => @lpatches;
1011 3 return "\nLocally applied patches:\n$list\n";
1012 }
1013  
1014 =head2 $reporter->harness3_options
1015  
1016 Show indication of the options used for C<HARNESS_OPTIONS>.
1017  
1018 =cut
1019  
1020 61 ▶sub harness3_options {
Subroutine harness3_options: called CC=3 SCAR=17.3
Pod documented
1021 61 my $self = shift;
1022  
1023 61 ▶ $self->{harnessonly} or return "";
Branch: 1 branch
BranchTrueFalseTotal
$self->{"harnessonly"} or return "" 0 61 61
1024  
1025 0 my $msg = "\nTestsuite was run only with 'harness'";
1026 0 ▶ $self->{harness3opts} or return $msg . "\n";
Branch: 1 branch
BranchTrueFalseTotal
$self->{"harness3opts"} or return $msg . "\n" 0 0 0
1027  
1028 0 return $msg . " and HARNESS_OPTIONS=$self->{harness3opts}\n";
1029 }
1030  
1031 =head2 $reporter->user_skipped_tests( )
1032  
1033 Show indication for the fact that the user requested to skip some tests.
1034  
1035 =cut
1036  
1037 62 ▶sub user_skipped_tests {
Subroutine user_skipped_tests: called CC=8 SCAR=21.1
Pod documented
1038 62 my $self = shift;
1039  
1040 62 my @skipped;
1041 62 ▶ if ($self->{skip_tests} && -f $self->{skip_tests} and open my $fh,
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"skip_tests"} and -f $self->{"skip_tests"} and open my $fh, "<", $self->{"skip_tests"}) 2 60 62
Condition66%4/6
$self->{"skip_tests"} and -f $self->{"skip_tests"} and open my $fh, "<", $self->{"skip_tests"}
!ll&&!rl&&r
6002
$self->{"skip_tests"} and -f $self->{"skip_tests"}
!ll&&!rl&&r
6002
MC/DC33%1/3
$self->{"skip_tests"} and -f $self->{"skip_tests"} and open my $fh, "<", $self->{"skip_tests"}
$self->{"skip_tests"} -f $self->{"skip_tests"} open my $fh, "<", $self->{"skip_tests"}
Truth table50%2/4
A and B and C
A= $self->{"skip_tests"}B= -f $self->{"skip_tests"}C= open my $fh, "<", $self->{"skip_tests"}
ABCresult
0XX0
10X0
1100
1111
1042 "<", $self->{skip_tests})
1043 {
1044 2 ▶ while (my $raw = <$fh>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $raw = readline $fh)) 2 2 4
1045 2 ▶ next, if $raw =~ m/^# One test name on a line/;
Branch: 1 branch
BranchTrueFalseTotal
if $raw =~ /^# One test name on a line/ 0 2 2
1046 2 chomp($raw);
1047 2 push @skipped, " $raw";
1048 }
1049 2 close $fh;
1050 }
1051 62 ▶ wantarray and return @skipped;
Branch: 1 branch
BranchTrueFalseTotal
wantarray and return @skipped 0 62 62
1052  
1053 62 ▶ my $skipped = join "\n", @skipped or return "";
Branch: 1 branch
BranchTrueFalseTotal
my $skipped = join("\n", @skipped) or return "" 2 60 62
1054  
1055 2 return "\nTests skipped on user request:\n$skipped";
1056 }
1057  
1058 =head2 $reporter->ccmessages( )
1059  
1060 Use a port of Jarkko's F<grepccerr> script to report the compiler messages.
1061  
1062 =cut
1063  
1064 62 ▶sub ccmessages {
Subroutine ccmessages: called CC=9 SCAR=23.3
Pod documented
1065 62 my $self = shift;
1066  
1067 62 ▶ my $ccinfo = $self->{_rpt}{cinfo} || $self->{_ccinfo} || "cc";
Condition60%3/5
$self->{'_rpt'}{'cinfo'} || $self->{'_ccinfo'} || 'cc'
l!l
620
$self->{"_rpt"}{"cinfo"} or $self->{"_ccinfo"}
l!l&&r!l&&!r
12500
MC/DC0%0/2
$self->{'_rpt'}{'cinfo'} || $self->{'_ccinfo'} || 'cc'
$self->{"_rpt"}{"cinfo"} $self->{"_ccinfo"}
Truth table66%2/3
A or B
A= $self->{"_rpt"}{"cinfo"}B= $self->{"_ccinfo"}
ABresult
1X1
011
000
1068 62 $ccinfo =~ s/^(.+)\s+version\s+.+/$1/;
1069  
1070 62 ▶ $^O =~ /^(?:linux|.*bsd.*|darwin)/ and $ccinfo = 'gcc';
Branch: 1 branch
BranchTrueFalseTotal
$^O =~ /^(?:linux|.*bsd.*|darwin)/ and $ccinfo = "gcc" 62 0 62
1071 62 ▶ my $cc = $ccinfo =~ /(gcc|bcc32)/ ? $1 : $^O;
Branch: 1 branch
BranchTrueFalseTotal
$ccinfo =~ /(gcc|bcc32)/ ? : 62 0 62
1072  
1073 62 ▶ if (!$self->{_ccmessages_}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"_ccmessages_"}) 61 1 62
1074  
1075 61 $self->log_info("Looking for cc messages: '%s'", $cc);
1076 $self->{_ccmessages_} = grepccmsg(
1077 $cc,
1078 $self->get_outfile(),
1079 $self->{v}
1080 61 ▶ ) || [];
Condition50%1/2
grepccmsg($cc, $self->get_outfile, $self->{'v'}) || []
l!l
610
MC/DC0%0/1
grepccmsg($cc, $self->get_outfile, $self->{'v'}) || []
grepccmsg($cc, $self->get_outfile, $self->{'v'})
Truth table50%1/2
A
A= grepccmsg($cc, $self->get_outfile, $self->{'v'})
Aresult
11
00
1081 }
1082 62 $self->log_debug("Finished grepping for %s", $cc);
1083  
1084 0 ▶ return @{$self->{_ccmessages_}} if wantarray;
Branch: 1 branch
BranchTrueFalseTotal
if wantarray 0 62 62
1085 62 ▶ return "" if !$self->{_ccmessages_};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"_ccmessages_"} 0 62 62
1086  
1087 62 local $" = "\n";
1088 62 return <<" EOERRORS";
1089  
1090 Compiler messages($cc):
1091 62 @{$self->{_ccmessages_}}
1092 EOERRORS
1093 }
1094  
1095 =head2 $reporter->nonfatalmessages( )
1096  
1097 Find failures worth reporting that won't cause tests to fail
1098  
1099 =cut
1100  
1101 61 ▶sub nonfatalmessages {
Subroutine nonfatalmessages: called CC=9 SCAR=23.4
Pod documented
1102 61 my $self = shift;
1103  
1104 61 ▶ my $ccinfo = $self->{_rpt}{cinfo} || $self->{_ccinfo} || "cc";
Condition60%3/5
$self->{'_rpt'}{'cinfo'} || $self->{'_ccinfo'} || 'cc'
l!l
610
$self->{"_rpt"}{"cinfo"} or $self->{"_ccinfo"}
l!l&&r!l&&!r
11500
MC/DC0%0/2
$self->{'_rpt'}{'cinfo'} || $self->{'_ccinfo'} || 'cc'
$self->{"_rpt"}{"cinfo"} $self->{"_ccinfo"}
Truth table66%2/3
A or B
A= $self->{"_rpt"}{"cinfo"}B= $self->{"_ccinfo"}
ABresult
1X1
011
000
1105 61 $ccinfo =~ s/^(.+)\s+version\s+.+/$1/;
1106  
1107 61 ▶ $^O =~ /^(?:linux|.*bsd.*|darwin)/ and $ccinfo = 'gcc';
Branch: 1 branch
BranchTrueFalseTotal
$^O =~ /^(?:linux|.*bsd.*|darwin)/ and $ccinfo = "gcc" 61 0 61
1108 61 ▶ my $cc = $ccinfo =~ /(gcc|bcc32)/ ? $1 : $^O;
Branch: 1 branch
BranchTrueFalseTotal
$ccinfo =~ /(gcc|bcc32)/ ? : 61 0 61
1109  
1110 61 ▶ if (!$self->{_nonfatal_}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"_nonfatal_"}) 60 1 61
1111  
1112 60 $self->log_info("Looking for non-fatal messages: '%s'", $cc);
1113 $self->{_nonfatal_} = grepnonfatal(
1114 $cc,
1115 $self->get_outfile(),
1116 $self->{v}
1117 60 ▶ ) || [];
Condition50%1/2
grepnonfatal($cc, $self->get_outfile, $self->{'v'}) || []
l!l
600
MC/DC0%0/1
grepnonfatal($cc, $self->get_outfile, $self->{'v'}) || []
grepnonfatal($cc, $self->get_outfile, $self->{'v'})
Truth table50%1/2
A
A= grepnonfatal($cc, $self->get_outfile, $self->{'v'})
Aresult
11
00
1118 }
1119  
1120 0 ▶ return @{$self->{_nonfatal_}} if wantarray;
Branch: 1 branch
BranchTrueFalseTotal
if wantarray 0 61 61
1121 61 ▶ return "" if !$self->{_nonfatal_};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"_nonfatal_"} 0 61 61
1122  
1123 61 local $" = "\n";
1124 61 return <<" EOERRORS";
1125  
1126 Non-Fatal messages($cc):
1127 61 @{$self->{_nonfatal_}}
1128 EOERRORS
1129 }
1130  
1131 =head2 $reporter->preamble( )
1132  
1133 Returns the header of the report.
1134  
1135 =cut
1136  
1137 63 ▶sub preamble {
Subroutine preamble: called CC=5 SCAR=16.2
Pod documented
1138 63 my $self = shift;
1139  
1140 63 my %Config = get_smoked_Config( $self->{ddir} => qw(
1141 version libc gnulibc_version
1142 ));
1143 63 my $si = System::Info->new;
1144 63 my $archname = lc $si->cpu_type;
1145  
1146 63 ▶ (my $ncpu = $si->ncpu || "") =~ s/^(\d+)\s*/$1 cpu/;
Condition50%1/2
$si->ncpu || ''
l!l
630
MC/DC0%0/1
$si->ncpu || ''
$si->ncpu
Truth table50%1/2
A
A= $si->ncpu
Aresult
11
00
1147 63 $archname .= "/$ncpu";
1148  
1149 63 my $cpu = $si->cpu;
1150  
1151 63 ▶ my $this_host = $self->{hostname} || $si->host;
Condition66%2/3
$self->{'hostname'} || $si->host
l!l&&r!l&&!r
1620
MC/DC0%0/2
$self->{'hostname'} || $si->host
$self->{'hostname'} $si->host
Truth table66%2/3
A || B
A= $self->{'hostname'}B= $si->host
ABresult
1X1
011
000
1152 63 my $time_msg = time_in_hhmm( $self->{_rpt}{secs} );
1153 63 my $savg_msg = time_in_hhmm( $self->{_rpt}{avg} );
1154  
1155 63 my $cinfo = $self->ccinfo;
1156  
1157 63 my $os = $si->os;
1158  
1159 63 my $branch = '';
1160 63 ▶ if ($self->{_rpt}{smokebranch}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"_rpt"}{"smokebranch"}) 0 63 63
1161 0 $branch = " branch $self->{_rpt}{smokebranch}";
1162 }
1163  
1164 63 my $preamble = <<__EOH__;
1165 Automated smoke report for$branch $Config{version} patch $self->{_rpt}{patchlevel}
1166 $this_host: $cpu ($archname)
1167 on $os
1168 using $cinfo
1169 smoketime $time_msg (average $savg_msg)
1170  
1171 __EOH__
1172  
1173 63 ▶ if ($self->{un_position} eq USERNOTE_ON_TOP) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"un_position"} eq "top") 1 62 63
1174 1 (my $user_note = $self->{user_note}) =~ s/(?<=\S)\s*\z/\n/;
1175 1 $preamble = "$user_note\n$preamble";
1176 }
1177  
1178 63 return $preamble;
1179 }
1180  
1181 =head2 $reporter->smoke_matrix( )
1182  
1183 C<smoke_matrix()> returns a string with the result-letters and their
1184 configs.
1185  
1186 =cut
1187  
1188 118 ▶sub smoke_matrix {
Subroutine smoke_matrix: called CC=5 SCAR=16.1
Pod documented
1189 118 my $self = shift;
1190 118 my $rpt = $self->{_rpt};
1191  
1192 # Maximum of 6 letters => 11 positions
1193 118 my $rptl = length $rpt->{patchdescr};
1194 118 ▶ my $pad = $rptl >= 11 ? "" : " " x int( (11 - $rptl)/2 );
Branch: 1 branch
BranchTrueFalseTotal
$rptl >= 11 ? : 76 42 118
1195 118 my $patch = $pad . $rpt->{patchdescr};
1196 my $report = sprintf "%-11s Configuration (common) %s\n",
1197 118 $patch, $rpt->{common_args};
1198 118 $report .= ("-" x 11) . " " . ("-" x 57) . "\n";
1199  
1200 118 foreach my $config ( @{ $rpt->{cfglist} } ) {
1201 250 my $letters = "";
1202 250 foreach my $dbinfo (qw( N D )) {
1203 500 foreach my $tstenv ( @{ $self->{_tstenv} } ) {
1204 832 $letters .= "$rpt->{$config}{summary}{$dbinfo}{$tstenv} ";
1205 }
1206 }
1207 250 my $cfg = join " ", grep ! exists $rpt->{_common_args}{ $_ }
1208 => quotewords( '\s+', 1, $config );
1209 250 $report .= sprintf "%-12s%s\n", $letters, $cfg;
1210 }
1211  
1212 118 return $report;
1213 }
1214  
1215 =head2 $reporter->summary( )
1216  
1217 Return the B<PASS> or B<FAIL(x)> string.
1218  
1219 =cut
1220  
1221 109 ▶sub summary {
Subroutine summary: called CC=3 SCAR=11.0
Pod documented
1222 109 my $self = shift;
1223 109 my $count = $self->{_counters};
1224 109 my @rpt_sum_stat = grep $count->{$_} > 0 => qw( X F M m c t );
1225 109 my $rpt_summary = "";
1226 109 ▶ if (@rpt_sum_stat) {
Branch: 1 branch
BranchTrueFalseTotal
if (@rpt_sum_stat) { } 77 32 109
1227 77 $rpt_summary = "FAIL(" . join("", @rpt_sum_stat) . ")";
1228 }
1229 else {
1230 32 ▶ $rpt_summary = $count->{o} == 0 ? "PASS" : "PASS-so-far";
Branch: 1 branch
BranchTrueFalseTotal
$count->{'o'} == 0 ? : 32 0 32
1231 }
1232  
1233 109 return $rpt_summary;
1234 }
1235  
1236 =head2 $reporter->has_test_failures( )
1237  
1238 Returns true if C<< @{ $reporter->{_failures} >>.
1239  
1240 =cut
1241  
1242 61 ▶sub has_test_failures { exists $_[0]->{_failures} && @{ $_[0]->{_failures} } }
Subroutine has_test_failures: called CC=2 SCAR=7.2
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
exists $_[0]{"_failures"} and @{$_[0]{"_failures"};} 61 0 61
1243  
1244 =head2 $reporter->failures( )
1245  
1246 report the failures (grouped by configurations).
1247  
1248 =cut
1249  
1250 84 ▶sub failures {
Subroutine failures: called CC=1 SCAR=0.0
Pod documented
1251 84 my $self = shift;
1252  
1253 return join "\n", map {
1254 123 join "\n", @{ $_->{cfgs} }, $_->{tests}, ""
1255 84 } @{ $self->{_failures} };
1256 }
1257  
1258 =head2 $reporter->has_todo_passed( )
1259  
1260 Returns true if C<< @{ $reporter->{_todo_pasesd} >>.
1261  
1262 =cut
1263  
1264 61 ▶sub has_todo_passed { exists $_[0]->{_todo_passed} && @{ $_[0]->{_todo_passed} } }
Subroutine has_todo_passed: called CC=2 SCAR=7.2
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
exists $_[0]{"_todo_passed"} and @{$_[0]{"_todo_passed"};} 61 0 61
1265  
1266 =head2 $reporter->todo_passed( )
1267  
1268 report the todo that passed (grouped by configurations).
1269  
1270 =cut
1271  
1272 54 ▶sub todo_passed {
Subroutine todo_passed: called CC=1 SCAR=0.0
Pod documented
1273 54 my $self = shift;
1274  
1275 return join "\n", map {
1276 66 join "\n", @{ $_->{cfgs} }, $_->{tests}, ""
1277 54 } @{ $self->{_todo_passed} };
1278 }
1279  
1280 =head2 $reporter->has_mani_failures( )
1281  
1282 Returns true if C<< @{ $reporter->{_mani} >>.
1283  
1284 =cut
1285  
1286 61 ▶sub has_mani_failures { exists $_[0]->{_mani} && @{ $_[0]->{_mani} } }
Subroutine has_mani_failures: called CC=2 SCAR=7.2
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
exists $_[0]{"_mani"} and @{$_[0]{"_mani"};} 61 0 61
1287  
1288 =head2 $reporter->mani_fail( )
1289  
1290 report the MANIFEST failures.
1291  
1292 =cut
1293  
1294 6 ▶sub mani_fail {
Subroutine mani_fail: called CC=1 SCAR=0.0
Pod documented
1295 6 my $self = shift;
1296  
1297 6 return join "\n", @{ $self->{_mani} }, "";
1298 }
1299  
1300 =head2 $reporter->bldenv_legend( )
1301  
1302 Returns a string with the legend for build-environments
1303  
1304 =cut
1305  
1306 63 ▶sub bldenv_legend {
Subroutine bldenv_legend: called CC=15 SCAR=28.0
Pod documented
1307 63 my $self = shift;
1308 0 $self->{defaultenv} = ( @{ $self->{_tstenv} } == 1 )
1309 63 ▶ unless defined $self->{defaultenv};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"defaultenv"} 0 63 63
1310 63 ▶ my $debugging = $self->{_rpt}{dbughow} || '-DDEBUGGING';
Condition100%2/2
$self->{'_rpt'}{'dbughow'} || '-DDEBUGGING'
l!l
2439
MC/DC100%1/1
$self->{'_rpt'}{'dbughow'} || '-DDEBUGGING'
$self->{'_rpt'}{'dbughow'}
Truth table100%2/2
A
A= $self->{'_rpt'}{'dbughow'}
Aresult
11
00
1311  
1312 63 ▶ if ( $self->{_locale} && @{ $self->{_locale} } ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"_locale"} and @{$self->{"_locale"};}) 10 53 63
Condition66%2/3
$self->{"_locale"} and @{$self->{"_locale"};}
!ll&&!rl&&r
05310
MC/DC50%1/2
$self->{"_locale"} and @{$self->{"_locale"};}
$self->{"_locale"} @{$self->{"_locale"};}
Truth table66%2/3
A and B
A= $self->{"_locale"}B= @{$self->{"_locale"};}
ABresult
0X0
100
111
1313 10 my @locale = ( @{ $self->{_locale} }, @{ $self->{_locale} } );
1314 10 my $lcnt = @locale;
1315 10 my $half = int(( 4 + $lcnt ) / 2 );
1316 10 my $cnt = 2 * $half;
1317  
1318 10 my $line = '';
1319 10 for my $i ( 0 .. $cnt-1 ) {
1320 62 $line .= '| ' x ( $cnt - 1 - $i );
1321 62 $line .= '+';
1322 62 $line .= '-' x (2 * $i);
1323 62 $line .= '- ';
1324  
1325 62 ▶ if ( ($i % $half) < ($lcnt / 2) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i % $half < $lcnt / 2) { } 22 40 62
1326 22 my $locale = shift @locale; # XXX: perhaps pop()
1327 22 $line .= "LC_ALL = $locale"
1328 } else {
1329 40 ▶ if ( $self->{perlio_only} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'perlio_only'}) { } 0 40 40
1330 0 $line .= "PERLIO = perlio"
1331 }
1332 else {
1333 40 ▶ $line .= ( (($i - @{$self->{_locale}}) % $half) % 2 == 0 )
Branch: 1 branch
BranchTrueFalseTotal
($i - @{$self->{'_locale'};}) % $half % 2 == 0 ? : 20 20 40
1334 ? "PERLIO = perlio"
1335 : "PERLIO = stdio ";
1336 }
1337 }
1338 62 ▶ $i < $half and $line .= " $debugging";
Branch: 1 branch
BranchTrueFalseTotal
$i < $half and $line .= " $debugging" 31 31 62
1339 62 $line .= "\n";
1340 }
1341 10 return $line;
1342 }
1343  
1344 53 my $locale = ''; # XXX
1345 53 my %l;
1346 53 @l{qw( EOS EOaL EOpL EOaE EOpE )} = (<<"EOS", <<"EOaL", <<"EOpL", <<"EOaE", <<"EOpE");
1347 | +--------- $debugging
1348 +----------- no debugging
1349  
1350 EOS
1351 | | | | | +- LC_ALL = $locale $debugging
1352 | | | | +--- PERLIO = perlio $debugging
1353 | | | +----- PERLIO = stdio $debugging
1354 | | +------- LC_ALL = $locale
1355 | +--------- PERLIO = perlio
1356 +----------- PERLIO = stdio
1357  
1358 EOaL
1359 | | | +----- LC_ALL = $locale $debugging
1360 | | +------- PERLIO = perlio $debugging
1361 | +--------- LC_ALL = $locale
1362 +----------- PERLIO = perlio
1363  
1364 EOpL
1365 | | | +----- PERLIO = perlio $debugging
1366 | | +------- PERLIO = stdio $debugging
1367 | +--------- PERLIO = perlio
1368 +----------- PERLIO = stdio
1369  
1370 EOaE
1371 | +--------- PERLIO = perlio $debugging
1372 +----------- PERLIO = perlio
1373  
1374 EOpE
1375 return $self->{perlio_only}
1376 ? $locale ? $l{EOaL} : $self->{defaultenv} ? $l{EOS} : $l{EOaE}
1377 53 ▶ : $locale ? $l{EOpL} : $self->{defaultenv} ? $l{EOS} : $l{EOpE};
Branch: 5 branches
BranchTrueFalseTotal
$self->{'perlio_only'} ? : 0 53 53
$locale ? : 0 0 0
$self->{'defaultenv'} ? : 0 0 0
$locale ? : 0 53 53
$self->{'defaultenv'} ? : 11 42 53
1378 }
1379  
1380 =head2 $reporter->letter_legend( )
1381  
1382 Returns a string with the legend for the letters in the matrix.
1383  
1384 =cut
1385  
1386 61 ▶sub letter_legend {
Subroutine letter_legend: called CC=1 SCAR=0.0
Pod documented
1387 61 require Test::Smoke::Smoker;
1388 return <<__EOL__
1389 O = OK F = Failure(s), extended report at the bottom
1390 X = Failure(s) under TEST but not under harness
1391 ? = still running or test results not (yet) available
1392 Build failures during: - = unknown or N/A
1393 c = Configure, m = make, M = make (after miniperl), t = make test-prep
1394 __EOL__
1395 61 }
1396  
1397 =head2 $reporter->signature()
1398  
1399 Returns the signature for the e-mail message (starting with dash dash space
1400 newline) and some version numbers.
1401  
1402 =cut
1403  
1404 62 ▶sub signature {
Subroutine signature: called CC=3 SCAR=11.1
Pod documented
1405 62 my $self = shift;
1406 62 ▶ my $this_pver = $^V ? sprintf "%vd", $^V : $];
Branch: 1 branch
BranchTrueFalseTotal
$^V ? : 62 0 62
1407 62 my $build_info = "$Test::Smoke::VERSION";
1408  
1409 62 my $signature = <<" __EOS__";
1410 --
1411 Report by Test::Smoke v$build_info running on perl $this_pver
1412 (Reporter v$VERSION / Smoker v$Test::Smoke::Smoker::VERSION)
1413 __EOS__
1414  
1415 62 ▶ if ($self->{un_position} ne USERNOTE_ON_TOP) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"un_position"} ne "top") 62 0 62
1416 62 (my $user_note = $self->{user_note}) =~ s/(?<=\S)\s*\z/\n/;
1417 62 $signature = "\n$user_note\n$signature";
1418 }
1419  
1420 62 return $signature;
1421 }
1422  
1423 6 1;
1424  
1425 =head1 SEE ALSO
1426  
1427 L<Test::Smoke::Smoker>
1428  
1429 =head1 COPYRIGHT
1430  
1431 (c) 2002-2012, All rights reserved.
1432  
1433 * Abe Timmerman <abeltje@cpan.org>
1434 * H.Merijn Brand <hmbrand@cpan.org>
1435  
1436 This library is free software; you can redistribute it and/or modify
1437 it under the same terms as Perl itself.
1438  
1439 See:
1440  
1441 =over 4
1442  
1443 =item * http://www.perl.com/perl/misc/Artistic.html
1444  
1445 =item * http://www.gnu.org/copyleft/gpl.html
1446  
1447 =back
1448  
1449 This program is distributed in the hope that it will be useful,
1450 but WITHOUT ANY WARRANTY; without even the implied warranty of
1451 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1452  
1453 =cut
« blib/lib/Test/Smoke/App/ConfigSmoke/SmokeEnv.pm ↑ Summary lib/Test/Smoke/Util.pm »