aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/test/sys_SUITE.erl
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2018-10-16 14:42:37 +0200
committerSiri Hansen <[email protected]>2018-10-16 14:42:37 +0200
commit5415e60c0b6a17accc33e128c73fa90ccb82c081 (patch)
tree518513541a2efcd728564b31a381db51f74bde31 /lib/stdlib/test/sys_SUITE.erl
parent41ab6463e73011969498969834b4ee84024748b0 (diff)
downloadotp-5415e60c0b6a17accc33e128c73fa90ccb82c081.tar.gz
otp-5415e60c0b6a17accc33e128c73fa90ccb82c081.tar.bz2
otp-5415e60c0b6a17accc33e128c73fa90ccb82c081.zip
Fix sys_SUITE:special_process/1 to terminating process synchronously
Diffstat (limited to 'lib/stdlib/test/sys_SUITE.erl')
-rw-r--r--lib/stdlib/test/sys_SUITE.erl17
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/stdlib/test/sys_SUITE.erl b/lib/stdlib/test/sys_SUITE.erl
index 3278eb0eb0..fcc4419569 100644
--- a/lib/stdlib/test/sys_SUITE.erl
+++ b/lib/stdlib/test/sys_SUITE.erl
@@ -219,7 +219,7 @@ spec_proc(Mod) ->
{Mod,system_get_state},{throw,fail}},_}} ->
ok
end,
- ok = sys:terminate(Mod, normal),
+ ok = sync_terminate(Mod),
{ok,_} = Mod:start_link(4),
ok = case catch sys:replace_state(Mod, fun(_) -> {} end) of
{} ->
@@ -228,7 +228,7 @@ spec_proc(Mod) ->
{Mod,system_replace_state},{throw,fail}},_}} ->
ok
end,
- ok = sys:terminate(Mod, normal),
+ ok = sync_terminate(Mod),
{ok,_} = Mod:start_link(4),
StateFun = fun(_) -> error(fail) end,
ok = case catch sys:replace_state(Mod, StateFun) of
@@ -240,7 +240,18 @@ spec_proc(Mod) ->
{'EXIT',{{callback_failed,StateFun,{error,fail}},_}} ->
ok
end,
- ok = sys:terminate(Mod, normal).
+ ok = sync_terminate(Mod).
+
+sync_terminate(Mod) ->
+ P = whereis(Mod),
+ MRef = erlang:monitor(process,P),
+ ok = sys:terminate(Mod, normal),
+ receive
+ {'DOWN',MRef,_,_,normal} ->
+ ok
+ end,
+ undefined = whereis(Mod),
+ ok.
%%%%%%%%%%%%%%%%%%%%
%% Dummy server