aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>2021-06-07 11:50:43 +0200
committerDr. David von Oheimb <dev@ddvo.net>2021-06-09 14:03:16 +0200
commitd63053bbdfa226c85e9cec06c35283296e254a84 (patch)
treeed464b5f554805567dbb7b17d4e739ab8dd7634b /test
parentee1d1db824a68f80c4cbdcbffbd7b4026f57a4f2 (diff)
downloadopenssl-d63053bbdfa226c85e9cec06c35283296e254a84.zip
openssl-d63053bbdfa226c85e9cec06c35283296e254a84.tar.gz
openssl-d63053bbdfa226c85e9cec06c35283296e254a84.tar.bz2
80-test_cmp_http.t: Improve the way the test server is launched and killed
Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15642)
Diffstat (limited to 'test')
-rw-r--r--test/recipes/79-test_http.t5
-rw-r--r--test/recipes/80-test_cmp_http.t12
2 files changed, 8 insertions, 9 deletions
diff --git a/test/recipes/79-test_http.t b/test/recipes/79-test_http.t
index b5bb743..939e7fc 100644
--- a/test/recipes/79-test_http.t
+++ b/test/recipes/79-test_http.t
@@ -19,8 +19,9 @@ SKIP: {
skip "OCSP disabled", 1 if disabled("ocsp");
my $cmd = [qw{openssl ocsp -index any -port 0}];
my @output = run(app($cmd), capture => 1);
- ok($output[0] =~ /^ACCEPT (0.0.0.0|\[::\]):(\d+?)$/ && $2 >= 1024,
- "HTTP server auto-selects and reports local port >= 1024");
+ ok($output[0] =~ /^ACCEPT (0.0.0.0|\[::\]):(\d+?) PID=(\d+)$/
+ && $2 >= 1024 && $3 > 0,
+ "HTTP server auto-selects and reports local port >= 1024 and pid > 0");
}
ok(run(test(["http_test", srctop_file("test", "certs", "ca-cert.pem")])));
diff --git a/test/recipes/80-test_cmp_http.t b/test/recipes/80-test_cmp_http.t
index bc23347..10f2b84 100644
--- a/test/recipes/80-test_cmp_http.t
+++ b/test/recipes/80-test_cmp_http.t
@@ -12,7 +12,7 @@ use strict;
use warnings;
use POSIX;
-use OpenSSL::Test qw/:DEFAULT data_file data_dir srctop_dir bldtop_dir result_dir/;
+use OpenSSL::Test qw/:DEFAULT cmdstr data_file data_dir srctop_dir bldtop_dir result_dir/;
use OpenSSL::Test::Utils;
BEGIN {
@@ -266,10 +266,8 @@ sub load_tests {
sub start_mock_server {
my $args = $_[0]; # optional further CLI arguments
- my $dir = bldtop_dir("");
- local $ENV{LD_LIBRARY_PATH} = $dir;
- local $ENV{DYLD_LIBRARY_PATH} = $dir;
- my $cmd = bldtop_dir($app) . " -config server.cnf $args";
+ my $cmd = cmdstr(app(['openssl', 'cmp', '-config', 'server.cnf',
+ $args ? $args : ()]), display => 1);
print "Current directory is ".getcwd()."\n";
print "Launching mock server: $cmd\n";
die "Invalid port: $server_port" unless $server_port =~ m/^\d+$/;
@@ -281,7 +279,7 @@ sub start_mock_server {
print "Server output: $_";
next if m/using section/;
s/\R$//; # Better chomp
- $server_port = $1 if /^ACCEPT\s.*:(\d+)$/;
+ ($server_port, $pid) = ($1, $2) if /^ACCEPT\s.*:(\d+) PID=(\d+)$/;
last; # Do not loop further to prevent hangs on server misbehavior
}
}
@@ -296,5 +294,5 @@ sub start_mock_server {
sub stop_mock_server {
my $pid = $_[0];
print "Killing mock server with pid=$pid\n";
- kill('QUIT', $pid) if $pid;
+ kill('QUIT', $pid);
}