diff options
author | Maxim Uvarov <maxim.uvarov@linaro.org> | 2015-10-26 16:48:07 +0300 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2015-10-26 17:29:47 +0300 |
commit | 05e6b05273ba07ee3ab8e48f55a2cc972287cb2c (patch) | |
tree | 666ab0d0b1c850b525806ecec3a35b9292f22455 /test/validation | |
parent | 00af9c28e62d8eeea4f769c9e4b4a74184616086 (diff) | |
parent | 78872639460a3f454fa69a72f7ea5ab4c547a2b8 (diff) |
Merge branch 'master' into api-next
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Conflicts:
example/classifier/odp_classifier.c
include/odp/api/config.h
include/odp/api/cpu.h
include/odp/api/cpumask.h
include/odp/api/packet_io.h
platform/linux-generic/Makefile.am
platform/linux-generic/arch/linux/odp_cpu_cycles.c
test/performance/odp_scheduling.c
test/validation/classification/odp_classification_testsuites.h
test/validation/system/system.c
Diffstat (limited to 'test/validation')
50 files changed, 836 insertions, 480 deletions
diff --git a/test/validation/README b/test/validation/README index 2d0c258a1..1baebaafc 100644 --- a/test/validation/README +++ b/test/validation/README @@ -4,47 +4,32 @@ All rights reserved. SPDX-License-Identifier: BSD-3-Clause -To add tests in here, please observe the following rules: +To add tests in here, please observe the rules listed below. This list +is a brief overview, for a more detailed explanation of the test +framework refer to the ODP Implementers' Guide, which can built as +follows: -1. Tests should be placed in the directory of the module they belong to. + ./configure --enable-user-guides + make +Output will be in doc/output/. If this fails, check the documentation +section of the DEPENDENCIES file. -2. Test under test/validation/... should be platform agnostic, i.e. - -they should be written in plain C only - -they may only used Clib functions, C_UNIT functions and of course ODP - functions. - -they should be expected to pass on all ODP implementation - - Tests that do not follow these rules should be placed in the platform - specific test area (currently platform/<platform>/test*) - - -3. If a new ODP API module is created, please update the Makefile.am and - the odptest.h file +Rules for all tests under this tree: +1. Tests must be placed in the directory of the module they belong to. -4. Respect the following name convention for the names exported in the library: +2. Tests must be platform agnostic, i.e. - * Tests, i.e. functions which are used in CUNIT test suites are named: - *<Module>_test_* + - should be written in plain C only. + - may only use C standard library functions, CUnit functions and of + course ODP functions + - should be expected to pass on all ODP implementations - * 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. + Tests that do not follow these rules should be placed in the platform + specific test area (currently platform/<platform>/test/). - * Main executable function(s), are called: - <Module>_main[_*]* - where the possible suffix identifies the executable using it +3. If a new ODP API module is created, please update the Makefile.am. - * Init/term function for the whole executable are called: - <Module>_init - <Module>_term +4. Symbols exported from test libraries must respect the naming + convention detailed in the ODP Implementers' Guide. diff --git a/test/validation/buffer/buffer.c b/test/validation/buffer/buffer.c index c62938d0a..257e95cb3 100644 --- a/test/validation/buffer/buffer.c +++ b/test/validation/buffer/buffer.c @@ -139,23 +139,24 @@ void buffer_test_management_basic(void) CU_ASSERT(odp_event_to_u64(ev) != odp_event_to_u64(ODP_EVENT_INVALID)); } -CU_TestInfo buffer_suite[] = { - _CU_TEST_INFO(buffer_test_pool_alloc), - _CU_TEST_INFO(buffer_test_pool_free), - _CU_TEST_INFO(buffer_test_management_basic), - CU_TEST_INFO_NULL, +odp_testinfo_t buffer_suite[] = { + ODP_TEST_INFO(buffer_test_pool_alloc), + ODP_TEST_INFO(buffer_test_pool_free), + ODP_TEST_INFO(buffer_test_management_basic), + ODP_TEST_INFO_NULL, }; -CU_SuiteInfo buffer_suites[] = { - { .pName = "buffer tests", - .pTests = buffer_suite, - .pInitFunc = buffer_suite_init, - .pCleanupFunc = buffer_suite_term, - }, - CU_SUITE_INFO_NULL, +odp_suiteinfo_t buffer_suites[] = { + {"buffer tests", buffer_suite_init, buffer_suite_term, buffer_suite}, + ODP_SUITE_INFO_NULL, }; int buffer_main(void) { - return odp_cunit_run(buffer_suites); + int ret = odp_cunit_register(buffer_suites); + + if (ret == 0) + odp_cunit_run(); + + return ret; } diff --git a/test/validation/buffer/buffer.h b/test/validation/buffer/buffer.h index 49166247f..8b61bf527 100644 --- a/test/validation/buffer/buffer.h +++ b/test/validation/buffer/buffer.h @@ -7,7 +7,7 @@ #ifndef _ODP_TEST_BUFFER_H_ #define _ODP_TEST_BUFFER_H_ -#include <CUnit/Basic.h> +#include <odp_cunit_common.h> /* test functions: */ void buffer_test_pool_alloc(void); @@ -15,14 +15,14 @@ void buffer_test_pool_free(void); void buffer_test_management_basic(void); /* test arrays: */ -extern CU_TestInfo buffer_suite[]; +extern odp_testinfo_t buffer_suite[]; /* test array init/term functions: */ int buffer_suite_init(void); int buffer_suite_term(void); /* test registry: */ -extern CU_SuiteInfo buffer_suites[]; +extern odp_suiteinfo_t buffer_suites[]; /* main test program: */ int buffer_main(void); diff --git a/test/validation/classification/classification.c b/test/validation/classification/classification.c index 6641893d7..9c3dbbb69 100644 --- a/test/validation/classification/classification.c +++ b/test/validation/classification/classification.c @@ -9,7 +9,7 @@ #include "odp_classification_testsuites.h" #include "classification.h" -CU_SuiteInfo classification_suites[] = { +odp_suiteinfo_t classification_suites[] = { { .pName = "classification basic", .pTests = classification_suite_basic, }, @@ -23,10 +23,15 @@ CU_SuiteInfo classification_suites[] = { .pInitFunc = classification_suite_init, .pCleanupFunc = classification_suite_term, }, - CU_SUITE_INFO_NULL, + ODP_SUITE_INFO_NULL, }; int classification_main(void) { - return odp_cunit_run(classification_suites); + int ret = odp_cunit_register(classification_suites); + + if (ret == 0) + ret = odp_cunit_run(); + + return ret; } diff --git a/test/validation/classification/classification.h b/test/validation/classification/classification.h index de9c37e13..6a7e8a5ab 100644 --- a/test/validation/classification/classification.h +++ b/test/validation/classification/classification.h @@ -7,7 +7,7 @@ #ifndef _ODP_TEST_CLASSIFICATION_H_ #define _ODP_TEST_CLASSIFICATION_H_ -#include <CUnit/Basic.h> +#include <odp_cunit_common.h> #define SHM_PKT_NUM_BUFS 32 #define SHM_PKT_BUF_SIZE 1024 @@ -71,15 +71,15 @@ void classification_test_pktio_configure(void); void classification_test_pktio_test(void); /* test arrays: */ -extern CU_TestInfo classification_suite_basic[]; -extern CU_TestInfo classification_suite[]; +extern odp_testinfo_t classification_suite_basic[]; +extern odp_testinfo_t classification_suite[]; /* test array init/term functions: */ int classification_suite_init(void); int classification_suite_term(void); /* test registry: */ -extern CU_SuiteInfo classification_suites[]; +extern odp_suiteinfo_t classification_suites[]; /* main test program: */ int classification_main(void); diff --git a/test/validation/classification/odp_classification_basic.c b/test/validation/classification/odp_classification_basic.c index f8b804d4e..20c157f4e 100644 --- a/test/validation/classification/odp_classification_basic.c +++ b/test/validation/classification/odp_classification_basic.c @@ -170,14 +170,14 @@ void classification_test_pmr_match_set_destroy(void) CU_ASSERT(retval == 0); } -CU_TestInfo classification_suite_basic[] = { - _CU_TEST_INFO(classification_test_create_cos), - _CU_TEST_INFO(classification_test_destroy_cos), - _CU_TEST_INFO(classification_test_create_pmr_match), - _CU_TEST_INFO(classification_test_destroy_pmr), - _CU_TEST_INFO(classification_test_cos_set_queue), - _CU_TEST_INFO(classification_test_cos_set_drop), - _CU_TEST_INFO(classification_test_pmr_match_set_create), - _CU_TEST_INFO(classification_test_pmr_match_set_destroy), - CU_TEST_INFO_NULL, +odp_testinfo_t classification_suite_basic[] = { + ODP_TEST_INFO(classification_test_create_cos), + ODP_TEST_INFO(classification_test_destroy_cos), + ODP_TEST_INFO(classification_test_create_pmr_match), + ODP_TEST_INFO(classification_test_destroy_pmr), + ODP_TEST_INFO(classification_test_cos_set_queue), + ODP_TEST_INFO(classification_test_cos_set_drop), + ODP_TEST_INFO(classification_test_pmr_match_set_create), + ODP_TEST_INFO(classification_test_pmr_match_set_destroy), + ODP_TEST_INFO_NULL, }; diff --git a/test/validation/classification/odp_classification_test_pmr.c b/test/validation/classification/odp_classification_test_pmr.c index 4bfe0cbfe..73ba6f5d5 100644 --- a/test/validation/classification/odp_classification_test_pmr.c +++ b/test/validation/classification/odp_classification_test_pmr.c @@ -533,11 +533,11 @@ static void classification_test_pmr_term_ipproto(void) odp_pktio_close(pktio); } -CU_TestInfo classification_suite_pmr[] = { - _CU_TEST_INFO(classification_test_pmr_term_tcp_dport), - _CU_TEST_INFO(classification_test_pmr_term_tcp_sport), - _CU_TEST_INFO(classification_test_pmr_term_udp_dport), - _CU_TEST_INFO(classification_test_pmr_term_udp_sport), - _CU_TEST_INFO(classification_test_pmr_term_ipproto), - CU_TEST_INFO_NULL, +odp_testinfo_t classification_suite_pmr[] = { + ODP_TEST_INFO(classification_test_pmr_term_tcp_dport), + ODP_TEST_INFO(classification_test_pmr_term_tcp_sport), + ODP_TEST_INFO(classification_test_pmr_term_udp_dport), + ODP_TEST_INFO(classification_test_pmr_term_udp_sport), + ODP_TEST_INFO(classification_test_pmr_term_ipproto), + ODP_TEST_INFO_NULL, }; diff --git a/test/validation/classification/odp_classification_tests.c b/test/validation/classification/odp_classification_tests.c index 03a855e5b..7dba8effb 100644 --- a/test/validation/classification/odp_classification_tests.c +++ b/test/validation/classification/odp_classification_tests.c @@ -643,12 +643,12 @@ void classification_test_pktio_test(void) test_pktio_pmr_match_set_cos(); } -CU_TestInfo classification_suite[] = { - _CU_TEST_INFO(classification_test_pmr_terms_avail), - _CU_TEST_INFO(classification_test_pktio_set_skip), - _CU_TEST_INFO(classification_test_pktio_set_headroom), - _CU_TEST_INFO(classification_test_pmr_terms_cap), - _CU_TEST_INFO(classification_test_pktio_configure), - _CU_TEST_INFO(classification_test_pktio_test), - CU_TEST_INFO_NULL, +odp_testinfo_t classification_suite[] = { + ODP_TEST_INFO(classification_test_pmr_terms_avail), + ODP_TEST_INFO(classification_test_pktio_set_skip), + ODP_TEST_INFO(classification_test_pktio_set_headroom), + ODP_TEST_INFO(classification_test_pmr_terms_cap), + ODP_TEST_INFO(classification_test_pktio_configure), + ODP_TEST_INFO(classification_test_pktio_test), + ODP_TEST_INFO_NULL, }; diff --git a/test/validation/classification/odp_classification_testsuites.h b/test/validation/classification/odp_classification_testsuites.h index a7a8baa83..7d27d95b5 100644 --- a/test/validation/classification/odp_classification_testsuites.h +++ b/test/validation/classification/odp_classification_testsuites.h @@ -8,12 +8,11 @@ #define ODP_CLASSIFICATION_TESTSUITES_H_ #include <odp.h> -#include <CUnit/CUnit.h> -#include <CUnit/Basic.h> +#include <odp_cunit_common.h> -extern CU_TestInfo classification_suite[]; -extern CU_TestInfo classification_suite_basic[]; -extern CU_TestInfo classification_suite_pmr[]; +extern odp_testinfo_t classification_suite[]; +extern odp_testinfo_t classification_suite_basic[]; +extern odp_testinfo_t classification_suite_pmr[]; int classification_suite_init(void); int classification_suite_term(void); diff --git a/test/validation/common/odp_cunit_common.c b/test/validation/common/odp_cunit_common.c index 0f79199ea..a98042d2d 100644 --- a/test/validation/common/odp_cunit_common.c +++ b/test/validation/common/odp_cunit_common.c @@ -22,6 +22,8 @@ static struct { int (*global_term_ptr)(void); } global_init_term = {tests_global_init, tests_global_term}; +static odp_suiteinfo_t *global_testsuites; + /** create test thread */ int odp_cunit_thread_create(void *func_ptr(void *), pthrd_arg *arg) { @@ -90,22 +92,196 @@ void odp_cunit_register_global_term(int (*func_term_ptr)(void)) global_init_term.global_term_ptr = func_term_ptr; } -int odp_cunit_run(CU_SuiteInfo testsuites[]) +static odp_suiteinfo_t *cunit_get_suite_info(const char *suite_name) { - int ret; + odp_suiteinfo_t *sinfo; - printf("\tODP API version: %s\n", odp_version_api_str()); - printf("\tODP implementation version: %s\n", odp_version_impl_str()); + for (sinfo = global_testsuites; sinfo->pName; sinfo++) + if (strcmp(sinfo->pName, suite_name) == 0) + return sinfo; - /* call test executable init hook, if any */ - if (global_init_term.global_init_ptr && - ((*global_init_term.global_init_ptr)() != 0)) + return NULL; +} + +static odp_testinfo_t *cunit_get_test_info(odp_suiteinfo_t *sinfo, + const char *test_name) +{ + odp_testinfo_t *tinfo; + + for (tinfo = sinfo->pTests; tinfo->testinfo.pName; tinfo++) + if (strcmp(tinfo->testinfo.pName, test_name) == 0) + return tinfo; + + return NULL; +} + +/* A wrapper for the suite's init function. This is done to allow for a + * potential runtime check to determine whether each test in the suite + * is active (enabled by using ODP_TEST_INFO_CONDITIONAL()). If present, + * the conditional check is run after the suite's init function. + */ +static int _cunit_suite_init(void) +{ + int ret = 0; + CU_pSuite cur_suite = CU_get_current_suite(); + odp_suiteinfo_t *sinfo; + odp_testinfo_t *tinfo; + + /* find the suite currently being run */ + cur_suite = CU_get_current_suite(); + if (!cur_suite) return -1; - CU_set_error_action(CUEA_ABORT); + sinfo = cunit_get_suite_info(cur_suite->pName); + if (!sinfo) + return -1; + + /* execute its init function */ + if (sinfo->pInitFunc) { + ret = sinfo->pInitFunc(); + if (ret) + return ret; + } + + /* run any configured conditional checks and mark inactive tests */ + for (tinfo = sinfo->pTests; tinfo->testinfo.pName; tinfo++) { + CU_pTest ptest; + CU_ErrorCode err; + + if (!tinfo->check_active || tinfo->check_active()) + continue; + + /* test is inactive, mark it as such */ + ptest = CU_get_test_by_name(tinfo->testinfo.pName, cur_suite); + if (ptest) + err = CU_set_test_active(ptest, CU_FALSE); + else + err = CUE_NOTEST; + + if (err != CUE_SUCCESS) { + fprintf(stderr, "%s: failed to set test %s inactive\n", + __func__, tinfo->testinfo.pName); + return -1; + } + } + + return ret; +} + +/* + * Register suites and tests with CUnit. + * + * Similar to CU_register_suites() but using locally defined wrapper + * types. + */ +static int cunit_register_suites(odp_suiteinfo_t testsuites[]) +{ + odp_suiteinfo_t *sinfo; + odp_testinfo_t *tinfo; + CU_pSuite suite; + CU_pTest test; + + for (sinfo = testsuites; sinfo->pName; sinfo++) { + suite = CU_add_suite(sinfo->pName, + _cunit_suite_init, sinfo->pCleanupFunc); + if (!suite) + return CU_get_error(); + + for (tinfo = sinfo->pTests; tinfo->testinfo.pName; tinfo++) { + test = CU_add_test(suite, tinfo->testinfo.pName, + tinfo->testinfo.pTestFunc); + if (!test) + return CU_get_error(); + } + } + + return 0; +} + +static int cunit_update_test(CU_pSuite suite, + odp_suiteinfo_t *sinfo, + odp_testinfo_t *updated_tinfo) +{ + CU_pTest test = NULL; + CU_ErrorCode err; + odp_testinfo_t *tinfo; + const char *test_name = updated_tinfo->testinfo.pName; + + tinfo = cunit_get_test_info(sinfo, test_name); + if (tinfo) + test = CU_get_test(suite, test_name); + + if (!tinfo || !test) { + fprintf(stderr, "%s: unable to find existing test named %s\n", + __func__, test_name); + return -1; + } + + err = CU_set_test_func(test, updated_tinfo->testinfo.pTestFunc); + if (err != CUE_SUCCESS) { + fprintf(stderr, "%s: failed to update test func for %s\n", + __func__, test_name); + return -1; + } + + tinfo->check_active = updated_tinfo->check_active; + + return 0; +} + +static int cunit_update_suite(odp_suiteinfo_t *updated_sinfo) +{ + CU_pSuite suite = NULL; + CU_ErrorCode err; + odp_suiteinfo_t *sinfo; + odp_testinfo_t *tinfo; + + /* find previously registered suite with matching name */ + sinfo = cunit_get_suite_info(updated_sinfo->pName); + + if (sinfo) { + /* lookup the associated CUnit suite */ + suite = CU_get_suite_by_name(updated_sinfo->pName, + CU_get_registry()); + } + + if (!sinfo || !suite) { + fprintf(stderr, "%s: unable to find existing suite named %s\n", + __func__, updated_sinfo->pName); + return -1; + } + + sinfo->pInitFunc = updated_sinfo->pInitFunc; + sinfo->pCleanupFunc = updated_sinfo->pCleanupFunc; + + err = CU_set_suite_cleanupfunc(suite, updated_sinfo->pCleanupFunc); + if (err != CUE_SUCCESS) { + fprintf(stderr, "%s: failed to update cleanup func for %s\n", + __func__, updated_sinfo->pName); + return -1; + } + + for (tinfo = updated_sinfo->pTests; tinfo->testinfo.pName; tinfo++) { + int ret; + + ret = cunit_update_test(suite, sinfo, tinfo); + if (ret != 0) + return ret; + } + + return 0; +} + +/* + * Run tests previously registered via odp_cunit_register() + */ +int odp_cunit_run(void) +{ + int ret; + + printf("\tODP API version: %s\n", odp_version_api_str()); + printf("\tODP implementation version: %s\n", odp_version_impl_str()); - CU_initialize_registry(); - CU_register_suites(testsuites); CU_basic_set_mode(CU_BRM_VERBOSE); CU_basic_run_tests(); @@ -120,3 +296,41 @@ int odp_cunit_run(CU_SuiteInfo testsuites[]) return (ret) ? -1 : 0; } + +/* + * Update suites/tests previously registered via odp_cunit_register(). + * + * Note that this is intended for modifying the properties of already + * registered suites/tests. New suites/tests can only be registered via + * odp_cunit_register(). + */ +int odp_cunit_update(odp_suiteinfo_t testsuites[]) +{ + int ret = 0; + odp_suiteinfo_t *sinfo; + + for (sinfo = testsuites; sinfo->pName && ret == 0; sinfo++) + ret = cunit_update_suite(sinfo); + + return ret; +} + +/* + * Register test suites to be run via odp_cunit_run() + */ +int odp_cunit_register(odp_suiteinfo_t testsuites[]) +{ + /* call test executable init hook, if any */ + if (global_init_term.global_init_ptr && + ((*global_init_term.global_init_ptr)() != 0)) + return -1; + + CU_set_error_action(CUEA_ABORT); + + CU_initialize_registry(); + global_testsuites = testsuites; + cunit_register_suites(testsuites); + CU_set_fail_on_inactive(CU_FALSE); + + return 0; +} diff --git a/test/validation/common/odp_cunit_common.h b/test/validation/common/odp_cunit_common.h index 6cafaaaa7..c68905466 100644 --- a/test/validation/common/odp_cunit_common.h +++ b/test/validation/common/odp_cunit_common.h @@ -15,14 +15,45 @@ #include <stdint.h> #include "CUnit/Basic.h" +#include "CUnit/TestDB.h" #define MAX_WORKERS 32 /**< Maximum number of work threads */ -/* the function, called by module main(), to run the testsuites: */ -int odp_cunit_run(CU_SuiteInfo testsuites[]); +typedef int (*cunit_test_check_active)(void); -/* the macro used to have test names (strings) matching function symbols */ -#define _CU_TEST_INFO(test_func) {#test_func, test_func} +typedef struct { + CU_TestInfo testinfo; + cunit_test_check_active check_active; +} odp_testinfo_t; + +typedef struct { + const char *pName; + CU_InitializeFunc pInitFunc; + CU_CleanupFunc pCleanupFunc; + odp_testinfo_t *pTests; +} odp_suiteinfo_t; + +static inline int odp_cunit_test_inactive(void) { return 0; } +static inline void odp_cunit_test_missing(void) { } + +/* An active test case, with the test name matching the test function name */ +#define ODP_TEST_INFO(test_func) \ + {{#test_func, test_func}, NULL} + +/* A test case that is unconditionally inactive. Its name will be registered + * with CUnit but it won't be executed and will be reported as inactive in + * the result summary. */ +#define ODP_TEST_INFO_INACTIVE(test_func) \ + {{#test_func, odp_cunit_test_missing}, odp_cunit_test_inactive} + +/* A test case that may be marked as inactive at runtime based on the + * return value of the cond_func function. A return value of 0 means + * inactive, anything else is active. */ +#define ODP_TEST_INFO_CONDITIONAL(test_func, cond_func) \ + {{#test_func, test_func}, cond_func} + +#define ODP_TEST_INFO_NULL {CU_TEST_INFO_NULL, NULL} +#define ODP_SUITE_INFO_NULL {NULL, NULL, NULL, NULL} typedef struct { uint32_t foo; @@ -37,9 +68,16 @@ typedef struct { int numthrds; /**< no of pthreads to create */ } pthrd_arg; +/* register suites to be run via odp_cunit_run() */ +int odp_cunit_register(odp_suiteinfo_t testsuites[]); +/* update tests previously registered via odp_cunit_register() */ +int odp_cunit_update(odp_suiteinfo_t testsuites[]); +/* the function, called by module main(), to run the testsuites: */ +int odp_cunit_run(void); + /** create thread fro start_routine function */ -extern int odp_cunit_thread_create(void *func_ptr(void *), pthrd_arg *arg); -extern int odp_cunit_thread_exit(pthrd_arg *); +int odp_cunit_thread_create(void *func_ptr(void *), pthrd_arg *arg); +int odp_cunit_thread_exit(pthrd_arg *); /** * Global tests initialization/termination. diff --git a/test/validation/config/config.c b/test/validation/config/config.c index a54d51ec0..f957150cf 100644 --- a/test/validation/config/config.c +++ b/test/validation/config/config.c @@ -40,21 +40,23 @@ void config_test(void) CU_ASSERT(odp_config_shm_blocks() == ODP_CONFIG_SHM_BLOCKS); } -CU_TestInfo config_suite[] = { - _CU_TEST_INFO(config_test), - CU_TEST_INFO_NULL, +odp_testinfo_t config_suite[] = { + ODP_TEST_INFO(config_test), + ODP_TEST_INFO_NULL, }; -CU_SuiteInfo config_suites[] = { - { .pName = "config tests", - .pTests = config_suite, - .pInitFunc = config_suite_init, - .pCleanupFunc = config_suite_term, - }, - CU_SUITE_INFO_NULL, +odp_suiteinfo_t config_suites[] = { + {"config tests", config_suite_init,config_suite_term, + config_suite}, + ODP_SUITE_INFO_NULL, }; int config_main(void) { - return odp_cunit_run(config_suites); + int ret = odp_cunit_register(config_suites); + + if (ret == 0) + ret = odp_cunit_run(); + + return ret; } diff --git a/test/validation/config/config.h b/test/validation/config/config.h index 95c1631da..55cb5399c 100644 --- a/test/validation/config/config.h +++ b/test/validation/config/config.h @@ -7,20 +7,20 @@ #ifndef _ODP_TEST_CONFIG_H_ #define _ODP_TEST_CONFIG_H_ -#include <CUnit/Basic.h> +#include <odp_cunit_common.h> /* test functions: */ void config_test(void); /* test arrays: */ -extern CU_TestInfo config_suite[]; +extern odp_testinfo_t config_suite[]; /* test array init/term functions: */ int config_suite_init(void); int config_suite_term(void); /* test registry: */ -extern CU_SuiteInfo config_suites[]; +extern odp_suiteinfo_t config_suites[]; /* main test program: */ int config_main(void); diff --git a/test/validation/cpumask/cpumask.c b/test/validation/cpumask/cpumask.c index d09744a0f..2419f47dc 100644 --- a/test/validation/cpumask/cpumask.c +++ b/test/validation/cpumask/cpumask.c @@ -72,34 +72,39 @@ void cpumask_test_odp_cpumask_def(void) CU_ASSERT(num_worker > 0); } -CU_TestInfo cpumask_suite[] = { - _CU_TEST_INFO(cpumask_test_odp_cpumask_to_from_str), - _CU_TEST_INFO(cpumask_test_odp_cpumask_equal), - _CU_TEST_INFO(cpumask_test_odp_cpumask_zero), - _CU_TEST_INFO(cpumask_test_odp_cpumask_set), - _CU_TEST_INFO(cpumask_test_odp_cpumask_clr), - _CU_TEST_INFO(cpumask_test_odp_cpumask_isset), - _CU_TEST_INFO(cpumask_test_odp_cpumask_count), - _CU_TEST_INFO(cpumask_test_odp_cpumask_and), - _CU_TEST_INFO(cpumask_test_odp_cpumask_or), - _CU_TEST_INFO(cpumask_test_odp_cpumask_xor), - _CU_TEST_INFO(cpumask_test_odp_cpumask_copy), - _CU_TEST_INFO(cpumask_test_odp_cpumask_first), - _CU_TEST_INFO(cpumask_test_odp_cpumask_last), - _CU_TEST_INFO(cpumask_test_odp_cpumask_next), - _CU_TEST_INFO(cpumask_test_odp_cpumask_setall), - _CU_TEST_INFO(cpumask_test_odp_cpumask_def_control), - _CU_TEST_INFO(cpumask_test_odp_cpumask_def_worker), - _CU_TEST_INFO(cpumask_test_odp_cpumask_def), - CU_TEST_INFO_NULL, +odp_testinfo_t cpumask_suite[] = { + ODP_TEST_INFO(cpumask_test_odp_cpumask_to_from_str), + ODP_TEST_INFO(cpumask_test_odp_cpumask_equal), + ODP_TEST_INFO(cpumask_test_odp_cpumask_zero), + ODP_TEST_INFO(cpumask_test_odp_cpumask_set), + ODP_TEST_INFO(cpumask_test_odp_cpumask_clr), + ODP_TEST_INFO(cpumask_test_odp_cpumask_isset), + ODP_TEST_INFO(cpumask_test_odp_cpumask_count), + ODP_TEST_INFO(cpumask_test_odp_cpumask_and), + ODP_TEST_INFO(cpumask_test_odp_cpumask_or), + ODP_TEST_INFO(cpumask_test_odp_cpumask_xor), + ODP_TEST_INFO(cpumask_test_odp_cpumask_copy), + ODP_TEST_INFO(cpumask_test_odp_cpumask_first), + ODP_TEST_INFO(cpumask_test_odp_cpumask_last), + ODP_TEST_INFO(cpumask_test_odp_cpumask_next), + ODP_TEST_INFO(cpumask_test_odp_cpumask_setall), + ODP_TEST_INFO(cpumask_test_odp_cpumask_def_control), + ODP_TEST_INFO(cpumask_test_odp_cpumask_def_worker), + ODP_TEST_INFO(cpumask_test_odp_cpumask_def), + ODP_TEST_INFO_NULL, }; -CU_SuiteInfo cpumask_suites[] = { - {"Cpumask", NULL, NULL, NULL, NULL, cpumask_suite}, - CU_SUITE_INFO_NULL, +odp_suiteinfo_t cpumask_suites[] = { + {"Cpumask", NULL, NULL, cpumask_suite}, + ODP_SUITE_INFO_NULL, }; int cpumask_main(void) { - return odp_cunit_run(cpumask_suites); + int ret = odp_cunit_register(cpumask_suites); + + if (ret == 0) + ret = odp_cunit_run(); + + return ret; } diff --git a/test/validation/cpumask/cpumask.h b/test/validation/cpumask/cpumask.h index 7a58b5d0e..c6f9cde9d 100644 --- a/test/validation/cpumask/cpumask.h +++ b/test/validation/cpumask/cpumask.h @@ -8,7 +8,7 @@ #define _ODP_TEST_CPUMASK_H_ #include <odp.h> -#include <CUnit/Basic.h> +#include <odp_cunit_common.h> /* test functions: */ #include "mask_common.h" @@ -17,10 +17,10 @@ void cpumask_test_odp_cpumask_def_worker(void); void cpumask_test_odp_cpumask_def(void); /* test arrays: */ -extern CU_TestInfo cpumask_suite[]; +extern odp_testinfo_t cpumask_suite[]; /* test registry: */ -extern CU_SuiteInfo cpumask_suites[]; +extern odp_suiteinfo_t cpumask_suites[]; /* main test program: */ int cpumask_main(void); diff --git a/test/validation/crypto/crypto.c b/test/validation/crypto/crypto.c index cad660163..9229cab95 100644 --- a/test/validation/crypto/crypto.c +++ b/test/validation/crypto/crypto.c @@ -5,7 +5,7 @@ */ #include <odp.h> -#include "odp_cunit_common.h" +#include <odp_cunit_common.h> #include "odp_crypto_test_inp.h" #include "crypto.h" @@ -15,12 +15,10 @@ #define SHM_COMPL_POOL_SIZE (128 * 1024) #define SHM_COMPL_POOL_BUF_SIZE 128 -CU_SuiteInfo crypto_suites[] = { - {ODP_CRYPTO_SYNC_INP, crypto_suite_sync_init, NULL, NULL, NULL, - crypto_suite}, - {ODP_CRYPTO_ASYNC_INP, crypto_suite_async_init, NULL, NULL, NULL, - crypto_suite}, - CU_SUITE_INFO_NULL, +odp_suiteinfo_t crypto_suites[] = { + {ODP_CRYPTO_SYNC_INP, crypto_suite_sync_init, NULL, crypto_suite}, + {ODP_CRYPTO_ASYNC_INP, crypto_suite_async_init, NULL, crypto_suite}, + ODP_SUITE_INFO_NULL, }; int crypto_init(void) @@ -96,7 +94,15 @@ int crypto_term(void) int crypto_main(void) { + int ret; + odp_cunit_register_global_init(crypto_init); odp_cunit_register_global_term(crypto_term); - return odp_cunit_run(crypto_suites); + + ret = odp_cunit_register(crypto_suites); + + if (ret == 0) + ret = odp_cunit_run(); + + return ret; } diff --git a/test/validation/crypto/crypto.h b/test/validation/crypto/crypto.h index 41dd4ed7d..7cb60d4a7 100644 --- a/test/validation/crypto/crypto.h +++ b/test/validation/crypto/crypto.h @@ -7,7 +7,7 @@ #ifndef _ODP_TEST_CRYPTO_H_ #define _ODP_TEST_CRYPTO_H_ -#include <CUnit/Basic.h> +#include "odp_cunit_common.h" /* test functions: */ void crypto_test_enc_alg_3des_cbc(void); @@ -17,14 +17,14 @@ void crypto_test_dec_alg_3des_cbc_ovr_iv(void); void crypto_test_alg_hmac_md5(void); /* test arrays: */ -extern CU_TestInfo crypto_suite[]; +extern odp_testinfo_t crypto_suite[]; /* test array init/term functions: */ int crypto_suite_sync_init(void); int crypto_suite_async_init(void); /* test registry: */ -extern CU_SuiteInfo crypto_suites[]; +extern odp_suiteinfo_t crypto_suites[]; /* executable init/term functions: */ int crypto_init(void); diff --git a/test/validation/crypto/odp_crypto_test_inp.c b/test/validation/crypto/odp_crypto_test_inp.c index 187a04c28..69325a4a7 100644 --- a/test/validation/crypto/odp_crypto_test_inp.c +++ b/test/validation/crypto/odp_crypto_test_inp.c @@ -319,11 +319,11 @@ int crypto_suite_async_init(void) return 0; } -CU_TestInfo crypto_suite[] = { - _CU_TEST_INFO(crypto_test_enc_alg_3des_cbc), - _CU_TEST_INFO(crypto_test_dec_alg_3des_cbc), - _CU_TEST_INFO(crypto_test_enc_alg_3des_cbc_ovr_iv), - _CU_TEST_INFO(crypto_test_dec_alg_3des_cbc_ovr_iv), - _CU_TEST_INFO(crypto_test_alg_hmac_md5), - CU_TEST_INFO_NULL, +odp_testinfo_t crypto_suite[] = { + ODP_TEST_INFO(crypto_test_enc_alg_3des_cbc), + ODP_TEST_INFO(crypto_test_dec_alg_3des_cbc), + ODP_TEST_INFO(crypto_test_enc_alg_3des_cbc_ovr_iv), + ODP_TEST_INFO(crypto_test_dec_alg_3des_cbc_ovr_iv), + ODP_TEST_INFO(crypto_test_alg_hmac_md5), + ODP_TEST_INFO_NULL, }; diff --git a/test/validation/crypto/odp_crypto_test_inp.h b/test/validation/crypto/odp_crypto_test_inp.h index d46994fb7..8bda34472 100644 --- a/test/validation/crypto/odp_crypto_test_inp.h +++ b/test/validation/crypto/odp_crypto_test_inp.h @@ -6,14 +6,14 @@ #ifndef ODP_CRYPTO_TEST_ASYNC_INP_ #define ODP_CRYPTO_TEST_ASYNC_INP_ -#include "CUnit/TestDB.h" +#include <odp_cunit_common.h> /* Suite names */ #define ODP_CRYPTO_ASYNC_INP "odp_crypto_async_inp" #define ODP_CRYPTO_SYNC_INP "odp_crypto_sync_inp" /* Suite test array */ -extern CU_TestInfo crypto_suite[]; +extern odp_testinfo_t crypto_suite[]; int crypto_suite_sync_init(void); int crypto_suite_async_init(void); diff --git a/test/validation/errno/errno.c b/test/validation/errno/errno.c index c4f4aabee..d0e2128c6 100644 --- a/test/validation/errno/errno.c +++ b/test/validation/errno/errno.c @@ -19,17 +19,22 @@ void errno_test_odp_errno_sunny_day(void) CU_ASSERT_PTR_NOT_NULL(odp_errno_str(my_errno)); } -CU_TestInfo errno_suite[] = { - _CU_TEST_INFO(errno_test_odp_errno_sunny_day), - CU_TEST_INFO_NULL, +odp_testinfo_t errno_suite[] = { + ODP_TEST_INFO(errno_test_odp_errno_sunny_day), + ODP_TEST_INFO_NULL, }; -CU_SuiteInfo errno_suites[] = { - {"Errno", NULL, NULL, NULL, NULL, errno_suite}, - CU_SUITE_INFO_NULL, +odp_suiteinfo_t errno_suites[] = { + {"Errno", NULL, NULL, errno_suite}, + ODP_SUITE_INFO_NULL, }; int errno_main(void) { - return odp_cunit_run(errno_suites); + int ret = odp_cunit_register(errno_suites); + + if (ret == 0) + ret = odp_cunit_run(); + + return ret; } diff --git a/test/validation/errno/errno.h b/test/validation/errno/errno.h index 374a3c96a..3e217b5d4 100644 --- a/test/validation/errno/errno.h +++ b/test/validation/errno/errno.h @@ -7,16 +7,16 @@ #ifndef _ODP_TEST_ERRNO_H_ #define _ODP_TEST_ERRNO_H_ -#include <CUnit/Basic.h> +#include <odp_cunit_common.h> /* test functions: */ void errno_test_odp_errno_sunny_day(void); /* test arrays: */ -extern CU_TestInfo errno_suite[]; +extern odp_testinfo_t errno_suite[]; /* test registry: */ -extern CU_SuiteInfo errno_suites[]; +extern odp_suiteinfo_t errno_suites[]; /* main test program: */ int errno_main(void); diff --git a/test/validation/hash/hash.c b/test/validation/hash/hash.c index d2dfbf231..11b331e28 100644 --- a/test/validation/hash/hash.c +++ b/test/validation/hash/hash.c @@ -27,17 +27,23 @@ void hash_test_crc32c(void) CU_ASSERT(ret == 0xe6e910b0); } -CU_TestInfo hash_suite[] = { - _CU_TEST_INFO(hash_test_crc32c), - CU_TEST_INFO_NULL, +odp_testinfo_t hash_suite[] = { + ODP_TEST_INFO(hash_test_crc32c), + ODP_TEST_INFO_NULL, }; -CU_SuiteInfo hash_suites[] = { - {"Hash", NULL, NULL, NULL, NULL, hash_suite}, - CU_SUITE_INFO_NULL, +odp_suiteinfo_t hash_suites[] = { + {"Hash", NULL, NULL, hash_suite}, + ODP_SUITE_INFO_NULL }; int hash_main(void) { - return odp_cunit_run(hash_suites); + int ret = odp_cunit_register(hash_suites); + + if (ret == 0) + ret = odp_cunit_run(); + + return ret; + } diff --git a/test/validation/hash/hash.h b/test/validation/hash/hash.h index ea0e444bb..46c74660d 100644 --- a/test/validation/hash/hash.h +++ b/test/validation/hash/hash.h @@ -7,16 +7,16 @@ #ifndef _ODP_TEST_HASH_H_ #define _ODP_TEST_HASH_H_ -#include <CUnit/Basic.h> +#include <odp_cunit_common.h> /* test functions: */ void hash_test_crc32c(void); /* test arrays: */ -extern CU_TestInfo hash_suite[]; +extern odp_testinfo_t hash_suite[]; /* test registry: */ -extern CU_SuiteInfo hash_suites[]; +extern odp_suiteinfo_t hash_suites[]; /* main test program: */ int hash_main(void); diff --git a/test/validation/hash/hash_main b/test/validation/hash/hash_main Binary files differnew file mode 100755 index 000000000..e938ffc56 --- /dev/null +++ b/test/validation/hash/hash_main diff --git a/test/validation/init/init.c b/test/validation/init/init.c index 3a04fc9c8..a8a564063 100644 --- a/test/validation/init/init.c +++ b/test/validation/init/init.c @@ -8,7 +8,6 @@ #include <stdlib.h> #include <odp.h> #include <CUnit/Basic.h> -#include "odp_cunit_common.h" #include "init.h" /* flag set when the replacement logging function is used */ @@ -37,14 +36,14 @@ void init_test_odp_init_global_replace_abort(void) CU_ASSERT(status == 0); } -CU_TestInfo init_suite_abort[] = { - _CU_TEST_INFO(init_test_odp_init_global_replace_abort), - CU_TEST_INFO_NULL, +odp_testinfo_t init_suite_abort[] = { + ODP_TEST_INFO(init_test_odp_init_global_replace_abort), + ODP_TEST_INFO_NULL, }; -CU_SuiteInfo init_suites_abort[] = { - {"Init", NULL, NULL, NULL, NULL, init_suite_abort}, - CU_SUITE_INFO_NULL, +odp_suiteinfo_t init_suites_abort[] = { + {"Init", NULL, NULL, init_suite_abort}, + ODP_SUITE_INFO_NULL, }; static void odp_init_abort(void) @@ -54,12 +53,19 @@ static void odp_init_abort(void) int init_main_abort(void) { + int ret; + /* prevent default ODP init: */ odp_cunit_register_global_init(NULL); odp_cunit_register_global_term(NULL); /* run the tests: */ - return odp_cunit_run(init_suites_abort); + ret = odp_cunit_register(init_suites_abort); + + if (ret == 0) + ret = odp_cunit_run(); + + return ret; } /* test ODP global init, with alternate log function */ @@ -82,14 +88,14 @@ void init_test_odp_init_global_replace_log(void) CU_ASSERT(status == 0); } -CU_TestInfo init_suite_log[] = { - _CU_TEST_INFO(init_test_odp_init_global_replace_log), - CU_TEST_INFO_NULL, +odp_testinfo_t init_suite_log[] = { + ODP_TEST_INFO(init_test_odp_init_global_replace_log), + ODP_TEST_INFO_NULL, }; -CU_SuiteInfo init_suites_log[] = { - {"Init", NULL, NULL, NULL, NULL, init_suite_log}, - CU_SUITE_INFO_NULL, +odp_suiteinfo_t init_suites_log[] = { + {"Init", NULL, NULL, init_suite_log}, + ODP_SUITE_INFO_NULL, }; static int odp_init_log(odp_log_level_e level __attribute__((unused)), @@ -110,12 +116,20 @@ static int odp_init_log(odp_log_level_e level __attribute__((unused)), int init_main_log(void) { + int ret; + /* prevent default ODP init: */ odp_cunit_register_global_init(NULL); odp_cunit_register_global_term(NULL); + /* register the tests: */ + ret = odp_cunit_register(init_suites_log); + /* run the tests: */ - return odp_cunit_run(init_suites_log); + if (ret == 0) + ret = odp_cunit_run(); + + return ret; } /* test normal ODP global init */ @@ -130,22 +144,30 @@ void init_test_odp_init_global(void) CU_ASSERT(status == 0); } -CU_TestInfo init_suite_ok[] = { - _CU_TEST_INFO(init_test_odp_init_global), - CU_TEST_INFO_NULL, +odp_testinfo_t init_suite_ok[] = { + ODP_TEST_INFO(init_test_odp_init_global), + ODP_TEST_INFO_NULL, }; -CU_SuiteInfo init_suites_ok[] = { - {"Init", NULL, NULL, NULL, NULL, init_suite_ok}, - CU_SUITE_INFO_NULL, +odp_suiteinfo_t init_suites_ok[] = { + {"Init", NULL, NULL, init_suite_ok}, + ODP_SUITE_INFO_NULL, }; int init_main_ok(void) { + int ret; + /* prevent default ODP init: */ odp_cunit_register_global_init(NULL); odp_cunit_register_global_term(NULL); + /* register the tests: */ + ret = odp_cunit_register(init_suites_ok); + /* run the tests: */ - return odp_cunit_run(init_suites_ok); + if (ret == 0) + ret = odp_cunit_run(); + + return ret; } diff --git a/test/validation/init/init.h b/test/validation/init/init.h index 08f09e55c..272d42652 100644 --- a/test/validation/init/init.h +++ b/test/validation/init/init.h @@ -7,7 +7,7 @@ #ifndef _ODP_TEST_INIT_H_ #define _ODP_TEST_INIT_H_ -#include <CUnit/Basic.h> +#include <odp_cunit_common.h> /* test functions: */ void init_test_odp_init_global_replace_abort(void); @@ -15,14 +15,14 @@ void init_test_odp_init_global_replace_log(void); void init_test_odp_init_global(void); /* test arrays: */ -extern CU_TestInfo init_suite_abort[]; -extern CU_TestInfo init_suite_log[]; -extern CU_TestInfo init_suite_ok[]; +extern odp_testinfo_t init_suite_abort[]; +extern odp_testinfo_t init_suite_log[]; +extern odp_testinfo_t init_suite_ok[]; /* test registry: */ -extern CU_SuiteInfo init_suites_abort[]; -extern CU_SuiteInfo init_suites_log[]; -extern CU_SuiteInfo init_suites_ok[]; +extern odp_suiteinfo_t init_suites_abort[]; +extern odp_suiteinfo_t init_suites_log[]; +extern odp_suiteinfo_t init_suites_ok[]; /* main test program: */ int init_main_abort(void); diff --git a/test/validation/packet/packet.c b/test/validation/packet/packet.c index 0c749c377..1694293ce 100644 --- a/test/validation/packet/packet.c +++ b/test/validation/packet/packet.c @@ -7,7 +7,7 @@ #include <stdlib.h> #include <odp.h> -#include "odp_cunit_common.h" +#include <odp_cunit_common.h> #include "packet.h" #define PACKET_BUF_LEN ODP_CONFIG_PACKET_SEG_LEN_MIN @@ -778,38 +778,43 @@ void packet_test_offset(void) CU_ASSERT_PTR_NOT_NULL(ptr); } -CU_TestInfo packet_suite[] = { - _CU_TEST_INFO(packet_test_alloc_free), - _CU_TEST_INFO(packet_test_alloc_segmented), - _CU_TEST_INFO(packet_test_basic_metadata), - _CU_TEST_INFO(packet_test_debug), - _CU_TEST_INFO(packet_test_length), - _CU_TEST_INFO(packet_test_headroom), - _CU_TEST_INFO(packet_test_tailroom), - _CU_TEST_INFO(packet_test_context), - _CU_TEST_INFO(packet_test_event_conversion), - _CU_TEST_INFO(packet_test_layer_offsets), - _CU_TEST_INFO(packet_test_segments), - _CU_TEST_INFO(packet_test_segment_last), - _CU_TEST_INFO(packet_test_in_flags), - _CU_TEST_INFO(packet_test_error_flags), - _CU_TEST_INFO(packet_test_add_rem_data), - _CU_TEST_INFO(packet_test_copy), - _CU_TEST_INFO(packet_test_copydata), - _CU_TEST_INFO(packet_test_offset), - CU_TEST_INFO_NULL, +odp_testinfo_t packet_suite[] = { + ODP_TEST_INFO(packet_test_alloc_free), + ODP_TEST_INFO(packet_test_alloc_segmented), + ODP_TEST_INFO(packet_test_basic_metadata), + ODP_TEST_INFO(packet_test_debug), + ODP_TEST_INFO(packet_test_length), + ODP_TEST_INFO(packet_test_headroom), + ODP_TEST_INFO(packet_test_tailroom), + ODP_TEST_INFO(packet_test_context), + ODP_TEST_INFO(packet_test_event_conversion), + ODP_TEST_INFO(packet_test_layer_offsets), + ODP_TEST_INFO(packet_test_segments), + ODP_TEST_INFO(packet_test_segment_last), + ODP_TEST_INFO(packet_test_in_flags), + ODP_TEST_INFO(packet_test_error_flags), + ODP_TEST_INFO(packet_test_add_rem_data), + ODP_TEST_INFO(packet_test_copy), + ODP_TEST_INFO(packet_test_copydata), + ODP_TEST_INFO(packet_test_offset), + ODP_TEST_INFO_NULL, }; -CU_SuiteInfo packet_suites[] = { +odp_suiteinfo_t packet_suites[] = { { .pName = "packet tests", .pTests = packet_suite, .pInitFunc = packet_suite_init, .pCleanupFunc = packet_suite_term, }, - CU_SUITE_INFO_NULL, + ODP_SUITE_INFO_NULL, }; int packet_main(void) { - return odp_cunit_run(packet_suites); + int ret = odp_cunit_register(packet_suites); + + if (ret == 0) + ret = odp_cunit_run(); + + return ret; } diff --git a/test/validation/packet/packet.h b/test/validation/packet/packet.h index f8a16a8e2..096a1e2b1 100644 --- a/test/validation/packet/packet.h +++ b/test/validation/packet/packet.h @@ -7,7 +7,7 @@ #ifndef _ODP_TEST_PACKET_H_ #define _ODP_TEST_PACKET_H_ -#include <CUnit/Basic.h> +#include <odp_cunit_common.h> /* test functions: */ void packet_test_alloc_free(void); @@ -30,14 +30,14 @@ void packet_test_copydata(void); void packet_test_offset(void); /* test arrays: */ -extern CU_TestInfo packet_suite[]; +extern odp_testinfo_t packet_suite[]; /* test array init/term functions: */ int packet_suite_init(void); int packet_suite_term(void); /* test registry: */ -extern CU_SuiteInfo packet_suites[]; +extern odp_suiteinfo_t packet_suites[]; /* main test program: */ int packet_main(void); diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c index 26ff4cd42..a746b9aab 100644 --- a/test/validation/pktio/pktio.c +++ b/test/validation/pktio/pktio.c @@ -520,7 +520,9 @@ void pktio_test_mtu(void) { int ret; int mtu; + odp_pktio_t pktio = create_pktio(iface_name[0], ODP_QUEUE_TYPE_SCHED, 0); + CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); mtu = odp_pktio_mtu(pktio); CU_ASSERT(mtu > 0); @@ -534,7 +536,9 @@ void pktio_test_mtu(void) void pktio_test_promisc(void) { int ret; + odp_pktio_t pktio = create_pktio(iface_name[0], ODP_QUEUE_TYPE_SCHED, 0); + CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); ret = odp_pktio_promisc_mode_set(pktio, 1); CU_ASSERT(0 == ret); @@ -562,6 +566,7 @@ void pktio_test_mac(void) odp_pktio_t pktio; pktio = create_pktio(iface_name[0], ODP_QUEUE_TYPE_SCHED, 0); + CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); printf("testing mac for %s\n", iface_name[0]); @@ -589,7 +594,7 @@ void pktio_test_inq_remdef(void) int i; pktio = create_pktio(iface_name[0], ODP_QUEUE_TYPE_SCHED, 0); - CU_ASSERT(pktio != ODP_PKTIO_INVALID); + CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); CU_ASSERT(create_inq(pktio, ODP_QUEUE_TYPE_POLL) == 0); inq = odp_pktio_inq_getdef(pktio); CU_ASSERT(inq != ODP_QUEUE_INVALID); @@ -617,7 +622,7 @@ void pktio_test_open(void) /* test the sequence open->close->open->close() */ for (i = 0; i < 2; ++i) { pktio = create_pktio(iface_name[0], ODP_QUEUE_TYPE_SCHED, 0); - CU_ASSERT(pktio != ODP_PKTIO_INVALID); + CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); CU_ASSERT(odp_pktio_close(pktio) == 0); } @@ -656,7 +661,7 @@ void pktio_test_inq(void) odp_pktio_t pktio; pktio = create_pktio(iface_name[0], ODP_QUEUE_TYPE_SCHED, 0); - CU_ASSERT(pktio != ODP_PKTIO_INVALID); + CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); CU_ASSERT(create_inq(pktio, ODP_QUEUE_TYPE_POLL) == 0); CU_ASSERT(destroy_inq(pktio) == 0); @@ -675,7 +680,7 @@ static void pktio_test_start_stop(void) for (i = 0; i < num_ifaces; i++) { pktio[i] = create_pktio(iface_name[i], ODP_QUEUE_TYPE_SCHED, 0); - CU_ASSERT(pktio[i] != ODP_PKTIO_INVALID); + CU_ASSERT_FATAL(pktio[i] != ODP_PKTIO_INVALID); create_inq(pktio[i], ODP_QUEUE_TYPE_SCHED); } @@ -790,7 +795,8 @@ static int create_pool(const char *iface, int num) pool[num] = odp_pool_create(pool_name, ¶ms); if (ODP_POOL_INVALID == pool[num]) { - CU_FAIL("unable to create pool"); + fprintf(stderr, "%s: failed to create pool: %d", + __func__, odp_errno()); return -1; } @@ -871,41 +877,46 @@ int pktio_suite_term(void) return ret; } -CU_TestInfo pktio_suite_unsegmented[] = { - _CU_TEST_INFO(pktio_test_open), - _CU_TEST_INFO(pktio_test_lookup), - _CU_TEST_INFO(pktio_test_inq), - _CU_TEST_INFO(pktio_test_poll_queue), - _CU_TEST_INFO(pktio_test_poll_multi), - _CU_TEST_INFO(pktio_test_sched_queue), - _CU_TEST_INFO(pktio_test_sched_multi), - _CU_TEST_INFO(pktio_test_jumbo), - _CU_TEST_INFO(pktio_test_mtu), - _CU_TEST_INFO(pktio_test_promisc), - _CU_TEST_INFO(pktio_test_mac), - _CU_TEST_INFO(pktio_test_inq_remdef), - _CU_TEST_INFO(pktio_test_start_stop), - CU_TEST_INFO_NULL +odp_testinfo_t pktio_suite_unsegmented[] = { + ODP_TEST_INFO(pktio_test_open), + ODP_TEST_INFO(pktio_test_lookup), + ODP_TEST_INFO(pktio_test_inq), + ODP_TEST_INFO(pktio_test_poll_queue), + ODP_TEST_INFO(pktio_test_poll_multi), + ODP_TEST_INFO(pktio_test_sched_queue), + ODP_TEST_INFO(pktio_test_sched_multi), + ODP_TEST_INFO(pktio_test_jumbo), + ODP_TEST_INFO(pktio_test_mtu), + ODP_TEST_INFO(pktio_test_promisc), + ODP_TEST_INFO(pktio_test_mac), + ODP_TEST_INFO(pktio_test_inq_remdef), + ODP_TEST_INFO(pktio_test_start_stop), + ODP_TEST_INFO_NULL }; -CU_TestInfo pktio_suite_segmented[] = { - {"pktio poll queues", pktio_test_poll_queue}, - {"pktio poll multi", pktio_test_poll_multi}, - {"pktio sched queues", pktio_test_sched_queue}, - {"pktio sched multi", pktio_test_sched_multi}, - {"pktio jumbo frames", pktio_test_jumbo}, - CU_TEST_INFO_NULL +odp_testinfo_t pktio_suite_segmented[] = { + ODP_TEST_INFO(pktio_test_poll_queue), + ODP_TEST_INFO(pktio_test_poll_multi), + ODP_TEST_INFO(pktio_test_sched_queue), + ODP_TEST_INFO(pktio_test_sched_multi), + ODP_TEST_INFO(pktio_test_jumbo), + ODP_TEST_INFO_NULL }; -CU_SuiteInfo pktio_suites[] = { +odp_suiteinfo_t pktio_suites[] = { {"Packet I/O Unsegmented", pktio_suite_init_unsegmented, - pktio_suite_term, NULL, NULL, pktio_suite_unsegmented}, + pktio_suite_term, pktio_suite_unsegmented}, {"Packet I/O Segmented", pktio_suite_init_segmented, - pktio_suite_term, NULL, NULL, pktio_suite_segmented}, - CU_SUITE_INFO_NULL + pktio_suite_term, pktio_suite_segmented}, + ODP_SUITE_INFO_NULL }; int pktio_main(void) { - return odp_cunit_run(pktio_suites); + int ret = odp_cunit_register(pktio_suites); + + if (ret == 0) + ret = odp_cunit_run(); + + return ret; } diff --git a/test/validation/pktio/pktio.h b/test/validation/pktio/pktio.h index feaf7fb70..2928dbe2b 100644 --- a/test/validation/pktio/pktio.h +++ b/test/validation/pktio/pktio.h @@ -7,7 +7,7 @@ #ifndef _ODP_TEST_PKTIO_H_ #define _ODP_TEST_PKTIO_H_ -#include <CUnit/Basic.h> +#include <odp_cunit_common.h> /* test functions: */ void pktio_test_poll_queue(void); @@ -24,7 +24,7 @@ void pktio_test_lookup(void); void pktio_test_inq(void); /* test arrays: */ -extern CU_TestInfo pktio_suite[]; +extern odp_testinfo_t pktio_suite[]; /* test array init/term functions: */ int pktio_suite_term(void); @@ -32,7 +32,7 @@ int pktio_suite_init_segmented(void); int pktio_suite_init_unsegmented(void); /* test registry: */ -extern CU_SuiteInfo pktio_suites[]; +extern odp_suiteinfo_t pktio_suites[]; /* main test program: */ int pktio_main(void); diff --git a/test/validation/pool/pool.c b/test/validation/pool/pool.c index 44ba155c6..bca210aa4 100644 --- a/test/validation/pool/pool.c +++ b/test/validation/pool/pool.c @@ -99,22 +99,27 @@ void pool_test_lookup_info_print(void) CU_ASSERT(odp_pool_destroy(pool) == 0); } -CU_TestInfo pool_suite[] = { - _CU_TEST_INFO(pool_test_create_destroy_buffer), - _CU_TEST_INFO(pool_test_create_destroy_packet), - _CU_TEST_INFO(pool_test_create_destroy_timeout), - _CU_TEST_INFO(pool_test_lookup_info_print), - CU_TEST_INFO_NULL, +odp_testinfo_t pool_suite[] = { + ODP_TEST_INFO(pool_test_create_destroy_buffer), + ODP_TEST_INFO(pool_test_create_destroy_packet), + ODP_TEST_INFO(pool_test_create_destroy_timeout), + ODP_TEST_INFO(pool_test_lookup_info_print), + ODP_TEST_INFO_NULL, }; -CU_SuiteInfo pool_suites[] = { +odp_suiteinfo_t pool_suites[] = { { .pName = "Pool tests", .pTests = pool_suite, }, - CU_SUITE_INFO_NULL, + ODP_SUITE_INFO_NULL, }; int pool_main(void) { - return odp_cunit_run(pool_suites); + int ret = odp_cunit_register(pool_suites); + + if (ret == 0) + ret = odp_cunit_run(); + + return ret; } diff --git a/test/validation/pool/pool.h b/test/validation/pool/pool.h index 12c6193d8..6a83a2e72 100644 --- a/test/validation/pool/pool.h +++ b/test/validation/pool/pool.h @@ -7,7 +7,7 @@ #ifndef _ODP_TEST_POOL_H_ #define _ODP_TEST_POOL_H_ -#include <CUnit/Basic.h> +#include <odp_cunit_common.h> /* test functions: */ void pool_test_create_destroy_buffer(void); @@ -17,10 +17,10 @@ void pool_test_create_destroy_buffer_shm(void); void pool_test_lookup_info_print(void); /* test arrays: */ -extern CU_TestInfo pool_suite[]; +extern odp_testinfo_t pool_suite[]; /* test registry: */ -extern CU_SuiteInfo pool_suites[]; +extern odp_suiteinfo_t pool_suites[]; /* main test program: */ int pool_main(void); diff --git a/test/validation/queue/queue.c b/test/validation/queue/queue.c index 02a553817..98da2ec0c 100644 --- a/test/validation/queue/queue.c +++ b/test/validation/queue/queue.c @@ -125,18 +125,22 @@ void queue_test_sunnydays(void) CU_ASSERT(odp_queue_destroy(queue_id) == 0); } -CU_TestInfo queue_suite[] = { - _CU_TEST_INFO(queue_test_sunnydays), - CU_TEST_INFO_NULL, +odp_testinfo_t queue_suite[] = { + ODP_TEST_INFO(queue_test_sunnydays), + ODP_TEST_INFO_NULL, }; -CU_SuiteInfo queue_suites[] = { - {"Queue", queue_suite_init, queue_suite_term, - NULL, NULL, queue_suite}, - CU_SUITE_INFO_NULL, +odp_suiteinfo_t queue_suites[] = { + {"Queue", queue_suite_init, queue_suite_term, queue_suite}, + ODP_SUITE_INFO_NULL, }; int queue_main(void) { - return odp_cunit_run(queue_suites); + int ret = odp_cunit_register(queue_suites); + + if (ret == 0) + ret = odp_cunit_run(); + + return ret; } diff --git a/test/validation/queue/queue.h b/test/validation/queue/queue.h index d2765ce46..5de7b2c23 100644 --- a/test/validation/queue/queue.h +++ b/test/validation/queue/queue.h @@ -7,20 +7,20 @@ #ifndef _ODP_TEST_QUEUE_H_ #define _ODP_TEST_QUEUE_H_ -#include <CUnit/Basic.h> +#include <odp_cunit_common.h> /* test functions: */ void queue_test_sunnydays(void); /* test arrays: */ -extern CU_TestInfo queue_suite[]; +extern odp_testinfo_t queue_suite[]; /* test array init/term functions: */ int queue_suite_init(void); int queue_suite_term(void); /* test registry: */ -extern CU_SuiteInfo queue_suites[]; +extern odp_suiteinfo_t queue_suites[]; /* main test program: */ int queue_main(void); diff --git a/test/validation/random/random.c b/test/validation/random/random.c index b6426f4c0..8ed594420 100644 --- a/test/validation/random/random.c +++ b/test/validation/random/random.c @@ -17,17 +17,22 @@ void random_test_get_size(void) CU_ASSERT(ret == sizeof(buf)); } -CU_TestInfo random_suite[] = { - _CU_TEST_INFO(random_test_get_size), - CU_TEST_INFO_NULL, +odp_testinfo_t random_suite[] = { + ODP_TEST_INFO(random_test_get_size), + ODP_TEST_INFO_NULL, }; -CU_SuiteInfo random_suites[] = { - {"Random", NULL, NULL, NULL, NULL, random_suite}, - CU_SUITE_INFO_NULL, +odp_suiteinfo_t random_suites[] = { + {"Random", NULL, NULL, random_suite}, + ODP_SUITE_INFO_NULL, }; int random_main(void) { - return odp_cunit_run(random_suites); + int ret = odp_cunit_register(random_suites); + + if (ret == 0) + ret = odp_cunit_run(); + + return ret; } diff --git a/test/validation/random/random.h b/test/validation/random/random.h index cda1843e4..4101ef17d 100644 --- a/test/validation/random/random.h +++ b/test/validation/random/random.h @@ -7,16 +7,16 @@ #ifndef _ODP_TEST_RANDOM_H_ #define _ODP_TEST_RANDOM_H_ -#include <CUnit/Basic.h> +#include <odp_cunit_common.h> /* test functions: */ void random_test_get_size(void); /* test arrays: */ -extern CU_TestInfo random_suite[]; +extern odp_testinfo_t random_suite[]; /* test registry: */ -extern CU_SuiteInfo random_suites[]; +extern odp_suiteinfo_t random_suites[]; /* main test program: */ int random_main(void); diff --git a/test/validation/scheduler/scheduler.c b/test/validation/scheduler/scheduler.c index 0c96dc3a3..89c1099c1 100644 --- a/test/validation/scheduler/scheduler.c +++ b/test/validation/scheduler/scheduler.c @@ -1130,49 +1130,54 @@ int scheduler_suite_term(void) return 0; } -CU_TestInfo scheduler_suite[] = { - _CU_TEST_INFO(scheduler_test_wait_time), - _CU_TEST_INFO(scheduler_test_num_prio), - _CU_TEST_INFO(scheduler_test_queue_destroy), - _CU_TEST_INFO(scheduler_test_groups), - _CU_TEST_INFO(scheduler_test_1q_1t_n), - _CU_TEST_INFO(scheduler_test_1q_1t_a), - _CU_TEST_INFO(scheduler_test_1q_1t_o), - _CU_TEST_INFO(scheduler_test_mq_1t_n), - _CU_TEST_INFO(scheduler_test_mq_1t_a), - _CU_TEST_INFO(scheduler_test_mq_1t_o), - _CU_TEST_INFO(scheduler_test_mq_1t_prio_n), - _CU_TEST_INFO(scheduler_test_mq_1t_prio_a), - _CU_TEST_INFO(scheduler_test_mq_1t_prio_o), - _CU_TEST_INFO(scheduler_test_mq_mt_prio_n), - _CU_TEST_INFO(scheduler_test_mq_mt_prio_a), - _CU_TEST_INFO(scheduler_test_mq_mt_prio_o), - _CU_TEST_INFO(scheduler_test_1q_mt_a_excl), - _CU_TEST_INFO(scheduler_test_multi_1q_1t_n), - _CU_TEST_INFO(scheduler_test_multi_1q_1t_a), - _CU_TEST_INFO(scheduler_test_multi_1q_1t_o), - _CU_TEST_INFO(scheduler_test_multi_mq_1t_n), - _CU_TEST_INFO(scheduler_test_multi_mq_1t_a), - _CU_TEST_INFO(scheduler_test_multi_mq_1t_o), - _CU_TEST_INFO(scheduler_test_multi_mq_1t_prio_n), - _CU_TEST_INFO(scheduler_test_multi_mq_1t_prio_a), - _CU_TEST_INFO(scheduler_test_multi_mq_1t_prio_o), - _CU_TEST_INFO(scheduler_test_multi_mq_mt_prio_n), - _CU_TEST_INFO(scheduler_test_multi_mq_mt_prio_a), - _CU_TEST_INFO(scheduler_test_multi_mq_mt_prio_o), - _CU_TEST_INFO(scheduler_test_multi_1q_mt_a_excl), - _CU_TEST_INFO(scheduler_test_pause_resume), - CU_TEST_INFO_NULL, +odp_testinfo_t scheduler_suite[] = { + ODP_TEST_INFO(scheduler_test_wait_time), + ODP_TEST_INFO(scheduler_test_num_prio), + ODP_TEST_INFO(scheduler_test_queue_destroy), + ODP_TEST_INFO(scheduler_test_groups), + ODP_TEST_INFO(scheduler_test_1q_1t_n), + ODP_TEST_INFO(scheduler_test_1q_1t_a), + ODP_TEST_INFO(scheduler_test_1q_1t_o), + ODP_TEST_INFO(scheduler_test_mq_1t_n), + ODP_TEST_INFO(scheduler_test_mq_1t_a), + ODP_TEST_INFO(scheduler_test_mq_1t_o), + ODP_TEST_INFO(scheduler_test_mq_1t_prio_n), + ODP_TEST_INFO(scheduler_test_mq_1t_prio_a), + ODP_TEST_INFO(scheduler_test_mq_1t_prio_o), + ODP_TEST_INFO(scheduler_test_mq_mt_prio_n), + ODP_TEST_INFO(scheduler_test_mq_mt_prio_a), + ODP_TEST_INFO(scheduler_test_mq_mt_prio_o), + ODP_TEST_INFO(scheduler_test_1q_mt_a_excl), + ODP_TEST_INFO(scheduler_test_multi_1q_1t_n), + ODP_TEST_INFO(scheduler_test_multi_1q_1t_a), + ODP_TEST_INFO(scheduler_test_multi_1q_1t_o), + ODP_TEST_INFO(scheduler_test_multi_mq_1t_n), + ODP_TEST_INFO(scheduler_test_multi_mq_1t_a), + ODP_TEST_INFO(scheduler_test_multi_mq_1t_o), + ODP_TEST_INFO(scheduler_test_multi_mq_1t_prio_n), + ODP_TEST_INFO(scheduler_test_multi_mq_1t_prio_a), + ODP_TEST_INFO(scheduler_test_multi_mq_1t_prio_o), + ODP_TEST_INFO(scheduler_test_multi_mq_mt_prio_n), + ODP_TEST_INFO(scheduler_test_multi_mq_mt_prio_a), + ODP_TEST_INFO(scheduler_test_multi_mq_mt_prio_o), + ODP_TEST_INFO(scheduler_test_multi_1q_mt_a_excl), + ODP_TEST_INFO(scheduler_test_pause_resume), + ODP_TEST_INFO_NULL, }; -CU_SuiteInfo scheduler_suites[] = { +odp_suiteinfo_t scheduler_suites[] = { {"Scheduler", - scheduler_suite_init, scheduler_suite_term, NULL, NULL, scheduler_suite + scheduler_suite_init, scheduler_suite_term, scheduler_suite }, - CU_SUITE_INFO_NULL, + ODP_SUITE_INFO_NULL, }; int scheduler_main(void) { - return odp_cunit_run(scheduler_suites); + int ret = odp_cunit_register(scheduler_suites); + + if (ret == 0) + ret = odp_cunit_run(); + + return ret; } diff --git a/test/validation/scheduler/scheduler.h b/test/validation/scheduler/scheduler.h index eab8787b7..c869e414f 100644 --- a/test/validation/scheduler/scheduler.h +++ b/test/validation/scheduler/scheduler.h @@ -7,7 +7,7 @@ #ifndef _ODP_TEST_SCHEDULER_H_ #define _ODP_TEST_SCHEDULER_H_ -#include <CUnit/Basic.h> +#include <odp_cunit_common.h> /* test functions: */ void scheduler_test_wait_time(void); @@ -43,14 +43,14 @@ void scheduler_test_multi_1q_mt_a_excl(void); void scheduler_test_pause_resume(void); /* test arrays: */ -extern CU_TestInfo scheduler_suite[]; +extern odp_testinfo_t scheduler_suite[]; /* test array init/term functions: */ int scheduler_suite_init(void); int scheduler_suite_term(void); /* test registry: */ -extern CU_SuiteInfo scheduler_suites[]; +extern odp_suiteinfo_t scheduler_suites[]; /* main test program: */ int scheduler_main(void); diff --git a/test/validation/shmem/shmem.c b/test/validation/shmem/shmem.c index 6dc579a39..5524b5cc1 100644 --- a/test/validation/shmem/shmem.c +++ b/test/validation/shmem/shmem.c @@ -76,17 +76,22 @@ void shmem_test_odp_shm_sunnyday(void) odp_cunit_thread_exit(&thrdarg); } -CU_TestInfo shmem_suite[] = { - _CU_TEST_INFO(shmem_test_odp_shm_sunnyday), - CU_TEST_INFO_NULL, +odp_testinfo_t shmem_suite[] = { + ODP_TEST_INFO(shmem_test_odp_shm_sunnyday), + ODP_TEST_INFO_NULL, }; -CU_SuiteInfo shmem_suites[] = { - {"Shared Memory", NULL, NULL, NULL, NULL, shmem_suite}, - CU_SUITE_INFO_NULL, +odp_suiteinfo_t shmem_suites[] = { + {"Shared Memory", NULL, NULL, shmem_suite}, + ODP_SUITE_INFO_NULL, }; int shmem_main(void) { - return odp_cunit_run(shmem_suites); + int ret = odp_cunit_register(shmem_suites); + + if (ret == 0) + ret = odp_cunit_run(); + + return ret; } diff --git a/test/validation/shmem/shmem.h b/test/validation/shmem/shmem.h index 8de0bc660..d60cf6482 100644 --- a/test/validation/shmem/shmem.h +++ b/test/validation/shmem/shmem.h @@ -7,16 +7,16 @@ #ifndef _ODP_TEST_SHMEM_H_ #define _ODP_TEST_SHMEM_H_ -#include <CUnit/Basic.h> +#include <odp_cunit_common.h> /* test functions: */ void shmem_test_odp_shm_sunnyday(void); /* test arrays: */ -extern CU_TestInfo shmem_suite[]; +extern odp_testinfo_t shmem_suite[]; /* test registry: */ -extern CU_SuiteInfo shmem_suites[]; +extern odp_suiteinfo_t shmem_suites[]; /* main test program: */ int shmem_main(void); diff --git a/test/validation/synchronizers/synchronizers.c b/test/validation/synchronizers/synchronizers.c index 47295c88a..2406c7706 100644 --- a/test/validation/synchronizers/synchronizers.c +++ b/test/validation/synchronizers/synchronizers.c @@ -942,10 +942,10 @@ void synchronizers_test_barrier_functional(void) odp_cunit_thread_exit(&arg); } -CU_TestInfo synchronizers_suite_barrier[] = { - _CU_TEST_INFO(synchronizers_test_no_barrier_functional), - _CU_TEST_INFO(synchronizers_test_barrier_functional), - CU_TEST_INFO_NULL +odp_testinfo_t synchronizers_suite_barrier[] = { + ODP_TEST_INFO(synchronizers_test_no_barrier_functional), + ODP_TEST_INFO(synchronizers_test_barrier_functional), + ODP_TEST_INFO_NULL }; /* Thread-unsafe tests */ @@ -958,9 +958,9 @@ void synchronizers_test_no_lock_functional(void) odp_cunit_thread_exit(&arg); } -CU_TestInfo synchronizers_suite_no_locking[] = { - _CU_TEST_INFO(synchronizers_test_no_lock_functional), - CU_TEST_INFO_NULL +odp_testinfo_t synchronizers_suite_no_locking[] = { + ODP_TEST_INFO(synchronizers_test_no_lock_functional), + ODP_TEST_INFO_NULL }; /* Spin lock tests */ @@ -983,10 +983,10 @@ void synchronizers_test_spinlock_functional(void) odp_cunit_thread_exit(&arg); } -CU_TestInfo synchronizers_suite_spinlock[] = { - _CU_TEST_INFO(synchronizers_test_spinlock_api), - _CU_TEST_INFO(synchronizers_test_spinlock_functional), - CU_TEST_INFO_NULL +odp_testinfo_t synchronizers_suite_spinlock[] = { + ODP_TEST_INFO(synchronizers_test_spinlock_api), + ODP_TEST_INFO(synchronizers_test_spinlock_functional), + ODP_TEST_INFO_NULL }; /* Ticket lock tests */ @@ -1010,10 +1010,10 @@ void synchronizers_test_ticketlock_functional(void) odp_cunit_thread_exit(&arg); } -CU_TestInfo synchronizers_suite_ticketlock[] = { - _CU_TEST_INFO(synchronizers_test_ticketlock_api), - _CU_TEST_INFO(synchronizers_test_ticketlock_functional), - CU_TEST_INFO_NULL +odp_testinfo_t synchronizers_suite_ticketlock[] = { + ODP_TEST_INFO(synchronizers_test_ticketlock_api), + ODP_TEST_INFO(synchronizers_test_ticketlock_functional), + ODP_TEST_INFO_NULL }; /* RW lock tests */ @@ -1036,10 +1036,10 @@ void synchronizers_test_rwlock_functional(void) odp_cunit_thread_exit(&arg); } -CU_TestInfo synchronizers_suite_rwlock[] = { - _CU_TEST_INFO(synchronizers_test_rwlock_api), - _CU_TEST_INFO(synchronizers_test_rwlock_functional), - CU_TEST_INFO_NULL +odp_testinfo_t synchronizers_suite_rwlock[] = { + ODP_TEST_INFO(synchronizers_test_rwlock_api), + ODP_TEST_INFO(synchronizers_test_rwlock_functional), + ODP_TEST_INFO_NULL }; int synchronizers_suite_init(void) @@ -1188,32 +1188,40 @@ void synchronizers_test_atomic_fetch_add_sub(void) test_atomic_functional(test_atomic_fetch_add_sub_thread); } -CU_TestInfo synchronizers_suite_atomic[] = { - _CU_TEST_INFO(synchronizers_test_atomic_inc_dec), - _CU_TEST_INFO(synchronizers_test_atomic_add_sub), - _CU_TEST_INFO(synchronizers_test_atomic_fetch_inc_dec), - _CU_TEST_INFO(synchronizers_test_atomic_fetch_add_sub), - CU_TEST_INFO_NULL, +odp_testinfo_t synchronizers_suite_atomic[] = { + ODP_TEST_INFO(synchronizers_test_atomic_inc_dec), + ODP_TEST_INFO(synchronizers_test_atomic_add_sub), + ODP_TEST_INFO(synchronizers_test_atomic_fetch_inc_dec), + ODP_TEST_INFO(synchronizers_test_atomic_fetch_add_sub), + ODP_TEST_INFO_NULL, }; -CU_SuiteInfo synchronizers_suites[] = { - {"barrier", NULL, - NULL, NULL, NULL, synchronizers_suite_barrier}, - {"nolocking", synchronizers_suite_init, - NULL, NULL, NULL, synchronizers_suite_no_locking}, - {"spinlock", synchronizers_suite_init, - NULL, NULL, NULL, synchronizers_suite_spinlock}, - {"ticketlock", synchronizers_suite_init, - NULL, NULL, NULL, synchronizers_suite_ticketlock}, - {"rwlock", synchronizers_suite_init, - NULL, NULL, NULL, synchronizers_suite_rwlock}, - {"atomic", NULL, NULL, NULL, NULL, - synchronizers_suite_atomic}, - CU_SUITE_INFO_NULL +odp_suiteinfo_t synchronizers_suites[] = { + {"barrier", NULL, NULL, + synchronizers_suite_barrier}, + {"nolocking", synchronizers_suite_init, NULL, + synchronizers_suite_no_locking}, + {"spinlock", synchronizers_suite_init, NULL, + synchronizers_suite_spinlock}, + {"ticketlock", synchronizers_suite_init, NULL, + synchronizers_suite_ticketlock}, + {"rwlock", synchronizers_suite_init, NULL, + synchronizers_suite_rwlock}, + {"atomic", NULL, NULL, + synchronizers_suite_atomic}, + ODP_SUITE_INFO_NULL }; int synchronizers_main(void) { + int ret; + odp_cunit_register_global_init(synchronizers_init); - return odp_cunit_run(synchronizers_suites); + + ret = odp_cunit_register(synchronizers_suites); + + if (ret == 0) + ret = odp_cunit_run(); + + return ret; } diff --git a/test/validation/synchronizers/synchronizers.h b/test/validation/synchronizers/synchronizers.h index 45b90e946..f16477cb9 100644 --- a/test/validation/synchronizers/synchronizers.h +++ b/test/validation/synchronizers/synchronizers.h @@ -7,7 +7,7 @@ #ifndef _ODP_TEST_SYNCHRONIZERS_H_ #define _ODP_TEST_SYNCHRONIZERS_H_ -#include <CUnit/Basic.h> +#include <odp_cunit_common.h> /* test functions: */ void synchronizers_test_no_barrier_functional(void); @@ -25,18 +25,18 @@ void synchronizers_test_atomic_fetch_inc_dec(void); void synchronizers_test_atomic_fetch_add_sub(void); /* test arrays: */ -extern CU_TestInfo synchronizers_suite_barrier[]; -extern CU_TestInfo synchronizers_suite_no_locking[]; -extern CU_TestInfo synchronizers_suite_spinlock[]; -extern CU_TestInfo synchronizers_suite_ticketlock[]; -extern CU_TestInfo synchronizers_suite_rwlock[]; -extern CU_TestInfo synchronizers_suite_atomic[]; +extern odp_testinfo_t synchronizers_suite_barrier[]; +extern odp_testinfo_t synchronizers_suite_no_locking[]; +extern odp_testinfo_t synchronizers_suite_spinlock[]; +extern odp_testinfo_t synchronizers_suite_ticketlock[]; +extern odp_testinfo_t synchronizers_suite_rwlock[]; +extern odp_testinfo_t synchronizers_suite_atomic[]; /* test array init/term functions: */ int synchronizers_suite_init(void); /* test registry: */ -extern CU_SuiteInfo synchronizers_suites[]; +extern odp_suiteinfo_t synchronizers_suites[]; /* executable init/term functions: */ int synchronizers_init(void); diff --git a/test/validation/system/system.c b/test/validation/system/system.c index eebeb52d9..171fb74e7 100644 --- a/test/validation/system/system.c +++ b/test/validation/system/system.c @@ -141,27 +141,32 @@ void system_test_odp_cpu_hz_max_id(void) } } -CU_TestInfo system_suite[] = { - _CU_TEST_INFO(system_test_odp_version_numbers), - _CU_TEST_INFO(system_test_odp_cpu_count), - _CU_TEST_INFO(system_test_odp_sys_cache_line_size), - _CU_TEST_INFO(system_test_odp_cpu_model_str), - _CU_TEST_INFO(system_test_odp_cpu_model_str_id), - _CU_TEST_INFO(system_test_odp_sys_page_size), - _CU_TEST_INFO(system_test_odp_sys_huge_page_size), - _CU_TEST_INFO(system_test_odp_cpu_hz), - _CU_TEST_INFO(system_test_odp_cpu_hz_id), - _CU_TEST_INFO(system_test_odp_cpu_hz_max), - _CU_TEST_INFO(system_test_odp_cpu_hz_max_id), - CU_TEST_INFO_NULL, +odp_testinfo_t system_suite[] = { + ODP_TEST_INFO(system_test_odp_version_numbers), + ODP_TEST_INFO(system_test_odp_cpu_count), + ODP_TEST_INFO(system_test_odp_sys_cache_line_size), + ODP_TEST_INFO(system_test_odp_cpu_model_str), + ODP_TEST_INFO(system_test_odp_cpu_model_str_id), + ODP_TEST_INFO(system_test_odp_sys_page_size), + ODP_TEST_INFO(system_test_odp_sys_huge_page_size), + ODP_TEST_INFO(system_test_odp_cpu_hz), + ODP_TEST_INFO(system_test_odp_cpu_hz_id), + ODP_TEST_INFO(system_test_odp_cpu_hz_max), + ODP_TEST_INFO(system_test_odp_cpu_hz_max_id), + ODP_TEST_INFO_NULL, }; -CU_SuiteInfo system_suites[] = { - {"System Info", NULL, NULL, NULL, NULL, system_suite}, - CU_SUITE_INFO_NULL, +odp_suiteinfo_t system_suites[] = { + {"System Info", NULL, NULL, system_suite}, + ODP_SUITE_INFO_NULL, }; int system_main(void) { - return odp_cunit_run(system_suites); + int ret = odp_cunit_register(system_suites); + + if (ret == 0) + ret = odp_cunit_run(); + + return ret; } diff --git a/test/validation/system/system.h b/test/validation/system/system.h index 4abe78ca9..13725db30 100644 --- a/test/validation/system/system.h +++ b/test/validation/system/system.h @@ -7,7 +7,7 @@ #ifndef _ODP_TEST_SYSTEM_H_ #define _ODP_TEST_SYSTEM_H_ -#include <CUnit/Basic.h> +#include <odp_cunit_common.h> /* test functions: */ void system_test_odp_version_numbers(void); @@ -23,10 +23,10 @@ void system_test_odp_cpu_hz_max(void); void system_test_odp_cpu_hz_max_id(void); /* test arrays: */ -extern CU_TestInfo system_suite[]; +extern odp_testinfo_t system_suite[]; /* test registry: */ -extern CU_SuiteInfo system_suites[]; +extern odp_suiteinfo_t system_suites[]; /* main test program: */ int system_main(void); diff --git a/test/validation/thread/thread.c b/test/validation/thread/thread.c index 093e68802..03bf3cd2d 100644 --- a/test/validation/thread/thread.c +++ b/test/validation/thread/thread.c @@ -95,35 +95,40 @@ void thread_test_odp_thrmask_control(void) CU_ASSERT(ret == 1); } -CU_TestInfo thread_suite[] = { - _CU_TEST_INFO(thread_test_odp_cpu_id), - _CU_TEST_INFO(thread_test_odp_thread_id), - _CU_TEST_INFO(thread_test_odp_thread_count), - _CU_TEST_INFO(thread_test_odp_thrmask_to_from_str), - _CU_TEST_INFO(thread_test_odp_thrmask_equal), - _CU_TEST_INFO(thread_test_odp_thrmask_zero), - _CU_TEST_INFO(thread_test_odp_thrmask_set), - _CU_TEST_INFO(thread_test_odp_thrmask_clr), - _CU_TEST_INFO(thread_test_odp_thrmask_isset), - _CU_TEST_INFO(thread_test_odp_thrmask_count), - _CU_TEST_INFO(thread_test_odp_thrmask_and), - _CU_TEST_INFO(thread_test_odp_thrmask_or), - _CU_TEST_INFO(thread_test_odp_thrmask_xor), - _CU_TEST_INFO(thread_test_odp_thrmask_copy), - _CU_TEST_INFO(thread_test_odp_thrmask_first), - _CU_TEST_INFO(thread_test_odp_thrmask_last), - _CU_TEST_INFO(thread_test_odp_thrmask_next), - _CU_TEST_INFO(thread_test_odp_thrmask_worker), - _CU_TEST_INFO(thread_test_odp_thrmask_control), - CU_TEST_INFO_NULL, +odp_testinfo_t thread_suite[] = { + ODP_TEST_INFO(thread_test_odp_cpu_id), + ODP_TEST_INFO(thread_test_odp_thread_id), + ODP_TEST_INFO(thread_test_odp_thread_count), + ODP_TEST_INFO(thread_test_odp_thrmask_to_from_str), + ODP_TEST_INFO(thread_test_odp_thrmask_equal), + ODP_TEST_INFO(thread_test_odp_thrmask_zero), + ODP_TEST_INFO(thread_test_odp_thrmask_set), + ODP_TEST_INFO(thread_test_odp_thrmask_clr), + ODP_TEST_INFO(thread_test_odp_thrmask_isset), + ODP_TEST_INFO(thread_test_odp_thrmask_count), + ODP_TEST_INFO(thread_test_odp_thrmask_and), + ODP_TEST_INFO(thread_test_odp_thrmask_or), + ODP_TEST_INFO(thread_test_odp_thrmask_xor), + ODP_TEST_INFO(thread_test_odp_thrmask_copy), + ODP_TEST_INFO(thread_test_odp_thrmask_first), + ODP_TEST_INFO(thread_test_odp_thrmask_last), + ODP_TEST_INFO(thread_test_odp_thrmask_next), + ODP_TEST_INFO(thread_test_odp_thrmask_worker), + ODP_TEST_INFO(thread_test_odp_thrmask_control), + ODP_TEST_INFO_NULL, }; -CU_SuiteInfo thread_suites[] = { - {"thread", NULL, NULL, NULL, NULL, thread_suite}, - CU_SUITE_INFO_NULL, +odp_suiteinfo_t thread_suites[] = { + {"thread", NULL, NULL, thread_suite}, + ODP_SUITE_INFO_NULL, }; int thread_main(void) { - return odp_cunit_run(thread_suites); + int ret = odp_cunit_register(thread_suites); + + if (ret == 0) + ret = odp_cunit_run(); + + return ret; } diff --git a/test/validation/thread/thread.h b/test/validation/thread/thread.h index ef645b4b0..6cbc69432 100644 --- a/test/validation/thread/thread.h +++ b/test/validation/thread/thread.h @@ -8,7 +8,7 @@ #define _ODP_TEST_THREAD_H_ #include <odp.h> -#include <CUnit/Basic.h> +#include <odp_cunit_common.h> /* test functions: */ #ifndef TEST_THRMASK @@ -22,10 +22,10 @@ void thread_test_odp_thrmask_control(void); void thread_test_odp_thrmask_worker(void); /* test arrays: */ -extern CU_TestInfo thread_suite[]; +extern odp_testinfo_t thread_suite[]; /* test registry: */ -extern CU_SuiteInfo thread_suites[]; +extern odp_suiteinfo_t thread_suites[]; /* main test program: */ int thread_main(void); diff --git a/test/validation/time/time.c b/test/validation/time/time.c index 4b81c2c0b..41db0e954 100644 --- a/test/validation/time/time.c +++ b/test/validation/time/time.c @@ -61,19 +61,24 @@ void time_test_odp_time_conversion(void) CU_ASSERT((ns2 <= upper_limit) && (ns2 >= lower_limit)); } -CU_TestInfo time_suite_time[] = { - _CU_TEST_INFO(time_test_odp_cycles_diff), - _CU_TEST_INFO(time_test_odp_cycles_negative_diff), - _CU_TEST_INFO(time_test_odp_time_conversion), - CU_TEST_INFO_NULL +odp_testinfo_t time_suite_time[] = { + ODP_TEST_INFO(time_test_odp_cycles_diff), + ODP_TEST_INFO(time_test_odp_cycles_negative_diff), + ODP_TEST_INFO(time_test_odp_time_conversion), + ODP_TEST_INFO_NULL }; -CU_SuiteInfo time_suites[] = { - {"Time", NULL, NULL, NULL, NULL, time_suite_time}, - CU_SUITE_INFO_NULL +odp_suiteinfo_t time_suites[] = { + {"Time", NULL, NULL, time_suite_time}, + ODP_SUITE_INFO_NULL }; int time_main(void) { - return odp_cunit_run(time_suites); + int ret = odp_cunit_register(time_suites); + + if (ret == 0) + ret = odp_cunit_run(); + + return ret; } diff --git a/test/validation/time/time.h b/test/validation/time/time.h index 1f6982633..9ccdeb762 100644 --- a/test/validation/time/time.h +++ b/test/validation/time/time.h @@ -7,7 +7,7 @@ #ifndef _ODP_TEST_TIME_H_ #define _ODP_TEST_TIME_H_ -#include <CUnit/Basic.h> +#include <odp_cunit_common.h> /* test functions: */ void time_test_odp_cycles_diff(void); @@ -15,10 +15,10 @@ void time_test_odp_cycles_negative_diff(void); void time_test_odp_time_conversion(void); /* test arrays: */ -extern CU_TestInfo time_suite_time[]; +extern odp_testinfo_t time_suite_time[]; /* test registry: */ -extern CU_SuiteInfo time_suites[]; +extern odp_suiteinfo_t time_suites[]; /* main test program: */ int time_main(void); diff --git a/test/validation/timer/timer.c b/test/validation/timer/timer.c index 7a8b98a17..645dc5882 100644 --- a/test/validation/timer/timer.c +++ b/test/validation/timer/timer.c @@ -529,20 +529,25 @@ void timer_test_odp_timer_all(void) CU_PASS("ODP timer test"); } -CU_TestInfo timer_suite[] = { - _CU_TEST_INFO(timer_test_timeout_pool_alloc), - _CU_TEST_INFO(timer_test_timeout_pool_free), - _CU_TEST_INFO(timer_test_odp_timer_cancel), - _CU_TEST_INFO(timer_test_odp_timer_all), - CU_TEST_INFO_NULL, +odp_testinfo_t timer_suite[] = { + ODP_TEST_INFO(timer_test_timeout_pool_alloc), + ODP_TEST_INFO(timer_test_timeout_pool_free), + ODP_TEST_INFO(timer_test_odp_timer_cancel), + ODP_TEST_INFO(timer_test_odp_timer_all), + ODP_TEST_INFO_NULL, }; -CU_SuiteInfo timer_suites[] = { - {"Timer", NULL, NULL, NULL, NULL, timer_suite}, - CU_SUITE_INFO_NULL, +odp_suiteinfo_t timer_suites[] = { + {"Timer", NULL, NULL, timer_suite}, + ODP_SUITE_INFO_NULL, }; int timer_main(void) { - return odp_cunit_run(timer_suites); + int ret = odp_cunit_register(timer_suites); + + if (ret == 0) + ret = odp_cunit_run(); + + return ret; } diff --git a/test/validation/timer/timer.h b/test/validation/timer/timer.h index 3694671f0..46ea8d768 100644 --- a/test/validation/timer/timer.h +++ b/test/validation/timer/timer.h @@ -7,7 +7,7 @@ #ifndef _ODP_TEST_TIMER_H_ #define _ODP_TEST_TIMER_H_ -#include <CUnit/Basic.h> +#include <odp_cunit_common.h> /* test functions: */ void timer_test_timeout_pool_alloc(void); @@ -16,10 +16,10 @@ void timer_test_odp_timer_cancel(void); void timer_test_odp_timer_all(void); /* test arrays: */ -extern CU_TestInfo timer_suite[]; +extern odp_testinfo_t timer_suite[]; /* test registry: */ -extern CU_SuiteInfo timer_suites[]; +extern odp_suiteinfo_t timer_suites[]; /* main test program: */ int timer_main(void); |