From: Benjamin Berg Date: Wed, 11 Jun 2025 08:47:24 +0000 (+0200) Subject: tests: Ensure D-Bus property change notifications happen in VM X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=171820eaa8187becc5c5da63eff64e6ce4b8875b;p=thirdparty%2Fhostap.git tests: Ensure D-Bus property change notifications happen in VM 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 Reviewed-by: Andrei Otcheretianski --- diff --git a/tests/hwsim/test_dbus.py b/tests/hwsim/test_dbus.py index ab535a3ef..ffc59a181 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)