aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2018-12-29 15:01:01 (GMT)
committerJouni Malinen <j@w1.fi>2018-12-29 15:02:54 (GMT)
commitcd803b6ccd9d120347246f70293cd25c7cca406e (patch)
tree7299c7e9ff3a65918f0c3ff5ad6f4600f14410c7 /tests
parent90eb910ef540a1418b95a391534899344ebd6bd3 (diff)
downloadhostap-cd803b6ccd9d120347246f70293cd25c7cca406e.zip
hostap-cd803b6ccd9d120347246f70293cd25c7cca406e.tar.gz
hostap-cd803b6ccd9d120347246f70293cd25c7cca406e.tar.bz2
tests: Clear regulatory Beacon hints more robustly in TDLS test cases
The ap_open_tdls_vht* test cases could leave some pending regulatory Beacon hints waiting to be cleared during the following test case. This would result in a failure if the following test case expected specific regdom event behavior. For example, this caused "ap_open_tdls_vht160 dbus_country" sequence to result in failure in dbus_country. Fix this by using more robust sequence in clearing regdom state at the end of the TDLS test cases that have the AP advertising a country code. Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'tests')
-rw-r--r--tests/hwsim/test_ap_tdls.py48
1 files changed, 20 insertions, 28 deletions
diff --git a/tests/hwsim/test_ap_tdls.py b/tests/hwsim/test_ap_tdls.py
index 3afa4a8..2d1fc2c 100644
--- a/tests/hwsim/test_ap_tdls.py
+++ b/tests/hwsim/test_ap_tdls.py
@@ -359,6 +359,22 @@ def test_ap_wpa2_tdls_responder_teardown(dev, apdev):
setup_tdls(dev[0], dev[1], hapd)
teardown_tdls(dev[0], dev[1], hapd, responder=True)
+def tdls_clear_reg(hapd, dev):
+ if hapd:
+ hapd.request("DISABLE")
+ dev[0].request("DISCONNECT")
+ dev[0].request("ABORT_SCAN")
+ dev[1].request("DISCONNECT")
+ dev[1].request("ABORT_SCAN")
+ dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.5)
+ dev[0].dump_monitor()
+ dev[1].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.5)
+ dev[1].dump_monitor()
+ subprocess.call(['iw', 'reg', 'set', '00'])
+ dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=0.5)
+ dev[0].flush_scan_cache()
+ dev[1].flush_scan_cache()
+
def test_ap_open_tdls_vht(dev, apdev):
"""Open AP and two stations using TDLS"""
params = { "ssid": "test-open",
@@ -381,13 +397,7 @@ def test_ap_open_tdls_vht(dev, apdev):
setup_tdls(dev[1], dev[0], hapd)
teardown_tdls(dev[1], dev[0], hapd, wildcard=True)
finally:
- dev[0].request("DISCONNECT")
- dev[1].request("DISCONNECT")
- if hapd:
- hapd.request("DISABLE")
- subprocess.call(['iw', 'reg', 'set', '00'])
- dev[0].flush_scan_cache()
- dev[1].flush_scan_cache()
+ tdls_clear_reg(hapd, dev)
def test_ap_open_tdls_vht80(dev, apdev):
"""Open AP and two stations using TDLS with VHT 80"""
@@ -424,13 +434,7 @@ def test_ap_open_tdls_vht80(dev, apdev):
raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
raise
finally:
- dev[0].request("DISCONNECT")
- dev[1].request("DISCONNECT")
- if hapd:
- hapd.request("DISABLE")
- subprocess.call(['iw', 'reg', 'set', '00'])
- dev[0].flush_scan_cache()
- dev[1].flush_scan_cache()
+ tdls_clear_reg(hapd, dev)
def test_ap_open_tdls_vht80plus80(dev, apdev):
"""Open AP and two stations using TDLS with VHT 80+80"""
@@ -474,13 +478,7 @@ def test_ap_open_tdls_vht80plus80(dev, apdev):
raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
raise
finally:
- dev[0].request("DISCONNECT")
- dev[1].request("DISCONNECT")
- if hapd:
- hapd.request("DISABLE")
- subprocess.call(['iw', 'reg', 'set', '00'])
- dev[0].flush_scan_cache()
- dev[1].flush_scan_cache()
+ tdls_clear_reg(hapd, dev)
def test_ap_open_tdls_vht160(dev, apdev):
"""Open AP and two stations using TDLS with VHT 160"""
@@ -524,13 +522,7 @@ def test_ap_open_tdls_vht160(dev, apdev):
raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
raise
finally:
- dev[0].request("DISCONNECT")
- dev[1].request("DISCONNECT")
- if hapd:
- hapd.request("DISABLE")
- subprocess.call(['iw', 'reg', 'set', '00'])
- dev[0].flush_scan_cache()
- dev[1].flush_scan_cache()
+ tdls_clear_reg(hapd, dev)
def test_tdls_chan_switch(dev, apdev):
"""Open AP and two stations using TDLS"""