From: Dr. David von Oheimb Date: Thu, 30 Jan 2025 08:06:41 +0000 (+0100) Subject: 80-test_cmp_http.t: on test failures also print failed client invocations X-Git-Tag: openssl-3.3.3~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=beeeca8b836827484c45137b43d0c1fb2793fe76;p=thirdparty%2Fopenssl.git 80-test_cmp_http.t: on test failures also print failed client invocations Reviewed-by: Bernd Edlinger Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/26589) (cherry picked from commit b1775ba4c9eff94df2a6395e2430749f7a7b259d) --- diff --git a/test/recipes/80-test_cmp_http.t b/test/recipes/80-test_cmp_http.t index 72ad76c80bd..847bd594e48 100644 --- a/test/recipes/80-test_cmp_http.t +++ b/test/recipes/80-test_cmp_http.t @@ -132,8 +132,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; @@ -176,6 +176,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 () { + 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 @@ -221,13 +232,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 () { - print "# $_"; - } - close F; - } + print_file_prefixed($Mock_serverlog, "$server_name server STDERR output is"); } } } @@ -237,6 +242,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;