[Zope-Checkins] SVN: zdaemon/trunk/ Merge changes made from a wrong project:

Tim Peters tim.one at comcast.net
Mon Jan 24 10:56:19 EST 2005


Log message for revision 28926:
  Merge changes made from a wrong project:
  
  r28912 | tim_one | 2005-01-21 17:22:52 -0500 (Fri, 21 Jan 2005) | 17 lines
  Changed paths:
     M /Zope/trunk/lib/python/zdaemon/tests/testzdrun.py
  
  Try to repair testRunIgnoresParentSignals.
  
  Instead of poke-and-hope guessing at how long to wait
  for the child process to start running, use send_action()
  in a loop to ask about that more directly -- but don't
  wait longer than a minute.
  
  The test should run faster on most boxes now, but
  take up to a minute on boxes that are bogged down for
  whatever reason.
  
  Note that this checkin is being made from a wrong place!
  zdaemon isn't part of the Zope tree, it's stitched in
  from the zdaemon repository.  So this checkin has no
  effect on zdaemon.  It will need to be sideported later
  if it turns out to fix the overnight test failures.
  

Changed:
  _U  zdaemon/trunk/
  _U  zdaemon/trunk/tests/
  U   zdaemon/trunk/tests/testzdrun.py

-=-

Property changes on: zdaemon/trunk
___________________________________________________________________
Name: svn:ignore
   + *so
*.pyc
build



Property changes on: zdaemon/trunk/tests
___________________________________________________________________
Name: svn:ignore
   + *so
*.pyc
build


Modified: zdaemon/trunk/tests/testzdrun.py
===================================================================
--- zdaemon/trunk/tests/testzdrun.py	2005-01-24 15:52:51 UTC (rev 28925)
+++ zdaemon/trunk/tests/testzdrun.py	2005-01-24 15:56:19 UTC (rev 28926)
@@ -224,15 +224,24 @@
             sys.executable,
             [sys.executable, os.path.join(self.here, 'parent.py')]
             )
-        time.sleep(2) # race condition possible here
+        # Wait for it to start, but no longer than a minute.
+        deadline = time.time() + 60
+        is_started = False
+        while time.time() < deadline:
+             response = send_action('status\n', zdrun_socket)
+             if response is None:
+                 time.sleep(0.05)
+             else:
+                 is_started = True
+                 break
+        self.assert_(is_started, "spawned process failed to start in a minute")
+        # Kill it, and wait a little to ensure it's dead.
         os.kill(zdctlpid, signal.SIGINT)
-        try:
-            response = send_action('status\n', zdrun_socket) or ''
-        except socket.error, msg:
-            response = ''
-        params = response.split('\n')
-        self.assert_(len(params) > 1, repr(response))
-        # kill the process
+        time.sleep(0.25)
+        # Make sure the child is still responsive.
+        response = send_action('status\n', zdrun_socket)
+        self.assert_(response is not None and '\n' in response)
+        # Kill the process.
         send_action('exit\n', zdrun_socket)
 
     def testUmask(self):



More information about the Zope-Checkins mailing list