diff mbox series

test: dbus: wait for connection before disconnect (again)

Message ID 20240130172128.576da042d53b.I6d380cae385148f008d79ce0a41f51e91a62eb97@changeid
State Accepted
Headers show
Series test: dbus: wait for connection before disconnect (again) | expand

Commit Message

Johannes Berg Jan. 30, 2024, 4:21 p.m. UTC
From: Johannes Berg <johannes.berg@intel.com>

The same thing as we did previously in dbus_p2p_autogo_pbc
can evidently also happen in dbus_p2p_autogo.

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 | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Jouni Malinen Jan. 31, 2024, 10:56 a.m. UTC | #1
On Tue, Jan 30, 2024 at 05:21:29PM +0100, Johannes Berg wrote:
> The same thing as we did previously in dbus_p2p_autogo_pbc
> can evidently also happen in dbus_p2p_autogo.
> 
> 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.
diff mbox series

Patch

diff --git a/tests/hwsim/test_dbus.py b/tests/hwsim/test_dbus.py
index c16f59d53f59..461667011f6d 100644
--- a/tests/hwsim/test_dbus.py
+++ b/tests/hwsim/test_dbus.py
@@ -3684,6 +3684,7 @@  def test_dbus_p2p_autogo(dev, apdev):
             self.exceptions = False
             self.deauthorized = False
             self.done = False
+            self.dev1 = WpaSupplicant('wlan1', '/tmp/wpas-wlan1')
 
         def __enter__(self):
             gobject.timeout_add(1, self.run_test)
@@ -3737,8 +3738,7 @@  def test_dbus_p2p_autogo(dev, apdev):
                                            WPAS_DBUS_IFACE_P2PDEVICE)
                 group_p2p.Disconnect()
             else:
-                dev1 = WpaSupplicant('wlan1', '/tmp/wpas-wlan1')
-                dev1.global_request("P2P_CONNECT " + addr0 + " 12345670 join")
+                self.dev1.global_request("P2P_CONNECT " + addr0 + " 12345670 join")
 
         def groupFinished(self, properties):
             logger.debug("groupFinished: " + str(properties))
@@ -3902,6 +3902,10 @@  def test_dbus_p2p_autogo(dev, apdev):
             p2p.RemoveClient({'peer': self.peer_path})
 
             self.waiting_end = True
+
+            # wait for client to be fully connected
+            self.dev1.wait_connected()
+            # so we can cleanly disconnect it now
             group_p2p = dbus.Interface(self.g_if_obj,
                                        WPAS_DBUS_IFACE_P2PDEVICE)
             group_p2p.Disconnect()