From d00be9f38760b5f143a7cdecf6c61ad6316f4cc8 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Wed, 2 Jun 2021 08:14:08 +0200 Subject: [PATCH] test/recipes/80-test_cmp_http.t: Simplify test_cmp_http() test_cmp_http() made some assumptions about what values that exit_checker could get that aren't quite right. Furthermore, the expected result isn't about exit codes, but about true or false. This is better served by getting the value from OpenSSL::Test::run(), and checking that value against $expected_result with Test::More::is(). Fixes #15557 Fixes #15571 Reviewed-by: David von Oheimb (Merged from https://github.com/openssl/openssl/pull/15580) --- test/recipes/80-test_cmp_http.t | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/test/recipes/80-test_cmp_http.t b/test/recipes/80-test_cmp_http.t index 910c751eec4..fbd7470ff00 100644 --- a/test/recipes/80-test_cmp_http.t +++ b/test/recipes/80-test_cmp_http.t @@ -12,7 +12,7 @@ use strict; use warnings; use POSIX; -use OpenSSL::Test qw/:DEFAULT with data_file data_dir srctop_dir bldtop_dir result_dir/; +use OpenSSL::Test qw/:DEFAULT data_file data_dir srctop_dir bldtop_dir result_dir/; use OpenSSL::Test::Utils; BEGIN { @@ -133,19 +133,17 @@ sub test_cmp_http { $params = [ '-server', "127.0.0.1:$server_port", @$params ] unless grep { $_ eq '-server' } @$params; - with({ exit_checker => sub { - my $actual_result = shift == 0; - my $OK = $actual_result == $expected_result; - if ($faillog && !$OK) { + unless (is(my $actual_result = run(cmd([$path_app, @$params,])), + $expected_result, + $title)) { + if ($faillog) { my $quote_spc_empty = sub { $_ eq "" ? '""' : $_ =~ m/ / ? '"'.$_.'"' : $_ }; my $invocation = "$path_app ".join(' ', map $quote_spc_empty->($_), @$params); print $faillog "$server_name $aspect \"$title\" ($i/$n)". " expected=$expected_result actual=$actual_result\n"; print $faillog "$invocation\n\n"; } - return $OK; } }, - sub { ok(run(cmd([$path_app, @$params,])), - $title); }); + } } sub test_cmp_http_aspect { -- 2.47.3