From b1775ba4c9eff94df2a6395e2430749f7a7b259d Mon Sep 17 00:00:00 2001 From: "Dr. David von Oheimb" Date: Thu, 30 Jan 2025 09:06:41 +0100 Subject: [PATCH] 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) --- test/recipes/80-test_cmp_http.t | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/test/recipes/80-test_cmp_http.t b/test/recipes/80-test_cmp_http.t index 50c06cacbdb..8d398248cce 100644 --- a/test/recipes/80-test_cmp_http.t +++ b/test/recipes/80-test_cmp_http.t @@ -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 () { + 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 () { - 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; -- 2.47.2