diff options
author | Henrik Nord <henrik@erlang.org> | 2011-05-06 15:04:19 +0200 |
---|---|---|
committer | Henrik Nord <henrik@erlang.org> | 2011-05-06 15:04:24 +0200 |
commit | 6fb4aec04d38bf6b5609b544981c9cebc2d1c89a (patch) | |
tree | 23a237fbf6a5bb04f62374e89c2368fdbcb7d18d /lib | |
parent | 1ab60eaaba8ba089a5b9a7d4b3119650ba08dac6 (diff) | |
parent | bd38a126546376246f9a93a2943e70a3925df48f (diff) | |
download | otp-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')
-rw-r--r-- | lib/eunit/src/eunit.erl | 10 | ||||
-rw-r--r-- | lib/eunit/src/eunit_surefire.erl | 14 |
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), |