From 5c76d061866ea5d62e3faec19caf56bd6dcc3eca Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Sat, 9 Jun 2018 20:30:48 +0300 Subject: [PATCH] zdtm: open notify file descriptors in a binary mode Send pre-dump notify to 36 Traceback (most recent call last): File "zdtm.py", line 2161, in do_run_test(tinfo[0], tinfo[1], tinfo[2], tinfo[3]) File "zdtm.py", line 1549, in do_run_test cr(cr_api, t, opts) File "zdtm.py", line 1264, in cr test.pre_dump_notify() File "zdtm.py", line 490, in pre_dump_notify fdin.write(struct.pack("i", 0)) TypeError: write() argument 1 must be unicode, not str Signed-off-by: Andrei Vagin --- test/zdtm.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/zdtm.py b/test/zdtm.py index fa91f01ba..b99db2478 100755 --- a/test/zdtm.py +++ b/test/zdtm.py @@ -481,8 +481,8 @@ class zdtm_test: notify_fdin_path = "/proc/%s/fd/%s" % (self.__pid, env['ZDTM_NOTIFY_FDIN']) print("Send pre-dump notify to %s" % (self.__pid)) - with open(notify_fdout_path) as fdout: - with open(notify_fdin_path, "w") as fdin: + with open(notify_fdout_path, "rb") as fdout: + with open(notify_fdin_path, "wb") as fdin: fdin.write(struct.pack("i", 0)) fdin.flush() print("Wait pre-dump notify reply") @@ -500,7 +500,7 @@ class zdtm_test: print_sep(self.__name + '.out.inprogress') print(open(self.__name + '.out.inprogress').read()) print_sep(self.__name + '.out.inprogress') - raise test_fail_exc("result check: %s" % list(map(lambda s: s.strip(), res.split())) + res) + raise test_fail_exc("result check") def getpid(self): if self.__pid == 0: