On 4 August 2016 at 04:58, Christophe Milard <christophe.mil...@linaro.org> wrote:
> At installation time (make install) all tests executables are copied > into a single directory (lib/odp/tests). > Having two modules with identical names on the two interfaces (api and drv) > leads to the same test executable name ('atomic_main' in this case). > As a consequence one of the test overwrites the other at copy time, > and is run twice at make check install (successfully, so no error is > shown). > We therefore have to guarantee module name unicity over ODP: we > cannot have an atomic module on the drv interface if such a module > name already exists on the api interface. > The atomic module from the drv interface is hence renamed drvatomic. > Rather than add this scoping to each test by hand, can drv tests be in lib/odp/drv/tests so that they all get scoped automatically ? I know this means altering the path that the executables are found on which may not be that easy so this is just a thought. > > Signed-off-by: Christophe Milard <christophe.mil...@linaro.org> > --- > test/common_plat/m4/configure.m4 | 2 +- > test/common_plat/validation/drv/Makefile.am | 2 +- > test/common_plat/validation/drv/atomic/.gitignore | 1 - > test/common_plat/validation/drv/atomic/Makefile.am | 10 ---- > test/common_plat/validation/drv/atomic/atomic.h | 38 --------------- > .../validation/drv/drvatomic/.gitignore | 1 + > .../validation/drv/drvatomic/Makefile.am | 10 ++++ > .../drv/{atomic/atomic.c => drvatomic/drvatomic.c} | 54 > +++++++++++----------- > .../validation/drv/drvatomic/drvatomic.h | 35 ++++++++++++++ > .../atomic_main.c => drvatomic/drvatomic_main.c} | 4 +- > test/linux-generic/Makefile.am | 2 +- > 11 files changed, 78 insertions(+), 81 deletions(-) > delete mode 100644 test/common_plat/validation/drv/atomic/.gitignore > delete mode 100644 test/common_plat/validation/drv/atomic/Makefile.am > delete mode 100644 test/common_plat/validation/drv/atomic/atomic.h > create mode 100644 test/common_plat/validation/drv/drvatomic/.gitignore > create mode 100644 test/common_plat/validation/drv/drvatomic/Makefile.am > rename test/common_plat/validation/drv/{atomic/atomic.c => > drvatomic/drvatomic.c} (94%) > create mode 100644 test/common_plat/validation/drv/drvatomic/drvatomic.h > rename test/common_plat/validation/drv/{atomic/atomic_main.c => > drvatomic/drvatomic_main.c} (72%) > > diff --git a/test/common_plat/m4/configure.m4 > b/test/common_plat/m4/configure.m4 > index bfde6cb..20c3a3b 100644 > --- a/test/common_plat/m4/configure.m4 > +++ b/test/common_plat/m4/configure.m4 > @@ -32,4 +32,4 @@ AC_CONFIG_FILES([test/common_plat/Makefile > test/common_plat/validation/api/timer/Makefile > test/common_plat/validation/api/traffic_mngr/Makefile > test/common_plat/validation/drv/Makefile > - test/common_plat/validation/drv/atomic/Makefile]) > + test/common_plat/validation/drv/drvatomic/Makefile]) > diff --git a/test/common_plat/validation/drv/Makefile.am > b/test/common_plat/validation/drv/Makefile.am > index 0dae3c3..eedbad5 100644 > --- a/test/common_plat/validation/drv/Makefile.am > +++ b/test/common_plat/validation/drv/Makefile.am > @@ -1,4 +1,4 @@ > -ODPDRV_MODULES = atomic > +ODPDRV_MODULES = drvatomic > > SUBDIRS = $(ODPDRV_MODULES) > > diff --git a/test/common_plat/validation/drv/atomic/.gitignore > b/test/common_plat/validation/drv/atomic/.gitignore > deleted file mode 100644 > index 610ffea..0000000 > --- a/test/common_plat/validation/drv/atomic/.gitignore > +++ /dev/null > @@ -1 +0,0 @@ > -atomic_main > diff --git a/test/common_plat/validation/drv/atomic/Makefile.am > b/test/common_plat/validation/drv/atomic/Makefile.am > deleted file mode 100644 > index 9b6bd63..0000000 > --- a/test/common_plat/validation/drv/atomic/Makefile.am > +++ /dev/null > @@ -1,10 +0,0 @@ > -include ../Makefile.inc > - > -noinst_LTLIBRARIES = libtestatomic.la > -libtestatomic_la_SOURCES = atomic.c > - > -test_PROGRAMS = atomic_main$(EXEEXT) > -dist_atomic_main_SOURCES = atomic_main.c > -atomic_main_LDADD = libtestatomic.la $(LIBCUNIT_COMMON) $(LIBODP) > - > -EXTRA_DIST = atomic.h > diff --git a/test/common_plat/validation/drv/atomic/atomic.h > b/test/common_plat/validation/drv/atomic/atomic.h > deleted file mode 100644 > index 438c0a3..0000000 > --- a/test/common_plat/validation/drv/atomic/atomic.h > +++ /dev/null > @@ -1,38 +0,0 @@ > -/* Copyright (c) 2016, Linaro Limited > - * All rights reserved. > - * > - * SPDX-License-Identifier: BSD-3-Clause > - */ > - > -#ifndef _ODP_TEST_ATOMIC_H_ > -#define _ODP_TEST_ATOMIC_H_ > - > -#include <odp_cunit_common.h> > - > -/* test functions: */ > -void atomic_test_atomic_inc_dec(void); > -void atomic_test_atomic_add_sub(void); > -void atomic_test_atomic_fetch_inc_dec(void); > -void atomic_test_atomic_fetch_add_sub(void); > -void atomic_test_atomic_max_min(void); > -void atomic_test_atomic_cas_inc_dec(void); > -void atomic_test_atomic_xchg(void); > -void atomic_test_atomic_non_relaxed(void); > -void atomic_test_atomic_op_lock_free(void); > - > -/* test arrays: */ > -extern odp_testinfo_t atomic_suite_atomic[]; > - > -/* test array init/term functions: */ > -int atomic_suite_init(void); > - > -/* test registry: */ > -extern odp_suiteinfo_t atomic_suites[]; > - > -/* executable init/term functions: */ > -int atomic_init(odp_instance_t *inst); > - > -/* main test program: */ > -int atomic_main(int argc, char *argv[]); > - > -#endif > diff --git a/test/common_plat/validation/drv/drvatomic/.gitignore > b/test/common_plat/validation/drv/drvatomic/.gitignore > new file mode 100644 > index 0000000..3b5e510 > --- /dev/null > +++ b/test/common_plat/validation/drv/drvatomic/.gitignore > @@ -0,0 +1 @@ > +drvatomic_main > diff --git a/test/common_plat/validation/drv/drvatomic/Makefile.am > b/test/common_plat/validation/drv/drvatomic/Makefile.am > new file mode 100644 > index 0000000..53e971c > --- /dev/null > +++ b/test/common_plat/validation/drv/drvatomic/Makefile.am > @@ -0,0 +1,10 @@ > +include ../Makefile.inc > + > +noinst_LTLIBRARIES = libtestdrvatomic.la > +libtestdrvatomic_la_SOURCES = drvatomic.c > + > +test_PROGRAMS = drvatomic_main$(EXEEXT) > +dist_drvatomic_main_SOURCES = drvatomic_main.c > +drvatomic_main_LDADD = libtestdrvatomic.la $(LIBCUNIT_COMMON) $(LIBODP) > + > +EXTRA_DIST = drvatomic.h > diff --git a/test/common_plat/validation/drv/atomic/atomic.c > b/test/common_plat/validation/drv/drvatomic/drvatomic.c > similarity index 94% > rename from test/common_plat/validation/drv/atomic/atomic.c > rename to test/common_plat/validation/drv/drvatomic/drvatomic.c > index 162f6e4..cc5e441 100644 > --- a/test/common_plat/validation/drv/atomic/atomic.c > +++ b/test/common_plat/validation/drv/drvatomic/drvatomic.c > @@ -10,7 +10,7 @@ > #include <CUnit/Basic.h> > #include <odp_cunit_common.h> > #include <unistd.h> > -#include "atomic.h" > +#include "drvatomic.h" > > #define VERBOSE 0 > #define MAX_ITERATIONS 1000 > @@ -541,7 +541,7 @@ static void test_atomic_validate(int check) > } > } > > -int atomic_init(odp_instance_t *inst) > +int drvatomic_init(odp_instance_t *inst) > { > uint32_t workers_count, max_threads; > int ret = 0; > @@ -707,48 +707,48 @@ static void test_atomic_functional(int func_ptr(void > *), int check) > test_atomic_validate(check); > } > > -void atomic_test_atomic_inc_dec(void) > +void drvatomic_test_atomic_inc_dec(void) > { > test_atomic_functional(test_atomic_inc_dec_thread, 0); > } > > -void atomic_test_atomic_add_sub(void) > +void drvatomic_test_atomic_add_sub(void) > { > test_atomic_functional(test_atomic_add_sub_thread, 0); > } > > -void atomic_test_atomic_fetch_inc_dec(void) > +void drvatomic_test_atomic_fetch_inc_dec(void) > { > test_atomic_functional(test_atomic_fetch_inc_dec_thread, 0); > } > > -void atomic_test_atomic_fetch_add_sub(void) > +void drvatomic_test_atomic_fetch_add_sub(void) > { > test_atomic_functional(test_atomic_fetch_add_sub_thread, 0); > } > > -void atomic_test_atomic_max_min(void) > +void drvatomic_test_atomic_max_min(void) > { > test_atomic_functional(test_atomic_max_min_thread, CHECK_MAX_MIN); > } > > -void atomic_test_atomic_cas_inc_dec(void) > +void drvatomic_test_atomic_cas_inc_dec(void) > { > test_atomic_functional(test_atomic_cas_inc_dec_thread, 0); > } > > -void atomic_test_atomic_xchg(void) > +void drvatomic_test_atomic_xchg(void) > { > test_atomic_functional(test_atomic_xchg_thread, CHECK_XCHG); > } > > -void atomic_test_atomic_non_relaxed(void) > +void drvatomic_test_atomic_non_relaxed(void) > { > test_atomic_functional(test_atomic_non_relaxed_thread, > CHECK_MAX_MIN | CHECK_XCHG); > } > > -void atomic_test_atomic_op_lock_free(void) > +void drvatomic_test_atomic_op_lock_free(void) > { > odpdrv_atomic_op_t atomic_op; > int ret_null, ret; > @@ -854,26 +854,26 @@ void atomic_test_atomic_op_lock_free(void) > } > } > > -odp_testinfo_t atomic_suite_atomic[] = { > - ODP_TEST_INFO(atomic_test_atomic_inc_dec), > - ODP_TEST_INFO(atomic_test_atomic_add_sub), > - ODP_TEST_INFO(atomic_test_atomic_fetch_inc_dec), > - ODP_TEST_INFO(atomic_test_atomic_fetch_add_sub), > - ODP_TEST_INFO(atomic_test_atomic_max_min), > - ODP_TEST_INFO(atomic_test_atomic_cas_inc_dec), > - ODP_TEST_INFO(atomic_test_atomic_xchg), > - ODP_TEST_INFO(atomic_test_atomic_non_relaxed), > - ODP_TEST_INFO(atomic_test_atomic_op_lock_free), > +odp_testinfo_t drvatomic_suite_atomic[] = { > + ODP_TEST_INFO(drvatomic_test_atomic_inc_dec), > + ODP_TEST_INFO(drvatomic_test_atomic_add_sub), > + ODP_TEST_INFO(drvatomic_test_atomic_fetch_inc_dec), > + ODP_TEST_INFO(drvatomic_test_atomic_fetch_add_sub), > + ODP_TEST_INFO(drvatomic_test_atomic_max_min), > + ODP_TEST_INFO(drvatomic_test_atomic_cas_inc_dec), > + ODP_TEST_INFO(drvatomic_test_atomic_xchg), > + ODP_TEST_INFO(drvatomic_test_atomic_non_relaxed), > + ODP_TEST_INFO(drvatomic_test_atomic_op_lock_free), > ODP_TEST_INFO_NULL, > }; > > -odp_suiteinfo_t atomic_suites[] = { > - {"atomic", NULL, NULL, > - atomic_suite_atomic}, > +odp_suiteinfo_t drvatomic_suites[] = { > + {"drvatomic", NULL, NULL, > + drvatomic_suite_atomic}, > ODP_SUITE_INFO_NULL > }; > > -int atomic_main(int argc, char *argv[]) > +int drvatomic_main(int argc, char *argv[]) > { > int ret; > > @@ -881,9 +881,9 @@ int atomic_main(int argc, char *argv[]) > if (odp_cunit_parse_options(argc, argv)) > return -1; > > - odp_cunit_register_global_init(atomic_init); > + odp_cunit_register_global_init(drvatomic_init); > > - ret = odp_cunit_register(atomic_suites); > + ret = odp_cunit_register(drvatomic_suites); > > if (ret == 0) > ret = odp_cunit_run(); > diff --git a/test/common_plat/validation/drv/drvatomic/drvatomic.h > b/test/common_plat/validation/drv/drvatomic/drvatomic.h > new file mode 100644 > index 0000000..02ce14a > --- /dev/null > +++ b/test/common_plat/validation/drv/drvatomic/drvatomic.h > @@ -0,0 +1,35 @@ > +/* Copyright (c) 2016, Linaro Limited > + * All rights reserved. > + * > + * SPDX-License-Identifier: BSD-3-Clause > + */ > + > +#ifndef _ODP_TEST_ATOMIC_H_ > +#define _ODP_TEST_ATOMIC_H_ > + > +#include <odp_cunit_common.h> > + > +/* test functions: */ > +void drvatomic_test_atomic_inc_dec(void); > +void drvatomic_test_atomic_add_sub(void); > +void drvatomic_test_atomic_fetch_inc_dec(void); > +void drvatomic_test_atomic_fetch_add_sub(void); > +void drvatomic_test_atomic_max_min(void); > +void drvatomic_test_atomic_cas_inc_dec(void); > +void drvatomic_test_atomic_xchg(void); > +void drvatomic_test_atomic_non_relaxed(void); > +void drvatomic_test_atomic_op_lock_free(void); > + > +/* test arrays: */ > +extern odp_testinfo_t drvatomic_suite_atomic[]; > + > +/* test registry: */ > +extern odp_suiteinfo_t drvatomic_suites[]; > + > +/* executable init/term functions: */ > +int drvatomic_init(odp_instance_t *inst); > + > +/* main test program: */ > +int drvatomic_main(int argc, char *argv[]); > + > +#endif > diff --git a/test/common_plat/validation/drv/atomic/atomic_main.c > b/test/common_plat/validation/drv/drvatomic/drvatomic_main.c > similarity index 72% > rename from test/common_plat/validation/drv/atomic/atomic_main.c > rename to test/common_plat/validation/drv/drvatomic/drvatomic_main.c > index b290087..390a3e2 100644 > --- a/test/common_plat/validation/drv/atomic/atomic_main.c > +++ b/test/common_plat/validation/drv/drvatomic/drvatomic_main.c > @@ -4,9 +4,9 @@ > * SPDX-License-Identifier: BSD-3-Clause > */ > > -#include "atomic.h" > +#include "drvatomic.h" > > int main(int argc, char *argv[]) > { > - return atomic_main(argc, argv); > + return drvatomic_main(argc, argv); > } > diff --git a/test/linux-generic/Makefile.am > b/test/linux-generic/Makefile.am > index 1cee6e7..df10c61 100644 > --- a/test/linux-generic/Makefile.am > +++ b/test/linux-generic/Makefile.am > @@ -34,7 +34,7 @@ TESTS = validation/api/pktio/pktio_run.sh \ > $(ALL_API_VALIDATION_DIR)/traffic_mngr/traffic_mngr_main$(EXEEXT) \ > $(ALL_API_VALIDATION_DIR)/shmem/shmem_main$(EXEEXT) \ > $(ALL_API_VALIDATION_DIR)/system/system_main$(EXEEXT) \ > - $(ALL_DRV_VALIDATION_DIR)/atomic/atomic_main$(EXEEXT) \ > + $(ALL_DRV_VALIDATION_DIR)/drvatomic/drvatomic_main$(EXEEXT) \ > ring/ring_main$(EXEEXT) > > SUBDIRS += validation/api/pktio\ > -- > 2.7.4 > > -- Mike Holmes Technical Manager - Linaro Networking Group Linaro.org <http://www.linaro.org/> *│ *Open source software for ARM SoCs "Work should be fun and collaborative, the rest follows"