80-test_cmp_http.t: on test failures also print failed client invocations

Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26589)

(cherry picked from commit b1775ba4c9)
This commit is contained in:
Dr. David von Oheimb 2025-01-30 09:06:41 +01:00
parent e9060dd1cb
commit e73ed1bf1a
1 changed files with 19 additions and 9 deletions

View File

@ -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 (<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
@ -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 (<F>) {
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;