From e22335e5db949709efc782d9086a7b4439adc53d Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 8 Dec 2014 19:46:00 +0200 Subject: [PATCH] tests: Invalid P2P_INVITE parameters Signed-off-by: Jouni Malinen --- tests/hwsim/test_p2p_invitation.py | 13 +++++++++++++ tests/hwsim/test_p2p_persistent.py | 5 +++++ 2 files changed, 18 insertions(+) diff --git a/tests/hwsim/test_p2p_invitation.py b/tests/hwsim/test_p2p_invitation.py index fd7d3a4f6..bc4fb1bb3 100644 --- a/tests/hwsim/test_p2p_invitation.py +++ b/tests/hwsim/test_p2p_invitation.py @@ -174,3 +174,16 @@ def test_p2p_cli_invite(dev): dev[0].remove_group() dev[1].wait_go_ending_session() dev[2].wait_go_ending_session() + +def test_p2p_invite_invalid(dev): + """Invalid parameters to P2P_INVITE""" + id = dev[0].add_network() + for cmd in [ "foo=bar", + "persistent=123 peer=foo", + "persistent=123", + "persistent=%d" % id, + "group=foo", + "group=foo peer=foo", + "group=foo peer=00:11:22:33:44:55 go_dev_addr=foo" ]: + if "FAIL" not in dev[0].request("P2P_INVITE " + cmd): + raise Exception("Invalid P2P_INVITE accepted: " + cmd) diff --git a/tests/hwsim/test_p2p_persistent.py b/tests/hwsim/test_p2p_persistent.py index 2e3a17a1d..5e503d6c3 100644 --- a/tests/hwsim/test_p2p_persistent.py +++ b/tests/hwsim/test_p2p_persistent.py @@ -470,6 +470,11 @@ def test_persistent_group_without_persistent_reconnect(dev): sa = s[2] id = s[3] freq = s[4] + logger.info("Invalid P2P_INVITE test coverage") + if "FAIL" not in dev[0].global_request("P2P_INVITE persistent=" + id + " peer=" + sa + " freq=0"): + raise Exception("Invalid P2P_INVITE accepted") + if "FAIL" not in dev[0].global_request("P2P_INVITE persistent=" + id + " peer=" + sa + " pref=0"): + raise Exception("Invalid P2P_INVITE accepted") logger.info("Re-initiate invitation based on upper layer acceptance") if "OK" not in dev[0].global_request("P2P_INVITE persistent=" + id + " peer=" + sa + " freq=" + freq): raise Exception("Invitation command failed")