From ca9b78add80e43a7cf9e6e134606df62f697877b Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 8 Dec 2014 18:42:16 +0200 Subject: [PATCH] tests: Additional coverage for P2P_PROV_DISC Signed-off-by: Jouni Malinen --- tests/hwsim/test_p2p_autogo.py | 19 ++++++++++++++++++- tests/hwsim/test_p2p_discovery.py | 7 +++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/tests/hwsim/test_p2p_autogo.py b/tests/hwsim/test_p2p_autogo.py index b2d8523b0..2bba8212b 100644 --- a/tests/hwsim/test_p2p_autogo.py +++ b/tests/hwsim/test_p2p_autogo.py @@ -32,13 +32,15 @@ def connect_cli(go, client, social=False, freq=None): def test_autogo(dev): """P2P autonomous GO and client joining group""" + addr0 = dev[0].p2p_dev_addr() + addr2 = dev[2].p2p_dev_addr() res = autogo(dev[0]) if "p2p-wlan" in res['ifname']: raise Exception("Unexpected group interface name on GO") res = connect_cli(dev[0], dev[1]) if "p2p-wlan" in res['ifname']: 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(): raise Exception("Unexpected BSSID in the BSS entry for the GO") id = bss['id'] @@ -60,6 +62,21 @@ def test_autogo(dev): if ev is None: 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[1].wait_go_ending_session() diff --git a/tests/hwsim/test_p2p_discovery.py b/tests/hwsim/test_p2p_discovery.py index dc2db2056..9d62798f6 100644 --- a/tests/hwsim/test_p2p_discovery.py +++ b/tests/hwsim/test_p2p_discovery.py @@ -80,6 +80,13 @@ def test_discovery(dev): if "FAIL" not in dev[0].p2p_find(dev_type="foo"): 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): """P2P device discovery and provision discovery retries""" addr0 = dev[0].p2p_dev_addr()