3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 21:22:37 +01:00

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:
Andrew Zaborowski 2017-04-26 02:31:39 +02:00 committed by Denis Kenzior
parent 0c64cc226a
commit f5036d7e1f

View File

@ -518,28 +518,27 @@ class IWD(AsyncOpAbstract):
global mainloop
mainloop = GLib.MainLoop()
if not start_iwd_daemon:
return
if start_iwd_daemon:
iwd_wiphys = [wname for wname, wiphy in wiphy.wiphy_map.items()
if any(intf for intf in wiphy.values()
if intf.use == 'iwd')]
whitelist = ','.join(iwd_wiphys)
iwd_wiphys = [wname for wname, wiphy in wiphy.wiphy_map.items()
if any(intf for intf in wiphy.values()
if intf.use == 'iwd')]
whitelist = ','.join(iwd_wiphys)
import subprocess
iwd_proc = subprocess.Popen(['iwd', '-c', iwd_config_dir, '-p',
whitelist])
import subprocess
iwd_proc = subprocess.Popen(['iwd', '-c', iwd_config_dir, '-p',
whitelist])
self._iwd_proc = iwd_proc
tries = 0
while not self._bus.name_has_owner(IWD_SERVICE):
if tries > 20:
iwd_proc.terminate()
if tries > 100:
if start_iwd_daemon:
iwd_proc.terminate()
raise TimeoutError('IWD has failed to start')
tries += 1
time.sleep(0.05)
self._iwd_proc = iwd_proc
def __del__(self):
if self._iwd_proc is None:
return