Commit c1630bfa1d for openssl.org
commit c1630bfa1da0a1aa405d01e96e7dfbd738e15eb2
Author: Milan Broz <gmazyland@gmail.com>
Date: Sat Mar 21 13:50:37 2026 +0100
test: Fix test_rand to check output length (and run silently)
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)
diff --git a/test/recipes/05-test_rand.t b/test/recipes/05-test_rand.t
index 73a163d4d1..d70b65c649 100644
--- a/test/recipes/05-test_rand.t
+++ b/test/recipes/05-test_rand.t
@@ -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");
}