From ecc46f29005d58e262a04ac68e2d57c7f1c9c2f8 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 28 Feb 2021 23:15:57 +0200 Subject: [PATCH] tests: Move ERP/FILS capability checks to utils.py Signed-off-by: Jouni Malinen --- tests/hwsim/test_eap_proto.py | 3 +-- tests/hwsim/test_erp.py | 7 +------ tests/hwsim/test_fils.py | 12 +----------- tests/hwsim/test_pasn.py | 3 +-- tests/hwsim/utils.py | 15 +++++++++++++++ 5 files changed, 19 insertions(+), 21 deletions(-) diff --git a/tests/hwsim/test_eap_proto.py b/tests/hwsim/test_eap_proto.py index 3401749de..dab218dc1 100644 --- a/tests/hwsim/test_eap_proto.py +++ b/tests/hwsim/test_eap_proto.py @@ -16,9 +16,8 @@ import threading import time import hostapd -from utils import HwsimSkip, alloc_fail, fail_test, wait_fail_trigger +from utils import * from test_ap_eap import check_eap_capa, check_hlr_auc_gw_support, int_eap_server_params -from test_erp import check_erp_capa try: import OpenSSL diff --git a/tests/hwsim/test_erp.py b/tests/hwsim/test_erp.py index 40fbf2b67..6ca1259ab 100644 --- a/tests/hwsim/test_erp.py +++ b/tests/hwsim/test_erp.py @@ -11,15 +11,10 @@ import os import time import hostapd -from utils import HwsimSkip, alloc_fail, fail_test, wait_fail_trigger +from utils import * from test_ap_eap import int_eap_server_params from test_ap_psk import find_wpas_process, read_process_memory, verify_not_present, get_key_locations -def check_erp_capa(dev): - capab = dev.get_capability("erp") - if not capab or 'ERP' not in capab: - raise HwsimSkip("ERP not supported in the build") - def test_erp_initiate_reauth_start(dev, apdev): """Authenticator sending EAP-Initiate/Re-auth-Start, but ERP disabled on peer""" params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap") diff --git a/tests/hwsim/test_fils.py b/tests/hwsim/test_fils.py index d867e8fd4..39b48e980 100644 --- a/tests/hwsim/test_fils.py +++ b/tests/hwsim/test_fils.py @@ -18,19 +18,9 @@ from tshark import run_tshark from wpasupplicant import WpaSupplicant import hwsim_utils from utils import * -from test_erp import check_erp_capa, start_erp_as +from test_erp import start_erp_as from test_ap_hs20 import ip_checksum -def check_fils_capa(dev): - capa = dev.get_capability("fils") - if capa is None or "FILS" not in capa: - raise HwsimSkip("FILS not supported") - -def check_fils_sk_pfs_capa(dev): - capa = dev.get_capability("fils") - if capa is None or "FILS-SK-PFS" not in capa: - raise HwsimSkip("FILS-SK-PFS not supported") - def test_fils_sk_full_auth(dev, apdev, params): """FILS SK full authentication""" check_fils_capa(dev[0]) diff --git a/tests/hwsim/test_pasn.py b/tests/hwsim/test_pasn.py index 3ee8cf52a..55aee9ef6 100644 --- a/tests/hwsim/test_pasn.py +++ b/tests/hwsim/test_pasn.py @@ -19,8 +19,7 @@ import hostapd from wpasupplicant import WpaSupplicant from utils import * from hwsim import HWSimRadio -from test_erp import check_erp_capa, start_erp_as -from test_fils import check_fils_capa +from test_erp import start_erp_as from test_ap_ft import run_roams, ft_params1, ft_params2 def check_pasn_capab(dev): diff --git a/tests/hwsim/utils.py b/tests/hwsim/utils.py index 3aa7c4497..f35831aa8 100644 --- a/tests/hwsim/utils.py +++ b/tests/hwsim/utils.py @@ -117,6 +117,21 @@ def check_sae_pk_capab(dev): if "PK" not in dev.get_capability("sae"): raise HwsimSkip("SAE-PK not supported") +def check_erp_capa(dev): + capab = dev.get_capability("erp") + if not capab or 'ERP' not in capab: + raise HwsimSkip("ERP not supported in the build") + +def check_fils_capa(dev): + capa = dev.get_capability("fils") + if capa is None or "FILS" not in capa: + raise HwsimSkip("FILS not supported") + +def check_fils_sk_pfs_capa(dev): + capa = dev.get_capability("fils") + if capa is None or "FILS-SK-PFS" not in capa: + raise HwsimSkip("FILS-SK-PFS not supported") + def check_tls_tod(dev): tls = dev.request("GET tls_library") if not tls.startswith("OpenSSL") and not tls.startswith("internal"):