tests: Make p2p_service_discovery_restart more robust
Stop and restart P2P_FIND on dev[1] to avoid timing issues where the wait on dev[1] makes the test case fail even though this was trying to verify that dev[0] is reacting quickly enough. Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
This commit is contained in:
parent
afd306cf79
commit
6f1041b3fb
1 changed files with 6 additions and 1 deletions
|
@ -593,12 +593,14 @@ def _test_p2p_service_discovery_restart(dev):
|
||||||
# implementation every now and then, so run this multiple time and pass the
|
# implementation every now and then, so run this multiple time and pass the
|
||||||
# test if any attempt is fast enough.
|
# test if any attempt is fast enough.
|
||||||
|
|
||||||
for i in range(10):
|
for i in range(20):
|
||||||
|
dev[1].p2p_stop_find()
|
||||||
dev[0].p2p_stop_find()
|
dev[0].p2p_stop_find()
|
||||||
time.sleep(0.01)
|
time.sleep(0.01)
|
||||||
dev[0].p2p_listen()
|
dev[0].p2p_listen()
|
||||||
|
|
||||||
dev[1].global_request("P2P_SERV_DISC_REQ " + addr0 + " 02000001")
|
dev[1].global_request("P2P_SERV_DISC_REQ " + addr0 + " 02000001")
|
||||||
|
dev[1].p2p_find(social=True)
|
||||||
start = os.times()[4]
|
start = os.times()[4]
|
||||||
ev = dev[1].wait_global_event(["P2P-SERV-DISC-RESP"], timeout=10)
|
ev = dev[1].wait_global_event(["P2P-SERV-DISC-RESP"], timeout=10)
|
||||||
if ev is None:
|
if ev is None:
|
||||||
|
@ -608,5 +610,8 @@ def _test_p2p_service_discovery_restart(dev):
|
||||||
if end - start < 0.8:
|
if end - start < 0.8:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
dev[0].p2p_stop_find()
|
||||||
|
dev[1].p2p_stop_find()
|
||||||
|
|
||||||
if end - start > 0.8:
|
if end - start > 0.8:
|
||||||
raise Exception("Unexpectedly slow second SD Response: " + str(end - start) + " seconds")
|
raise Exception("Unexpectedly slow second SD Response: " + str(end - start) + " seconds")
|
||||||
|
|
Loading…
Reference in a new issue