[PATCH 2/7] tests: Ensure property change notifications happen in VM

Benjamin Berg benjamin at sipsolutions.net
Wed Jun 11 01:47:24 PDT 2025


From: Benjamin Berg <benjamin.berg at intel.com>

When running in a VM (UML time-travel to be exact), it may happen that
not enough time passes and the 5ms 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 at intel.com>
Reviewed-by: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
---
 tests/hwsim/test_dbus.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tests/hwsim/test_dbus.py b/tests/hwsim/test_dbus.py
index ab535a3ef0..ffc59a181c 100644
--- a/tests/hwsim/test_dbus.py
+++ b/tests/hwsim/test_dbus.py
@@ -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)
-- 
2.49.0




More information about the Hostap mailing list