aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2017-11-26 11:27:25 (GMT)
committerJouni Malinen <j@w1.fi>2017-11-26 11:27:25 (GMT)
commitb9e8f920a8e232d8ccecc25e398468e7081b5beb (patch)
treee460ad19d6fd14aec63d874f4bc761e1cd989261
parent32452fd2aaa85f34cd11ece69fe5b422ebcbbc0d (diff)
downloadhostap-b9e8f920a8e232d8ccecc25e398468e7081b5beb.zip
hostap-b9e8f920a8e232d8ccecc25e398468e7081b5beb.tar.gz
hostap-b9e8f920a8e232d8ccecc25e398468e7081b5beb.tar.bz2
tests: Split ap_vht160 into two test cases (ap_vht160 and ap_vht160b)
These VHT160 with DFS cases were in a single test case to optimize test execution time with parallel wait for the 60 second CAC. However, this design has become difficult to support with the kernel changes that allow radar events to be shared between interfaces. To avoid need for more workarounds here just for testing purposes, split this into two test cases so that conflicting events from another interface do not cause the test case to fail. Signed-off-by: Jouni Malinen <j@w1.fi>
-rw-r--r--tests/hwsim/test_ap_vht.py91
1 files changed, 55 insertions, 36 deletions
diff --git a/tests/hwsim/test_ap_vht.py b/tests/hwsim/test_ap_vht.py
index 41fade3..a752592 100644
--- a/tests/hwsim/test_ap_vht.py
+++ b/tests/hwsim/test_ap_vht.py
@@ -308,10 +308,9 @@ def test_ap_vht_capab_not_supported(dev, apdev):
subprocess.call(['iw', 'reg', 'set', '00'])
def test_ap_vht160(dev, apdev):
- """VHT with 160 MHz channel width"""
+ """VHT with 160 MHz channel width (1)"""
try:
hapd = None
- hapd2 = None
params = { "ssid": "vht",
"country_code": "FI",
"hw_mode": "a",
@@ -338,7 +337,47 @@ def test_ap_vht160(dev, apdev):
raise HwsimSkip("CRDA or wireless-regdb did not support 160 MHz")
raise Exception("Unexpected interface state: " + state)
- params = { "ssid": "vht2",
+ logger.info("Waiting for CAC to complete")
+
+ ev = wait_dfs_event(hapd, "DFS-CAC-COMPLETED", 70)
+ if "success=1" not in ev:
+ raise Exception("CAC failed")
+ if "freq=5180" not in ev:
+ raise Exception("Unexpected DFS freq result")
+
+ ev = hapd.wait_event(["AP-ENABLED"], timeout=5)
+ if not ev:
+ raise Exception("AP setup timed out")
+
+ state = hapd.get_status_field("state")
+ if state != "ENABLED":
+ raise Exception("Unexpected interface state")
+
+ dev[0].connect("vht", key_mgmt="NONE", scan_freq="5180")
+ hwsim_utils.test_connectivity(dev[0], hapd)
+ sig = dev[0].request("SIGNAL_POLL").splitlines()
+ if "FREQUENCY=5180" not in sig:
+ raise Exception("Unexpected SIGNAL_POLL value(1): " + str(sig))
+ if "WIDTH=160 MHz" not in sig:
+ raise Exception("Unexpected SIGNAL_POLL value(2): " + str(sig))
+ except Exception, e:
+ if isinstance(e, Exception) and str(e) == "AP startup failed":
+ if not vht_supported():
+ raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
+ raise
+ finally:
+ dev[0].request("DISCONNECT")
+ if hapd:
+ hapd.request("DISABLE")
+ subprocess.call(['iw', 'reg', 'set', '00'])
+ dev[0].flush_scan_cache()
+
+def test_ap_vht160b(dev, apdev):
+ """VHT with 160 MHz channel width (2)"""
+ try:
+ hapd = None
+
+ params = { "ssid": "vht",
"country_code": "FI",
"hw_mode": "a",
"channel": "104",
@@ -349,60 +388,44 @@ def test_ap_vht160(dev, apdev):
"vht_oper_centr_freq_seg0_idx": "114",
'ieee80211d': '1',
'ieee80211h': '1' }
- hapd2 = hostapd.add_ap(apdev[1], params, wait_enabled=False)
+ hapd = hostapd.add_ap(apdev[1], params, wait_enabled=False)
- ev = wait_dfs_event(hapd2, "DFS-CAC-START", 5)
+ ev = wait_dfs_event(hapd, "DFS-CAC-START", 5)
if "DFS-CAC-START" not in ev:
raise Exception("Unexpected DFS event(2)")
- state = hapd2.get_status_field("state")
+ state = hapd.get_status_field("state")
if state != "DFS":
- raise Exception("Unexpected interface state(2): " + state)
+ if state == "DISABLED" and not os.path.exists("dfs"):
+ # Not all systems have recent enough CRDA version and
+ # wireless-regdb changes to support 160 MHz and DFS. For now,
+ # do not report failures for this test case.
+ raise HwsimSkip("CRDA or wireless-regdb did not support 160 MHz")
+ raise Exception("Unexpected interface state: " + state)
logger.info("Waiting for CAC to complete")
ev = wait_dfs_event(hapd, "DFS-CAC-COMPLETED", 70)
if "success=1" not in ev:
- raise Exception("CAC failed")
- if "freq=5180" not in ev:
- raise Exception("Unexpected DFS freq result")
-
- ev = hapd.wait_event(["AP-ENABLED"], timeout=5)
- if not ev:
- raise Exception("AP setup timed out")
-
- state = hapd.get_status_field("state")
- if state != "ENABLED":
- raise Exception("Unexpected interface state")
-
- ev = wait_dfs_event(hapd2, "DFS-CAC-COMPLETED", 70)
- if "success=1" not in ev:
raise Exception("CAC failed(2)")
if "freq=5520" not in ev:
raise Exception("Unexpected DFS freq result(2)")
- ev = hapd2.wait_event(["AP-ENABLED"], timeout=5)
+ ev = hapd.wait_event(["AP-ENABLED"], timeout=5)
if not ev:
raise Exception("AP setup timed out(2)")
- state = hapd2.get_status_field("state")
+ state = hapd.get_status_field("state")
if state != "ENABLED":
raise Exception("Unexpected interface state(2)")
- freq = hapd2.get_status_field("freq")
+ freq = hapd.get_status_field("freq")
if freq != "5520":
raise Exception("Unexpected frequency(2)")
- dev[0].connect("vht", key_mgmt="NONE", scan_freq="5180")
+ dev[0].connect("vht", key_mgmt="NONE", scan_freq="5520")
hwsim_utils.test_connectivity(dev[0], hapd)
sig = dev[0].request("SIGNAL_POLL").splitlines()
- if "FREQUENCY=5180" not in sig:
- raise Exception("Unexpected SIGNAL_POLL value(1): " + str(sig))
- if "WIDTH=160 MHz" not in sig:
- raise Exception("Unexpected SIGNAL_POLL value(2): " + str(sig))
- dev[1].connect("vht2", key_mgmt="NONE", scan_freq="5520")
- hwsim_utils.test_connectivity(dev[1], hapd2)
- sig = dev[1].request("SIGNAL_POLL").splitlines()
if "FREQUENCY=5520" not in sig:
raise Exception("Unexpected SIGNAL_POLL value(1): " + str(sig))
if "WIDTH=160 MHz" not in sig:
@@ -414,14 +437,10 @@ def test_ap_vht160(dev, apdev):
raise
finally:
dev[0].request("DISCONNECT")
- dev[1].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
- if hapd2:
- hapd2.request("DISABLE")
subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
- dev[1].flush_scan_cache()
def test_ap_vht160_no_dfs_100_plus(dev, apdev):
"""VHT with 160 MHz channel width and no DFS (100 plus)"""