From 45b0b88f80f4f166228acc8e3d61c50dc19f4ef8 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 2 Feb 2019 12:48:30 +0200 Subject: [PATCH] tests: Decode command execution output to a str for python3 Need to convert from bytes to str to allow the following string operations to work with python3. Signed-off-by: Jouni Malinen --- tests/hwsim/hostapd.py | 4 ++-- tests/hwsim/remotehost.py | 4 ++-- tests/hwsim/wpasupplicant.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/hwsim/hostapd.py b/tests/hwsim/hostapd.py index 9deab15aa..69d3e3135 100644 --- a/tests/hwsim/hostapd.py +++ b/tests/hwsim/hostapd.py @@ -55,7 +55,7 @@ class HostapdGlobal: stdout=subprocess.PIPE, shell=shell) out = proc.communicate()[0] ret = proc.returncode - return ret, out + return ret, out.decode() else: return self.host.execute(cmd_array) @@ -162,7 +162,7 @@ class Hostapd: stdout=subprocess.PIPE, shell=shell) out = proc.communicate()[0] ret = proc.returncode - return ret, out + return ret, out.decode() else: return self.host.execute(cmd_array) diff --git a/tests/hwsim/remotehost.py b/tests/hwsim/remotehost.py index bf1ccd216..f18da4994 100644 --- a/tests/hwsim/remotehost.py +++ b/tests/hwsim/remotehost.py @@ -55,7 +55,7 @@ class Host(): logger.debug("status: " + str(status)) logger.debug("buf: " + str(buf)) - return status, buf + return status, buf.decode() def execute(self, command): if self.host is None: @@ -73,7 +73,7 @@ class Host(): logger.debug(self.name + " status: " + str(status)) logger.debug(self.name + " buf: " + str(buf)) - return status, buf + return status, buf.decode() # async execute def execute_run(self, command, res): diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py index 0cc6ea8c9..1d538f1f7 100644 --- a/tests/hwsim/wpasupplicant.py +++ b/tests/hwsim/wpasupplicant.py @@ -64,7 +64,7 @@ class WpaSupplicant: stdout=subprocess.PIPE, shell=shell) out = proc.communicate()[0] ret = proc.returncode - return ret, out + return ret, out.decode() else: return self.host.execute(cmd_array)