From e1d6bc7f84c5a52b555d1c672f8a59489047380e Mon Sep 17 00:00:00 2001 From: Jeremy Bettis Date: Wed, 6 Apr 2022 09:47:54 -0600 Subject: ec: Add sleep to emulated ztests for tasks Sometimes the tasks don't finish starting until the test is done. There are several tasks that are included in all tests even if they don't use them, such as the console task, and those often don't even start until the end of the test. This causes the number of covered lines in gcov to change from run to run. Add a sleep before printing Pass, as that is when the util/run_host_test kills the test. BRANCH=None BUG=b:213374060 TEST=Ran accel_cal 50 times Signed-off-by: Jeremy Bettis Change-Id: I36a8b2e0812adbbb158c439aea867e1b5bc960d6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3573692 Tested-by: Jeremy Bettis Reviewed-by: Aaron Massey Commit-Queue: Jeremy Bettis --- common/test_util.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/test_util.c b/common/test_util.c index 287bcbeddf..37cc42000c 100644 --- a/common/test_util.c +++ b/common/test_util.c @@ -225,7 +225,11 @@ void z_ztest_run_test_suite(const char *name, struct unit_test *suite) suite++; } + /* Sometimes the console task doesn't start until the test is done. */ + sleep(1); + ccprintf("%s: ", name); + test_print_result(); } #endif /* CONFIG_ZEPHYR */ -- cgit v1.2.1