|  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.21';  | 
| 
5
 | 
3
 | 
 
 | 
 
 | 
  
3
  
 | 
 
 | 
1404
 | 
 use strict;  | 
| 
 
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
6
 | 
    | 
| 
 
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
83
 | 
    | 
| 
6
 | 
3
 | 
 
 | 
 
 | 
  
3
  
 | 
 
 | 
16
 | 
 use warnings;  | 
| 
 
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
6
 | 
    | 
| 
 
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
102
 | 
    | 
| 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
8
 | 
3
 | 
 
 | 
 
 | 
  
3
  
 | 
 
 | 
14
 | 
 use base 'SmokeRunner::Multi::Runner';  | 
| 
 
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
7
 | 
    | 
| 
 
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1712
 | 
    | 
| 
9
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 __PACKAGE__->mk_ro_accessors( 'tap_archive_file' );  | 
| 
10
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
11
 | 
3
 | 
 
 | 
 
 | 
  
3
  
 | 
 
 | 
3479
 | 
 use Archive::Tar;  | 
| 
 
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
427519
 | 
    | 
| 
 
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
224
 | 
    | 
| 
12
 | 
3
 | 
 
 | 
 
 | 
  
3
  
 | 
 
 | 
34
 | 
 use File::Basename qw( basename );  | 
| 
 
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
6
 | 
    | 
| 
 
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
187
 | 
    | 
| 
13
 | 
3
 | 
 
 | 
 
 | 
  
3
  
 | 
 
 | 
2399
 | 
 use File::chdir;  | 
| 
 
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
9890
 | 
    | 
| 
 
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
326
 | 
    | 
| 
14
 | 
3
 | 
 
 | 
 
 | 
  
3
  
 | 
 
 | 
18
 | 
 use File::Spec;  | 
| 
 
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
7
 | 
    | 
| 
 
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
79
 | 
    | 
| 
15
 | 
3
 | 
 
 | 
 
 | 
  
3
  
 | 
 
 | 
1156
 | 
 use File::Temp qw( tempfile tempdir );  | 
| 
 
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
10444
 | 
    | 
| 
 
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
184
 | 
    | 
| 
16
 | 
3
 | 
 
 | 
 
 | 
  
3
  
 | 
 
 | 
565
 | 
 use SmokeRunner::Multi::SafeRun qw( safe_run );  | 
| 
 
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
7
 | 
    | 
| 
 
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
152
 | 
    | 
| 
17
 | 
3
 | 
 
 | 
 
 | 
  
3
  
 | 
 
 | 
19
 | 
 use SmokeRunner::Multi::Validate qw( validate ARRAYREF_TYPE );  | 
| 
 
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
4
 | 
    | 
| 
 
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
26
 | 
    | 
| 
18
 | 
3
 | 
 
 | 
 
 | 
  
3
  
 | 
 
 | 
764
 | 
 use YAML::Syck qw( Dump );  | 
| 
 
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1938
 | 
    | 
| 
 
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1944
 | 
    | 
| 
19
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
21
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub new  | 
| 
22
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 {  | 
| 
23
 | 
2
 | 
 
 | 
 
 | 
  
2
  
 | 
  
1
  
 | 
1615
 | 
     my $class = shift;  | 
| 
24
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
25
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
27
 | 
     return $class->SUPER::new(@_);  | 
| 
26
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
27
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
28
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub run_tests  | 
| 
29
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 {  | 
| 
30
 | 
2
 | 
 
 | 
 
 | 
  
2
  
 | 
  
1
  
 | 
25
 | 
     my $self = shift;  | 
| 
31
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
32
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
26
 | 
     my $temp_dir = tempdir( CLEANUP => 1 );  | 
| 
33
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1362
 | 
     my $archive  = Archive::Tar->new();  | 
| 
34
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
35
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
47
 | 
     my @files     = $self->set()->test_files();  | 
| 
36
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
2671
 | 
     my %meta_info =  | 
| 
37
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         ( file_order => \@files,  | 
| 
38
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
           start_time => time,  | 
| 
39
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         );  | 
| 
40
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
41
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     {  | 
| 
42
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
5
 | 
         local $CWD = $self->set()->set_dir();  | 
| 
 
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
11
 | 
    | 
| 
43
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
149
 | 
         foreach my $file (@files) {  | 
| 
44
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
18
 | 
             my $output;  | 
| 
45
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
48
 | 
             safe_run  | 
| 
46
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                 ( command       => $self->_perl_bin(),  | 
| 
47
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                   args          => [ $self->_libs(), $file ],  | 
| 
48
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                   stdout_buffer => \$output,  | 
| 
49
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                   stderr_buffer => \$output,  | 
| 
50
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                 );  | 
| 
51
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
52
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
148148
 | 
             my $basename = basename( $file, '.t' );  | 
| 
53
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
153
 | 
             my $destination  | 
| 
54
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                 = File::Spec->catfile( $temp_dir, "$basename.tap" );  | 
| 
55
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
56
 | 
4
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
673
 | 
             open my $fh, '>', $destination  | 
| 
57
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                 or die "Cannot write to $destination: $!";  | 
| 
58
 | 
4
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
105
 | 
             print $fh $output  | 
| 
59
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                 or die "Cannot write to $destination: $!";  | 
| 
60
 | 
4
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
356
 | 
             close $fh  | 
| 
61
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                 or die "Cannot write to $destination: $!";  | 
| 
62
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         }  | 
| 
63
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
64
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
65
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
132
 | 
     $meta_info{stop_time} = time;  | 
| 
66
 | 
2
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
207
 | 
     open my $meta_fh, '>', File::Spec->catfile( $temp_dir, 'meta.yml' )  | 
| 
67
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         or die "Could not open meta.yml for writing: $!";  | 
| 
68
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
37
 | 
     print $meta_fh Dump( \%meta_info );  | 
| 
69
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
447
 | 
     close $meta_fh;  | 
| 
70
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
71
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
392
 | 
     $archive->add_files( glob( File::Spec->catfile( $temp_dir, '*' ) ) );  | 
| 
72
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
73
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
3720
 | 
     my $tar_file = File::Spec->catfile( $temp_dir, "tap-archive-$$.tar.gz" );  | 
| 
74
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
25
 | 
     $archive->write( $tar_file, 1 );  | 
| 
75
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
76
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
17487
 | 
     $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
  
 | 
 
 | 
23
 | 
         if defined $ENV{HARNESS_PERL};  | 
| 
84
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
85
 | 
4
 | 
  
 50
  
 | 
  
 33
  
 | 
 
 | 
 
 | 
59
 | 
     return qq["$^X"]  | 
| 
86
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         if $^O =~ /^(MS)?Win32$/ && $^X =~ /[^\w\.\/\\]/;  | 
| 
87
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
88
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
32
 | 
     return $^X;  | 
| 
89
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
90
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
91
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub _libs  | 
| 
92
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 {  | 
| 
93
 | 
4
 | 
 
 | 
 
 | 
  
4
  
 | 
 
 | 
43
 | 
     return '-Mblib', '-Mlib=lib';  | 
| 
94
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
95
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
96
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
97
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 1;  | 
| 
98
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
99
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 __END__  |