]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
test: Fix test_rand to check output length (and run silently)
authorMilan Broz <gmazyland@gmail.com>
Sat, 21 Mar 2026 12:50:37 +0000 (13:50 +0100)
committerTomas Mraz <tomas@openssl.foundation>
Tue, 24 Mar 2026 17:04:16 +0000 (18:04 +0100)
When running tests on Windows, the last test command in test_rand
is mixed with test output.

  perl.exe ..\..\util\wrap.pl ..\..\apps\openssl.exe rand
  -hex 2K => 0[14:11:00] 05-test_rand.t ......

As there is also missing actual check for output length,
fix both problems by adding simple check for expected length.

Signed-off-by: Milan Broz <gmazyland@gmail.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Mar 24 17:04:22 2026
(Merged from https://github.com/openssl/openssl/pull/30521)

test/recipes/05-test_rand.t

index 73a163d4d102114c7abe0a3b7fa6e0948be7f906..d70b65c64928e6f3ae7263838f4e57fafa29f3de 100644 (file)
@@ -13,7 +13,7 @@ use OpenSSL::Test::Utils;
 use OpenSSL::Test qw/:DEFAULT srctop_file bldtop_dir/;
 use Cwd qw(abs_path);
 
-plan tests => 5;
+plan tests => 6;
 setup("test_rand");
 
 ok(run(test(["rand_test", srctop_file("test", "default.cnf")])));
@@ -41,8 +41,15 @@ SKIP: {
     chomp(@randdata);
     ok($success && $randdata[0] eq $expected,
        "rand with ossltest provider: Check rand output is as expected");
+}
+
+{
+    my $success;
+    my @randdata;
 
     @randdata = run(app(['openssl', 'rand', '-hex', '2K' ]),
                     capture => 1, statusvar => \$success);
     chomp(@randdata);
+    ok($success && length($randdata[0]) == 4096,
+       "rand: Check rand output is of expected length");
 }