tests: Split ap_ft_oom into separate test cases

ap_ft_oom seemed to depend on undesired wpa_supplicant behavior of
trying to do FT protocol even without being ready for reassociation.
This is going to be fixed in wpa_supplicant which would make this test
case fail, so split it into separate test cases for each failure item to
be able to avoid incorrect test failures.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2019-01-04 23:19:30 +02:00
parent 04e17e5024
commit 63a7683b2d
2 changed files with 31 additions and 9 deletions

View file

@ -1389,8 +1389,7 @@ def test_ap_ft_gcmp_256(dev, apdev):
run_roams(dev[0], apdev, hapd0, hapd1, ssid, passphrase,
pairwise_cipher="GCMP-256", group_cipher="GCMP-256")
def test_ap_ft_oom(dev, apdev):
"""WPA2-PSK-FT and OOM"""
def setup_ap_ft_oom(dev, apdev):
skip_with_fips(dev[0])
ssid = "test-ft"
passphrase="12345678"
@ -1408,13 +1407,32 @@ def test_ap_ft_oom(dev, apdev):
dst = apdev[0]['bssid']
dev[0].scan_for_bss(dst, freq="2412")
return dst
def test_ap_ft_oom(dev, apdev):
"""WPA2-PSK-FT and OOM"""
dst = setup_ap_ft_oom(dev, apdev)
with alloc_fail(dev[0], 1, "wpa_ft_gen_req_ies"):
dev[0].roam(dst)
with fail_test(dev[0], 1, "wpa_ft_mic"):
dev[0].roam(dst, fail_test=True)
with fail_test(dev[0], 1, "os_get_random;wpa_ft_prepare_auth_request"):
dev[0].roam(dst, fail_test=True)
def test_ap_ft_oom2(dev, apdev):
"""WPA2-PSK-FT and OOM (2)"""
dst = setup_ap_ft_oom(dev, apdev)
with fail_test(dev[0], 1, "wpa_ft_mic"):
dev[0].roam(dst, fail_test=True, assoc_reject_ok=True)
def test_ap_ft_oom3(dev, apdev):
"""WPA2-PSK-FT and OOM (3)"""
dst = setup_ap_ft_oom(dev, apdev)
with fail_test(dev[0], 1, "os_get_random;wpa_ft_prepare_auth_request"):
dev[0].roam(dst)
def test_ap_ft_oom4(dev, apdev):
"""WPA2-PSK-FT and OOM (4)"""
ssid = "test-ft"
passphrase="12345678"
dst = setup_ap_ft_oom(dev, apdev)
dev[0].request("REMOVE_NETWORK all")
with alloc_fail(dev[0], 1, "=sme_update_ft_ies"):
dev[0].connect(ssid, psk=passphrase, key_mgmt="FT-PSK", proto="WPA2",

View file

@ -1106,13 +1106,17 @@ class WpaSupplicant:
if len(res.splitlines()) > 1:
logger.info("flush_scan_cache: Could not clear all BSS entries. These remain:\n" + res)
def roam(self, bssid, fail_test=False):
def roam(self, bssid, fail_test=False, assoc_reject_ok=False):
self.dump_monitor()
if "OK" not in self.request("ROAM " + bssid):
raise Exception("ROAM failed")
if fail_test:
if assoc_reject_ok:
ev = self.wait_event(["CTRL-EVENT-CONNECTED",
"CTRL-EVENT-ASSOC-REJECT"], timeout=1)
else:
ev = self.wait_event(["CTRL-EVENT-CONNECTED"], timeout=1)
if ev is not None:
if ev is not None and "CTRL-EVENT-ASSOC-REJECT" not in ev:
raise Exception("Unexpected connection")
self.dump_monitor()
return