tests: Clear regdom changes more robustly in FST test cases

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2019-01-01 11:35:22 +02:00
parent 2fa2b90aaf
commit 003716ec7b
4 changed files with 13 additions and 0 deletions

View 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"""

View 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)

View 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"""

View 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"""