tests: Use FLUSH command to clear wpa_supplicant state

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2013-03-31 20:32:33 +03:00
parent acb546436a
commit 62d58f7ae3
3 changed files with 3 additions and 16 deletions

View file

@ -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']

View file

@ -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")

View file

@ -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