mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-08-27 16:46:02 +00:00
If a ztest test case creates child thread(s), and one of the descendent threads invokes ztest_test_pass(), ztest_test_fail(), or ztest_thread_skip(), only that descendent thread will be aborted. Then ztest will try to run the next scenario on the ztest_thread which is already in use. This was causing corruption issues on SMP systems, and possibly other subtle, hard-to-debug situations. This patch ensures that ztest_thread is always dead before re-using it, as run_test() now attempts to join on it instead of using a semaphore. The ztest_test_* functions now ensure that the ztest_thread is always aborted, in addition to the current thread. This isn't perfect. If the testcase spawned other threads, they will keep running. The most robust way to fix this is to iterate over all non-essential threads in the system and abort them. Unfortunately, Zephyr doesn't have a facility to do this safely. It would also be simpler to re-use thread objects if k_thread_create() could detect whether the thread was already active and abort it, but this is currently not possible since k_thread_create() can be used with uninitialzed thread object memory and no checks are possible. This may be improved in the future, see #23030. Fixes: #22738 Partial fix for: #24713 Signed-off-by: Andrew Boie <andrew.p.boie@intel.com> |
||
---|---|---|
.. | ||
bluetooth | ||
canbus | ||
console | ||
cpp | ||
debug | ||
dfu | ||
disk | ||
fb | ||
fs | ||
jwt | ||
logging | ||
mgmt | ||
net | ||
power | ||
random | ||
settings | ||
shell | ||
stats | ||
storage | ||
testsuite | ||
tracing | ||
usb | ||
CMakeLists.txt | ||
Kconfig |