You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ee...@apache.org on 2009/07/17 05:32:26 UTC

svn commit: r794951 - /incubator/cassandra/trunk/test/system/__init__.py

Author: eevans
Date: Fri Jul 17 03:32:25 2009
New Revision: 794951

URL: http://svn.apache.org/viewvc?rev=794951&view=rev
Log:
improved error handling for system test server startup

Capture stderr and stdout when process is dead; only kill if it isn't
already dead.

Patch by Sammy Yu; reviewed by eevans for CASSANDRA-306

Modified:
    incubator/cassandra/trunk/test/system/__init__.py

Modified: incubator/cassandra/trunk/test/system/__init__.py
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/test/system/__init__.py?rev=794951&r1=794950&r2=794951&view=diff
==============================================================================
--- incubator/cassandra/trunk/test/system/__init__.py (original)
+++ incubator/cassandra/trunk/test/system/__init__.py Fri Jul 17 03:32:25 2009
@@ -72,7 +72,7 @@
             os.chdir(root)
             os.environ['CASSANDRA_INCLUDE'] = 'test/cassandra.in.sh'
             args = ['bin/cassandra', '-p', pid_fname]
-            sp.Popen(args, stderr=sp.PIPE, stdout=sp.PIPE)
+            process = sp.Popen(args, stderr=sp.PIPE, stdout=sp.PIPE)
             time.sleep(0.1)
 
             # connect to it, with a timeout in case something went wrong
@@ -85,8 +85,16 @@
                 else:
                     break
             else:
-                os.kill(pid(), signal.SIGKILL) # just in case
                 print "Couldn't connect to server; aborting regression test"
+                # see if process is still alive
+                process.poll()
+                
+                if process.returncode is None:
+                    os.kill(pid(), signal.SIGKILL) # just in case
+                else:
+                    stdout_value, stderr_value = process.communicate()
+                    print "Stdout: %s" % (stdout_value)
+                    print "Stderr: %s" % (stderr_value)
                 sys.exit()
         else:
             client.transport.open()