tests: kernel: use TC_END_REPORT for faults

Use TC_END_REPORT() to report "PROJECT EXECUTION FAILED"
instead of a call to printk() for ZTEST enabled tests. as
this prints the failed message as well as the RunID (and
whatever will be added in future).

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2024-02-22 14:44:58 -08:00 committed by Anas Nashif
parent 4323bfe71c
commit 7c80746bc6
11 changed files with 15 additions and 15 deletions

View File

@ -56,20 +56,20 @@ void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *pEsf)
if (expected_reason == -1) {
printk("Was not expecting a crash\n");
printk("PROJECT EXECUTION FAILED\n");
TC_END_REPORT(TC_FAIL);
k_fatal_halt(reason);
}
if (k_current_get() != &alt_thread) {
printk("Wrong thread crashed\n");
printk("PROJECT EXECUTION FAILED\n");
TC_END_REPORT(TC_FAIL);
k_fatal_halt(reason);
}
if (reason != expected_reason) {
printk("Wrong crash type got %d expected %d\n", reason,
expected_reason);
printk("PROJECT EXECUTION FAILED\n");
TC_END_REPORT(TC_FAIL);
k_fatal_halt(reason);
}

View File

@ -73,7 +73,7 @@ void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *pEsf)
ztest_test_pass();
} else {
printk("Unexpected fault during test");
printk("PROJECT EXECUTION FAILED\n");
TC_END_REPORT(TC_FAIL);
k_fatal_halt(reason);
}
}

View File

@ -42,7 +42,7 @@ void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *pEsf)
ztest_test_pass();
} else {
printk("Unexpected fault during test\n");
printk("PROJECT EXECUTION FAILED\n");
TC_END_REPORT(TC_FAIL);
k_fatal_halt(reason);
}
}

View File

@ -16,7 +16,7 @@ void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *pEsf)
valid_fault = false; /* reset back to normal */
} else {
printk("fatal error was unexpected, aborting\n");
printk("PROJECT EXECUTION FAILED\n");
TC_END_REPORT(TC_FAIL);
k_fatal_halt(reason);
}
}

View File

@ -19,7 +19,7 @@ void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *esf)
{
if (reason != K_ERR_STACK_CHK_FAIL) {
printk("wrong error type\n");
printk("PROJECT EXECUTION FAILED\n");
TC_END_REPORT(TC_FAIL);
k_fatal_halt(reason);
}
}

View File

@ -572,7 +572,7 @@ void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *pEsf)
{
printk("Caught system error -- reason %d\n", reason);
printk("Unexpected fault during test\n");
printk("PROJECT EXECUTION FAILED\n");
TC_END_REPORT(TC_FAIL);
k_fatal_halt(reason);
}

View File

@ -40,7 +40,7 @@ void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *pEsf)
{
printk("Caught system error -- reason %d\n", reason);
printk("Unexpected fault during test\n");
printk("PROJECT EXECUTION FAILED\n");
TC_END_REPORT(TC_FAIL);
k_fatal_halt(reason);
}

View File

@ -82,12 +82,12 @@ void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *pEsf)
} else {
printk("Wrong fault reason, expecting %d\n",
expected_reason);
printk("PROJECT EXECUTION FAILED\n");
TC_END_REPORT(TC_FAIL);
k_fatal_halt(reason);
}
} else {
printk("Unexpected fault during test\n");
printk("PROJECT EXECUTION FAILED\n");
TC_END_REPORT(TC_FAIL);
k_fatal_halt(reason);
}
}

View File

@ -681,7 +681,7 @@ void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *pEsf)
valid_fault = false; /* reset back to normal */
ztest_test_pass();
} else {
printk("PROJECT EXECUTION FAILED\n");
TC_END_REPORT(TC_FAIL);
k_fatal_halt(reason);
}
}

View File

@ -763,7 +763,7 @@ void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *esf)
if (reason != K_ERR_KERNEL_OOPS) {
printk("wrong error reason\n");
printk("PROJECT EXECUTION FAILED\n");
TC_END_REPORT(TC_FAIL);
k_fatal_halt(reason);
}

View File

@ -20,12 +20,12 @@ void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *esf)
{
if (reason != K_ERR_KERNEL_OOPS) {
printk("wrong error reason\n");
printk("PROJECT EXECUTION FAILED\n");
TC_END_REPORT(TC_FAIL);
k_fatal_halt(reason);
}
if (k_current_get() != dyn_thread) {
printk("wrong thread crashed\n");
printk("PROJECT EXECUTION FAILED\n");
TC_END_REPORT(TC_FAIL);
k_fatal_halt(reason);
}
}