tests: P2P persistent group formation, re-invocation, and cancel

Verify that P2P_CANCEL gets rejected on fully re-invoked persistent
group. This did not work properly before the last couple of commits and
before this week, the P2P_CANCEL on a separate group interface in P2p
Client role could result in use of freed memory and process termination.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2015-12-04 23:15:11 +02:00 committed by Jouni Malinen
parent bf3214b593
commit b134397b11
2 changed files with 43 additions and 4 deletions

View file

@ -158,20 +158,22 @@ def form(go, cli, test_data=True, reverse_init=False):
else:
return i_res
def invite_from_cli(go, cli):
def invite_from_cli(go, cli, terminate=True):
logger.info("Re-invoke persistent group from client")
invite(cli, go)
[go_res, cli_res] = check_result(go, cli)
hwsim_utils.test_connectivity_p2p(go, cli)
terminate_group(go, cli)
if terminate:
terminate_group(go, cli)
return [go_res, cli_res]
def invite_from_go(go, cli):
def invite_from_go(go, cli, terminate=True):
logger.info("Re-invoke persistent group from GO")
invite(go, cli)
[go_res, cli_res] = check_result(go, cli)
hwsim_utils.test_connectivity_p2p(go, cli)
terminate_group(go, cli)
if terminate:
terminate_group(go, cli)
return [go_res, cli_res]
def autogo(go, freq=None, persistent=None):

View file

@ -553,3 +553,40 @@ def test_persistent_group_profile_add(dev):
dev[0].remove_group()
dev[1].wait_go_ending_session()
def test_persistent_group_cancel_on_cli(dev):
"""P2P persistent group formation, re-invocation, and cancel"""
dev[0].global_request("SET p2p_no_group_iface 0")
dev[1].global_request("SET p2p_no_group_iface 0")
form(dev[0], dev[1])
invite_from_go(dev[0], dev[1], terminate=False)
if "FAIL" not in dev[1].global_request("P2P_CANCEL"):
raise Exception("P2P_CANCEL succeeded unexpectedly on CLI")
if "FAIL" not in dev[0].global_request("P2P_CANCEL"):
raise Exception("P2P_CANCEL succeeded unexpectedly on GO")
terminate_group(dev[0], dev[1])
invite_from_cli(dev[0], dev[1], terminate=False)
if "FAIL" not in dev[1].global_request("P2P_CANCEL"):
raise Exception("P2P_CANCEL succeeded unexpectedly on CLI")
if "FAIL" not in dev[0].global_request("P2P_CANCEL"):
raise Exception("P2P_CANCEL succeeded unexpectedly on GO")
terminate_group(dev[0], dev[1])
def test_persistent_group_cancel_on_cli2(dev):
"""P2P persistent group formation, re-invocation, and cancel (2)"""
form(dev[0], dev[1])
invite_from_go(dev[0], dev[1], terminate=False)
if "FAIL" not in dev[1].global_request("P2P_CANCEL"):
raise Exception("P2P_CANCEL succeeded unexpectedly on CLI")
if "FAIL" not in dev[0].global_request("P2P_CANCEL"):
raise Exception("P2P_CANCEL succeeded unexpectedly on GO")
terminate_group(dev[0], dev[1])
invite_from_cli(dev[0], dev[1], terminate=False)
if "FAIL" not in dev[1].global_request("P2P_CANCEL"):
raise Exception("P2P_CANCEL succeeded unexpectedly on CLI")
if "FAIL" not in dev[0].global_request("P2P_CANCEL"):
raise Exception("P2P_CANCEL succeeded unexpectedly on GO")
terminate_group(dev[0], dev[1])