[PATCH 33/50] tests: Modify mbo 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_mbo.py | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/tests/hwsim/test_mbo.py b/tests/hwsim/test_mbo.py
index a36aee2ba..586d1d53c 100644
--- a/tests/hwsim/test_mbo.py
+++ b/tests/hwsim/test_mbo.py
@@ -11,6 +11,7 @@ logger = logging.getLogger()
 import hostapd
 import os
 import time
+import sys
 
 import hostapd
 from tshark import run_tshark
@@ -212,8 +213,12 @@ def test_mbo_assoc_disallow(dev, apdev, params):
     out = run_tshark(os.path.join(params['logdir'], "hwsim0.pcapng"),
                      "wlan.fc.type == 0 && wlan.fc.type_subtype == 0x00",
                      wait=False)
-    if "Destination address: " + hapd1.own_addr() in out:
-        raise Exception("Association request sent to disallowed AP")
+    if sys.version_info[0] > 2:
+        if "Destination address: " + hapd1.own_addr() in out:
+            raise Exception("Association request sent to disallowed AP")
+    else:
+        if ("Destination address: " + hapd1.own_addr()).encode() in out:
+            raise Exception("Association request sent to disallowed AP")
 
     timestamp = run_tshark(os.path.join(params['logdir'], "hwsim0.pcapng"),
                            "wlan.fc.type_subtype == 0x00",
@@ -449,7 +454,10 @@ def test_mbo_sta_supp_op_classes(dev, apdev):
     logger.debug("STA: " + str(sta))
     if 'supp_op_classes' not in sta:
         raise Exception("No supp_op_classes")
-    supp = bytearray(sta['supp_op_classes'].decode("hex"))
+    if sys.version_info[0] > 2:
+        supp = binascii.unhexlify(sta['supp_op_classes'])
+    else:
+        supp = bytearray(sta['supp_op_classes'].decode("hex"))
     if supp[0] != 81:
         raise Exception("Unexpected current operating class %d" % supp[0])
     if 115 not in supp:
-- 
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