diff options
author | Paul Joseph Davis <davisp@apache.org> | 2009-09-27 16:52:44 +0000 |
---|---|---|
committer | Paul Joseph Davis <davisp@apache.org> | 2009-09-27 16:52:44 +0000 |
commit | eadbdb42d0e7f28276c6fb26d5f76e899e8ad104 (patch) | |
tree | b6c589988986f710fdd4fcfd55de65951112b39f | |
parent | f794d794cc7a475abb2c36238f4533ca79f767e5 (diff) |
Fixed 040-util.t test from deadlocking.
When we started the linked process to kill with couch_util:terminate_linked/1, we weren't waiting for the child process to start.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@819341 13f79535-47bb-0310-9956-ffa450edef68
-rwxr-xr-x | test/etap/040-util.t | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/test/etap/040-util.t b/test/etap/040-util.t index e311adab..f2033060 100755 --- a/test/etap/040-util.t +++ b/test/etap/040-util.t @@ -17,9 +17,7 @@ main(_) -> code:add_pathz("src/couchdb"), application:start(crypto), - % Changed to 9 till we figure out the buildbot freeze. - %etap:plan(10), - etap:plan(9), + etap:plan(10), case (catch test()) of ok -> etap:end_tests(); @@ -40,18 +38,25 @@ test() -> % terminate_linked Self = self(), - % This is causing halts on the buildbot make coverage runner. - % Im disabling until we get build bot running but we need to - % revisit this. - %spawn(fun() -> - % ChildPid = spawn_link(fun() -> receive shutdown -> ok end end), - % couch_util:terminate_linked(normal), - % Self ! {pid, ChildPid} - %end), - %receive - % {pid, Pid} -> - % etap:ok(not is_process_alive(Pid), "why wont this work?") - %end, + spawn(fun() -> + SecondSelf = self(), + ChildPid = spawn_link(fun() -> + SecondSelf ! {child, started}, + receive shutdown -> ok end + end), + PidUp = receive + {child, started} -> ok + after 1000 -> + {error, timeout} + end, + etap:is(ok, PidUp, "Started a linked process."), + couch_util:terminate_linked(normal), + Self ! {pid, ChildPid} + end), + receive + {pid, Pid} -> + etap:ok(not is_process_alive(Pid), "Linked process was killed.") + end, % implode etap:is([1, 38, 2, 38, 3], couch_util:implode([1,2,3],"&"), |