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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Benjamin Berg <benjamin.berg@xxxxxxxxx>

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@xxxxxxxxx>
Reviewed-by: Andrei Otcheretianski <andrei.otcheretianski@xxxxxxxxx>
---
 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


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux