line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: Look into TAP-Archives |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Archive::TAP::Peek; |
4
|
|
|
|
|
|
|
{ |
5
|
|
|
|
|
|
|
$Archive::TAP::Peek::VERSION = '0.002'; |
6
|
|
|
|
|
|
|
} |
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
36916
|
use strict; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
92
|
|
9
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
83
|
|
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
2716
|
use Archive::Extract; |
|
2
|
|
|
|
|
634569
|
|
|
2
|
|
|
|
|
123
|
|
12
|
2
|
|
|
2
|
|
2770
|
use File::Temp qw( tempdir ); |
|
2
|
|
|
|
|
55634
|
|
|
2
|
|
|
|
|
146
|
|
13
|
2
|
|
|
2
|
|
2025
|
use TAP::Parser; |
|
2
|
|
|
|
|
124429
|
|
|
2
|
|
|
|
|
898
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub new { |
16
|
2
|
|
|
2
|
0
|
23
|
my $class = shift; |
17
|
|
|
|
|
|
|
|
18
|
2
|
|
|
|
|
9
|
my %args = @_; |
19
|
|
|
|
|
|
|
|
20
|
2
|
|
|
|
|
8
|
my $self = { error_found => 0 }; |
21
|
|
|
|
|
|
|
|
22
|
2
|
50
|
|
|
|
9
|
die "Parameter 'archive' needed" unless exists $args{archive}; |
23
|
|
|
|
|
|
|
|
24
|
2
|
50
|
|
|
|
77
|
die "$args{archive} not found" unless -f $args{archive}; |
25
|
|
|
|
|
|
|
|
26
|
2
|
|
|
|
|
29
|
my $ae = Archive::Extract->new( archive => $args{archive}, |
27
|
|
|
|
|
|
|
type => 'tgz' |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
|
30
|
2
|
50
|
|
|
|
1148
|
die "$args{archive} is not of type 'tgz'" unless $ae->is_tgz; |
31
|
|
|
|
|
|
|
|
32
|
2
|
|
|
|
|
54
|
my $tmpdir = tempdir( CLEANUP => 1 ); |
33
|
|
|
|
|
|
|
|
34
|
2
|
50
|
|
|
|
2171
|
$ae->extract( to => $tmpdir ) or die $ae->error; |
35
|
|
|
|
|
|
|
|
36
|
2
|
|
|
|
|
512690
|
my $files = $ae->files; |
37
|
|
|
|
|
|
|
|
38
|
2
|
|
|
|
|
44
|
my $outdir = $ae->extract_path; |
39
|
|
|
|
|
|
|
|
40
|
2
|
|
|
|
|
23
|
foreach my $f (@{$files}) { |
|
2
|
|
|
|
|
15
|
|
41
|
|
|
|
|
|
|
|
42
|
10
|
100
|
|
|
|
1930
|
next unless ( $f =~ /.*\.t$/); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# code from here: |
45
|
|
|
|
|
|
|
# http://stackoverflow.com/questions/13781443/capture-and-split-tap-output-result |
46
|
8
|
|
|
|
|
27
|
my $tap_file = $outdir . '/' . $f; |
47
|
8
|
50
|
|
|
|
502
|
open my $tap_fh, $tap_file or die $!; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# Can't just pass in the .t file, it will try to execute it. |
50
|
8
|
|
|
|
|
151
|
my $parser = TAP::Parser->new({ |
51
|
|
|
|
|
|
|
source => $tap_fh |
52
|
|
|
|
|
|
|
}); |
53
|
|
|
|
|
|
|
|
54
|
8
|
|
|
|
|
7112
|
while ( my $result = $parser->next ) { |
55
|
|
|
|
|
|
|
# do whatever you like with the $result, like print it back out |
56
|
63
|
|
|
|
|
17680
|
my $line = $result->as_string; |
57
|
|
|
|
|
|
|
|
58
|
63
|
100
|
|
|
|
1477
|
if ($line =~ /^ok/) { |
|
|
100
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# everything is fine... keep going on |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
elsif ($line =~ /^not ok/) { |
62
|
|
|
|
|
|
|
# oops! error. |
63
|
1
|
|
|
|
|
7
|
$self->{error_found} = 1; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# we break here... since we already know there are failures |
66
|
1
|
|
|
|
|
5
|
last; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
else { |
69
|
|
|
|
|
|
|
# some other lines we don't need |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
2
|
|
|
|
|
23
|
bless ($self, $class); |
76
|
|
|
|
|
|
|
|
77
|
2
|
|
|
|
|
95
|
return $self; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub all_ok { |
81
|
2
|
|
|
2
|
1
|
954
|
my $self = shift; |
82
|
|
|
|
|
|
|
|
83
|
2
|
100
|
|
|
|
12
|
if( $self->{error_found} ) { |
84
|
1
|
|
|
|
|
12
|
return; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
else { |
87
|
1
|
|
|
|
|
25
|
return 1; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
1; |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
__END__ |