tests: Additional P2P_GROUP_ADD coverage

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2014-12-09 23:03:27 +02:00
parent 15badebd47
commit bccbd51a80
2 changed files with 49 additions and 0 deletions

View file

@ -503,3 +503,42 @@ def test_p2p_autogo_pref_chan_not_in_regulatory(dev, apdev):
finally: finally:
dev[0].request("SET p2p_pref_chan ") dev[0].request("SET p2p_pref_chan ")
set_country("00") 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")

View file

@ -543,3 +543,13 @@ def test_persistent_group_add_cli_chan(dev):
dev[1].request("BSS_FLUSH 0") dev[1].request("BSS_FLUSH 0")
invite_from_cli(dev[0], dev[1]) invite_from_cli(dev[0], dev[1])
invite_from_go(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")