@@ -139,20 +139,16 @@ 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)
@@ -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);
@@ -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,
},
@@ -18,7 +18,7 @@ CU_SuiteInfo classification_suites[] = {
.pInitFunc = classification_suite_init,
.pCleanupFunc = classification_suite_term,
},
- CU_SUITE_INFO_NULL,
+ ODP_SUITE_INFO_NULL,
};
int classification_main(void)
@@ -7,7 +7,7 @@
#ifndef _ODP_TEST_CLASSIFICATION_H_
#define _ODP_TEST_CLASSIFICATION_H_
-#include <CUnit/Basic.h>
+#include <odp_cunit_common.h>
/* test functions: */
void classification_test_create_cos(void);
@@ -27,15 +27,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);
@@ -156,14 +156,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,
};
@@ -858,12 +858,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,
};
@@ -8,11 +8,10 @@
#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 odp_testinfo_t classification_suite[];
+extern odp_testinfo_t classification_suite_basic[];
int classification_suite_init(void);
int classification_suite_term(void);
@@ -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,7 +92,104 @@ 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)
+{
+ odp_suiteinfo_t *sinfo;
+
+ for (sinfo = global_testsuites; sinfo->pName; sinfo++)
+ if (strcmp(sinfo->pName, suite_name) == 0)
+ return sinfo;
+
+ 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;
+
+ 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;
+}
+
+/*
+ * Register test suites to be run via odp_cunit_run()
+ */
+int odp_cunit_run(odp_suiteinfo_t testsuites[])
{
int ret;
@@ -105,7 +204,9 @@ int odp_cunit_run(CU_SuiteInfo testsuites[])
CU_set_error_action(CUEA_ABORT);
CU_initialize_registry();
- CU_register_suites(testsuites);
+ global_testsuites = testsuites;
+ cunit_register_suites(testsuites);
+ CU_set_fail_on_inactive(CU_FALSE);
CU_basic_set_mode(CU_BRM_VERBOSE);
CU_basic_run_tests();
@@ -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,6 +68,9 @@ typedef struct {
int numthrds; /**< no of pthreads to create */
} pthrd_arg;
+/* the function, called by module main(), to run the testsuites: */
+int odp_cunit_run(odp_suiteinfo_t testsuites[]);
+
/** 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 *);
@@ -72,31 +72,31 @@ 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)
@@ -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);
@@ -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)
@@ -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);
@@ -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,
};
@@ -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);
@@ -19,14 +19,14 @@ 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)
@@ -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);
@@ -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)
@@ -82,14 +81,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)),
@@ -130,14 +129,14 @@ 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)
@@ -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);
@@ -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
@@ -772,35 +772,35 @@ 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)
@@ -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);
@@ -790,7 +790,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,38 +872,38 @@ 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)
@@ -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);
@@ -99,19 +99,19 @@ 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)
@@ -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);
@@ -125,15 +125,14 @@ 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)
@@ -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);
@@ -17,14 +17,14 @@ 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)
@@ -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);
@@ -1103,46 +1103,46 @@ 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)
@@ -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);
@@ -76,14 +76,14 @@ 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)
@@ -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);
@@ -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,28 +1188,28 @@ 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)
@@ -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);
@@ -83,20 +83,20 @@ void system_test_odp_sys_cpu_hz(void)
CU_ASSERT(0 < hz);
}
-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_sys_cpu_model_str),
- _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_sys_cpu_hz),
- 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_sys_cpu_model_str),
+ 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_sys_cpu_hz),
+ 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)
@@ -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);
@@ -19,10 +19,10 @@ void system_test_odp_sys_huge_page_size(void);
void system_test_odp_sys_cpu_hz(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);
@@ -95,32 +95,32 @@ 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)
@@ -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);
@@ -61,16 +61,16 @@ 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)
@@ -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);
@@ -529,17 +529,17 @@ 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)
@@ -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);
Add the ability for individual test cases to be marked as inactive, either unconditionally or based on the result of a check function which is called at test init time. Inactive tests are registered with CUnit and are reported as inactive in test reports without being executed. All uses of CU_TestInfo have been replaced with odp_testinfo_t in order to carry the conditional function pointer in addition to the CU_TestInfo struct, and some new macros added to make things a bit easier; _CU_TEST_INFO() is renamed to ODP_TEST_INFO() but remains functionally the same, these tests will be run unconditionally. ODP_TEST_INFO_INACTIVE() can be used to define an inactive test case. There's no good reason to do this in any of the modules under test/validation/ but the intention is to allow this to be done on a per-platform basis from within the platform/<platform>/test/ tree. ODP_TEST_INFO_CONDITIONAL() takes an additional parameter which is a pointer to a function to call at test suite initialisation time to determine whether that test should be marked as inactive. Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org> --- test/validation/buffer/buffer.c | 20 ++-- test/validation/buffer/buffer.h | 6 +- test/validation/classification/classification.c | 4 +- test/validation/classification/classification.h | 8 +- .../classification/odp_classification_basic.c | 20 ++-- .../classification/odp_classification_tests.c | 16 ++-- .../classification/odp_classification_testsuites.h | 7 +- test/validation/common/odp_cunit_common.c | 105 ++++++++++++++++++++- test/validation/common/odp_cunit_common.h | 42 ++++++++- test/validation/cpumask/cpumask.c | 46 ++++----- test/validation/cpumask/cpumask.h | 6 +- test/validation/crypto/crypto.c | 12 +-- test/validation/crypto/crypto.h | 6 +- test/validation/crypto/odp_crypto_test_inp.c | 14 +-- test/validation/crypto/odp_crypto_test_inp.h | 4 +- test/validation/errno/errno.c | 12 +-- test/validation/errno/errno.h | 6 +- test/validation/init/init.c | 37 ++++---- test/validation/init/init.h | 14 +-- test/validation/packet/packet.c | 46 ++++----- test/validation/packet/packet.h | 6 +- test/validation/pktio/pktio.c | 55 +++++------ test/validation/pktio/pktio.h | 6 +- test/validation/pool/pool.c | 16 ++-- test/validation/pool/pool.h | 6 +- test/validation/queue/queue.c | 13 ++- test/validation/queue/queue.h | 6 +- test/validation/random/random.c | 12 +-- test/validation/random/random.h | 6 +- test/validation/scheduler/scheduler.c | 72 +++++++------- test/validation/scheduler/scheduler.h | 6 +- test/validation/shmem/shmem.c | 12 +-- test/validation/shmem/shmem.h | 6 +- test/validation/synchronizers/synchronizers.c | 78 +++++++-------- test/validation/synchronizers/synchronizers.h | 16 ++-- test/validation/system/system.c | 24 ++--- test/validation/system/system.h | 6 +- test/validation/thread/thread.c | 48 +++++----- test/validation/thread/thread.h | 6 +- test/validation/time/time.c | 16 ++-- test/validation/time/time.h | 6 +- test/validation/timer/timer.c | 18 ++-- test/validation/timer/timer.h | 6 +- 43 files changed, 502 insertions(+), 375 deletions(-)