autotests: Always wait for DBus name in IWD.__init__
Sometimes iwd will take a while to register its dbus name. The python class already waits for the name to appear on dbus if iwd is being launched from python, do this also if iwd was already launched by the test-runner. My use case was when running iwd under valgrind in which case it runs slower.
This commit is contained in:
parent
0c64cc226a
commit
f5036d7e1f
|
@ -518,9 +518,7 @@ class IWD(AsyncOpAbstract):
|
||||||
global mainloop
|
global mainloop
|
||||||
mainloop = GLib.MainLoop()
|
mainloop = GLib.MainLoop()
|
||||||
|
|
||||||
if not start_iwd_daemon:
|
if start_iwd_daemon:
|
||||||
return
|
|
||||||
|
|
||||||
iwd_wiphys = [wname for wname, wiphy in wiphy.wiphy_map.items()
|
iwd_wiphys = [wname for wname, wiphy in wiphy.wiphy_map.items()
|
||||||
if any(intf for intf in wiphy.values()
|
if any(intf for intf in wiphy.values()
|
||||||
if intf.use == 'iwd')]
|
if intf.use == 'iwd')]
|
||||||
|
@ -530,16 +528,17 @@ class IWD(AsyncOpAbstract):
|
||||||
iwd_proc = subprocess.Popen(['iwd', '-c', iwd_config_dir, '-p',
|
iwd_proc = subprocess.Popen(['iwd', '-c', iwd_config_dir, '-p',
|
||||||
whitelist])
|
whitelist])
|
||||||
|
|
||||||
|
self._iwd_proc = iwd_proc
|
||||||
|
|
||||||
tries = 0
|
tries = 0
|
||||||
while not self._bus.name_has_owner(IWD_SERVICE):
|
while not self._bus.name_has_owner(IWD_SERVICE):
|
||||||
if tries > 20:
|
if tries > 100:
|
||||||
|
if start_iwd_daemon:
|
||||||
iwd_proc.terminate()
|
iwd_proc.terminate()
|
||||||
raise TimeoutError('IWD has failed to start')
|
raise TimeoutError('IWD has failed to start')
|
||||||
tries += 1
|
tries += 1
|
||||||
time.sleep(0.05)
|
time.sleep(0.05)
|
||||||
|
|
||||||
self._iwd_proc = iwd_proc
|
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
if self._iwd_proc is None:
|
if self._iwd_proc is None:
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue