tests: Move HwsimSkip processing into start_wnm_ap()

There is no need to handle this separately in each OCV test case.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2019-12-27 09:38:25 +02:00
parent 743b234902
commit 4ee4778676

View File

@ -81,7 +81,12 @@ def start_wnm_ap(apdev, bss_transition=True, time_adv=False, ssid=None,
params["vht_oper_centr_freq_seg0_idx"] = "0" params["vht_oper_centr_freq_seg0_idx"] = "0"
if mbo: if mbo:
params["mbo"] = "1" params["mbo"] = "1"
try:
hapd = hostapd.add_ap(apdev, params) hapd = hostapd.add_ap(apdev, params)
except Exception as e:
if "Failed to set hostapd parameter ocv" in str(e):
raise HwsimSkip("OCV not supported")
raise
if rsn: if rsn:
Wlantest.setup(hapd) Wlantest.setup(hapd)
wt = Wlantest() wt = Wlantest()
@ -301,13 +306,8 @@ def test_wnm_sleep_mode_rsn_pmf(dev, apdev):
@remote_compatible @remote_compatible
def test_wnm_sleep_mode_rsn_ocv(dev, apdev): def test_wnm_sleep_mode_rsn_ocv(dev, apdev):
"""WNM Sleep Mode - RSN with OCV""" """WNM Sleep Mode - RSN with OCV"""
try:
hapd = start_wnm_ap(apdev[0], rsn=True, wnm_sleep_mode=True, hapd = start_wnm_ap(apdev[0], rsn=True, wnm_sleep_mode=True,
time_adv=True, ocv=True) time_adv=True, ocv=True)
except Exception as e:
if "Failed to set hostapd parameter ocv" in str(e):
raise HwsimSkip("OCV not supported")
raise
dev[0].connect("test-wnm-rsn", psk="12345678", ieee80211w="2", ocv="1", dev[0].connect("test-wnm-rsn", psk="12345678", ieee80211w="2", ocv="1",
key_mgmt="WPA-PSK-SHA256", proto="WPA2", scan_freq="2412") key_mgmt="WPA-PSK-SHA256", proto="WPA2", scan_freq="2412")
@ -325,12 +325,7 @@ def test_wnm_sleep_mode_rsn_ocv(dev, apdev):
def test_wnm_sleep_mode_rsn_badocv(dev, apdev): def test_wnm_sleep_mode_rsn_badocv(dev, apdev):
"""WNM Sleep Mode - RSN with OCV and bad OCI elements""" """WNM Sleep Mode - RSN with OCV and bad OCI elements"""
ssid = "test-wnm-rsn" ssid = "test-wnm-rsn"
try:
hapd = start_wnm_ap(apdev[0], rsn=True, wnm_sleep_mode=True, ocv=True) hapd = start_wnm_ap(apdev[0], rsn=True, wnm_sleep_mode=True, ocv=True)
except Exception as e:
if "Failed to set hostapd parameter ocv" in str(e):
raise HwsimSkip("OCV not supported")
raise
bssid = apdev[0]['bssid'] bssid = apdev[0]['bssid']
dev[0].connect(ssid, psk="12345678", key_mgmt="WPA-PSK-SHA256", ocv="1", dev[0].connect(ssid, psk="12345678", key_mgmt="WPA-PSK-SHA256", ocv="1",
proto="WPA2", ieee80211w="2", scan_freq="2412") proto="WPA2", ieee80211w="2", scan_freq="2412")
@ -406,13 +401,8 @@ def test_wnm_sleep_mode_rsn_badocv(dev, apdev):
def test_wnm_sleep_mode_rsn_ocv_failure(dev, apdev): def test_wnm_sleep_mode_rsn_ocv_failure(dev, apdev):
"""WNM Sleep Mode - RSN with OCV - local failure""" """WNM Sleep Mode - RSN with OCV - local failure"""
try:
hapd = start_wnm_ap(apdev[0], rsn=True, wnm_sleep_mode=True, hapd = start_wnm_ap(apdev[0], rsn=True, wnm_sleep_mode=True,
time_adv=True, ocv=True) time_adv=True, ocv=True)
except Exception as e:
if "Failed to set hostapd parameter ocv" in str(e):
raise HwsimSkip("OCV not supported")
raise
dev[0].connect("test-wnm-rsn", psk="12345678", ieee80211w="2", ocv="1", dev[0].connect("test-wnm-rsn", psk="12345678", ieee80211w="2", ocv="1",
key_mgmt="WPA-PSK-SHA256", proto="WPA2", scan_freq="2412") key_mgmt="WPA-PSK-SHA256", proto="WPA2", scan_freq="2412")