]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Move clear_scan_cache() and set_world_reg() to utils.py
authorJouni Malinen <j@w1.fi>
Sat, 18 Apr 2020 08:12:54 +0000 (11:12 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 18 Apr 2020 08:35:32 +0000 (11:35 +0300)
Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/test_ap_acs.py
tests/hwsim/test_ap_ht.py
tests/hwsim/test_ap_open.py
tests/hwsim/test_ap_vht.py
tests/hwsim/test_he.py
tests/hwsim/test_ocv.py
tests/hwsim/test_p2p_concurrency.py
tests/hwsim/test_rrm.py
tests/hwsim/test_ssid.py
tests/hwsim/test_wpas_mesh.py
tests/hwsim/utils.py

index 1833c0fd8827440672e38e69adbcffb0e59ae317..450a38fa107991ba0b7ced43a112d45ffdf7165b 100644 (file)
@@ -10,7 +10,6 @@ import time
 
 import hostapd
 from utils import *
-from test_ap_ht import clear_scan_cache
 from test_dfs import wait_dfs_event
 
 def force_prev_ap_on_24g(ap):
index c2b032c11bd5c34222ec9a6cb16214d21acf86f5..51187177b4d7dde128aca127c7220aa54e6b6ad1 100644 (file)
@@ -12,27 +12,10 @@ import struct
 
 import hostapd
 from wpasupplicant import WpaSupplicant
-from utils import HwsimSkip, alloc_fail, parse_ie, clear_regdom
+from utils import *
 import hwsim_utils
 from test_ap_csa import csa_supported
 
-def clear_scan_cache(apdev):
-    ifname = apdev['ifname']
-    hostapd.cmd_execute(apdev, ['ifconfig', ifname, 'up'])
-    hostapd.cmd_execute(apdev, ['iw', ifname, 'scan', 'trigger', 'freq', '2412',
-                                'flush'])
-    time.sleep(0.1)
-    hostapd.cmd_execute(apdev, ['ifconfig', ifname, 'down'])
-
-def set_world_reg(apdev0=None, apdev1=None, dev0=None):
-    if apdev0:
-        hostapd.cmd_execute(apdev0, ['iw', 'reg', 'set', '00'])
-    if apdev1:
-        hostapd.cmd_execute(apdev1, ['iw', 'reg', 'set', '00'])
-    if dev0:
-        dev0.cmd_execute(['iw', 'reg', 'set', '00'])
-    time.sleep(0.1)
-
 def test_ap_ht40_scan(dev, apdev):
     """HT40 co-ex scan"""
     clear_scan_cache(apdev[0])
index fd9919bb128989b309dc4bfa82af09eb34550a9a..62f22154278b09742288693ff2509d905de18337 100644 (file)
@@ -18,7 +18,6 @@ from tshark import run_tshark
 from utils import *
 from wpasupplicant import WpaSupplicant
 from wlantest import WlantestCapture
-from test_ap_ht import set_world_reg
 
 @remote_compatible
 def test_ap_open(dev, apdev):
index 338e8c806f66b0e30f9564af4560a354548b59ff..f0e2f3d618285b8ae516fb0aa8085100a744a963 100644 (file)
@@ -16,7 +16,6 @@ from wpasupplicant import WpaSupplicant
 from utils import *
 from test_dfs import wait_dfs_event
 from test_ap_csa import csa_supported
-from test_ap_ht import clear_scan_cache
 
 def test_ap_vht80(dev, apdev):
     """VHT with 80 MHz channel width"""
index 25f53e71313e98f617a7ffc6eab964213fe179af..22c9402f76a3098a61062b31ac5bc4513b6b8e30 100644 (file)
@@ -15,7 +15,6 @@ from wpasupplicant import WpaSupplicant
 from utils import *
 from test_dfs import wait_dfs_event
 from test_ap_csa import csa_supported
-from test_ap_ht import clear_scan_cache
 
 def test_he_open(dev, apdev):
     """HE AP with open mode configuration"""
index df84e7124f0259bc0d5d0260f8283d7873878a53..5456f3ba045921494665273589ea61c0ab1bae18 100644 (file)
@@ -12,9 +12,8 @@ logger = logging.getLogger()
 import hostapd
 from wpasupplicant import WpaSupplicant
 import hwsim_utils
-from utils import HwsimSkip
+from utils import *
 
-from test_ap_ht import set_world_reg
 from test_ap_psk import parse_eapol, build_eapol, pmk_to_ptk, eapol_key_mic, recv_eapol, send_eapol, reply_eapol, build_eapol_key_3_4, aes_wrap, pad_key_data
 
 #TODO: Refuse setting up AP with OCV but without MFP support
index 512886ba41dcca9c4d6e2d13505b5b90dd27f826..8fb2bb9294ab892fd47acebffa41a24f7cbccd91 100644 (file)
@@ -13,8 +13,7 @@ import time
 import hwsim_utils
 import hostapd
 from p2p_utils import *
-from test_ap_ht import clear_scan_cache
-from utils import HwsimSkip
+from utils import *
 
 @remote_compatible
 def test_concurrent_autogo(dev, apdev):
index 425edb20effb935122b969052ffc5e00e9b64a89..2b43c4c5914cd00766b0a0538307cc923106cd08 100644 (file)
@@ -17,7 +17,6 @@ import time
 import hostapd
 from wpasupplicant import WpaSupplicant
 from utils import *
-from test_ap_ht import clear_scan_cache
 from remotehost import remote_compatible
 
 def check_rrm_support(dev):
index d4ee4e37011ce84a47fdb2afcae75576bfb32282..faee75d5ff77ae5e9f4941add8a2b6ca4d659661 100644 (file)
@@ -77,7 +77,7 @@ def test_ssid_utf8(dev, apdev):
     if "[UTF-8]" not in dev[0].request("SCAN_RESULTS"):
         raise Exception("[UTF-8] flag not included in SCAN_RESULTS")
 
-def clear_scan_cache(hapd, dev):
+def clear_scan_cache2(hapd, dev):
     # clear BSS table to avoid issues in following test cases
     dev[0].request("REMOVE_NETWORK all")
     dev[1].request("REMOVE_NETWORK all")
@@ -97,7 +97,7 @@ def test_ssid_hidden(dev, apdev):
     ev = dev[1].wait_event(["CTRL-EVENT-CONNECTED"], timeout=1)
     if ev is not None:
         raise Exception("Unexpected connection")
-    clear_scan_cache(hapd, dev)
+    clear_scan_cache2(hapd, dev)
 
 @remote_compatible
 def test_ssid_hidden2(dev, apdev):
@@ -110,7 +110,7 @@ def test_ssid_hidden2(dev, apdev):
     ev = dev[1].wait_event(["CTRL-EVENT-CONNECTED"], timeout=1)
     if ev is not None:
         raise Exception("Unexpected connection")
-    clear_scan_cache(hapd, dev)
+    clear_scan_cache2(hapd, dev)
 
 @remote_compatible
 def test_ssid_hidden_wpa2(dev, apdev):
@@ -124,4 +124,4 @@ def test_ssid_hidden_wpa2(dev, apdev):
     ev = dev[1].wait_event(["CTRL-EVENT-CONNECTED"], timeout=1)
     if ev is not None:
         raise Exception("Unexpected connection")
-    clear_scan_cache(hapd, dev)
+    clear_scan_cache2(hapd, dev)
index aac49e2d009d63a217d26e5b40f74e9874a92a95..3c918184f158bd7f6919679246605fff016e2cb9 100644 (file)
@@ -18,7 +18,6 @@ import hostapd
 from wpasupplicant import WpaSupplicant
 from utils import *
 from tshark import run_tshark, run_tshark_json
-from test_ap_ht import set_world_reg
 from test_sae import build_sae_commit, sae_rx_commit_token_req
 from hwsim_utils import set_group_map
 
index 57b570c2eb8447632c01543455ac7181f6a521e2..5afa76b246acdd39be030565d483e67fc7501fcf 100644 (file)
@@ -13,6 +13,7 @@ import time
 import remotehost
 import logging
 logger = logging.getLogger()
+import hostapd
 
 def get_ifnames():
     ifnames = []
@@ -224,3 +225,20 @@ def start_monitor(ifname, freq=2412):
 def stop_monitor(ifname):
     subprocess.call(["ip", "link", "set", "dev", ifname, "down"])
     subprocess.call(["iw", ifname, "set", "type", "managed"])
+
+def clear_scan_cache(apdev):
+    ifname = apdev['ifname']
+    hostapd.cmd_execute(apdev, ['ifconfig', ifname, 'up'])
+    hostapd.cmd_execute(apdev, ['iw', ifname, 'scan', 'trigger', 'freq', '2412',
+                                'flush'])
+    time.sleep(0.1)
+    hostapd.cmd_execute(apdev, ['ifconfig', ifname, 'down'])
+
+def set_world_reg(apdev0=None, apdev1=None, dev0=None):
+    if apdev0:
+        hostapd.cmd_execute(apdev0, ['iw', 'reg', 'set', '00'])
+    if apdev1:
+        hostapd.cmd_execute(apdev1, ['iw', 'reg', 'set', '00'])
+    if dev0:
+        dev0.cmd_execute(['iw', 'reg', 'set', '00'])
+    time.sleep(0.1)