From 1bacafce4e84f7a0ddab953dcadd9116e75c49d8 Mon Sep 17 00:00:00 2001
From: Jouni Malinen <j@w1.fi>
Date: Sat, 23 Dec 2023 16:44:30 +0200
Subject: [PATCH] tests: Enable full testing for ACS with VHT160

This is now supported in hostapd, so drop the option to fail to start
the AP.

Signed-off-by: Jouni Malinen <j@w1.fi>
---
 tests/hwsim/test_ap_acs.py | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/tests/hwsim/test_ap_acs.py b/tests/hwsim/test_ap_acs.py
index 0bfb45035..ecf3b3f8b 100644
--- a/tests/hwsim/test_ap_acs.py
+++ b/tests/hwsim/test_ap_acs.py
@@ -354,6 +354,7 @@ def test_ap_acs_vht160(dev, apdev):
         params['hw_mode'] = 'a'
         params['channel'] = '0'
         params['ht_capab'] = '[HT40+]'
+        params["vht_capab"] = "[VHT160]"
         params['country_code'] = 'ZA'
         params['ieee80211ac'] = '1'
         params['vht_oper_chwidth'] = '2'
@@ -361,18 +362,20 @@ def test_ap_acs_vht160(dev, apdev):
         params['ieee80211h'] = '1'
         params['chanlist'] = '100'
         params['acs_num_scans'] = '1'
-        hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False)
-        ev = hapd.wait_event(["AP-ENABLED", "AP-DISABLED"], timeout=10)
-        if not ev:
-            raise Exception("ACS start timed out")
-        # VHT160 is not currently supported in hostapd ACS, so do not try to
-        # enforce successful AP start.
-        if "AP-ENABLED" in ev:
-            freq = hapd.get_status_field("freq")
-            if int(freq) < 5000:
-                raise Exception("Unexpected frequency")
-            dev[0].connect("test-acs", psk="12345678", scan_freq=freq)
-            dev[0].wait_regdom(country_ie=True)
+        hapd = hostapd.add_ap(apdev[0], params)
+        freq = hapd.get_status_field("freq")
+        if int(freq) < 5000:
+            raise Exception("Unexpected frequency")
+        dev[0].connect("test-acs", psk="12345678", scan_freq=freq)
+        dev[0].wait_regdom(country_ie=True)
+        hapd.wait_sta()
+        sig = dev[0].request("SIGNAL_POLL").splitlines()
+        logger.info("SIGNAL_POLL: " + str(sig))
+        if "WIDTH=160 MHz" not in sig:
+            raise Exception("Station did not report 160 MHz bandwidth")
+        dev[0].request("DISCONNECT")
+        dev[0].wait_disconnected()
+        hapd.wait_sta_disconnect()
     finally:
         clear_regdom(hapd, dev)