]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: wpa_supplicant control socket and event burst
authorJouni Malinen <j@w1.fi>
Sun, 4 Oct 2015 08:46:02 +0000 (11:46 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 4 Oct 2015 15:52:38 +0000 (18:52 +0300)
Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/test_wpas_ctrl.py
tests/hwsim/wpasupplicant.py

index de7cde49eb9581cf9971b20f3b6cc836a6032a16..99fde193a7c4ba08859771c64b332b6413cbd516 100644 (file)
@@ -1757,3 +1757,27 @@ def test_wpas_ctrl_socket_full(dev, apdev, test_params):
     if not dev[0].ping():
         raise Exception("Could not ping wpa_supplicant at the end of the test")
     dev[0].get_status()
+
+def test_wpas_ctrl_event_burst(dev, apdev):
+    """wpa_supplicant control socket and event burst"""
+    if "OK" not in dev[0].request("EVENT_TEST 1000"):
+        raise Exception("Could not request event messages")
+
+    total_i = 0
+    total_g = 0
+    for i in range(100):
+        (i,g) = dev[0].dump_monitor()
+        total_i += i
+        total_g += g
+        logger.info("Received i=%d g=%d" % (i, g))
+        if total_i >= 1000 and total_g >= 1000:
+            break
+        time.sleep(0.05)
+
+    if total_i < 1000:
+        raise Exception("Some per-interface events not seen: %d" % total_i)
+    if total_g < 1000:
+        raise Exception("Some global events not seen: %d" % total_g)
+
+    if not dev[0].ping():
+        raise Exception("Could not ping wpa_supplicant at the end of the test")
index 8e79c8b005b3f9f9856bd64869e01072b72e0225..1dab60af75660450cdb41e81c5cddad690a01f6c 100644 (file)
@@ -688,12 +688,17 @@ class WpaSupplicant:
             raise Exception("Unexpected group removal reason")
 
     def dump_monitor(self):
+        count_iface = 0
+        count_global = 0
         while self.mon.pending():
             ev = self.mon.recv()
             logger.debug(self.ifname + ": " + ev)
+            count_iface += 1
         while self.global_mon and self.global_mon.pending():
             ev = self.global_mon.recv()
             logger.debug(self.ifname + "(global): " + ev)
+            count_global += 1
+        return (count_iface, count_global)
 
     def remove_group(self, ifname=None):
         if self.gctrl_mon: