You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kp...@apache.org on 2016/09/30 20:47:02 UTC

qpid-interop-test git commit: QPIDIT-40: Added os kill based on testing where some threads could not be killed by process.kill()

Repository: qpid-interop-test
Updated Branches:
  refs/heads/master 5dc10051e -> cd3ab86dc


QPIDIT-40: Added os kill based on testing where some threads could not be killed by process.kill()


Project: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/commit/cd3ab86d
Tree: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/tree/cd3ab86d
Diff: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/diff/cd3ab86d

Branch: refs/heads/master
Commit: cd3ab86dceefe1f356b5e34506ccc89eef829034
Parents: 5dc1005
Author: Kim van der Riet <kp...@apache.org>
Authored: Fri Sep 30 16:46:42 2016 -0400
Committer: Kim van der Riet <kp...@apache.org>
Committed: Fri Sep 30 16:46:42 2016 -0400

----------------------------------------------------------------------
 .../qpid-interop-test/jms/jms_message_tests.py  |  2 ++
 src/python/qpid-interop-test/shims.py           | 20 ++++++++++++++++----
 .../types/simple_type_tests.py                  |  2 ++
 3 files changed, 20 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/cd3ab86d/src/python/qpid-interop-test/jms/jms_message_tests.py
----------------------------------------------------------------------
diff --git a/src/python/qpid-interop-test/jms/jms_message_tests.py b/src/python/qpid-interop-test/jms/jms_message_tests.py
index 6ea1c01..bb9fc9b 100755
--- a/src/python/qpid-interop-test/jms/jms_message_tests.py
+++ b/src/python/qpid-interop-test/jms/jms_message_tests.py
@@ -30,6 +30,7 @@ import unittest
 from itertools import product
 from json import dumps
 from os import getenv, path
+from sys import stdout
 
 import broker_properties
 import shims
@@ -477,6 +478,7 @@ if __name__ == '__main__':
                           else '<platform not found>'
         print 'Test Broker: %s v.%s on %s' % (BROKER, BROKER_VERSION, BROKER_PLATFORM)
         print
+        stdout.flush()
 
     TYPES = JmsMessageTypes()
 

http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/cd3ab86d/src/python/qpid-interop-test/shims.py
----------------------------------------------------------------------
diff --git a/src/python/qpid-interop-test/shims.py b/src/python/qpid-interop-test/shims.py
index 1110d47..cdc1f66 100644
--- a/src/python/qpid-interop-test/shims.py
+++ b/src/python/qpid-interop-test/shims.py
@@ -21,7 +21,8 @@ Module containing worker thread classes and shims
 #
 
 from json import loads
-from os import getenv, path
+from os import getenv, kill, path
+from signal import SIGKILL
 from subprocess import Popen, PIPE, CalledProcessError
 from sys import stdout
 from threading import Thread
@@ -52,8 +53,11 @@ class ShimWorkerThread(Thread):
         if self.is_alive():
             if self._terminate_loop():
                 if self._kill_loop():
-                    print '\n  ERROR: Thread %s (pid=%d) alive after kill' % (self.name, self.proc.pid)
-                    stdout.flush()
+                    if self._os_kill():
+                        print '\n  ERROR: Thread %s (pid=%d) alive after kill' % (self.name, self.proc.pid)
+                        stdout.flush()
+                    else:
+                        print 'Killed by os'
                 else:
                     print 'Killed'
                     stdout.flush()
@@ -72,7 +76,7 @@ class ShimWorkerThread(Thread):
             sleep(wait_time)
         return self.is_alive()
 
-    def _kill_loop(self, num_attempts=5, wait_time=5):
+    def _kill_loop(self, num_attempts=2, wait_time=5):
         cnt = 0
         while cnt < num_attempts and self.is_alive():
             cnt += 1
@@ -83,6 +87,14 @@ class ShimWorkerThread(Thread):
             sleep(wait_time)
         return self.is_alive()
 
+    def _os_kill(self, wait_time=5):
+        if self.is_alive():
+            print '\n  Thread %s (pid=%d) alive after kill, using os kill...' % (self.name, self.proc.pid),
+            stdout.flush()
+            kill(self.proc.pid, SIGKILL)
+            sleep(wait_time)
+        return self.is_alive()
+
 
 class Sender(ShimWorkerThread):
     """Sender class for multi-threaded send"""

http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/cd3ab86d/src/python/qpid-interop-test/types/simple_type_tests.py
----------------------------------------------------------------------
diff --git a/src/python/qpid-interop-test/types/simple_type_tests.py b/src/python/qpid-interop-test/types/simple_type_tests.py
index 0482f2e..e9a89d8 100755
--- a/src/python/qpid-interop-test/types/simple_type_tests.py
+++ b/src/python/qpid-interop-test/types/simple_type_tests.py
@@ -30,6 +30,7 @@ import unittest
 from itertools import product
 from json import dumps
 from os import getenv, path
+from sys import stdout
 from time import mktime, time
 from uuid import UUID, uuid4
 
@@ -401,6 +402,7 @@ if __name__ == '__main__':
                           else '<platform not found>'
         print 'Test Broker: %s v.%s on %s' % (BROKER, BROKER_VERSION, BROKER_PLATFORM)
         print
+        stdout.flush()
 
     TYPES = AmqpPrimitiveTypes()
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org