You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2009/09/27 18:52:44 UTC

svn commit: r819341 - /couchdb/trunk/test/etap/040-util.t

Author: davisp
Date: Sun Sep 27 16:52:44 2009
New Revision: 819341

URL: http://svn.apache.org/viewvc?rev=819341&view=rev
Log:
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.


Modified:
    couchdb/trunk/test/etap/040-util.t

Modified: couchdb/trunk/test/etap/040-util.t
URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/040-util.t?rev=819341&r1=819340&r2=819341&view=diff
==============================================================================
--- couchdb/trunk/test/etap/040-util.t (original)
+++ couchdb/trunk/test/etap/040-util.t Sun Sep 27 16:52:44 2009
@@ -17,9 +17,7 @@
     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 @@
     % 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],"&"),