]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Check wait_event argument type
authorJouni Malinen <jouni@codeaurora.org>
Wed, 7 Aug 2019 09:41:12 +0000 (12:41 +0300)
committerJouni Malinen <j@w1.fi>
Wed, 7 Aug 2019 09:57:22 +0000 (12:57 +0300)
It was clearly too easy to get unexpected behavior by accidentially
passing in a string instead of a list of strings to these functions, so
enforce the correct type to notice such issues automatically.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
tests/hwsim/hostapd.py
tests/hwsim/wpasupplicant.py

index a0b8cac188e0fda20d8a5511767d9a2310eae15c..4430d8055356be0ca6f9400f4533cc73ebdd4466 100644 (file)
@@ -246,6 +246,8 @@ class Hostapd:
             logger.debug(self.dbg + ": " + ev)
 
     def wait_event(self, events, timeout):
+        if not isinstance(events, list):
+            raise Exception("Hostapd.wait_event() called with incorrect events argument type")
         start = os.times()[4]
         while True:
             while self.mon.pending():
index be1963704ba091ea44cd8469a5d8f6c70fde39b1..8c7e13d02c771f4baa503563ab5fcc23a9353a4d 100644 (file)
@@ -838,6 +838,8 @@ class WpaSupplicant:
         raise Exception("P2P_CONNECT failed")
 
     def _wait_event(self, mon, pfx, events, timeout):
+        if not isinstance(events, list):
+            raise Exception("WpaSupplicant._wait_event() called with incorrect events argument type")
         start = os.times()[4]
         while True:
             while mon.pending():
@@ -864,6 +866,8 @@ class WpaSupplicant:
                                 events, timeout)
 
     def wait_group_event(self, events, timeout=10):
+        if not isinstance(events, list):
+            raise Exception("WpaSupplicant.wait_group_event() called with incorrect events argument type")
         if self.group_ifname and self.group_ifname != self.ifname:
             if self.gctrl_mon is None:
                 return None