tests: Additional P2P_FIND parameter coverage

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2014-12-08 17:56:47 +02:00
parent 5b2f1e2456
commit 7457c63538
2 changed files with 10 additions and 2 deletions

View 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()

View 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):