File 1104-compile_SUITE-Make-core_roundtrip-1-less-resource-in.patch of Package erlang

From 4551d6bbcfd417ff46b7294a88366f7d1c955d64 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Tue, 1 Nov 2022 14:49:32 +0100
Subject: [PATCH 4/4] compile_SUITE: Make core_roundtrip/1 less
 resource-intensive

---
 lib/compiler/test/compile_SUITE.erl | 13 +++++++++++--
 lib/compiler/test/test_lib.erl      |  9 +++++++--
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/lib/compiler/test/compile_SUITE.erl b/lib/compiler/test/compile_SUITE.erl
index 0071fb3dc1..cbe7179e0a 100644
--- a/lib/compiler/test/compile_SUITE.erl
+++ b/lib/compiler/test/compile_SUITE.erl
@@ -1130,7 +1130,7 @@ do_core_pp_1(M, A, Outdir) ->
     compile_forms(M, Core, [clint,ssalint,from_core,binary]),
 
     %% Don't optimize to test that we are not dependent
-    %% on the Core Erlang optmimization passes.
+    %% on the Core Erlang optimization passes.
     %% (Example of a previous bug: The core_parse pass
     %% would not turn map literals into #c_literal{}
     %% records; if sys_core_fold was run it would fix
@@ -1154,7 +1154,16 @@ core_roundtrip(Config) ->
     ok = file:make_dir(Outdir),
 
     TestBeams = get_unique_beam_files(),
-    test_lib:p_run(fun(F) -> do_core_roundtrip(F, Outdir) end, TestBeams).
+
+    Test = fun(F) -> do_core_roundtrip(F, Outdir) end,
+    case erlang:system_info(wordsize) of
+        4 ->
+            %% This test case is very memory intensive. Only
+            %% use a single process.
+            test_lib:p_run(Test, TestBeams, 1);
+        8 ->
+            test_lib:p_run(Test, TestBeams)
+    end.
 
 do_core_roundtrip(Beam, Outdir) ->
     try
diff --git a/lib/compiler/test/test_lib.erl b/lib/compiler/test/test_lib.erl
index 0328ed9f26..c4d377e4f1 100644
--- a/lib/compiler/test/test_lib.erl
+++ b/lib/compiler/test/test_lib.erl
@@ -23,7 +23,7 @@
 -compile({no_auto_import,[binary_part/2]}).
 -export([id/1,recompile/1,recompile_core/1,parallel/0,
          uniq/0,opt_opts/1,get_data_dir/1,
-         is_cloned_mod/1,smoke_disasm/1,p_run/2,
+         is_cloned_mod/1,smoke_disasm/1,p_run/2,p_run/3,
          highest_opcode/1]).
 
 %% Used by test case that override BIFs.
@@ -139,6 +139,7 @@ is_cloned_mod(Mod) ->
 is_cloned_mod_1("_no_opt_SUITE") -> true;
 is_cloned_mod_1("_no_copt_SUITE") -> true;
 is_cloned_mod_1("_no_ssa_opt_SUITE") -> true;
+is_cloned_mod_1("_no_type_opt_SUITE") -> true;
 is_cloned_mod_1("_post_opt_SUITE") -> true;
 is_cloned_mod_1("_inline_SUITE") -> true;
 is_cloned_mod_1("_21_SUITE") -> true;
@@ -166,7 +167,11 @@ p_run(Test, List) ->
                 min(S0, 8)
         end,
     N = S + 1,
-    io:format("p_run: ~p parallel processes\n", [N]),
+    p_run(Test, List, N).
+
+p_run(Test, List, N) ->
+    io:format("p_run: ~p parallel processes; ~p jobs\n",
+              [N,length(List)]),
     p_run_loop(Test, List, N, [], 0, 0).
 
 p_run_loop(_, [], _, [], Errors, Ws) ->
-- 
2.35.3

openSUSE Build Service is sponsored by