You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by ns...@apache.org on 2016/03/02 15:45:09 UTC

[7/8] thrift git commit: THRIFT-3694 [Windows] Disable tests of a few servers that are not supported

THRIFT-3694 [Windows] Disable tests of a few servers that are not supported

This closes #909


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/06e8fd4a
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/06e8fd4a
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/06e8fd4a

Branch: refs/heads/master
Commit: 06e8fd4a08b0ec9eae505ab8618fe96b6a1faaf4
Parents: f7a8d94
Author: Nobuaki Sukegawa <ns...@apache.org>
Authored: Sun Feb 28 12:50:03 2016 +0900
Committer: Nobuaki Sukegawa <ns...@apache.org>
Committed: Wed Mar 2 23:44:23 2016 +0900

----------------------------------------------------------------------
 test/py/RunClientServer.py | 33 +++++++++++++++++++--------------
 1 file changed, 19 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/06e8fd4a/test/py/RunClientServer.py
----------------------------------------------------------------------
diff --git a/test/py/RunClientServer.py b/test/py/RunClientServer.py
index 15c4d2b..c1443ec 100755
--- a/test/py/RunClientServer.py
+++ b/test/py/RunClientServer.py
@@ -21,6 +21,7 @@
 
 from __future__ import division
 from __future__ import print_function
+import platform
 import copy
 import os
 import signal
@@ -56,15 +57,19 @@ PROTOS = [
     'json',
 ]
 
-SERVERS = [
-    "TSimpleServer",
-    "TThreadedServer",
-    "TThreadPoolServer",
-    "TProcessPoolServer",
-    "TForkingServer",
-    "TNonblockingServer",
-    "THttpServer",
-]
+
+def default_servers():
+    servers = [
+        'TSimpleServer',
+        'TThreadedServer',
+        'TThreadPoolServer',
+        'TNonblockingServer',
+        'THttpServer',
+    ]
+    if platform.system() != 'Windows':
+        servers.append('TProcessPoolServer')
+        servers.append('TForkingServer')
+    return servers
 
 
 def relfile(fname):
@@ -77,7 +82,7 @@ def setup_pypath(libdir, gendir):
     pypath = env.get('PYTHONPATH', None)
     if pypath:
         dirs.append(pypath)
-    env['PYTHONPATH'] = ':'.join(dirs)
+    env['PYTHONPATH'] = os.pathsep.join(dirs)
     if gendir.endswith('gen-py-no_utf8strings'):
         env['THRIFT_TEST_PY_NO_UTF8STRINGS'] = '1'
     return env
@@ -135,7 +140,6 @@ def runServiceTest(libdir, genbase, genpydir, server_class, proto, port, use_zli
     # Wait for the server to start accepting connections on the given port.
     sleep_time = 0.1  # Seconds
     max_attempts = 100
-    # try:
     attempt = 0
     while True:
         sock4 = socket.socket()
@@ -172,7 +176,8 @@ def runServiceTest(libdir, genbase, genpydir, server_class, proto, port, use_zli
                   'processes to terminate via alarm'
                   % (server_class, proto, use_zlib, use_ssl, extra_sleep))
             time.sleep(extra_sleep)
-        os.kill(serverproc.pid, signal.SIGKILL)
+        sig = signal.SIGKILL if platform.system() != 'Windows' else signal.SIGABRT
+        os.kill(serverproc.pid, sig)
         serverproc.wait()
 
 
@@ -274,9 +279,9 @@ def main():
         generated_dirs.append('gen-py-%s' % (gp_dir))
 
     # commandline permits a single class name to be specified to override SERVERS=[...]
-    servers = SERVERS
+    servers = default_servers()
     if len(args) == 1:
-        if args[0] in SERVERS:
+        if args[0] in servers:
             servers = args
         else:
             print('Unavailable server type "%s", please choose one of: %s' % (args[0], servers))