diff options
author | Alexander Pyhalov <apyhalov@gmail.com> | 2020-01-28 21:31:44 +0300 |
---|---|---|
committer | Dan McDonald <danmcd@joyent.com> | 2020-02-05 09:34:36 -0500 |
commit | cdd7a662d2c0914e93e1daa44cebae7003c99777 (patch) | |
tree | 8bfa3eb100fd13d59f866730cdc0387f9e98a126 /usr/src/test/test-runner | |
parent | 7484d76e78bc19298de9589214be103d65cf3989 (diff) | |
download | illumos-gate-cdd7a662d2c0914e93e1daa44cebae7003c99777.tar.gz |
12254 python changes have broken the zfs test suite
Reviewed by: Andy Fiddaman <omnios@citrus-it.co.uk>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Approved by: Dan McDonald <danmcd@joyent.com>
Diffstat (limited to 'usr/src/test/test-runner')
-rw-r--r-- | usr/src/test/test-runner/cmd/run | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/usr/src/test/test-runner/cmd/run b/usr/src/test/test-runner/cmd/run index 5966397dfa..364992d482 100644 --- a/usr/src/test/test-runner/cmd/run +++ b/usr/src/test/test-runner/cmd/run @@ -26,6 +26,7 @@ if PY3: else: import ConfigParser as configparser +import io import os import logging import platform @@ -59,7 +60,7 @@ class WatchedFileHandlerClosed(WatchedFileHandler): giving up, default 5. """ - def __init__(self, filename, mode='a', encoding=None, delay=0, max_tries=5): + def __init__(self, filename, mode='a', encoding='utf-8', delay=0, max_tries=5): self.max_tries = max_tries self.tries = 0 WatchedFileHandler.__init__(self, filename, mode, encoding, delay) @@ -146,7 +147,7 @@ class Output(object): for easy sorting/merging later. """ fd = self.fileno() - buf = os.read(fd, 4096).decode() + buf = os.read(fd, 4096).decode('utf-8') if not buf: return None if '\n' not in buf: @@ -316,15 +317,24 @@ class Cmd(object): logger.debug('%s %s' % (dt.strftime("%H:%M:%S.%f ")[:11], line)) if len(self.result.stdout): - with open(os.path.join(self.outputdir, 'stdout'), 'w') as out: + with io.open(os.path.join(self.outputdir, 'stdout'), + encoding='utf-8', + errors='surrogateescape', + mode='w') as out: for _, line in self.result.stdout: out.write('%s\n' % line) if len(self.result.stderr): - with open(os.path.join(self.outputdir, 'stderr'), 'w') as err: + with io.open(os.path.join(self.outputdir, 'stderr'), + encoding='utf-8', + errors='surrogateescape', + mode='w') as err: for _, line in self.result.stderr: err.write('%s\n' % line) if len(self.result.stdout) and len(self.result.stderr): - with open(os.path.join(self.outputdir, 'merged'), 'w') as merged: + with io.open(os.path.join(self.outputdir, 'merged'), + encoding='utf-8', + errors='surrogateescape', + mode='w') as merged: for _, line in lines: merged.write('%s\n' % line) |