Message ID | 1417414566-11985-1-git-send-email-yan.songming@linaro.org |
---|---|
State | New |
Headers | show |
On 1 December 2014 at 01:16, Yan Sonming <yan.songming@linaro.org> wrote: > Add odp_version.c to test api of odp_version.h. > > Signed-off-by: Yan Songming <yan.songming@linaro.org> > --- > test/validation/.gitignore | 1 + > test/validation/Makefile.am | 4 ++- > test/validation/odp_version.c | 70 > +++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 74 insertions(+), 1 deletion(-) > create mode 100644 test/validation/odp_version.c > > diff --git a/test/validation/.gitignore b/test/validation/.gitignore > index 696cf0a..dbf590c 100644 > --- a/test/validation/.gitignore > +++ b/test/validation/.gitignore > @@ -3,3 +3,4 @@ > odp_init > odp_queue > odp_crypto > +odp_version > diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am > index 0b831d0..f43554d 100644 > --- a/test/validation/Makefile.am > +++ b/test/validation/Makefile.am > @@ -6,11 +6,12 @@ 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 > +bin_PROGRAMS = odp_init odp_queue odp_crypto odp_version > odp_init_LDFLAGS = $(AM_LDFLAGS) > odp_queue_LDFLAGS = $(AM_LDFLAGS) > odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto > odp_crypto_LDFLAGS = $(AM_LDFLAGS) > +odp_version_LDFLAGS = $(AM_LDFLAGS) > endif > > dist_odp_init_SOURCES = odp_init.c > @@ -18,3 +19,4 @@ dist_odp_queue_SOURCES = odp_queue.c > dist_odp_crypto_SOURCES = crypto/odp_crypto_test_async_inp.c \ > crypto/odp_crypto_test_sync_inp.c \ > odp_crypto.c > +dist_odp_version_SOURCES = odp_version.c > diff --git a/test/validation/odp_version.c b/test/validation/odp_version.c > new file mode 100644 > index 0000000..b5c0a16 > --- /dev/null > +++ b/test/validation/odp_version.c > @@ -0,0 +1,70 @@ > +/* 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_version_impl_str(void) > +{ > + const char *impl; > + > + impl = odp_version_impl_str(); > + CU_ASSERT(strlen(impl) > 0) > +} > + > +static void test_odp_version_api_str(void) > +{ > + const char *api; > + > + api = odp_version_api_str(); > + CU_ASSERT(strlen(api) > 0) > +} > + > +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()); > + > + return 0; > +} > + > +CU_TestInfo test_odp_version[] = { > + {"odp_version_impl_str", test_odp_version_impl_str}, > + {"odp_version_api_str", test_odp_version_api_str}, > + CU_TEST_INFO_NULL, > +}; > + > +CU_SuiteInfo suites[] = { > + {"odp_system", init_suite, NULL, NULL, NULL, test_odp_version}, > I think this test belongs to the logical group http://docs.opendataplane.org/odp/html/group__odp__ver__abt__log__dbg.html As defined right now the logical group odp_system should be these tests http://docs.opendataplane.org/odp/html/group__odp__system.html > + CU_SUITE_INFO_NULL, > +}; > + > +int main(void) > +{ > + int ret; > + > + if (odp_init_global(NULL, NULL)) { > + printf("ODP global init failed.\n"); > + return -1; > + } > + odp_init_local(); > + > + 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(); > + > + odp_term_local(); > + odp_term_global(); > + > + return ret; > +} > -- > 1.8.3.1 > > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > http://lists.linaro.org/mailman/listinfo/lng-odp >
diff --git a/test/validation/.gitignore b/test/validation/.gitignore index 696cf0a..dbf590c 100644 --- a/test/validation/.gitignore +++ b/test/validation/.gitignore @@ -3,3 +3,4 @@ odp_init odp_queue odp_crypto +odp_version diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am index 0b831d0..f43554d 100644 --- a/test/validation/Makefile.am +++ b/test/validation/Makefile.am @@ -6,11 +6,12 @@ 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 +bin_PROGRAMS = odp_init odp_queue odp_crypto odp_version odp_init_LDFLAGS = $(AM_LDFLAGS) odp_queue_LDFLAGS = $(AM_LDFLAGS) odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto odp_crypto_LDFLAGS = $(AM_LDFLAGS) +odp_version_LDFLAGS = $(AM_LDFLAGS) endif dist_odp_init_SOURCES = odp_init.c @@ -18,3 +19,4 @@ dist_odp_queue_SOURCES = odp_queue.c dist_odp_crypto_SOURCES = crypto/odp_crypto_test_async_inp.c \ crypto/odp_crypto_test_sync_inp.c \ odp_crypto.c +dist_odp_version_SOURCES = odp_version.c diff --git a/test/validation/odp_version.c b/test/validation/odp_version.c new file mode 100644 index 0000000..b5c0a16 --- /dev/null +++ b/test/validation/odp_version.c @@ -0,0 +1,70 @@ +/* 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_version_impl_str(void) +{ + const char *impl; + + impl = odp_version_impl_str(); + CU_ASSERT(strlen(impl) > 0) +} + +static void test_odp_version_api_str(void) +{ + const char *api; + + api = odp_version_api_str(); + CU_ASSERT(strlen(api) > 0) +} + +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()); + + return 0; +} + +CU_TestInfo test_odp_version[] = { + {"odp_version_impl_str", test_odp_version_impl_str}, + {"odp_version_api_str", test_odp_version_api_str}, + CU_TEST_INFO_NULL, +}; + +CU_SuiteInfo suites[] = { + {"odp_system", init_suite, NULL, NULL, NULL, test_odp_version}, + CU_SUITE_INFO_NULL, +}; + +int main(void) +{ + int ret; + + if (odp_init_global(NULL, NULL)) { + printf("ODP global init failed.\n"); + return -1; + } + odp_init_local(); + + 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(); + + odp_term_local(); + odp_term_global(); + + return ret; +}
Add odp_version.c to test api of odp_version.h. Signed-off-by: Yan Songming <yan.songming@linaro.org> --- test/validation/.gitignore | 1 + test/validation/Makefile.am | 4 ++- test/validation/odp_version.c | 70 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 test/validation/odp_version.c