Renaming of things which may be, one day, exported in a lib. Also defining local test main.
Things that are candidate to be exported in the lib in the future have been named as follows: -Tests, i.e. functions which are used in CUNIT testsuites are named: <Module>_test_* -Test arrays, i.e. arrays of CU_TestInfo, listing the test functions belonging to a suite, are called: <Module>_suite[_*] where the possible suffix can be used if many suites are declared. -CUNIT suite init and termination functions are called: <Module>_suite[_*]_init() and <Module>_suite[_*]_term() respectively. -Suite arrays, i.e. arrays of CU_SuiteInfo used in executables are called: <Module>_suites[_*] where the possible suffix identifies the executable using it, if many. -Main function(s), are called: <Module>_main[_*] where the possible suffix identifies the executable using it Signed-off-by: Christophe Milard <christophe.mil...@linaro.org> --- test/validation/Makefile.am | 1 + test/validation/odp_random.c | 21 ++++++++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am index 7470d9d..6ddda79 100644 --- a/test/validation/Makefile.am +++ b/test/validation/Makefile.am @@ -51,6 +51,7 @@ dist_odp_init_SOURCES = odp_init.c dist_odp_init_abort_SOURCES = odp_init_abort.c dist_odp_init_log_SOURCES = odp_init_log.c dist_odp_queue_SOURCES = odp_queue.c $(ODP_CU_COMMON) +odp_random_CFLAGS = $(AM_CFLAGS) -DMODULE_HAS_OWN_MAIN dist_odp_random_SOURCES = odp_random.c $(ODP_CU_COMMON) dist_odp_scheduler_SOURCES = odp_scheduler.c $(ODP_CU_COMMON) dist_odp_shared_memory_SOURCES = odp_shared_memory.c $(ODP_CU_COMMON) diff --git a/test/validation/odp_random.c b/test/validation/odp_random.c index ebc9705..cefc52d 100644 --- a/test/validation/odp_random.c +++ b/test/validation/odp_random.c @@ -10,7 +10,7 @@ /* Helper macro for CU_TestInfo initialization */ #define _CU_TEST_INFO(test_func) {#test_func, test_func} -static void random_get_size(void) +static void random_test_get_size(void) { int32_t ret; uint8_t buf[32]; @@ -19,12 +19,23 @@ static void random_get_size(void) CU_ASSERT(ret == sizeof(buf)); } -CU_TestInfo test_odp_random[] = { - _CU_TEST_INFO(random_get_size), +static CU_TestInfo random_suite[] = { + _CU_TEST_INFO(random_test_get_size), CU_TEST_INFO_NULL, }; -CU_SuiteInfo odp_testsuites[] = { - {"Random", NULL, NULL, NULL, NULL, test_odp_random}, +static CU_SuiteInfo random_suites[] = { + {"Random", NULL, NULL, NULL, NULL, random_suite}, CU_SUITE_INFO_NULL, }; + +static int random_main(void) +{ + return odp_cunit_run(random_suites); +} + +/* the following main function will be seperated when lib is created */ +int main(void) +{ + return random_main(); +} -- 1.9.1 _______________________________________________ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp