@@ -115,6 +115,12 @@ void alt_thread3(void)
115115 irq_unlock (key );
116116}
117117
118+ void alt_thread4 (void )
119+ {
120+ __ASSERT (0 , "intentionally failed assertion" );
121+ rv = TC_FAIL ;
122+ }
123+
118124#ifndef CONFIG_ARCH_POSIX
119125#ifdef CONFIG_STACK_SENTINEL
120126void blow_up_stack (void )
@@ -266,6 +272,19 @@ void test_fatal(void)
266272 crash_reason , _NANO_ERR_KERNEL_PANIC );
267273 zassert_not_equal (rv , TC_FAIL , "thread was not aborted" );
268274
275+ TC_PRINT ("test alt thread 4: fail assertion\n" );
276+ k_thread_create (& alt_thread , alt_stack ,
277+ K_THREAD_STACK_SIZEOF (alt_stack ),
278+ (k_thread_entry_t )alt_thread4 ,
279+ NULL , NULL , NULL , K_PRIO_COOP (PRIORITY ), 0 ,
280+ K_NO_WAIT );
281+ k_thread_abort (& alt_thread );
282+ /* Default assert_post_action() induces a kernel panic */
283+ zassert_equal (crash_reason , _NANO_ERR_KERNEL_PANIC ,
284+ "bad reason code got %d expected %d\n" ,
285+ crash_reason , _NANO_ERR_KERNEL_PANIC );
286+ zassert_not_equal (rv , TC_FAIL , "thread was not aborted" );
287+
269288#ifndef CONFIG_ARCH_POSIX
270289
271290#ifdef CONFIG_STACK_SENTINEL
0 commit comments