From e8031bab2a3058a59515b1b57a5ef7f194aaca43 Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Thu, 17 Dec 2020 11:36:06 -0800 Subject: [PATCH] test-runner: add wait_for_dbus_service Common API to wait for a DBus service to appear on the bus --- tools/test-runner | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/test-runner b/tools/test-runner index bc580a41..d16c8885 100755 --- a/tools/test-runner +++ b/tools/test-runner @@ -616,6 +616,15 @@ class Namespace: return False + def wait_for_dbus_service(self, service): + tries = 0 + + while not self._bus.name_has_owner(service): + if tries > 200: + raise TimeoutError('DBus service %s did not appear', service) + tries += 1 + sleep(0.1) + def __str__(self): ret = 'Namespace: %s\n' % self.name ret += 'Processes:\n'