]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Make dfs_etsi more robust
authorJouni Malinen <quic_jouni@quicinc.com>
Fri, 26 Jan 2024 10:00:24 +0000 (12:00 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 26 Jan 2024 10:00:24 +0000 (12:00 +0200)
Explicitly wait for the STA to complete connection or channel switch
processing before running the second connectivity check.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
tests/hwsim/test_dfs.py

index c8506b5ebb9eb1614fc44362761318ba1a4e62a4..d0bae5a66ac4ba42f653d612bc502cd0222ca514 100644 (file)
@@ -160,10 +160,17 @@ def test_dfs_etsi(dev, apdev):
         if freq != "5260":
             raise Exception("Unexpected frequency")
 
+        hapd.dump_monitor()
+        dev[0].dump_monitor()
+
         dev[0].connect("dfs", key_mgmt="NONE")
         dev[0].wait_regdom(country_ie=True)
+        time.sleep(1)
         hwsim_utils.test_connectivity(dev[0], hapd)
 
+        hapd.dump_monitor()
+        dev[0].dump_monitor()
+
         hapd.request("RADAR DETECTED freq=%s ht_enabled=1 chan_width=1" % freq)
         ev = hapd.wait_event(["DFS-RADAR-DETECTED"], timeout=5)
         if ev is None:
@@ -181,6 +188,7 @@ def test_dfs_etsi(dev, apdev):
             raise Exception("AP-CSA-FINISHED or DFS-CAC-START event not reported")
         if "DFS-CAC-START" in ev:
             # The selected new channel requires CAC
+            dev[0].wait_disconnected()
             ev = wait_dfs_event(hapd, "DFS-CAC-COMPLETED", 70)
             if "success=1" not in ev:
                 raise Exception("CAC failed")
@@ -191,11 +199,19 @@ def test_dfs_etsi(dev, apdev):
             ev = hapd.wait_event(["AP-STA-CONNECTED"], timeout=30)
             if not ev:
                 raise Exception("STA did not reconnect on new DFS channel")
+            dev[0].wait_connected()
         else:
             # The new channel did not require CAC - try again
             if "freq=%s" % freq in ev:
                 raise Exception("Channel did not change after radar was detected(2)")
+            ev = dev[0].wait_event(["CTRL-EVENT-CHANNEL-SWITCH"], timeout=10)
+            if ev is None:
+                raise Exception("Channel switch not reported on STA")
             time.sleep(1)
+
+        hapd.dump_monitor()
+        dev[0].dump_monitor()
+        time.sleep(1)
         hwsim_utils.test_connectivity(dev[0], hapd)
     finally:
         clear_regdom(hapd, dev)