From 40341e16a5d0452f5537f7d0aa5e787c01c82345 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 18 Apr 2020 11:05:49 +0300 Subject: [PATCH] tests: Move check_wep_capa() into utils.py Signed-off-by: Jouni Malinen --- tests/hwsim/test_ap_params.py | 3 +-- tests/hwsim/test_ap_tdls.py | 1 - tests/hwsim/test_ap_wps.py | 1 - tests/hwsim/test_cfg80211.py | 2 +- tests/hwsim/test_connect_cmd.py | 2 +- tests/hwsim/test_ibss.py | 1 - tests/hwsim/test_ieee8021x.py | 3 +-- tests/hwsim/test_radius.py | 3 +-- tests/hwsim/test_scan.py | 4 +--- tests/hwsim/test_wep.py | 6 +----- tests/hwsim/test_wext.py | 1 - tests/hwsim/test_wpas_ap.py | 3 +-- tests/hwsim/utils.py | 4 ++++ 13 files changed, 12 insertions(+), 22 deletions(-) diff --git a/tests/hwsim/test_ap_params.py b/tests/hwsim/test_ap_params.py index 4c5deb8d5..8b5fdea82 100644 --- a/tests/hwsim/test_ap_params.py +++ b/tests/hwsim/test_ap_params.py @@ -15,8 +15,7 @@ import time import hwsim_utils import hostapd from tshark import run_tshark -from utils import alloc_fail, HwsimSkip, parse_ie -from test_wep import check_wep_capa +from utils import * @remote_compatible def test_ap_fragmentation_rts_set_high(dev, apdev): diff --git a/tests/hwsim/test_ap_tdls.py b/tests/hwsim/test_ap_tdls.py index 1af072263..de2f02ac1 100644 --- a/tests/hwsim/test_ap_tdls.py +++ b/tests/hwsim/test_ap_tdls.py @@ -17,7 +17,6 @@ import hostapd from utils import * from wlantest import Wlantest from test_ap_vht import vht_supported -from test_wep import check_wep_capa def start_ap_wpa2_psk(ap): params = hostapd.wpa2_params(ssid="test-wpa2-psk", passphrase="12345678") diff --git a/tests/hwsim/test_ap_wps.py b/tests/hwsim/test_ap_wps.py index 54e4eaf6a..c8514b260 100644 --- a/tests/hwsim/test_ap_wps.py +++ b/tests/hwsim/test_ap_wps.py @@ -44,7 +44,6 @@ from wpasupplicant import WpaSupplicant from utils import * from test_ap_eap import int_eap_server_params from test_sae import check_sae_capab -from test_wep import check_wep_capa def wps_start_ap(apdev, ssid="test-wps-conf"): params = {"ssid": ssid, "eap_server": "1", "wps_state": "2", diff --git a/tests/hwsim/test_cfg80211.py b/tests/hwsim/test_cfg80211.py index 9c7935e70..3ee7a909b 100644 --- a/tests/hwsim/test_cfg80211.py +++ b/tests/hwsim/test_cfg80211.py @@ -16,7 +16,7 @@ import hwsim_utils from tshark import run_tshark from nl80211 import * from wpasupplicant import WpaSupplicant -from test_wep import check_wep_capa +from utils import * def nl80211_command(dev, cmd, attr): res = dev.request("VENDOR ffffffff {} {}".format(nl80211_cmd[cmd], diff --git a/tests/hwsim/test_connect_cmd.py b/tests/hwsim/test_connect_cmd.py index 07a9ab651..3c0985137 100644 --- a/tests/hwsim/test_connect_cmd.py +++ b/tests/hwsim/test_connect_cmd.py @@ -12,7 +12,7 @@ import hwsim_utils import hostapd from wpasupplicant import WpaSupplicant from p2p_utils import * -from test_wep import check_wep_capa +from utils import * def test_connect_cmd_open(dev, apdev): """Open connection using cfg80211 connect command""" diff --git a/tests/hwsim/test_ibss.py b/tests/hwsim/test_ibss.py index 8e688bd73..29ebd8129 100644 --- a/tests/hwsim/test_ibss.py +++ b/tests/hwsim/test_ibss.py @@ -13,7 +13,6 @@ import subprocess import hwsim_utils from utils import * -from test_wep import check_wep_capa def connect_ibss_cmd(dev, id, freq=2412): dev.dump_monitor() diff --git a/tests/hwsim/test_ieee8021x.py b/tests/hwsim/test_ieee8021x.py index 194694819..89c282b39 100644 --- a/tests/hwsim/test_ieee8021x.py +++ b/tests/hwsim/test_ieee8021x.py @@ -13,9 +13,8 @@ import time import hostapd import hwsim_utils -from utils import skip_with_fips +from utils import * from tshark import run_tshark -from test_wep import check_wep_capa logger = logging.getLogger() diff --git a/tests/hwsim/test_radius.py b/tests/hwsim/test_radius.py index 403fbd739..84163f36d 100644 --- a/tests/hwsim/test_radius.py +++ b/tests/hwsim/test_radius.py @@ -18,10 +18,9 @@ import threading import time import hostapd -from utils import HwsimSkip, require_under_vm, skip_with_fips, alloc_fail, fail_test, wait_fail_trigger +from utils import * from test_ap_hs20 import build_dhcp_ack from test_ap_ft import ft_params1 -from test_wep import check_wep_capa def connect(dev, ssid, wait_connect=True): dev.connect(ssid, key_mgmt="WPA-EAP", scan_freq="2412", diff --git a/tests/hwsim/test_scan.py b/tests/hwsim/test_scan.py index 56ab9c57d..ef6ebbaf6 100644 --- a/tests/hwsim/test_scan.py +++ b/tests/hwsim/test_scan.py @@ -15,11 +15,9 @@ import subprocess import hostapd from wpasupplicant import WpaSupplicant -from utils import HwsimSkip, fail_test, alloc_fail, wait_fail_trigger, parse_ie -from utils import clear_regdom_dev +from utils import * from tshark import run_tshark from test_ap_csa import switch_channel, wait_channel_switch, csa_supported -from test_wep import check_wep_capa def check_scan(dev, params, other_started=False, test_busy=False): if not other_started: diff --git a/tests/hwsim/test_wep.py b/tests/hwsim/test_wep.py index 38e34964a..6df9ef899 100644 --- a/tests/hwsim/test_wep.py +++ b/tests/hwsim/test_wep.py @@ -11,11 +11,7 @@ import subprocess from remotehost import remote_compatible import hostapd import hwsim_utils -from utils import clear_regdom, HwsimSkip - -def check_wep_capa(dev): - if "WEP40" not in dev.get_capability("group"): - raise HwsimSkip("WEP not supported") +from utils import * @remote_compatible def test_wep_open_auth(dev, apdev): diff --git a/tests/hwsim/test_wext.py b/tests/hwsim/test_wext.py index f50e1d1b7..e14eecede 100644 --- a/tests/hwsim/test_wext.py +++ b/tests/hwsim/test_wext.py @@ -13,7 +13,6 @@ import hwsim_utils from wpasupplicant import WpaSupplicant from utils import * from test_rfkill import get_rfkill -from test_wep import check_wep_capa def get_wext_interface(): if not os.path.exists("/proc/net/wireless"): diff --git a/tests/hwsim/test_wpas_ap.py b/tests/hwsim/test_wpas_ap.py index 8211b6b8d..b5b43114a 100644 --- a/tests/hwsim/test_wpas_ap.py +++ b/tests/hwsim/test_wpas_ap.py @@ -11,10 +11,9 @@ import logging logger = logging.getLogger() import hwsim_utils -from utils import HwsimSkip, alloc_fail, clear_regdom_dev +from utils import * from wpasupplicant import WpaSupplicant from test_p2p_channel import set_country -from test_wep import check_wep_capa def wait_ap_ready(dev): ev = dev.wait_event(["CTRL-EVENT-CONNECTED"]) diff --git a/tests/hwsim/utils.py b/tests/hwsim/utils.py index c901dd639..ee2f3ee12 100644 --- a/tests/hwsim/utils.py +++ b/tests/hwsim/utils.py @@ -104,6 +104,10 @@ def skip_without_tkip(dev): "TKIP" not in dev.get_capability("group"): raise HwsimSkip("Cipher TKIP not supported") +def check_wep_capa(dev): + if "WEP40" not in dev.get_capability("group"): + raise HwsimSkip("WEP not supported") + def get_phy(ap, ifname=None): phy = "phy3" try: