]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Avoid control interface throttling in various test cases
authorJouni Malinen <quic_jouni@quicinc.com>
Wed, 27 Mar 2024 21:26:00 +0000 (23:26 +0200)
committerJouni Malinen <j@w1.fi>
Wed, 27 Mar 2024 21:48:39 +0000 (23:48 +0200)
These can cause unexpected test failures, so dump the pending monitor
socket events more frequently in some cases where event throttling is
seen.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
tests/hwsim/test_ap_pmf.py
tests/hwsim/test_dpp3.py
tests/hwsim/test_eap_proto.py
tests/hwsim/test_radius.py
tests/hwsim/test_sigma_dut.py
tests/hwsim/test_wpas_ctrl.py

index c9f09ee0e2804f4a273dc14acbdd0dab015d5014..4b2cc5bbd1b3134186675ec0bb9f381ef099ab47 100644 (file)
@@ -1190,6 +1190,7 @@ def run_ap_pmf_inject_eap(dev, apdev, pmf=True):
                 eap_start = True
             if "CTRL-EVENT-EAP-FAILURE" in ev:
                 eap_failure = True
+        dev[0].dump_monitor(mon=False)
     dev[0].dump_monitor()
     ev = hapd.wait_event(["AP-STA-DISCONNECTED"], timeout=0.1)
     if ev:
@@ -1232,6 +1233,7 @@ def run_ap_pmf_inject_eap(dev, apdev, pmf=True):
                 eap_start = True
             if "CTRL-EVENT-EAP-FAILURE" in ev:
                 eap_failure = True
+        dev[0].dump_monitor(mon=False)
     dev[0].dump_monitor()
     ev = hapd.wait_event(["AP-STA-DISCONNECTED"], timeout=0.1)
     if ev:
index 276ec64dad161926fc2931c2d8964fc4e48a4cd0..a65a1281fc2945f7e299226be6a1ae90d09c2af9 100644 (file)
@@ -325,9 +325,11 @@ def test_dpp_push_button_unsupported_ap_conf(dev, apdev):
     if ev is None or "failed" not in ev:
         raise Exception("Push button bootstrapping did not fail on AP")
     while True:
-        ev = dev[0].wait_event(["DPP-PB-RESULT", "DPP-RX"], timeout=100)
+        ev = dev[0].wait_event(["DPP-PB-RESULT", "DPP-RX", "DPP-TX"],
+                               timeout=100)
         if ev is None:
             raise Exception("Push button result not reported on station")
+        dev[0].dump_monitor(mon=False)
         if "DPP-PB-RESULT failed" in ev:
             break
         if "type=18" in ev:
index e125481717cc0a4dc23f642ec5f5f117a70bd320..0aa292c371ca45cb8f709250d84de152710bc9ee 100644 (file)
@@ -771,6 +771,7 @@ def test_eap_proto_sake(dev, apdev):
                 raise Exception("Timeout on EAP start")
             time.sleep(0.1)
             dev[0].request("REMOVE_NETWORK all")
+            dev[0].dump_monitor()
 
         logger.info("Too short password")
         dev[0].connect("eap-test", key_mgmt="WPA-EAP", scan_freq="2412",
@@ -780,7 +781,20 @@ def test_eap_proto_sake(dev, apdev):
         ev = dev[0].wait_event(["CTRL-EVENT-EAP-PROPOSED-METHOD"], timeout=15)
         if ev is None:
             raise Exception("Timeout on EAP start")
+        start = os.times()[4]
+        while True:
+            ev = dev[0].wait_event(["CTRL-EVENT-EAP-PROPOSED-METHOD"],
+                                   timeout=0.1)
+            if ev is None:
+                break
+            now = os.times()[4]
+            if now - start > 0.1:
+                break
+            dev[0].dump_monitor()
+
+        dev[0].request("REMOVE_NETWORK all")
         time.sleep(0.1)
+        dev[0].dump_monitor()
     finally:
         stop_radius_server(srv)
 
index 20b28b84f8a5679009cd53bb94330953ee17e2e7..4ecb6599bf7abd021a69e99cc692db8cce010c9e 100644 (file)
@@ -597,6 +597,7 @@ def test_radius_das_disconnect(dev, apdev):
     ev = dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=1)
     if ev is not None:
         raise Exception("Unexpected disconnection")
+    dev[0].dump_monitor()
 
     logger.info("Disconnect-Request with mismatching NAS-IP-Address")
     req = radius_das.DisconnectPacket(dict=dict, secret=b"secret",
@@ -615,6 +616,7 @@ def test_radius_das_disconnect(dev, apdev):
     ev = dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=1)
     if ev is not None:
         raise Exception("Unexpected disconnection")
+    dev[0].dump_monitor()
 
     logger.info("Disconnect-Request with matching Acct-Session-Id")
     req = radius_das.DisconnectPacket(dict=dict, secret=b"secret",
@@ -628,6 +630,7 @@ def test_radius_das_disconnect(dev, apdev):
     hapd.wait_sta_disconnect(addr=dev[0].own_addr())
     dev[0].wait_connected(timeout=10, error="Re-connection timed out")
     hapd.wait_sta(addr=dev[0].own_addr())
+    dev[0].dump_monitor()
 
     logger.info("Disconnect-Request with matching Acct-Multi-Session-Id")
     sta = hapd.get_sta(addr)
@@ -643,6 +646,7 @@ def test_radius_das_disconnect(dev, apdev):
     hapd.wait_sta_disconnect(addr=dev[0].own_addr())
     dev[0].wait_connected(timeout=10, error="Re-connection timed out")
     hapd.wait_sta(addr=dev[0].own_addr())
+    dev[0].dump_monitor()
 
     logger.info("Disconnect-Request with matching User-Name")
     req = radius_das.DisconnectPacket(dict=dict, secret=b"secret",
@@ -655,6 +659,7 @@ def test_radius_das_disconnect(dev, apdev):
     hapd.wait_sta_disconnect(addr=dev[0].own_addr())
     dev[0].wait_connected(timeout=10, error="Re-connection timed out")
     hapd.wait_sta(addr=dev[0].own_addr())
+    dev[0].dump_monitor()
 
     logger.info("Disconnect-Request with matching Calling-Station-Id")
     req = radius_das.DisconnectPacket(dict=dict, secret=b"secret",
@@ -672,6 +677,7 @@ def test_radius_das_disconnect(dev, apdev):
         raise Exception("Unexpected skipping of EAP authentication in reconnection")
     dev[0].wait_connected(timeout=10, error="Re-connection timed out")
     hapd.wait_sta(addr=dev[0].own_addr())
+    dev[0].dump_monitor()
 
     logger.info("Disconnect-Request with matching Calling-Station-Id and non-matching CUI")
     req = radius_das.DisconnectPacket(dict=dict, secret=b"secret",
@@ -704,6 +710,7 @@ def test_radius_das_disconnect(dev, apdev):
 
     connect(dev[2], "radius-das")
     hapd.wait_sta(addr=dev[2].own_addr())
+    dev[0].dump_monitor()
 
     logger.info("Disconnect-Request with matching User-Name - multiple sessions matching")
     req = radius_das.DisconnectPacket(dict=dict, secret=b"secret",
@@ -724,6 +731,7 @@ def test_radius_das_disconnect(dev, apdev):
     hapd.wait_sta_disconnect(addr=dev[0].own_addr())
     dev[0].wait_connected(timeout=10, error="Re-connection timed out")
     hapd.wait_sta(addr=dev[0].own_addr())
+    dev[0].dump_monitor()
 
     ev = dev[2].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=1)
     if ev is not None:
@@ -748,10 +756,12 @@ def test_radius_das_disconnect(dev, apdev):
         raise Exception("Timeout on EAP start")
     dev[0].wait_connected(timeout=15)
     hapd.wait_sta(addr=dev[0].own_addr())
+    dev[0].dump_monitor()
 
     logger.info("Disconnect-Request with matching User-Name after disassociation")
     dev[0].request("DISCONNECT")
     dev[0].wait_disconnected(timeout=10)
+    dev[0].dump_monitor()
     hapd.wait_sta_disconnect(addr=dev[0].own_addr())
     dev[2].request("DISCONNECT")
     dev[2].wait_disconnected(timeout=10)
@@ -780,9 +790,11 @@ def test_radius_das_disconnect(dev, apdev):
         raise Exception("Timeout on EAP start")
     dev[0].wait_connected(timeout=15)
     hapd.wait_sta(addr=dev[0].own_addr())
+    dev[0].dump_monitor()
     dev[0].request("DISCONNECT")
     dev[0].wait_disconnected(timeout=10)
     hapd.wait_sta_disconnect(addr=dev[0].own_addr())
+    dev[0].dump_monitor()
     req = radius_das.DisconnectPacket(dict=dict, secret=b"secret",
                                       NAS_IP_Address="127.0.0.1",
                                       NAS_Identifier="nas.example.com",
index c007d213dce5abe631a6a760cdf257ce2f5bd1bc..bac450268891af866c496b5a0db91bdc99471a27 100644 (file)
@@ -788,10 +788,13 @@ def test_sigma_dut_suite_b_rsa(dev, apdev, params):
             dut.cmd_check(cmd + extra)
             dut.cmd_check("sta_associate,interface,%s,ssid,%s,channel,1" % (ifname, "test-suite-b"),
                                 timeout=10)
+            dev[0].dump_monitor()
             dut.wait_connected()
+            dev[0].dump_monitor()
             dut.cmd_check("sta_get_ip_config,interface," + ifname)
             dut.cmd_check("sta_disconnect,interface," + ifname)
             dut.cmd_check("sta_reset_default,interface," + ifname)
+            dev[0].dump_monitor()
 
 def test_sigma_dut_ap_suite_b(dev, apdev, params):
     """sigma_dut controlled AP Suite B"""
@@ -5284,7 +5287,9 @@ def test_sigma_dut_ap_beacon_prot(dev, apdev, params):
         dev[0].connect("test-psk", key_mgmt="WPA-PSK-SHA256",
                        psk="12345678", scan_freq="2412",
                        ieee80211w="2", beacon_prot="1")
-        time.sleep(1)
+        for i in range(10):
+            dev[0].dump_monitor()
+            time.sleep(0.1)
 
     valid_bip = wt.get_bss_counter('valid_bip_mmie', bssid)
     invalid_bip = wt.get_bss_counter('invalid_bip_mmie', bssid)
index e40aecda1a7e2249b2240654dc17a004381569e3..44eb004442d8a0861b34274fd6c60ef327a06fd9 100644 (file)
@@ -301,8 +301,10 @@ def test_wpas_ctrl_network_oom(dev):
 @remote_compatible
 def test_wpas_ctrl_many_networks(dev, apdev):
     """wpa_supplicant ctrl_iface LIST_NETWORKS with huge number of networks"""
-    for i in range(1000):
-        id = dev[0].add_network()
+    for i in range(999):
+        dev[0].add_network()
+        dev[0].dump_monitor()
+    id = dev[0].add_network()
     ev = dev[0].wait_event(["CTRL-EVENT-NETWORK-ADDED %d" % id])
     if ev is None:
         raise Exception("Network added event not seen for the last network")
@@ -320,12 +322,24 @@ def test_wpas_ctrl_many_networks(dev, apdev):
     # power CPU, so increase the command timeout significantly to avoid issues
     # with the test case failing and following reset operation timing out.
     dev[0].request("REMOVE_NETWORK all", timeout=60)
-    ev = dev[0].wait_event(["CTRL-EVENT-NETWORK-REMOVED %d" % id])
-    if ev is None:
-        raise Exception("Network removed event not seen for the last network")
-    ev = dev[0].wait_global_event(["CTRL-EVENT-NETWORK-REMOVED %d" % id], timeout=10)
-    if ev is None:
-        raise Exception("Network removed event (global) not seen for the last network")
+    seen = seen_global = False
+
+    for i in range(1000):
+        ev = dev[0].wait_event(["CTRL-EVENT-NETWORK-REMOVED"])
+        if ev is None:
+            raise Exception("Network removed event not seen for the last network")
+        if str(id) in ev:
+            seen = True
+        ev = dev[0].wait_global_event(["CTRL-EVENT-NETWORK-REMOVED"],
+                                      timeout=10)
+        if ev is None:
+            raise Exception("Network removed event (global) not seen for the last network")
+        if str(id) in ev:
+            seen_global = True
+    if not seen:
+            raise Exception("Network removed event not seen for the last network")
+    if not seen_global:
+            raise Exception("Network removed event (global) not seen for the last network")
     dev[0].dump_monitor()
 
 @remote_compatible