aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2015-12-28 15:31:16 (GMT)
committerJouni Malinen <j@w1.fi>2015-12-28 15:33:17 (GMT)
commitcf3a9d8f067ed2764a7495cef16a7b8281d453a3 (patch)
tree11fb279e4715837c9c0308b62e3d094ba71ef24a /tests
parent721ec02da53ee498ded0d30c92e8e739dda45448 (diff)
downloadhostap-cf3a9d8f067ed2764a7495cef16a7b8281d453a3.zip
hostap-cf3a9d8f067ed2764a7495cef16a7b8281d453a3.tar.gz
hostap-cf3a9d8f067ed2764a7495cef16a7b8281d453a3.tar.bz2
tests: Clear p2p_add_cli_chan explicitly in test cases where it is used
This parameter is used only in couple of test cases and there is no need to maintain the code to reset it in WpaSupplicant::reset(). Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/hwsim/test_p2p_grpform.py88
-rw-r--r--tests/hwsim/test_p2p_persistent.py24
-rw-r--r--tests/hwsim/wpasupplicant.py1
3 files changed, 66 insertions, 47 deletions
diff --git a/tests/hwsim/test_p2p_grpform.py b/tests/hwsim/test_p2p_grpform.py
index 9f70a09..899bacb 100644
--- a/tests/hwsim/test_p2p_grpform.py
+++ b/tests/hwsim/test_p2p_grpform.py
@@ -402,51 +402,67 @@ def test_grpform_no_5ghz_world_roaming(dev):
def test_grpform_no_5ghz_add_cli(dev):
"""P2P group formation with passive scan 5 GHz and p2p_add_cli_chan=1"""
- dev[0].request("SET p2p_add_cli_chan 1")
- dev[1].request("SET p2p_add_cli_chan 1")
- [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=0,
- r_dev=dev[1], r_intent=14,
- test_data=False)
- check_grpform_results(i_res, r_res)
- if int(i_res['freq']) > 4000:
- raise Exception("Unexpected channel - did not follow world roaming rules")
- remove_group(dev[0], dev[1])
+ try:
+ dev[0].request("SET p2p_add_cli_chan 1")
+ dev[1].request("SET p2p_add_cli_chan 1")
+ [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=0,
+ r_dev=dev[1], r_intent=14,
+ test_data=False)
+ check_grpform_results(i_res, r_res)
+ if int(i_res['freq']) > 4000:
+ raise Exception("Unexpected channel - did not follow world roaming rules")
+ remove_group(dev[0], dev[1])
+ finally:
+ dev[0].request("SET p2p_add_cli_chan 0")
+ dev[1].request("SET p2p_add_cli_chan 0")
def test_grpform_no_5ghz_add_cli2(dev):
"""P2P group formation with passive scan 5 GHz and p2p_add_cli_chan=1 (reverse)"""
- dev[0].request("SET p2p_add_cli_chan 1")
- dev[1].request("SET p2p_add_cli_chan 1")
- [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=14,
- r_dev=dev[1], r_intent=0,
- test_data=False)
- check_grpform_results(i_res, r_res)
- if int(i_res['freq']) > 4000:
- raise Exception("Unexpected channel - did not follow world roaming rules")
- remove_group(dev[0], dev[1])
+ try:
+ dev[0].request("SET p2p_add_cli_chan 1")
+ dev[1].request("SET p2p_add_cli_chan 1")
+ [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=14,
+ r_dev=dev[1], r_intent=0,
+ test_data=False)
+ check_grpform_results(i_res, r_res)
+ if int(i_res['freq']) > 4000:
+ raise Exception("Unexpected channel - did not follow world roaming rules")
+ remove_group(dev[0], dev[1])
+ finally:
+ dev[0].request("SET p2p_add_cli_chan 0")
+ dev[1].request("SET p2p_add_cli_chan 0")
def test_grpform_no_5ghz_add_cli3(dev):
"""P2P group formation with passive scan 5 GHz and p2p_add_cli_chan=1 (intent 15)"""
- dev[0].request("SET p2p_add_cli_chan 1")
- dev[1].request("SET p2p_add_cli_chan 1")
- [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=0,
- r_dev=dev[1], r_intent=15,
- test_data=False)
- check_grpform_results(i_res, r_res)
- if int(i_res['freq']) > 4000:
- raise Exception("Unexpected channel - did not follow world roaming rules")
- remove_group(dev[0], dev[1])
+ try:
+ dev[0].request("SET p2p_add_cli_chan 1")
+ dev[1].request("SET p2p_add_cli_chan 1")
+ [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=0,
+ r_dev=dev[1], r_intent=15,
+ test_data=False)
+ check_grpform_results(i_res, r_res)
+ if int(i_res['freq']) > 4000:
+ raise Exception("Unexpected channel - did not follow world roaming rules")
+ remove_group(dev[0], dev[1])
+ finally:
+ dev[0].request("SET p2p_add_cli_chan 0")
+ dev[1].request("SET p2p_add_cli_chan 0")
def test_grpform_no_5ghz_add_cli4(dev):
"""P2P group formation with passive scan 5 GHz and p2p_add_cli_chan=1 (reverse; intent 15)"""
- dev[0].request("SET p2p_add_cli_chan 1")
- dev[1].request("SET p2p_add_cli_chan 1")
- [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15,
- r_dev=dev[1], r_intent=0,
- test_data=False)
- check_grpform_results(i_res, r_res)
- if int(i_res['freq']) > 4000:
- raise Exception("Unexpected channel - did not follow world roaming rules")
- remove_group(dev[0], dev[1])
+ try:
+ dev[0].request("SET p2p_add_cli_chan 1")
+ dev[1].request("SET p2p_add_cli_chan 1")
+ [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15,
+ r_dev=dev[1], r_intent=0,
+ test_data=False)
+ check_grpform_results(i_res, r_res)
+ if int(i_res['freq']) > 4000:
+ raise Exception("Unexpected channel - did not follow world roaming rules")
+ remove_group(dev[0], dev[1])
+ finally:
+ dev[0].request("SET p2p_add_cli_chan 0")
+ dev[1].request("SET p2p_add_cli_chan 0")
def test_grpform_incorrect_pin(dev):
"""P2P GO Negotiation with incorrect PIN"""
diff --git a/tests/hwsim/test_p2p_persistent.py b/tests/hwsim/test_p2p_persistent.py
index b9201bc..fdcb66f 100644
--- a/tests/hwsim/test_p2p_persistent.py
+++ b/tests/hwsim/test_p2p_persistent.py
@@ -465,16 +465,20 @@ def test_persistent_group_already_running(dev):
def test_persistent_group_add_cli_chan(dev):
"""P2P persistent group formation and re-invocation with p2p_add_cli_chan=1"""
- dev[0].request("SET p2p_add_cli_chan 1")
- dev[1].request("SET p2p_add_cli_chan 1")
- form(dev[0], dev[1])
- dev[1].request("BSS_FLUSH 0")
- dev[1].scan(freq="2412", only_new=True)
- dev[1].scan(freq="2437", only_new=True)
- dev[1].scan(freq="2462", only_new=True)
- dev[1].request("BSS_FLUSH 0")
- invite_from_cli(dev[0], dev[1])
- invite_from_go(dev[0], dev[1])
+ try:
+ dev[0].request("SET p2p_add_cli_chan 1")
+ dev[1].request("SET p2p_add_cli_chan 1")
+ form(dev[0], dev[1])
+ dev[1].request("BSS_FLUSH 0")
+ dev[1].scan(freq="2412", only_new=True)
+ dev[1].scan(freq="2437", only_new=True)
+ dev[1].scan(freq="2462", only_new=True)
+ dev[1].request("BSS_FLUSH 0")
+ invite_from_cli(dev[0], dev[1])
+ invite_from_go(dev[0], dev[1])
+ finally:
+ dev[0].request("SET p2p_add_cli_chan 0")
+ dev[1].request("SET p2p_add_cli_chan 0")
def test_persistent_invalid_group_add(dev):
"""Invalid P2P_GROUP_ADD command"""
diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py
index 2f8290e..3da8a5c 100644
--- a/tests/hwsim/wpasupplicant.py
+++ b/tests/hwsim/wpasupplicant.py
@@ -122,7 +122,6 @@ class WpaSupplicant:
if not "OK" in res:
logger.info("FLUSH to " + self.ifname + " failed: " + res)
self.global_request("REMOVE_NETWORK all")
- self.global_request("SET p2p_add_cli_chan 0")
self.global_request("SET p2p_pref_chan ")
self.global_request("SET p2p_no_group_iface 1")
self.global_request("SET p2p_go_intent 7")