summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Larsson <lukas@erlang.org>2021-11-30 14:05:28 +0100
committerLukas Larsson <lukas@erlang.org>2021-11-30 14:05:28 +0100
commit1f3be272f38d55133e66241b1e35cfe2fba7e214 (patch)
tree2092264170689dd2e3e849cc1dee20ced13338ab
parentedfcc01fec57baebf8fb629ffd47214048b1e520 (diff)
parent0a066e9970ee8c2201fac4facf044dd2eb6ad765 (diff)
downloaderlang-1f3be272f38d55133e66241b1e35cfe2fba7e214.tar.gz
Merge branch 'lukas/24/test-fixes' into maint
* lukas/24/test-fixes: erts: Fix unicode printing in statistics testcase erts: Unlink with nc checker to avoid noconnect signal erts: Restore the number of dirty schedulers in scheduler SUITE erts: Cleanup error_logger after max_heap testcase erts: Try to make dump_SUITE:abort_signal more stable erts: Only run perf tests on linux platforms with jit support erts: Filter ERL env flags to old test nodes erts: Handle length offset mark in debug function sasl: Allow beam.emu to be installed for testing erts: Fix port test error on MacOS catalina stdlib: Add comment about why unlink at supervisor shutdown
-rw-r--r--erts/emulator/beam/erl_proc_sig_queue.c1
-rw-r--r--erts/emulator/test/dump_SUITE.erl41
-rw-r--r--erts/emulator/test/hash_property_test_SUITE.erl13
-rw-r--r--erts/emulator/test/node_container_SUITE.erl20
-rw-r--r--erts/emulator/test/perf_SUITE.erl3
-rw-r--r--erts/emulator/test/port_SUITE.erl18
-rw-r--r--erts/emulator/test/process_SUITE.erl14
-rw-r--r--erts/emulator/test/scheduler_SUITE.erl5
-rw-r--r--erts/emulator/test/statistics_SUITE.erl7
-rw-r--r--lib/sasl/test/systools_SUITE.erl2
-rw-r--r--lib/stdlib/src/supervisor.erl2
11 files changed, 91 insertions, 35 deletions
diff --git a/erts/emulator/beam/erl_proc_sig_queue.c b/erts/emulator/beam/erl_proc_sig_queue.c
index f488b64772..46bdbb277d 100644
--- a/erts/emulator/beam/erl_proc_sig_queue.c
+++ b/erts/emulator/beam/erl_proc_sig_queue.c
@@ -7490,6 +7490,7 @@ erts_proc_sig_debug_foreach_sig(Process *c_p,
case ERTS_SIG_Q_OP_TRACE_CHANGE_STATE:
case ERTS_SIG_Q_OP_PROCESS_INFO:
case ERTS_SIG_Q_OP_RECV_MARK:
+ case ERTS_SIG_Q_OP_MSGQ_LEN_OFFS_MARK:
break;
default:
diff --git a/erts/emulator/test/dump_SUITE.erl b/erts/emulator/test/dump_SUITE.erl
index 31a80434c7..08e2e682b8 100644
--- a/erts/emulator/test/dump_SUITE.erl
+++ b/erts/emulator/test/dump_SUITE.erl
@@ -68,19 +68,29 @@ signal_abort(Config) ->
{ok, Node} = start_node(Config),
- SO = rpc:call(Node, erlang, system_info, [schedulers_online]),
-
- Iter = lists:seq(0, 5),
-
- [spawn_opt(Node, ?MODULE, load, [self()], [{scheduler, (I rem SO) + 1}])
- || I <- Iter],
-
- %% Make sure that each process is started
- [receive ok -> ok end || _ <- Iter],
- timer:sleep(500),
-
- true = rpc:call(Node, os, putenv, ["ERL_CRASH_DUMP",Dump]),
- rpc:call(Node, erlang, halt, ["dump"]),
+ false = rpc:call(Node, erts_debug, set_internal_state,
+ [available_internal_state, true]),
+
+ Iter = lists:seq(2, 3),
+
+ spawn_opt(Node,
+ fun() ->
+ os:putenv("ERL_CRASH_DUMP", Dump),
+ code:ensure_loaded(timer),
+
+ %% We spread the load on all schedulers except scheduler 1
+ [spawn_opt(?MODULE, load, [self()], [{scheduler, I}])
+ || I <- Iter],
+
+ %% Make sure that each process is started
+ [receive ok -> ok end || _ <- Iter],
+ timer:sleep(500),
+ erlang:halt("dump")
+ end,
+ [{scheduler,1},{priority,high}, monitor]),
+ receive
+ M -> ct:pal("~p",[M])
+ end,
{ok, Bin} = get_dump_when_done(Dump),
@@ -98,7 +108,8 @@ load(Parent) ->
Parent ! ok,
load().
load() ->
- lists:seq(1,10000),
+ %% We generate load by sleeping
+ erts_debug:set_internal_state(sleep, 10),
load().
@@ -214,7 +225,7 @@ get_dump_when_done(Dump) ->
get_dump_when_done(Dump, Sz) ->
timer:sleep(1000),
case file:read_file_info(Dump) of
- {ok, #file_info{ size = Sz }} ->
+ {ok, #file_info{ size = Sz }} when Sz > 1000 ->
{ok, Bin} = file:read_file(Dump),
ct:log("~s",[Bin]),
{ok, Bin};
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/node_container_SUITE.erl b/erts/emulator/test/node_container_SUITE.erl
index 161968fe0d..3f781170a4 100644
--- a/erts/emulator/test/node_container_SUITE.erl
+++ b/erts/emulator/test/node_container_SUITE.erl
@@ -1037,21 +1037,23 @@ nc_refc_check(Node) when is_atom(Node) ->
Ref = make_ref(),
Self = self(),
io:format("Starting reference count check of node ~w~n", [Node]),
- spawn_link(Node,
- fun () ->
- erts_test_utils:check_node_dist(
- fun (ErrMsg) ->
- Self ! {Ref, ErrMsg, failed},
- exit(normal)
- end),
- Self ! {Ref, succeded}
- end),
+ Pid = spawn_link(
+ Node,
+ fun () ->
+ erts_test_utils:check_node_dist(
+ fun (ErrMsg) ->
+ Self ! {Ref, ErrMsg, failed},
+ exit(normal)
+ end),
+ Self ! {Ref, succeded}
+ end),
receive
{Ref, ErrorMsg, failed} ->
io:format("~s~n", [ErrorMsg]),
ct:fail(reference_count_check_failed);
{Ref, succeded} ->
io:format("Reference count check of node ~w succeded!~n", [Node]),
+ unlink(Pid),
ok
end.
diff --git a/erts/emulator/test/perf_SUITE.erl b/erts/emulator/test/perf_SUITE.erl
index aaef7b039c..b5483fcc8a 100644
--- a/erts/emulator/test/perf_SUITE.erl
+++ b/erts/emulator/test/perf_SUITE.erl
@@ -30,7 +30,8 @@ all() ->
[symbols, annotate].
init_per_suite(Config) ->
- case os:find_executable("perf") of
+ case erlang:system_info(emu_flavor) =:= jit andalso
+ os:find_executable("perf") =/= false of
false ->
{skip, "perf not found"};
_Perf ->
diff --git a/erts/emulator/test/port_SUITE.erl b/erts/emulator/test/port_SUITE.erl
index e7f93b103e..b6910fb378 100644
--- a/erts/emulator/test/port_SUITE.erl
+++ b/erts/emulator/test/port_SUITE.erl
@@ -1493,6 +1493,8 @@ otp_4389(Config) when is_list(Config) ->
{unix, _} ->
ct:timetrap({minutes, 4}),
TCR = self(),
+ %% On MacOS Catalina libc can return enoent instead of emfile for cwd
+ BrokenCWD = (os:type() =:= {unix,darwin}) andalso element(1,os:version()) == 19,
case get_true_cmd() of
True when is_list(True) ->
lists:foreach(
@@ -1513,16 +1515,20 @@ otp_4389(Config) when is_list(Config) ->
receive
{P,{exit_status,_}} ->
TCR ! {self(),ok};
- {'EXIT',_,{R2,_}} when R2 == emfile;
- R2 == eagain;
- R2 == enomem ->
+ {'EXIT',_,{R2,_}}
+ when R2 == emfile;
+ R2 == eagain;
+ R2 == enomem;
+ R2 == enoent andalso BrokenCWD ->
TCR ! {self(),ok};
Err2 ->
TCR ! {self(),{msg,Err2}}
end;
- {'EXIT',{R1,_}} when R1 == emfile;
- R1 == eagain;
- R1 == enomem ->
+ {'EXIT',{R1,_}}
+ when R1 == emfile;
+ R1 == eagain;
+ R1 == enomem;
+ R1 == enoent andalso BrokenCWD ->
TCR ! {self(),ok};
Err1 ->
TCR ! {self(), {open_port,Err1}}
diff --git a/erts/emulator/test/process_SUITE.erl b/erts/emulator/test/process_SUITE.erl
index d484eb8e42..bd6202f333 100644
--- a/erts/emulator/test/process_SUITE.erl
+++ b/erts/emulator/test/process_SUITE.erl
@@ -2308,6 +2308,8 @@ spawn_opt_max_heap_size(_Config) ->
%% Test that ordinary case works as expected again
max_heap_size_test(1024, 1024, true, true),
+ error_logger:delete_report_handler(?MODULE),
+
ok.
max_heap_size_test(Option, Size, Kill, ErrorLogger)
@@ -3128,6 +3130,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 +3148,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
diff --git a/erts/emulator/test/scheduler_SUITE.erl b/erts/emulator/test/scheduler_SUITE.erl
index faf16a96ef..f1683769dc 100644
--- a/erts/emulator/test/scheduler_SUITE.erl
+++ b/erts/emulator/test/scheduler_SUITE.erl
@@ -94,6 +94,7 @@ end_per_suite(Config) ->
catch erts_debug:set_internal_state(available_internal_state, false),
SchedOnln = proplists:get_value(schedulers_online, Config),
erlang:system_flag(schedulers_online, SchedOnln),
+ erlang:system_flag(dirty_cpu_schedulers_online, SchedOnln),
Config.
init_per_testcase(update_cpu_info, Config) ->
@@ -1248,10 +1249,12 @@ scheduler_suspend_basic(Config) when is_list(Config) ->
{skip, "Nothing to test"};
_ ->
Onln = erlang:system_info(schedulers_online),
+ DirtyOnln = erlang:system_info(dirty_cpu_schedulers_online),
try
scheduler_suspend_basic_test()
after
- erlang:system_flag(schedulers_online, Onln)
+ erlang:system_flag(schedulers_online, Onln),
+ erlang:system_flag(dirty_cpu_schedulers_online, DirtyOnln)
end
end.
diff --git a/erts/emulator/test/statistics_SUITE.erl b/erts/emulator/test/statistics_SUITE.erl
index 90fbedb94a..155ec28323 100644
--- a/erts/emulator/test/statistics_SUITE.erl
+++ b/erts/emulator/test/statistics_SUITE.erl
@@ -341,9 +341,9 @@ run_scheduler_wall_time_test(Type) ->
Schedulers + DirtyCPUSchedulers
end,
- Env = [io_lib:format("~s~n",[KV]) || KV <- os:getenv()],
+ Env = [io_lib:format("~ts~n",[KV]) || KV <- os:getenv()],
- ct:log("Env:~n~s",[Env]),
+ ct:log("Env:~n~ts",[Env]),
ct:log("Schedulers: ~p~n"
"SchedulersOnline: ~p~n"
@@ -356,6 +356,9 @@ run_scheduler_wall_time_test(Type) ->
DirtyCPUSchedulers,
DirtyIOSchedulers]),
+ %% Assert that number of schedulers is the same as number of dirty schedulers
+ Schedulers = DirtyCPUSchedulers,
+
%% Let testserver and everyone else finish their work
timer:sleep(1500),
%% Empty load
diff --git a/lib/sasl/test/systools_SUITE.erl b/lib/sasl/test/systools_SUITE.erl
index 47669b3c99..f12b2f2830 100644
--- a/lib/sasl/test/systools_SUITE.erl
+++ b/lib/sasl/test/systools_SUITE.erl
@@ -1111,6 +1111,8 @@ erts_tar(Config) ->
string:equal(filename:dirname(File),ERTS_DIR),
%% Filter out beam.*.smp.*
re:run(filename:basename(File), "beam\\.[^\\.]+\\.smp(\\.dll)?") == nomatch,
+ %% Filter out beam.*.emu.*
+ re:run(filename:basename(File), "beam\\.([^\\.]+\\.)?emu(\\.dll)?") == nomatch,
%% Filter out any erl_child_setup.*
re:run(filename:basename(File), "erl_child_setup\\..*") == nomatch
])
diff --git a/lib/stdlib/src/supervisor.erl b/lib/stdlib/src/supervisor.erl
index 17e714fcc0..7208068f4e 100644
--- a/lib/stdlib/src/supervisor.erl
+++ b/lib/stdlib/src/supervisor.erl
@@ -969,6 +969,8 @@ shutdown(#child{pid=Pid, shutdown=Time} = Child) ->
end.
unlink_flush(Pid, DefaultReason) ->
+ %% We call unlink in order to guarantee that the 'EXIT' has arrived
+ %% from the dead process. See the unlink docs for details.
unlink(Pid),
receive
{'EXIT', Pid, Reason} ->