tests/kernel/fatal: Work around historical API misuse

This test was written to do a k_oops() in the main thread.  That's an
essential thread, and aborting it is actually a system panic now.  The
test was written contra the docs on this, but it worked fine for
years.

Just reflag the thread as a simple workaround rather than trying
anything fancy. This is a very simple test.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
Andy Ross 2022-05-19 15:01:38 -07:00 committed by Carles Cufí
commit c64ac967a8

View file

@ -9,6 +9,8 @@
static volatile int expected_reason = -1;
void z_thread_essential_clear(void);
void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *pEsf)
{
printk("Caught system error -- reason %d\n", reason);
@ -73,5 +75,13 @@ void test_message_capture(void)
void main(void)
{
/* main() is an essential thread, and we try to OOPS it. When
* this test was written, that worked (even though it wasn't
* supposed to per docs). Now we trap a different error (a
* panic and not an oops). Set the thread non-essential as a
* workaround.
*/
z_thread_essential_clear();
test_message_capture();
}