line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Docker::Image::Utility; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
47603
|
use strict; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
153
|
|
4
|
5
|
|
|
5
|
|
20
|
use warnings; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
119
|
|
5
|
|
|
|
|
|
|
|
6
|
5
|
|
|
5
|
|
2310
|
use parent 'Exporter'; |
|
5
|
|
|
|
|
1356
|
|
|
5
|
|
|
|
|
26
|
|
7
|
5
|
|
|
5
|
|
4525
|
use IPC::Run3; |
|
5
|
|
|
|
|
132487
|
|
|
5
|
|
|
|
|
529
|
|
8
|
5
|
|
|
5
|
|
2536
|
use Time::HiRes; |
|
5
|
|
|
|
|
3631
|
|
|
5
|
|
|
|
|
28
|
|
9
|
|
|
|
|
|
|
|
10
|
5
|
|
|
5
|
|
592
|
use constant DEBUG => $ENV{DEBUG_TEST_DOCKER_IMAGE}; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
1202
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our @EXPORT = qw(docker); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our @EXPORT_OK = qw(run); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub WARN { |
17
|
0
|
|
|
0
|
0
|
0
|
my $msg = join " ", @_; |
18
|
0
|
|
|
|
|
0
|
chomp $msg; |
19
|
0
|
|
|
|
|
0
|
warn sprintf "[%s %.5f] %s\n", __PACKAGE__, Time::HiRes::time, $msg; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
1
|
0
|
1076
|
sub docker { run('docker', @_); } |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub run { |
25
|
2
|
|
|
2
|
0
|
2987
|
my (@cmd) = @_; |
26
|
|
|
|
|
|
|
|
27
|
2
|
|
|
|
|
3
|
DEBUG && WARN sprintf "Run [ %s ]", join ' ', @cmd; |
28
|
2
|
|
|
|
|
17
|
my $is_success = run3 [ @cmd ], \my $in, \my $out, \my $err; |
29
|
1
|
50
|
|
|
|
4248
|
if ($is_success) { |
30
|
1
|
|
|
|
|
4
|
chomp $out; |
31
|
1
|
|
|
|
|
14
|
return $out; |
32
|
|
|
|
|
|
|
} else { |
33
|
0
|
|
|
|
|
|
die $err; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |