]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Additional P2P_FIND parameter coverage
authorJouni Malinen <j@w1.fi>
Mon, 8 Dec 2014 15:56:47 +0000 (17:56 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 8 Dec 2014 15:56:47 +0000 (17:56 +0200)
Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/test_p2p_discovery.py
tests/hwsim/wpasupplicant.py

index 2071e2427e399cf6d6a59942b3e690f9a84bb72c..dc2db2056a0dfd4950f77c6b0b046fca817722df 100644 (file)
@@ -16,7 +16,7 @@ def test_discovery(dev):
     addr0 = dev[0].p2p_dev_addr()
     addr1 = dev[1].p2p_dev_addr()
     logger.info("Start device discovery")
-    dev[0].p2p_find(social=True)
+    dev[0].p2p_find(social=True, delay=1)
     if not dev[1].discover_peer(addr0):
         raise Exception("Device discovery timed out")
     if not dev[0].discover_peer(addr1):
@@ -75,6 +75,11 @@ def test_discovery(dev):
     dev[0].p2p_stop_find
     dev[1].p2p_stop_find
 
+    if "FAIL" not in dev[0].p2p_find(dev_id="foo"):
+        raise Exception("P2P_FIND with invalid dev_id accepted")
+    if "FAIL" not in dev[0].p2p_find(dev_type="foo"):
+        raise Exception("P2P_FIND with invalid dev_type accepted")
+
 def test_discovery_pd_retries(dev):
     """P2P device discovery and provision discovery retries"""
     addr0 = dev[0].p2p_dev_addr()
index 2d7b7f354de326412ac574b0c6fc512fd8dd6033..a3f9d9d38231f614bc5d6bc33b9bb737d9cf36a6 100644 (file)
@@ -370,7 +370,8 @@ class WpaSupplicant:
     def p2p_listen(self):
         return self.global_request("P2P_LISTEN")
 
-    def p2p_find(self, social=False, progressive=False, dev_id=None, dev_type=None):
+    def p2p_find(self, social=False, progressive=False, dev_id=None,
+                 dev_type=None, delay=None):
         cmd = "P2P_FIND"
         if social:
             cmd = cmd + " type=social"
@@ -380,6 +381,8 @@ class WpaSupplicant:
             cmd = cmd + " dev_id=" + dev_id
         if dev_type:
             cmd = cmd + " dev_type=" + dev_type
+        if delay:
+            cmd = cmd + " delay=" + str(delay)
         return self.global_request(cmd)
 
     def p2p_stop_find(self):