]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Split event wait in grpform_cred_ready_timeout
authorJouni Malinen <j@w1.fi>
Sun, 17 Mar 2019 14:00:18 +0000 (16:00 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 17 Mar 2019 14:08:53 +0000 (16:08 +0200)
The long wait for the monitor socket events resulted in another socket
running out of TX buffer space. Split the wait into smaller segments and
clear the other socket in each iteration.

Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/test_p2p_grpform.py
tests/hwsim/wpasupplicant.py

index 41104d51532ea826d1c13415569aba525b37c083..47882cce20d6bbaae023d9b4ae9347d15b36128b 100644 (file)
@@ -1,5 +1,5 @@
 # P2P group formation test cases
-# Copyright (c) 2013-2014, Jouni Malinen <j@w1.fi>
+# Copyright (c) 2013-2019, Jouni Malinen <j@w1.fi>
 #
 # This software may be distributed under the terms of the BSD license.
 # See README for more details.
@@ -766,7 +766,11 @@ def test_grpform_cred_ready_timeout(dev, apdev, params):
     dev[2].dump_monitor()
     logger.info("Starting p2p_find to change state")
     dev[2].p2p_find()
-    ev = dev[2].wait_global_event(["P2P-GO-NEG-FAILURE"], timeout=100)
+    for i in range(10):
+        ev = dev[2].wait_global_event(["P2P-GO-NEG-FAILURE"], timeout=10)
+        if ev:
+            break
+        dev[2].dump_monitor(global_mon=False)
     if ev is None:
         raise Exception("GO Negotiation failure timed out(2)")
     dev[2].dump_monitor()
@@ -785,7 +789,10 @@ def test_grpform_cred_ready_timeout(dev, apdev, params):
     if wpas.p2p_dev_addr() not in ev:
         raise Exception("Unexpected device found: " + ev)
     dev[2].p2p_stop_find()
+    dev[2].dump_monitor()
     wpas.p2p_stop_find()
+    wpas.close_monitor()
+    del wpas
 
     # Finally, verify without p2p_find
     ev = dev[0].wait_global_event(["P2P-GO-NEG-FAILURE"], timeout=120)
index 125867ef9e813163f09a3b0e0792015a360c8bdb..00dec57b3a6cab759c125c44549c34d8d9c75f23 100644 (file)
@@ -884,14 +884,14 @@ class WpaSupplicant:
         if "reason=GO_ENDING_SESSION" not in ev:
             raise Exception("Unexpected group removal reason")
 
-    def dump_monitor(self):
+    def dump_monitor(self, mon=True, global_mon=True):
         count_iface = 0
         count_global = 0
-        while self.monitor and self.mon.pending():
+        while mon and self.monitor and self.mon.pending():
             ev = self.mon.recv()
             logger.debug(self.dbg + ": " + ev)
             count_iface += 1
-        while self.monitor and self.global_mon and self.global_mon.pending():
+        while global_mon and self.monitor and self.global_mon and self.global_mon.pending():
             ev = self.global_mon.recv()
             logger.debug(self.global_dbg + self.ifname + "(global): " + ev)
             count_global += 1