aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/eunit/src/eunit.erl10
-rw-r--r--lib/eunit/src/eunit_surefire.erl14
2 files changed, 14 insertions, 10 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
diff --git a/lib/eunit/src/eunit_surefire.erl b/lib/eunit/src/eunit_surefire.erl
index f289cd724a..dfb08c90b2 100644
--- a/lib/eunit/src/eunit_surefire.erl
+++ b/lib/eunit/src/eunit_surefire.erl
@@ -100,16 +100,10 @@ terminate({ok, _Data}, St) ->
XmlDir = St#state.xmldir,
write_report(TestSuite, XmlDir),
ok;
-terminate({error, Reason}, _St) ->
- io:fwrite("Internal error: ~P.\n", [Reason, 25]),
- sync_end(error).
-
-sync_end(Result) ->
- receive
- {stop, Reference, ReplyTo} ->
- ReplyTo ! {result, Reference, Result},
- ok
- end.
+terminate({error, _Reason}, _St) ->
+ %% Don't report any errors here, since eunit_tty takes care of that.
+ %% Just terminate.
+ ok.
handle_begin(group, Data, St) ->
NewId = proplists:get_value(id, Data),