tests: Additional coverage for P2P_PROV_DISC

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2014-12-08 18:42:16 +02:00
parent 6da4a0af92
commit ca9b78add8
2 changed files with 25 additions and 1 deletions

View file

@ -32,13 +32,15 @@ def connect_cli(go, client, social=False, freq=None):
def test_autogo(dev): def test_autogo(dev):
"""P2P autonomous GO and client joining group""" """P2P autonomous GO and client joining group"""
addr0 = dev[0].p2p_dev_addr()
addr2 = dev[2].p2p_dev_addr()
res = autogo(dev[0]) res = autogo(dev[0])
if "p2p-wlan" in res['ifname']: if "p2p-wlan" in res['ifname']:
raise Exception("Unexpected group interface name on GO") raise Exception("Unexpected group interface name on GO")
res = connect_cli(dev[0], dev[1]) res = connect_cli(dev[0], dev[1])
if "p2p-wlan" in res['ifname']: if "p2p-wlan" in res['ifname']:
raise Exception("Unexpected group interface name on client") raise Exception("Unexpected group interface name on client")
bss = dev[1].get_bss("p2p_dev_addr=" + dev[0].p2p_dev_addr()) bss = dev[1].get_bss("p2p_dev_addr=" + addr0)
if bss['bssid'] != dev[0].p2p_interface_addr(): if bss['bssid'] != dev[0].p2p_interface_addr():
raise Exception("Unexpected BSSID in the BSS entry for the GO") raise Exception("Unexpected BSSID in the BSS entry for the GO")
id = bss['id'] id = bss['id']
@ -60,6 +62,21 @@ def test_autogo(dev):
if ev is None: if ev is None:
raise Exception("Timeout while waiting for Presence Response") raise Exception("Timeout while waiting for Presence Response")
if not dev[2].discover_peer(addr0):
raise Exception("Could not discover GO")
dev[0].dump_monitor()
dev[2].global_request("P2P_PROV_DISC " + addr0 + " display join")
ev = dev[0].wait_global_event(["P2P-PROV-DISC-SHOW-PIN"], timeout=10)
if ev is None:
raise Exception("GO did not report P2P-PROV-DISC-SHOW-PIN")
if "p2p_dev_addr=" + addr2 not in ev:
raise Exception("Unexpected P2P Device Address in event: " + ev)
if "group=" + dev[0].group_ifname not in ev:
raise Exception("Unexpected group interface in event: " + ev)
ev = dev[2].wait_global_event(["P2P-PROV-DISC-ENTER-PIN"], timeout=10)
if ev is None:
raise Exception("P2P-PROV-DISC-ENTER-PIN not reported")
dev[0].remove_group() dev[0].remove_group()
dev[1].wait_go_ending_session() dev[1].wait_go_ending_session()

View file

@ -80,6 +80,13 @@ def test_discovery(dev):
if "FAIL" not in dev[0].p2p_find(dev_type="foo"): if "FAIL" not in dev[0].p2p_find(dev_type="foo"):
raise Exception("P2P_FIND with invalid dev_type accepted") raise Exception("P2P_FIND with invalid dev_type accepted")
if "FAIL" not in dev[0].global_request("P2P_PROV_DISC foo pbc"):
raise Exception("Invalid P2P_PROV_DISC accepted")
if "FAIL" not in dev[0].global_request("P2P_PROV_DISC 00:11:22:33:44:55"):
raise Exception("Invalid P2P_PROV_DISC accepted")
if "FAIL" not in dev[0].global_request("P2P_PROV_DISC 00:11:22:33:44:55 pbc join"):
raise Exception("Invalid P2P_PROV_DISC accepted")
def test_discovery_pd_retries(dev): def test_discovery_pd_retries(dev):
"""P2P device discovery and provision discovery retries""" """P2P device discovery and provision discovery retries"""
addr0 = dev[0].p2p_dev_addr() addr0 = dev[0].p2p_dev_addr()