tests: Clear ignore_old_scan_res 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>
This commit is contained in:
Jouni Malinen 2015-12-28 17:48:01 +02:00 committed by Jouni Malinen
parent 49d51a0dcb
commit b90b3eab1f
3 changed files with 22 additions and 3 deletions

View File

@ -580,6 +580,13 @@ def test_nfc_p2p_static_handover_join_tagdev_go(dev):
def test_nfc_p2p_static_handover_join_tagdev_client(dev): def test_nfc_p2p_static_handover_join_tagdev_client(dev):
"""NFC static handover to join a P2P group (NFC Tag device is the P2P Client)""" """NFC static handover to join a P2P group (NFC Tag device is the P2P Client)"""
try:
_test_nfc_p2p_static_handover_join_tagdev_client(dev)
finally:
dev[1].global_request("SET ignore_old_scan_res 0")
dev[2].global_request("SET ignore_old_scan_res 0")
def _test_nfc_p2p_static_handover_join_tagdev_client(dev):
set_ip_addr_info(dev[0]) set_ip_addr_info(dev[0])
logger.info("Start autonomous GO") logger.info("Start autonomous GO")
dev[0].p2p_start_go() dev[0].p2p_start_go()

View File

@ -154,6 +154,12 @@ def test_nfc_wps_password_token_ap(dev, apdev):
def test_nfc_wps_handover_init(dev, apdev): def test_nfc_wps_handover_init(dev, apdev):
"""Connect to WPS AP with NFC connection handover and move to configured state""" """Connect to WPS AP with NFC connection handover and move to configured state"""
try:
_test_nfc_wps_handover_init(dev, apdev)
finally:
dev[0].request("SET ignore_old_scan_res 0")
def _test_nfc_wps_handover_init(dev, apdev):
dev[0].request("SET ignore_old_scan_res 1") dev[0].request("SET ignore_old_scan_res 1")
ssid = "test-wps-nfc-handover-init" ssid = "test-wps-nfc-handover-init"
hostapd.add_ap(apdev[0]['ifname'], hostapd.add_ap(apdev[0]['ifname'],
@ -398,8 +404,11 @@ def start_ap_er(er, ap, ssid):
"ap_pin": ap_pin, "uuid": ap_uuid, "upnp_iface": "lo"}) "ap_pin": ap_pin, "uuid": ap_uuid, "upnp_iface": "lo"})
logger.info("Learn AP configuration") logger.info("Learn AP configuration")
er.dump_monitor() er.dump_monitor()
er.request("SET ignore_old_scan_res 1") try:
er.wps_reg(ap['bssid'], ap_pin) er.request("SET ignore_old_scan_res 1")
er.wps_reg(ap['bssid'], ap_pin)
finally:
er.request("SET ignore_old_scan_res 0")
logger.info("Start ER") logger.info("Start ER")
er.request("WPS_ER_STOP") er.request("WPS_ER_STOP")
@ -420,6 +429,7 @@ def test_nfc_wps_er_pw_token(dev, apdev):
_test_nfc_wps_er_pw_token(dev, apdev) _test_nfc_wps_er_pw_token(dev, apdev)
finally: finally:
dev[0].request("WPS_ER_STOP") dev[0].request("WPS_ER_STOP")
dev[1].request("SET ignore_old_scan_res 0")
def _test_nfc_wps_er_pw_token(dev, apdev): def _test_nfc_wps_er_pw_token(dev, apdev):
ssid = "wps-nfc-er-pw-token" ssid = "wps-nfc-er-pw-token"
@ -449,6 +459,7 @@ def test_nfc_wps_er_config_token(dev, apdev):
_test_nfc_wps_er_config_token(dev, apdev) _test_nfc_wps_er_config_token(dev, apdev)
finally: finally:
dev[0].request("WPS_ER_STOP") dev[0].request("WPS_ER_STOP")
dev[1].request("SET ignore_old_scan_res 0")
def _test_nfc_wps_er_config_token(dev, apdev): def _test_nfc_wps_er_config_token(dev, apdev):
ssid = "wps-nfc-er-config-token" ssid = "wps-nfc-er-config-token"
@ -502,6 +513,7 @@ def test_nfc_wps_er_handover_pk_hash_mismatch_sta(dev, apdev):
_test_nfc_wps_er_handover_pk_hash_mismatch_sta(dev, apdev) _test_nfc_wps_er_handover_pk_hash_mismatch_sta(dev, apdev)
finally: finally:
dev[0].request("WPS_ER_STOP") dev[0].request("WPS_ER_STOP")
dev[1].request("SET ignore_old_scan_res 0")
def _test_nfc_wps_er_handover_pk_hash_mismatch_sta(dev, apdev): def _test_nfc_wps_er_handover_pk_hash_mismatch_sta(dev, apdev):
ssid = "wps-nfc-er-handover-pkhash-sta" ssid = "wps-nfc-er-handover-pkhash-sta"
@ -536,6 +548,7 @@ def test_nfc_wps_er_handover_pk_hash_mismatch_er(dev, apdev):
_test_nfc_wps_er_handover_pk_hash_mismatch_er(dev, apdev) _test_nfc_wps_er_handover_pk_hash_mismatch_er(dev, apdev)
finally: finally:
dev[0].request("WPS_ER_STOP") dev[0].request("WPS_ER_STOP")
dev[1].request("SET ignore_old_scan_res 0")
def _test_nfc_wps_er_handover_pk_hash_mismatch_er(dev, apdev): def _test_nfc_wps_er_handover_pk_hash_mismatch_er(dev, apdev):
ssid = "wps-nfc-er-handover-pkhash-er" ssid = "wps-nfc-er-handover-pkhash-er"

View File

@ -124,7 +124,6 @@ class WpaSupplicant:
self.global_request("REMOVE_NETWORK all") self.global_request("REMOVE_NETWORK all")
self.global_request("SET p2p_no_group_iface 1") self.global_request("SET p2p_no_group_iface 1")
self.global_request("P2P_FLUSH") self.global_request("P2P_FLUSH")
self.request("SET ignore_old_scan_res 0")
if self.gctrl_mon: if self.gctrl_mon:
try: try:
self.gctrl_mon.detach() self.gctrl_mon.detach()