summaryrefslogtreecommitdiff
path: root/erts/emulator/test/erl_link_SUITE.erl
diff options
context:
space:
mode:
Diffstat (limited to 'erts/emulator/test/erl_link_SUITE.erl')
-rw-r--r--erts/emulator/test/erl_link_SUITE.erl47
1 files changed, 42 insertions, 5 deletions
diff --git a/erts/emulator/test/erl_link_SUITE.erl b/erts/emulator/test/erl_link_SUITE.erl
index 0e3829c275..391dfe6bf9 100644
--- a/erts/emulator/test/erl_link_SUITE.erl
+++ b/erts/emulator/test/erl_link_SUITE.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2001-2022. All Rights Reserved.
+%% Copyright Ericsson AB 2001-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.
@@ -671,9 +671,12 @@ make_busy(Node, Time) when is_integer(Time) ->
receive after Own -> ok end,
wait_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
@@ -690,6 +693,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.
+
suspend_on_busy_test(Node, Doing, Fun) ->
Tester = self(),
DoIt = make_ref(),
@@ -1205,7 +1230,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},