THRIFT-3452 .travis.yml: Migrating from legacy to container-based infrastructure
Client: Build
Patch: Nobuaki Sukegawa
Use "services: docker"
This closes #730
diff --git a/test/crossrunner/__init__.py b/test/crossrunner/__init__.py
index 06de2d0..584cc07 100644
--- a/test/crossrunner/__init__.py
+++ b/test/crossrunner/__init__.py
@@ -17,9 +17,8 @@
# under the License.
#
-from crossrunner.test import test_name
-from crossrunner.collect import collect_tests
-from crossrunner.run import TestDispatcher
-from crossrunner.report import generate_known_failures
-from crossrunner.report import load_known_failures
-from crossrunner.prepare import prepare
+from .test import test_name
+from .collect import collect_tests
+from .run import TestDispatcher
+from .report import generate_known_failures, load_known_failures
+from .prepare import prepare
diff --git a/test/crossrunner/collect.py b/test/crossrunner/collect.py
index 145afef..c6e33e9 100644
--- a/test/crossrunner/collect.py
+++ b/test/crossrunner/collect.py
@@ -20,7 +20,7 @@
import platform
from itertools import product
-from crossrunner.util import merge_dict
+from .util import merge_dict
# Those keys are passed to execution as is.
# Note that there are keys other than these, namely:
diff --git a/test/crossrunner/compat.py b/test/crossrunner/compat.py
index 70992f6..6ab9d71 100644
--- a/test/crossrunner/compat.py
+++ b/test/crossrunner/compat.py
@@ -13,9 +13,12 @@
b = s.decode(_ENCODE)
return b.join(bin_args).encode(_ENCODE)
+ logfile_open = open
+
else:
path_join = os.path.join
+ str_join = str.join
- def str_join(s, l):
- return s.join(l)
+ def logfile_open(*args):
+ return open(*args, errors='replace')
diff --git a/test/crossrunner/prepare.py b/test/crossrunner/prepare.py
index 6e4f6ee..c6784af 100644
--- a/test/crossrunner/prepare.py
+++ b/test/crossrunner/prepare.py
@@ -20,7 +20,7 @@
import os
import subprocess
-from crossrunner.collect import collect_testlibs
+from .collect import collect_testlibs
def prepare(config_dict, testdir, server_match, client_match):
diff --git a/test/crossrunner/report.py b/test/crossrunner/report.py
index bcfe181..defc486 100644
--- a/test/crossrunner/report.py
+++ b/test/crossrunner/report.py
@@ -17,6 +17,7 @@
# under the License.
#
+from __future__ import print_function
import datetime
import json
import multiprocessing
@@ -28,7 +29,7 @@
import time
import traceback
-from .compat import path_join, str_join
+from .compat import logfile_open, path_join, str_join
from .test import TestEntry
LOG_DIR = 'log'
@@ -44,7 +45,7 @@
if not r[success_index]:
yield TestEntry.get_name(*r)
try:
- with open(os.path.join(testdir, RESULT_JSON), 'r') as fp:
+ with logfile_open(os.path.join(testdir, RESULT_JSON), 'r') as fp:
results = json.load(fp)
except IOError:
sys.stderr.write('Unable to load last result. Did you run tests ?\n')
@@ -67,7 +68,7 @@
def load_known_failures(testdir):
try:
- with open(os.path.join(testdir, FAIL_JSON % platform.system()), 'r') as fp:
+ with logfile_open(os.path.join(testdir, FAIL_JSON % platform.system()), 'r') as fp:
return json.load(fp)
except IOError:
return []
@@ -138,16 +139,7 @@
self._lock.release()
def killed(self):
- self._lock.acquire()
- try:
- if self.out and not self.out.closed:
- self._print_footer()
- self._close()
- self.out = None
- else:
- self._log.debug('Output stream is not available.')
- finally:
- self._lock.release()
+ self.end(None)
_init_failure_exprs = {
'server': list(map(re.compile, [
@@ -177,8 +169,7 @@
server_logfile = self.logpath
# need to handle unicode errors on Python 3
- kwargs = {} if sys.version_info[0] < 3 else {'errors': 'replace'}
- with open(server_logfile, 'r', **kwargs) as fp:
+ with logfile_open(server_logfile, 'r') as fp:
if any(map(match, fp)):
return True
except (KeyboardInterrupt, SystemExit):
@@ -345,12 +336,12 @@
def _assemble_log(self, title, indexes):
if len(indexes) > 0:
def add_prog_log(fp, test, prog_kind):
- fp.write('*************************** %s message ***************************\n'
- % prog_kind)
+ print('*************************** %s message ***************************' % prog_kind,
+ file=fp)
path = self.test_logfile(test.name, prog_kind, self.testdir)
- kwargs = {} if sys.version_info[0] < 3 else {'errors': 'replace'}
- with open(path, 'r', **kwargs) as prog_fp:
- fp.write(prog_fp.read())
+ if os.path.exists(path):
+ with logfile_open(path, 'r') as prog_fp:
+ print(prog_fp.read(), file=fp)
filename = title.replace(' ', '_') + '.log'
with open(os.path.join(self.logdir, filename), 'w+') as fp:
for test in map(self._tests.__getitem__, indexes):
@@ -358,7 +349,7 @@
add_prog_log(fp, test, test.server.kind)
add_prog_log(fp, test, test.client.kind)
fp.write('**********************************************************************\n\n')
- self.out.write('%s are logged to test/%s/%s\n' % (title.capitalize(), LOG_DIR, filename))
+ print('%s are logged to test/%s/%s' % (title.capitalize(), LOG_DIR, filename))
def end(self):
self._print_footer()
diff --git a/test/crossrunner/run.py b/test/crossrunner/run.py
index 129016c..acba335 100644
--- a/test/crossrunner/run.py
+++ b/test/crossrunner/run.py
@@ -21,15 +21,14 @@
import multiprocessing
import multiprocessing.managers
import os
-import sys
import platform
import random
-import socket
import signal
+import socket
import subprocess
+import sys
import threading
import time
-import traceback
from .compat import str_join
from .test import TestEntry, domain_socket_path
@@ -165,10 +164,10 @@
stop.set()
return None
except Exception as ex:
- logger.warn('Error while executing test : %s' % str(ex))
+ logger.warn('%s', ex)
if not async:
raise
- logger.info(traceback.print_exc())
+ logger.debug('Error executing [%s]', test.name, exc_info=sys.exc_info())
return RESULT_ERROR
diff --git a/test/crossrunner/test.py b/test/crossrunner/test.py
index 63219e1..49ba7d3 100644
--- a/test/crossrunner/test.py
+++ b/test/crossrunner/test.py
@@ -22,8 +22,7 @@
import os
import sys
from .compat import path_join
-
-from crossrunner.util import merge_dict
+from .util import merge_dict
def domain_socket_path(port):
diff --git a/test/dart/test_client/bin/main.dart b/test/dart/test_client/bin/main.dart
index 48c6b3c..5ad3cde 100644
--- a/test/dart/test_client/bin/main.dart
+++ b/test/dart/test_client/bin/main.dart
@@ -104,7 +104,7 @@
parser.addOption('port', defaultsTo: '9090', help: 'The port to connect to');
parser.addOption('transport',
defaultsTo: 'buffered',
- allowed: ['buffered', 'framed'],
+ allowed: ['buffered', 'framed', 'http'],
help: 'The transport name',
allowedHelp: {
'buffered': 'TBufferedTransport',
diff --git a/test/known_failures_Linux.json b/test/known_failures_Linux.json
index b05f61c..2293c5c 100644
--- a/test/known_failures_Linux.json
+++ b/test/known_failures_Linux.json
@@ -1,14 +1,12 @@
[
- "c_glib-rb_binary-accel_buffered-ip",
- "c_glib-rb_binary-accel_framed-ip",
- "c_glib-rb_binary_buffered-ip",
- "c_glib-rb_binary_framed-ip",
"cpp-cpp_binary_http-domain",
"cpp-cpp_binary_http-ip",
"cpp-cpp_compact_http-domain",
"cpp-cpp_header_http-domain",
"cpp-cpp_header_http-ip",
"cpp-cpp_json_http-ip",
+ "cpp-dart_binary_http-ip",
+ "cpp-dart_json_http-ip",
"cpp-hs_json_buffered-ip",
"cpp-hs_json_framed-ip",
"cpp-hs_json_http-ip",
@@ -18,8 +16,8 @@
"cpp-java_compact_http-ip-ssl",
"cpp-java_json_http-ip",
"cpp-java_json_http-ip-ssl",
- "cpp-nodejs_json_buffered-ip-ssl",
- "cpp-rb_json_buffered-ip",
+ "cpp-perl_binary_buffered-ip-ssl",
+ "cpp-perl_binary_framed-ip-ssl",
"csharp-cpp_binary_buffered-ip-ssl",
"csharp-cpp_binary_framed-ip-ssl",
"csharp-cpp_compact_buffered-ip-ssl",
@@ -42,19 +40,18 @@
"csharp-nodejs_binary_framed-ip-ssl",
"csharp-nodejs_compact_buffered-ip-ssl",
"csharp-nodejs_compact_framed-ip-ssl",
- "csharp-nodejs_json_buffered-ip",
"csharp-nodejs_json_buffered-ip-ssl",
"csharp-nodejs_json_framed-ip-ssl",
+ "csharp-perl_binary_buffered-ip-ssl",
+ "csharp-perl_binary_framed-ip-ssl",
"erl-cpp_compact_buffered-ip",
"erl-cpp_compact_buffered-ip-ssl",
"erl-cpp_compact_framed-ip",
"erl-cpp_compact_framed-ip-ssl",
- "erl-go_binary_buffered-ip-ssl",
- "erl-go_binary_framed-ip-ssl",
- "erl-go_compact_buffered-ip-ssl",
- "erl-go_compact_framed-ip-ssl",
"erl-nodejs_binary_buffered-ip",
"erl-nodejs_compact_buffered-ip",
+ "erl-perl_binary_buffered-ip-ssl",
+ "erl-perl_binary_framed-ip-ssl",
"erl-rb_binary-accel_buffered-ip",
"erl-rb_binary-accel_framed-ip",
"erl-rb_binary_buffered-ip",
@@ -92,24 +89,30 @@
"java-hs_json_buffered-ip",
"java-hs_json_fastframed-framed-ip",
"java-hs_json_framed-ip",
- "nodejs-csharp_compact_buffered-ip-ssl",
- "nodejs-csharp_compact_framed-ip-ssl",
- "nodejs-csharp_json_buffered-ip",
- "nodejs-csharp_json_buffered-ip-ssl",
- "nodejs-csharp_json_framed-ip",
- "nodejs-csharp_json_framed-ip-ssl",
+ "java-perl_binary_buffered-ip-ssl",
+ "java-perl_binary_fastframed-framed-ip-ssl",
+ "java-perl_binary_framed-ip-ssl",
"nodejs-hs_binary_buffered-ip",
"nodejs-hs_binary_framed-ip",
"nodejs-hs_compact_buffered-ip",
"nodejs-hs_compact_framed-ip",
"nodejs-hs_json_buffered-ip",
"nodejs-hs_json_framed-ip",
- "nodejs-rb_json_buffered-ip",
+ "nodejs-perl_binary_buffered-ip-ssl",
+ "nodejs-perl_binary_framed-ip-ssl",
+ "perl-perl_binary_buffered-ip-ssl",
+ "perl-perl_binary_framed-ip-ssl",
"perl-php_binary_framed-ip",
"py-hs_json_buffered-ip",
"py-hs_json_framed-ip",
+ "py-perl_accel-binary_buffered-ip-ssl",
+ "py-perl_accel-binary_framed-ip-ssl",
+ "py-perl_binary_buffered-ip-ssl",
+ "py-perl_binary_framed-ip-ssl",
"py3-hs_json_buffered-ip",
"py3-hs_json_framed-ip",
+ "py3-perl_binary_buffered-ip-ssl",
+ "py3-perl_binary_framed-ip-ssl",
"rb-hs_json_buffered-ip",
"rb-hs_json_framed-ip"
-]
\ No newline at end of file
+]
diff --git a/test/rb/integration/TestClient.rb b/test/rb/integration/TestClient.rb
index 6aec596..15dcbfd 100755
--- a/test/rb/integration/TestClient.rb
+++ b/test/rb/integration/TestClient.rb
@@ -318,9 +318,9 @@
def test_oneway
p 'test_oneway'
time1 = Time.now.to_f
- @client.testOneway(3)
+ @client.testOneway(1)
time2 = Time.now.to_f
- assert_equal((time2-time1)*1000000<400, true)
+ assert_operator (time2-time1), :<, 0.1
end
end
diff --git a/test/tests.json b/test/tests.json
index 2c1aa70..be7d52b 100644
--- a/test/tests.json
+++ b/test/tests.json
@@ -325,6 +325,7 @@
"server": {
"delay": 3,
"command": [
+ "mono",
"TestClientServer.exe",
"server"
]
@@ -332,6 +333,7 @@
"client": {
"timeout": 9,
"command": [
+ "mono",
"TestClientServer.exe",
"client"
]
@@ -451,6 +453,7 @@
]
},
"server": {
+ "delay": 5,
"command": [
"erl",
"+K",