3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-25 08:02:38 +01:00

auto-t: disable timeouts in IWD class when debugging

If --gdb is used with test-runner, all the timeouts in the
IWD class must be turned off otherwise the test will fail.
Inside test-runner, a environment variable (IWD_TEST_TIMEOUTS)
is set to either 'on' or 'off'. Then the IWD class (and any
others) can handle the timeouts accordingly. Note that this
does not turn off dbus timeouts, rather it ignores timeout
failures. This does mean that ultimately the test will most
likely fail due to a dbus timeout, but it at least gives you
unlimited debugging time.
This commit is contained in:
James Prestwood 2018-04-02 10:14:03 -07:00 committed by Denis Kenzior
parent 461b39f206
commit e889452dde

View File

@ -590,11 +590,12 @@ class IWD(AsyncOpAbstract):
tries = 0 tries = 0
while not self._bus.name_has_owner(IWD_SERVICE): while not self._bus.name_has_owner(IWD_SERVICE):
if tries > 100: if os.environ['IWD_TEST_TIMEOUTS'] == 'on':
if start_iwd_daemon: if tries > 100:
iwd_proc.terminate() if start_iwd_daemon:
raise TimeoutError('IWD has failed to start') iwd_proc.terminate()
tries += 1 raise TimeoutError('IWD has failed to start')
tries += 1
time.sleep(0.05) time.sleep(0.05)
def __del__(self): def __del__(self):
@ -641,7 +642,7 @@ class IWD(AsyncOpAbstract):
context = mainloop.get_context() context = mainloop.get_context()
while not eval(condition_str): while not eval(condition_str):
context.iteration(may_block=True) context.iteration(may_block=True)
if self._wait_timed_out: if self._wait_timed_out and os.environ['IWD_TEST_TIMEOUTS'] == 'on':
raise TimeoutError('[' + condition_str + ']'\ raise TimeoutError('[' + condition_str + ']'\
' condition was not met in '\ ' condition was not met in '\
+ str(max_wait) + ' sec') + str(max_wait) + ' sec')