tests: Split event wait in grpform_cred_ready_timeout

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>
This commit is contained in:
Jouni Malinen 2019-03-17 16:00:18 +02:00
parent e4b4e1748a
commit 3a88b7e6e9
2 changed files with 12 additions and 5 deletions

View 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)

View 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