Repository: thrift
Updated Branches:
  refs/heads/master a2d12b6ee -> 41ad4342c


http://git-wip-us.apache.org/repos/asf/thrift/blob/41ad4342/test/php/Makefile.am
----------------------------------------------------------------------
diff --git a/test/php/Makefile.am b/test/php/Makefile.am
index 1625903..11974da 100755
--- a/test/php/Makefile.am
+++ b/test/php/Makefile.am
@@ -17,12 +17,14 @@
 # under the License.
 #
 
-THRIFT = $(top_srcdir)/compiler/cpp/thrift
+THRIFT = $(top_builddir)/compiler/cpp/thrift
 
 stubs: ../ThriftTest.thrift
        $(THRIFT) --gen php ../ThriftTest.thrift
        $(THRIFT) --gen php:inlined ../ThriftTest.thrift
 
+precross: stubs
+
 check: stubs
 
 clean-local:

http://git-wip-us.apache.org/repos/asf/thrift/blob/41ad4342/test/php/TestClient.php
----------------------------------------------------------------------
diff --git a/test/php/TestClient.php b/test/php/TestClient.php
index ea17435..4ec4eab 100755
--- a/test/php/TestClient.php
+++ b/test/php/TestClient.php
@@ -60,6 +60,14 @@ if ($argc > 2) {
   $host = $argv[1];
 }
 
+foreach ($argv as $arg) {
+  if (substr($arg, 0, 7) == '--port=') {
+    $port = substr($arg, 7);
+  } else if (substr($arg, 0, 11) == '--transport=') {
+    $MODE = substr($arg, 11);
+  }
+}
+
 $hosts = array('localhost');
 
 $socket = new TSocket($host, $port);

http://git-wip-us.apache.org/repos/asf/thrift/blob/41ad4342/test/py.twisted/Makefile.am
----------------------------------------------------------------------
diff --git a/test/py.twisted/Makefile.am b/test/py.twisted/Makefile.am
index 4723b7d..17baa59 100644
--- a/test/py.twisted/Makefile.am
+++ b/test/py.twisted/Makefile.am
@@ -17,7 +17,7 @@
 # under the License.
 #
 
-THRIFT = $(top_srcdir)/compiler/cpp/thrift
+THRIFT = $(top_builddir)/compiler/cpp/thrift
 
 stubs: ../ThriftTest.thrift ../SmallTest.thrift
        $(THRIFT) --gen py:twisted ../ThriftTest.thrift

http://git-wip-us.apache.org/repos/asf/thrift/blob/41ad4342/test/py/Makefile.am
----------------------------------------------------------------------
diff --git a/test/py/Makefile.am b/test/py/Makefile.am
index 2fe9b5a..f8a3aa0 100755
--- a/test/py/Makefile.am
+++ b/test/py/Makefile.am
@@ -18,7 +18,7 @@
 #
 AUTOMAKE_OPTIONS = serial-tests
 
-THRIFT = $(top_srcdir)/compiler/cpp/thrift
+THRIFT = $(top_builddir)/compiler/cpp/thrift
 
 py_unit_tests = RunClientServer.py
 
@@ -38,6 +38,8 @@ thrift_gen =                                    \
         gen-py-dynamicslots/ThriftTest/__init__.py           \
         gen-py-dynamicslots/DebugProtoTest/__init__.py
 
+precross: $(THRIFT) $(thrift_gen)
+
 helper_scripts=                                 \
         TestClient.py                           \
         TestServer.py
@@ -52,27 +54,29 @@ TESTS= $(py_unit_tests)
 
 gen-py/%/__init__.py: ../%.thrift
        $(THRIFT) --gen py  $<
-       test -d gen-py-default || mkdir gen-py-default
+
+gen-py-default/%/__init__.py: ../%.thrift
+       test -d gen-py-default || $(MKDIR_P) gen-py-default
        $(THRIFT) --gen py -out gen-py-default $<
 
 gen-py-slots/%/__init__.py: ../%.thrift
-       test -d gen-py-slots || mkdir gen-py-slots
+       test -d gen-py-slots || $(MKDIR_P) gen-py-slots
        $(THRIFT) --gen py:slots -out gen-py-slots $<
 
 gen-py-newstyle/%/__init__.py: ../%.thrift
-       test -d gen-py-newstyle || mkdir gen-py-newstyle
+       test -d gen-py-newstyle || $(MKDIR_P) gen-py-newstyle
        $(THRIFT) --gen py:new_style -out gen-py-newstyle $<
 
 gen-py-newstyleslots/%/__init__.py: ../%.thrift
-       test -d gen-py-newstyleslots || mkdir gen-py-newstyleslots
+       test -d gen-py-newstyleslots || $(MKDIR_P) gen-py-newstyleslots
        $(THRIFT) --gen py:new_style,slots -out gen-py-newstyleslots $<
 
 gen-py-dynamic/%/__init__.py: ../%.thrift
-       test -d gen-py-dynamic || mkdir gen-py-dynamic
+       test -d gen-py-dynamic || $(MKDIR_P) gen-py-dynamic
        $(THRIFT) --gen py:dynamic -out gen-py-dynamic $<
 
 gen-py-dynamicslots/%/__init__.py: ../%.thrift
-       test -d gen-py-dynamicslots || mkdir gen-py-dynamicslots
+       test -d gen-py-dynamicslots || $(MKDIR_P) gen-py-dynamicslots
        $(THRIFT) --gen py:dynamic,slots -out gen-py-dynamicslots $<
 
 clean-local:

http://git-wip-us.apache.org/repos/asf/thrift/blob/41ad4342/test/rb/Makefile.am
----------------------------------------------------------------------
diff --git a/test/rb/Makefile.am b/test/rb/Makefile.am
index 9cdd99b..7b74c6c 100644
--- a/test/rb/Makefile.am
+++ b/test/rb/Makefile.am
@@ -17,12 +17,14 @@
 # under the License.
 #
 
-THRIFT = $(top_srcdir)/compiler/cpp/thrift
+THRIFT = $(top_builddir)/compiler/cpp/thrift
 
-stubs: ../ThriftTest.thrift ../SmallTest.thrift
+stubs: $(THRIFT) ../ThriftTest.thrift ../SmallTest.thrift
        $(THRIFT) --gen rb ../ThriftTest.thrift
        $(THRIFT) --gen rb ../SmallTest.thrift
 
+precross: stubs
+
 check: stubs
 if HAVE_BUNDLER
        $(BUNDLER) install

http://git-wip-us.apache.org/repos/asf/thrift/blob/41ad4342/test/result.html
----------------------------------------------------------------------
diff --git a/test/result.html b/test/result.html
index a2dac2c..0f918be 100644
--- a/test/result.html
+++ b/test/result.html
@@ -1,33 +1,74 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
 <!DOCTYPE HTML>
 <html>
 <head>
 <meta charset="utf-8">
 <title>Apache Thrift - integration test suite</title>
-<link rel="stylesheet" type="text/css" 
href="http://cdn.datatables.net/1.10.0/css/jquery.dataTables.css";>
-<script type="text/javascript" charset="utf-8" 
src="http://code.jquery.com/jquery-1.10.2.min.js";></script>
-<script type="text/javascript" charset="utf-8" 
src="http://cdn.datatables.net/1.10.0/js/jquery.dataTables.js";></script>
+<link rel="stylesheet" type="text/css" 
href="http://cdn.datatables.net/1.10.4/css/jquery.dataTables.css";>
+<script type="text/javascript" charset="utf-8" 
src="http://code.jquery.com/jquery-2.1.3.min.js";></script>
+<script type="text/javascript" charset="utf-8" 
src="http://cdn.datatables.net/1.10.4/js/jquery.dataTables.js";></script>
 <script>
- var test_data;
-
-    $(document).ready( function () {
-      $.getJSON('results.json', function(testData) {
-          testTable = $('#test_results').DataTable( {
-            data: testData,
-      "columnDefs": [
-            {
-                "render": function ( data, type, row ) {
-                    return data +' ('+ '<a 
href="'+row[5].Client+'">Client</a>,<a href="'+row[5].Server+'">Server</a>'+')';
+$.getJSON('results.json', function(results) {
+    $(document).ready(function() {
+        var transport = 3;
+        var socket = 4;
+        var success = 5;
+        var expected = 6;
+        var returnCode = 7;
+        var logFile = 8;
+        testTable = $('#test_results').DataTable({
+            data: results['results'],
+            columnDefs: [
+                {
+                    targets: 3,
+                    render: function(data, type, row) {
+                        return row[transport] + '-' + row[socket];
+                    },
                 },
-                "targets": 4
-            }
-        ]
-
-          });
-        $('#test_results_filter label input')
-          .focus()
-          .val('failure');
+                {
+                    targets: 4,
+                    render: function(data, type, row) {
+                        return (row[success] ? 'success' : 'failure')
+                                + '(' + (row[returnCode] == 128 ? 'timeout' : 
row[returnCode]) + ')'
+                                + '(<a href="' + row[logFile].server + 
'">Server</a>, '
+                                + '<a href="' + row[logFile].client + 
'">Client</a>)';
+                    },
+                },
+                {
+                    targets: 5,
+                    render: function(data, type, row) {
+                        // 'yes' rather than 'expected' to ease search
+                        return row[expected] ? 'yes' : 'unexpected';
+                    },
+                }
+            ],
         });
-      });
+        $('#test_results_filter label input').focus().val('unexpected 
failure');
+        $('#test_info').text(
+            "Test Date:     " + results['date'] + "\n" +
+            "Revision:      " + results['revision'] + "\n" +
+            "Platform:      " + results['platform'] + "\n" +
+            "Test duration: " + results['duration']) + " seconds";
+    });
+});
 </script>
 </head>
 <body>
@@ -40,8 +81,11 @@
             <th>Protocol</th>
             <th>Transport</th>
             <th>Result (log)</th>
+            <th>Expected</th>
         </tr>
     </thead>
 </table>
+<h2>Test Information</h2>
+<pre id="test_info"></pre>
 </body>
 </html>

http://git-wip-us.apache.org/repos/asf/thrift/blob/41ad4342/test/test.py
----------------------------------------------------------------------
diff --git a/test/test.py b/test/test.py
old mode 100644
new mode 100755
index c04ff8d..1176369
--- a/test/test.py
+++ b/test/test.py
@@ -1,5 +1,4 @@
 #!/usr/bin/env python
-
 #
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements. See the NOTICE file
@@ -19,285 +18,106 @@
 # under the License.
 #
 
-from __future__ import division
-import time
-import socket
-import subprocess
-import sys
-import os
-import signal
-import json
-import platform
-import shutil
-import threading
-from optparse import OptionParser
-
-parser = OptionParser()
-parser.add_option("--port", type="int", dest="port", default=9090,
-    help="port number for server to listen on")
-parser.add_option('-v', '--verbose', action="store_const",
-    dest="verbose", const=2,
-    help="verbose output")
-parser.add_option('-q', '--quiet', action="store_const",
-    dest="verbose", const=0,
-    help="minimal output")
-parser.add_option("--server", type="string", dest="servers", default="",
-    help="list of servers to test separated by commas, eg:- --server=cpp,java")
-parser.add_option("--client", type="string", dest="clients", default="",
-    help="list of clients to test separated by commas, eg:- --client=cpp,java")
-parser.set_defaults(verbose=1)
-options, args = parser.parse_args()
-
-if options.servers == "":
-  serversList = []
-else:
-  serversList = options.servers.split(",")
-if options.clients == "":
-  clientsList = []
-else:
-  clientsList = options.clients.split(",")
-
-def relfile(fname):
-    return os.path.join(os.path.dirname(__file__), fname)
-
-def getSocketArgs(socket_type):
-  if socket_type == 'ip':
-    return ""
-  elif socket_type == 'ip-ssl':
-    return "--ssl"
-  elif socket_type == 'domain':
-    return "--domain-socket=/tmp/ThriftTest.thrift"
+# Apache Thrift - integration test suite
+#
+# tests different server-client, protocol and transport combinations
+#
+# This script supports python 2.7 and later.
+# python 3.x is recommended for better stability.
+#
+# TODO: eliminate a few 2.7 occurrences to support 2.6 ?
+#
 
-def runServiceTest(test_name, server_lib, server_executable, 
server_extra_args, client_lib,  client_executable, client_extra_args, 
server_protocol, client_protocol, transport, port, use_zlib, socket_type):
-  # Build command line arguments
-  server_args = []
-  cli_args = []
-  if server_lib == 'java':
-    server_args.append(server_executable[0])
-    server_args.append(server_executable[1])
-    server_args.append(relfile(server_executable[2]))
-    server_args.extend(['-Dtestargs','\"'])
-  else:
-    server_args = [relfile(server_executable)]
-  if client_lib == 'java':
-    cli_args.append(client_executable[0])
-    cli_args.append(client_executable[1])
-    cli_args.append(relfile(client_executable[2]))
-    cli_args.extend(['-Dtestargs','\"'])
-  else:
-    cli_args = [relfile(client_executable)]
+import json
+import logging
+import multiprocessing
+import optparse
+import os
+import sys
 
-  server_args.append('--protocol=%s' % server_protocol)
-  cli_args.append('--protocol=%s' % client_protocol)
+import crossrunner
 
-  for which in (server_args, cli_args):
-    which.append('--transport=%s' % transport)
-    which.append('--port=%d' % port) # default to 9090
-    if use_zlib:
-      which.append('--zlib')
-    if socket_type == 'ip-ssl':
-      which.append('--ssl')
-    elif socket_type == 'domain':
-      which.append('--domain-socket=/tmp/ThriftTest.thrift')
-#    if options.verbose == 0:
-#      which.append('-q')
-#    if options.verbose == 2:
-#      which.append('-v')
-  if server_lib == 'java':
-    server_args.append('\"')
-  if client_lib == 'java':
-    cli_args.append('\"')
+TEST_DIR = os.path.realpath(os.path.dirname(__file__))
+CONFIG_PATH = os.path.join(TEST_DIR, 'tests.json')
 
-  server_args.extend(server_extra_args)
-  cli_args.extend(client_extra_args)
 
-  server_log=open(relfile("log/" + test_name + "_server.log"),"a")
-  client_log=open(relfile("log/" + test_name + "_client.log"),"a")
+def prepare(server_match, client_match):
+  with open(CONFIG_PATH, 'r') as fp:
+    j = json.load(fp)
+  return crossrunner.prepare(j, TEST_DIR, server_match, client_match)
 
-  try:
-    if options.verbose > 0:
-      print 'Testing server: %s' % (' '.join(server_args))
-      serverproc = subprocess.Popen(server_args, stdout=server_log, 
stderr=server_log)
-    else:
-      serverproc = subprocess.Popen(server_args, stdout=server_log, 
stderr=server_log)
-  except OSError as e:
-    return "OS error({0}): {1}".format(e.errno, e.strerror)
 
-  def ensureServerAlive():
-    if serverproc.poll() is not None:
-      return 'Server subprocess died, args: %s' % (' '.join(server_args))
+def run_tests(server_match, client_match, jobs, skip_known_failures):
+  logger = multiprocessing.get_logger()
+  logger.debug('Collecting tests')
+  with open(CONFIG_PATH, 'r') as fp:
+    j = json.load(fp)
+  tests = list(crossrunner.collect_tests(j, server_match, client_match))
+  if skip_known_failures:
+    known = crossrunner.load_known_failures(TEST_DIR)
+    tests = list(filter(lambda t: crossrunner.test_name(**t) not in known, 
tests))
 
-  # Wait for the server to start accepting connections on the given port.
-  sock = socket.socket()
-  sleep_time = 0.1  # Seconds
-  max_attempts = 100
+  dispatcher = crossrunner.TestDispatcher(TEST_DIR, jobs)
+  logger.debug('Executing %d tests' % len(tests))
   try:
-    attempt = 0
+    for r in [dispatcher.dispatch(test) for test in tests]:
+      r.wait()
+    logger.debug('Waiting for completion')
+    return dispatcher.wait()
+  except (KeyboardInterrupt, SystemExit):
+    logger.debug('Interrupted, shutting down')
+    dispatcher.terminate()
+    return False
 
-    if socket_type != 'domain':
-      while sock.connect_ex(('127.0.0.1', port)) != 0:
-        attempt += 1
-        if attempt >= max_attempts:
-          return "TestServer not ready on port %d after %.2f seconds" % (port, 
sleep_time * attempt)
-        ensureServerAlive()
-        time.sleep(sleep_time)
-  finally:
-    sock.close()
 
+def default_concurrenty():
   try:
-    o = []
-    def target():
-      try:
-        if options.verbose > 0:
-          print 'Testing client: %s' % (' '.join(cli_args))
-          process = subprocess.Popen(cli_args, stdout=client_log, 
stderr=client_log)
-          o.append(process)
-          process.communicate()
-        else:
-          process = subprocess.Popen(cli_args, stdout=client_log, 
stderr=client_log)
-          o.append(process)
-          process.communicate()
-      except OSError as e:
-        return "OS error({0}): {1}".format(e.errno, e.strerror)
-      except:
-        return "Unexpected error:", sys.exc_info()[0]
-    thread = threading.Thread(target=target)
-    thread.start()
-
-    thread.join(10)
-    if thread.is_alive():
-      print 'Terminating process'
-      o[0].terminate()
-      thread.join()
-    if(len(o)==0):
-      return "Client subprocess failed, args: %s" % (' '.join(cli_args))
-    ret = o[0].returncode
-    if ret != 0:
-      return "Client subprocess failed, retcode=%d, args: %s" % (ret, ' 
'.join(cli_args))
-      #raise Exception("Client subprocess failed, retcode=%d, args: %s" % 
(ret, ' '.join(cli_args)))
-  finally:
-    # check that server didn't die
-    #ensureServerAlive()
-    extra_sleep = 0
-    if extra_sleep > 0 and options.verbose > 0:
-      print ('Giving (protocol=%s,zlib=%s,ssl=%s) an extra %d seconds for 
child'
-             'processes to terminate via alarm'
-             % (protocol, use_zlib, use_ssl, extra_sleep))
-      time.sleep(extra_sleep)
-    os.kill(serverproc.pid, signal.SIGTERM)
-    #serverproc.wait()
-  client_log.flush()
-  server_log.flush()
-  client_log.close()
-  server_log.close()
-
-test_count = 0
-failed = 0
-hard_fail_count = 0
-platform = platform.system()
-if os.path.exists(relfile('log')): shutil.rmtree(relfile('log'))
-os.makedirs(relfile('log'))
-if os.path.exists(relfile('results.json')): os.remove(relfile('results.json'))
-results_json = open(relfile("results.json"),"a")
-results_json.write("[\n")
-
-with open(relfile('tests.json')) as data_file:
-    data = json.load(data_file)
-
-#subprocess.call("export 
NODE_PATH=../lib/nodejs/test:../lib/nodejs/lib:${NODE_PATH}")
-count = 0
-for server in data["server"]:
-  if (server["lib"] in serversList or len(serversList) == 0) and platform in 
server["platform"]:
-    server_executable = server["executable"]
-    server_extra_args = ""
-    server_lib = server["lib"]
-    if "extra_args" in server:
-      server_extra_args = server["extra_args"]
-    for protocol in server["protocols"]:
-      for transport in server["transports"]:
-        for sock in server["sockets"]:
-          for client in data["client"]:
-            if (client["lib"] in clientsList or len(clientsList) == 0) and 
platform in client["platform"]:
-              client_executable = client["executable"]
-              client_extra_args = ""
-              client_lib = client["lib"]
-              if "extra_args" in client:
-                client_extra_args = client["extra_args"]
-              if protocol in client["protocols"]:
-                if transport in client["transports"]:
-                  if sock in client["sockets"]:
-                    if count != 0:
-                      results_json.write(",\n")
-                    count = 1
-                    results_json.write("\t[\n\t\t\"" + server_lib + 
"\",\n\t\t\"" + client_lib + "\",\n\t\t\"" + protocol + "\",\n\t\t\"" + 
transport + "-" + sock + "\",\n" )
-                    test_name = server_lib + "_" + client_lib + "_" + protocol 
+ "_" + transport + "_" + sock
-                    ret = runServiceTest(test_name, server_lib, 
server_executable, server_extra_args, client_lib, client_executable, 
client_extra_args, protocol, protocol, transport, options.port, 0, sock)
-                    if ret != None:
-                      failed += 1
-                      if client["exit"] == "hard" and server["exit"] == "hard":
-                        hard_fail_count +=1
-                      print "Error: %s" % ret
-                      print "Using"
-                      print (' Server: %s --protocol=%s --transport=%s %s %s'
-                        % (server_executable, protocol, transport, 
getSocketArgs(sock), ' '.join(server_extra_args)))
-                      print (' Client: %s --protocol=%s --transport=%s %s %s'
-                        % (client_executable, protocol, transport, 
getSocketArgs(sock), ''.join(client_extra_args)))
-                      results_json.write("\t\t\"failure\",\n")
-                    else:
-                      results_json.write("\t\t\"success\",\n")
-                    results_json.write("\t\t{\n\t\t\t\"Client\":\"log/" + 
test_name + "_client.log\",\n\t\t\t\"Server\":\"log/" + test_name + 
"_server.log\"\n\t\t}\n\t]")
-                    test_count += 1
-              if protocol == 'binary' and 'accel' in client["protocols"]:
-                if transport in client["transports"]:
-                  if sock in client["sockets"]:
-                    if count != 0:
-                      results_json.write(",\n")
-                    count = 1
-                    results_json.write("\t[\n\t\t\"" + server_lib + 
"\",\n\t\t\"" + client_lib + "\",\n\t\t\"accel-binary\",\n\t\t\"" + transport + 
"-" + sock + "\",\n" )
-                    test_name = server_lib + "_" + client_lib + 
"_accel-binary_" + transport + "_" + sock
-                    ret = runServiceTest(test_name, 
server_lib,server_executable, server_extra_args, client_lib, client_executable, 
client_extra_args, protocol, 'accel', transport, options.port, 0, sock)
+    return int(os.environ.get('THRIFT_CROSSTEST_CONCURRENCY'))
+  except (TypeError, ValueError):
+    # Since much time is spent sleeping, use many threads
+    return int(multiprocessing.cpu_count() * 1.25) + 1
+
+
+def main(argv):
+  parser = optparse.OptionParser()
+  parser.add_option('--server', type='string', dest='servers', default='',
+                    help='list of servers to test separated by commas, eg:- 
--server=cpp,java')
+  parser.add_option('--client', type='string', dest='clients', default='',
+                    help='list of clients to test separated by commas, eg:- 
--client=cpp,java')
+  parser.add_option('-s', '--skip-known-failures', action='store_true', 
dest='skip_known_failures',
+                    help='do not execute tests that are known to fail')
+  parser.add_option('-j', '--jobs', type='int', dest='jobs',
+                    default=default_concurrenty(),
+                    help='number of concurrent test executions')
+  g = optparse.OptionGroup(parser, 'Advanced')
+  g.add_option('-v', '--verbose', action='store_const',
+               dest='log_level', const=logging.DEBUG, default=logging.WARNING,
+               help='show debug output for test runner')
+  g.add_option('-P', '--print-expected-failures', choices=['merge', 
'overwrite'],
+               dest='print_failures', default=None,
+               help="generate expected failures based on last result and print 
to stdout")
+  g.add_option('-U', '--update-expected-failures', choices=['merge', 
'overwrite'],
+               dest='update_failures', default=None,
+               help="generate expected failures based on last result and save 
to default file location")
+  g.add_option('--prepare', action='store_true',
+               dest='prepare',
+               help="try to prepare files needed for cross test 
(experimental)")
+  parser.add_option_group(g)
+  logger = multiprocessing.log_to_stderr()
+  options, _ = parser.parse_args(argv)
+  server_match = options.servers.split(',') if options.servers else []
+  client_match = options.clients.split(',') if options.clients else []
+  logger.setLevel(options.log_level)
+
+  if options.prepare:
+    res = prepare(server_match, client_match)
+  elif options.update_failures or options.print_failures:
+    res = crossrunner.generate_known_failures(
+        TEST_DIR, options.update_failures == 'overwrite',
+        options.update_failures, options.print_failures)
+  else:
+    res = run_tests(server_match, client_match, options.jobs, 
options.skip_known_failures)
+  return 0 if res else 1
 
-                    if ret != None:
-                      failed += 1
-                      if client["exit"] == "hard" and server["exit"] == "hard":
-                        hard_fail_count +=1
-                      print "Error: %s" % ret
-                      print "Using"
-                      print (' Server: %s --protocol=%s --transport=%s %s %s'
-                        % (server_executable, protocol, transport, 
getSocketArgs(sock), ' '.join(server_extra_args)))
-                      print (' Client: %s --protocol=%s --transport=%s %s %s'
-                        % (client_executable, protocol, transport , 
getSocketArgs(sock), ''.join(client_extra_args)))
-                      results_json.write("\t\t\"failure\",\n")
-                    else:
-                      results_json.write("\t\t\"success\",\n")
-                    results_json.write("\t\t{\n\t\t\t\"Client\":\"log/" + 
test_name + "_client.log\",\n\t\t\t\"Server\":\"log/" + test_name + 
"_server.log\"\n\t\t}\n\t]")
-                    test_count += 1
-              if protocol == 'accel' and 'binary' in client["protocols"]:
-                if transport in client["transports"]:
-                  if sock in client["sockets"]:
-                    if count != 0:
-                      results_json.write(",\n")
-                    count = 1
-                    results_json.write("\t[\n\t\t\"" + server_lib + 
"\",\n\t\t\"" + client_lib + "\",\n\t\t\"binary-accel\",\n\t\t\"" + transport + 
"-" + sock + "\",\n" )
-                    test_name = server_lib + "_" + client_lib + 
"_binary-accel_" + transport + "_" + sock
-                    ret = runServiceTest(test_name, 
server_lib,server_executable, server_extra_args, client_lib, client_executable, 
client_extra_args, protocol, 'binary', transport, options.port, 0, sock)
-                    if ret != None:
-                      failed += 1
-                      if client["exit"] == "hard" and server["exit"] == "hard":
-                        hard_fail_count +=1
-                      print "Error: %s" % ret
-                      print "Using"
-                      print (' Server: %s --protocol=%s --transport=%s %s %s'
-                        % (server_executable, protocol, transport + sock, 
getSocketArgs(sock), ' '.join(server_extra_args)))
-                      print (' Client: %s --protocol=%s --transport=%s %s %s'
-                        % (client_executable, protocol, transport + sock, 
getSocketArgs(sock), ''.join(client_extra_args)))
-                      results_json.write("\t\t\"failure\",\n")
-                    else:
-                      results_json.write("\t\t\"success\",\n")
-                    results_json.write("\t\t{\n\t\t\t\"Client\":\"log/" + 
test_name + "_client.log\",\n\t\t\t\"Server\":\"log/" + test_name + 
"_server.log\"\n\t\t}\n\t]")
-                    test_count += 1
-results_json.write("\n]")
-results_json.flush()
-results_json.close()
-print '%s failed of %s tests in total' % (failed, test_count)
-sys.exit(hard_fail_count)
\ No newline at end of file
+if __name__ == '__main__':
+  sys.exit(main(sys.argv[1:]))

http://git-wip-us.apache.org/repos/asf/thrift/blob/41ad4342/test/tests.json
----------------------------------------------------------------------
diff --git a/test/tests.json b/test/tests.json
index 5abafdf..c428786 100644
--- a/test/tests.json
+++ b/test/tests.json
@@ -1,280 +1,344 @@
-{
-    "client": [
-        {
-            "description": "Python TestClient",
-            "lib": "py",
-            "executable": "py/TestClient.py",
-            "exit": "hard",
-            "extra_args":  ["--genpydir=gen-py"],
-            "protocols": [
-                "binary",
-                "compact",
-                "json",
-                "accel"
-            ],
-            "transports": [
-                "buffered",
-                "framed"
-            ],
-            "sockets": [
-                "ip",
-                "ip-ssl"
-            ],
-            "platform": [
-                "Linux"
-            ]
-        },
-        {
-            "description": "C++ TestClient",
-            "lib": "cpp",
-            "executable": "cpp/TestClient",
-            "exit": "hard",
-            "protocols": [
-                "binary",
-                "compact",
-                "json"
-            ],
-            "transports": [
-                "buffered",
-                "framed",
-                "http"
-            ],
-            "sockets": [
-                "ip",
-                "ip-ssl",
-                "domain"
-            ],
-            "platform": [
-                "Linux"
-            ]
-        },
-        {
-            "description": "Nodejs TestClient",
-            "lib": "nodejs",
-            "executable": "../lib/nodejs/test/client.js",
-            "exit": "soft",
-            "protocols": [
-                "binary",
-                "compact",
-                "json"
-            ],
-            "transports": [
-                "buffered",
-                "framed"
-            ],
-            "sockets": [
-                "ip",
-                "ip-ssl"
-            ],
-            "platform": [
-                "Linux"
-            ]
-        },
-        {
-            "description": "Ruby TestClient",
-            "lib": "ruby",
-            "executable": "rb/integration/TestClient.rb",
-            "exit": "soft",
-            "protocols": [
-                "binary",
-                "compact",
-                "json",
-                "accel"
-            ],
-            "transports": [
-                "buffered",
-                "framed"
-            ],
-            "sockets": [
-                "ip"
-            ],
-            "platform": [
-                "Linux"
-            ]
-        },
-        {
-            "description": "Java TestClient",
-            "lib": "java",
-            "executable": 
["ant","-f","../lib/java/build.xml","-Dno-gen-thrift=\"\""],
-            "extra_args": ["run-testclient"],
-            "exit": "hard",
-            "protocols": [
-                "binary",
-                "compact",
-                "json"
-            ],
-            "transports": [
-                "buffered",
-                "framed",
-                "fastframed",
-                "http"
-            ],
-            "sockets": [
-                "ip",
-                "ip-ssl"
-            ],
-            "platform": [
-                "Linux"
-            ]
-        },
-        {
-            "description": "Haskell TestClient",
-            "lib": "hs",
-            "executable": "hs/TestClient",
-            "exit": "hard",
-            "protocols": [
-                "binary",
-                "compact",
-                "json"
-            ],
-            "transports": [
-                "buffered"
-            ],
-            "sockets": [
-                "ip"
-            ],
-            "platform": [
-                "Linux"
-            ]
-        }
+[
+  {
+    "name": "c_glib",
+    "platforms": [
+      "Linux"
     ],
-    "server": [
-        {
-            "description": "Python TSimpleServer",
-            "lib": "py",
-            "executable": "py/TestServer.py",
-            "extra_args": ["--genpydir=gen-py", "TSimpleServer"],
-            "extra_delay": 0,
-            "exit": "soft",
-            "protocols": [
-                "binary",
-                "compact",
-                "json",
-                "accel"
-            ],
-            "transports": [
-                "buffered",
-                "framed"
-            ],
-            "sockets": [
-                "ip",
-                "ip-ssl"
-            ],
-            "platform": [
-                "Linux"
-            ]
-        },
-        {
-            "description": "C++ TestServer",
-            "lib": "cpp",
-            "executable": "cpp/TestServer",
-            "exit": "hard",
-            "protocols": [
-                "binary",
-                "compact",
-                "json"
-            ],
-            "transports": [
-                "buffered",
-                "framed",
-                "http"
-            ],
-            "sockets": [
-                "ip",
-                "ip-ssl",
-                "domain"
-            ],
-            "platform": [
-                "Linux"
-            ]
-        },
-        {
-            "description": "Ruby TestServer",
-            "lib": "ruby",
-            "executable": "rb/integration/TestServer.rb",
-            "exit": "soft",
-            "protocols": [
-                "binary",
-                "compact",
-                "json",
-                "accel"
-            ],
-            "transports": [
-                "buffered",
-                "framed"
-            ],
-            "sockets": [
-                "ip"
-            ],
-            "platform": [
-                "Linux"
-            ]
-        },
-        {
-            "description": "Nodejs TestServer",
-            "lib": "nodejs",
-            "executable": "../lib/nodejs/test/server.js",
-            "exit": "soft",
-            "protocols": [
-                "binary",
-                "compact",
-                "json"
-            ],
-            "transports": [
-                "buffered",
-                "framed"
-            ],
-            "sockets": [
-                "ip",
-                "ip-ssl"
-            ],
-            "platform": [
-                "Linux"
-            ]
-        },
-        {
-            "description": "Java TestServer",
-            "lib": "java",
-            "executable": 
["ant","-f","../lib/java/build.xml","-Dno-gen-thrift=\"\""],
-            "extra_args": ["run-testserver"],
-            "exit": "hard",
-            "protocols": [
-                "binary",
-                "compact",
-                "json"
-            ],
-            "transports": [
-                "buffered",
-                "framed",
-                "fastframed"
-            ],
-            "sockets": [
-                "ip",
-                "ip-ssl"
-            ],
-            "platform": [
-                "Linux"
-            ]
-        },
-        {
-            "description": "Haskell TestServer",
-            "lib": "hs",
-            "executable": "hs/TestServer",
-            "exit": "hard",
-            "protocols": [
-                "binary",
-                "compact",
-                "json"
-            ],
-            "transports": [
-                "buffered"
-            ],
-            "sockets": [
-                "ip"
-            ],
-            "platform": [
-                "Linux"
-            ]
-        }
-    ]
-}
+    "server": {
+      "delay": 1,
+      "command": [
+        "test_server"
+      ]
+    },
+    "client": {
+      "command": [
+        "test_client"
+      ]
+    },
+    "transports": [
+      "buffered",
+      "framed"
+    ],
+    "sockets": [
+      "ip"
+    ],
+    "protocols": [
+      "binary"
+    ],
+    "workdir": "c_glib"
+  },
+  {
+    "name": "go",
+    "server": {
+      "delay": 1,
+      "command": [
+        "testserver",
+        "--certPath=../../keys"
+      ]
+    },
+    "client": {
+      "timeout": 6,
+      "command": [
+        "testclient"
+      ]
+    },
+    "transports": [
+      "buffered",
+      "framed"
+    ],
+    "sockets": [
+      "ip",
+      "ip-ssl"
+    ],
+    "protocols": [
+      "binary",
+      "compact",
+      "json"
+    ],
+    "workdir": "go/bin"
+  },
+  {
+    "name": "java",
+    "join_args": true,
+    "command": [
+      "ant",
+      "-f",
+      "build.xml",
+      "-Dno-gen-thrift=\"\"",
+      "-Dtestargs"
+    ],
+    "prepare": [
+      "ant",
+      "-f",
+      "build.xml",
+      "compile-test"
+    ],
+    "server": {
+      "delay": 5,
+      "extra_args": ["run-testserver"]
+    },
+    "client": {
+      "timeout": 13,
+      "extra_args": ["run-testclient"],
+      "transports": [
+        "http"
+      ]
+    },
+    "transports": [
+      "buffered",
+      "framed",
+      "framed:fastframed"
+    ],
+    "sockets": [
+      "ip-ssl",
+      "ip"
+    ],
+    "protocols": [
+      "compact",
+      "binary",
+      "json"
+    ],
+    "workdir": "../lib/java"
+  },
+  {
+    "name": "nodejs",
+    "env": {
+      "NODE_PATH": "../lib"
+    },
+    "server": {
+      "delay": 1,
+      "command": [
+        "node",
+        "server.js",
+        "--type=tcp"
+      ]
+    },
+    "client": {
+      "timeout": 2.9,
+      "command": [
+        "node",
+        "client.js",
+        "--type=tcp"
+      ]
+    },
+    "transports": [
+      "buffered",
+      "framed"
+    ],
+    "sockets": [
+      "ip-ssl",
+      "ip"
+    ],
+    "protocols": [
+      "compact",
+      "binary",
+      "json"
+    ],
+    "workdir": "../lib/nodejs/test"
+  },
+  {
+    "name": "hs",
+    "server": {
+      "command": [
+        "TestServer"
+      ]
+    },
+    "client": {
+      "timeout": 6,
+      "command": [
+        "TestClient"
+      ]
+    },
+    "transports": [
+      "buffered",
+      "framed",
+      "http",
+      "http:evhttp"
+    ],
+    "sockets": [
+      "ip",
+      "ip-ssl"
+    ],
+    "protocols": [
+      "compact",
+      "binary",
+      "json"
+    ],
+    "workdir": "hs"
+  },
+  {
+    "name": "py",
+    "server": {
+      "delay": 1,
+      "extra_args": ["TSimpleServer"],
+      "command": [
+        "TestServer.py",
+        "--genpydir=gen-py"
+      ]
+    },
+    "client": {
+      "timeout": 10,
+      "command": [
+        "TestClient.py",
+        "--host=localhost",
+        "--genpydir=gen-py"
+      ]
+    },
+    "transports": [
+      "buffered",
+      "framed"
+    ],
+    "sockets": [
+      "ip-ssl",
+      "ip"
+    ],
+    "protocols": [
+      "compact",
+      "binary",
+      "json",
+      "binary:accel"
+    ],
+    "workdir": "py"
+  },
+  {
+    "name": "cpp",
+    "server": {
+      "delay": 2,
+      "command": [
+        "TestServer"
+      ]
+    },
+    "client": {
+      "timeout": 8,
+      "command": [
+        "TestClient"
+      ]
+    },
+    "transports": [
+      "buffered",
+      "http",
+      "framed"
+    ],
+    "sockets": [
+      "ip-ssl",
+      "ip",
+      "domain"
+    ],
+    "protocols": [
+      "compact",
+      "binary",
+      "json"
+    ],
+    "workdir": "cpp"
+  },
+  {
+    "name": "rb",
+    "server": {
+      "delay": 1,
+      "command": [
+        "ruby",
+        "../integration/TestServer.rb"
+      ]
+    },
+    "client": {
+      "timeout": 5,
+      "command": [
+        "ruby",
+        "../integration/TestClient.rb",
+        "--host=127.0.0.1"
+      ]
+    },
+    "transports": [
+      "buffered",
+      "framed"
+    ],
+    "sockets": [
+      "ip"
+    ],
+    "protocols": [
+      "compact",
+      "binary",
+      "json",
+      "binary:accel"
+    ],
+    "workdir": "rb/gen-rb"
+  },
+  {
+    "name": "csharp",
+    "env": {
+      "MONO_PATH": "../.."
+    },
+    "transports": [
+      "buffered",
+      "framed"
+    ],
+    "sockets": [
+      "ip",
+      "ip-ssl"
+    ],
+    "protocols": [
+      "binary",
+      "compact",
+      "json"
+    ],
+    "server": {
+      "delay": 3,
+      "command": [
+        "TestClientServer.exe",
+        "server",
+        "--cert=../../../../test/keys/server.pem"
+      ]
+    },
+    "client": {
+      "timeout": 9,
+      "command": [
+        "TestClientServer.exe",
+        "client",
+        "--cert=../../../../test/keys/client.pem"
+      ]
+    },
+    "workdir": "../lib/csharp/test/ThriftTest"
+  },
+  {
+    "name": "perl",
+    "client": {
+      "transports": [
+        "buffered"
+      ],
+      "sockets": [
+        "ip"
+      ],
+      "protocols": [
+        "binary"
+      ],
+      "command": [
+        "perl",
+        "-Igen-perl/",
+        "-I../../lib/perl/lib/",
+        "TestClient.pl"
+      ]
+    },
+    "workdir": "perl"
+  },
+  {
+    "name": "php",
+    "client": {
+      "timeout": 6,
+      "transports": [
+        "buffered",
+        "framed"
+      ],
+      "sockets": [
+        "ip"
+      ],
+      "protocols": [
+        "binary"
+      ],
+      "command": [
+        "php",
+        "TestClient.php"
+      ]
+    },
+    "workdir": "php"
+  }
+]

Reply via email to