tests: Make test cases more robust by clearing scan cache explicitly
This test cases can fail if previously executed tests leave older scan results in cfg80211 scan table. Clear that scan table explicitly to avoid such issues. Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
This commit is contained in:
parent
a44fa15cb1
commit
fa34e3255e
6 changed files with 26 additions and 1 deletions
|
@ -1932,6 +1932,7 @@ def test_ap_ft_gtk_rekey(dev, apdev):
|
|||
params['wpa_group_rekey'] = '1'
|
||||
hapd = hostapd.add_ap(apdev[0], params)
|
||||
|
||||
dev[0].flush_scan_cache()
|
||||
dev[0].connect(ssid, psk=passphrase, key_mgmt="FT-PSK", proto="WPA2",
|
||||
ieee80211w="1", scan_freq="2412")
|
||||
|
||||
|
@ -2071,6 +2072,7 @@ def test_ap_ft_invalid_resp(dev, apdev):
|
|||
|
||||
params = ft_params1(ssid=ssid, passphrase=passphrase)
|
||||
hapd0 = hostapd.add_ap(apdev[0], params)
|
||||
dev[0].flush_scan_cache()
|
||||
dev[0].connect(ssid, psk=passphrase, key_mgmt="FT-PSK", proto="WPA2",
|
||||
scan_freq="2412")
|
||||
|
||||
|
@ -2148,6 +2150,7 @@ def setup_ap_ft_oom(dev, apdev):
|
|||
params = ft_params2(ssid=ssid, passphrase=passphrase)
|
||||
hapd1 = hostapd.add_ap(apdev[1], params)
|
||||
|
||||
dev[0].flush_scan_cache()
|
||||
dev[0].connect(ssid, psk=passphrase, key_mgmt="FT-PSK", proto="WPA2",
|
||||
scan_freq="2412")
|
||||
if dev[0].get_status_field('bssid') == apdev[0]['bssid']:
|
||||
|
@ -2196,6 +2199,7 @@ def test_ap_ft_ap_oom(dev, apdev):
|
|||
hapd0 = hostapd.add_ap(apdev[0], params)
|
||||
bssid0 = hapd0.own_addr()
|
||||
|
||||
dev[0].flush_scan_cache()
|
||||
dev[0].scan_for_bss(bssid0, freq="2412")
|
||||
with alloc_fail(hapd0, 1, "wpa_ft_store_pmk_r0"):
|
||||
dev[0].connect(ssid, psk=passphrase, key_mgmt="FT-PSK", proto="WPA2",
|
||||
|
@ -2217,6 +2221,7 @@ def test_ap_ft_ap_oom2(dev, apdev):
|
|||
hapd0 = hostapd.add_ap(apdev[0], params)
|
||||
bssid0 = hapd0.own_addr()
|
||||
|
||||
dev[0].flush_scan_cache()
|
||||
dev[0].scan_for_bss(bssid0, freq="2412")
|
||||
with alloc_fail(hapd0, 1, "wpa_ft_store_pmk_r1"):
|
||||
dev[0].connect(ssid, psk=passphrase, key_mgmt="FT-PSK", proto="WPA2",
|
||||
|
@ -2241,6 +2246,7 @@ def test_ap_ft_ap_oom3(dev, apdev):
|
|||
hapd0 = hostapd.add_ap(apdev[0], params)
|
||||
bssid0 = hapd0.own_addr()
|
||||
|
||||
dev[0].flush_scan_cache()
|
||||
dev[0].scan_for_bss(bssid0, freq="2412")
|
||||
dev[0].connect(ssid, psk=passphrase, key_mgmt="FT-PSK", proto="WPA2",
|
||||
scan_freq="2412")
|
||||
|
@ -2291,6 +2297,7 @@ def test_ap_ft_ap_oom4(dev, apdev):
|
|||
hapd0 = hostapd.add_ap(apdev[0], params)
|
||||
bssid0 = hapd0.own_addr()
|
||||
|
||||
dev[0].flush_scan_cache()
|
||||
dev[0].scan_for_bss(bssid0, freq="2412")
|
||||
dev[0].connect(ssid, psk=passphrase, key_mgmt="FT-PSK", proto="WPA2",
|
||||
scan_freq="2412")
|
||||
|
@ -2323,6 +2330,7 @@ def test_ap_ft_ap_oom5(dev, apdev):
|
|||
hapd0 = hostapd.add_ap(apdev[0], params)
|
||||
bssid0 = hapd0.own_addr()
|
||||
|
||||
dev[0].flush_scan_cache()
|
||||
dev[0].scan_for_bss(bssid0, freq="2412")
|
||||
dev[0].connect(ssid, psk=passphrase, key_mgmt="FT-PSK", proto="WPA2",
|
||||
scan_freq="2412")
|
||||
|
@ -2385,6 +2393,7 @@ def test_ap_ft_ap_oom7a(dev, apdev):
|
|||
hapd0 = hostapd.add_ap(apdev[0], params)
|
||||
bssid0 = hapd0.own_addr()
|
||||
|
||||
dev[0].flush_scan_cache()
|
||||
dev[0].scan_for_bss(bssid0, freq="2412")
|
||||
dev[0].connect(ssid, psk=passphrase, key_mgmt="FT-PSK", proto="WPA2",
|
||||
ieee80211w="2", scan_freq="2412")
|
||||
|
@ -2408,6 +2417,7 @@ def test_ap_ft_ap_oom7b(dev, apdev):
|
|||
hapd0 = hostapd.add_ap(apdev[0], params)
|
||||
bssid0 = hapd0.own_addr()
|
||||
|
||||
dev[0].flush_scan_cache()
|
||||
dev[0].scan_for_bss(bssid0, freq="2412")
|
||||
dev[0].connect(ssid, psk=passphrase, key_mgmt="FT-PSK", proto="WPA2",
|
||||
ieee80211w="2", scan_freq="2412")
|
||||
|
@ -2431,6 +2441,7 @@ def test_ap_ft_ap_oom7c(dev, apdev):
|
|||
hapd0 = hostapd.add_ap(apdev[0], params)
|
||||
bssid0 = hapd0.own_addr()
|
||||
|
||||
dev[0].flush_scan_cache()
|
||||
dev[0].scan_for_bss(bssid0, freq="2412")
|
||||
dev[0].connect(ssid, psk=passphrase, key_mgmt="FT-PSK", proto="WPA2",
|
||||
ieee80211w="2", scan_freq="2412")
|
||||
|
@ -2454,6 +2465,7 @@ def test_ap_ft_ap_oom7d(dev, apdev):
|
|||
hapd0 = hostapd.add_ap(apdev[0], params)
|
||||
bssid0 = hapd0.own_addr()
|
||||
|
||||
dev[0].flush_scan_cache()
|
||||
dev[0].scan_for_bss(bssid0, freq="2412")
|
||||
dev[0].connect(ssid, psk=passphrase, key_mgmt="FT-PSK", proto="WPA2",
|
||||
ieee80211w="2", scan_freq="2412")
|
||||
|
@ -2477,6 +2489,7 @@ def test_ap_ft_ap_oom8(dev, apdev):
|
|||
hapd0 = hostapd.add_ap(apdev[0], params)
|
||||
bssid0 = hapd0.own_addr()
|
||||
|
||||
dev[0].flush_scan_cache()
|
||||
dev[0].scan_for_bss(bssid0, freq="2412")
|
||||
dev[0].connect(ssid, psk=passphrase, key_mgmt="FT-PSK", proto="WPA2",
|
||||
scan_freq="2412")
|
||||
|
@ -3333,6 +3346,7 @@ def test_ap_ft_roam_rrm(dev, apdev):
|
|||
bssid0 = hapd0.own_addr()
|
||||
|
||||
addr = dev[0].own_addr()
|
||||
dev[0].flush_scan_cache()
|
||||
dev[0].connect(ssid, psk=passphrase, key_mgmt="FT-PSK", proto="WPA2",
|
||||
scan_freq="2412")
|
||||
check_beacon_req(hapd0, addr, 1)
|
||||
|
|
|
@ -2787,6 +2787,8 @@ def test_ap_hs20_osen_single_ssid(dev, apdev):
|
|||
params['hessid'] = bssid
|
||||
hapd = hostapd.add_ap(apdev[0], params)
|
||||
|
||||
dev[0].flush_scan_cache()
|
||||
|
||||
# RSN-OSEN (for OSU)
|
||||
dev[0].connect("test-hs20", proto="OSEN", key_mgmt="OSEN", pairwise="CCMP",
|
||||
group="CCMP GTK_NOT_USED",
|
||||
|
|
|
@ -818,6 +818,7 @@ def test_ap_dtim_period(dev, apdev):
|
|||
params = {'ssid': ssid, 'dtim_period': "10"}
|
||||
hapd = hostapd.add_ap(apdev[0], params)
|
||||
bssid = hapd.own_addr()
|
||||
dev[0].flush_scan_cache()
|
||||
dev[0].connect(ssid, key_mgmt="NONE", scan_freq="2412")
|
||||
for i in range(10):
|
||||
dev[0].scan(freq="2412")
|
||||
|
|
|
@ -149,6 +149,7 @@ def test_ap_reconnect_auth_timeout(dev, apdev, params):
|
|||
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
|
||||
wpas.interface_add("wlan5",
|
||||
drv_params="force_connect_cmd=1,force_bss_selection=1")
|
||||
wpas.flush_scan_cache()
|
||||
|
||||
params = hostapd.wpa2_params(ssid="test-wpa2-psk", passphrase="12345678")
|
||||
hapd0 = hostapd.add_ap(apdev[0], params)
|
||||
|
@ -380,6 +381,7 @@ def test_ap_roam_signal_level_override(dev, apdev):
|
|||
def test_ap_roam_during_scan(dev, apdev):
|
||||
"""Roam command during a scan operation"""
|
||||
hapd0 = hostapd.add_ap(apdev[0], {"ssid": "test-open"})
|
||||
dev[0].flush_scan_cache()
|
||||
dev[0].scan_for_bss(hapd0.own_addr(), freq=2412)
|
||||
dev[0].connect("test-open", key_mgmt="NONE")
|
||||
hapd1 = hostapd.add_ap(apdev[1], {"ssid": "test-open"})
|
||||
|
|
|
@ -114,6 +114,8 @@ def test_dbus_getall(dev, apdev):
|
|||
"""D-Bus GetAll"""
|
||||
(bus, wpas_obj, path, if_obj) = prepare_dbus(dev[0])
|
||||
|
||||
dev[0].flush_scan_cache()
|
||||
|
||||
props = wpas_obj.GetAll(WPAS_DBUS_SERVICE,
|
||||
dbus_interface=dbus.PROPERTIES_IFACE)
|
||||
logger.debug("GetAll(fi.w1.wpa.supplicant1, /fi/w1/wpa_supplicant1) ==> " + str(props))
|
||||
|
@ -145,8 +147,10 @@ def test_dbus_getall(dev, apdev):
|
|||
|
||||
res = if_obj.Get(WPAS_DBUS_IFACE, 'BSSs',
|
||||
dbus_interface=dbus.PROPERTIES_IFACE)
|
||||
if len(res) != 1:
|
||||
if len(res) < 1:
|
||||
raise Exception("Missing BSSs entry: " + str(res))
|
||||
if len(res) > 1:
|
||||
raise Exception("Too manu BSSs entries: " + str(res))
|
||||
bss_obj = bus.get_object(WPAS_DBUS_SERVICE, res[0])
|
||||
props = bss_obj.GetAll(WPAS_DBUS_BSS, dbus_interface=dbus.PROPERTIES_IFACE)
|
||||
logger.debug("GetAll(%s, %s): %s" % (WPAS_DBUS_BSS, res[0], str(props)))
|
||||
|
@ -621,6 +625,7 @@ def _test_dbus_wps_pbc(dev, apdev):
|
|||
hapd = start_ap(apdev[0])
|
||||
hapd.request("WPS_PBC")
|
||||
bssid = apdev[0]['bssid']
|
||||
dev[0].flush_scan_cache()
|
||||
dev[0].scan_for_bss(bssid, freq="2412")
|
||||
dev[0].request("SET wps_cred_processing 2")
|
||||
|
||||
|
|
|
@ -262,6 +262,7 @@ def test_scan_bss_operations(dev, apdev):
|
|||
hostapd.add_ap(apdev[1], {"ssid": "test2-scan"})
|
||||
bssid2 = apdev[1]['bssid']
|
||||
|
||||
dev[0].flush_scan_cache()
|
||||
dev[0].scan(freq="2412")
|
||||
dev[0].scan(freq="2412")
|
||||
dev[0].scan(freq="2412")
|
||||
|
|
Loading…
Reference in a new issue