summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr/src/test/test-runner/cmd/run20
-rw-r--r--usr/src/test/zfs-tests/tests/functional/channel_program/synctask_core/tst.destroy_fs.ksh4
2 files changed, 17 insertions, 7 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)
diff --git a/usr/src/test/zfs-tests/tests/functional/channel_program/synctask_core/tst.destroy_fs.ksh b/usr/src/test/zfs-tests/tests/functional/channel_program/synctask_core/tst.destroy_fs.ksh
index b2e0e600ea..6120ba6051 100644
--- a/usr/src/test/zfs-tests/tests/functional/channel_program/synctask_core/tst.destroy_fs.ksh
+++ b/usr/src/test/zfs-tests/tests/functional/channel_program/synctask_core/tst.destroy_fs.ksh
@@ -14,10 +14,10 @@
# Copyright (c) 2016, 2017 by Delphix. All rights reserved.
#
-verify_runnable "global"
-
. $STF_SUITE/tests/functional/channel_program/channel_common.kshlib
+verify_runnable "global"
+
fs=$TESTPOOL/$TESTFS/testchild
function cleanup