aboutsummaryrefslogtreecommitdiffstats
path: root/lib/eunit/src/eunit.erl
diff options
context:
space:
mode:
authorHenrik Nord <[email protected]>2011-05-06 15:04:19 +0200
committerHenrik Nord <[email protected]>2011-05-06 15:04:24 +0200
commit6fb4aec04d38bf6b5609b544981c9cebc2d1c89a (patch)
tree23a237fbf6a5bb04f62374e89c2368fdbcb7d18d /lib/eunit/src/eunit.erl
parent1ab60eaaba8ba089a5b9a7d4b3119650ba08dac6 (diff)
parentbd38a126546376246f9a93a2943e70a3925df48f (diff)
downloadotp-6fb4aec04d38bf6b5609b544981c9cebc2d1c89a.tar.gz
otp-6fb4aec04d38bf6b5609b544981c9cebc2d1c89a.tar.bz2
otp-6fb4aec04d38bf6b5609b544981c9cebc2d1c89a.zip
Merge branch 'kj/eunit-race-cond' into dev
* kj/eunit-race-cond: Don't let eunit_surefire report back to eunit when stopping Wait until all eunit listeners terminate OTP-9269
Diffstat (limited to 'lib/eunit/src/eunit.erl')
-rw-r--r--lib/eunit/src/eunit.erl10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/eunit/src/eunit.erl b/lib/eunit/src/eunit.erl
index 4a86a108cf..da35c5c2ec 100644
--- a/lib/eunit/src/eunit.erl
+++ b/lib/eunit/src/eunit.erl
@@ -157,6 +157,7 @@ test_run(Reference, Listeners) ->
receive
{done, Reference} ->
cast(Listeners, {stop, Reference, self()}),
+ wait_until_listeners_have_terminated(Listeners),
receive
{result, Reference, Result} ->
Result
@@ -169,6 +170,15 @@ cast([P | Ps], Msg) ->
cast([], _Msg) ->
ok.
+wait_until_listeners_have_terminated([P | Ps]) ->
+ MRef = erlang:monitor(process, P),
+ receive
+ {'DOWN', MRef, process, P, _} ->
+ wait_until_listeners_have_terminated(Ps)
+ end;
+wait_until_listeners_have_terminated([]) ->
+ ok.
+
%% TODO: functions that run tests on a given node, not a given server
%% TODO: maybe some functions could check for a globally registered server?
%% TODO: some synchronous but completely quiet interface function