From: Dr. David von Oheimb Date: Wed, 29 Jan 2025 17:59:49 +0000 (+0100) Subject: 80-test_cmp_http.t: on test failures print Mock server STDERR output X-Git-Tag: openssl-3.3.3~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b19a483178d66fd700ce27a79be10153563a8f30;p=thirdparty%2Fopenssl.git 80-test_cmp_http.t: on test failures print Mock server STDERR output Reviewed-by: Bernd Edlinger Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/26589) (cherry picked from commit e7c6c5e0885b797c67a363802072fd1df2c54558) --- diff --git a/test/recipes/80-test_cmp_http.t b/test/recipes/80-test_cmp_http.t index 7b8a5b237b3..72ad76c80bd 100644 --- a/test/recipes/80-test_cmp_http.t +++ b/test/recipes/80-test_cmp_http.t @@ -130,11 +130,10 @@ my @all_aspects = ("connection", "verification", "credentials", "commands", "enr @all_aspects = split /\s+/, $ENV{OPENSSL_CMP_ASPECTS} if $ENV{OPENSSL_CMP_ASPECTS}; # set env variable, e.g., OPENSSL_CMP_ASPECTS="commands enrollment" to select specific aspects +my $Mock_serverlog; my $faillog; -my $file = $ENV{HARNESS_FAILLOG}; # pathname relative to result_dir -if ($file) { - open($faillog, ">", $file) or die "Cannot open '$file' for writing: $!"; -} +my $file = $ENV{HARNESS_FAILLOG} // "failed_client_invocations.txt"; # pathname relative to result_dir +open($faillog, ">", $file) or die "Cannot open '$file' for writing: $!"; sub test_cmp_http { my $server_name = shift; @@ -215,8 +214,23 @@ indir data_dir() => sub { test_cmp_http_aspect($server_name, $aspect, $tests); }; }; - stop_server($server_name, $pid) if $pid; - ok(1, "$server_name server has terminated"); + + if ($server_name eq "Mock") { + stop_server($server_name, $pid) if $pid; + ok(1, "$server_name server has terminated"); + + 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; + } + } + } + } } } }; @@ -293,7 +307,8 @@ sub start_server { $args ? $args : ()]), display => 1); print "Current directory is ".getcwd()."\n"; print "Launching $server_name server: $cmd\n"; - my $pid = open($server_fh, "$cmd 2>".result_dir()."/error.txt |"); + $Mock_serverlog = result_dir()."/Mock_server_STDERR.txt"; + my $pid = open($server_fh, "$cmd 2>$Mock_serverlog |"); unless ($pid) { print "Error launching $cmd, cannot obtain $server_name server PID"; return 0;