tests: p2p_find with progressive scan
authorJouni Malinen <j@w1.fi>
Sat, 12 Apr 2014 17:03:24 +0000 (20:03 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 13 Apr 2014 07:26:53 +0000 (10:26 +0300)
Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/test_p2p_discovery.py
tests/hwsim/wpasupplicant.py

index cfbf1d0..ed73022 100644 (file)
@@ -209,3 +209,26 @@ def test_discovery_dev_id_go(dev):
     ev = dev[2].wait_event(['P2P-DEVICE-FOUND ' + addr1], timeout=2)
     if ev is None:
         raise Exception("P2P device not found")
+
+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"])
+    if ev is None:
+        raise Exception("Peer not found")
+    ev = dev[1].wait_event(["P2P-DEVICE-FOUND"])
+    if ev is None:
+        raise Exception("Peer not found")
+    dev[0].p2p_stop_find()
+    dev[1].p2p_stop_find()
+    if not dev[0].peer_known(go):
+        raise Exception("GO not found in progressive scan")
+    if dev[1].peer_known(go):
+        raise Exception("GO found in social-only scan")
index a8f3ccf..fceb056 100644 (file)
@@ -330,10 +330,12 @@ class WpaSupplicant:
     def p2p_listen(self):
         return self.global_request("P2P_LISTEN")
 
-    def p2p_find(self, social=False, dev_id=None, dev_type=None):
+    def p2p_find(self, social=False, progressive=False, dev_id=None, dev_type=None):
         cmd = "P2P_FIND"
         if social:
             cmd = cmd + " type=social"
+        elif progressive:
+            cmd = cmd + " type=progressive"
         if dev_id:
             cmd = cmd + " dev_id=" + dev_id
         if dev_type: