From: Jouni Malinen Date: Tue, 9 Dec 2014 21:03:27 +0000 (+0200) Subject: tests: Additional P2P_GROUP_ADD coverage X-Git-Tag: hostap_2_4~845 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bccbd51a802b5952dba79415281459e17b79a0cb;p=thirdparty%2Fhostap.git tests: Additional P2P_GROUP_ADD coverage Signed-off-by: Jouni Malinen --- diff --git a/tests/hwsim/test_p2p_channel.py b/tests/hwsim/test_p2p_channel.py index 118c5ef36..2138d89d9 100644 --- a/tests/hwsim/test_p2p_channel.py +++ b/tests/hwsim/test_p2p_channel.py @@ -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") diff --git a/tests/hwsim/test_p2p_persistent.py b/tests/hwsim/test_p2p_persistent.py index 5e503d6c3..6366867fa 100644 --- a/tests/hwsim/test_p2p_persistent.py +++ b/tests/hwsim/test_p2p_persistent.py @@ -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")