[rhmessaging-commits] rhmessaging commits: r2180 - in mgmt/trunk/cumin: python/cumin and 1 other directory.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Tue Jul 8 11:52:17 EDT 2008


Author: justi9
Date: 2008-07-08 11:52:17 -0400 (Tue, 08 Jul 2008)
New Revision: 2180

Modified:
   mgmt/trunk/cumin/bin/cumin-test
   mgmt/trunk/cumin/python/cumin/test.py
Log:
Add more process handling for the default test broker; pass in a data dir; use the default path, with sbin dirs added, to look up the qpidd executable

Modified: mgmt/trunk/cumin/bin/cumin-test
===================================================================
--- mgmt/trunk/cumin/bin/cumin-test	2008-07-08 00:43:06 UTC (rev 2179)
+++ mgmt/trunk/cumin/bin/cumin-test	2008-07-08 15:52:17 UTC (rev 2180)
@@ -21,6 +21,10 @@
 
         sys.exit(1)
 
+    usr_sbin = "/usr/sbin"
+    if usr_sbin not in sys.path:
+        sys.path.append(usr_sbin)
+
     app.init()
 
     if config.broker:
@@ -30,7 +34,7 @@
         # supports it
         host, port = "localhost", randint(16384, 32767)
 
-        broker = TestBroker("/usr/sbin/qpidd", port)
+        broker = TestBroker("qpidd", port)
         broker.start()
 
     env = TestEnvironment(app, host, port, config.spec)

Modified: mgmt/trunk/cumin/python/cumin/test.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/test.py	2008-07-08 00:43:06 UTC (rev 2179)
+++ mgmt/trunk/cumin/python/cumin/test.py	2008-07-08 15:52:17 UTC (rev 2180)
@@ -1,4 +1,4 @@
-import sys, os
+import sys, os, signal
 from mint import *
 from traceback import print_exc, extract_tb
 from datetime import datetime
@@ -17,24 +17,38 @@
 
         self.path = path
         self.port = port
-        self.command = (path, "--port", str(port),
+
+        self.key = "cumin-test-qpidd-%i" % port
+        
+        self.command = (path,
+                        "--port", str(port),
                         "--auth", "no",
-                        "-t",
-                        "--no-data-dir")
-        self.output = "qpidd-test.log"
+                        "--trace",
+                        "--data-dir", self.key)
+
+        self.log = "%s.log" % self.key
+
         self.setDaemon(True)
 
     def run(self):
-        out = open(self.output, "w")
+        os.makedirs(self.key)
 
+        out = open(self.log, "w")
+
         try:
             pop = Popen4(self.command)
             copyfileobj(pop.fromchild, out)
             exit_code = pop.wait()
             print exit_code
         finally:
-            print "hmmm!"
+            if pop:
+                os.kill(pop.pid, signal.SIGKILL)
 
+            kpid, stat = os.waitpid(pop.pid, os.WNOHANG)
+
+            if kpid == 0:
+                print "Test qpidd not killed"
+
 class TestEnvironment(object):
     def __init__(self, app, broker_host, broker_port, spec_path):
         self.app = app
@@ -53,7 +67,7 @@
 
     def init(self):
         self.broker_conn.open()
-        
+
         session = quirk.Session(self.broker_conn, "test")
         session.open()
 




More information about the rhmessaging-commits mailing list