[openssl] master update
dev at ddvo.net
dev at ddvo.net
Fri Jul 3 11:40:03 UTC 2020
The branch master has been updated
via 64bb6276d17cc78c15e0bbea2cce899ba9b6778d (commit)
via 89137609606a1195091c1edb4741c67c06f878a5 (commit)
from 94fcec0902ec6df54a6286f61e35fa6f93815fd6 (commit)
- Log -----------------------------------------------------------------
commit 64bb6276d17cc78c15e0bbea2cce899ba9b6778d
Author: Dr. David von Oheimb <David.von.Oheimb at siemens.com>
Date: Tue Jun 23 08:04:54 2020 +0200
81-test_cmp_cli.t: Correct subroutine quote_spc_empty and its use
Reviewed-by: Matt Caswell <matt at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12280)
commit 89137609606a1195091c1edb4741c67c06f878a5
Author: Dr. David von Oheimb <David.von.Oheimb at siemens.com>
Date: Tue Jun 23 08:03:59 2020 +0200
81-test_cmp_cli.t: Streamline {start,stop}_mock_server and improve port setting
Reviewed-by: Matt Caswell <matt at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12280)
-----------------------------------------------------------------------
Summary of changes:
test/recipes/81-test_cmp_cli.t | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/test/recipes/81-test_cmp_cli.t b/test/recipes/81-test_cmp_cli.t
index 82441327fe..385c259729 100644
--- a/test/recipes/81-test_cmp_cli.t
+++ b/test/recipes/81-test_cmp_cli.t
@@ -55,7 +55,6 @@ my @cmp_basic_tests = (
my $rsp_cert = "signer_only.crt";
my $outfile = "test.cert.pem";
my $secret = "pass:test";
-my $localport = 1700;
# this uses the mock server directly in the cmp app, without TCP
sub use_mock_srv_internally
@@ -163,8 +162,8 @@ sub test_cmp_cli {
my $actual_exit = shift;
my $OK = $actual_exit == $expected_exit;
if ($faillog && !$OK) {
- sub quote_spc_empty(_) { $_ eq "" ? '""' : $_ =~ m/ / ? '"'.$_.'"' : $_ };
- my $invocation = ("$path_app ").join(' ', map quote_spc_empty @$params);
+ my $quote_spc_empty = sub { $_ eq "" ? '""' : $_ =~ m/ / ? '"'.$_.'"' : $_ };
+ my $invocation = "$path_app ".join(' ', map $quote_spc_empty->($_), @$params);
print $faillog "$server_name $aspect \"$title\" ($i/$n)".
" expected=$expected_exit actual=$actual_exit\n";
print $faillog "$invocation\n\n";
@@ -206,11 +205,11 @@ indir data_dir() => sub {
foreach my $server_name (@server_configurations) {
$server_name = chop_dblquot($server_name);
load_config($server_name, $server_name);
- my $launch_mock = $server_name eq "Mock" && !$ENV{OPENSSL_CMP_CONFIG};
- if ($launch_mock) {
+ my $pid;
+ if ($server_name eq "Mock") {
indir "Mock" => sub {
- stop_mock_server(); # in case a previous run did not exit properly
- start_mock_server("") || die "Cannot start CMP mock server";
+ $pid = start_mock_server("");
+ die "Cannot start CMP mock server" unless $pid;
}
}
foreach my $aspect (@all_aspects) {
@@ -222,7 +221,7 @@ indir data_dir() => sub {
test_cmp_cli_aspect($server_name, $aspect, $tests);
};
};
- stop_mock_server() if $launch_mock;
+ stop_mock_server($pid) if $pid;
};
};
@@ -285,19 +284,21 @@ sub load_tests {
}
sub mock_server_pid {
- return `lsof -iTCP:$localport -sTCP:LISTEN | tail -n 1 | awk '{ print \$2 }'`;
+ return `lsof -iTCP:$server_port -sTCP:LISTEN | tail -n 1 | awk '{ print \$2 }'`;
}
sub start_mock_server {
- return 0 if mock_server_pid(); # already running
my $args = $_[0]; # optional further CLI arguments
my $dir = bldtop_dir("");
- return system("LD_LIBRARY_PATH=$dir DYLD_LIBRARY_PATH=$dir " .
- bldtop_dir($app) . " -config server.cnf " .
- "$args &") == 0; # start in background, check for success
+ my $cmd = "LD_LIBRARY_PATH=$dir DYLD_LIBRARY_PATH=$dir " .
+ bldtop_dir($app) . " -config server.cnf $args";
+ my $pid = mock_server_pid();
+ return $pid if $pid; # already running
+ return system("$cmd &") == 0 # start in background, check for success
+ ? (sleep 1, mock_server_pid()) : 0;
}
sub stop_mock_server {
- my $pid = mock_server_pid();
+ my $pid = $_[0];
system("kill $pid") if $pid;
}
More information about the openssl-commits
mailing list