[PATCH v2 36/38] tests: Modify wpas_ctrl test sets for python3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Masashi Honma <masashi.honma@xxxxxxxxx>
---
 tests/hwsim/test_wpas_ctrl.py | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/tests/hwsim/test_wpas_ctrl.py b/tests/hwsim/test_wpas_ctrl.py
index fece8f170..48ca4438a 100644
--- a/tests/hwsim/test_wpas_ctrl.py
+++ b/tests/hwsim/test_wpas_ctrl.py
@@ -11,6 +11,7 @@ import os
 import socket
 import subprocess
 import time
+import binascii
 
 import hostapd
 import hwsim_utils
@@ -872,7 +873,7 @@ def test_wpas_ctrl_disallow_aps(dev, apdev):
         raise Exception("Unexpected BSSID")
 
     dev[0].dump_monitor()
-    if "OK" not in dev[0].request("SET disallow_aps ssid " + "test".encode("hex")):
+    if "OK" not in dev[0].request("SET disallow_aps ssid " + binascii.hexlify(b"test").decode()):
         raise Exception("Failed to set disallow_aps")
     dev[0].wait_disconnected(timeout=5, error="Disconnection not seen")
     ev = dev[0].wait_event(["CTRL-EVENT-CONNECTED"], timeout=1)
@@ -1617,7 +1618,7 @@ def test_wpas_ctrl_wait(dev, apdev, test_params):
         prg = '../../wpa_supplicant/wpa_supplicant'
     arg = [ prg ]
     cmd = subprocess.Popen(arg, stdout=subprocess.PIPE)
-    out = cmd.communicate()[0]
+    out = cmd.communicate()[0].decode()
     cmd.wait()
     tracing = "Linux tracing" in out
 
@@ -1826,7 +1827,7 @@ def test_wpas_ctrl_socket_full(dev, apdev, test_params):
     for i in range(20):
         logger.debug("Command %d" % i)
         try:
-            s.send("MIB")
+            s.send(b"MIB")
         except Exception as e:
             logger.info("Could not send command %d: %s" % (i, str(e)))
             break
@@ -1845,7 +1846,7 @@ def test_wpas_ctrl_socket_full(dev, apdev, test_params):
     for i in range(10):
         logger.debug("Command %d [2]" % i)
         try:
-            s2.send("MIB")
+            s2.send(b"MIB")
         except Exception as e:
             logger.info("Could not send command %d [2]: %s" % (i, str(e)))
             break
@@ -1858,7 +1859,7 @@ def test_wpas_ctrl_socket_full(dev, apdev, test_params):
     for i in range(10):
         logger.debug("Command %d [3]" % i)
         try:
-            s2.send("MIB")
+            s2.send(b"MIB")
         except Exception as e:
             logger.info("Could not send command %d [3]: %s" % (i, str(e)))
             break
@@ -1877,8 +1878,8 @@ def test_wpas_ctrl_socket_full(dev, apdev, test_params):
     counter += 1
     s.bind(local)
     s.connect("/var/run/wpa_supplicant/wlan0")
-    s.send("ATTACH")
-    res = s.recv(100)
+    s.send(b"ATTACH")
+    res = s.recv(100).decode()
     if "OK" not in res:
         raise Exception("Could not attach a test socket")
 
-- 
2.17.1


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux