File 5416-compiler-Make-test_lib-robust-to-deterministic.patch of Package erlang

From a22b140e4f456a0b872f3205e59f8f0d4ced7114 Mon Sep 17 00:00:00 2001
From: Tom Davies <todavies5@gmail.com>
Date: Thu, 28 Apr 2022 06:24:42 -0700
Subject: [PATCH 6/7] compiler: Make test_lib robust to +deterministic

Makes test_lib avoid a crash if +deterministic is enabled to tests.
+deterministic strips the compilation options entirely, which test_lib
wasn't able to handle. Now, an empty list is returned in that case.
---
 lib/compiler/test/test_lib.erl | 56 ++++++++++++++++++----------------
 1 file changed, 30 insertions(+), 26 deletions(-)

diff --git a/lib/compiler/test/test_lib.erl b/lib/compiler/test/test_lib.erl
index 4f24310d15..39a887834c 100644
--- a/lib/compiler/test/test_lib.erl
+++ b/lib/compiler/test/test_lib.erl
@@ -82,32 +82,36 @@ uniq() ->
 
 opt_opts(Mod) ->
     Comp = Mod:module_info(compile),
-    {options,Opts} = lists:keyfind(options, 1, Comp),
-    lists:filter(fun
-                     (debug_info) -> true;
-                     (dialyzer) -> true;
-                     ({feature,_,enable}) -> true;
-                     ({feature,_,disable}) -> true;
-                     (inline) -> true;
-                     (no_bsm3) -> true;
-                     (no_bsm_opt) -> true;
-                     (no_copt) -> true;
-                     (no_fun_opt) -> true;
-                     (no_init_yregs) -> true;
-                     (no_make_fun3) -> true;
-                     (no_module_opt) -> true;
-                     (no_postopt) -> true;
-                     (no_put_tuple2) -> true;
-                     (no_recv_opt) -> true;
-                     (no_share_opt) -> true;
-                     (no_shared_fun_wrappers) -> true;
-                     (no_ssa_float) -> true;
-                     (no_ssa_opt) -> true;
-                     (no_stack_trimming) -> true;
-                     (no_swap) -> true;
-                     (no_type_opt) -> true;
-                     (_) -> false
-                end, Opts).
+    case lists:keyfind(options, 1, Comp) of
+        {options,Opts} ->
+            lists:filter(fun
+                            (debug_info) -> true;
+                            (dialyzer) -> true;
+                            (deterministic) -> true;
+                            ({enable_feature,_}) -> true;
+                            (inline) -> true;
+                            (no_bsm3) -> true;
+                            (no_bsm_opt) -> true;
+                            (no_copt) -> true;
+                            (no_fun_opt) -> true;
+                            (no_init_yregs) -> true;
+                            (no_make_fun3) -> true;
+                            (no_module_opt) -> true;
+                            (no_postopt) -> true;
+                            (no_put_tuple2) -> true;
+                            (no_recv_opt) -> true;
+                            (no_share_opt) -> true;
+                            (no_shared_fun_wrappers) -> true;
+                            (no_ssa_float) -> true;
+                            (no_ssa_opt) -> true;
+                            (no_stack_trimming) -> true;
+                            (no_swap) -> true;
+                            (no_type_opt) -> true;
+                            (_) -> false
+                         end, Opts);
+          %% `options` may not be set at all if +deterministic is enabled
+          false -> []
+    end.
 
 %% Some test suites gets cloned (e.g. to "record_SUITE" to
 %% "record_no_opt_SUITE"), but the data directory is not cloned.
-- 
2.35.3

openSUSE Build Service is sponsored by