Message ID | 1417471243-17795-1-git-send-email-mike.holmes@linaro.org |
---|---|
State | Changes Requested |
Headers | show |
On 2 December 2014 at 06:00, Mike Holmes <mike.holmes@linaro.org> wrote: > Signed-off-by: Mike Holmes <mike.holmes@linaro.org> > --- > Reviewed-by: Yan Songming <yan.songming@linaro.org> > test/validation/.gitignore | 1 + > test/validation/Makefile.am | 4 +- > test/validation/odp_system.c | 114 > +++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 118 insertions(+), 1 deletion(-) > create mode 100644 test/validation/odp_system.c > > diff --git a/test/validation/.gitignore b/test/validation/.gitignore > index 37e2594..e3b86f6 100644 > --- a/test/validation/.gitignore > +++ b/test/validation/.gitignore > @@ -4,3 +4,4 @@ odp_init > odp_queue > odp_crypto > odp_shm > +odp_system > diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am > index 4bee2ab..1e02f27 100644 > --- a/test/validation/Makefile.am > +++ b/test/validation/Makefile.am > @@ -6,13 +6,14 @@ AM_LDFLAGS += -L$(CUNIT_PATH)/lib -static -lcunit > if ODP_CUNIT_ENABLED > TESTS = ${bin_PROGRAMS} > check_PROGRAMS = ${bin_PROGRAMS} > -bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm > +bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_system > odp_init_LDFLAGS = $(AM_LDFLAGS) > odp_queue_LDFLAGS = $(AM_LDFLAGS) > odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto > odp_crypto_LDFLAGS = $(AM_LDFLAGS) > odp_shm_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/common > odp_shm_LDFLAGS = $(AM_LDFLAGS) > +odp_system_LDFLAGS = $(AM_LDFLAGS) > endif > > dist_odp_init_SOURCES = odp_init.c > @@ -21,3 +22,4 @@ dist_odp_crypto_SOURCES = > crypto/odp_crypto_test_async_inp.c \ > crypto/odp_crypto_test_sync_inp.c \ > odp_crypto.c > dist_odp_shm_SOURCES = odp_shm.c common/odp_cunit_common.c > +dist_odp_system_SOURCES = odp_system.c > diff --git a/test/validation/odp_system.c b/test/validation/odp_system.c > new file mode 100644 > index 0000000..938981b > --- /dev/null > +++ b/test/validation/odp_system.c > @@ -0,0 +1,114 @@ > +/* Copyright (c) 2014, Linaro Limited > + * All rights reserved. > + * > + * SPDX-License-Identifier: BSD-3-Clause > + */ > + > +#include "odp.h" > +#include "CUnit/Basic.h" > + > +static void test_odp_sys_core_count(void) > +{ > + int cores; > + > + cores = odp_sys_core_count(); > + CU_ASSERT(0 < cores) > +} > + > +static void test_odp_sys_cache_line_size(void) > +{ > + uint64_t cache_size; > + > + cache_size = odp_sys_cache_line_size(); > + CU_ASSERT(0 < cache_size) > +} > + > +static void test_odp_sys_cpu_model_str(void) > +{ > + char model[128]; > + > + strcpy(model, odp_sys_cpu_model_str()); > + CU_ASSERT(strlen(model) > 0) > + CU_ASSERT(strlen(model) < 127) > +} > + > +static void test_odp_sys_page_size(void) > +{ > + uint64_t page; > + > + page = odp_sys_page_size(); > + CU_ASSERT(0 < page) > +} > + > +static void test_odp_sys_huge_page_size(void) > +{ > + uint64_t page; > + > + page = odp_sys_huge_page_size(); > + CU_ASSERT(0 < page) > +} > + > +static void test_odp_sys_cpu_hz(void) > +{ > + uint64_t hz; > + > + hz = odp_sys_cpu_hz(); > + CU_ASSERT(0 < hz) > +} > + > +static int init_suite(void) > +{ > + printf("\tODP API version: %s\n", odp_version_api_str()); > + printf("\tODP implementation version: %s\n", > odp_version_impl_str()); > + > + if (odp_init_global(NULL, NULL)) { > + printf("ODP global init failed.\n"); > + return -1; > + } > + odp_init_local(); > + > + return 0; > +} > + > +static int finalise(void) > +{ > + odp_term_local(); > + odp_term_global(); > + > + return 0; > +} > + > +CU_TestInfo test_odp_system[] = { > + {"odp_sys_core_count", test_odp_sys_core_count}, > + {"odp_sys_cache_line_size", test_odp_sys_cache_line_size}, > + {"odp_sys_cpu_model_str", test_odp_sys_cpu_model_str}, > + {"odp_sys_page_size", test_odp_sys_page_size}, > + {"odp_sys_huge_page_size", test_odp_sys_huge_page_size}, > + {"odp_sys_cpu_hz", test_odp_sys_cpu_hz}, > + CU_TEST_INFO_NULL, > +}; > + > +CU_SuiteInfo suites[] = { > + {"odp_system", init_suite, finalise, NULL, NULL, > + test_odp_system}, > + CU_SUITE_INFO_NULL, > +}; > + > + > +int main(void) > +{ > + int ret; > + > + CU_set_error_action(CUEA_ABORT); > + > + CU_initialize_registry(); > + CU_register_suites(suites); > + CU_basic_set_mode(CU_BRM_VERBOSE); > + CU_basic_run_tests(); > + > + ret = CU_get_number_of_failure_records(); > + > + CU_cleanup_registry(); > + > + return ret; > +} > -- > 2.1.0 > > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > http://lists.linaro.org/mailman/listinfo/lng-odp >
On 1 Dec 2014 23:01, "Mike Holmes" <mike.holmes@linaro.org> wrote: > > Signed-off-by: Mike Holmes <mike.holmes@linaro.org> > --- > test/validation/.gitignore | 1 + > test/validation/Makefile.am | 4 +- > test/validation/odp_system.c | 114 +++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 118 insertions(+), 1 deletion(-) > create mode 100644 test/validation/odp_system.c > > diff --git a/test/validation/.gitignore b/test/validation/.gitignore > index 37e2594..e3b86f6 100644 > --- a/test/validation/.gitignore > +++ b/test/validation/.gitignore > @@ -4,3 +4,4 @@ odp_init > odp_queue > odp_crypto > odp_shm > +odp_system > diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am > index 4bee2ab..1e02f27 100644 > --- a/test/validation/Makefile.am > +++ b/test/validation/Makefile.am > @@ -6,13 +6,14 @@ AM_LDFLAGS += -L$(CUNIT_PATH)/lib -static -lcunit > if ODP_CUNIT_ENABLED > TESTS = ${bin_PROGRAMS} > check_PROGRAMS = ${bin_PROGRAMS} > -bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm > +bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_system > odp_init_LDFLAGS = $(AM_LDFLAGS) > odp_queue_LDFLAGS = $(AM_LDFLAGS) > odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto > odp_crypto_LDFLAGS = $(AM_LDFLAGS) > odp_shm_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/common > odp_shm_LDFLAGS = $(AM_LDFLAGS) > +odp_system_LDFLAGS = $(AM_LDFLAGS) > endif > > dist_odp_init_SOURCES = odp_init.c > @@ -21,3 +22,4 @@ dist_odp_crypto_SOURCES = crypto/odp_crypto_test_async_inp.c \ > crypto/odp_crypto_test_sync_inp.c \ > odp_crypto.c > dist_odp_shm_SOURCES = odp_shm.c common/odp_cunit_common.c > +dist_odp_system_SOURCES = odp_system.c > diff --git a/test/validation/odp_system.c b/test/validation/odp_system.c > new file mode 100644 > index 0000000..938981b > --- /dev/null > +++ b/test/validation/odp_system.c > @@ -0,0 +1,114 @@ > +/* Copyright (c) 2014, Linaro Limited > + * All rights reserved. > + * > + * SPDX-License-Identifier: BSD-3-Clause > + */ > + > +#include "odp.h" > +#include "CUnit/Basic.h" > + > +static void test_odp_sys_core_count(void) > +{ > + int cores; > + > + cores = odp_sys_core_count(); > + CU_ASSERT(0 < cores) > +} > + > +static void test_odp_sys_cache_line_size(void) > +{ > + uint64_t cache_size; > + > + cache_size = odp_sys_cache_line_size(); > + CU_ASSERT(0 < cache_size) > +} > + > +static void test_odp_sys_cpu_model_str(void) > +{ > + char model[128]; > + > + strcpy(model, odp_sys_cpu_model_str()); > + CU_ASSERT(strlen(model) > 0) > + CU_ASSERT(strlen(model) < 127) > +} > + > +static void test_odp_sys_page_size(void) > +{ > + uint64_t page; > + > + page = odp_sys_page_size(); > + CU_ASSERT(0 < page) > +} > + > +static void test_odp_sys_huge_page_size(void) > +{ > + uint64_t page; > + > + page = odp_sys_huge_page_size(); > + CU_ASSERT(0 < page) > +} > + > +static void test_odp_sys_cpu_hz(void) > +{ > + uint64_t hz; > + > + hz = odp_sys_cpu_hz(); > + CU_ASSERT(0 < hz) > +} > + > +static int init_suite(void) > +{ > + printf("\tODP API version: %s\n", odp_version_api_str()); > + printf("\tODP implementation version: %s\n", odp_version_impl_str()); > + > + if (odp_init_global(NULL, NULL)) { > + printf("ODP global init failed.\n"); > + return -1; > + } > + odp_init_local(); > + > + return 0; > +} > + > +static int finalise(void) > +{ > + odp_term_local(); > + odp_term_global(); > + > + return 0; > +} > + > +CU_TestInfo test_odp_system[] = { > + {"odp_sys_core_count", test_odp_sys_core_count}, > + {"odp_sys_cache_line_size", test_odp_sys_cache_line_size}, > + {"odp_sys_cpu_model_str", test_odp_sys_cpu_model_str}, > + {"odp_sys_page_size", test_odp_sys_page_size}, > + {"odp_sys_huge_page_size", test_odp_sys_huge_page_size}, > + {"odp_sys_cpu_hz", test_odp_sys_cpu_hz}, > + CU_TEST_INFO_NULL, > +}; > + > +CU_SuiteInfo suites[] = { Change to odp_testsuites > + {"odp_system", init_suite, finalise, NULL, NULL, > + test_odp_system}, > + CU_SUITE_INFO_NULL, > +}; > + > + > +int main(void) > +{ > + int ret; > + > + CU_set_error_action(CUEA_ABORT); > + > + CU_initialize_registry(); > + CU_register_suites(suites); > + CU_basic_set_mode(CU_BRM_VERBOSE); > + CU_basic_run_tests(); > + > + ret = CU_get_number_of_failure_records(); > + > + CU_cleanup_registry(); > + > + return ret; > +} > -- > 2.1.0 > > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > http://lists.linaro.org/mailman/listinfo/lng-odp
On 12/02/2014 11:40 AM, Anders Roxell wrote: > > > +CU_SuiteInfo suites[] = { > > Change to odp_testsuites > Reason for that? Everywhere we use simple suites. But it has to be 'static'. Maxim.
diff --git a/test/validation/.gitignore b/test/validation/.gitignore index 37e2594..e3b86f6 100644 --- a/test/validation/.gitignore +++ b/test/validation/.gitignore @@ -4,3 +4,4 @@ odp_init odp_queue odp_crypto odp_shm +odp_system diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am index 4bee2ab..1e02f27 100644 --- a/test/validation/Makefile.am +++ b/test/validation/Makefile.am @@ -6,13 +6,14 @@ AM_LDFLAGS += -L$(CUNIT_PATH)/lib -static -lcunit if ODP_CUNIT_ENABLED TESTS = ${bin_PROGRAMS} check_PROGRAMS = ${bin_PROGRAMS} -bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm +bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_system odp_init_LDFLAGS = $(AM_LDFLAGS) odp_queue_LDFLAGS = $(AM_LDFLAGS) odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto odp_crypto_LDFLAGS = $(AM_LDFLAGS) odp_shm_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/common odp_shm_LDFLAGS = $(AM_LDFLAGS) +odp_system_LDFLAGS = $(AM_LDFLAGS) endif dist_odp_init_SOURCES = odp_init.c @@ -21,3 +22,4 @@ dist_odp_crypto_SOURCES = crypto/odp_crypto_test_async_inp.c \ crypto/odp_crypto_test_sync_inp.c \ odp_crypto.c dist_odp_shm_SOURCES = odp_shm.c common/odp_cunit_common.c +dist_odp_system_SOURCES = odp_system.c diff --git a/test/validation/odp_system.c b/test/validation/odp_system.c new file mode 100644 index 0000000..938981b --- /dev/null +++ b/test/validation/odp_system.c @@ -0,0 +1,114 @@ +/* Copyright (c) 2014, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include "odp.h" +#include "CUnit/Basic.h" + +static void test_odp_sys_core_count(void) +{ + int cores; + + cores = odp_sys_core_count(); + CU_ASSERT(0 < cores) +} + +static void test_odp_sys_cache_line_size(void) +{ + uint64_t cache_size; + + cache_size = odp_sys_cache_line_size(); + CU_ASSERT(0 < cache_size) +} + +static void test_odp_sys_cpu_model_str(void) +{ + char model[128]; + + strcpy(model, odp_sys_cpu_model_str()); + CU_ASSERT(strlen(model) > 0) + CU_ASSERT(strlen(model) < 127) +} + +static void test_odp_sys_page_size(void) +{ + uint64_t page; + + page = odp_sys_page_size(); + CU_ASSERT(0 < page) +} + +static void test_odp_sys_huge_page_size(void) +{ + uint64_t page; + + page = odp_sys_huge_page_size(); + CU_ASSERT(0 < page) +} + +static void test_odp_sys_cpu_hz(void) +{ + uint64_t hz; + + hz = odp_sys_cpu_hz(); + CU_ASSERT(0 < hz) +} + +static int init_suite(void) +{ + printf("\tODP API version: %s\n", odp_version_api_str()); + printf("\tODP implementation version: %s\n", odp_version_impl_str()); + + if (odp_init_global(NULL, NULL)) { + printf("ODP global init failed.\n"); + return -1; + } + odp_init_local(); + + return 0; +} + +static int finalise(void) +{ + odp_term_local(); + odp_term_global(); + + return 0; +} + +CU_TestInfo test_odp_system[] = { + {"odp_sys_core_count", test_odp_sys_core_count}, + {"odp_sys_cache_line_size", test_odp_sys_cache_line_size}, + {"odp_sys_cpu_model_str", test_odp_sys_cpu_model_str}, + {"odp_sys_page_size", test_odp_sys_page_size}, + {"odp_sys_huge_page_size", test_odp_sys_huge_page_size}, + {"odp_sys_cpu_hz", test_odp_sys_cpu_hz}, + CU_TEST_INFO_NULL, +}; + +CU_SuiteInfo suites[] = { + {"odp_system", init_suite, finalise, NULL, NULL, + test_odp_system}, + CU_SUITE_INFO_NULL, +}; + + +int main(void) +{ + int ret; + + CU_set_error_action(CUEA_ABORT); + + CU_initialize_registry(); + CU_register_suites(suites); + CU_basic_set_mode(CU_BRM_VERBOSE); + CU_basic_run_tests(); + + ret = CU_get_number_of_failure_records(); + + CU_cleanup_registry(); + + return ret; +}
Signed-off-by: Mike Holmes <mike.holmes@linaro.org> --- test/validation/.gitignore | 1 + test/validation/Makefile.am | 4 +- test/validation/odp_system.c | 114 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 test/validation/odp_system.c