dist/testrunner: add optional delay before opening serial

This option is null by default but is useful when used with boards exposing their stdio over USB
This commit is contained in:
Alexandre Abadie
2020-03-18 10:53:17 +01:00
parent f5a17a90fb
commit a91c4bf7e6
+8
View File
@@ -28,6 +28,10 @@ MAKE_TERM_STARTED_DELAY = int(os.environ.get('TESTRUNNER_START_DELAY') or 3)
# default value (0, no delay)
MAKE_RESET_DELAY = int(os.environ.get('TESTRUNNER_RESET_DELAY') or 0)
# Setting an empty 'TESTRUNNER_CONNECT_DELAY' environment variable use the
# default value (0)
MAKE_TERM_CONNECT_DELAY = int(os.environ.get('TESTRUNNER_CONNECT_DELAY') or 0)
# 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)
@@ -66,6 +70,10 @@ def setup_child(timeout=10, spawnclass=pexpect.spawnu, env=None, logfile=None):
# before `cleanterm`.
_reset_board(env)
# on platforms exposing UART over USB, wait a little before connecting to
# the serial terminal. This gives time for stdio to be ready.
time.sleep(MAKE_TERM_CONNECT_DELAY)
child = spawnclass("make cleanterm", env=env, timeout=timeout,
codec_errors='replace', echo=False)