| 1 | package Net::Respite::Server::Test; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 4 | ▶ | use Test::More; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 4 | ▶ | use File::Temp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 4 | ▶ | use Throw qw(throw import); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 4 | ▶ | use Time::HiRes qw(sleep); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 4 | ▶ | use End; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | #use Data::Debug; | ||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 5 | ▶ | sub setup_test_server { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setup_test_server: called CC=35 SCAR=44.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 5 | ▶ | my $args = shift || {}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift() || {}
MC/DC0%0/1
shift() || {}
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 5 | ▶ | my $verbose = exists($args->{'verbose'}) ? $args->{'verbose'} : 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | # setup some defaults | ||||||||||||||||||||||||||||||||||||||||||
| 17 | 5 | ▶ | my $port = $args->{'port'} || do { | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$args->{'port'} || do {
require IO::Socket;
my $sock = 'IO::Socket::INET'->new;
$sock->configure({'LocalPort', 0, 'Listen', 1, 'Proto', 'tcp', 'ReuseAddr', 1}) or throw('Could not create temp socket', {'msg', $!});
my $port = $sock->sockport || throw('Could not generate random usable sockport')
}
MC/DC0%0/2
$args->{'port'} || do {
require IO::Socket;
my $sock = 'IO::Socket::INET'->new;
$sock->configure({'LocalPort', 0, 'Listen', 1, 'Proto', 'tcp', 'ReuseAddr', 1}) or throw('Could not create temp socket', {'msg', $!});
my $port = $sock->sockport || throw('Could not generate random usable sockport')
}
$args->{'port'}
do {
require IO::Socket;
my $sock = 'IO::Socket::INET'->new;
$sock->configure({'LocalPort', 0, 'Listen', 1, 'Proto', 'tcp', 'ReuseAddr', 1}) or throw('Could not create temp socket', {'msg', $!});
my $port = $sock->sockport || throw('Could not generate random usable sockport')
}
Truth table33%1/3
A || B
A= $args->{'port'}B= do {
require IO::Socket;
my $sock = 'IO::Socket::INET'->new;
$sock->configure({'LocalPort', 0, 'Listen', 1, 'Proto', 'tcp', 'ReuseAddr', 1}) or throw('Could not create temp socket', {'msg', $!});
my $port = $sock->sockport || throw('Could not generate random usable sockport')
}
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 5 | require IO::Socket; | |||||||||||||||||||||||||||||||||||||||||
| 19 | 5 | my $sock = IO::Socket::INET->new; | |||||||||||||||||||||||||||||||||||||||||
| 20 | 5 | ▶ | $sock->configure({ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | LocalPort => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 22 | Listen => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 23 | Proto => 'tcp', | ||||||||||||||||||||||||||||||||||||||||||
| 24 | ReuseAddr => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 25 | }) || throw "Could not create temp socket", {msg => $!}; | ||||||||||||||||||||||||||||||||||||||||||
| 26 | 5 | ▶ | my $port = $sock->sockport || throw "Could not generate random usable sockport"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$sock->sockport || throw('Could not generate random usable sockport')
MC/DC0%0/2
$sock->sockport || throw('Could not generate random usable sockport')
$sock->sockport
throw('Could not generate random usable sockport')
Truth table33%1/3
A || B
A= $sock->sockportB= throw('Could not generate random usable sockport')
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 28 | 5 | my $tmpnam = File::Temp->new; | |||||||||||||||||||||||||||||||||||||||||
| 29 | 5 | ▶ | my $pid_file = $args->{'pid_file'} || "$tmpnam.$$.pid"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args->{'pid_file'} || "$tmpnam.${$}.pid"
MC/DC0%0/1
$args->{'pid_file'} || "$tmpnam.${$}.pid"
$args->{'pid_file'}
Truth table50%1/2
A
A= $args->{'pid_file'}
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | 5 | ▶ | my $access_file = $args->{'access_file'} || "$tmpnam.$$.access"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args->{'access_file'} || "$tmpnam.${$}.access"
MC/DC0%0/1
$args->{'access_file'} || "$tmpnam.${$}.access"
$args->{'access_file'}
Truth table50%1/2
A
A= $args->{'access_file'}
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | 5 | ▶ | my $error_file = $args->{'error_file'} || "$tmpnam.$$.error"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args->{'error_file'} || "$tmpnam.${$}.error"
MC/DC0%0/1
$args->{'error_file'} || "$tmpnam.${$}.error"
$args->{'error_file'}
Truth table50%1/2
A
A= $args->{'error_file'}
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 5 | undef $tmpnam; | |||||||||||||||||||||||||||||||||||||||||
| 33 | 5 | ▶ | my $no_brand = exists($args->{'no_brand'}) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | 5 | ▶ | my $no_ssl = exists($args->{'no_ssl'}) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | #$no_ssl = 1; | ||||||||||||||||||||||||||||||||||||||||||
| 36 | 5 | ▶ | my $flat = exists($args->{'flat'}) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | 5 | ▶ | my $server = $args->{'server'} || do { | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$args->{'server'} || do {
my $pkg = $args->{'server_class'} || 'Net::Respite::Server';
(my $file = "$pkg.pm") =~ s[::][/]g;
eval {
do {
require $file
}
} or throw('Could not require client library', {'msg', $@});
$pkg->new({'no_brand', $no_brand, $args->{'service'} ? ('server_name', $args->{'service'}) : (), $args->{'api_meta'} ? ('api_meta', $args->{'api_meta'}) : (), 'port', $port, 'server_type', $args->{'server_type'} || 'Fork', 'no_ssl', $no_ssl, 'flat', $flat, 'host', $args->{'host'} || 'localhost', 'pass', $args->{'pass'}, 'pid_file', $pid_file, 'access_log_file', $access_file, 'log_file', $error_file, 'user', defined $args->{'user'} ? $args->{'user'} : $<, 'group', defined $args->{'group'} ? $args->{'group'} : $(})
}
MC/DC0%0/2
$args->{'server'} || do {
my $pkg = $args->{'server_class'} || 'Net::Respite::Server';
(my $file = "$pkg.pm") =~ s[::][/]g;
eval {
do {
require $file
}
} or throw('Could not require client library', {'msg', $@});
$pkg->new({'no_brand', $no_brand, $args->{'service'} ? ('server_name', $args->{'service'}) : (), $args->{'api_meta'} ? ('api_meta', $args->{'api_meta'}) : (), 'port', $port, 'server_type', $args->{'server_type'} || 'Fork', 'no_ssl', $no_ssl, 'flat', $flat, 'host', $args->{'host'} || 'localhost', 'pass', $args->{'pass'}, 'pid_file', $pid_file, 'access_log_file', $access_file, 'log_file', $error_file, 'user', defined $args->{'user'} ? $args->{'user'} : $<, 'group', defined $args->{'group'} ? $args->{'group'} : $(})
}
$args->{'server'}
do {
my $pkg = $args->{'server_class'} || 'Net::Respite::Server';
(my $file = "$pkg.pm") =~ s[::][/]g;
eval {
do {
require $file
}
} or throw('Could not require client library', {'msg', $@});
$pkg->new({'no_brand', $no_brand, $args->{'service'} ? ('server_name', $args->{'service'}) : (), $args->{'api_meta'} ? ('api_meta', $args->{'api_meta'}) : (), 'port', $port, 'server_type', $args->{'server_type'} || 'Fork', 'no_ssl', $no_ssl, 'flat', $flat, 'host', $args->{'host'} || 'localhost', 'pass', $args->{'pass'}, 'pid_file', $pid_file, 'access_log_file', $access_file, 'log_file', $error_file, 'user', defined $args->{'user'} ? $args->{'user'} : $<, 'group', defined $args->{'group'} ? $args->{'group'} : $(})
}
Truth table33%1/3
A || B
A= $args->{'server'}B= do {
my $pkg = $args->{'server_class'} || 'Net::Respite::Server';
(my $file = "$pkg.pm") =~ s[::][/]g;
eval {
do {
require $file
}
} or throw('Could not require client library', {'msg', $@});
$pkg->new({'no_brand', $no_brand, $args->{'service'} ? ('server_name', $args->{'service'}) : (), $args->{'api_meta'} ? ('api_meta', $args->{'api_meta'}) : (), 'port', $port, 'server_type', $args->{'server_type'} || 'Fork', 'no_ssl', $no_ssl, 'flat', $flat, 'host', $args->{'host'} || 'localhost', 'pass', $args->{'pass'}, 'pid_file', $pid_file, 'access_log_file', $access_file, 'log_file', $error_file, 'user', defined $args->{'user'} ? $args->{'user'} : $<, 'group', defined $args->{'group'} ? $args->{'group'} : $(})
}
| |||||||||||||||||||||||||||||||||||||||||||
| 39 | 5 | ▶ | my $pkg = $args->{'server_class'} || 'Net::Respite::Server'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args->{'server_class'} || 'Net::Respite::Server'
MC/DC0%0/1
$args->{'server_class'} || 'Net::Respite::Server'
$args->{'server_class'}
Truth table50%1/2
A
A= $args->{'server_class'}
| |||||||||||||||||||||||||||||||||||||||||||
| 40 | 5 | (my $file = "$pkg.pm") =~ s|::|/|g; | |||||||||||||||||||||||||||||||||||||||||
| 41 | 5 | ▶ | eval { require $file } || throw "Could not require client library", {msg => $@}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | $pkg->new({ | ||||||||||||||||||||||||||||||||||||||||||
| 43 | no_brand => $no_brand, | ||||||||||||||||||||||||||||||||||||||||||
| 44 | ($args->{'service'} ? (server_name => $args->{'service'}) : ()), | ||||||||||||||||||||||||||||||||||||||||||
| 45 | ($args->{'api_meta'} ? (api_meta => $args->{'api_meta'}) : ()), | ||||||||||||||||||||||||||||||||||||||||||
| 46 | port => $port, | ||||||||||||||||||||||||||||||||||||||||||
| 47 | server_type => $args->{'server_type'} || 'Fork', | ||||||||||||||||||||||||||||||||||||||||||
| 48 | no_ssl => $no_ssl, | ||||||||||||||||||||||||||||||||||||||||||
| 49 | flat => $flat, | ||||||||||||||||||||||||||||||||||||||||||
| 50 | host => $args->{'host'} || 'localhost', | ||||||||||||||||||||||||||||||||||||||||||
| 51 | pass => $args->{'pass'}, | ||||||||||||||||||||||||||||||||||||||||||
| 52 | pid_file => $pid_file, | ||||||||||||||||||||||||||||||||||||||||||
| 53 | access_log_file => $access_file, | ||||||||||||||||||||||||||||||||||||||||||
| 54 | log_file => $error_file, | ||||||||||||||||||||||||||||||||||||||||||
| 55 | user => defined($args->{'user'}) ? $args->{'user'} : $<, | ||||||||||||||||||||||||||||||||||||||||||
| 56 | 5 | ▶ | group => defined($args->{'group'}) ? $args->{'group'} : $(, | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
Condition50%2/4
$args->{'server_type'} || 'Fork'
$args->{'host'} || 'localhost'
MC/DC0%0/1
$args->{'server_type'} || 'Fork'
$args->{'server_type'}
MC/DC0%0/1
$args->{'host'} || 'localhost'
$args->{'host'}
Truth table50%1/2
A
A= $args->{'server_type'}
Truth table50%1/2
A
A= $args->{'host'}
| |||||||||||||||||||||||||||||||||||||||||||
| 57 | }); | ||||||||||||||||||||||||||||||||||||||||||
| 58 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 59 | #debug $server; | ||||||||||||||||||||||||||||||||||||||||||
| 60 | 5 | my $service = $server->server_name; | |||||||||||||||||||||||||||||||||||||||||
| 61 | 5 | $service =~ s/_server$//; | |||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | 5 | ▶ | my $encoded = exists($args->{'utf8_encoded'}) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 64 | 5 | ▶ | my $client = $args->{'client'} || do { | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$args->{'client'} || do {
my $pkg = $args->{'client_class'} || 'Net::Respite::Client';
(my $file = "$pkg.pm") =~ s[::][/]g;
eval {
do {
require $file
}
} or throw('Could not require client library', {'msg', $@});
$pkg->new({'no_brand', $no_brand, 'service', $service, 'port', $port, 'host', $server->{'host'}, 'pass', $args->{'pass'}, 'no_ssl', $no_ssl, 'flat', $flat, 'utf8_encoded', $encoded, $args->{'brand'} ? ('brand', $args->{'brand'}) : ()})
}
MC/DC0%0/2
$args->{'client'} || do {
my $pkg = $args->{'client_class'} || 'Net::Respite::Client';
(my $file = "$pkg.pm") =~ s[::][/]g;
eval {
do {
require $file
}
} or throw('Could not require client library', {'msg', $@});
$pkg->new({'no_brand', $no_brand, 'service', $service, 'port', $port, 'host', $server->{'host'}, 'pass', $args->{'pass'}, 'no_ssl', $no_ssl, 'flat', $flat, 'utf8_encoded', $encoded, $args->{'brand'} ? ('brand', $args->{'brand'}) : ()})
}
$args->{'client'}
do {
my $pkg = $args->{'client_class'} || 'Net::Respite::Client';
(my $file = "$pkg.pm") =~ s[::][/]g;
eval {
do {
require $file
}
} or throw('Could not require client library', {'msg', $@});
$pkg->new({'no_brand', $no_brand, 'service', $service, 'port', $port, 'host', $server->{'host'}, 'pass', $args->{'pass'}, 'no_ssl', $no_ssl, 'flat', $flat, 'utf8_encoded', $encoded, $args->{'brand'} ? ('brand', $args->{'brand'}) : ()})
}
Truth table33%1/3
A || B
A= $args->{'client'}B= do {
my $pkg = $args->{'client_class'} || 'Net::Respite::Client';
(my $file = "$pkg.pm") =~ s[::][/]g;
eval {
do {
require $file
}
} or throw('Could not require client library', {'msg', $@});
$pkg->new({'no_brand', $no_brand, 'service', $service, 'port', $port, 'host', $server->{'host'}, 'pass', $args->{'pass'}, 'no_ssl', $no_ssl, 'flat', $flat, 'utf8_encoded', $encoded, $args->{'brand'} ? ('brand', $args->{'brand'}) : ()})
}
| |||||||||||||||||||||||||||||||||||||||||||
| 65 | 5 | ▶ | my $pkg = $args->{'client_class'} || 'Net::Respite::Client'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args->{'client_class'} || 'Net::Respite::Client'
MC/DC0%0/1
$args->{'client_class'} || 'Net::Respite::Client'
$args->{'client_class'}
Truth table50%1/2
A
A= $args->{'client_class'}
| |||||||||||||||||||||||||||||||||||||||||||
| 66 | 5 | (my $file = "$pkg.pm") =~ s|::|/|g; | |||||||||||||||||||||||||||||||||||||||||
| 67 | 5 | ▶ | eval { require $file } || throw "Could not require client library", {msg => $@}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 68 | $pkg->new({ | ||||||||||||||||||||||||||||||||||||||||||
| 69 | no_brand => $no_brand, | ||||||||||||||||||||||||||||||||||||||||||
| 70 | service => $service, | ||||||||||||||||||||||||||||||||||||||||||
| 71 | port => $port, | ||||||||||||||||||||||||||||||||||||||||||
| 72 | host => $server->{'host'}, | ||||||||||||||||||||||||||||||||||||||||||
| 73 | pass => $args->{'pass'}, | ||||||||||||||||||||||||||||||||||||||||||
| 74 | no_ssl => $no_ssl, | ||||||||||||||||||||||||||||||||||||||||||
| 75 | flat => $flat, | ||||||||||||||||||||||||||||||||||||||||||
| 76 | utf8_encoded => $encoded, | ||||||||||||||||||||||||||||||||||||||||||
| 77 | 5 | ▶ | ($args->{'brand'} ? (brand => $args->{'brand'}) : ()), | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 78 | }); | ||||||||||||||||||||||||||||||||||||||||||
| 79 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 80 | #debug $client; | ||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | ###----------------------------------------------------------------### | ||||||||||||||||||||||||||||||||||||||||||
| 83 | # start the server in a child, block the parent until ready | ||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | 5 | my $pid = fork; | |||||||||||||||||||||||||||||||||||||||||
| 86 | 5 | ▶ | die "Could not fork during test\n" if ! defined $pid; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 87 | 5 | ▶ | if (!$pid) { # child | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 88 | 2 | local @ARGV; | |||||||||||||||||||||||||||||||||||||||||
| 89 | 2 | $server->run_server(setsid => 0, background => 0); # allow a kill term to close the server too | |||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | exit; | |||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | 3 | my $client_pid = $$; | |||||||||||||||||||||||||||||||||||||||||
| 94 | 3 | ▶ | $client->{'_test_ender'} = end { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=10 SCAR=26.2
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | 3 | diag("Client object ending: pid=[$$] port=[$port]"); | |||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||
| 97 | 3 | ▶ | if ($client_pid != $$) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | diag("ORIGPID[$client_pid]!=CURRPID[$$] Refusing to stop server on port [$port]! Running setup_test_server() while an old client object still exists can trigger this phantom cleanup on the OLD client object when the child request from the NEW server completes, especially for the Fork personality."); | |||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||
| 102 | 3 | ▶ | diag("Process list") if $verbose; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 103 | 3 | $server->__ps; | |||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | 3 | diag("Stop server"); | |||||||||||||||||||||||||||||||||||||||||
| 106 | 3 | $server->__stop; | |||||||||||||||||||||||||||||||||||||||||
| 107 | # get some info - then tear down | ||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | 3 | ▶ | diag("Tail of the error_log") if $verbose; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 110 | 3 | ▶ | $server->__tail_error(1000) if $verbose; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | 3 | ▶ | diag("Tail of the access_log") if $verbose; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 113 | 3 | ▶ | $server->__tail_access($server->{'tail_access'} || 20) if $verbose; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$server->{'tail_access'} || 20
MC/DC0%0/1
$server->{'tail_access'} || 20
$server->{'tail_access'}
Truth table50%1/2
A
A= $server->{'tail_access'}
| |||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||
| 115 | 3 | ▶ | diag("Shut down server") if $verbose; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 116 | 3 | unlink $_ for $pid_file, $access_file, $error_file; # double check | |||||||||||||||||||||||||||||||||||||||||
| 117 | 3 | }; | |||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||
| 119 | # block the parent (that will run client tests) until the child running the server is fully setup | ||||||||||||||||||||||||||||||||||||||||||
| 120 | 3 | my $connected; | |||||||||||||||||||||||||||||||||||||||||
| 121 | 3 | for (1 .. 30) { | |||||||||||||||||||||||||||||||||||||||||
| 122 | 3 | sleep 0.1; | |||||||||||||||||||||||||||||||||||||||||
| 123 | 3 | my $class = 'IO::Socket::INET'; | |||||||||||||||||||||||||||||||||||||||||
| 124 | 3 | ▶ | if (!$no_ssl) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | require IO::Socket::SSL; | |||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | $class = 'IO::Socket::SSL'; | |||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||
| 128 | 3 | ▶ | my $sock = $class->new(PeerHost => "localhost", PeerPort => $port, SSL_verify_mode => 0) || next; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$class->new('PeerHost', 'localhost', 'PeerPort', $port, 'SSL_verify_mode', 0) || (next)
MC/DC0%0/1
$class->new('PeerHost', 'localhost', 'PeerPort', $port, 'SSL_verify_mode', 0) || (next)
$class->new('PeerHost', 'localhost', 'PeerPort', $port, 'SSL_verify_mode', 0)
Truth table50%1/2
A
A= $class->new('PeerHost', 'localhost', 'PeerPort', $port, 'SSL_verify_mode', 0)
| |||||||||||||||||||||||||||||||||||||||||||
| 129 | 3 | print $sock "GET /waited_until_child HTTP/1.0\n\n"; | |||||||||||||||||||||||||||||||||||||||||
| 130 | 3 | $connected = 1; | |||||||||||||||||||||||||||||||||||||||||
| 131 | 3 | last; | |||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||
| 133 | 3 | ▶ | if (! $connected) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | diag("Tail of the error_log"); | |||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | ▶ | $server->__tail_error($server->{'tail_error'} || 20) if $verbose; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$server->{'tail_error'} || 20
MC/DC0%0/1
$server->{'tail_error'} || 20
$server->{'tail_error'}
Truth table0%0/2
A
A= $server->{'tail_error'}
| |||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | die "Failed to connect to the server: $!"; | |||||||||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||
| 139 | 3 | ▶ | return wantarray ? ($client, $server) : $client; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||
| 142 | 4 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||
| 144 | __END__ | ||||||||||||||||||||||||||||||||||||||||||