]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
80-test_cmp_http.t: on test failures also print failed client invocations
authorDr. David von Oheimb <dev@ddvo.net>
Thu, 30 Jan 2025 08:06:41 +0000 (09:06 +0100)
committerDr. David von Oheimb <dev@ddvo.net>
Mon, 3 Feb 2025 07:36:10 +0000 (08:36 +0100)
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26589)

test/recipes/80-test_cmp_http.t

index 50c06cacbdb20df644bccc920a274006a4db93fb..8d398248cce077e998fb776ef80e6ca4709ecc47 100644 (file)
@@ -134,8 +134,8 @@ my @all_aspects = ("connection", "verification", "credentials", "commands", "enr
 
 my $Mock_serverlog;
 my $faillog;
-my $file = $ENV{HARNESS_FAILLOG} // "failed_client_invocations.txt"; # pathname relative to result_dir
-open($faillog, ">", $file) or die "Cannot open '$file' for writing: $!";
+my $faillog_file = $ENV{HARNESS_FAILLOG} // "failed_client_invocations.txt"; # pathname relative to result_dir
+open($faillog, ">", $faillog_file) or die "Cannot open '$faillog_file' for writing: $!";
 
 sub test_cmp_http {
     my $server_name = shift;
@@ -178,6 +178,17 @@ sub test_cmp_http_aspect {
     # not unlinking test.cert.pem, test.cacerts.pem, and test.extracerts.pem
 }
 
+sub print_file_prefixed {
+    my ($file, $desc) = @_;
+    print "$desc (each line prefixed by \"# \"):\n";
+    if (open F, $file) {
+        while (<F>) {
+            print "# $_";
+        }
+        close F;
+    }
+}
+
 # The input files for the tests done here dynamically depend on the test server
 # selected (where the mock server used by default is just one possibility).
 # On the other hand the main test configuration file test.cnf, which references
@@ -223,13 +234,7 @@ indir data_dir() => sub {
 
                 if (-s $faillog) {
                     indir "Mock" => sub {
-                        print "$server_name server STDERR output is (each line prefixed by \"# \"):\n";
-                        if (open F, $Mock_serverlog) {
-                            while (<F>) {
-                                print "# $_";
-                            }
-                            close F;
-                        }
+                        print_file_prefixed($Mock_serverlog, "$server_name server STDERR output is");
                     }
                 }
             }
@@ -239,6 +244,11 @@ indir data_dir() => sub {
 };
 
 close($faillog) if $faillog;
+if (-s $faillog_file) {
+    print "# ------------------------------------------------------------------------------\n";
+    print_file_prefixed($faillog_file, "Failed client invocations are");
+    print "# ------------------------------------------------------------------------------\n";
+}
 
 sub load_tests {
     my $server_name = shift;