tests: Make active scans more robust
This makes testing under very heavy load or under extensive kernel debugging options more robust by allowing number of test cases to scan multiple times before giving up on active scans. The main reason for many of the related test failures is in Probe Response frame from hostapd not getting out quickly enough especially when multiple BSSes are operating. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
1f53fe0310
commit
90ad11e625
3 changed files with 35 additions and 4 deletions
|
@ -35,7 +35,7 @@ def test_ap_change_ssid(dev, apdev):
|
||||||
dev[0].set_network_quoted(id, "ssid", "test-wpa2-psk-new")
|
dev[0].set_network_quoted(id, "ssid", "test-wpa2-psk-new")
|
||||||
dev[0].connect_network(id)
|
dev[0].connect_network(id)
|
||||||
|
|
||||||
def multi_check(dev, check):
|
def multi_check(dev, check, scan_opt=True):
|
||||||
id = []
|
id = []
|
||||||
num_bss = len(check)
|
num_bss = len(check)
|
||||||
for i in range(0, num_bss):
|
for i in range(0, num_bss):
|
||||||
|
@ -49,6 +49,9 @@ def multi_check(dev, check):
|
||||||
for i in range(num_bss):
|
for i in range(num_bss):
|
||||||
if not check[i]:
|
if not check[i]:
|
||||||
continue
|
continue
|
||||||
|
bssid = '02:00:00:00:03:0' + str(i)
|
||||||
|
if scan_opt:
|
||||||
|
dev[i].scan_for_bss(bssid, freq=2412)
|
||||||
id.append(dev[i].connect("bss-" + str(i + 1), key_mgmt="NONE",
|
id.append(dev[i].connect("bss-" + str(i + 1), key_mgmt="NONE",
|
||||||
scan_freq="2412", wait_connect=True))
|
scan_freq="2412", wait_connect=True))
|
||||||
first = True
|
first = True
|
||||||
|
@ -78,6 +81,15 @@ def multi_check(dev, check):
|
||||||
|
|
||||||
def test_ap_bss_add_remove(dev, apdev):
|
def test_ap_bss_add_remove(dev, apdev):
|
||||||
"""Dynamic BSS add/remove operations with hostapd"""
|
"""Dynamic BSS add/remove operations with hostapd"""
|
||||||
|
try:
|
||||||
|
_test_ap_bss_add_remove(dev, apdev)
|
||||||
|
finally:
|
||||||
|
for i in range(3):
|
||||||
|
dev[i].request("SCAN_INTERVAL 5")
|
||||||
|
|
||||||
|
def _test_ap_bss_add_remove(dev, apdev):
|
||||||
|
for i in range(3):
|
||||||
|
dev[i].request("SCAN_INTERVAL 1")
|
||||||
ifname1 = apdev[0]['ifname']
|
ifname1 = apdev[0]['ifname']
|
||||||
ifname2 = apdev[0]['ifname'] + '-2'
|
ifname2 = apdev[0]['ifname'] + '-2'
|
||||||
ifname3 = apdev[0]['ifname'] + '-3'
|
ifname3 = apdev[0]['ifname'] + '-3'
|
||||||
|
@ -143,14 +155,14 @@ def test_ap_bss_add_remove_during_ht_scan(dev, apdev):
|
||||||
ifname2 = apdev[0]['ifname'] + '-2'
|
ifname2 = apdev[0]['ifname'] + '-2'
|
||||||
hostapd.add_bss('phy3', ifname1, 'bss-ht40-1.conf')
|
hostapd.add_bss('phy3', ifname1, 'bss-ht40-1.conf')
|
||||||
hostapd.add_bss('phy3', ifname2, 'bss-ht40-2.conf')
|
hostapd.add_bss('phy3', ifname2, 'bss-ht40-2.conf')
|
||||||
multi_check(dev, [ True, True ])
|
multi_check(dev, [ True, True ], scan_opt=False)
|
||||||
hostapd.remove_bss(ifname2)
|
hostapd.remove_bss(ifname2)
|
||||||
hostapd.remove_bss(ifname1)
|
hostapd.remove_bss(ifname1)
|
||||||
|
|
||||||
hostapd.add_bss('phy3', ifname1, 'bss-ht40-1.conf')
|
hostapd.add_bss('phy3', ifname1, 'bss-ht40-1.conf')
|
||||||
hostapd.add_bss('phy3', ifname2, 'bss-ht40-2.conf')
|
hostapd.add_bss('phy3', ifname2, 'bss-ht40-2.conf')
|
||||||
hostapd.remove_bss(ifname2)
|
hostapd.remove_bss(ifname2)
|
||||||
multi_check(dev, [ True, False ])
|
multi_check(dev, [ True, False ], scan_opt=False)
|
||||||
hostapd.remove_bss(ifname1)
|
hostapd.remove_bss(ifname1)
|
||||||
|
|
||||||
hostapd.add_bss('phy3', ifname1, 'bss-ht40-1.conf')
|
hostapd.add_bss('phy3', ifname1, 'bss-ht40-1.conf')
|
||||||
|
|
|
@ -306,6 +306,8 @@ def _test_ap_wpa2_eap_sim_ext(dev, apdev):
|
||||||
if ev is None:
|
if ev is None:
|
||||||
raise Exception("EAP failure not reported")
|
raise Exception("EAP failure not reported")
|
||||||
dev[0].request("DISCONNECT")
|
dev[0].request("DISCONNECT")
|
||||||
|
dev[0].wait_disconnected()
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
dev[0].select_network(id, freq="2412")
|
dev[0].select_network(id, freq="2412")
|
||||||
ev = dev[0].wait_event(["CTRL-REQ-SIM"], timeout=15)
|
ev = dev[0].wait_event(["CTRL-REQ-SIM"], timeout=15)
|
||||||
|
@ -322,6 +324,8 @@ def _test_ap_wpa2_eap_sim_ext(dev, apdev):
|
||||||
if ev is None:
|
if ev is None:
|
||||||
raise Exception("EAP failure not reported")
|
raise Exception("EAP failure not reported")
|
||||||
dev[0].request("DISCONNECT")
|
dev[0].request("DISCONNECT")
|
||||||
|
dev[0].wait_disconnected()
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
dev[0].select_network(id, freq="2412")
|
dev[0].select_network(id, freq="2412")
|
||||||
ev = dev[0].wait_event(["CTRL-REQ-SIM"], timeout=15)
|
ev = dev[0].wait_event(["CTRL-REQ-SIM"], timeout=15)
|
||||||
|
@ -338,6 +342,8 @@ def _test_ap_wpa2_eap_sim_ext(dev, apdev):
|
||||||
if ev is None:
|
if ev is None:
|
||||||
raise Exception("EAP failure not reported")
|
raise Exception("EAP failure not reported")
|
||||||
dev[0].request("DISCONNECT")
|
dev[0].request("DISCONNECT")
|
||||||
|
dev[0].wait_disconnected()
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
dev[0].select_network(id, freq="2412")
|
dev[0].select_network(id, freq="2412")
|
||||||
ev = dev[0].wait_event(["CTRL-REQ-SIM"], timeout=15)
|
ev = dev[0].wait_event(["CTRL-REQ-SIM"], timeout=15)
|
||||||
|
@ -354,6 +360,8 @@ def _test_ap_wpa2_eap_sim_ext(dev, apdev):
|
||||||
if ev is None:
|
if ev is None:
|
||||||
raise Exception("EAP failure not reported")
|
raise Exception("EAP failure not reported")
|
||||||
dev[0].request("DISCONNECT")
|
dev[0].request("DISCONNECT")
|
||||||
|
dev[0].wait_disconnected()
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
dev[0].select_network(id, freq="2412")
|
dev[0].select_network(id, freq="2412")
|
||||||
ev = dev[0].wait_event(["CTRL-REQ-SIM"], timeout=15)
|
ev = dev[0].wait_event(["CTRL-REQ-SIM"], timeout=15)
|
||||||
|
@ -370,6 +378,8 @@ def _test_ap_wpa2_eap_sim_ext(dev, apdev):
|
||||||
if ev is None:
|
if ev is None:
|
||||||
raise Exception("EAP failure not reported")
|
raise Exception("EAP failure not reported")
|
||||||
dev[0].request("DISCONNECT")
|
dev[0].request("DISCONNECT")
|
||||||
|
dev[0].wait_disconnected()
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
dev[0].select_network(id, freq="2412")
|
dev[0].select_network(id, freq="2412")
|
||||||
ev = dev[0].wait_event(["CTRL-REQ-SIM"], timeout=15)
|
ev = dev[0].wait_event(["CTRL-REQ-SIM"], timeout=15)
|
||||||
|
@ -386,6 +396,8 @@ def _test_ap_wpa2_eap_sim_ext(dev, apdev):
|
||||||
if ev is None:
|
if ev is None:
|
||||||
raise Exception("EAP failure not reported")
|
raise Exception("EAP failure not reported")
|
||||||
dev[0].request("DISCONNECT")
|
dev[0].request("DISCONNECT")
|
||||||
|
dev[0].wait_disconnected()
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
dev[0].select_network(id, freq="2412")
|
dev[0].select_network(id, freq="2412")
|
||||||
ev = dev[0].wait_event(["CTRL-REQ-SIM"], timeout=15)
|
ev = dev[0].wait_event(["CTRL-REQ-SIM"], timeout=15)
|
||||||
|
@ -559,6 +571,7 @@ def _test_ap_wpa2_eap_aka_ext(dev, apdev):
|
||||||
raise Exception("EAP failure not reported")
|
raise Exception("EAP failure not reported")
|
||||||
dev[0].request("DISCONNECT")
|
dev[0].request("DISCONNECT")
|
||||||
dev[0].wait_disconnected()
|
dev[0].wait_disconnected()
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
dev[0].select_network(id, freq="2412")
|
dev[0].select_network(id, freq="2412")
|
||||||
ev = dev[0].wait_event(["CTRL-REQ-SIM"], timeout=15)
|
ev = dev[0].wait_event(["CTRL-REQ-SIM"], timeout=15)
|
||||||
|
@ -586,6 +599,7 @@ def _test_ap_wpa2_eap_aka_ext(dev, apdev):
|
||||||
raise Exception("EAP failure not reported")
|
raise Exception("EAP failure not reported")
|
||||||
dev[0].request("DISCONNECT")
|
dev[0].request("DISCONNECT")
|
||||||
dev[0].wait_disconnected()
|
dev[0].wait_disconnected()
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
tests = [ ":UMTS-AUTH:00112233445566778899aabbccddeeff:00112233445566778899aabbccddeeff:0011223344",
|
tests = [ ":UMTS-AUTH:00112233445566778899aabbccddeeff:00112233445566778899aabbccddeeff:0011223344",
|
||||||
":UMTS-AUTH:34",
|
":UMTS-AUTH:34",
|
||||||
|
@ -611,6 +625,7 @@ def _test_ap_wpa2_eap_aka_ext(dev, apdev):
|
||||||
raise Exception("EAP failure not reported")
|
raise Exception("EAP failure not reported")
|
||||||
dev[0].request("DISCONNECT")
|
dev[0].request("DISCONNECT")
|
||||||
dev[0].wait_disconnected()
|
dev[0].wait_disconnected()
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
def test_ap_wpa2_eap_aka_prime(dev, apdev):
|
def test_ap_wpa2_eap_aka_prime(dev, apdev):
|
||||||
"""WPA2-Enterprise connection using EAP-AKA'"""
|
"""WPA2-Enterprise connection using EAP-AKA'"""
|
||||||
|
@ -1207,6 +1222,7 @@ def test_ap_wpa2_eap_tls_diff_ca_trust(dev, apdev):
|
||||||
only_add_network=True, scan_freq="2412")
|
only_add_network=True, scan_freq="2412")
|
||||||
|
|
||||||
dev[0].request("DISCONNECT")
|
dev[0].request("DISCONNECT")
|
||||||
|
dev[0].wait_disconnected()
|
||||||
dev[0].dump_monitor()
|
dev[0].dump_monitor()
|
||||||
dev[0].select_network(id, freq="2412")
|
dev[0].select_network(id, freq="2412")
|
||||||
|
|
||||||
|
@ -1233,6 +1249,7 @@ def test_ap_wpa2_eap_tls_diff_ca_trust2(dev, apdev):
|
||||||
only_add_network=True, scan_freq="2412")
|
only_add_network=True, scan_freq="2412")
|
||||||
|
|
||||||
dev[0].request("DISCONNECT")
|
dev[0].request("DISCONNECT")
|
||||||
|
dev[0].wait_disconnected()
|
||||||
dev[0].dump_monitor()
|
dev[0].dump_monitor()
|
||||||
dev[0].select_network(id, freq="2412")
|
dev[0].select_network(id, freq="2412")
|
||||||
|
|
||||||
|
@ -1254,6 +1271,7 @@ def test_ap_wpa2_eap_tls_diff_ca_trust3(dev, apdev):
|
||||||
ca_cert="auth_serv/ca.pem",
|
ca_cert="auth_serv/ca.pem",
|
||||||
wait_connect=True, scan_freq="2412")
|
wait_connect=True, scan_freq="2412")
|
||||||
dev[0].request("DISCONNECT")
|
dev[0].request("DISCONNECT")
|
||||||
|
dev[0].wait_disconnected()
|
||||||
dev[0].dump_monitor()
|
dev[0].dump_monitor()
|
||||||
dev[0].set_network_quoted(id, "ca_cert", "auth_serv/ca-incorrect.pem")
|
dev[0].set_network_quoted(id, "ca_cert", "auth_serv/ca-incorrect.pem")
|
||||||
dev[0].select_network(id, freq="2412")
|
dev[0].select_network(id, freq="2412")
|
||||||
|
|
|
@ -708,12 +708,13 @@ def test_wpas_ctrl_disallow_aps(dev, apdev):
|
||||||
|
|
||||||
dev[0].connect("test", key_mgmt="NONE", scan_freq="2412")
|
dev[0].connect("test", key_mgmt="NONE", scan_freq="2412")
|
||||||
hostapd.add_ap(apdev[1]['ifname'], params)
|
hostapd.add_ap(apdev[1]['ifname'], params)
|
||||||
|
dev[0].scan_for_bss(apdev[1]['bssid'], freq="2412")
|
||||||
dev[0].dump_monitor()
|
dev[0].dump_monitor()
|
||||||
if "OK" not in dev[0].request("SET disallow_aps bssid 00:11:22:33:44:55 bssid 00:22:33:44:55:66"):
|
if "OK" not in dev[0].request("SET disallow_aps bssid 00:11:22:33:44:55 bssid 00:22:33:44:55:66"):
|
||||||
raise Exception("Failed to set disallow_aps")
|
raise Exception("Failed to set disallow_aps")
|
||||||
if "OK" not in dev[0].request("SET disallow_aps bssid " + apdev[0]['bssid']):
|
if "OK" not in dev[0].request("SET disallow_aps bssid " + apdev[0]['bssid']):
|
||||||
raise Exception("Failed to set disallow_aps")
|
raise Exception("Failed to set disallow_aps")
|
||||||
ev = dev[0].wait_connected(timeout=15, error="Reassociation timed out")
|
ev = dev[0].wait_connected(timeout=30, error="Reassociation timed out")
|
||||||
if apdev[1]['bssid'] not in ev:
|
if apdev[1]['bssid'] not in ev:
|
||||||
raise Exception("Unexpected BSSID")
|
raise Exception("Unexpected BSSID")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue