File tree Expand file tree Collapse file tree 3 files changed +23
-0
lines changed
Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -3,3 +3,6 @@ CONFIG_IPC_MAJOR_4=y
33CONFIG_ZTEST=y
44CONFIG_MM_DRV=y
55CONFIG_ZEPHYR_NATIVE_DRIVERS=y
6+
7+ # Ensure the kernel can exit QEMU on shutdown/panic
8+ CONFIG_REBOOT=y
Original file line number Diff line number Diff line change @@ -5,3 +5,6 @@ CONFIG_ZTEST=y
55CONFIG_TEST_USERSPACE=y
66CONFIG_MM_DRV=y
77CONFIG_ZEPHYR_NATIVE_DRIVERS=y
8+
9+ # Ensure the kernel can exit QEMU on shutdown/panic
10+ CONFIG_REBOOT=y
Original file line number Diff line number Diff line change 77#include <zephyr/kernel.h>
88#include <sof/boot_test.h>
99#include <zephyr/logging/log.h>
10+
1011LOG_MODULE_REGISTER (main , LOG_LEVEL_DBG );
1112
1213/* define qemu boot tests if any qemu target is defined, add targets to end */
@@ -56,12 +57,28 @@ static int sof_app_main(void)
5657 return 0 ;
5758}
5859
60+ #if CONFIG_SOF_BOOT_TEST && defined(QEMU_BOOT_TESTS )
61+ /* cleanly exit qemu so CI can continue and check test results */
62+ static inline void qemu_xtensa_exit (int status ) {
63+ register int syscall_id __asm__ ("a2" ) = 1 ; /* SYS_exit is 1 */
64+ register int exit_status __asm__ ("a3" ) = status ;
65+
66+ __asm__ __volatile__ (
67+ "simcall\n"
68+ :
69+ : "r" (syscall_id ), "r" (exit_status )
70+ : "memory"
71+ );
72+ }
73+ #endif
74+
5975#if CONFIG_ZTEST
6076void test_main (void )
6177{
6278 sof_app_main ();
6379#if CONFIG_SOF_BOOT_TEST && defined(QEMU_BOOT_TESTS )
6480 sof_run_boot_tests ();
81+ qemu_xtensa_exit (0 );
6582#endif
6683}
6784#else
You can’t perform that action at this time.
0 commit comments