diff mbox series

test: dbus: wait for connection before disconnect

Message ID 20240128205908.5b51ffda69eb.I583b6dd829d1572c91bb0683042f21f8dcc684d9@changeid
State Accepted
Headers show
Series test: dbus: wait for connection before disconnect | expand

Commit Message

Johannes Berg Jan. 28, 2024, 7:59 p.m. UTC
From: Johannes Berg <johannes.berg@intel.com>

The test here wants to connect and then disconnect again,
but it's driven only by the GO side, so the client may end
up (with UML time-travel) not fully connecting, and then
it all fails. Wait for the client to have connected first.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 tests/hwsim/test_dbus.py | 3 +++
 1 file changed, 3 insertions(+)

Comments

Jouni Malinen Jan. 29, 2024, 5:08 p.m. UTC | #1
On Sun, Jan 28, 2024 at 08:59:09PM +0100, Johannes Berg wrote:
> The test here wants to connect and then disconnect again,
> but it's driven only by the GO side, so the client may end
> up (with UML time-travel) not fully connecting, and then
> it all fails. Wait for the client to have connected first.

Thanks, applied. Though, I replaced the direct reference to dev[1]
within the TestDbusP2P class with a separate control interface
connection that gets explicitly cleared in the end to avoid some issues
with DBus test cases and cleaning up the control interfaces. I've never
figured out what exactly is happening there, but in any case, it causes
issues and leaves behind client sockets for the control interface.
diff mbox series

Patch

diff --git a/tests/hwsim/test_dbus.py b/tests/hwsim/test_dbus.py
index 4dee2277bd78..324207894013 100644
--- a/tests/hwsim/test_dbus.py
+++ b/tests/hwsim/test_dbus.py
@@ -3993,6 +3993,9 @@  def test_dbus_p2p_autogo_pbc(dev, apdev):
 
         def staAuthorized(self, name):
             logger.debug("staAuthorized: " + name)
+            # wait for client to be fully connected
+            dev[1].wait_connected()
+            # so we can cleanly disconnect it now
             group_p2p = dbus.Interface(self.g_if_obj,
                                        WPAS_DBUS_IFACE_P2PDEVICE)
             group_p2p.Disconnect()