couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject couch commit: updated refs/heads/master to 1aec9a4
Date Tue, 13 Oct 2015 22:57:12 GMT
Repository: couchdb-couch
Updated Branches:
  refs/heads/master c0bf9d67d -> 1aec9a4a9


Stabilize couch_task_status_tests:run_multiple_tasks/0 test.

Previously, at the end of the test, it kills each status process
with call(Pid1, done), then immediately calls couch_task_status:all().

This caused a race between couch_task_status receiving the 'all'
call and the 'DOWN' message (from monitoring test processes). If
'DOWN' message came before 'all', test passed. If it came
after, it failed.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/1aec9a4a
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/1aec9a4a
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/1aec9a4a

Branch: refs/heads/master
Commit: 1aec9a4a906798005582987ac1963aebf0f5955f
Parents: c0bf9d6
Author: Nick Vatamaniuc <vatamane@gmail.com>
Authored: Tue Oct 13 15:54:37 2015 -0400
Committer: Nick Vatamaniuc <vatamane@gmail.com>
Committed: Tue Oct 13 17:25:05 2015 -0400

----------------------------------------------------------------------
 test/couch_task_status_tests.erl | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/1aec9a4a/test/couch_task_status_tests.erl
----------------------------------------------------------------------
diff --git a/test/couch_task_status_tests.erl b/test/couch_task_status_tests.erl
index 0227b64..0ec0356 100644
--- a/test/couch_task_status_tests.erl
+++ b/test/couch_task_status_tests.erl
@@ -180,6 +180,16 @@ loop() ->
             From ! {ok, self(), ok}
     end.
 
+call(Pid, done) ->
+    Ref = erlang:monitor(process, Pid),
+    Pid ! {done, self()},
+    Res = wait(Pid),
+    receive
+        {'DOWN', Ref, _Type, Pid, _Info} ->
+            Res
+    after ?TIMEOUT ->
+            throw(timeout_error)
+    end;
 call(Pid, Command) ->
     Pid ! {Command, self()},
     wait(Pid).


Mime
View raw message