Commit 43db29b222 for openssl.org

commit 43db29b222948d9c3690c8ead90968bb314b1912
Author: Dr. David von Oheimb <dev@ddvo.net>
Date:   Mon Sep 8 14:18:04 2025 +0200

    80-test_cmp_http.t: improve diagnostics on failure getting server output

    Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
    Reviewed-by: Paul Dale <paul.dale@oracle.com>
    MergeDate: Tue Feb  3 08:43:04 2026
    (Merged from https://github.com/openssl/openssl/pull/28478)

diff --git a/test/recipes/80-test_cmp_http.t b/test/recipes/80-test_cmp_http.t
index 6f560216dc..0031f785b3 100644
--- a/test/recipes/80-test_cmp_http.t
+++ b/test/recipes/80-test_cmp_http.t
@@ -56,7 +56,7 @@ my @app = qw(openssl cmp);
 # the server-dependent client configuration consists of:
 my $ca_dn;      # The CA's Distinguished Name
 my $server_dn;  # The server's Distinguished Name
-my $server_host;# The server's hostname or IP address
+my $server_host;# The server's hostname or IP address, '*' means to be determined from server output
 my $server_port;# The server's port
 my $server_tls; # The server's TLS port, if any, or 0
 my $server_path;# The server's CMP alias
@@ -328,10 +328,12 @@ sub start_server {
     print "$server_name server PID=$pid\n";

     if ($server_host eq '*' || $server_port == 0) {
-        # Find out the actual server host and port and possibly different PID
+        my $server_output = "";
+        # Determine the actual server host and port and possibly different PID from server output
         my ($host, $port);
         my $pid0 = $pid;
         while (<$server_fh>) {
+            $server_output .= $_;
             print "$server_name server output: $_";
             next if m/[Uu]sing section/;
             s/\R$//;                # Better chomp
@@ -349,11 +351,11 @@ sub start_server {
             kill('KILL', $pid0);
             waitpid($pid0, 0);
         }
-    }
-    if ($server_host eq '*' || $server_port == 0) {
-        stop_server($server_name, $pid) if $pid;
-        print "Cannot get expected output from the $server_name server\n";
-        return 0;
+        if ($server_host eq '*' || $server_port == 0) {
+            stop_server($server_name, $pid) if $pid;
+            print "Cannot get server host and port from the $server_name server output: $server_output\n";
+            return 0;
+        }
     }
     $kur_port = $server_port if $kur_port eq "\$server_port";
     $pbm_port = $server_port if $pbm_port eq "\$server_port";
diff --git a/test/recipes/80-test_cmp_http_data/Mock/test.cnf b/test/recipes/80-test_cmp_http_data/Mock/test.cnf
index 3276001fec..7450eb692a 100644
--- a/test/recipes/80-test_cmp_http_data/Mock/test.cnf
+++ b/test/recipes/80-test_cmp_http_data/Mock/test.cnf
@@ -18,7 +18,7 @@ policies = certificatePolicies
 [Mock] # the built-in OpenSSL CMP mock server
 # no_check_time = 1
 server_host = * # to be determined by server: 127.0.0.1 or ::1 (localhost)
-server_port = 0 # 0 means that the port is determined by the server
+server_port = 0 # 0 means that the port is determined from server output
 server_tls = $server_port
 server_cert = server.crt
 # server = $server_host:$server_port