File 0553-crypto-Cuddle-crypto_SUITE-info.patch of Package erlang

From ef4d6c12d794923dac6db8096db2210c33a13137 Mon Sep 17 00:00:00 2001
From: Sverker Eriksson <sverker@erlang.org>
Date: Thu, 27 Oct 2022 15:58:39 +0200
Subject: [PATCH] crypto: Cuddle crypto_SUITE:info

on SUSE where OpenSSL version strings differ slightly

header: "OpenSSL 1.1.1l  24 Aug 2021 SUSE release SUSE_OPENSSL_RELEASE"
in lib: "OpenSSL 1.1.1l  24 Aug 2021 SUSE release 150400.7.7.1"
---
 lib/crypto/test/crypto_SUITE.erl | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/lib/crypto/test/crypto_SUITE.erl b/lib/crypto/test/crypto_SUITE.erl
index 959e1a09a0..a2adaf8ed0 100644
--- a/lib/crypto/test/crypto_SUITE.erl
+++ b/lib/crypto/test/crypto_SUITE.erl
@@ -1432,17 +1432,31 @@ rand_plugin_s(Config) when is_list(Config) ->
 %%--------------------------------------------------------------------
 info(_Config) ->
     [{_,_,VerBin}] = crypto:info_lib(),
-    Ver = binary:bin_to_list(VerBin),
+    LibVer = binary:bin_to_list(VerBin),
     try
         crypto:info()
     of
-        #{cryptolib_version_compiled := Ver,
-          cryptolib_version_linked := Ver,
+        #{cryptolib_version_compiled := LibVer,
+          cryptolib_version_linked := LibVer,
           compile_type := Tc,
           link_type := Tl} when is_atom(Tc), is_atom(Tl) ->
             ok;
+
+        %% Version strings in header vs lib seen to differ slightly on SUSE
+        %% but OpenSSL version numbers should be the same
+        #{cryptolib_version_compiled := CompVer,
+          cryptolib_version_linked := LibVer,
+          compile_type := Tc,
+          link_type := Tl} when is_atom(Tc), is_atom(Tl) ->
+            RE = "OpenSSL (\\d+\\.\\d+\\.\\d+.)",
+            Opts = [{capture,first,list}],
+            {match,[CompV]} = re:run(CompVer, RE, Opts),
+            {match,[LinkV]} = re:run(LibVer, RE, Opts),
+            {CompV,CompV} = {CompV,LinkV},
+            ok;
+
         Other ->
-            ct:log("Ver = ~p~ncrypto:info() -> ~p", [Ver,Other]),
+            ct:log("LibVer = ~p~ncrypto:info() -> ~p", [LibVer,Other]),
             ct:fail("Version mismatch", [])
     catch
         C:E ->
-- 
2.35.3

openSUSE Build Service is sponsored by