From: Dr. David von Oheimb Date: Mon, 7 Jun 2021 09:44:23 +0000 (+0200) Subject: 80-test_cmp_http.t: Simplify and prevent hangs on server not launching/behaving correctly X-Git-Tag: openssl-3.0.0-beta1~124 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ee1d1db824a68f80c4cbdcbffbd7b4026f57a4f2;p=thirdparty%2Fopenssl.git 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) --- 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; }