From a0e117c684dddf4b1979635a397c25b295c8b94e Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 2 Aug 2015 20:48:56 +0300 Subject: [PATCH] tests: P2P extended listen timing operations This verifies P2P extended listen timing operations by confirming that a peer is not discoverable during the provisioning step and that the peer becomes discoverable after having removed the group during such provisioning step. The latter case was broken until the 'P2P: Cancel group formation when deleting a group during group formation' commit. Signed-off-by: Jouni Malinen --- tests/hwsim/test_p2p_grpform.py | 57 +++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/tests/hwsim/test_p2p_grpform.py b/tests/hwsim/test_p2p_grpform.py index 93e499a89..e530e0c62 100644 --- a/tests/hwsim/test_p2p_grpform.py +++ b/tests/hwsim/test_p2p_grpform.py @@ -306,6 +306,63 @@ def test_grpform_ext_listen(dev): if "OK" not in dev[1].global_request("P2P_EXT_LISTEN"): raise Exception("Failed to clear extended listen timing") +def test_grpform_ext_listen_oper(dev): + """P2P extended listen timing operations""" + try: + _test_grpform_ext_listen_oper(dev) + finally: + dev[0].global_request("P2P_EXT_LISTEN") + +def _test_grpform_ext_listen_oper(dev): + addr0 = dev[0].p2p_dev_addr() + dev[0].global_request("SET p2p_no_group_iface 0") + wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5') + wpas.interface_add("wlan5") + addr1 = wpas.p2p_dev_addr() + wpas.request("P2P_SET listen_channel 1") + wpas.global_request("SET p2p_no_group_iface 0") + wpas.request("P2P_LISTEN") + if not dev[0].discover_peer(addr1): + raise Exception("Could not discover peer") + dev[0].request("P2P_LISTEN") + if not wpas.discover_peer(addr0): + raise Exception("Could not discover peer (2)") + + dev[0].global_request("P2P_EXT_LISTEN 300 500") + dev[0].global_request("P2P_CONNECT " + addr1 + " 12345670 display auth go_intent=0 freq=2417") + wpas.global_request("P2P_CONNECT " + addr0 + " 12345670 enter go_intent=15 freq=2417") + ev = dev[0].wait_global_event(["P2P-GO-NEG-SUCCESS"], timeout=15) + if ev is None: + raise Exception("GO Negotiation failed") + ifaces = wpas.request("INTERFACES").splitlines() + iface = ifaces[0] if "p2p-wlan" in ifaces[0] else ifaces[1] + wpas.group_ifname = iface + if "OK" not in wpas.group_request("STOP_AP"): + raise Exception("STOP_AP failed") + wpas.group_request("SET ext_mgmt_frame_handling 1") + dev[1].p2p_find(social=True) + time.sleep(1) + if dev[1].peer_known(addr0): + raise Exception("Unexpected peer discovery") + ifaces = dev[0].request("INTERFACES").splitlines() + iface = ifaces[0] if "p2p-wlan" in ifaces[0] else ifaces[1] + if "OK" not in dev[0].global_request("P2P_GROUP_REMOVE " + iface): + raise Exception("Failed to request group removal") + wpas.remove_group() + + count = 0 + timeout = 15 + found = False + while count < timeout * 4: + time.sleep(0.25) + count = count + 1 + if dev[1].peer_known(addr0): + found = True + break + dev[1].p2p_stop_find() + if not found: + raise Exception("Could not discover peer that was supposed to use extended listen") + def test_both_go_intent_15(dev): """P2P GO Negotiation with both devices using GO intent 15""" go_neg_pin_authorized(i_dev=dev[0], i_intent=15, r_dev=dev[1], r_intent=15, expect_failure=True, i_go_neg_status=9)