Browse Source

tests: GO Negotiation and timeout while waiting for peer

grpform_cred_ready_timeout2 is similar to the grpform_cred_ready_timeout
test case with the difference being in initiating a P2P_FIND operation
during the wait.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Jouni Malinen 10 years ago
parent
commit
0ee41e866c
1 changed files with 26 additions and 0 deletions
  1. 26 0
      tests/hwsim/test_p2p_grpform.py

+ 26 - 0
tests/hwsim/test_p2p_grpform.py

@@ -725,6 +725,32 @@ def test_grpform_cred_ready_timeout(dev, apdev, params):
     if end - start < 120:
         raise Exception("Too short GO Negotiation wait time: {}".format(end - start))
 
+def test_grpform_cred_ready_timeout2(dev, apdev, params):
+    """P2P GO Negotiation wait for credentials to become ready (2) [long]"""
+    if not params['long']:
+        logger.info("Skip test case with long duration due to --long not specified")
+        return "skip"
+
+    dev[1].p2p_listen()
+    addr1 = dev[1].p2p_dev_addr()
+    if not dev[0].discover_peer(addr1):
+        raise Exception("Peer " + addr1 + " not found")
+    start = os.times()[4]
+    if "OK" not in dev[0].global_request("P2P_CONNECT " + addr1 + " 12345670 display"):
+        raise Exception("Failed to initiate GO Neg")
+    ev = dev[0].wait_global_event(["P2P-GO-NEG-FAILURE"], timeout=30)
+    if ev is not None:
+        raise Exception("Too early GO Negotiation timeout reported")
+    logger.info("Starting p2p_find to change state")
+    dev[0].p2p_find()
+    ev = dev[0].wait_global_event(["P2P-GO-NEG-FAILURE"], timeout=100)
+    if ev is None:
+        raise Exception("GO Negotiation failure timed out")
+    end = os.times()[4]
+    logger.info("GO Negotiation wait time: {} seconds".format(end - start))
+    if end - start < 120:
+        raise Exception("Too short GO Negotiation wait time: {}".format(end - start))
+
 def test_grpform_no_wsc_done(dev):
     """P2P group formation with WSC-Done not sent"""
     addr0 = dev[0].p2p_dev_addr()