]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Decode subprocess.check_output() return value for python3
authorMasashi Honma <masashi.honma@gmail.com>
Thu, 31 Jan 2019 08:15:42 +0000 (17:15 +0900)
committerJouni Malinen <j@w1.fi>
Mon, 4 Feb 2019 10:26:33 +0000 (12:26 +0200)
Explicit conversion to str is needed here for python3 compatibility.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
tests/hwsim/remotehost.py
tests/hwsim/test_ap_eap.py
tests/hwsim/test_ap_hs20.py
tests/hwsim/test_hs20_filter.py
tests/hwsim/test_hs20_pps_mo.py
tests/hwsim/test_wmediumd.py
tests/hwsim/wlantest.py

index f18da4994ba0cb688ac19466bfe65347c3b10461..aa83c1d94abeb3db657dbfb29e48b5a7ef2ce9d0 100644 (file)
@@ -19,7 +19,7 @@ def execute_thread(command, reply):
     logger.debug("thread run: " + cmd)
     try:
         status = 0
-        buf = subprocess.check_output(command, stderr=subprocess.STDOUT)
+        buf = subprocess.check_output(command, stderr=subprocess.STDOUT).decode()
     except subprocess.CalledProcessError as e:
         status = e.returncode
         buf = e.output
index 38a0ed13773d393894a3b62e14bf1101d220413b..88dff59847e59aae768e68a72d6ca0a908b0dde2 100644 (file)
@@ -529,7 +529,7 @@ def _test_ap_wpa2_eap_sim_ext_replace_sim(dev, apdev):
     res = subprocess.check_output(["../../hostapd/hlr_auc_gw",
                                    "-m",
                                    "auth_serv/hlr_auc_gw.milenage_db",
-                                   "GSM-AUTH-REQ 232010000000000 " + rand])
+                                   "GSM-AUTH-REQ 232010000000000 " + rand]).decode()
     if "GSM-AUTH-RESP" not in res:
         raise Exception("Unexpected hlr_auc_gw response")
     resp = res.split(' ')[2].rstrip()
@@ -555,7 +555,7 @@ def _test_ap_wpa2_eap_sim_ext_replace_sim(dev, apdev):
     res = subprocess.check_output(["../../hostapd/hlr_auc_gw",
                                    "-m",
                                    "auth_serv/hlr_auc_gw.milenage_db",
-                                   "GSM-AUTH-REQ 232010000000009 " + rand])
+                                   "GSM-AUTH-REQ 232010000000009 " + rand]).decode()
     if "GSM-AUTH-RESP" not in res:
         raise Exception("Unexpected hlr_auc_gw response")
     resp = res.split(' ')[2].rstrip()
@@ -595,7 +595,7 @@ def _test_ap_wpa2_eap_sim_ext_replace_sim2(dev, apdev):
     res = subprocess.check_output(["../../hostapd/hlr_auc_gw",
                                    "-m",
                                    "auth_serv/hlr_auc_gw.milenage_db",
-                                   "GSM-AUTH-REQ 232010000000000 " + rand])
+                                   "GSM-AUTH-REQ 232010000000000 " + rand]).decode()
     if "GSM-AUTH-RESP" not in res:
         raise Exception("Unexpected hlr_auc_gw response")
     resp = res.split(' ')[2].rstrip()
@@ -622,7 +622,7 @@ def _test_ap_wpa2_eap_sim_ext_replace_sim2(dev, apdev):
     res = subprocess.check_output(["../../hostapd/hlr_auc_gw",
                                    "-m",
                                    "auth_serv/hlr_auc_gw.milenage_db",
-                                   "GSM-AUTH-REQ 232010000000009 " + rand])
+                                   "GSM-AUTH-REQ 232010000000009 " + rand]).decode()
     if "GSM-AUTH-RESP" not in res:
         raise Exception("Unexpected hlr_auc_gw response")
     resp = res.split(' ')[2].rstrip()
@@ -665,7 +665,7 @@ def _test_ap_wpa2_eap_sim_ext_replace_sim3(dev, apdev):
     res = subprocess.check_output(["../../hostapd/hlr_auc_gw",
                                    "-m",
                                    "auth_serv/hlr_auc_gw.milenage_db",
-                                   "GSM-AUTH-REQ 232010000000000 " + rand])
+                                   "GSM-AUTH-REQ 232010000000000 " + rand]).decode()
     if "GSM-AUTH-RESP" not in res:
         raise Exception("Unexpected hlr_auc_gw response")
     resp = res.split(' ')[2].rstrip()
@@ -698,7 +698,7 @@ def _test_ap_wpa2_eap_sim_ext_replace_sim3(dev, apdev):
     res = subprocess.check_output(["../../hostapd/hlr_auc_gw",
                                    "-m",
                                    "auth_serv/hlr_auc_gw.milenage_db",
-                                   "GSM-AUTH-REQ 232010000000009 " + rand])
+                                   "GSM-AUTH-REQ 232010000000009 " + rand]).decode()
     if "GSM-AUTH-RESP" not in res:
         raise Exception("Unexpected hlr_auc_gw response")
     resp = res.split(' ')[2].rstrip()
@@ -764,7 +764,7 @@ def _test_ap_wpa2_eap_sim_change_bssid(dev, apdev):
     res = subprocess.check_output(["../../hostapd/hlr_auc_gw",
                                    "-m",
                                    "auth_serv/hlr_auc_gw.milenage_db",
-                                   "GSM-AUTH-REQ 232010000000000 " + rand])
+                                   "GSM-AUTH-REQ 232010000000000 " + rand]).decode()
     if "GSM-AUTH-RESP" not in res:
         raise Exception("Unexpected hlr_auc_gw response")
     resp = res.split(' ')[2].rstrip()
@@ -805,7 +805,7 @@ def _test_ap_wpa2_eap_sim_no_change_set(dev, apdev):
     res = subprocess.check_output(["../../hostapd/hlr_auc_gw",
                                    "-m",
                                    "auth_serv/hlr_auc_gw.milenage_db",
-                                   "GSM-AUTH-REQ 232010000000000 " + rand])
+                                   "GSM-AUTH-REQ 232010000000000 " + rand]).decode()
     if "GSM-AUTH-RESP" not in res:
         raise Exception("Unexpected hlr_auc_gw response")
     resp = res.split(' ')[2].rstrip()
@@ -1707,7 +1707,7 @@ def run_ext_sim_auth(dev):
     res = subprocess.check_output(["../../hostapd/hlr_auc_gw",
                                    "-m",
                                    "auth_serv/hlr_auc_gw.milenage_db",
-                                   "GSM-AUTH-REQ 232010000000000 " + rand])
+                                   "GSM-AUTH-REQ 232010000000000 " + rand]).decode()
     if "GSM-AUTH-RESP" not in res:
         raise Exception("Unexpected hlr_auc_gw response")
     resp = res.split(' ')[2].rstrip()
index acc391732730c31a97bc81d735c365eb587600f8..75fef33c266d7ed18ee234430776f81f75ffb0f0 100644 (file)
@@ -129,7 +129,7 @@ def interworking_ext_sim_auth(dev, method):
     res = subprocess.check_output(["../../hostapd/hlr_auc_gw",
                                    "-m",
                                    "auth_serv/hlr_auc_gw.milenage_db",
-                                   "GSM-AUTH-REQ 232010000000000 " + rand])
+                                   "GSM-AUTH-REQ 232010000000000 " + rand]).decode()
     if "GSM-AUTH-RESP" not in res:
         raise Exception("Unexpected hlr_auc_gw response")
     resp = res.split(' ')[2].rstrip()
index 5ae498cd76097e0d07c61d608ee977f483789a24..545751c59933a49b7dfefe8b04b1ee4edfeebe20 100644 (file)
@@ -32,7 +32,7 @@ class IPAssign(object):
         if self._ipv6:
             # wait for DAD to finish
             while True:
-                o = subprocess.check_output(self._cmd + ['show', 'tentative', 'dev', self._iface])
+                o = subprocess.check_output(self._cmd + ['show', 'tentative', 'dev', self._iface]).decode()
                 if not self._addr in o:
                     break
                 time.sleep(0.1)
@@ -167,7 +167,7 @@ def test_ip4_drop_gratuitous_arp(devs, apdevs, params):
             if "OK" not in hapd.request('DATA_TEST_FRAME ' + pkt):
                 raise Exception("DATA_TEST_FRAME failed")
 
-            if hapd.own_addr() in subprocess.check_output(['ip', 'neigh', 'show']):
+            if hapd.own_addr() in subprocess.check_output(['ip', 'neigh', 'show']).decode():
                 raise Exception("gratuitous ARP frame updated erroneously")
         finally:
             subprocess.call(['ip', 'neigh', 'del', '10.0.0.1', 'dev', dev.ifname])
@@ -193,7 +193,7 @@ def test_ip6_drop_unsolicited_na(devs, apdevs, params):
             if "OK" not in hapd.request('DATA_TEST_FRAME ' + pkt):
                 raise Exception("DATA_TEST_FRAME failed")
 
-            if hapd.own_addr() in subprocess.check_output(['ip', 'neigh', 'show']):
+            if hapd.own_addr() in subprocess.check_output(['ip', 'neigh', 'show']).decode():
                 raise Exception("unsolicited NA frame updated erroneously")
         finally:
             subprocess.call(['ip', '-6', 'neigh', 'del', 'fdaa::2', 'dev', dev.ifname])
index 5324cde1f2947cf4a102f4b72155fcd680bb210f..75c524ad6611a4ee9023bc087639eaa9ed3eb250 100644 (file)
@@ -20,7 +20,7 @@ def check_hs20_osu_client():
 
 def set_pps(pps_mo):
     res = subprocess.check_output(["../../hs20/client/hs20-osu-client",
-                                   "set_pps", pps_mo])
+                                   "set_pps", pps_mo]).decode()
     logger.info("set_pps result: " + res)
 
 def test_hs20_pps_mo_1(dev, apdev):
index d30f27c3fb88fc53859ddbf10f059179e4eb27be..cb322cf00b1abacd03f7e905a62e3f6163bf65d4 100644 (file)
@@ -69,7 +69,7 @@ def get_wmediumd_version():
         return LocalVariables.revs
 
     try:
-        verstr = subprocess.check_output(['wmediumd', '-V'])
+        verstr = subprocess.check_output(['wmediumd', '-V']).decode()
     except OSError as e:
         if e.errno == errno.ENOENT:
             raise HwsimSkip('wmediumd not available')
index 75dcdb5683c2d5fb1b7f5247f3150fb7db60c470..95c09bb998f631555b3497fbc18a0e1173de486b 100644 (file)
@@ -111,7 +111,7 @@ class Wlantest:
                 raise Exception("wlantest_cli failed")
             return ret[1]
         else:
-            return subprocess.check_output([self.wlantest_cli] + params)
+            return subprocess.check_output([self.wlantest_cli] + params).decode()
 
     def flush(self):
         res = self.cli_cmd(["flush"])