]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Clear regdom changes more robustly in FST test cases
authorJouni Malinen <j@w1.fi>
Tue, 1 Jan 2019 09:35:22 +0000 (11:35 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 1 Jan 2019 09:35:43 +0000 (11:35 +0200)
Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/fst_module_aux.py
tests/hwsim/fst_test_common.py
tests/hwsim/test_fst_config.py
tests/hwsim/test_fst_module.py

index fa6078871db76268395f08be5b87d5baa8238f44..9fd838fd5a634a1d379ff385fbfe54b251e0b890 100644 (file)
@@ -101,6 +101,7 @@ def stop_two_ap_sta_pairs(ap1, ap2, sta1, sta2):
     sta2.stop()
     ap1.stop()
     ap2.stop()
+    fst_test_common.fst_clear_regdom()
 
 def connect_two_ap_sta_pairs(ap1, ap2, dev1, dev2, rsn=False):
     """Connects a pair of stations, each one to a separate AP"""
index 22d0ff6e97d1460e93f90769207ac9591ec0f705..c0255ce31916614f9ba9dbdaecf5ad1c66b900bd 100644 (file)
@@ -5,6 +5,7 @@
 # See README for more details.
 
 import subprocess
+import time
 import logging
 
 import hostapd
@@ -86,3 +87,11 @@ class HapdRegCtrl:
             raise Exception("Cannot restore regulatory domain")
 
         logger.debug("fst hostapd: regulatory domain ready")
+
+def fst_clear_regdom():
+    cmd = subprocess.Popen([ "iw", "reg", "get" ], stdout=subprocess.PIPE)
+    res = cmd.stdout.read()
+    cmd.stdout.close()
+    if "country 00:" not in res:
+        subprocess.call(['iw', 'reg', 'set', '00'])
+        time.sleep(0.1)
index 03287b23869187040a45c0d00cac5e0a0af1c0e5..9244740cd76829b43b943ed0fadc0e17e17fc63b 100644 (file)
@@ -219,6 +219,7 @@ class FstLauncher:
         while len(self.cfgs_to_run) != 0:
             cfg = self.cfgs_to_run[0]
             self.remove_cfg(cfg)
+        fst_test_common.fst_clear_regdom()
 
     def kill_pid(self, pidfile, try_again=False):
         """Kills process by PID file"""
index 0d6f552eed9202db522e2c06479ae06ced181c05..4e182b97efa401135e6cb5fb69305828deb0cabc 100644 (file)
@@ -1523,6 +1523,7 @@ def test_fst_ap_start_session_oom(dev, apdev, test_params):
         run_fst_ap_start_session_oom(apdev, ap1)
     finally:
         ap1.stop()
+        fst_test_common.fst_clear_regdom()
 
 def run_fst_ap_start_session_oom(apdev, ap1):
     with alloc_fail(ap1, 1, "fst_iface_create"):
@@ -2137,6 +2138,7 @@ def test_fst_ap_config_oom(dev, apdev, test_params):
         # This is allowed to complete currently
 
     ap1.stop()
+    fst_test_common.fst_clear_regdom()
 
 def test_fst_send_oom(dev, apdev, test_params):
     """FST send action OOM"""