line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::SSH::Any::Test::Isolated; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
13262
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
4
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
21
|
|
5
|
1
|
|
|
1
|
|
3
|
use feature qw(say); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
73
|
|
6
|
1
|
|
|
1
|
|
3
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
56
|
|
7
|
1
|
|
|
1
|
|
3
|
use Scalar::Util (); |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
10
|
|
8
|
1
|
|
|
1
|
|
567
|
use Data::Dumper; |
|
1
|
|
|
|
|
6424
|
|
|
1
|
|
|
|
|
48
|
|
9
|
1
|
|
|
1
|
|
409
|
use IPC::Open2 qw(open2); |
|
1
|
|
|
|
|
3523
|
|
|
1
|
|
|
|
|
58
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $debug; |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
368
|
use parent qw(Net::SSH::Any::Test::Isolated::_Base); |
|
1
|
|
|
|
|
250
|
|
|
1
|
|
|
|
|
4
|
|
14
|
1
|
|
|
1
|
|
363
|
use Net::SSH::Any::URI; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
864
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub _default_logger { |
18
|
0
|
|
|
0
|
|
0
|
my ($fh, $text) = @_; |
19
|
0
|
|
|
|
|
0
|
print {$fh} $text; |
|
0
|
|
|
|
|
0
|
|
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub _diag_logger { |
23
|
29
|
|
|
29
|
|
127
|
require Test::More; |
24
|
29
|
|
|
|
|
97
|
Test::More::diag($_[1]); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub new { |
28
|
3
|
|
|
3
|
0
|
2710
|
my ($class, %opts) = @_; |
29
|
3
|
|
|
|
|
17
|
my $self = $class->SUPER::_new('client'); |
30
|
|
|
|
|
|
|
|
31
|
3
|
|
50
|
|
|
19
|
my $logger_fh = delete $opts{logger_fh} // \*STDERR; |
32
|
3
|
|
|
|
|
34
|
open my $logger_fh_dup, '>>&', $logger_fh; |
33
|
3
|
|
|
|
|
11
|
$self->{logger_fh} = $logger_fh_dup; |
34
|
3
|
|
50
|
|
|
12
|
my $logger = delete $opts{logger} // \&_default_logger; |
35
|
3
|
50
|
|
|
|
7
|
unless (ref $logger) { |
36
|
3
|
50
|
|
|
|
8
|
if ($logger eq 'diag') { |
37
|
3
|
|
|
|
|
7
|
$logger = \&_diag_logger; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
else { |
40
|
0
|
|
|
|
|
0
|
croak "Bad logger argument '$logger'"; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
} |
43
|
3
|
|
|
|
|
7
|
$self->{logger} = $logger; |
44
|
3
|
|
33
|
|
|
16
|
$self->{perl} = $opts{local_perl_cmd} // $^X // 'perl'; |
|
|
|
50
|
|
|
|
|
45
|
3
|
|
|
|
|
9
|
$self->_bootstrap; |
46
|
3
|
|
|
|
|
22
|
$self->_start(%opts); |
47
|
|
|
|
|
|
|
|
48
|
3
|
|
|
|
|
24
|
$self; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub _log { |
52
|
29
|
|
|
29
|
|
31
|
my $self = shift; |
53
|
29
|
|
|
|
|
78
|
$self->{logger}->($self->{logger_fh}, @_); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub _bootstrap { |
57
|
3
|
|
|
3
|
|
4
|
my $self = shift; |
58
|
3
|
|
|
|
|
15
|
$self->_check_state('new'); |
59
|
3
|
50
|
|
|
|
10
|
my $perl = $self->{perl} or return; |
60
|
3
|
|
|
|
|
14
|
$self->{pid} = open2($self->{in}, $self->{out}, $^X); |
61
|
|
|
|
|
|
|
|
62
|
3
|
|
|
|
|
5651
|
my $old = select($self->{out}); |
63
|
3
|
|
|
|
|
7
|
$| = 1; |
64
|
3
|
|
|
|
|
7
|
select $old; |
65
|
|
|
|
|
|
|
|
66
|
3
|
|
33
|
|
|
116
|
my $inc = Data::Dumper::Dumper([grep defined && !ref, @INC]); |
67
|
3
|
50
|
|
|
|
336
|
my $debug_as_str = ($debug ? -1 : 'undef'); |
68
|
|
|
|
|
|
|
|
69
|
3
|
|
|
|
|
12
|
my $code = <
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
use lib \@{$inc}; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
use strict; |
74
|
|
|
|
|
|
|
use warnings; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
\$Net::SSH::Any::Test::Isolated::debug = $debug_as_str; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
use Net::SSH::Any::Test::Isolated::_Slave; |
79
|
|
|
|
|
|
|
Net::SSH::Any::Test::Isolated::_Slave->run; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
__END__ |