@@ -2,6 +2,7 @@
import unittest
import sys
+import dbus
sys.path.append('../util')
import iwd
@@ -56,11 +57,26 @@ class Test(unittest.TestCase):
IWD.clear_storage()
def test_connection_with_other_agent(self):
+ def wait_for_service_pid(pid):
+ dbus_object = ctx._bus.get_object('org.freedesktop.DBus',
+ '/org/freedesktop/DBus')
+ dbus_iface = dbus.Interface(dbus_object, 'org.freedesktop.DBus')
+
+ services = dbus_iface.ListNames()
+
+ for service in services:
+ bus_iface = dbus.Interface(dbus_object, "org.freedesktop.DBus")
+ if pid == int(bus_iface.GetConnectionUnixProcessID(service)):
+ return True
+
+ return False
+
wd = IWD()
iwctl = ctx.start_process(['iwctl', '-P', 'secret_ssid2'])
+
# Let iwctl to start and register its agent.
- wd.wait(2)
+ ctx.non_block_wait(wait_for_service_pid, 10, iwctl.pid)
self.check_connection(wd, 'ssid2')