Some testcases cannot cleanup when assert fail causing an "unexpected eof" on qemu #57681
Labels
area: QEMU
QEMU Emulation
area: Tests
Issues related to a particular existing or missing test
bug
The issue is a bug, or the PR is fixing a bug
priority: medium
Medium impact/importance bug
Stale
Describe the bug
An issue encountered in #55207 (comment) about CI failure
Platform:
qemu_cortex_a53_smp
, there might be more platform affected.Some testcases like tests/kernel/sched/schedule_api/kernel.scheduler has the following logic structure
The issue is, when
assert
fail, the fail routine will callk_thread_abort
to abort the current thread, thus the thread cannot clean up the allocated resource. Takingtests/kernel/sched/schedule_api/kernel.scheduler
as an example,zephyr/tests/kernel/sched/schedule_api/src/test_sched_timeslice_and_lock.c
Lines 286 to 298 in 534952a
The test thread first spawns 3 threads, then test and finally abort the spawned threads. But if the assert fails,
https://github.com/zephyrproject-rtos/zephyr/blob/main/tests/kernel/sched/schedule_api/src/test_sched_timeslice_and_lock.c#L255
the assert will call
k_thread_abort
to abort the current thread (test thread), so that the test thread will never teardown the spawned threads which are living inrunq
'forever'. However, the next test will respawn the threads without checking if these threads have been aborted or still living inrunq
and just init them again so that the same threads will exist inrunq
twice or even more times. This issue probably causes an unexpected exception and further, the unexpected exception will call PSCI func to shutdown the core resulting in an unexpected exit of QEMU.To Reproduce
Steps to reproduce the behavior:
west build -p always -b qemu_cortex_a53_smp -t run -T zephyr/tests/kernel/sched/schedule_api/kernel.scheduler
or
west twister -p qemu_cortex_a53_smp -s tests/kernel/sched/schedule_api/kernel.scheduler
Expected behavior
ztest should have a statistical info
twister should not have
unexpected eof
Impact
annoyance
Logs and console output
Environment (please complete the following information):
Additional context
possible solutions:
The text was updated successfully, but these errors were encountered: