Skip to content

Commit 87bfbed

Browse files
committed
openssl: fix 05-test_rand
As of OpenSSL v3.1.4, there is a pair of new test failures in 05-test_rand. The symptom looks like this: Engine "ossltest" set. ../../util/wrap.pl ../../apps/openssl.exe rand -engine ossltest -hex 16 => 0 not ok 4 - rand with ossltest: Check rand output is as expected # Failed test 'rand with ossltest: Check rand output is as expected' # at ../openssl-3.1.4/test/recipes/05-test_rand.t line 32. Engine "dasync" set. ../../util/wrap.pl ../../apps/openssl.exe rand -engine dasync -hex 16 => 0 not ok 5 - rand with dasync: Check rand output is of expected length The two failing tests both spawn an engine, which by virtue of being MINGW `.dll` files use CR/LF when printing to `stdout`. To accommodate for that, use the same "better chomp" as elsewhere in OpenSSL's source code. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent fb9fc20 commit 87bfbed

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
From 820803594c31daa2c96921f2d7888c88b1edc97e Mon Sep 17 00:00:00 2001
2+
From: Johannes Schindelin <[email protected]>
3+
Date: Wed, 25 Oct 2023 17:10:17 +0200
4+
Subject: [PATCH] test_rand: use the "better chomp"
5+
6+
Following in the footsteps of
7+
https://github.com/openssl/openssl/commit/9ba96fbb2523cb12747c559c704c58bd8f9e7982
8+
(Perl's chop / chomp considered bad, use a regexp instead, 2016-02-11),
9+
let's not use `chomp()` here because it would leave Carriage Returns in
10+
place, making the test fail in the MINGW build on Windows.
11+
12+
Signed-off-by: Johannes Schindelin <[email protected]>
13+
---
14+
test/recipes/05-test_rand.t | 4 ++--
15+
1 file changed, 2 insertions(+), 2 deletions(-)
16+
17+
diff --git a/test/recipes/05-test_rand.t b/test/recipes/05-test_rand.t
18+
index aa012c1..f2c1374 100644
19+
--- a/test/recipes/05-test_rand.t
20+
+++ b/test/recipes/05-test_rand.t
21+
@@ -28,13 +28,13 @@ SKIP: {
22+
23+
@randdata = run(app(['openssl', 'rand', '-engine', 'ossltest', '-hex', '16' ]),
24+
capture => 1, statusvar => \$success);
25+
- chomp(@randdata);
26+
+ $_ =~ s|\R+$|| for @randdata;
27+
ok($success && $randdata[0] eq $expected,
28+
"rand with ossltest: Check rand output is as expected");
29+
30+
@randdata = run(app(['openssl', 'rand', '-engine', 'dasync', '-hex', '16' ]),
31+
capture => 1, statusvar => \$success);
32+
- chomp(@randdata);
33+
+ $_ =~ s|\R+$|| for @randdata;
34+
ok($success && length($randdata[0]) == 32,
35+
"rand with dasync: Check rand output is of expected length");
36+
}
37+
--
38+
2.42.0.windows.2
39+

mingw-w64-openssl/PKGBUILD

+4-1
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@ options=('!strip' '!buildflags')
2121
source=("https://www.openssl.org/source/openssl-${pkgver}.tar.gz"{,.asc}
2222
'001-support-aarch64.patch'
2323
'002-relocation.patch'
24+
'0001-test_rand-use-the-better-chomp.patch'
2425
'pathtools.c'
2526
'pathtools.h')
2627
sha256sums=('840af5366ab9b522bde525826be3ef0fb0af81c6a9ebd84caa600fea1731eee3'
2728
'SKIP'
2829
'21b96771b401442570e885c2d5689a359a91e86dcbf5511db3667202b6c1fa8a'
2930
'5628dd39ab0d3ce4afbb5207bab5d22766abc86a8875b48b6d4d3efd68550e68'
31+
'56fcd20131ae0c563db18ae00c6ba3b95cd9cb1e9934548079284ba3f52ad250'
3032
'08209cbf1633fa92eae7e5d28f95f8df9d6184cc20fa878c99aec4709bb257fd'
3133
'965d3921ec4fdeec94a2718bc2c85ce5e1a00ea0e499330a554074a7ae15dfc6')
3234

@@ -54,7 +56,8 @@ prepare() {
5456

5557
apply_patch_with_msg \
5658
001-support-aarch64.patch \
57-
002-relocation.patch
59+
002-relocation.patch \
60+
0001-test_rand-use-the-better-chomp.patch
5861

5962
test ! -d "${startdir}/../mingw-w64-pathtools" || {
6063
cmp "${startdir}/../mingw-w64-pathtools/pathtools.c" "${srcdir}/pathtools.c" &&

0 commit comments

Comments
 (0)