Skip to content

Commit

Permalink
tests: Limit the number of parallel processes on 32-bit systems
Browse files Browse the repository at this point in the history
When running tests for the `asn1` and `compiler` applications on
32-bit systems, limit the number of concurrent processes that the
`p_run/2` helper will spawn to a single process. This should make it
less likely that virtual address space or memory is exhausted,
especially on Windws, where only 2 GB of virtual address space is
available.
  • Loading branch information
bjorng committed Oct 11, 2024
1 parent 699f706 commit 6581757
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
10 changes: 6 additions & 4 deletions lib/asn1/test/asn1_test_lib.erl
Original file line number Diff line number Diff line change
Expand Up @@ -307,16 +307,18 @@ ber_get_len(<<1:1,Octets:7,T0/binary>>) ->

p_run(Test, List) ->
%% Limit the number of parallel processes to avoid running out of
%% memory.
%% virtual address space or memory. This is especially important
%% on 32-bit Windows, where only 2 GB of virtual address space is
%% available.
S = case {erlang:system_info(schedulers),erlang:system_info(wordsize)} of
{S0,4} ->
min(S0, 2);
{_,4} ->
1;
{S0,_} ->
min(S0, 8)
end,
N = case test_server:is_cover() of
false ->
S + 1;
S;
true ->
%% Cover is running. Using too many processes
%% could slow us down.
Expand Down
15 changes: 8 additions & 7 deletions lib/compiler/test/test_lib.erl
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,15 @@ highest_opcode(Beam) ->

p_run(Test, List) ->
%% Limit the number of parallel processes to avoid running out of
%% memory.
S = case {erlang:system_info(schedulers),erlang:system_info(wordsize)} of
{S0,4} ->
min(S0, 2);
{S0,8} ->
min(S0, 8)
%% virtual address space or memory. This is especially important
%% on 32-bit Windows, where only 2 GB of virtual address space is
%% available.
N = case {erlang:system_info(schedulers),erlang:system_info(wordsize)} of
{_,4} ->
1;
{N0,8} ->
min(N0, 8)
end,
N = S + 1,
p_run(Test, List, N).

p_run(Test, List, N) ->
Expand Down

0 comments on commit 6581757

Please sign in to comment.