tests/mem_protect/stackprot: Need a delay under SMP

The "alternate thread" test would spawn a thread and then exit the
test, but on SMP that other thread runs asynchronously and it was
possible for the main thread to exit the test entirely before the test
thread had a chance to run (and overflow its stack), leading to
spurious test case failures.

Obviously we can't exactly synchronize to an async crash, so put a
short delay in after spawning the thread.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
Andy Ross 2020-01-23 13:00:29 -08:00 committed by Anas Nashif
commit 83d1ca06dc

View file

@ -126,6 +126,11 @@ void test_create_alt_thread(void)
k_thread_create(&alt_thread_data, alt_thread_stack_area, STACKSIZE,
(k_thread_entry_t)alternate_thread, NULL, NULL, NULL,
K_PRIO_COOP(1), K_USER, K_NO_WAIT);
/* Note that this sleep is required on SMP platforms where
* that thread will execute asynchronously!
*/
k_sleep(K_MSEC(100));
}
void test_main(void)