3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-23 06:02: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 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()
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() import subprocess
if any(intf for intf in wiphy.values() iwd_proc = subprocess.Popen(['iwd', '-c', iwd_config_dir, '-p',
if intf.use == 'iwd')] whitelist])
whitelist = ','.join(iwd_wiphys)
import subprocess self._iwd_proc = iwd_proc
iwd_proc = subprocess.Popen(['iwd', '-c', iwd_config_dir, '-p',
whitelist])
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:
iwd_proc.terminate() if start_iwd_daemon:
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