ztest: add a delay between tests through CONFIG_ZTEST_TEST_DELAY_MS

Some testsuites dump lots of output very fast where some systems are not
able to capture the complete output from the tests. Add a slight delay
between each test in the suite.

New kconfig CONFIG_ZTEST_TEST_DELAY_MS is added to ztest.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2022-09-24 17:03:19 -04:00 committed by Fabio Baltieri
commit 268fff57a8
2 changed files with 10 additions and 0 deletions

View file

@ -22,6 +22,13 @@ config ZTEST_STACK_SIZE
default 2048 if COVERAGE_GCOV
default 1024
config ZTEST_TEST_DELAY_MS
int "Delay between tests in milliseconds"
default 0
help
Add a delay between between tests to manage output on the console on
systems that can't handle the rapid output rate.
config ZTEST_FAIL_FAST
bool "Abort on first failing test"
help

View file

@ -509,6 +509,9 @@ static int run_test(struct ztest_suite_node *suite, struct ztest_unit_test *test
{
int ret = TC_PASS;
#if CONFIG_ZTEST_TEST_DELAY_MS > 0
k_busy_wait(CONFIG_ZTEST_TEST_DELAY_MS * USEC_PER_MSEC);
#endif
TC_START(test->name);
phase = TEST_PHASE_BEFORE;