From e889452dde912e2d258cb744cae42271568e2e77 Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Mon, 2 Apr 2018 10:14:03 -0700 Subject: [PATCH] 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. --- autotests/util/iwd.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/autotests/util/iwd.py b/autotests/util/iwd.py index 46aa1b69..4958373a 100755 --- a/autotests/util/iwd.py +++ b/autotests/util/iwd.py @@ -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')