diff options
author | Zoltan Kiss <zoltan.kiss@linaro.org> | 2015-08-04 17:18:41 +0100 |
---|---|---|
committer | Zoltan Kiss <zoltan.kiss@linaro.org> | 2015-08-04 17:18:41 +0100 |
commit | f72f9c3b54293ac587de816b0b3fbc50005c1426 (patch) | |
tree | 8bd4811b9f18add159e053177cb48131febab2f8 | |
parent | b7bb9f3b117e59a2bd144af3f1c3465dbe636766 (diff) | |
parent | 3b09d8928f599c80cae0aa46be8db8ccaf5d800a (diff) |
Merge branch 'master' of https://git.linaro.org/lng/odpv1.2.0.0_DPDK_2.0.0
46 files changed, 633 insertions, 211 deletions
diff --git a/doc/doxygen.cfg b/doc/doxygen.cfg index 213a90370..f28ec244e 100644 --- a/doc/doxygen.cfg +++ b/doc/doxygen.cfg @@ -28,7 +28,7 @@ CLASS_DIAGRAMS = NO HAVE_DOT = YES CALL_GRAPH = YES DOT_MULTI_TARGETS = NO -EXAMPLE_PATH = $(SRCDIR)/example $(SRCDIR)/platform +EXAMPLE_PATH = $(SRCDIR)/example $(SRCDIR)/platform $(SRCDIR) EXAMPLE_PATTERNS = *.c EXAMPLE_RECURSIVE = YES IMAGE_PATH = $(SRCDIR)/doc/images diff --git a/doc/odp.dox b/doc/odp.dox index 0a3bc73c1..0bff5ad9e 100644 --- a/doc/odp.dox +++ b/doc/odp.dox @@ -41,3 +41,7 @@ * - Bug tracking is https://bugs.linaro.org/buglist.cgi?product=OpenDataPlane * */ + +/**@page contributing Contributing Guide Lines + * @verbinclude CONTRIBUTING + */ diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c index 53c7fdfe1..b55a6f9dc 100644 --- a/example/classifier/odp_classifier.c +++ b/example/classifier/odp_classifier.c @@ -602,10 +602,12 @@ static int parse_pmr_policy(appl_args_t *appl_args, char *argv[], char *optarg) switch (term) { case ODP_PMR_SIP_ADDR: token = strtok(NULL, ":"); - strncpy(stats[policy_count].value, token, DISPLAY_STRING_LEN); + strncpy(stats[policy_count].value, token, + DISPLAY_STRING_LEN - 1); parse_ipv4_addr(token, &stats[policy_count].rule.val); token = strtok(NULL, ":"); - strncpy(stats[policy_count].mask, token, DISPLAY_STRING_LEN); + strncpy(stats[policy_count].mask, token, + DISPLAY_STRING_LEN - 1); parse_ipv4_mask(token, &stats[policy_count].rule.mask); stats[policy_count].val_sz = 4; break; @@ -617,7 +619,7 @@ static int parse_pmr_policy(appl_args_t *appl_args, char *argv[], char *optarg) /* Queue Name */ token = strtok(NULL, ":"); - strncpy(stats[policy_count].queue_name, token, ODP_QUEUE_NAME_LEN); + strncpy(stats[policy_count].queue_name, token, ODP_QUEUE_NAME_LEN - 1); appl_args->policy_count++; free(pmr_str); return 0; diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index d6ec75863..bdee22270 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -26,6 +26,7 @@ #define MAX_WORKERS 32 /**< max number of works */ #define SHM_PKT_POOL_SIZE (512*2048) /**< pkt pool size */ #define SHM_PKT_POOL_BUF_SIZE 1856 /**< pkt pool buf size */ +#define DEFAULT_PKT_INTERVAL 1000 /**< interval btw each pkt */ #define APPL_MODE_UDP 0 /**< UDP mode */ #define APPL_MODE_PING 1 /**< ping mode */ @@ -370,6 +371,7 @@ static odp_pktio_t create_pktio(const char *dev, odp_pool_t pool) static void *gen_send_thread(void *arg) { int thr; + uint64_t start, now, diff; odp_pktio_t pktio; thread_args_t *thr_args; odp_queue_t outq_def; @@ -391,6 +393,7 @@ static void *gen_send_thread(void *arg) return NULL; } + start = odp_time_cycles(); printf(" [%02i] created mode: SEND\n", thr); for (;;) { int err; @@ -431,6 +434,15 @@ static void *gen_send_thread(void *arg) >= (unsigned int)args->appl.number) { break; } + + now = odp_time_cycles(); + diff = odp_time_diff_cycles(start, now); + if (odp_time_cycles_to_ns(diff) > 20 * ODP_TIME_SEC) { + start = odp_time_cycles(); + printf(" [%02i] total send: %ju\n", + thr, odp_atomic_load_u64(&counters.seq)); + fflush(stdout); + } } /* receive number of reply pks until timeout */ @@ -439,7 +451,7 @@ static void *gen_send_thread(void *arg) if (odp_atomic_load_u64(&counters.icmp) >= (unsigned int)args->appl.number) break; - millisleep(1000, + millisleep(DEFAULT_PKT_INTERVAL, thr_args->tp, thr_args->tim, thr_args->tq, diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index 44af5d173..933dc3b9e 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -21,6 +21,7 @@ #define MAX_WORKERS 32 /**< Max worker threads */ #define NUM_TMOS 10000 /**< Number of timers */ +#define WAIT_NUM 10 /**< Max tries to rx last tmo per worker */ /** Test arguments */ @@ -47,6 +48,7 @@ typedef struct { odp_timer_pool_t tp; /**< Timer pool handle*/ odp_atomic_u32_t remain; /**< Number of timeouts to receive*/ struct test_timer tt[256]; /**< Array of all timer helper structs*/ + uint32_t num_workers; /**< Number of threads */ } test_globals_t; /** @private Timer set status ASCII strings */ @@ -87,6 +89,7 @@ static void test_abs_timeouts(int thr, test_globals_t *gbls) uint64_t tick; struct test_timer *ttp; odp_timeout_t tmo; + uint32_t num_workers = gbls->num_workers; EXAMPLE_DBG(" [%i] test_timeouts\n", thr); @@ -115,16 +118,19 @@ static void test_abs_timeouts(int thr, test_globals_t *gbls) ttp->ev = odp_timeout_to_event(tmo); tick = odp_timer_current_tick(gbls->tp); - while ((int)odp_atomic_load_u32(&gbls->remain) > 0) { + while (1) { + int wait = 0; odp_event_t ev; odp_timer_set_t rc; - tick += period; - rc = odp_timer_set_abs(ttp->tim, tick, &ttp->ev); - if (odp_unlikely(rc != ODP_TIMER_SUCCESS)) { - /* Too early or too late timeout requested */ - EXAMPLE_ABORT("odp_timer_set_abs() failed: %s\n", - timerset2str(rc)); + if (ttp) { + tick += period; + rc = odp_timer_set_abs(ttp->tim, tick, &ttp->ev); + if (odp_unlikely(rc != ODP_TIMER_SUCCESS)) { + /* Too early or too late timeout requested */ + EXAMPLE_ABORT("odp_timer_set_abs() failed: %s\n", + timerset2str(rc)); + } } /* Get the next expired timeout. @@ -139,6 +145,9 @@ static void test_abs_timeouts(int thr, test_globals_t *gbls) ev = odp_schedule(&queue, sched_tmo); /* Check if odp_schedule() timed out, possibly there * are no remaining timeouts to receive */ + if (++wait > WAIT_NUM && + odp_atomic_load_u32(&gbls->remain) < num_workers) + EXAMPLE_ABORT("At least one TMO was lost\n"); } while (ev == ODP_EVENT_INVALID && (int)odp_atomic_load_u32(&gbls->remain) > 0); @@ -161,18 +170,18 @@ static void test_abs_timeouts(int thr, test_globals_t *gbls) } EXAMPLE_DBG(" [%i] timeout, tick %"PRIu64"\n", thr, tick); - odp_atomic_dec_u32(&gbls->remain); - } + uint32_t rx_num = odp_atomic_fetch_dec_u32(&gbls->remain); + + if (!rx_num) + EXAMPLE_ABORT("Unexpected timeout received (timer %x, tick %"PRIu64")\n", + ttp->tim, tick); + else if (rx_num > num_workers) + continue; - /* Cancel and free last timer used */ - (void)odp_timer_cancel(ttp->tim, &ttp->ev); - if (ttp->ev != ODP_EVENT_INVALID) odp_timeout_free(odp_timeout_from_event(ttp->ev)); - else - EXAMPLE_ERR("Lost timeout event at timer cancel\n"); - /* Since we have cancelled the timer, there is no timeout event to - * return from odp_timer_free() */ - (void)odp_timer_free(ttp->tim); + odp_timer_free(ttp->tim); + ttp = NULL; + } /* Remove any prescheduled events */ remove_prescheduled_events(); @@ -456,6 +465,8 @@ int main(int argc, char *argv[]) printf("\n"); + gbls->num_workers = num_workers; + /* Initialize number of timeouts to receive */ odp_atomic_init_u32(&gbls->remain, gbls->args.tmo_count * num_workers); diff --git a/test/Makefile.inc b/test/Makefile.inc index d5b4770ec..2700b1859 100644 --- a/test/Makefile.inc +++ b/test/Makefile.inc @@ -6,8 +6,7 @@ LIB = $(top_builddir)/lib #before libodp by setting PRE_LDADD before the inclusion. LDADD = $(PRE_LDADD) $(LIB)/libodphelper.la $(LIB)/libodp.la -INCFLAGS = -I$(srcdir) \ - -I$(top_srcdir)/test \ +INCFLAGS = -I$(top_srcdir)/test \ -I$(top_srcdir)/platform/@with_platform@/include \ -I$(top_srcdir)/platform/linux-generic/include \ -I$(top_srcdir)/include \ @@ -20,4 +19,4 @@ AM_LDFLAGS += -L$(LIB) @VALGRIND_CHECK_RULES@ valgrind_tools = memcheck drd sgcheck -TESTS_ENVIRONMENT= ODP_PLATFORM=${with_platform} EXEEXT=${EXEEXT}
\ No newline at end of file +TESTS_ENVIRONMENT= ODP_PLATFORM=${with_platform} EXEEXT=${EXEEXT} diff --git a/test/validation/Makefile.inc b/test/validation/Makefile.inc index ac8081404..49efbda98 100644 --- a/test/validation/Makefile.inc +++ b/test/validation/Makefile.inc @@ -2,6 +2,11 @@ include $(top_srcdir)/test/Makefile.inc COMMON_DIR = $(top_builddir)/test/validation/common +#the following option ensure that option '-I.' is not passed to gcc, +#therefore distinguishing between '#include "X"' and '#include <X>'. +#It allows common filenames (such as 'errno.h') to be used locally. +AUTOMAKE_OPTIONS = nostdinc + AM_CFLAGS += -I$(top_srcdir)/test/validation/common AM_LDFLAGS += -static diff --git a/test/validation/buffer/buffer.c b/test/validation/buffer/buffer.c index f67c55fc0..52585b95a 100644 --- a/test/validation/buffer/buffer.c +++ b/test/validation/buffer/buffer.c @@ -15,7 +15,7 @@ static odp_pool_t raw_pool; static odp_buffer_t raw_buffer = ODP_BUFFER_INVALID; static const size_t raw_buffer_size = 1500; -static int buffer_suite_init(void) +int buffer_suite_init(void) { odp_pool_param_t params = { .buf = { @@ -35,7 +35,7 @@ static int buffer_suite_init(void) return 0; } -static int buffer_suite_term(void) +int buffer_suite_term(void) { odp_buffer_free(raw_buffer); if (odp_pool_destroy(raw_pool) != 0) @@ -43,7 +43,7 @@ static int buffer_suite_term(void) return 0; } -static void buffer_test_pool_alloc(void) +void buffer_test_pool_alloc(void) { odp_pool_t pool; const int num = 3; @@ -95,7 +95,7 @@ static void buffer_test_pool_alloc(void) CU_ASSERT(odp_pool_destroy(pool) == 0); } -static void buffer_test_pool_free(void) +void buffer_test_pool_free(void) { odp_pool_t pool; odp_buffer_t buffer; @@ -127,7 +127,7 @@ static void buffer_test_pool_free(void) CU_ASSERT(odp_pool_destroy(pool) == 0); } -static void buffer_test_management_basic(void) +void buffer_test_management_basic(void) { odp_event_t ev = odp_buffer_to_event(raw_buffer); @@ -142,14 +142,14 @@ static void buffer_test_management_basic(void) CU_ASSERT(odp_event_to_u64(ev) != odp_event_to_u64(ODP_EVENT_INVALID)); } -static CU_TestInfo buffer_suite[] = { +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, }; -static CU_SuiteInfo buffer_suites[] = { +CU_SuiteInfo buffer_suites[] = { { .pName = "buffer tests", .pTests = buffer_suite, .pInitFunc = buffer_suite_init, diff --git a/test/validation/buffer/buffer.h b/test/validation/buffer/buffer.h index 6269c63de..49166247f 100644 --- a/test/validation/buffer/buffer.h +++ b/test/validation/buffer/buffer.h @@ -7,6 +7,24 @@ #ifndef _ODP_TEST_BUFFER_H_ #define _ODP_TEST_BUFFER_H_ +#include <CUnit/Basic.h> + +/* test functions: */ +void buffer_test_pool_alloc(void); +void buffer_test_pool_free(void); +void buffer_test_management_basic(void); + +/* test arrays: */ +extern CU_TestInfo buffer_suite[]; + +/* test array init/term functions: */ +int buffer_suite_init(void); +int buffer_suite_term(void); + +/* test registry: */ +extern CU_SuiteInfo buffer_suites[]; + +/* main test program: */ int buffer_main(void); #endif diff --git a/test/validation/classification/classification.c b/test/validation/classification/classification.c index 2582aaa0b..d0fef934c 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" -static CU_SuiteInfo classification_suites[] = { +CU_SuiteInfo classification_suites[] = { { .pName = "classification basic", .pTests = classification_suite_basic, }, diff --git a/test/validation/classification/classification.h b/test/validation/classification/classification.h index 63ad0221b..d2847e52a 100644 --- a/test/validation/classification/classification.h +++ b/test/validation/classification/classification.h @@ -7,6 +7,37 @@ #ifndef _ODP_TEST_CLASSIFICATION_H_ #define _ODP_TEST_CLASSIFICATION_H_ +#include <CUnit/Basic.h> + +/* test functions: */ +void classification_test_create_cos(void); +void classification_test_destroy_cos(void); +void classification_test_create_pmr_match(void); +void classification_test_destroy_pmr(void); +void classification_test_cos_set_queue(void); +void classification_test_cos_set_drop(void); +void classification_test_pmr_match_set_create(void); +void classification_test_pmr_match_set_destroy(void); + +void classification_test_pktio_set_skip(void); +void classification_test_pktio_set_headroom(void); +void classification_test_pmr_terms_avail(void); +void classification_test_pmr_terms_cap(void); +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[]; + +/* test array init/term functions: */ +int classification_suite_init(void); +int classification_suite_term(void); + +/* test registry: */ +extern CU_SuiteInfo classification_suites[]; + +/* main test program: */ int classification_main(void); #endif diff --git a/test/validation/classification/odp_classification_basic.c b/test/validation/classification/odp_classification_basic.c index 99202eefc..79c775e1c 100644 --- a/test/validation/classification/odp_classification_basic.c +++ b/test/validation/classification/odp_classification_basic.c @@ -5,10 +5,11 @@ */ #include "odp_classification_testsuites.h" +#include "classification.h" #define PMR_SET_NUM 5 -static void classification_test_create_cos(void) +void classification_test_create_cos(void) { odp_cos_t cos; char name[ODP_COS_NAME_LEN]; @@ -19,7 +20,7 @@ static void classification_test_create_cos(void) odp_cos_destroy(cos); } -static void classification_test_destroy_cos(void) +void classification_test_destroy_cos(void) { odp_cos_t cos; char name[ODP_COS_NAME_LEN]; @@ -33,7 +34,7 @@ static void classification_test_destroy_cos(void) CU_ASSERT(retval < 0); } -static void classification_test_create_pmr_match(void) +void classification_test_create_pmr_match(void) { odp_pmr_t pmr; uint16_t val; @@ -46,7 +47,7 @@ static void classification_test_create_pmr_match(void) odp_pmr_destroy(pmr); } -static void classification_test_destroy_pmr(void) +void classification_test_destroy_pmr(void) { odp_pmr_t pmr; uint16_t val; @@ -62,7 +63,7 @@ static void classification_test_destroy_pmr(void) CU_ASSERT(retval < 0); } -static void classification_test_cos_set_queue(void) +void classification_test_cos_set_queue(void) { int retval; char cosname[ODP_COS_NAME_LEN]; @@ -87,7 +88,7 @@ static void classification_test_cos_set_queue(void) odp_queue_destroy(queue_cos); } -static void classification_test_cos_set_drop(void) +void classification_test_cos_set_drop(void) { int retval; char cosname[ODP_COS_NAME_LEN]; @@ -103,7 +104,7 @@ static void classification_test_cos_set_drop(void) odp_cos_destroy(cos_drop); } -static void classification_test_pmr_match_set_create(void) +void classification_test_pmr_match_set_create(void) { odp_pmr_set_t pmr_set; int retval; @@ -127,7 +128,7 @@ static void classification_test_pmr_match_set_create(void) CU_ASSERT(retval == 0); } -static void classification_test_pmr_match_set_destroy(void) +void classification_test_pmr_match_set_destroy(void) { odp_pmr_set_t pmr_set; int retval; diff --git a/test/validation/classification/odp_classification_tests.c b/test/validation/classification/odp_classification_tests.c index a4072c4bf..0e0c4eb6d 100644 --- a/test/validation/classification/odp_classification_tests.c +++ b/test/validation/classification/odp_classification_tests.c @@ -5,6 +5,7 @@ */ #include "odp_classification_testsuites.h" +#include "classification.h" #include <odp_cunit_common.h> #include <odp/helper/eth.h> #include <odp/helper/ip.h> @@ -564,7 +565,7 @@ void test_pktio_error_cos(void) odp_packet_free(pkt); } -static void classification_test_pktio_set_skip(void) +void classification_test_pktio_set_skip(void) { int retval; size_t offset = 5; @@ -581,7 +582,7 @@ static void classification_test_pktio_set_skip(void) CU_ASSERT(retval == 0); } -static void classification_test_pktio_set_headroom(void) +void classification_test_pktio_set_headroom(void) { size_t headroom; int retval; @@ -793,7 +794,7 @@ void test_pktio_pmr_match_set_cos(void) odp_packet_free(pkt); } -static void classification_test_pmr_terms_avail(void) +void classification_test_pmr_terms_avail(void) { int retval; /* Since this API called at the start of the suite the return value @@ -802,7 +803,7 @@ static void classification_test_pmr_terms_avail(void) CU_ASSERT(retval > 0); } -static void classification_test_pmr_terms_cap(void) +void classification_test_pmr_terms_cap(void) { unsigned long long retval; /* Need to check different values for different platforms */ @@ -810,7 +811,7 @@ static void classification_test_pmr_terms_cap(void) CU_ASSERT(retval & (1 << ODP_PMR_IPPROTO)); } -static void classification_test_pktio_configure(void) +void classification_test_pktio_configure(void) { /* Configure the Different CoS for the pktio interface */ if (TEST_DEFAULT) @@ -827,7 +828,7 @@ static void classification_test_pktio_configure(void) configure_pktio_pmr_match_set_cos(); } -static void classification_test_pktio_test(void) +void classification_test_pktio_test(void) { /* Test Different CoS on the pktio interface */ if (TEST_DEFAULT) diff --git a/test/validation/cpumask/cpumask.c b/test/validation/cpumask/cpumask.c index 76b764859..029baadf6 100644 --- a/test/validation/cpumask/cpumask.c +++ b/test/validation/cpumask/cpumask.c @@ -10,10 +10,10 @@ #include "cpumask.h" #include "mask_common.h" -/* default worker paramiter to get all that may be available */ +/* default worker parameter to get all that may be available */ #define ALL_AVAILABLE 0 -static void cpumask_test_odp_cpumask_def_control(void) +void cpumask_test_odp_cpumask_def_control(void) { unsigned num; unsigned mask_count; @@ -28,7 +28,7 @@ static void cpumask_test_odp_cpumask_def_control(void) CU_ASSERT(num <= max_cpus); } -static void cpumask_test_odp_cpumask_def_worker(void) +void cpumask_test_odp_cpumask_def_worker(void) { unsigned num; unsigned mask_count; @@ -43,7 +43,7 @@ static void cpumask_test_odp_cpumask_def_worker(void) CU_ASSERT(num <= max_cpus); } -static void cpumask_test_odp_cpumask_def(void) +void cpumask_test_odp_cpumask_def(void) { unsigned mask_count; unsigned num_worker; @@ -72,7 +72,7 @@ static void cpumask_test_odp_cpumask_def(void) CU_ASSERT(num_worker > 0); } -static CU_TestInfo cpumask_suite[] = { +CU_TestInfo cpumask_suite[] = { {"odp_cpumask_to/from_str()", cpumask_test_odp_cpumask_to_from_str}, {"odp_cpumask_equal()", cpumask_test_odp_cpumask_equal}, {"odp_cpumask_zero()", cpumask_test_odp_cpumask_zero}, @@ -94,7 +94,7 @@ static CU_TestInfo cpumask_suite[] = { CU_TEST_INFO_NULL, }; -static CU_SuiteInfo cpumask_suites[] = { +CU_SuiteInfo cpumask_suites[] = { {"Cpumask", NULL, NULL, NULL, NULL, cpumask_suite}, CU_SUITE_INFO_NULL, }; diff --git a/test/validation/cpumask/cpumask.h b/test/validation/cpumask/cpumask.h index 2c6fb4adc..7a58b5d0e 100644 --- a/test/validation/cpumask/cpumask.h +++ b/test/validation/cpumask/cpumask.h @@ -7,6 +7,22 @@ #ifndef _ODP_TEST_CPUMASK_H_ #define _ODP_TEST_CPUMASK_H_ +#include <odp.h> +#include <CUnit/Basic.h> + +/* test functions: */ +#include "mask_common.h" +void cpumask_test_odp_cpumask_def_control(void); +void cpumask_test_odp_cpumask_def_worker(void); +void cpumask_test_odp_cpumask_def(void); + +/* test arrays: */ +extern CU_TestInfo cpumask_suite[]; + +/* test registry: */ +extern CU_SuiteInfo cpumask_suites[]; + +/* main test program: */ int cpumask_main(void); #endif diff --git a/test/validation/crypto/crypto.c b/test/validation/crypto/crypto.c index 996543259..cad660163 100644 --- a/test/validation/crypto/crypto.c +++ b/test/validation/crypto/crypto.c @@ -15,7 +15,7 @@ #define SHM_COMPL_POOL_SIZE (128 * 1024) #define SHM_COMPL_POOL_BUF_SIZE 128 -static CU_SuiteInfo crypto_suites[] = { +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, @@ -23,7 +23,7 @@ static CU_SuiteInfo crypto_suites[] = { CU_SUITE_INFO_NULL, }; -static int crypto_init(void) +int crypto_init(void) { odp_pool_param_t params; odp_pool_t pool; @@ -60,7 +60,7 @@ static int crypto_init(void) return 0; } -static int crypto_term(void) +int crypto_term(void) { odp_pool_t pool; odp_queue_t out_queue; diff --git a/test/validation/crypto/crypto.h b/test/validation/crypto/crypto.h index 9ab641b15..41dd4ed7d 100644 --- a/test/validation/crypto/crypto.h +++ b/test/validation/crypto/crypto.h @@ -7,6 +7,30 @@ #ifndef _ODP_TEST_CRYPTO_H_ #define _ODP_TEST_CRYPTO_H_ +#include <CUnit/Basic.h> + +/* test functions: */ +void crypto_test_enc_alg_3des_cbc(void); +void crypto_test_enc_alg_3des_cbc_ovr_iv(void); +void crypto_test_dec_alg_3des_cbc(void); +void crypto_test_dec_alg_3des_cbc_ovr_iv(void); +void crypto_test_alg_hmac_md5(void); + +/* test arrays: */ +extern CU_TestInfo 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[]; + +/* executable init/term functions: */ +int crypto_init(void); +int crypto_term(void); + +/* main test program: */ int crypto_main(void); #endif diff --git a/test/validation/crypto/odp_crypto_test_inp.c b/test/validation/crypto/odp_crypto_test_inp.c index c1c08af50..90fe8d039 100644 --- a/test/validation/crypto/odp_crypto_test_inp.c +++ b/test/validation/crypto/odp_crypto_test_inp.c @@ -8,6 +8,7 @@ #include <CUnit/Basic.h> #include "test_vectors.h" #include "odp_crypto_test_inp.h" +#include "crypto.h" struct suite_context_s { enum odp_crypto_op_mode pref_mode; @@ -132,7 +133,7 @@ cleanup: * In addition the test verifies if the implementation can use the * packet buffer as completion event buffer.*/ #define ASYNC_INP_ENC_ALG_3DES_CBC "ENC_ALG_3DES_CBC" -static void crypto_test_enc_alg_3des_cbc(void) +void crypto_test_enc_alg_3des_cbc(void) { odp_crypto_key_t cipher_key = { .data = NULL, .length = 0 }, auth_key = { .data = NULL, .length = 0 }; @@ -165,7 +166,7 @@ static void crypto_test_enc_alg_3des_cbc(void) * operation for 3DES_CBC algorithm. IV for the operation is the operation IV. * */ #define ASYNC_INP_ENC_ALG_3DES_CBC_OVR_IV "ENC_ALG_3DES_CBC_OVR_IV" -static void crypto_test_enc_alg_3des_cbc_ovr_iv(void) +void crypto_test_enc_alg_3des_cbc_ovr_iv(void) { odp_crypto_key_t cipher_key = { .data = NULL, .length = 0 }, auth_key = { .data = NULL, .length = 0 }; @@ -199,7 +200,7 @@ static void crypto_test_enc_alg_3des_cbc_ovr_iv(void) * packet buffer as completion event buffer. * */ #define ASYNC_INP_DEC_ALG_3DES_CBC "DEC_ALG_3DES_CBC" -static void crypto_test_dec_alg_3des_cbc(void) +void crypto_test_dec_alg_3des_cbc(void) { odp_crypto_key_t cipher_key = { .data = NULL, .length = 0 }, auth_key = { .data = NULL, .length = 0 }; @@ -234,7 +235,7 @@ static void crypto_test_dec_alg_3des_cbc(void) * packet buffer as completion event buffer. * */ #define ASYNC_INP_DEC_ALG_3DES_CBC_OVR_IV "DEC_ALG_3DES_CBC_OVR_IV" -static void crypto_test_dec_alg_3des_cbc_ovr_iv(void) +void crypto_test_dec_alg_3des_cbc_ovr_iv(void) { odp_crypto_key_t cipher_key = { .data = NULL, .length = 0 }, auth_key = { .data = NULL, .length = 0 }; @@ -270,7 +271,7 @@ static void crypto_test_dec_alg_3des_cbc_ovr_iv(void) * packet buffer as completion event buffer. * */ #define ASYNC_INP_ALG_HMAC_MD5 "ALG_HMAC_MD5" -static void crypto_test_alg_hmac_md5(void) +void crypto_test_alg_hmac_md5(void) { odp_crypto_key_t cipher_key = { .data = NULL, .length = 0 }, auth_key = { .data = NULL, .length = 0 }; diff --git a/test/validation/errno/errno.c b/test/validation/errno/errno.c index ac1d93caf..9b6b125aa 100644 --- a/test/validation/errno/errno.c +++ b/test/validation/errno/errno.c @@ -6,8 +6,9 @@ #include <odp.h> #include "odp_cunit_common.h" +#include "errno.h" -static void errno_test_odp_errno_sunny_day(void) +void errno_test_odp_errno_sunny_day(void) { int my_errno; diff --git a/test/validation/errno/errno.h b/test/validation/errno/errno.h index 592376838..374a3c96a 100644 --- a/test/validation/errno/errno.h +++ b/test/validation/errno/errno.h @@ -7,6 +7,18 @@ #ifndef _ODP_TEST_ERRNO_H_ #define _ODP_TEST_ERRNO_H_ +#include <CUnit/Basic.h> + +/* test functions: */ +void errno_test_odp_errno_sunny_day(void); + +/* test arrays: */ +extern CU_TestInfo errno_suite[]; + +/* test registry: */ +extern CU_SuiteInfo errno_suites[]; + +/* main test program: */ int errno_main(void); #endif diff --git a/test/validation/init/init.c b/test/validation/init/init.c index 169bd5c58..12aa554b8 100644 --- a/test/validation/init/init.c +++ b/test/validation/init/init.c @@ -22,7 +22,7 @@ ODP_PRINTF_FORMAT(2, 3) static int odp_init_log(odp_log_level_e level, const char *fmt, ...); /* test ODP global init, with alternate abort function */ -static void init_test_odp_init_global_replace_abort(void) +void init_test_odp_init_global_replace_abort(void) { int status; struct odp_init_t init_data; @@ -37,12 +37,12 @@ static void init_test_odp_init_global_replace_abort(void) CU_ASSERT(status == 0); } -static CU_TestInfo init_suite_abort[] = { +CU_TestInfo init_suite_abort[] = { {"replace abort", init_test_odp_init_global_replace_abort}, CU_TEST_INFO_NULL, }; -static CU_SuiteInfo init_suites_abort[] = { +CU_SuiteInfo init_suites_abort[] = { {"Init", NULL, NULL, NULL, NULL, init_suite_abort}, CU_SUITE_INFO_NULL, }; @@ -63,7 +63,7 @@ int init_main_abort(void) } /* test ODP global init, with alternate log function */ -static void init_test_odp_init_global_replace_log(void) +void init_test_odp_init_global_replace_log(void) { int status; struct odp_init_t init_data; @@ -82,12 +82,12 @@ static void init_test_odp_init_global_replace_log(void) CU_ASSERT(status == 0); } -static CU_TestInfo init_suite_log[] = { +CU_TestInfo init_suite_log[] = { {"replace log", init_test_odp_init_global_replace_log}, CU_TEST_INFO_NULL, }; -static CU_SuiteInfo init_suites_log[] = { +CU_SuiteInfo init_suites_log[] = { {"Init", NULL, NULL, NULL, NULL, init_suite_log}, CU_SUITE_INFO_NULL, }; @@ -119,7 +119,7 @@ int init_main_log(void) } /* test normal ODP global init */ -static void init_test_odp_init_global(void) +void init_test_odp_init_global(void) { int status; @@ -130,12 +130,12 @@ static void init_test_odp_init_global(void) CU_ASSERT(status == 0); } -static CU_TestInfo init_suite_ok[] = { +CU_TestInfo init_suite_ok[] = { {"test_odp_init_global", init_test_odp_init_global}, CU_TEST_INFO_NULL, }; -static CU_SuiteInfo init_suites_ok[] = { +CU_SuiteInfo init_suites_ok[] = { {"Init", NULL, NULL, NULL, NULL, init_suite_ok}, CU_SUITE_INFO_NULL, }; diff --git a/test/validation/init/init.h b/test/validation/init/init.h index 7e5a082f2..08f09e55c 100644 --- a/test/validation/init/init.h +++ b/test/validation/init/init.h @@ -7,6 +7,24 @@ #ifndef _ODP_TEST_INIT_H_ #define _ODP_TEST_INIT_H_ +#include <CUnit/Basic.h> + +/* test functions: */ +void init_test_odp_init_global_replace_abort(void); +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[]; + +/* test registry: */ +extern CU_SuiteInfo init_suites_abort[]; +extern CU_SuiteInfo init_suites_log[]; +extern CU_SuiteInfo init_suites_ok[]; + +/* main test program: */ int init_main_abort(void); int init_main_log(void); int init_main_ok(void); diff --git a/test/validation/packet/packet.c b/test/validation/packet/packet.c index 329482a89..99a67458d 100644 --- a/test/validation/packet/packet.c +++ b/test/validation/packet/packet.c @@ -36,7 +36,7 @@ static struct udata_struct { "abcdefg", }; -static int packet_suite_init(void) +int packet_suite_init(void) { odp_pool_param_t params = { .pkt = { @@ -78,7 +78,7 @@ static int packet_suite_init(void) return 0; } -static int packet_suite_term(void) +int packet_suite_term(void) { odp_packet_free(test_packet); odp_packet_free(segmented_test_packet); @@ -87,7 +87,7 @@ static int packet_suite_term(void) return 0; } -static void packet_test_alloc_free(void) +void packet_test_alloc_free(void) { odp_pool_t pool; odp_packet_t packet; @@ -126,7 +126,7 @@ static void packet_test_alloc_free(void) CU_ASSERT(odp_pool_destroy(pool) == 0); } -static void packet_test_alloc_segmented(void) +void packet_test_alloc_segmented(void) { odp_packet_t pkt; const uint32_t len = ODP_CONFIG_PACKET_BUF_LEN_MAX - @@ -139,7 +139,7 @@ static void packet_test_alloc_segmented(void) odp_packet_free(pkt); } -static void packet_test_event_conversion(void) +void packet_test_event_conversion(void) { odp_packet_t pkt = test_packet; odp_packet_t tmp_pkt; @@ -154,7 +154,7 @@ static void packet_test_event_conversion(void) /** @todo: Need an API to compare packets */ } -static void packet_test_basic_metadata(void) +void packet_test_basic_metadata(void) { odp_packet_t pkt = test_packet; @@ -166,7 +166,7 @@ static void packet_test_basic_metadata(void) CU_ASSERT(odp_packet_input(pkt) == ODP_PKTIO_INVALID); } -static void packet_test_length(void) +void packet_test_length(void) { odp_packet_t pkt = test_packet; uint32_t buf_len, headroom, tailroom; @@ -185,13 +185,13 @@ static void packet_test_length(void) CU_ASSERT(buf_len >= packet_len + headroom + tailroom); } -static void packet_test_debug(void) +void packet_test_debug(void) { CU_ASSERT(odp_packet_is_valid(test_packet) == 1); odp_packet_print(test_packet); } -static void packet_test_context(void) +void packet_test_context(void) { odp_packet_t pkt = test_packet; char ptr_test_value = 2; @@ -213,7 +213,7 @@ static void packet_test_context(void) odp_packet_reset(pkt, packet_len); } -static void packet_test_layer_offsets(void) +void packet_test_layer_offsets(void) { odp_packet_t pkt = test_packet; uint8_t *l2_addr, *l3_addr, *l4_addr; @@ -287,7 +287,7 @@ static void _verify_headroom_shift(odp_packet_t packet, CU_ASSERT(data == data_orig - shift); } -static void packet_test_headroom(void) +void packet_test_headroom(void) { odp_packet_t pkt = test_packet; uint32_t room; @@ -359,7 +359,7 @@ static void _verify_tailroom_shift(odp_packet_t pkt, } } -static void packet_test_tailroom(void) +void packet_test_tailroom(void) { odp_packet_t pkt = test_packet; odp_packet_seg_t segment; @@ -386,7 +386,7 @@ static void packet_test_tailroom(void) _verify_tailroom_shift(pkt, 0); } -static void packet_test_segments(void) +void packet_test_segments(void) { int num_segs, seg_index; uint32_t data_len, buf_len; @@ -486,7 +486,7 @@ static void packet_test_segments(void) CU_ASSERT(seg == ODP_PACKET_SEG_INVALID); } -static void packet_test_segment_last(void) +void packet_test_segment_last(void) { odp_packet_t pkt = test_packet; odp_packet_seg_t seg; @@ -506,7 +506,7 @@ do { \ CU_ASSERT(odp_packet_has_##flag(packet) != 0); \ } while (0) -static void packet_test_in_flags(void) +void packet_test_in_flags(void) { odp_packet_t pkt = test_packet; @@ -529,7 +529,7 @@ static void packet_test_in_flags(void) TEST_INFLAG(pkt, icmp); } -static void packet_test_error_flags(void) +void packet_test_error_flags(void) { odp_packet_t pkt = test_packet; int err; @@ -551,7 +551,7 @@ struct packet_metadata { uint64_t usr_u64; }; -static void packet_test_add_rem_data(void) +void packet_test_add_rem_data(void) { odp_packet_t pkt, new_pkt; uint32_t pkt_len, offset, add_len; @@ -660,7 +660,7 @@ static void _packet_compare_data(odp_packet_t pkt1, odp_packet_t pkt2) } } -static void packet_test_copy(void) +void packet_test_copy(void) { odp_packet_t pkt = test_packet; odp_packet_t pkt_copy; @@ -679,7 +679,7 @@ static void packet_test_copy(void) odp_packet_free(pkt_copy); } -static void packet_test_copydata(void) +void packet_test_copydata(void) { odp_packet_t pkt = test_packet; uint32_t pkt_len = odp_packet_len(pkt); @@ -710,7 +710,7 @@ static void packet_test_copydata(void) free(data_buf); } -static void packet_test_offset(void) +void packet_test_offset(void) { odp_packet_t pkt = test_packet; uint32_t seg_len, full_seg_len; @@ -756,7 +756,7 @@ static void packet_test_offset(void) CU_ASSERT_PTR_NOT_NULL(ptr); } -static CU_TestInfo packet_suite[] = { +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), @@ -778,7 +778,7 @@ static CU_TestInfo packet_suite[] = { CU_TEST_INFO_NULL, }; -static CU_SuiteInfo packet_suites[] = { +CU_SuiteInfo packet_suites[] = { { .pName = "packet tests", .pTests = packet_suite, .pInitFunc = packet_suite_init, diff --git a/test/validation/packet/packet.h b/test/validation/packet/packet.h index 7e210cb7c..f8a16a8e2 100644 --- a/test/validation/packet/packet.h +++ b/test/validation/packet/packet.h @@ -7,6 +7,39 @@ #ifndef _ODP_TEST_PACKET_H_ #define _ODP_TEST_PACKET_H_ +#include <CUnit/Basic.h> + +/* test functions: */ +void packet_test_alloc_free(void); +void packet_test_alloc_segmented(void); +void packet_test_event_conversion(void); +void packet_test_basic_metadata(void); +void packet_test_length(void); +void packet_test_debug(void); +void packet_test_context(void); +void packet_test_layer_offsets(void); +void packet_test_headroom(void); +void packet_test_tailroom(void); +void packet_test_segments(void); +void packet_test_segment_last(void); +void packet_test_in_flags(void); +void packet_test_error_flags(void); +void packet_test_add_rem_data(void); +void packet_test_copy(void); +void packet_test_copydata(void); +void packet_test_offset(void); + +/* test arrays: */ +extern CU_TestInfo packet_suite[]; + +/* test array init/term functions: */ +int packet_suite_init(void); +int packet_suite_term(void); + +/* test registry: */ +extern CU_SuiteInfo packet_suites[]; + +/* main test program: */ int packet_main(void); #endif diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c index bfdf52570..5eb7a56bd 100644 --- a/test/validation/pktio/pktio.c +++ b/test/validation/pktio/pktio.c @@ -445,34 +445,34 @@ static void test_txrx(odp_queue_type_t q_type, int num_pkts) } } -static void pktio_test_poll_queue(void) +void pktio_test_poll_queue(void) { test_txrx(ODP_QUEUE_TYPE_POLL, 1); } -static void pktio_test_poll_multi(void) +void pktio_test_poll_multi(void) { test_txrx(ODP_QUEUE_TYPE_POLL, 4); } -static void pktio_test_sched_queue(void) +void pktio_test_sched_queue(void) { test_txrx(ODP_QUEUE_TYPE_SCHED, 1); } -static void pktio_test_sched_multi(void) +void pktio_test_sched_multi(void) { test_txrx(ODP_QUEUE_TYPE_SCHED, 4); } -static void pktio_test_jumbo(void) +void pktio_test_jumbo(void) { packet_len = PKT_LEN_JUMBO; pktio_test_sched_multi(); packet_len = PKT_LEN_NORMAL; } -static void pktio_test_mtu(void) +void pktio_test_mtu(void) { int ret; int mtu; @@ -487,7 +487,7 @@ static void pktio_test_mtu(void) CU_ASSERT(ret == 0); } -static void pktio_test_promisc(void) +void pktio_test_promisc(void) { int ret; odp_pktio_t pktio = create_pktio(iface_name[0], 0); @@ -510,7 +510,7 @@ static void pktio_test_promisc(void) CU_ASSERT(ret == 0); } -static void pktio_test_mac(void) +void pktio_test_mac(void) { unsigned char mac_addr[ODPH_ETHADDR_LEN]; int mac_len; @@ -534,7 +534,7 @@ static void pktio_test_mac(void) CU_ASSERT(0 == ret); } -static void pktio_test_inq_remdef(void) +void pktio_test_inq_remdef(void) { odp_pktio_t pktio = create_pktio(iface_name[0], 0); odp_queue_t inq; @@ -559,7 +559,7 @@ static void pktio_test_inq_remdef(void) CU_ASSERT(odp_pktio_close(pktio) == 0); } -static void pktio_test_open(void) +void pktio_test_open(void) { odp_pktio_t pktio; int i; @@ -575,7 +575,7 @@ static void pktio_test_open(void) CU_ASSERT(pktio == ODP_PKTIO_INVALID); } -static void pktio_test_lookup(void) +void pktio_test_lookup(void) { odp_pktio_t pktio, pktio_inval; @@ -593,7 +593,7 @@ static void pktio_test_lookup(void) CU_ASSERT(odp_pktio_lookup(iface_name[0]) == ODP_PKTIO_INVALID); } -static void pktio_test_inq(void) +void pktio_test_inq(void) { odp_pktio_t pktio; @@ -627,7 +627,7 @@ static int create_pool(const char *iface, int num) return 0; } -static int pktio_suite_init(void) +int pktio_suite_init(void) { odp_atomic_init_u32(&ip_seq, 0); iface_name[0] = getenv("ODP_PKTIO_IF0"); @@ -659,7 +659,7 @@ static int pktio_suite_init(void) return 0; } -static int pktio_suite_term(void) +int pktio_suite_term(void) { char pool_name[ODP_POOL_NAME_LEN]; odp_pool_t pool; @@ -688,7 +688,7 @@ static int pktio_suite_term(void) return ret; } -static CU_TestInfo pktio_suite[] = { +CU_TestInfo pktio_suite[] = { {"pktio open", pktio_test_open}, {"pktio lookup", pktio_test_lookup}, {"pktio inq", pktio_test_inq}, @@ -704,7 +704,7 @@ static CU_TestInfo pktio_suite[] = { CU_TEST_INFO_NULL }; -static CU_SuiteInfo pktio_suites[] = { +CU_SuiteInfo pktio_suites[] = { {"Packet I/O", pktio_suite_init, pktio_suite_term, NULL, NULL, pktio_suite}, CU_SUITE_INFO_NULL diff --git a/test/validation/pktio/pktio.h b/test/validation/pktio/pktio.h index ccf52680c..1749d5d8e 100644 --- a/test/validation/pktio/pktio.h +++ b/test/validation/pktio/pktio.h @@ -7,6 +7,33 @@ #ifndef _ODP_TEST_PKTIO_H_ #define _ODP_TEST_PKTIO_H_ +#include <CUnit/Basic.h> + +/* test functions: */ +void pktio_test_poll_queue(void); +void pktio_test_poll_multi(void); +void pktio_test_sched_queue(void); +void pktio_test_sched_multi(void); +void pktio_test_jumbo(void); +void pktio_test_mtu(void); +void pktio_test_promisc(void); +void pktio_test_mac(void); +void pktio_test_inq_remdef(void); +void pktio_test_open(void); +void pktio_test_lookup(void); +void pktio_test_inq(void); + +/* test arrays: */ +extern CU_TestInfo pktio_suite[]; + +/* test array init/term functions: */ +int pktio_suite_term(void); +int pktio_suite_init(void); + +/* test registry: */ +extern CU_SuiteInfo pktio_suites[]; + +/* main test program: */ int pktio_main(void); #endif diff --git a/test/validation/pool/pool.c b/test/validation/pool/pool.c index a888b6846..924755763 100644 --- a/test/validation/pool/pool.c +++ b/test/validation/pool/pool.c @@ -27,7 +27,7 @@ static void pool_create_destroy(odp_pool_param_t *params) CU_ASSERT(odp_pool_destroy(pool) == 0); } -static void pool_test_create_destroy_buffer(void) +void pool_test_create_destroy_buffer(void) { odp_pool_param_t params = { .buf = { @@ -41,7 +41,7 @@ static void pool_test_create_destroy_buffer(void) pool_create_destroy(¶ms); } -static void pool_test_create_destroy_packet(void) +void pool_test_create_destroy_packet(void) { odp_pool_param_t params = { .pkt = { @@ -55,7 +55,7 @@ static void pool_test_create_destroy_packet(void) pool_create_destroy(¶ms); } -static void pool_test_create_destroy_timeout(void) +void pool_test_create_destroy_timeout(void) { odp_pool_param_t params = { .tmo = { @@ -67,7 +67,7 @@ static void pool_test_create_destroy_timeout(void) pool_create_destroy(¶ms); } -static void pool_test_lookup_info_print(void) +void pool_test_lookup_info_print(void) { odp_pool_t pool; const char pool_name[] = "pool_for_lookup_test"; @@ -101,7 +101,7 @@ static void pool_test_lookup_info_print(void) #define _CU_TEST_INFO(test_func) {#test_func, test_func} -static CU_TestInfo pool_suite[] = { +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), @@ -109,7 +109,7 @@ static CU_TestInfo pool_suite[] = { CU_TEST_INFO_NULL, }; -static CU_SuiteInfo pool_suites[] = { +CU_SuiteInfo pool_suites[] = { { .pName = "Pool tests", .pTests = pool_suite, }, diff --git a/test/validation/pool/pool.h b/test/validation/pool/pool.h index 8c73d9b5e..12c6193d8 100644 --- a/test/validation/pool/pool.h +++ b/test/validation/pool/pool.h @@ -7,6 +7,22 @@ #ifndef _ODP_TEST_POOL_H_ #define _ODP_TEST_POOL_H_ +#include <CUnit/Basic.h> + +/* test functions: */ +void pool_test_create_destroy_buffer(void); +void pool_test_create_destroy_packet(void); +void pool_test_create_destroy_timeout(void); +void pool_test_create_destroy_buffer_shm(void); +void pool_test_lookup_info_print(void); + +/* test arrays: */ +extern CU_TestInfo pool_suite[]; + +/* test registry: */ +extern CU_SuiteInfo pool_suites[]; + +/* main test program: */ int pool_main(void); #endif diff --git a/test/validation/queue/queue.c b/test/validation/queue/queue.c index ef7c8f24f..5b2a13ae7 100644 --- a/test/validation/queue/queue.c +++ b/test/validation/queue/queue.c @@ -15,7 +15,7 @@ static int queue_contest = 0xff; static odp_pool_t pool; -static int queue_suite_init(void) +int queue_suite_init(void) { odp_pool_param_t params; @@ -33,12 +33,12 @@ static int queue_suite_init(void) return 0; } -static int queue_suite_term(void) +int queue_suite_term(void) { return odp_pool_destroy(pool); } -static void queue_test_sunnydays(void) +void queue_test_sunnydays(void) { odp_queue_t queue_creat_id, queue_id; odp_event_t enev[MAX_BUFFER_QUEUE]; @@ -114,12 +114,12 @@ static void queue_test_sunnydays(void) CU_ASSERT(odp_queue_destroy(queue_id) == 0); } -static CU_TestInfo queue_suite[] = { +CU_TestInfo queue_suite[] = { {"queue sunnyday", queue_test_sunnydays}, CU_TEST_INFO_NULL, }; -static CU_SuiteInfo queue_suites[] = { +CU_SuiteInfo queue_suites[] = { {"Queue", queue_suite_init, queue_suite_term, NULL, NULL, queue_suite}, CU_SUITE_INFO_NULL, diff --git a/test/validation/queue/queue.h b/test/validation/queue/queue.h index 8302912de..d2765ce46 100644 --- a/test/validation/queue/queue.h +++ b/test/validation/queue/queue.h @@ -7,6 +7,22 @@ #ifndef _ODP_TEST_QUEUE_H_ #define _ODP_TEST_QUEUE_H_ +#include <CUnit/Basic.h> + +/* test functions: */ +void queue_test_sunnydays(void); + +/* test arrays: */ +extern CU_TestInfo queue_suite[]; + +/* test array init/term functions: */ +int queue_suite_init(void); +int queue_suite_term(void); + +/* test registry: */ +extern CU_SuiteInfo queue_suites[]; + +/* main test program: */ int queue_main(void); #endif diff --git a/test/validation/random/random.c b/test/validation/random/random.c index a42523faf..039c7a333 100644 --- a/test/validation/random/random.c +++ b/test/validation/random/random.c @@ -11,7 +11,7 @@ /* Helper macro for CU_TestInfo initialization */ #define _CU_TEST_INFO(test_func) {#test_func, test_func} -static void random_test_get_size(void) +void random_test_get_size(void) { int32_t ret; uint8_t buf[32]; @@ -20,12 +20,12 @@ static void random_test_get_size(void) CU_ASSERT(ret == sizeof(buf)); } -static CU_TestInfo random_suite[] = { +CU_TestInfo random_suite[] = { _CU_TEST_INFO(random_test_get_size), CU_TEST_INFO_NULL, }; -static CU_SuiteInfo random_suites[] = { +CU_SuiteInfo random_suites[] = { {"Random", NULL, NULL, NULL, NULL, random_suite}, CU_SUITE_INFO_NULL, }; diff --git a/test/validation/random/random.h b/test/validation/random/random.h index 34e375c70..cda1843e4 100644 --- a/test/validation/random/random.h +++ b/test/validation/random/random.h @@ -7,6 +7,18 @@ #ifndef _ODP_TEST_RANDOM_H_ #define _ODP_TEST_RANDOM_H_ +#include <CUnit/Basic.h> + +/* test functions: */ +void random_test_get_size(void); + +/* test arrays: */ +extern CU_TestInfo random_suite[]; + +/* test registry: */ +extern CU_SuiteInfo random_suites[]; + +/* main test program: */ int random_main(void); #endif diff --git a/test/validation/scheduler/scheduler.c b/test/validation/scheduler/scheduler.c index d6a4a3e99..1bcaee693 100644 --- a/test/validation/scheduler/scheduler.c +++ b/test/validation/scheduler/scheduler.c @@ -78,7 +78,7 @@ static int exit_schedule_loop(void) return ret; } -static void scheduler_test_wait_time(void) +void scheduler_test_wait_time(void) { uint64_t wait_time; @@ -91,7 +91,7 @@ static void scheduler_test_wait_time(void) CU_ASSERT(wait_time > 0); } -static void scheduler_test_num_prio(void) +void scheduler_test_num_prio(void) { int prio; @@ -101,7 +101,7 @@ static void scheduler_test_num_prio(void) CU_ASSERT(prio == odp_schedule_num_prio()); } -static void scheduler_test_queue_destroy(void) +void scheduler_test_queue_destroy(void) { odp_pool_t p; odp_pool_param_t params; @@ -371,25 +371,25 @@ static void parallel_execute(odp_schedule_sync_t sync, int num_queues, } /* 1 queue 1 thread ODP_SCHED_SYNC_NONE */ -static void scheduler_test_1q_1t_n(void) +void scheduler_test_1q_1t_n(void) { schedule_common(ODP_SCHED_SYNC_NONE, ONE_Q, ONE_PRIO, SCHD_ONE); } /* 1 queue 1 thread ODP_SCHED_SYNC_ATOMIC */ -static void scheduler_test_1q_1t_a(void) +void scheduler_test_1q_1t_a(void) { schedule_common(ODP_SCHED_SYNC_ATOMIC, ONE_Q, ONE_PRIO, SCHD_ONE); } /* 1 queue 1 thread ODP_SCHED_SYNC_ORDERED */ -static void scheduler_test_1q_1t_o(void) +void scheduler_test_1q_1t_o(void) { schedule_common(ODP_SCHED_SYNC_ORDERED, ONE_Q, ONE_PRIO, SCHD_ONE); } /* Many queues 1 thread ODP_SCHED_SYNC_NONE */ -static void scheduler_test_mq_1t_n(void) +void scheduler_test_mq_1t_n(void) { /* Only one priority involved in these tests, but use the same number of queues the more general case uses */ @@ -397,19 +397,19 @@ static void scheduler_test_mq_1t_n(void) } /* Many queues 1 thread ODP_SCHED_SYNC_ATOMIC */ -static void scheduler_test_mq_1t_a(void) +void scheduler_test_mq_1t_a(void) { schedule_common(ODP_SCHED_SYNC_ATOMIC, MANY_QS, ONE_PRIO, SCHD_ONE); } /* Many queues 1 thread ODP_SCHED_SYNC_ORDERED */ -static void scheduler_test_mq_1t_o(void) +void scheduler_test_mq_1t_o(void) { schedule_common(ODP_SCHED_SYNC_ORDERED, MANY_QS, ONE_PRIO, SCHD_ONE); } /* Many queues 1 thread check priority ODP_SCHED_SYNC_NONE */ -static void scheduler_test_mq_1t_prio_n(void) +void scheduler_test_mq_1t_prio_n(void) { int prio = odp_schedule_num_prio(); @@ -417,7 +417,7 @@ static void scheduler_test_mq_1t_prio_n(void) } /* Many queues 1 thread check priority ODP_SCHED_SYNC_ATOMIC */ -static void scheduler_test_mq_1t_prio_a(void) +void scheduler_test_mq_1t_prio_a(void) { int prio = odp_schedule_num_prio(); @@ -425,7 +425,7 @@ static void scheduler_test_mq_1t_prio_a(void) } /* Many queues 1 thread check priority ODP_SCHED_SYNC_ORDERED */ -static void scheduler_test_mq_1t_prio_o(void) +void scheduler_test_mq_1t_prio_o(void) { int prio = odp_schedule_num_prio(); @@ -433,7 +433,7 @@ static void scheduler_test_mq_1t_prio_o(void) } /* Many queues many threads check priority ODP_SCHED_SYNC_NONE */ -static void scheduler_test_mq_mt_prio_n(void) +void scheduler_test_mq_mt_prio_n(void) { int prio = odp_schedule_num_prio(); @@ -442,7 +442,7 @@ static void scheduler_test_mq_mt_prio_n(void) } /* Many queues many threads check priority ODP_SCHED_SYNC_ATOMIC */ -static void scheduler_test_mq_mt_prio_a(void) +void scheduler_test_mq_mt_prio_a(void) { int prio = odp_schedule_num_prio(); @@ -451,7 +451,7 @@ static void scheduler_test_mq_mt_prio_a(void) } /* Many queues many threads check priority ODP_SCHED_SYNC_ORDERED */ -static void scheduler_test_mq_mt_prio_o(void) +void scheduler_test_mq_mt_prio_o(void) { int prio = odp_schedule_num_prio(); @@ -460,32 +460,32 @@ static void scheduler_test_mq_mt_prio_o(void) } /* 1 queue many threads check exclusive access on ATOMIC queues */ -static void scheduler_test_1q_mt_a_excl(void) +void scheduler_test_1q_mt_a_excl(void) { parallel_execute(ODP_SCHED_SYNC_ATOMIC, ONE_Q, ONE_PRIO, SCHD_ONE, ENABLE_EXCL_ATOMIC); } /* 1 queue 1 thread ODP_SCHED_SYNC_NONE multi */ -static void scheduler_test_multi_1q_1t_n(void) +void scheduler_test_multi_1q_1t_n(void) { schedule_common(ODP_SCHED_SYNC_NONE, ONE_Q, ONE_PRIO, SCHD_MULTI); } /* 1 queue 1 thread ODP_SCHED_SYNC_ATOMIC multi */ -static void scheduler_test_multi_1q_1t_a(void) +void scheduler_test_multi_1q_1t_a(void) { schedule_common(ODP_SCHED_SYNC_ATOMIC, ONE_Q, ONE_PRIO, SCHD_MULTI); } /* 1 queue 1 thread ODP_SCHED_SYNC_ORDERED multi */ -static void scheduler_test_multi_1q_1t_o(void) +void scheduler_test_multi_1q_1t_o(void) { schedule_common(ODP_SCHED_SYNC_ORDERED, ONE_Q, ONE_PRIO, SCHD_MULTI); } /* Many queues 1 thread ODP_SCHED_SYNC_NONE multi */ -static void scheduler_test_multi_mq_1t_n(void) +void scheduler_test_multi_mq_1t_n(void) { /* Only one priority involved in these tests, but use the same number of queues the more general case uses */ @@ -493,19 +493,19 @@ static void scheduler_test_multi_mq_1t_n(void) } /* Many queues 1 thread ODP_SCHED_SYNC_ATOMIC multi */ -static void scheduler_test_multi_mq_1t_a(void) +void scheduler_test_multi_mq_1t_a(void) { schedule_common(ODP_SCHED_SYNC_ATOMIC, MANY_QS, ONE_PRIO, SCHD_MULTI); } /* Many queues 1 thread ODP_SCHED_SYNC_ORDERED multi */ -static void scheduler_test_multi_mq_1t_o(void) +void scheduler_test_multi_mq_1t_o(void) { schedule_common(ODP_SCHED_SYNC_ORDERED, MANY_QS, ONE_PRIO, SCHD_MULTI); } /* Many queues 1 thread check priority ODP_SCHED_SYNC_NONE multi */ -static void scheduler_test_multi_mq_1t_prio_n(void) +void scheduler_test_multi_mq_1t_prio_n(void) { int prio = odp_schedule_num_prio(); @@ -513,7 +513,7 @@ static void scheduler_test_multi_mq_1t_prio_n(void) } /* Many queues 1 thread check priority ODP_SCHED_SYNC_ATOMIC multi */ -static void scheduler_test_multi_mq_1t_prio_a(void) +void scheduler_test_multi_mq_1t_prio_a(void) { int prio = odp_schedule_num_prio(); @@ -521,7 +521,7 @@ static void scheduler_test_multi_mq_1t_prio_a(void) } /* Many queues 1 thread check priority ODP_SCHED_SYNC_ORDERED multi */ -static void scheduler_test_multi_mq_1t_prio_o(void) +void scheduler_test_multi_mq_1t_prio_o(void) { int prio = odp_schedule_num_prio(); @@ -529,7 +529,7 @@ static void scheduler_test_multi_mq_1t_prio_o(void) } /* Many queues many threads check priority ODP_SCHED_SYNC_NONE multi */ -static void scheduler_test_multi_mq_mt_prio_n(void) +void scheduler_test_multi_mq_mt_prio_n(void) { int prio = odp_schedule_num_prio(); @@ -537,7 +537,7 @@ static void scheduler_test_multi_mq_mt_prio_n(void) } /* Many queues many threads check priority ODP_SCHED_SYNC_ATOMIC multi */ -static void scheduler_test_multi_mq_mt_prio_a(void) +void scheduler_test_multi_mq_mt_prio_a(void) { int prio = odp_schedule_num_prio(); @@ -545,7 +545,7 @@ static void scheduler_test_multi_mq_mt_prio_a(void) } /* Many queues many threads check priority ODP_SCHED_SYNC_ORDERED multi */ -static void scheduler_test_multi_mq_mt_prio_o(void) +void scheduler_test_multi_mq_mt_prio_o(void) { int prio = odp_schedule_num_prio(); @@ -553,13 +553,13 @@ static void scheduler_test_multi_mq_mt_prio_o(void) } /* 1 queue many threads check exclusive access on ATOMIC queues multi */ -static void scheduler_test_multi_1q_mt_a_excl(void) +void scheduler_test_multi_1q_mt_a_excl(void) { parallel_execute(ODP_SCHED_SYNC_ATOMIC, ONE_Q, ONE_PRIO, SCHD_MULTI, ENABLE_EXCL_ATOMIC); } -static void scheduler_test_pause_resume(void) +void scheduler_test_pause_resume(void) { odp_queue_t queue; odp_buffer_t buf; @@ -665,7 +665,7 @@ static int create_queues(void) return 0; } -static int scheduler_suite_init(void) +int scheduler_suite_init(void) { odp_cpumask_t mask; odp_shm_t shm; @@ -763,7 +763,7 @@ static int destroy_queues(void) return 0; } -static int scheduler_suite_term(void) +int scheduler_suite_term(void) { odp_pool_t pool; @@ -779,7 +779,7 @@ static int scheduler_suite_term(void) return 0; } -static struct CU_TestInfo scheduler_suite[] = { +CU_TestInfo scheduler_suite[] = { {"schedule_wait_time", scheduler_test_wait_time}, {"schedule_num_prio", scheduler_test_num_prio}, {"schedule_queue_destroy", scheduler_test_queue_destroy}, @@ -813,7 +813,7 @@ static struct CU_TestInfo scheduler_suite[] = { CU_TEST_INFO_NULL, }; -static CU_SuiteInfo scheduler_suites[] = { +CU_SuiteInfo scheduler_suites[] = { {"Scheduler", scheduler_suite_init, scheduler_suite_term, NULL, NULL, scheduler_suite }, diff --git a/test/validation/scheduler/scheduler.h b/test/validation/scheduler/scheduler.h index db0f2895b..31f02ca3b 100644 --- a/test/validation/scheduler/scheduler.h +++ b/test/validation/scheduler/scheduler.h @@ -7,6 +7,51 @@ #ifndef _ODP_TEST_SCHEDULER_H_ #define _ODP_TEST_SCHEDULER_H_ +#include <CUnit/Basic.h> + +/* test functions: */ +void scheduler_test_wait_time(void); +void scheduler_test_num_prio(void); +void scheduler_test_queue_destroy(void); +void scheduler_test_1q_1t_n(void); +void scheduler_test_1q_1t_a(void); +void scheduler_test_1q_1t_o(void); +void scheduler_test_mq_1t_n(void); +void scheduler_test_mq_1t_a(void); +void scheduler_test_mq_1t_o(void); +void scheduler_test_mq_1t_prio_n(void); +void scheduler_test_mq_1t_prio_a(void); +void scheduler_test_mq_1t_prio_o(void); +void scheduler_test_mq_mt_prio_n(void); +void scheduler_test_mq_mt_prio_a(void); +void scheduler_test_mq_mt_prio_o(void); +void scheduler_test_1q_mt_a_excl(void); +void scheduler_test_multi_1q_1t_n(void); +void scheduler_test_multi_1q_1t_a(void); +void scheduler_test_multi_1q_1t_o(void); +void scheduler_test_multi_mq_1t_n(void); +void scheduler_test_multi_mq_1t_a(void); +void scheduler_test_multi_mq_1t_o(void); +void scheduler_test_multi_mq_1t_prio_n(void); +void scheduler_test_multi_mq_1t_prio_a(void); +void scheduler_test_multi_mq_1t_prio_o(void); +void scheduler_test_multi_mq_mt_prio_n(void); +void scheduler_test_multi_mq_mt_prio_a(void); +void scheduler_test_multi_mq_mt_prio_o(void); +void scheduler_test_multi_1q_mt_a_excl(void); +void scheduler_test_pause_resume(void); + +/* test arrays: */ +extern CU_TestInfo scheduler_suite[]; + +/* test array init/term functions: */ +int scheduler_suite_init(void); +int scheduler_suite_term(void); + +/* test registry: */ +extern CU_SuiteInfo scheduler_suites[]; + +/* main test program: */ int scheduler_main(void); #endif diff --git a/test/validation/shmem/shmem.c b/test/validation/shmem/shmem.c index 0c713c657..3abba0c3b 100644 --- a/test/validation/shmem/shmem.c +++ b/test/validation/shmem/shmem.c @@ -44,7 +44,7 @@ static void *run_shm_thread(void *arg) return arg; } -static void shmem_test_odp_shm_sunnyday(void) +void shmem_test_odp_shm_sunnyday(void) { pthrd_arg thrdarg; odp_shm_t shm; @@ -76,12 +76,12 @@ static void shmem_test_odp_shm_sunnyday(void) odp_cunit_thread_exit(&thrdarg); } -static CU_TestInfo shmem_suite[] = { +CU_TestInfo shmem_suite[] = { {"test_odp_shm_creat", shmem_test_odp_shm_sunnyday}, CU_TEST_INFO_NULL, }; -static CU_SuiteInfo shmem_suites[] = { +CU_SuiteInfo shmem_suites[] = { {"Shared Memory", NULL, NULL, NULL, NULL, shmem_suite}, CU_SUITE_INFO_NULL, }; diff --git a/test/validation/shmem/shmem.h b/test/validation/shmem/shmem.h index f9cf52307..8de0bc660 100644 --- a/test/validation/shmem/shmem.h +++ b/test/validation/shmem/shmem.h @@ -7,6 +7,18 @@ #ifndef _ODP_TEST_SHMEM_H_ #define _ODP_TEST_SHMEM_H_ +#include <CUnit/Basic.h> + +/* test functions: */ +void shmem_test_odp_shm_sunnyday(void); + +/* test arrays: */ +extern CU_TestInfo shmem_suite[]; + +/* test registry: */ +extern CU_SuiteInfo shmem_suites[]; + +/* main test program: */ int shmem_main(void); #endif diff --git a/test/validation/synchronizers/synchronizers.c b/test/validation/synchronizers/synchronizers.c index ed56c8fca..7c521cadd 100644 --- a/test/validation/synchronizers/synchronizers.c +++ b/test/validation/synchronizers/synchronizers.c @@ -920,7 +920,7 @@ static void test_atomic_validate(void) } /* Barrier tests */ -static void synchronizers_test_no_barrier_functional(void) +void synchronizers_test_no_barrier_functional(void) { pthrd_arg arg; @@ -930,7 +930,7 @@ static void synchronizers_test_no_barrier_functional(void) odp_cunit_thread_exit(&arg); } -static void synchronizers_test_barrier_functional(void) +void synchronizers_test_barrier_functional(void) { pthrd_arg arg; @@ -940,14 +940,14 @@ static void synchronizers_test_barrier_functional(void) odp_cunit_thread_exit(&arg); } -static CU_TestInfo synchronizers_suite_barrier[] = { +CU_TestInfo synchronizers_suite_barrier[] = { {"no_barrier_functional", synchronizers_test_no_barrier_functional}, {"barrier_functional", synchronizers_test_barrier_functional}, CU_TEST_INFO_NULL }; /* Thread-unsafe tests */ -static void synchronizers_test_no_lock_functional(void) +void synchronizers_test_no_lock_functional(void) { pthrd_arg arg; @@ -956,13 +956,13 @@ static void synchronizers_test_no_lock_functional(void) odp_cunit_thread_exit(&arg); } -static CU_TestInfo synchronizers_suite_no_locking[] = { +CU_TestInfo synchronizers_suite_no_locking[] = { {"no_lock_functional", synchronizers_test_no_lock_functional}, CU_TEST_INFO_NULL }; /* Spin lock tests */ -static void synchronizers_test_spinlock_api(void) +void synchronizers_test_spinlock_api(void) { pthrd_arg arg; @@ -971,7 +971,7 @@ static void synchronizers_test_spinlock_api(void) odp_cunit_thread_exit(&arg); } -static void synchronizers_test_spinlock_functional(void) +void synchronizers_test_spinlock_functional(void) { pthrd_arg arg; @@ -981,14 +981,14 @@ static void synchronizers_test_spinlock_functional(void) odp_cunit_thread_exit(&arg); } -static CU_TestInfo synchronizers_suite_spinlock[] = { +CU_TestInfo synchronizers_suite_spinlock[] = { {"spinlock_api", synchronizers_test_spinlock_api}, {"spinlock_functional", synchronizers_test_spinlock_functional}, CU_TEST_INFO_NULL }; /* Ticket lock tests */ -static void synchronizers_test_ticketlock_api(void) +void synchronizers_test_ticketlock_api(void) { pthrd_arg arg; @@ -997,7 +997,7 @@ static void synchronizers_test_ticketlock_api(void) odp_cunit_thread_exit(&arg); } -static void synchronizers_test_ticketlock_functional(void) +void synchronizers_test_ticketlock_functional(void) { pthrd_arg arg; @@ -1008,14 +1008,14 @@ static void synchronizers_test_ticketlock_functional(void) odp_cunit_thread_exit(&arg); } -static CU_TestInfo synchronizers_suite_ticketlock[] = { +CU_TestInfo synchronizers_suite_ticketlock[] = { {"ticketlock_api", synchronizers_test_ticketlock_api}, {"ticketlock_functional", synchronizers_test_ticketlock_functional}, CU_TEST_INFO_NULL }; /* RW lock tests */ -static void synchronizers_test_rwlock_api(void) +void synchronizers_test_rwlock_api(void) { pthrd_arg arg; @@ -1024,7 +1024,7 @@ static void synchronizers_test_rwlock_api(void) odp_cunit_thread_exit(&arg); } -static void synchronizers_test_rwlock_functional(void) +void synchronizers_test_rwlock_functional(void) { pthrd_arg arg; @@ -1034,13 +1034,13 @@ static void synchronizers_test_rwlock_functional(void) odp_cunit_thread_exit(&arg); } -static CU_TestInfo synchronizers_suite_rwlock[] = { +CU_TestInfo synchronizers_suite_rwlock[] = { {"rwlock_api", synchronizers_test_rwlock_api}, {"rwlock_functional", synchronizers_test_rwlock_functional}, CU_TEST_INFO_NULL }; -static int synchronizers_suite_init(void) +int synchronizers_suite_init(void) { uint32_t num_threads, idx; @@ -1052,10 +1052,11 @@ static int synchronizers_suite_init(void) return 0; } -static int synchronizers_init(void) +int synchronizers_init(void) { - uint32_t core_count, max_threads; + uint32_t workers_count, max_threads; int ret = 0; + odp_cpumask_t mask; if (0 != odp_init_global(NULL, NULL)) { fprintf(stderr, "error: odp_init_global() failed.\n"); @@ -1081,9 +1082,10 @@ static int synchronizers_init(void) global_mem->g_iterations = MAX_ITERATIONS; global_mem->g_verbose = VERBOSE; - core_count = odp_cpu_count(); + workers_count = odp_cpumask_def_worker(&mask, 0); - max_threads = (core_count >= MAX_WORKERS) ? MAX_WORKERS : core_count; + max_threads = (workers_count >= MAX_WORKERS) ? + MAX_WORKERS : workers_count; if (max_threads < global_mem->g_num_threads) { printf("Requested num of threads is too large\n"); @@ -1164,27 +1166,27 @@ static void test_atomic_functional(void *func_ptr(void *)) test_atomic_validate(); } -static void synchronizers_test_atomic_inc_dec(void) +void synchronizers_test_atomic_inc_dec(void) { test_atomic_functional(test_atomic_inc_dec_thread); } -static void synchronizers_test_atomic_add_sub(void) +void synchronizers_test_atomic_add_sub(void) { test_atomic_functional(test_atomic_add_sub_thread); } -static void synchronizers_test_atomic_fetch_inc_dec(void) +void synchronizers_test_atomic_fetch_inc_dec(void) { test_atomic_functional(test_atomic_fetch_inc_dec_thread); } -static void synchronizers_test_atomic_fetch_add_sub(void) +void synchronizers_test_atomic_fetch_add_sub(void) { test_atomic_functional(test_atomic_fetch_add_sub_thread); } -static CU_TestInfo synchronizers_suite_atomic[] = { +CU_TestInfo synchronizers_suite_atomic[] = { {"atomic_inc_dec", synchronizers_test_atomic_inc_dec}, {"atomic_add_sub", synchronizers_test_atomic_add_sub}, {"atomic_fetch_inc_dec", synchronizers_test_atomic_fetch_inc_dec}, @@ -1192,7 +1194,7 @@ static CU_TestInfo synchronizers_suite_atomic[] = { CU_TEST_INFO_NULL, }; -static CU_SuiteInfo synchronizers_suites[] = { +CU_SuiteInfo synchronizers_suites[] = { {"barrier", NULL, NULL, NULL, NULL, synchronizers_suite_barrier}, {"nolocking", synchronizers_suite_init, diff --git a/test/validation/synchronizers/synchronizers.h b/test/validation/synchronizers/synchronizers.h index 8a931876f..45b90e946 100644 --- a/test/validation/synchronizers/synchronizers.h +++ b/test/validation/synchronizers/synchronizers.h @@ -7,6 +7,41 @@ #ifndef _ODP_TEST_SYNCHRONIZERS_H_ #define _ODP_TEST_SYNCHRONIZERS_H_ +#include <CUnit/Basic.h> + +/* test functions: */ +void synchronizers_test_no_barrier_functional(void); +void synchronizers_test_barrier_functional(void); +void synchronizers_test_no_lock_functional(void); +void synchronizers_test_spinlock_api(void); +void synchronizers_test_spinlock_functional(void); +void synchronizers_test_ticketlock_api(void); +void synchronizers_test_ticketlock_functional(void); +void synchronizers_test_rwlock_api(void); +void synchronizers_test_rwlock_functional(void); +void synchronizers_test_atomic_inc_dec(void); +void synchronizers_test_atomic_add_sub(void); +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[]; + +/* test array init/term functions: */ +int synchronizers_suite_init(void); + +/* test registry: */ +extern CU_SuiteInfo synchronizers_suites[]; + +/* executable init/term functions: */ +int synchronizers_init(void); + +/* main test program: */ int synchronizers_main(void); #endif diff --git a/test/validation/system/system.c b/test/validation/system/system.c index b80fd39f9..7687f20de 100644 --- a/test/validation/system/system.c +++ b/test/validation/system/system.c @@ -10,7 +10,7 @@ #include "test_debug.h" #include "system.h" -static void system_test_odp_version_numbers(void) +void system_test_odp_version_numbers(void) { int char_ok; char version_string[128]; @@ -32,7 +32,7 @@ static void system_test_odp_version_numbers(void) CU_ASSERT(char_ok); } -static void system_test_odp_cpu_count(void) +void system_test_odp_cpu_count(void) { int cpus; @@ -40,7 +40,7 @@ static void system_test_odp_cpu_count(void) CU_ASSERT(0 < cpus); } -static void system_test_odp_sys_cache_line_size(void) +void system_test_odp_sys_cache_line_size(void) { uint64_t cache_size; @@ -49,7 +49,7 @@ static void system_test_odp_sys_cache_line_size(void) CU_ASSERT(ODP_CACHE_LINE_SIZE == cache_size); } -static void system_test_odp_sys_cpu_model_str(void) +void system_test_odp_sys_cpu_model_str(void) { char model[128]; @@ -58,7 +58,7 @@ static void system_test_odp_sys_cpu_model_str(void) CU_ASSERT(strlen(model) < 127); } -static void system_test_odp_sys_page_size(void) +void system_test_odp_sys_page_size(void) { uint64_t page; @@ -67,7 +67,7 @@ static void system_test_odp_sys_page_size(void) CU_ASSERT(ODP_PAGE_SIZE == page); } -static void system_test_odp_sys_huge_page_size(void) +void system_test_odp_sys_huge_page_size(void) { uint64_t page; @@ -75,7 +75,7 @@ static void system_test_odp_sys_huge_page_size(void) CU_ASSERT(0 < page); } -static void system_test_odp_sys_cpu_hz(void) +void system_test_odp_sys_cpu_hz(void) { uint64_t hz; @@ -83,7 +83,7 @@ static void system_test_odp_sys_cpu_hz(void) CU_ASSERT(0 < hz); } -static CU_TestInfo system_suite[] = { +CU_TestInfo system_suite[] = { {"odp version", system_test_odp_version_numbers}, {"odp_cpu_count", system_test_odp_cpu_count}, {"odp_sys_cache_line_size", system_test_odp_sys_cache_line_size}, @@ -94,7 +94,7 @@ static CU_TestInfo system_suite[] = { CU_TEST_INFO_NULL, }; -static CU_SuiteInfo system_suites[] = { +CU_SuiteInfo system_suites[] = { {"System Info", NULL, NULL, NULL, NULL, system_suite}, CU_SUITE_INFO_NULL, }; diff --git a/test/validation/system/system.h b/test/validation/system/system.h index f00ae5754..c8bd2d4d7 100644 --- a/test/validation/system/system.h +++ b/test/validation/system/system.h @@ -7,6 +7,24 @@ #ifndef _ODP_TEST_SYSTEM_H_ #define _ODP_TEST_SYSTEM_H_ +#include <CUnit/Basic.h> + +/* test functions: */ +void system_test_odp_version_numbers(void); +void system_test_odp_cpu_count(void); +void system_test_odp_sys_cache_line_size(void); +void system_test_odp_sys_cpu_model_str(void); +void system_test_odp_sys_page_size(void); +void system_test_odp_sys_huge_page_size(void); +void system_test_odp_sys_cpu_hz(void); + +/* test arrays: */ +extern CU_TestInfo system_suite[]; + +/* test registry: */ +extern CU_SuiteInfo system_suites[]; + +/* main test program: */ int system_main(void); #endif diff --git a/test/validation/thread/thread.c b/test/validation/thread/thread.c index 6fbdaef45..f95172ae6 100644 --- a/test/validation/thread/thread.c +++ b/test/validation/thread/thread.c @@ -17,19 +17,19 @@ odp_barrier_t bar_entry; odp_barrier_t bar_exit; -static void thread_test_odp_cpu_id(void) +void thread_test_odp_cpu_id(void) { (void)odp_cpu_id(); CU_PASS(); } -static void thread_test_odp_thread_id(void) +void thread_test_odp_thread_id(void) { (void)odp_thread_id(); CU_PASS(); } -static void thread_test_odp_thread_count(void) +void thread_test_odp_thread_count(void) { (void)odp_thread_count(); CU_PASS(); @@ -48,7 +48,7 @@ static void *thread_func(void *arg TEST_UNUSED) return NULL; } -static void thread_test_odp_thrmask_worker(void) +void thread_test_odp_thrmask_worker(void) { odp_thrmask_t mask; int ret; @@ -85,7 +85,7 @@ static void thread_test_odp_thrmask_worker(void) odp_cunit_thread_exit(&args); } -static void thread_test_odp_thrmask_control(void) +void thread_test_odp_thrmask_control(void) { odp_thrmask_t mask; int ret; @@ -98,7 +98,7 @@ static void thread_test_odp_thrmask_control(void) CU_ASSERT(ret == 1); } -static CU_TestInfo thread_suite[] = { +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), @@ -121,7 +121,7 @@ static CU_TestInfo thread_suite[] = { CU_TEST_INFO_NULL, }; -static CU_SuiteInfo thread_suites[] = { +CU_SuiteInfo thread_suites[] = { {"thread", NULL, NULL, NULL, NULL, thread_suite}, CU_SUITE_INFO_NULL, }; diff --git a/test/validation/thread/thread.h b/test/validation/thread/thread.h index c0cbb34ab..ef645b4b0 100644 --- a/test/validation/thread/thread.h +++ b/test/validation/thread/thread.h @@ -7,6 +7,27 @@ #ifndef _ODP_TEST_THREAD_H_ #define _ODP_TEST_THREAD_H_ +#include <odp.h> +#include <CUnit/Basic.h> + +/* test functions: */ +#ifndef TEST_THRMASK +#define TEST_THRMASK +#endif +#include "mask_common.h" +void thread_test_odp_cpu_id(void); +void thread_test_odp_thread_id(void); +void thread_test_odp_thread_count(void); +void thread_test_odp_thrmask_control(void); +void thread_test_odp_thrmask_worker(void); + +/* test arrays: */ +extern CU_TestInfo thread_suite[]; + +/* test registry: */ +extern CU_SuiteInfo thread_suites[]; + +/* main test program: */ int thread_main(void); #endif diff --git a/test/validation/time/time.c b/test/validation/time/time.c index 0aac599b6..4fa2eafa1 100644 --- a/test/validation/time/time.c +++ b/test/validation/time/time.c @@ -12,7 +12,7 @@ #define BUSY_LOOP_CNT 100 /* check that a cycles difference gives a reasonable result */ -static void time_test_odp_cycles_diff(void) +void time_test_odp_cycles_diff(void) { /* volatile to stop optimization of busy loop */ volatile int count = 0; @@ -32,7 +32,7 @@ static void time_test_odp_cycles_diff(void) } /* check that a negative cycles difference gives a reasonable result */ -static void time_test_odp_cycles_negative_diff(void) +void time_test_odp_cycles_negative_diff(void) { uint64_t diff, cycles1, cycles2; @@ -43,7 +43,7 @@ static void time_test_odp_cycles_negative_diff(void) } /* check that related conversions come back to the same value */ -static void time_test_odp_time_conversion(void) +void time_test_odp_time_conversion(void) { uint64_t ns1, ns2, cycles; uint64_t upper_limit, lower_limit; @@ -68,7 +68,7 @@ CU_TestInfo time_suite_time[] = { CU_TEST_INFO_NULL }; -static CU_SuiteInfo time_suites[] = { +CU_SuiteInfo time_suites[] = { {"Time", NULL, NULL, NULL, NULL, time_suite_time}, CU_SUITE_INFO_NULL }; diff --git a/test/validation/time/time.h b/test/validation/time/time.h index 1cd54d97f..1f6982633 100644 --- a/test/validation/time/time.h +++ b/test/validation/time/time.h @@ -7,6 +7,20 @@ #ifndef _ODP_TEST_TIME_H_ #define _ODP_TEST_TIME_H_ +#include <CUnit/Basic.h> + +/* test functions: */ +void time_test_odp_cycles_diff(void); +void time_test_odp_cycles_negative_diff(void); +void time_test_odp_time_conversion(void); + +/* test arrays: */ +extern CU_TestInfo time_suite_time[]; + +/* test registry: */ +extern CU_SuiteInfo time_suites[]; + +/* main test program: */ int time_main(void); #endif diff --git a/test/validation/timer/timer.c b/test/validation/timer/timer.c index ecca78564..30b2b4343 100644 --- a/test/validation/timer/timer.c +++ b/test/validation/timer/timer.c @@ -50,7 +50,7 @@ struct test_timer { #define TICK_INVALID (~(uint64_t)0) -static void timer_test_timeout_pool_alloc(void) +void timer_test_timeout_pool_alloc(void) { odp_pool_t pool; const int num = 3; @@ -94,7 +94,7 @@ static void timer_test_timeout_pool_alloc(void) CU_ASSERT(odp_pool_destroy(pool) == 0); } -static void timer_test_timeout_pool_free(void) +void timer_test_timeout_pool_free(void) { odp_pool_t pool; odp_timeout_t tmo; @@ -125,7 +125,7 @@ static void timer_test_timeout_pool_free(void) CU_ASSERT(odp_pool_destroy(pool) == 0); } -static void timer_test_odp_timer_cancel(void) +void timer_test_odp_timer_cancel(void) { odp_pool_t pool; odp_pool_param_t params; @@ -436,7 +436,7 @@ static void *worker_entrypoint(void *arg TEST_UNUSED) } /* @private Timer test case entrypoint */ -static void timer_test_odp_timer_all(void) +void timer_test_odp_timer_all(void) { int rc; odp_pool_param_t params; @@ -529,7 +529,7 @@ static void timer_test_odp_timer_all(void) CU_PASS("ODP timer test"); } -static CU_TestInfo timer_suite[] = { +CU_TestInfo timer_suite[] = { {"test_timeout_pool_alloc", timer_test_timeout_pool_alloc}, {"test_timeout_pool_free", timer_test_timeout_pool_free}, {"test_odp_timer_cancel", timer_test_odp_timer_cancel}, @@ -537,7 +537,7 @@ static CU_TestInfo timer_suite[] = { CU_TEST_INFO_NULL, }; -static CU_SuiteInfo timer_suites[] = { +CU_SuiteInfo timer_suites[] = { {"Timer", NULL, NULL, NULL, NULL, timer_suite}, CU_SUITE_INFO_NULL, }; diff --git a/test/validation/timer/timer.h b/test/validation/timer/timer.h index 5bdf9082a..3694671f0 100644 --- a/test/validation/timer/timer.h +++ b/test/validation/timer/timer.h @@ -7,6 +7,21 @@ #ifndef _ODP_TEST_TIMER_H_ #define _ODP_TEST_TIMER_H_ +#include <CUnit/Basic.h> + +/* test functions: */ +void timer_test_timeout_pool_alloc(void); +void timer_test_timeout_pool_free(void); +void timer_test_odp_timer_cancel(void); +void timer_test_odp_timer_all(void); + +/* test arrays: */ +extern CU_TestInfo timer_suite[]; + +/* test registry: */ +extern CU_SuiteInfo timer_suites[]; + +/* main test program: */ int timer_main(void); #endif |