From 62d58f7ae34596e47c242164a28eb55fec1b38ec Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 31 Mar 2013 20:32:33 +0300 Subject: [PATCH] tests: Use FLUSH command to clear wpa_supplicant state Signed-hostap: Jouni Malinen --- tests/hwsim/run-tests.py | 5 ++--- tests/hwsim/test_ap_wps.py | 6 ------ tests/hwsim/wpasupplicant.py | 8 +------- 3 files changed, 3 insertions(+), 16 deletions(-) diff --git a/tests/hwsim/run-tests.py b/tests/hwsim/run-tests.py index 80128e082..24d51cad2 100755 --- a/tests/hwsim/run-tests.py +++ b/tests/hwsim/run-tests.py @@ -17,11 +17,11 @@ from wpasupplicant import WpaSupplicant from hostapd import HostapdGlobal def reset_devs(dev, apdev): - for d in dev: - d.reset() hapd = HostapdGlobal() for ap in apdev: hapd.remove(ap['ifname']) + for d in dev: + d.reset() def main(): test_file = None @@ -56,7 +56,6 @@ def main(): if not d.ping(): print d.ifname + ": No response from wpa_supplicant" return - d.reset() print "DEV: " + d.ifname + ": " + d.p2p_dev_addr() for ap in apdev: print "APDEV: " + ap['ifname'] diff --git a/tests/hwsim/test_ap_wps.py b/tests/hwsim/test_ap_wps.py index 84fb8abbf..dbe947513 100644 --- a/tests/hwsim/test_ap_wps.py +++ b/tests/hwsim/test_ap_wps.py @@ -22,7 +22,6 @@ def test_ap_wps_init(dev, apdev): hapd = hostapd.Hostapd(apdev[0]['ifname']) logger.info("WPS provisioning step") hapd.request("WPS_PBC") - dev[0].request("BSS_FLUSH 0") dev[0].request("SET ignore_old_scan_res 1") dev[0].dump_monitor() dev[0].request("WPS_PBC") @@ -77,7 +76,6 @@ def test_ap_wps_conf_pin(dev, apdev): logger.info("WPS provisioning step") pin = dev[0].wps_read_pin() hapd.request("WPS_PIN any " + pin) - dev[0].request("BSS_FLUSH 0") dev[0].request("SET ignore_old_scan_res 1") dev[0].dump_monitor() dev[0].request("WPS_PIN any " + pin) @@ -104,7 +102,6 @@ def test_ap_wps_reg_connect(dev, apdev): "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP", "ap_pin": appin}) logger.info("WPS provisioning step") - dev[0].request("BSS_FLUSH 0") dev[0].request("SET ignore_old_scan_res 1") dev[0].dump_monitor() dev[0].request("WPS_REG " + apdev[0]['bssid'] + " " + appin) @@ -129,7 +126,6 @@ def test_ap_wps_reg_config(dev, apdev): { "ssid": ssid, "eap_server": "1", "wps_state": "2", "ap_pin": appin}) logger.info("WPS configuration step") - dev[0].request("BSS_FLUSH 0") dev[0].request("SET ignore_old_scan_res 1") dev[0].dump_monitor() new_ssid = "wps-new-ssid" @@ -182,9 +178,7 @@ def test_ap_wps_pbc_overlap_2sta(dev, apdev): logger.info("WPS provisioning step") hapd.request("WPS_PBC") dev[0].request("SET ignore_old_scan_res 1") - dev[0].request("BSS_FLUSH 0") dev[1].request("SET ignore_old_scan_res 1") - dev[1].request("BSS_FLUSH 0") dev[0].dump_monitor() dev[1].dump_monitor() dev[0].request("WPS_PBC") diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py index d151a3fb8..1606028f0 100644 --- a/tests/hwsim/wpasupplicant.py +++ b/tests/hwsim/wpasupplicant.py @@ -38,13 +38,7 @@ class WpaSupplicant: return "PONG" in self.request("PING") def reset(self): - self.request("P2P_STOP_FIND") - self.request("P2P_FLUSH") - self.request("P2P_GROUP_REMOVE *") - self.request("REMOVE_NETWORK *") - self.request("REMOVE_CRED *") - self.request("SET tdls_disabled 0") - self.request("SET tdls_testing 0") + self.request("FLUSH") self.request("SET ignore_old_scan_res 0") self.group_ifname = None