| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package SmokeRunner::Multi::Runner::TAPArchive; |
|
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:YANICK'; |
|
3
|
|
|
|
|
|
|
#ABSTRACT: Runner subclass which creates a TAP archive file |
|
4
|
|
|
|
|
|
|
$SmokeRunner::Multi::Runner::TAPArchive::VERSION = '0.20'; |
|
5
|
3
|
|
|
3
|
|
1493
|
use strict; |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
81
|
|
|
6
|
3
|
|
|
3
|
|
17
|
use warnings; |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
97
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
3
|
|
|
3
|
|
15
|
use base 'SmokeRunner::Multi::Runner'; |
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
1685
|
|
|
9
|
|
|
|
|
|
|
__PACKAGE__->mk_ro_accessors( 'tap_archive_file' ); |
|
10
|
|
|
|
|
|
|
|
|
11
|
3
|
|
|
3
|
|
3374
|
use Archive::Tar; |
|
|
3
|
|
|
|
|
310576
|
|
|
|
3
|
|
|
|
|
221
|
|
|
12
|
3
|
|
|
3
|
|
30
|
use File::Basename qw( basename ); |
|
|
3
|
|
|
|
|
9
|
|
|
|
3
|
|
|
|
|
182
|
|
|
13
|
3
|
|
|
3
|
|
2375
|
use File::chdir; |
|
|
3
|
|
|
|
|
9976
|
|
|
|
3
|
|
|
|
|
307
|
|
|
14
|
3
|
|
|
3
|
|
19
|
use File::Spec; |
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
84
|
|
|
15
|
3
|
|
|
3
|
|
1186
|
use File::Temp qw( tempfile tempdir ); |
|
|
3
|
|
|
|
|
10295
|
|
|
|
3
|
|
|
|
|
237
|
|
|
16
|
3
|
|
|
3
|
|
568
|
use SmokeRunner::Multi::SafeRun qw( safe_run ); |
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
173
|
|
|
17
|
3
|
|
|
3
|
|
18
|
use SmokeRunner::Multi::Validate qw( validate ARRAYREF_TYPE ); |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
27
|
|
|
18
|
3
|
|
|
3
|
|
831
|
use YAML::Syck qw( Dump ); |
|
|
3
|
|
|
|
|
1994
|
|
|
|
3
|
|
|
|
|
1938
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new |
|
22
|
|
|
|
|
|
|
{ |
|
23
|
2
|
|
|
2
|
1
|
1360
|
my $class = shift; |
|
24
|
|
|
|
|
|
|
|
|
25
|
2
|
|
|
|
|
27
|
return $class->SUPER::new(@_); |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub run_tests |
|
29
|
|
|
|
|
|
|
{ |
|
30
|
2
|
|
|
2
|
1
|
27
|
my $self = shift; |
|
31
|
|
|
|
|
|
|
|
|
32
|
2
|
|
|
|
|
22
|
my $temp_dir = tempdir( CLEANUP => 1 ); |
|
33
|
2
|
|
|
|
|
1280
|
my $archive = Archive::Tar->new(); |
|
34
|
|
|
|
|
|
|
|
|
35
|
2
|
|
|
|
|
46
|
my @files = $self->set()->test_files(); |
|
36
|
2
|
|
|
|
|
3187
|
my %meta_info = |
|
37
|
|
|
|
|
|
|
( file_order => \@files, |
|
38
|
|
|
|
|
|
|
start_time => time, |
|
39
|
|
|
|
|
|
|
); |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
{ |
|
42
|
2
|
|
|
|
|
6
|
local $CWD = $self->set()->set_dir(); |
|
|
2
|
|
|
|
|
14
|
|
|
43
|
2
|
|
|
|
|
146
|
foreach my $file (@files) { |
|
44
|
4
|
|
|
|
|
11
|
my $output; |
|
45
|
4
|
|
|
|
|
53
|
safe_run |
|
46
|
|
|
|
|
|
|
( command => $self->_perl_bin(), |
|
47
|
|
|
|
|
|
|
args => [ $self->_libs(), $file ], |
|
48
|
|
|
|
|
|
|
stdout_buffer => \$output, |
|
49
|
|
|
|
|
|
|
stderr_buffer => \$output, |
|
50
|
|
|
|
|
|
|
); |
|
51
|
|
|
|
|
|
|
|
|
52
|
4
|
|
|
|
|
142456
|
my $basename = basename( $file, '.t' ); |
|
53
|
4
|
|
|
|
|
200
|
my $destination |
|
54
|
|
|
|
|
|
|
= File::Spec->catfile( $temp_dir, "$basename.tap" ); |
|
55
|
|
|
|
|
|
|
|
|
56
|
4
|
50
|
|
|
|
900
|
open my $fh, '>', $destination |
|
57
|
|
|
|
|
|
|
or die "Cannot write to $destination: $!"; |
|
58
|
4
|
50
|
|
|
|
95
|
print $fh $output |
|
59
|
|
|
|
|
|
|
or die "Cannot write to $destination: $!"; |
|
60
|
4
|
50
|
|
|
|
398
|
close $fh |
|
61
|
|
|
|
|
|
|
or die "Cannot write to $destination: $!"; |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
2
|
|
|
|
|
147
|
$meta_info{stop_time} = time; |
|
66
|
2
|
50
|
|
|
|
211
|
open my $meta_fh, '>', File::Spec->catfile( $temp_dir, 'meta.yml' ) |
|
67
|
|
|
|
|
|
|
or die "Could not open meta.yml for writing: $!"; |
|
68
|
2
|
|
|
|
|
38
|
print $meta_fh Dump( \%meta_info ); |
|
69
|
2
|
|
|
|
|
289
|
close $meta_fh; |
|
70
|
|
|
|
|
|
|
|
|
71
|
2
|
|
|
|
|
416
|
$archive->add_files( glob( File::Spec->catfile( $temp_dir, '*' ) ) ); |
|
72
|
|
|
|
|
|
|
|
|
73
|
2
|
|
|
|
|
3845
|
my $tar_file = File::Spec->catfile( $temp_dir, "tap-archive-$$.tar.gz" ); |
|
74
|
2
|
|
|
|
|
28
|
$archive->write( $tar_file, 1 ); |
|
75
|
|
|
|
|
|
|
|
|
76
|
2
|
|
|
|
|
13576
|
$self->{tap_archive_file} = $tar_file; |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
# adapted from Test::Harness::Straps |
|
80
|
|
|
|
|
|
|
sub _perl_bin |
|
81
|
|
|
|
|
|
|
{ |
|
82
|
|
|
|
|
|
|
return $ENV{HARNESS_PERL} |
|
83
|
4
|
50
|
|
4
|
|
30
|
if defined $ENV{HARNESS_PERL}; |
|
84
|
|
|
|
|
|
|
|
|
85
|
4
|
50
|
33
|
|
|
67
|
return qq["$^X"] |
|
86
|
|
|
|
|
|
|
if $^O =~ /^(MS)?Win32$/ && $^X =~ /[^\w\.\/\\]/; |
|
87
|
|
|
|
|
|
|
|
|
88
|
4
|
|
|
|
|
39
|
return $^X; |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub _libs |
|
92
|
|
|
|
|
|
|
{ |
|
93
|
4
|
|
|
4
|
|
43
|
return '-Mblib', '-Mlib=lib'; |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
1; |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
__END__ |