[Erp5-report] r42106 nicolas - /erp5/trunk/utils/cloudooo/cloudooo/handler/ooo/tests/

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Jan 7 10:13:23 CET 2011


Author: nicolas
Date: Fri Jan  7 10:13:23 2011
New Revision: 42106

URL: http://svn.erp5.org?rev=42106&view=rev
Log:
Stop daemon smoothly, and insure that all sub-processes will be terminated.

Modified:
    erp5/trunk/utils/cloudooo/cloudooo/handler/ooo/tests/runCloudOOoUnitTest.py

Modified: erp5/trunk/utils/cloudooo/cloudooo/handler/ooo/tests/runCloudOOoUnitTest.py
URL: http://svn.erp5.org/erp5/trunk/utils/cloudooo/cloudooo/handler/ooo/tests/runCloudOOoUnitTest.py?rev=42106&r1=42105&r2=42106&view=diff
==============================================================================
--- erp5/trunk/utils/cloudooo/cloudooo/handler/ooo/tests/runCloudOOoUnitTest.py [utf8] (original)
+++ erp5/trunk/utils/cloudooo/cloudooo/handler/ooo/tests/runCloudOOoUnitTest.py [utf8] Fri Jan  7 10:13:23 2011
@@ -8,6 +8,8 @@ from cloudooo.handler.ooo.utils.utils im
 from ConfigParser import ConfigParser
 from os import chdir, path, environ, curdir
 from subprocess import Popen, PIPE
+import tempfile
+import os
 
 ENVIRONMENT_PATH = path.abspath(path.dirname(__file__))
 
@@ -83,18 +85,21 @@ def run():
   suite.addTest(module.test_suite())
 
   if DAEMON:
-    command = [paster_path, "serve", server_cloudooo_conf]
-    process = Popen(command, stdout=PIPE, stderr=PIPE)
+    fd, pid_filename = tempfile.mkstemp()
+    command = [paster_path, "serve", '--daemon', '--pid-file', pid_filename,
+               server_cloudooo_conf]
+    process = Popen(command)
     wait_use_port(hostname, openoffice_port)
     wait_use_port(hostname, server_port)
     chdir(ENVIRONMENT_PATH)
     try:
       TestRunner(verbosity=2).run(suite)
     finally:
-      process.send_signal(1)
-      wait_liberate_port(hostname, server_port)
-      process.terminate()
-    wait_liberate_port(hostname, server_port)
+      command = [paster_path, 'serve', '--stop-daemon', '--pid-file',
+                 pid_filename]
+      stop_process = Popen(command)
+      stop_process.communicate()
+      # pid file is destroyed by paster
   elif OPENOFFICE:
     chdir(ENVIRONMENT_PATH)
     openoffice, xvfb = startFakeEnvironment(conf_path=server_cloudooo_conf)



More information about the Erp5-report mailing list