diff options
Diffstat (limited to 'erts/emulator/test/distribution_SUITE.erl')
-rw-r--r-- | erts/emulator/test/distribution_SUITE.erl | 57 |
1 files changed, 47 insertions, 10 deletions
diff --git a/erts/emulator/test/distribution_SUITE.erl b/erts/emulator/test/distribution_SUITE.erl index ceedd26eb8..d577f2a1e5 100644 --- a/erts/emulator/test/distribution_SUITE.erl +++ b/erts/emulator/test/distribution_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2022. All Rights Reserved. +%% Copyright Ericsson AB 1997-2023. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -877,9 +877,12 @@ make_busy(Node, Time) when is_integer(Time) -> receive after Own -> ok end, until(fun () -> case {DCtrl, process_info(Pid, status)} of - {DPrt, {status, suspended}} when is_port(DPrt) -> true; - {DPid, {status, waiting}} when is_pid(DPid) -> true; - _ -> false + {DPrt, {status, waiting}} when is_port(DPrt) -> + verify_busy(DPrt); + {DPid, {status, waiting}} when is_pid(DPid) -> + true; + _ -> + false end end), %% then dist entry @@ -896,6 +899,28 @@ unmake_busy(Pid) -> unlink(Pid), exit(Pid, bang). +verify_busy(Port) -> + Parent = self(), + Pid = + spawn_link( + fun() -> + port_command(Port, "Just some data"), + Error = {not_busy, Port}, + exit(Parent, Error), + error(Error) + end), + receive after 30 -> ok end, + case process_info(Pid, status) of + {status, suspended} -> + unlink(Pid), + exit(Pid, kill), + true; + {status, _} = WrongStatus -> + unlink(Pid), + exit(Pid, WrongStatus), + error(WrongStatus) + end. + do_busy_test(Node, Fun) -> Busy = make_busy(Node, 1000), {P, M} = spawn_monitor(Fun), @@ -2553,7 +2578,19 @@ ensure_dctrl(Node) -> end. dctrl_send(DPrt, Data) when is_port(DPrt) -> - port_command(DPrt, Data); + try prim_inet:send(DPrt, Data) of + ok -> + ok; + Result -> + io:format("~w/2: ~p~n", [?FUNCTION_NAME, Result]), + Result + catch + Class: Reason: Stacktrace -> + io:format( + "~w/2: ~p: ~p: ~p ~n", + [?FUNCTION_NAME, Class, Reason, Stacktrace]), + erlang:raise(Class, Reason, Stacktrace) + end; dctrl_send(DPid, Data) when is_pid(DPid) -> Ref = make_ref(), DPid ! {send, self(), Ref, Data}, @@ -3246,7 +3283,7 @@ is_alive_tester(Node) -> ok end. -dyn_node_name_monitor_node(Config) -> +dyn_node_name_monitor_node(_Config) -> %% Test that monitor_node() does not fail when erlang:is_alive() return true %% but we have not yet gotten a name... Args = ["-setcookie", atom_to_list(erlang:get_cookie()), @@ -3284,7 +3321,7 @@ dyn_node_name_monitor_node_test(StartOpts, TestNode) -> ok. -dyn_node_name_monitor(Config) -> +dyn_node_name_monitor(_Config) -> %% Test that monitor() does not fail when erlang:is_alive() return true %% but we have not yet gotten a name... Args = ["-setcookie", atom_to_list(erlang:get_cookie()), @@ -3716,7 +3753,7 @@ id(X) -> wait_until(Fun) -> wait_until(Fun, 24*60*60*1000). -wait_until(Fun, Timeout) when Timeout < 0 -> +wait_until(_Fun, Timeout) when Timeout < 0 -> timeout; wait_until(Fun, Timeout) -> case catch Fun() of @@ -3887,8 +3924,8 @@ forever(Fun) -> Fun(), forever(Fun). -abort(Why) -> - set_internal_state(abort, Why). +%% abort(Why) -> +%% set_internal_state(abort, Why). start_busy_dist_port_tracer() -> |