From 721ec02da53ee498ded0d30c92e8e739dda45448 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 28 Dec 2015 17:26:20 +0200 Subject: [PATCH] tests: Clear p2p_no_go_freq 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 --- tests/hwsim/test_p2p_grpform.py | 30 ++++++++++++++++++------------ tests/hwsim/wpasupplicant.py | 1 - 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/tests/hwsim/test_p2p_grpform.py b/tests/hwsim/test_p2p_grpform.py index e06fd39e3..9f70a09ec 100644 --- a/tests/hwsim/test_p2p_grpform.py +++ b/tests/hwsim/test_p2p_grpform.py @@ -368,21 +368,27 @@ def test_grpform_pref_chan_go_overridden(dev): def test_grpform_no_go_freq_forcing_chan(dev): """P2P group formation with no-GO freq forcing channel""" - dev[1].request("SET p2p_no_go_freq 100-200,300,4000-6000") - [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 no-GO freq") - remove_group(dev[0], dev[1]) + try: + dev[1].request("SET p2p_no_go_freq 100-200,300,4000-6000") + [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 no-GO freq") + remove_group(dev[0], dev[1]) + finally: + dev[1].request("SET p2p_no_go_freq ") def test_grpform_no_go_freq_conflict(dev): """P2P group formation fails due to no-GO range forced by client""" - dev[1].request("SET p2p_no_go_freq 2000-3000") - go_neg_pin_authorized(i_dev=dev[0], i_intent=0, i_freq=2422, - r_dev=dev[1], r_intent=15, - expect_failure=True, i_go_neg_status=7) + try: + dev[1].request("SET p2p_no_go_freq 2000-3000") + go_neg_pin_authorized(i_dev=dev[0], i_intent=0, i_freq=2422, + r_dev=dev[1], r_intent=15, + expect_failure=True, i_go_neg_status=7) + finally: + dev[1].request("SET p2p_no_go_freq ") def test_grpform_no_5ghz_world_roaming(dev): """P2P group formation with world roaming regulatory""" diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py index e04615249..2f8290ecd 100644 --- a/tests/hwsim/wpasupplicant.py +++ b/tests/hwsim/wpasupplicant.py @@ -123,7 +123,6 @@ class WpaSupplicant: 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_no_go_freq ") self.global_request("SET p2p_pref_chan ") self.global_request("SET p2p_no_group_iface 1") self.global_request("SET p2p_go_intent 7")