line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Fennec::Collector; |
2
|
139
|
|
|
139
|
|
772
|
use strict; |
|
139
|
|
|
|
|
202
|
|
|
139
|
|
|
|
|
2786
|
|
3
|
139
|
|
|
139
|
|
455
|
use warnings; |
|
139
|
|
|
|
|
167
|
|
|
139
|
|
|
|
|
2676
|
|
4
|
|
|
|
|
|
|
|
5
|
139
|
|
|
139
|
|
453
|
use Carp qw/confess/; |
|
139
|
|
|
|
|
149
|
|
|
139
|
|
|
|
|
4753
|
|
6
|
139
|
|
|
139
|
|
626
|
use Fennec::Util qw/accessors require_module/; |
|
139
|
|
|
|
|
176
|
|
|
139
|
|
|
|
|
492
|
|
7
|
139
|
|
|
139
|
|
115628
|
use File::Temp qw/tempfile/; |
|
139
|
|
|
|
|
2246670
|
|
|
139
|
|
|
|
|
87188
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
accessors qw/test_count test_failed debug_data/; |
10
|
|
|
|
|
|
|
|
11
|
0
|
|
|
0
|
1
|
0
|
sub ok { confess "Must override ok" } |
12
|
0
|
|
|
0
|
1
|
0
|
sub diag { confess "Must override diag" } |
13
|
0
|
|
|
0
|
1
|
0
|
sub end_pid { confess "Must override end_pid" } |
14
|
0
|
|
|
0
|
1
|
0
|
sub collect { confess "Must override collect" } |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
0
|
1
|
|
sub init { } |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub new { |
19
|
139
|
|
|
139
|
1
|
361
|
my $class = shift; |
20
|
139
|
|
|
|
|
300
|
my %params = @_; |
21
|
139
|
|
|
|
|
341
|
my $self = bless \%params, $class; |
22
|
|
|
|
|
|
|
|
23
|
139
|
|
|
|
|
867
|
$self->debug_data([]); |
24
|
139
|
|
|
|
|
712
|
$self->init; |
25
|
|
|
|
|
|
|
|
26
|
139
|
|
|
|
|
12857
|
return $self; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub inc_test_count { |
30
|
3669
|
|
|
3669
|
1
|
6148
|
my $self = shift; |
31
|
3669
|
|
100
|
|
|
11357
|
my $count = $self->test_count || 0; |
32
|
3669
|
|
|
|
|
10399
|
$self->test_count( $count + 1 ); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub inc_test_failed { |
36
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
37
|
0
|
|
0
|
|
|
0
|
my $count = $self->test_failed || 0; |
38
|
0
|
|
|
|
|
0
|
$self->test_failed( $count + 1 ); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub debug { |
42
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
43
|
0
|
|
|
|
|
0
|
my ($msg) = @_; |
44
|
0
|
|
|
|
|
0
|
my ($action, $data) = $msg =~ m/^ ?# ?FENNEC_DEBUG_(MOCK|BLOCK|CUSTOM):(.*)$/; |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
0
|
my $set = { ACTION => $action }; |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
0
|
for my $field (split "\0", $data) { |
49
|
0
|
|
|
|
|
0
|
my ($key, $val) = $field =~ m/([^:]+):(.*)/; |
50
|
0
|
|
|
|
|
0
|
$set->{lc($key)} = $val; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
0
|
push @{$self->debug_data} => $set; |
|
0
|
|
|
|
|
0
|
|
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub finish { |
57
|
22
|
|
|
22
|
1
|
82
|
my $self = shift; |
58
|
22
|
50
|
|
|
|
70
|
return unless @{$self->debug_data}; |
|
22
|
|
|
|
|
282
|
|
59
|
0
|
|
0
|
|
|
|
my @data = sort { return $a->{sec} <=> $b->{sec} || $a->{msec} <=> $b->{msec} } |
60
|
0
|
|
|
|
|
|
@{ $self->debug_data }; |
|
0
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
my $index = 0; |
63
|
0
|
|
|
|
|
|
my $map = { $$ => $index++ }; |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
my @out; |
66
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
for my $item (@data) { |
68
|
0
|
0
|
|
|
|
|
$map->{$item->{pid}} = $index++ unless defined $map->{$item->{pid}}; |
69
|
0
|
|
|
|
|
|
my $idx = $map->{$item->{pid}}; |
70
|
0
|
0
|
|
|
|
|
if ($item->{ACTION} eq 'MOCK') { |
|
|
0
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
push @out => [ $idx, "MOCK $item->{class} => ($item->{overrides})" ]; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
elsif ($item->{ACTION} eq 'BLOCK') { |
74
|
0
|
|
|
|
|
|
push @out => [ $idx, "BLOCK $item->{start_line}\->$item->{end_line} $item->{type}: $item->{name} ($item->{state})" ]; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
else { |
77
|
0
|
|
|
|
|
|
push @out => [ $idx, "CUSTOM: $item->{message}" ]; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
my @pids = sort { $map->{$a} <=> $map->{$b} } keys %$map; |
|
0
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
my ($fh, $filename) = tempfile( CLEANUP => 0 ); |
83
|
|
|
|
|
|
|
|
84
|
0
|
|
|
|
|
|
print $fh join "," => @pids; |
85
|
0
|
|
|
|
|
|
print $fh "\n"; |
86
|
0
|
|
|
|
|
|
for my $row (@out) { |
87
|
0
|
|
|
|
|
|
print $fh " ," x $row->[0]; |
88
|
0
|
|
|
|
|
|
print $fh $row->[1]; |
89
|
0
|
|
|
|
|
|
print $fh ", " x ($index - $row->[0]); |
90
|
0
|
|
|
|
|
|
print $fh "\n"; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
0
|
|
|
|
|
|
close($fh); |
94
|
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
|
print "# See $filename for process debugging\n"; |
96
|
0
|
|
|
|
|
|
print "# Try column -s, -t < '$filename' | less -#2 -S\n"; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
1; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
__END__ |