line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test2::Harness::Parser::EventStream; |
2
|
25
|
|
|
25
|
|
214087
|
use strict; |
|
25
|
|
|
|
|
69
|
|
|
25
|
|
|
|
|
2333
|
|
3
|
25
|
|
|
25
|
|
139
|
use warnings; |
|
25
|
|
|
|
|
131
|
|
|
25
|
|
|
|
|
2291
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.000012'; |
6
|
|
|
|
|
|
|
|
7
|
25
|
|
|
25
|
|
161
|
use base 'Test2::Harness::Parser'; |
|
25
|
|
|
|
|
29
|
|
|
25
|
|
|
|
|
3791
|
|
8
|
25
|
|
|
25
|
|
160
|
use Test2::Util::HashBase; |
|
25
|
|
|
|
|
70
|
|
|
25
|
|
|
|
|
297
|
|
9
|
|
|
|
|
|
|
|
10
|
25
|
|
|
25
|
|
2518
|
use Test2::Event 1.302068; |
|
25
|
|
|
|
|
761
|
|
|
25
|
|
|
|
|
833
|
|
11
|
25
|
|
|
25
|
|
15089
|
use Test2::Event::Bail; |
|
25
|
|
|
|
|
11177
|
|
|
25
|
|
|
|
|
682
|
|
12
|
25
|
|
|
25
|
|
159
|
use Test2::Event::Diag; |
|
25
|
|
|
|
|
68
|
|
|
25
|
|
|
|
|
715
|
|
13
|
25
|
|
|
25
|
|
13959
|
use Test2::Event::Encoding; |
|
25
|
|
|
|
|
8062
|
|
|
25
|
|
|
|
|
679
|
|
14
|
25
|
|
|
25
|
|
12614
|
use Test2::Event::Exception; |
|
25
|
|
|
|
|
8050
|
|
|
25
|
|
|
|
|
772
|
|
15
|
25
|
|
|
25
|
|
12716
|
use Test2::Event::Note; |
|
25
|
|
|
|
|
7356
|
|
|
25
|
|
|
|
|
714
|
|
16
|
25
|
|
|
25
|
|
157
|
use Test2::Event::Ok; |
|
25
|
|
|
|
|
45
|
|
|
25
|
|
|
|
|
801
|
|
17
|
25
|
|
|
25
|
|
780
|
use Test2::Event::ParseError; |
|
25
|
|
|
|
|
48
|
|
|
25
|
|
|
|
|
651
|
|
18
|
25
|
|
|
25
|
|
13200
|
use Test2::Event::Plan; |
|
25
|
|
|
|
|
24091
|
|
|
25
|
|
|
|
|
751
|
|
19
|
25
|
|
|
25
|
|
20635
|
use Test2::Event::Skip; |
|
25
|
|
|
|
|
9180
|
|
|
25
|
|
|
|
|
798
|
|
20
|
25
|
|
|
25
|
|
165
|
use Test2::Event::Subtest; |
|
25
|
|
|
|
|
26
|
|
|
25
|
|
|
|
|
755
|
|
21
|
25
|
|
|
25
|
|
16287
|
use Test2::Event::UnknownStderr; |
|
25
|
|
|
|
|
69
|
|
|
25
|
|
|
|
|
760
|
|
22
|
25
|
|
|
25
|
|
12970
|
use Test2::Event::UnknownStdout; |
|
25
|
|
|
|
|
47
|
|
|
25
|
|
|
|
|
670
|
|
23
|
25
|
|
|
25
|
|
13559
|
use Test2::Event::Waiting; |
|
25
|
|
|
|
|
3615
|
|
|
25
|
|
|
|
|
755
|
|
24
|
25
|
|
|
25
|
|
15297
|
use Test2::Harness::JSON; |
|
25
|
|
|
|
|
92
|
|
|
25
|
|
|
|
|
11122
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
352
|
1
|
|
sub morph { } |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub step { |
29
|
13329
|
|
|
13329
|
1
|
12460
|
my $self = shift; |
30
|
|
|
|
|
|
|
|
31
|
13329
|
|
|
|
|
19110
|
return ($self->parse_stderr, $self->parse_stdout); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub parse_stderr { |
35
|
13339
|
|
|
13339
|
0
|
10606
|
my $self = shift; |
36
|
|
|
|
|
|
|
|
37
|
13339
|
100
|
|
|
|
23069
|
my $line = $self->proc->get_err_line or return; |
38
|
10
|
|
|
|
|
83
|
chomp $line; |
39
|
|
|
|
|
|
|
|
40
|
10
|
|
|
|
|
31
|
return Test2::Event::UnknownStderr->new(output => $line); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub parse_stdout { |
44
|
13335
|
|
|
13335
|
0
|
11516
|
my $self = shift; |
45
|
|
|
|
|
|
|
|
46
|
13335
|
100
|
|
|
|
22188
|
my $line = $self->proc->get_out_line or return; |
47
|
12500
|
|
|
|
|
136289
|
$line =~ s/\s+\z//s; |
48
|
|
|
|
|
|
|
|
49
|
12500
|
100
|
|
|
|
27198
|
if ($line =~ m/^T2_ENCODING: (.+)$/) { |
50
|
325
|
|
|
|
|
996
|
my $enc = $1; |
51
|
|
|
|
|
|
|
|
52
|
325
|
|
|
|
|
995
|
$self->proc->encoding($enc); |
53
|
|
|
|
|
|
|
|
54
|
325
|
|
|
|
|
4273
|
return Test2::Event::Encoding->new( |
55
|
|
|
|
|
|
|
encoding => $enc, |
56
|
|
|
|
|
|
|
); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
12175
|
100
|
|
|
|
19240
|
if ( my $event = $self->_event_from_stdout($line) ) { |
60
|
12173
|
|
|
|
|
1185362
|
return $event; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
2
|
|
|
|
|
14
|
return Test2::Event::UnknownStdout->new(output => $line); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub _event_from_stdout { |
67
|
12175
|
|
|
12175
|
|
9819
|
my $self = shift; |
68
|
12175
|
|
|
|
|
10199
|
my $out = shift; |
69
|
|
|
|
|
|
|
|
70
|
12175
|
100
|
|
|
|
71193
|
return unless $out =~ s/^T2_EVENT:\s//; |
71
|
|
|
|
|
|
|
|
72
|
12173
|
|
|
|
|
13843
|
local $@ = undef; |
73
|
12173
|
|
|
|
|
10952
|
my $data = eval { JSON->new->decode($out) }; |
|
12173
|
|
|
|
|
23250
|
|
74
|
12173
|
|
|
|
|
197633
|
my $err = $@; |
75
|
|
|
|
|
|
|
|
76
|
12173
|
50
|
|
|
|
20611
|
if ($data) { |
77
|
12173
|
|
|
|
|
46610
|
return Test2::Event->from_json(%$data); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
chomp($err); |
81
|
0
|
|
|
|
|
|
return Test2::Event::ParseError->new(parse_error => $err); |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
__END__ |