line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SmokeRunner::Multi::Runner::TAPArchive; |
2
|
|
|
|
|
|
|
BEGIN { |
3
|
3
|
|
|
3
|
|
2019
|
$SmokeRunner::Multi::Runner::TAPArchive::AUTHORITY = 'cpan:YANICK'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
{ |
6
|
|
|
|
|
|
|
$SmokeRunner::Multi::Runner::TAPArchive::VERSION = '0.19'; |
7
|
|
|
|
|
|
|
} |
8
|
|
|
|
|
|
|
#ABSTRACT: Runner subclass which creates a TAP archive file |
9
|
|
|
|
|
|
|
|
10
|
3
|
|
|
3
|
|
25
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
104
|
|
11
|
3
|
|
|
3
|
|
18
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
117
|
|
12
|
|
|
|
|
|
|
|
13
|
3
|
|
|
3
|
|
16
|
use base 'SmokeRunner::Multi::Runner'; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
1974
|
|
14
|
|
|
|
|
|
|
__PACKAGE__->mk_ro_accessors( 'tap_archive_file' ); |
15
|
|
|
|
|
|
|
|
16
|
3
|
|
|
3
|
|
4727
|
use Archive::Tar; |
|
3
|
|
|
|
|
384047
|
|
|
3
|
|
|
|
|
276
|
|
17
|
3
|
|
|
3
|
|
38
|
use File::Basename qw( basename ); |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
192
|
|
18
|
3
|
|
|
3
|
|
2923
|
use File::chdir; |
|
3
|
|
|
|
|
10928
|
|
|
3
|
|
|
|
|
372
|
|
19
|
3
|
|
|
3
|
|
26
|
use File::Spec; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
77
|
|
20
|
3
|
|
|
3
|
|
1459
|
use File::Temp qw( tempfile tempdir ); |
|
3
|
|
|
|
|
13518
|
|
|
3
|
|
|
|
|
242
|
|
21
|
3
|
|
|
3
|
|
635
|
use SmokeRunner::Multi::SafeRun qw( safe_run ); |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
173
|
|
22
|
3
|
|
|
3
|
|
22
|
use SmokeRunner::Multi::Validate qw( validate ARRAYREF_TYPE ); |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
30
|
|
23
|
3
|
|
|
3
|
|
994
|
use YAML::Syck qw( Dump ); |
|
3
|
|
|
|
|
2702
|
|
|
3
|
|
|
|
|
2096
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub new |
27
|
|
|
|
|
|
|
{ |
28
|
2
|
|
|
2
|
1
|
1694
|
my $class = shift; |
29
|
|
|
|
|
|
|
|
30
|
2
|
|
|
|
|
26
|
return $class->SUPER::new(@_); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub run_tests |
34
|
|
|
|
|
|
|
{ |
35
|
2
|
|
|
2
|
1
|
22
|
my $self = shift; |
36
|
|
|
|
|
|
|
|
37
|
2
|
|
|
|
|
25
|
my $temp_dir = tempdir( CLEANUP => 1 ); |
38
|
2
|
|
|
|
|
1251
|
my $archive = Archive::Tar->new(); |
39
|
|
|
|
|
|
|
|
40
|
2
|
|
|
|
|
48
|
my @files = $self->set()->test_files(); |
41
|
2
|
|
|
|
|
2607
|
my %meta_info = |
42
|
|
|
|
|
|
|
( file_order => \@files, |
43
|
|
|
|
|
|
|
start_time => time, |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
{ |
47
|
2
|
|
|
|
|
6
|
local $CWD = $self->set()->set_dir(); |
|
2
|
|
|
|
|
9
|
|
48
|
2
|
|
|
|
|
145
|
foreach my $file (@files) { |
49
|
4
|
|
|
|
|
8
|
my $output; |
50
|
4
|
|
|
|
|
81
|
safe_run |
51
|
|
|
|
|
|
|
( command => $self->_perl_bin(), |
52
|
|
|
|
|
|
|
args => [ $self->_libs(), $file ], |
53
|
|
|
|
|
|
|
stdout_buffer => \$output, |
54
|
|
|
|
|
|
|
stderr_buffer => \$output, |
55
|
|
|
|
|
|
|
); |
56
|
|
|
|
|
|
|
|
57
|
4
|
|
|
|
|
149671
|
my $basename = basename( $file, '.t' ); |
58
|
4
|
|
|
|
|
161
|
my $destination |
59
|
|
|
|
|
|
|
= File::Spec->catfile( $temp_dir, "$basename.tap" ); |
60
|
|
|
|
|
|
|
|
61
|
4
|
50
|
|
|
|
757
|
open my $fh, '>', $destination |
62
|
|
|
|
|
|
|
or die "Cannot write to $destination: $!"; |
63
|
4
|
50
|
|
|
|
86
|
print $fh $output |
64
|
|
|
|
|
|
|
or die "Cannot write to $destination: $!"; |
65
|
4
|
50
|
|
|
|
377
|
close $fh |
66
|
|
|
|
|
|
|
or die "Cannot write to $destination: $!"; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
2
|
|
|
|
|
141
|
$meta_info{stop_time} = time; |
71
|
2
|
50
|
|
|
|
208
|
open my $meta_fh, '>', File::Spec->catfile( $temp_dir, 'meta.yml' ) |
72
|
|
|
|
|
|
|
or die "Could not open meta.yml for writing: $!"; |
73
|
2
|
|
|
|
|
43
|
print $meta_fh Dump( \%meta_info ); |
74
|
2
|
|
|
|
|
243
|
close $meta_fh; |
75
|
|
|
|
|
|
|
|
76
|
2
|
|
|
|
|
429
|
$archive->add_files( glob( File::Spec->catfile( $temp_dir, '*' ) ) ); |
77
|
|
|
|
|
|
|
|
78
|
2
|
|
|
|
|
3684
|
my $tar_file = File::Spec->catfile( $temp_dir, "tap-archive-$$.tar.gz" ); |
79
|
2
|
|
|
|
|
26
|
$archive->write( $tar_file, 1 ); |
80
|
|
|
|
|
|
|
|
81
|
2
|
|
|
|
|
11286
|
$self->{tap_archive_file} = $tar_file; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
# adapted from Test::Harness::Straps |
85
|
|
|
|
|
|
|
sub _perl_bin |
86
|
|
|
|
|
|
|
{ |
87
|
4
|
50
|
|
4
|
|
25
|
return $ENV{HARNESS_PERL} |
88
|
|
|
|
|
|
|
if defined $ENV{HARNESS_PERL}; |
89
|
|
|
|
|
|
|
|
90
|
4
|
50
|
33
|
|
|
46
|
return qq["$^X"] |
91
|
|
|
|
|
|
|
if $^O =~ /^(MS)?Win32$/ && $^X =~ /[^\w\.\/\\]/; |
92
|
|
|
|
|
|
|
|
93
|
4
|
|
|
|
|
31
|
return $^X; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub _libs |
97
|
|
|
|
|
|
|
{ |
98
|
4
|
|
|
4
|
|
36
|
return '-Mblib', '-Mlib=lib'; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
1; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
__END__ |