diff options
author | Matthew Sackman <matthew@lshift.net> | 2010-02-15 13:54:46 +0000 |
---|---|---|
committer | Matthew Sackman <matthew@lshift.net> | 2010-02-15 13:54:46 +0000 |
commit | 7d7021d18c546d4086ae7bf21d43f450b7346802 (patch) | |
tree | 18244ee25f5602828defddaba98b4c0ab4eba5b0 | |
parent | 65869973d6f21a5165de6257c8461401fcefa61f (diff) | |
download | rabbitmq-server-bug22363.tar.gz |
Well without this, I can break the test frequently (> 50% of the time, with [rabbit_tests:test_pg_local()|| _ <- lists:seq(1,10000)]. With this, it's still not brilliant - but then it actually can't be fixed properly, without extending pg_local. This fix is "good enough" to stop my machine barfing on it, though it is still racy - "we" could process our monitors and go onto the final pg_local test before pg_local processes the monitors in its mailbox (well, actually before the monitors *arrive* in its mailbox).bug22363
-rw-r--r-- | src/rabbit_tests.erl | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/rabbit_tests.erl b/src/rabbit_tests.erl index 277e6717..51d95c35 100644 --- a/src/rabbit_tests.erl +++ b/src/rabbit_tests.erl @@ -31,6 +31,8 @@ -module(rabbit_tests). +-compile([export_all]). + -export([all_tests/0, test_parsing/0]). %% Exported so the hook mechanism can call back @@ -187,7 +189,7 @@ test_simple_n_element_queue(N) -> test_pg_local() -> [P, Q] = [spawn(fun () -> receive X -> X end end) || _ <- [x, x]], check_pg_local(ok, [], []), - check_pg_local(pg_local:join(a, P), [P], []), + check_pg_local(pg_local:join(a, P), [P], []), check_pg_local(pg_local:join(b, P), [P], [P]), check_pg_local(pg_local:join(a, P), [P, P], [P]), check_pg_local(pg_local:join(a, Q), [P, P, Q], [P]), @@ -197,7 +199,10 @@ test_pg_local() -> check_pg_local(pg_local:leave(b, P), [P, Q], [Q, Q]), check_pg_local(pg_local:leave(a, P), [Q], [Q, Q]), check_pg_local(pg_local:leave(a, P), [Q], [Q, Q]), - [X ! done || X <- [P, Q]], + [begin X ! done, + Ref = erlang:monitor(process, X), + receive {'DOWN', Ref, process, X, _Info} -> ok end + end || X <- [P, Q]], check_pg_local(ok, [], []), passed. |