summaryrefslogtreecommitdiff
path: root/test/crossrunner
diff options
context:
space:
mode:
authorJens Geyer <jensg@apache.org>2015-11-21 14:43:56 +0100
committerJens Geyer <jensg@apache.org>2015-11-21 15:03:32 +0100
commitaad06deedd780d443312905fbd80a081fa8fb442 (patch)
tree72c857715336de61b35fbf331cc0db2e14f14dd9 /test/crossrunner
parent8d8d6573f7d18150f6915484babbe82d6af60b58 (diff)
downloadthrift-aad06deedd780d443312905fbd80a081fa8fb442.tar.gz
THRIFT-3436 cross test fails with "UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 20: ordinal not in range(128)"
Client: Test Suite Patch: Jens Geyer
Diffstat (limited to 'test/crossrunner')
-rw-r--r--test/crossrunner/report.py9
-rw-r--r--test/crossrunner/run.py10
-rw-r--r--test/crossrunner/test.py10
3 files changed, 23 insertions, 6 deletions
diff --git a/test/crossrunner/report.py b/test/crossrunner/report.py
index a284d2b40..6ffc8e2d8 100644
--- a/test/crossrunner/report.py
+++ b/test/crossrunner/report.py
@@ -84,7 +84,7 @@ class TestReporter(object):
@classmethod
def test_logfile(cls, test_name, prog_kind, dir=None):
relpath = os.path.join('log', '%s_%s.log' % (test_name, prog_kind))
- return relpath if not dir else os.path.realpath(os.path.join(dir, relpath))
+ return relpath if not dir else os.path.realpath(os.path.join(dir.decode(sys.getfilesystemencoding()), relpath.decode(sys.getfilesystemencoding())).encode(sys.getfilesystemencoding()))
def _start(self):
self._start_time = time.time()
@@ -194,8 +194,13 @@ class ExecReporter(TestReporter):
self.out.close()
def _print_header(self):
+ tmp = list()
+ joined = ''
+ for item in self._prog.command:
+ tmp.append( item.decode(sys.getfilesystemencoding()))
+ joined = ' '.join(tmp).encode(sys.getfilesystemencoding())
self._print_date()
- self.out.write('Executing: %s\n' % ' '.join(self._prog.command))
+ self.out.write('Executing: %s\n' % joined)
self.out.write('Directory: %s\n' % self._prog.workdir)
self.out.write('config:delay: %s\n' % self._test.delay)
self.out.write('config:timeout: %s\n' % self._test.timeout)
diff --git a/test/crossrunner/run.py b/test/crossrunner/run.py
index ae7d3664c..8de6ba92f 100644
--- a/test/crossrunner/run.py
+++ b/test/crossrunner/run.py
@@ -21,6 +21,7 @@ import contextlib
import multiprocessing
import multiprocessing.managers
import os
+import sys
import platform
import random
import socket
@@ -81,11 +82,16 @@ class ExecutionContext(object):
return args
def start(self, timeout=0):
- self._log.debug('COMMAND: %s', ' '.join(self.cmd))
+ tmp = list()
+ joined = ''
+ for item in self.cmd:
+ tmp.append( item.decode(sys.getfilesystemencoding()))
+ joined = ' '.join(tmp).encode(sys.getfilesystemencoding())
+ self._log.debug('COMMAND: %s', joined)
self._log.debug('WORKDIR: %s', self.cwd)
self._log.debug('LOGFILE: %s', self.report.logpath)
self.report.begin()
- self.proc = subprocess.Popen(self.cmd, **self._popen_args())
+ self.proc = subprocess.Popen(tmp, **self._popen_args())
if timeout > 0:
self.timer = threading.Timer(timeout, self._expire)
self.timer.start()
diff --git a/test/crossrunner/test.py b/test/crossrunner/test.py
index 3750ba393..6a30b3e0a 100644
--- a/test/crossrunner/test.py
+++ b/test/crossrunner/test.py
@@ -51,7 +51,9 @@ class TestProgram(object):
def _fix_cmd_path(self, cmd):
# if the arg is a file in the current directory, make it path
def abs_if_exists(arg):
- p = os.path.join(self.workdir, arg)
+ p = self.workdir.decode(sys.getfilesystemencoding())
+ p = os.path.join(p, arg.decode(sys.getfilesystemencoding()))
+ p = p.encode(sys.getfilesystemencoding())
return p if os.path.exists(p) else arg
if cmd[0] == 'python':
@@ -113,7 +115,11 @@ class TestEntry(object):
if os.path.isabs(path):
path = os.path.realpath(path)
else:
- path = os.path.realpath(os.path.join(self.testdir, path))
+ tmp = self.testdir.decode(sys.getfilesystemencoding())
+ path = path.decode(sys.getfilesystemencoding())
+ path = os.path.join(tmp, path)
+ path = path.encode(sys.getfilesystemencoding())
+ path = os.path.realpath(path)
config.update({key: path})
return config