tests: Fix progressive p2p_find to actually use progressive part
authorJouni Malinen <j@w1.fi>
Mon, 14 Apr 2014 21:53:30 +0000 (00:53 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 14 Apr 2014 22:16:32 +0000 (01:16 +0300)
It turned out that the initial test case found the GO based on the
initial full scan instead of the progressive search part. Fix this by
started the GO only after the initial full scan.

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

index ed73022..c159aad 100644 (file)
@@ -213,17 +213,22 @@ def test_discovery_dev_id_go(dev):
 def test_discovery_social_plus_one(dev):
     """P2P device discovery with social-plus-one"""
     logger.info("Start autonomous GO " + dev[0].ifname)
-    dev[2].p2p_start_go(freq="2422")
-    go = dev[2].p2p_dev_addr()
     dev[1].p2p_find(social=True)
     dev[0].p2p_find(progressive=True)
-    ev = dev[0].wait_event(["P2P-DEVICE-FOUND"])
-    if ev is None:
-        raise Exception("Peer not found")
-    ev = dev[0].wait_event(["P2P-DEVICE-FOUND"])
+    logger.info("Wait for initial progressive find phases")
+    dev[0].wait_event(["CTRL-EVENT-SCAN-STARTED"])
+    dev[0].wait_event(["CTRL-EVENT-SCAN-STARTED"])
+    go = dev[2].p2p_dev_addr()
+    dev[2].p2p_start_go(freq="2422")
+    logger.info("Verify whether the GO on non-social channel can be found")
+    ev = dev[0].wait_global_event(["P2P-DEVICE-FOUND"], timeout=15)
     if ev is None:
         raise Exception("Peer not found")
-    ev = dev[1].wait_event(["P2P-DEVICE-FOUND"])
+    if go not in ev:
+        ev = dev[0].wait_global_event(["P2P-DEVICE-FOUND"], timeout=15)
+        if ev is None:
+            raise Exception("Peer not found")
+    ev = dev[1].wait_global_event(["P2P-DEVICE-FOUND"], timeout=15)
     if ev is None:
         raise Exception("Peer not found")
     dev[0].p2p_stop_find()