tests: Make P2PS tests less likely to fail in P2PS-PROV-DONE timeouts
authorJouni Malinen <j@w1.fi>
Sun, 11 Oct 2015 16:50:58 +0000 (19:50 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 11 Oct 2015 18:42:03 +0000 (21:42 +0300)
The combination of starting P2P extended listen and issuing
P2P_ASP_PROVISION_RESP almost immediately after that while in P2P_LISTEN
state resulted in caes where the advertiser could end up going back to a
long listen state while trying to retransmit PD Request. This resulted
in p2ps_provision() timing out while waiting for P2PS-PROV-DONE
especially in p2ps_feature_capability_* test cases.

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

index 96de8e1..ae37366 100644 (file)
@@ -190,6 +190,11 @@ def p2ps_provision(seeker, advertiser, adv_id, auto_accept=True, method="1000",
                 raise Exception("Unknown peer " + addr0)
             pin = ev.split()[2]
 
+        # Stop P2P_LISTEN before issuing P2P_ASP_PROVISION_RESP to avoid
+        # excessive delay and test case timeouts if it takes large number of
+        # retries to find the peer awake on its Listen channel.
+        advertiser.p2p_stop_find()
+
         advertiser.asp_provision(peer, adv_id=advert_id, adv_mac=advert_mac,
                                  session_id=int(session, 0),
                                  session_mac=session_mac, status=12,
@@ -856,6 +861,7 @@ def test_p2ps_pd_follow_on_status_failure(dev):
     if ev is None:
         raise Exception("P2P-PROV-DISC-FAILURE timeout on seeker side")
     dev[1].p2p_ext_listen(500, 500)
+    dev[0].p2p_stop_find()
     dev[0].asp_provision(addr1, adv_id=str(adv_id), adv_mac=addr0, session_id=1,
                          session_mac=addr1, status=11, method=0)