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
1 changed files with 7 additions and 6 deletions

View File

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