]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Ensure D-Bus property change notifications happen in VM
authorBenjamin Berg <benjamin.berg@intel.com>
Wed, 11 Jun 2025 08:47:24 +0000 (10:47 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 21 Jun 2025 08:36:18 +0000 (11:36 +0300)
When running in a VM (UML time-travel to be exact), it may happen that
not enough time passes and the 5 ms timeout for property notification
causes compression of events. However, some tests will check that all
property notifications were done and this compression can cause test
failures.

Work around this by simply inserting a 5 ms sleep for any signal handler
call.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Reviewed-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
tests/hwsim/test_dbus.py

index ab535a3ef01d5be0166550afea46fe797dbcaa37..ffc59a181cca7d8a3fd9e457267f25ffe22be2e5 100644 (file)
@@ -73,7 +73,13 @@ class TestDbus(object):
             s.remove()
 
     def add_signal(self, handler, interface, name, byte_arrays=False):
-        s = self.bus.add_signal_receiver(handler, dbus_interface=interface,
+        # Insert sleep to ensure WPA_DBUS_SEND_PROP_CHANGED_TIMEOUT passes
+        def int_handler(*args):
+            nonlocal handler
+            time.sleep(0.005)
+            handler(*args)
+
+        s = self.bus.add_signal_receiver(int_handler, dbus_interface=interface,
                                          signal_name=name,
                                          byte_arrays=byte_arrays)
         self.signals.append(s)