Browse Source

tests: Invalid P2P_INVITE parameters

Signed-off-by: Jouni Malinen <j@w1.fi>
Jouni Malinen 10 years ago
parent
commit
e22335e5db
2 changed files with 18 additions and 0 deletions
  1. 13 0
      tests/hwsim/test_p2p_invitation.py
  2. 5 0
      tests/hwsim/test_p2p_persistent.py

+ 13 - 0
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)

+ 5 - 0
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")