]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Additional P2P_GROUP_ADD coverage
authorJouni Malinen <j@w1.fi>
Tue, 9 Dec 2014 21:03:27 +0000 (23:03 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 9 Dec 2014 21:03:27 +0000 (23:03 +0200)
Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/test_p2p_channel.py
tests/hwsim/test_p2p_persistent.py

index 118c5ef36c5ff48444347d1459dff17f3b9c7a8e..2138d89d96f41ef96bb86a11dd10e524f237e42f 100644 (file)
@@ -503,3 +503,42 @@ def test_p2p_autogo_pref_chan_not_in_regulatory(dev, apdev):
     finally:
         dev[0].request("SET p2p_pref_chan ")
         set_country("00")
+
+def run_autogo(dev, param):
+    if "OK" not in dev.global_request("P2P_GROUP_ADD " + param):
+        raise Exception("P2P_GROUP_ADD failed: " + param)
+    ev = dev.wait_global_event(["P2P-GROUP-STARTED"], timeout=10)
+    if ev is None:
+        raise Exception("GO start up timed out")
+    res = dev.group_form_result(ev)
+    dev.remove_group()
+    return res
+
+def _test_autogo_ht_vht(dev):
+    res = run_autogo(dev[0], "ht40")
+
+    res = run_autogo(dev[0], "vht")
+
+    res = run_autogo(dev[0], "freq=2")
+    freq = int(res['freq'])
+    if freq < 2412 or freq > 2462:
+        raise Exception("Unexpected freq=2 channel: " + str(freq))
+
+    res = run_autogo(dev[0], "freq=5")
+    freq = int(res['freq'])
+    if freq < 5000 or freq >= 6000:
+        raise Exception("Unexpected freq=5 channel: " + str(freq))
+
+    res = run_autogo(dev[0], "freq=5 ht40 vht")
+    print res
+    freq = int(res['freq'])
+    if freq < 5000 or freq >= 6000:
+        raise Exception("Unexpected freq=5 ht40 vht channel: " + str(freq))
+
+def test_autogo_ht_vht(dev):
+    """P2P autonomous GO with HT/VHT parameters"""
+    try:
+        set_country("US")
+        _test_autogo_ht_vht(dev)
+    finally:
+        set_country("00")
index 5e503d6c36a57bd25358b50d2c13ae8a99fb9bf5..6366867faaa9e697687ce81f85054f881bc55440 100644 (file)
@@ -543,3 +543,13 @@ def test_persistent_group_add_cli_chan(dev):
     dev[1].request("BSS_FLUSH 0")
     invite_from_cli(dev[0], dev[1])
     invite_from_go(dev[0], dev[1])
+
+def test_persistent_invalid_group_add(dev):
+    """Invalid P2P_GROUP_ADD command"""
+    id = dev[0].add_network()
+    if "FAIL" not in dev[0].global_request("P2P_GROUP_ADD persistent=12345"):
+        raise Exception("Invalid P2P_GROUP_ADD accepted")
+    if "FAIL" not in dev[0].global_request("P2P_GROUP_ADD persistent=%d" % id):
+        raise Exception("Invalid P2P_GROUP_ADD accepted")
+    if "FAIL" not in dev[0].global_request("P2P_GROUP_ADD foo"):
+        raise Exception("Invalid P2P_GROUP_ADD accepted")