tests: Make hostapd_oom_wpa2_psk catch cases more robustly

For some reason, a potential OOM in hostapd_config_read_wpa_psk() and
hostapd_derive_psk() were missed in --codecov runs during the main
iteration loop. Cover these specific cases with separate instances to
avoid missing coverage.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2016-12-26 17:53:07 +02:00
parent 34e29dfd4b
commit 0f6fb05d91

View File

@ -50,6 +50,22 @@ def test_hostapd_oom_wpa2_psk(dev, apdev):
params['wpa_psk_file'] = 'hostapd.wpa_psk'
hostapd_oom_loop(apdev, params)
tests = [ "hostapd_config_read_wpa_psk", "hostapd_derive_psk" ]
for t in tests:
hapd = hostapd.add_ap(apdev[0], { "ssid": "ctrl" })
hapd.request("TEST_ALLOC_FAIL 1:%s" % t)
try:
hostapd.add_ap(apdev[1], params, timeout=2.5)
raise Exception("Unexpected add_ap() success during OOM")
except Exception, e:
if "Failed to enable hostapd" in str(e):
pass
else:
raise
state = hapd.request('GET_ALLOC_FAIL')
if state != "0:%s" % t:
raise Exception("OOM not triggered")
@remote_compatible
def test_hostapd_oom_wpa2_eap(dev, apdev):
"""hostapd failing to setup WPA2-EAP mode due to OOM"""