Revert "ztest: migrate error_hook tests to new API"
This reverts commit fa13d57f01
.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
parent
c3c026e03c
commit
85cc902a0d
3 changed files with 21 additions and 14 deletions
|
@ -1,5 +1,4 @@
|
||||||
CONFIG_ZTEST=y
|
CONFIG_ZTEST=y
|
||||||
CONFIG_ZTEST_NEW_API=y
|
|
||||||
CONFIG_TEST_USERSPACE=y
|
CONFIG_TEST_USERSPACE=y
|
||||||
CONFIG_IRQ_OFFLOAD=y
|
CONFIG_IRQ_OFFLOAD=y
|
||||||
CONFIG_ZTEST_FATAL_HOOK=y
|
CONFIG_ZTEST_FATAL_HOOK=y
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
CONFIG_ZTEST=y
|
CONFIG_ZTEST=y
|
||||||
CONFIG_ZTEST_NEW_API=y
|
|
||||||
CONFIG_IRQ_OFFLOAD=y
|
CONFIG_IRQ_OFFLOAD=y
|
||||||
CONFIG_ZTEST_FATAL_HOOK=y
|
CONFIG_ZTEST_FATAL_HOOK=y
|
||||||
CONFIG_ZTEST_ASSERT_HOOK=y
|
CONFIG_ZTEST_ASSERT_HOOK=y
|
||||||
|
|
|
@ -262,7 +262,7 @@ static int run_trigger_thread(int i)
|
||||||
* If the fatal error happened and the program enter assert_post_handler,
|
* If the fatal error happened and the program enter assert_post_handler,
|
||||||
* that means fatal error triggered as expected.
|
* that means fatal error triggered as expected.
|
||||||
*/
|
*/
|
||||||
ZTEST_USER(error_hook_tests, test_catch_fatal_error)
|
void test_catch_fatal_error(void)
|
||||||
{
|
{
|
||||||
#if defined(CONFIG_USERSPACE)
|
#if defined(CONFIG_USERSPACE)
|
||||||
run_trigger_thread(ZTEST_CATCH_FATAL_ACCESS);
|
run_trigger_thread(ZTEST_CATCH_FATAL_ACCESS);
|
||||||
|
@ -287,20 +287,15 @@ ZTEST_USER(error_hook_tests, test_catch_fatal_error)
|
||||||
* fail happened and the program enter assert_post_handler, that means
|
* fail happened and the program enter assert_post_handler, that means
|
||||||
* assert works as expected.
|
* assert works as expected.
|
||||||
*/
|
*/
|
||||||
ZTEST_USER(error_hook_tests, test_catch_assert_fail)
|
void test_catch_assert_fail(void)
|
||||||
{
|
{
|
||||||
case_type = ZTEST_CATCH_ASSERT_FAIL;
|
case_type = ZTEST_CATCH_ASSERT_FAIL;
|
||||||
|
|
||||||
printk("1\n");
|
|
||||||
ztest_set_assert_valid(false);
|
ztest_set_assert_valid(false);
|
||||||
|
|
||||||
printk("2\n");
|
|
||||||
ztest_set_assert_valid(true);
|
ztest_set_assert_valid(true);
|
||||||
|
|
||||||
printk("3\n");
|
|
||||||
trigger_assert_fail(NULL);
|
trigger_assert_fail(NULL);
|
||||||
|
|
||||||
printk("4\n");
|
|
||||||
ztest_test_fail();
|
ztest_test_fail();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,7 +313,7 @@ static void tIsr_assert(const void *p)
|
||||||
* fail happened and the program enter assert_post_handler, that means
|
* fail happened and the program enter assert_post_handler, that means
|
||||||
* assert works as expected.
|
* assert works as expected.
|
||||||
*/
|
*/
|
||||||
ZTEST(error_hook_tests, test_catch_assert_in_isr)
|
void test_catch_assert_in_isr(void)
|
||||||
{
|
{
|
||||||
case_type = ZTEST_CATCH_ASSERT_IN_ISR;
|
case_type = ZTEST_CATCH_ASSERT_IN_ISR;
|
||||||
irq_offload(tIsr_assert, NULL);
|
irq_offload(tIsr_assert, NULL);
|
||||||
|
@ -342,7 +337,7 @@ static void trigger_z_oops(void)
|
||||||
* that means z_oops triggered as expected. This test only for
|
* that means z_oops triggered as expected. This test only for
|
||||||
* userspace.
|
* userspace.
|
||||||
*/
|
*/
|
||||||
ZTEST(error_hook_tests, test_catch_z_oops)
|
void test_catch_z_oops(void)
|
||||||
{
|
{
|
||||||
case_type = ZTEST_CATCH_USER_FATAL_Z_OOPS;
|
case_type = ZTEST_CATCH_USER_FATAL_Z_OOPS;
|
||||||
|
|
||||||
|
@ -352,11 +347,25 @@ ZTEST(error_hook_tests, test_catch_z_oops)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static void *error_hook_tests_setup(void)
|
void test_main(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
#if defined(CONFIG_USERSPACE)
|
#if defined(CONFIG_USERSPACE)
|
||||||
k_thread_access_grant(k_current_get(), &tdata, &tstack);
|
k_thread_access_grant(k_current_get(), &tdata, &tstack);
|
||||||
|
|
||||||
|
ztest_test_suite(error_hook_tests,
|
||||||
|
ztest_user_unit_test(test_catch_assert_fail),
|
||||||
|
ztest_user_unit_test(test_catch_fatal_error),
|
||||||
|
ztest_unit_test(test_catch_z_oops),
|
||||||
|
ztest_unit_test(test_catch_assert_in_isr)
|
||||||
|
);
|
||||||
|
ztest_run_test_suite(error_hook_tests);
|
||||||
|
#else
|
||||||
|
ztest_test_suite(error_hook_tests,
|
||||||
|
ztest_unit_test(test_catch_fatal_error),
|
||||||
|
ztest_unit_test(test_catch_assert_fail),
|
||||||
|
ztest_unit_test(test_catch_assert_in_isr)
|
||||||
|
);
|
||||||
|
ztest_run_test_suite(error_hook_tests);
|
||||||
#endif
|
#endif
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
ZTEST_SUITE(error_hook_tests, NULL, error_hook_tests_setup, NULL, NULL, NULL);
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue