From eadbdb42d0e7f28276c6fb26d5f76e899e8ad104 Mon Sep 17 00:00:00 2001 From: Paul Joseph Davis Date: Sun, 27 Sep 2009 16:52:44 +0000 Subject: 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 --- test/etap/040-util.t | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) (limited to 'test') 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],"&"), -- cgit v1.2.3