From d429d789402d98234399508bb325ca7335ef1795 Mon Sep 17 00:00:00 2001 From: Tim Kourt Date: Tue, 4 Oct 2016 16:26:37 -0700 Subject: [PATCH] auto-t: Optionally start iwd from python lib --- autotests/util/iwd.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/autotests/util/iwd.py b/autotests/util/iwd.py index 34495772..6ba62d1d 100755 --- a/autotests/util/iwd.py +++ b/autotests/util/iwd.py @@ -483,10 +483,24 @@ class IWD(AsyncOpAbstract): _agent_manager_if = None _known_network_manager_if = None - def __init__(self): + def __init__(self, start_iwd_daemon = False): global mainloop mainloop = GLib.MainLoop() + if not start_iwd_daemon: + return + + import subprocess + iwd_proc = subprocess.Popen('iwd') + + tries = 0 + while not self._bus.name_has_owner(IWD_SERVICE): + if tries > 20: + iwd_proc.terminate() + raise TimeoutError('IWD has failed to start') + tries += 1 + time.sleep(0.05) + @property def _object_manager(self): if self._object_manager_if is None: