Repository: thrift
Updated Branches:
  refs/heads/master 8d8d6573f -> aad06deed


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


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

Branch: refs/heads/master
Commit: aad06deedd780d443312905fbd80a081fa8fb442
Parents: 8d8d657
Author: Jens Geyer <[email protected]>
Authored: Sat Nov 21 14:43:56 2015 +0100
Committer: Jens Geyer <[email protected]>
Committed: Sat Nov 21 15:03:32 2015 +0100

----------------------------------------------------------------------
 test/crossrunner/report.py |  9 +++++++--
 test/crossrunner/run.py    | 10 ++++++++--
 test/crossrunner/test.py   | 10 ++++++++--
 3 files changed, 23 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/aad06dee/test/crossrunner/report.py
----------------------------------------------------------------------
diff --git a/test/crossrunner/report.py b/test/crossrunner/report.py
index a284d2b..6ffc8e2 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)

http://git-wip-us.apache.org/repos/asf/thrift/blob/aad06dee/test/crossrunner/run.py
----------------------------------------------------------------------
diff --git a/test/crossrunner/run.py b/test/crossrunner/run.py
index ae7d366..8de6ba9 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()

http://git-wip-us.apache.org/repos/asf/thrift/blob/aad06dee/test/crossrunner/test.py
----------------------------------------------------------------------
diff --git a/test/crossrunner/test.py b/test/crossrunner/test.py
index 3750ba3..6a30b3e 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
 

Reply via email to