From ee1d1db824a68f80c4cbdcbffbd7b4026f57a4f2 Mon Sep 17 00:00:00 2001 From: "Dr. David von Oheimb" Date: Mon, 7 Jun 2021 11:44:23 +0200 Subject: [PATCH] 80-test_cmp_http.t: Simplify and prevent hangs on server not launching/behaving correctly Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/15642) --- test/recipes/80-test_cmp_http.t | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/test/recipes/80-test_cmp_http.t b/test/recipes/80-test_cmp_http.t index 9c99226721e..bc23347ad73 100644 --- a/test/recipes/80-test_cmp_http.t +++ b/test/recipes/80-test_cmp_http.t @@ -276,28 +276,19 @@ sub start_mock_server { my $pid = open($server_fh, "$cmd|") or die "Trying to $cmd"; print "Pid is: $pid\n"; if ($server_port == 0) { - # Clear it first - $server_port = undef; - # Find out the actual server port while (<$server_fh>) { - print; + print "Server output: $_"; + next if m/using section/; s/\R$//; # Better chomp - next unless (/^ACCEPT/); - - # $1 may be undefined, which is OK to assign to $server_port, - # as that gets detected further down. - /^ACCEPT\s.*:(\d+)$/; - $server_port = $1; - - last; - } - - unless (defined $server_port) { - stop_mock_server($pid); - return 0; + $server_port = $1 if /^ACCEPT\s.*:(\d+)$/; + last; # Do not loop further to prevent hangs on server misbehavior } } + unless ($server_port > 0) { + stop_mock_server($pid); + return 0; + } $server_tls = $kur_port = $pbm_port = $server_port; return $pid; } -- 2.47.2