diff --git a/test/validation/api/Makefile.am b/test/validation/api/Makefile.am index 2a44d790c3..c02ce01615 100644 --- a/test/validation/api/Makefile.am +++ b/test/validation/api/Makefile.am @@ -57,6 +57,7 @@ TESTS = \ hints/hints_main$(EXEEXT) \ init/init_defaults.sh \ init/init_abort.sh \ + init/init_abort_fn_get.sh \ init/init_log.sh \ init/init_log_thread.sh \ init/init_log_fn_get.sh \ diff --git a/test/validation/api/init/Makefile.am b/test/validation/api/init/Makefile.am index 504c8ac59f..302ce73d94 100644 --- a/test/validation/api/init/Makefile.am +++ b/test/validation/api/init/Makefile.am @@ -6,6 +6,7 @@ init_main_SOURCES = init_main.c EXTRA_DIST = \ init_defaults.sh \ init_abort.sh \ + init_abort_fn_get.sh \ init_log.sh \ init_log_fn_get.sh \ init_num_thr.sh \ diff --git a/test/validation/api/init/init_abort_fn_get.sh b/test/validation/api/init/init_abort_fn_get.sh new file mode 100755 index 0000000000..5a65c22ec9 --- /dev/null +++ b/test/validation/api/init/init_abort_fn_get.sh @@ -0,0 +1,3 @@ +#!/bin/sh +TEST_DIR="${TEST_DIR:-$(dirname $0)/..}/init" +$TEST_DIR/init_main$EXEEXT 10 diff --git a/test/validation/api/init/init_main.c b/test/validation/api/init/init_main.c index b4533ad0de..7cae4237a6 100644 --- a/test/validation/api/init/init_main.c +++ b/test/validation/api/init/init_main.c @@ -113,6 +113,35 @@ static void init_test_abort(void) CU_ASSERT(ret == 0); } +static void init_test_abort_fn_get(void) +{ + int ret; + odp_instance_t instance; + odp_init_t param; + odp_abort_func_t fn; + + fn = odp_abort_fn_get(); + CU_ASSERT(fn == NULL); + + odp_init_param_init(¶m); + param.abort_fn = &my_abort_func; + + ret = odp_init_global(&instance, ¶m, NULL); + CU_ASSERT_FATAL(ret == 0); + + ret = odp_init_local(instance, ODP_THREAD_WORKER); + CU_ASSERT_FATAL(ret == 0); + + fn = odp_abort_fn_get(); + CU_ASSERT(fn == &my_abort_func); + + ret = odp_term_local(); + CU_ASSERT_FATAL(ret == 0); + + ret = odp_term_global(instance); + CU_ASSERT(ret == 0); +} + static void init_test_log(void) { int ret; @@ -311,6 +340,7 @@ odp_testinfo_t testinfo[] = { ODP_TEST_INFO(init_test_param_init), ODP_TEST_INFO(init_test_term_abnormal), ODP_TEST_INFO(init_test_log_fn_get), + ODP_TEST_INFO(init_test_abort_fn_get), }; odp_testinfo_t init_suite[] = {