line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::SSH::Any::Test::Isolated; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
43710
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
4
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
5
|
1
|
|
|
1
|
|
3
|
use feature qw(say); |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
78
|
|
6
|
1
|
|
|
1
|
|
3
|
use Carp; |
|
1
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
48
|
|
7
|
1
|
|
|
1
|
|
3
|
use Scalar::Util (); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
10
|
|
8
|
1
|
|
|
1
|
|
517
|
use Data::Dumper; |
|
1
|
|
|
|
|
6305
|
|
|
1
|
|
|
|
|
73
|
|
9
|
1
|
|
|
1
|
|
444
|
use IPC::Open2 qw(open2); |
|
1
|
|
|
|
|
3379
|
|
|
1
|
|
|
|
|
58
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $debug; |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
383
|
use parent qw(Net::SSH::Any::Test::Isolated::_Base); |
|
1
|
|
|
|
|
246
|
|
|
1
|
|
|
|
|
5
|
|
14
|
1
|
|
|
1
|
|
366
|
use Net::SSH::Any::URI; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
869
|
|
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
|
13
|
|
|
13
|
|
79
|
require Test::More; |
24
|
13
|
|
|
|
|
59
|
Test::More::diag($_[1]); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub new { |
28
|
3
|
|
|
3
|
0
|
4517
|
my ($class, %opts) = @_; |
29
|
3
|
|
|
|
|
19
|
my $self = $class->SUPER::_new('client'); |
30
|
|
|
|
|
|
|
|
31
|
3
|
|
50
|
|
|
23
|
my $logger_fh = delete $opts{logger_fh} // \*STDERR; |
32
|
3
|
|
|
|
|
53
|
open my $logger_fh_dup, '>>&', $logger_fh; |
33
|
3
|
|
|
|
|
9
|
$self->{logger_fh} = $logger_fh_dup; |
34
|
3
|
|
50
|
|
|
10
|
my $logger = delete $opts{logger} // \&_default_logger; |
35
|
3
|
50
|
|
|
|
12
|
unless (ref $logger) { |
36
|
3
|
50
|
|
|
|
9
|
if ($logger eq 'diag') { |
37
|
3
|
|
|
|
|
6
|
$logger = \&_diag_logger; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
else { |
40
|
0
|
|
|
|
|
0
|
croak "Bad logger argument '$logger'"; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
} |
43
|
3
|
|
|
|
|
6
|
$self->{logger} = $logger; |
44
|
3
|
|
33
|
|
|
17
|
$self->{perl} = $opts{local_perl_cmd} // $^X // 'perl'; |
|
|
|
50
|
|
|
|
|
45
|
3
|
|
|
|
|
10
|
$self->_bootstrap; |
46
|
3
|
|
|
|
|
18
|
$self->_start(%opts); |
47
|
|
|
|
|
|
|
|
48
|
3
|
|
|
|
|
23
|
$self; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub _log { |
52
|
13
|
|
|
13
|
|
19
|
my $self = shift; |
53
|
13
|
|
|
|
|
44
|
$self->{logger}->($self->{logger_fh}, @_); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub _bootstrap { |
57
|
3
|
|
|
3
|
|
3
|
my $self = shift; |
58
|
3
|
|
|
|
|
19
|
$self->_check_state('new'); |
59
|
3
|
50
|
|
|
|
9
|
my $perl = $self->{perl} or return; |
60
|
3
|
|
|
|
|
14
|
$self->{pid} = open2($self->{in}, $self->{out}, $^X); |
61
|
|
|
|
|
|
|
|
62
|
3
|
|
|
|
|
6711
|
my $old = select($self->{out}); |
63
|
3
|
|
|
|
|
8
|
$| = 1; |
64
|
3
|
|
|
|
|
8
|
select $old; |
65
|
|
|
|
|
|
|
|
66
|
3
|
|
33
|
|
|
119
|
my $inc = Data::Dumper::Dumper([grep defined && !ref, @INC]); |
67
|
3
|
50
|
|
|
|
394
|
my $debug_as_str = ($debug ? -1 : 'undef'); |
68
|
|
|
|
|
|
|
|
69
|
3
|
|
|
|
|
20
|
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__ |