From 55ef04672832b47a89978b43dfbe322ec778a3ab Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Fri, 6 Dec 2019 11:36:13 +0100 Subject: [PATCH] dist/testrunner: make interactive test retries/delay configurable --- dist/pythonlibs/testrunner/spawn.py | 10 ++++++++-- dist/pythonlibs/testrunner/utils.py | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/dist/pythonlibs/testrunner/spawn.py b/dist/pythonlibs/testrunner/spawn.py index ea80951c05..cbca3bb6d7 100644 --- a/dist/pythonlibs/testrunner/spawn.py +++ b/dist/pythonlibs/testrunner/spawn.py @@ -24,6 +24,10 @@ RIOTBASE = (os.environ.get('RIOTBASE') or # default value (3) MAKE_TERM_STARTED_DELAY = int(os.environ.get('TESTRUNNER_START_DELAY') or 3) +# Allow customizing test interactive settings with environment variables +TEST_INTERACTIVE_RETRIES = int(os.environ.get('TEST_INTERACTIVE_RETRIES') or 5) +TEST_INTERACTIVE_DELAY = int(os.environ.get('TEST_INTERACTIVE_DELAY') or 1) + def list_until(l, cond): return l[:([i for i, e in enumerate(l) if cond(e)][0])] @@ -79,8 +83,10 @@ def sync_child(child): _test_utils_interactive_sync(child, modules) -def _test_utils_interactive_sync(child, modules, retries=5, delay=1): +def _test_utils_interactive_sync(child, modules): if 'test_utils_interactive_sync' not in modules: return - utils.test_utils_interactive_sync(child, retries=retries, delay=delay) + utils.test_utils_interactive_sync(child, + TEST_INTERACTIVE_RETRIES, + TEST_INTERACTIVE_DELAY) diff --git a/dist/pythonlibs/testrunner/utils.py b/dist/pythonlibs/testrunner/utils.py index faee374235..94a9091aeb 100644 --- a/dist/pythonlibs/testrunner/utils.py +++ b/dist/pythonlibs/testrunner/utils.py @@ -9,7 +9,7 @@ import pexpect -def test_utils_interactive_sync(child, retries=5, delay=1): +def test_utils_interactive_sync(child, retries, delay): """Synchronisation for 'test_utils_interactive_sync' function. Interacts through input to wait for node being ready.