File 0751-erts-Filter-ERL-env-flags-to-old-test-nodes.patch of Package erlang

From 23d7a7df0ca43d496a0cef884398a31aa2c25b2a Mon Sep 17 00:00:00 2001
From: Lukas Larsson <lukas@erlang.org>
Date: Fri, 1 Oct 2021 09:39:21 +0200
Subject: [PATCH 05/11] erts: Filter ERL env flags to old test nodes

---
 erts/emulator/test/hash_property_test_SUITE.erl | 13 ++++++++++++-
 erts/emulator/test/process_SUITE.erl            | 12 ++++++++++++
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/erts/emulator/test/hash_property_test_SUITE.erl b/erts/emulator/test/hash_property_test_SUITE.erl
index b4c7810a52..83f1158a5d 100644
--- a/erts/emulator/test/hash_property_test_SUITE.erl
+++ b/erts/emulator/test/hash_property_test_SUITE.erl
@@ -84,7 +84,18 @@ test_phash2_no_diff_between_versions(Config) when is_list(Config) ->
     case test_server:is_release_available(R) of
         true ->
             Rel = {release,R},
-            case test_server:start_node(rel21,peer,[{erl,[Rel]}]) of
+            %% We clear all ERL_FLAGS for the old node as all options may not
+            %% be supported.
+            ClearEnv = lists:foldl(
+                         fun({Key,_Value}, Acc) ->
+                                 case re:run(Key,"^ERL_.*FLAGS$") of
+                                     {match,_} ->
+                                         [{Key,""}|Acc];
+                                     nomatch ->
+                                         Acc
+                                 end
+                         end, [], os:env()),
+            case test_server:start_node(rel21,peer,[{erl,[Rel]},{env,ClearEnv}]) of
                 {error, Reason} -> {skip, io_lib:format("Could not start node: ~p~n", [Reason])};
                 {ok, Node} ->
                     try
diff --git a/erts/emulator/test/process_SUITE.erl b/erts/emulator/test/process_SUITE.erl
index d484eb8e42..a8e2197938 100644
--- a/erts/emulator/test/process_SUITE.erl
+++ b/erts/emulator/test/process_SUITE.erl
@@ -3128,6 +3128,17 @@ dist_spawn_monitor(Config) when is_list(Config) ->
 spawn_old_node(Config) when is_list(Config) ->
     Cookie = atom_to_list(erlang:get_cookie()),
     Rel = "22_latest",
+    %% We clear all ERL_FLAGS for the old node as all options may not
+    %% be supported.
+    ClearEnv = lists:foldl(
+                 fun({Key,_Value}, Acc) ->
+                         case re:run(Key,"^ERL_.*FLAGS$") of
+                             {match,_} ->
+                                 [{Key,""}|Acc];
+                             nomatch ->
+                                 Acc
+                         end
+                 end, [], os:env()),
     case test_server:is_release_available(Rel) of
 	false ->
 	    {skipped, "No OTP 22 available"};
@@ -3135,6 +3146,7 @@ spawn_old_node(Config) when is_list(Config) ->
 	    {ok, OldNode} = test_server:start_node(make_nodename(Config),
                                                    peer,
                                                    [{args, " -setcookie "++Cookie},
+                                                    {env, ClearEnv},
                                                     {erl, [{release, Rel}]}]),
             try
                 %% Spawns triggering a new connection; which
-- 
2.31.1

openSUSE Build Service is sponsored by