File 1101-small_SUITE-Unload-generated-test-modules.patch of Package erlang

From a64f45dd16ff7dd74c99fb8c84080bfb77f56f18 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Tue, 15 Aug 2023 14:45:27 +0200
Subject: [PATCH 1/7] small_SUITE: Unload generated test modules

---
 erts/emulator/test/small_SUITE.erl | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/erts/emulator/test/small_SUITE.erl b/erts/emulator/test/small_SUITE.erl
index 7d49522f05..2ab944d85e 100644
--- a/erts/emulator/test/small_SUITE.erl
+++ b/erts/emulator/test/small_SUITE.erl
@@ -139,6 +139,7 @@ addition(_Config) ->
     %% merl:print(Tree),
     {ok,_Bin} = merl:compile_and_load(Tree, []),
     test_addition(Fs0, Mod),
+    unload(Mod),
     ok.
 
 add_gen_pairs() ->
@@ -247,6 +248,7 @@ subtraction(_Config) ->
     %% merl:print(Tree),
     {ok,_Bin} = merl:compile_and_load(Tree, []),
     test_subtraction(Fs0, Mod),
+    unload(Mod),
     ok.
 
 sub_gen_pairs() ->
@@ -340,6 +342,7 @@ negation(_Config) ->
     merl:print(Tree),
     {ok,_Bin} = merl:compile_and_load(Tree, []),
     test_negation(Fs0, Mod),
+    unload(Mod),
     ok.
 
 neg_gen_integers() ->
@@ -405,6 +408,7 @@ multiplication(_Config) ->
     %% merl:print(Tree),
     {ok,_Bin} = merl:compile_and_load(Tree, []),
     test_multiplication(Fs0, Mod),
+    unload(Mod),
     ok.
 
 mul_gen_pairs() ->
@@ -507,6 +511,8 @@ division(_Config) ->
     3 = ignore_rem(ignore, 10, 3),
     1 = ignore_div(ignore, 16, 5),
 
+    unload(Mod),
+
     ok.
 
 ignore_rem(_, X, Y) ->
@@ -802,6 +808,7 @@ test_bitwise(_Config) ->
     merl:print(Tree),
     {ok,_Bin} = merl:compile_and_load(Tree, []),
     test_bitwise(Fs0, Mod),
+    unload(Mod),
 
     %% Test invalid operands.
     expect_badarith(fun(X) -> 42 band X end),
@@ -932,6 +939,7 @@ test_bsl(_Config) ->
     %% merl:print(Tree),
     {ok,_Bin} = merl:compile_and_load(Tree, []),
     test_bsl(Fs0, Mod),
+    unload(Mod),
     ok.
 
 bsl_gen_pairs() ->
@@ -1198,4 +1206,8 @@ determine_small_limits(N) ->
         false -> {-1 bsl (N - 1), (1 bsl (N - 1)) - 1}
     end.
 
+unload(Mod) ->
+    _ = code:delete(Mod),
+    code:purge(Mod).
+
 id(I) -> I.
-- 
2.35.3

openSUSE Build Service is sponsored by