From c93b6706d2800825aeb72da3b62ebece15016450 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 11 Dec 2014 00:03:01 +0200 Subject: [PATCH] tests: Additional P2P_REMOVE_CLIENT coverage Signed-off-by: Jouni Malinen --- tests/hwsim/test_p2p_autogo.py | 5 ++++- tests/hwsim/test_p2p_persistent.py | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/tests/hwsim/test_p2p_autogo.py b/tests/hwsim/test_p2p_autogo.py index 20f43cb28..f45c78bb1 100644 --- a/tests/hwsim/test_p2p_autogo.py +++ b/tests/hwsim/test_p2p_autogo.py @@ -218,8 +218,11 @@ def test_autogo_2cli(dev): hwsim_utils.test_connectivity_p2p(dev[1], dev[2]) dev[0].global_request("P2P_REMOVE_CLIENT " + dev[1].p2p_dev_addr()) dev[1].wait_go_ending_session() - dev[0].remove_group() + dev[0].global_request("P2P_REMOVE_CLIENT iface=" + dev[2].p2p_interface_addr()) dev[2].wait_go_ending_session() + if "FAIL" not in dev[0].global_request("P2P_REMOVE_CLIENT foo"): + raise Exception("Invalid P2P_REMOVE_CLIENT command accepted") + dev[0].remove_group() def test_autogo_pbc(dev): """P2P autonomous GO and PBC""" diff --git a/tests/hwsim/test_p2p_persistent.py b/tests/hwsim/test_p2p_persistent.py index 6366867fa..5ee3051ce 100644 --- a/tests/hwsim/test_p2p_persistent.py +++ b/tests/hwsim/test_p2p_persistent.py @@ -226,6 +226,22 @@ def test_persistent_group_per_sta_psk(dev): raise Exception("Persistent group not restarted as persistent (cli)") hwsim_utils.test_connectivity_p2p(dev[1], dev[2]) + logger.info("Remove one of the clients from the group without removing persistent group information for the client") + dev[0].global_request("P2P_REMOVE_CLIENT iface=" + dev[2].p2p_interface_addr()) + dev[2].wait_go_ending_session() + + logger.info("Try to reconnect after having been removed from group (but persistent group info still present)") + if not dev[2].discover_peer(addr0, social=True): + raise Exception("Peer " + peer + " not found") + dev[2].dump_monitor() + peer = dev[2].get_peer(addr0) + dev[2].global_request("P2P_GROUP_ADD persistent=" + peer['persistent']) + ev = dev[2].wait_global_event(["P2P-GROUP-STARTED","WPA: 4-Way Handshake failed"], timeout=30) + if ev is None: + raise Exception("Timeout on group restart (on client)") + if "P2P-GROUP-STARTED" not in ev: + raise Exception("Connection failed") + logger.info("Remove one of the clients from the group") dev[0].global_request("P2P_REMOVE_CLIENT " + addr2) dev[2].wait_go_ending_session()