diff mbox

[3/4] validation: creating own dir and lib for init

Message ID 1435164691-6714-4-git-send-email-christophe.milard@linaro.org
State Accepted
Commit 76eb2a9e5bdab7ec7bf59aaa7ac9499c6a09461b
Headers show

Commit Message

Christophe Milard June 24, 2015, 4:51 p.m. UTC
Module init now create its own lib
(currentely only containing its executables)

Signed-off-by: Christophe Milard <christophe.milard@linaro.org>
---
 configure.ac                           |   1 +
 test/validation/.gitignore             |   3 -
 test/validation/Makefile.am            |  19 ++---
 test/validation/init/.gitignore        |   4 +
 test/validation/init/Makefile.am       |  14 +++
 test/validation/init/init.c            | 151 +++++++++++++++++++++++++++++++++
 test/validation/init/init.h            |   9 ++
 test/validation/init/init_main_abort.c |  11 +++
 test/validation/init/init_main_log.c   |  11 +++
 test/validation/init/init_main_ok.c    |  11 +++
 test/validation/init/odp_init.c        |  57 -------------
 test/validation/init/odp_init_abort.c  |  67 ---------------
 test/validation/init/odp_init_log.c    |  83 ------------------
 13 files changed, 217 insertions(+), 224 deletions(-)
 create mode 100644 test/validation/init/.gitignore
 create mode 100644 test/validation/init/Makefile.am
 create mode 100644 test/validation/init/init.c
 create mode 100644 test/validation/init/init.h
 create mode 100644 test/validation/init/init_main_abort.c
 create mode 100644 test/validation/init/init_main_log.c
 create mode 100644 test/validation/init/init_main_ok.c
 delete mode 100644 test/validation/init/odp_init.c
 delete mode 100644 test/validation/init/odp_init_abort.c
 delete mode 100644 test/validation/init/odp_init_log.c

Comments

Stuart Haslam June 29, 2015, 10:22 a.m. UTC | #1
On Wed, Jun 24, 2015 at 06:51:30PM +0200, Christophe Milard wrote:
> Module init now create its own lib
> (currentely only containing its executables)
> 
> Signed-off-by: Christophe Milard <christophe.milard@linaro.org>
> ---
>  configure.ac                           |   1 +
>  test/validation/.gitignore             |   3 -
>  test/validation/Makefile.am            |  19 ++---
>  test/validation/init/.gitignore        |   4 +
>  test/validation/init/Makefile.am       |  14 +++
>  test/validation/init/init.c            | 151 +++++++++++++++++++++++++++++++++
>  test/validation/init/init.h            |   9 ++
>  test/validation/init/init_main_abort.c |  11 +++
>  test/validation/init/init_main_log.c   |  11 +++
>  test/validation/init/init_main_ok.c    |  11 +++
>  test/validation/init/odp_init.c        |  57 -------------
>  test/validation/init/odp_init_abort.c  |  67 ---------------
>  test/validation/init/odp_init_log.c    |  83 ------------------
>  13 files changed, 217 insertions(+), 224 deletions(-)
>  create mode 100644 test/validation/init/.gitignore
>  create mode 100644 test/validation/init/Makefile.am
>  create mode 100644 test/validation/init/init.c
>  create mode 100644 test/validation/init/init.h
>  create mode 100644 test/validation/init/init_main_abort.c
>  create mode 100644 test/validation/init/init_main_log.c
>  create mode 100644 test/validation/init/init_main_ok.c
>  delete mode 100644 test/validation/init/odp_init.c
>  delete mode 100644 test/validation/init/odp_init_abort.c
>  delete mode 100644 test/validation/init/odp_init_log.c
> 
> diff --git a/configure.ac b/configure.ac
> index 68b65d5..f58b472 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -306,6 +306,7 @@ AC_CONFIG_FILES([Makefile
>  		 test/validation/classification/Makefile
>  		 test/validation/common/Makefile
>  		 test/validation/crypto/Makefile
> +		 test/validation/init/Makefile
>  		 test/validation/pktio/Makefile
>  		 test/validation/random/Makefile
>  		 test/validation/system/Makefile
> diff --git a/test/validation/.gitignore b/test/validation/.gitignore
> index 8f78055..067914f 100644
> --- a/test/validation/.gitignore
> +++ b/test/validation/.gitignore
> @@ -3,9 +3,6 @@
>  odp_ver_abt_log_dbg
>  odp_buffer
>  odp_cpumask
> -odp_init
> -odp_init_abort
> -odp_init_log
>  odp_packet
>  odp_pool
>  odp_queue
> diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
> index bccc886..44a5a74 100644
> --- a/test/validation/Makefile.am
> +++ b/test/validation/Makefile.am
> @@ -6,9 +6,6 @@ AM_LDFLAGS += -static
>  
>  EXECUTABLES = odp_buffer \
>  	      odp_cpumask \
> -	      odp_init \
> -	      odp_init_abort \
> -	      odp_init_log \
>  	      odp_packet \
>  	      odp_pool \
>  	      odp_queue \
> @@ -20,7 +17,10 @@ EXECUTABLES = odp_buffer \
>  	      odp_ver_abt_log_dbg
>  
>  if test_vald
> -TESTS = $(EXECUTABLES)
> +TESTS = $(EXECUTABLES) \
> +	init/init_main_ok \
> +	init/init_main_abort \
> +	init/init_main_log
>  endif
>  
>  bin_PROGRAMS = $(EXECUTABLES) $(COMPILE_ONLY)
> @@ -30,16 +30,6 @@ ODP_CU_COMMON=common/odp_cunit_common.c
>  odp_buffer_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/buffer
>  dist_odp_buffer_SOURCES = odp_buffer.c
>  odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto
> -odp_init_LDADD = $(top_builddir)/test/validation/common/libcunit_common.a \
> -		 $(LIB)/libodp.la
> -dist_odp_init_SOURCES	= init/odp_init.c
> -odp_init_abort_LDADD = \
> -		 $(top_builddir)/test/validation/common/libcunit_common.a \
> -		 $(LIB)/libodp.la
> -dist_odp_init_abort_SOURCES = init/odp_init_abort.c
> -odp_init_log_LDADD = $(top_builddir)/test/validation/common/libcunit_common.a \
> -		     $(LIB)/libodp.la
> -dist_odp_init_log_SOURCES = init/odp_init_log.c
>  dist_odp_queue_SOURCES	= odp_queue.c
>  odp_random_LDADD = $(top_builddir)/test/validation/common/libcunit_common.a \
>  		   $(LIB)/libodp.la
> @@ -58,6 +48,7 @@ dist_odp_ver_abt_log_dbg_SOURCES  = ver_abt_log_dbg/odp_system.c \
>  
>  ODP_MODULES = classification \
>  	      crypto \
> +	      init \
>  	      pktio \
>  	      random \
>  	      system
> diff --git a/test/validation/init/.gitignore b/test/validation/init/.gitignore
> new file mode 100644
> index 0000000..79eb713
> --- /dev/null
> +++ b/test/validation/init/.gitignore
> @@ -0,0 +1,4 @@
> +libinit.a
> +init_main_abort
> +init_main_log
> +init_main_ok
> diff --git a/test/validation/init/Makefile.am b/test/validation/init/Makefile.am
> new file mode 100644
> index 0000000..08b1ca7
> --- /dev/null
> +++ b/test/validation/init/Makefile.am
> @@ -0,0 +1,14 @@
> +include ../Makefile.inc
> +noinst_LIBRARIES = libinit.a
> +libinit_a_SOURCES = init.c
> +
> +# most platforms are expected not to support multiple ODP inits
> +# following each other: therefore 3 separate binaries are
> +# created, each containing its ODP init test.
> +bin_PROGRAMS = init_main_abort init_main_log init_main_ok
> +dist_init_main_abort_SOURCES = init_main_abort.c
> +dist_init_main_log_SOURCES   = init_main_log.c
> +dist_init_main_ok_SOURCES    = init_main_ok.c
> +init_main_abort_LDADD = libinit.a $(LIBCUNIT_COMMON) $(LIBODP)
> +init_main_log_LDADD   = libinit.a $(LIBCUNIT_COMMON) $(LIBODP)
> +init_main_ok_LDADD    = libinit.a $(LIBCUNIT_COMMON) $(LIBODP)
> diff --git a/test/validation/init/init.c b/test/validation/init/init.c
> new file mode 100644
> index 0000000..169bd5c
> --- /dev/null
> +++ b/test/validation/init/init.c
> @@ -0,0 +1,151 @@
> +/* Copyright (c) 2015, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier:     BSD-3-Clause
> + */
> +
> +#include <stdarg.h>
> +#include <stdlib.h>
> +#include <odp.h>
> +#include <CUnit/Basic.h>
> +#include "odp_cunit_common.h"
> +#include "init.h"
> +
> +/* flag set when the replacement logging function is used */
> +int replacement_logging_used;
> +
> +/* replacement abort function: */
> +static void odp_init_abort(void) ODP_NORETURN;

Checkpatch generates a CHECK on this line, but it looks like a false
positive so I'm ignoring it.
Christophe Milard June 29, 2015, 11:16 a.m. UTC | #2
On 29 June 2015 at 12:22, Stuart Haslam <stuart.haslam@linaro.org> wrote:

> On Wed, Jun 24, 2015 at 06:51:30PM +0200, Christophe Milard wrote:
> > Module init now create its own lib
> > (currentely only containing its executables)
> >
> > Signed-off-by: Christophe Milard <christophe.milard@linaro.org>
> > ---
> >  configure.ac                           |   1 +
> >  test/validation/.gitignore             |   3 -
> >  test/validation/Makefile.am            |  19 ++---
> >  test/validation/init/.gitignore        |   4 +
> >  test/validation/init/Makefile.am       |  14 +++
> >  test/validation/init/init.c            | 151
> +++++++++++++++++++++++++++++++++
> >  test/validation/init/init.h            |   9 ++
> >  test/validation/init/init_main_abort.c |  11 +++
> >  test/validation/init/init_main_log.c   |  11 +++
> >  test/validation/init/init_main_ok.c    |  11 +++
> >  test/validation/init/odp_init.c        |  57 -------------
> >  test/validation/init/odp_init_abort.c  |  67 ---------------
> >  test/validation/init/odp_init_log.c    |  83 ------------------
> >  13 files changed, 217 insertions(+), 224 deletions(-)
> >  create mode 100644 test/validation/init/.gitignore
> >  create mode 100644 test/validation/init/Makefile.am
> >  create mode 100644 test/validation/init/init.c
> >  create mode 100644 test/validation/init/init.h
> >  create mode 100644 test/validation/init/init_main_abort.c
> >  create mode 100644 test/validation/init/init_main_log.c
> >  create mode 100644 test/validation/init/init_main_ok.c
> >  delete mode 100644 test/validation/init/odp_init.c
> >  delete mode 100644 test/validation/init/odp_init_abort.c
> >  delete mode 100644 test/validation/init/odp_init_log.c
> >
> > diff --git a/configure.ac b/configure.ac
> > index 68b65d5..f58b472 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -306,6 +306,7 @@ AC_CONFIG_FILES([Makefile
> >                test/validation/classification/Makefile
> >                test/validation/common/Makefile
> >                test/validation/crypto/Makefile
> > +              test/validation/init/Makefile
> >                test/validation/pktio/Makefile
> >                test/validation/random/Makefile
> >                test/validation/system/Makefile
> > diff --git a/test/validation/.gitignore b/test/validation/.gitignore
> > index 8f78055..067914f 100644
> > --- a/test/validation/.gitignore
> > +++ b/test/validation/.gitignore
> > @@ -3,9 +3,6 @@
> >  odp_ver_abt_log_dbg
> >  odp_buffer
> >  odp_cpumask
> > -odp_init
> > -odp_init_abort
> > -odp_init_log
> >  odp_packet
> >  odp_pool
> >  odp_queue
> > diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
> > index bccc886..44a5a74 100644
> > --- a/test/validation/Makefile.am
> > +++ b/test/validation/Makefile.am
> > @@ -6,9 +6,6 @@ AM_LDFLAGS += -static
> >
> >  EXECUTABLES = odp_buffer \
> >             odp_cpumask \
> > -           odp_init \
> > -           odp_init_abort \
> > -           odp_init_log \
> >             odp_packet \
> >             odp_pool \
> >             odp_queue \
> > @@ -20,7 +17,10 @@ EXECUTABLES = odp_buffer \
> >             odp_ver_abt_log_dbg
> >
> >  if test_vald
> > -TESTS = $(EXECUTABLES)
> > +TESTS = $(EXECUTABLES) \
> > +     init/init_main_ok \
> > +     init/init_main_abort \
> > +     init/init_main_log
> >  endif
> >
> >  bin_PROGRAMS = $(EXECUTABLES) $(COMPILE_ONLY)
> > @@ -30,16 +30,6 @@ ODP_CU_COMMON=common/odp_cunit_common.c
> >  odp_buffer_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/buffer
> >  dist_odp_buffer_SOURCES = odp_buffer.c
> >  odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto
> > -odp_init_LDADD =
> $(top_builddir)/test/validation/common/libcunit_common.a \
> > -              $(LIB)/libodp.la
> > -dist_odp_init_SOURCES        = init/odp_init.c
> > -odp_init_abort_LDADD = \
> > -              $(top_builddir)/test/validation/common/libcunit_common.a \
> > -              $(LIB)/libodp.la
> > -dist_odp_init_abort_SOURCES = init/odp_init_abort.c
> > -odp_init_log_LDADD =
> $(top_builddir)/test/validation/common/libcunit_common.a \
> > -                  $(LIB)/libodp.la
> > -dist_odp_init_log_SOURCES = init/odp_init_log.c
> >  dist_odp_queue_SOURCES       = odp_queue.c
> >  odp_random_LDADD =
> $(top_builddir)/test/validation/common/libcunit_common.a \
> >                  $(LIB)/libodp.la
> > @@ -58,6 +48,7 @@ dist_odp_ver_abt_log_dbg_SOURCES  =
> ver_abt_log_dbg/odp_system.c \
> >
> >  ODP_MODULES = classification \
> >             crypto \
> > +           init \
> >             pktio \
> >             random \
> >             system
> > diff --git a/test/validation/init/.gitignore
> b/test/validation/init/.gitignore
> > new file mode 100644
> > index 0000000..79eb713
> > --- /dev/null
> > +++ b/test/validation/init/.gitignore
> > @@ -0,0 +1,4 @@
> > +libinit.a
> > +init_main_abort
> > +init_main_log
> > +init_main_ok
> > diff --git a/test/validation/init/Makefile.am
> b/test/validation/init/Makefile.am
> > new file mode 100644
> > index 0000000..08b1ca7
> > --- /dev/null
> > +++ b/test/validation/init/Makefile.am
> > @@ -0,0 +1,14 @@
> > +include ../Makefile.inc
> > +noinst_LIBRARIES = libinit.a
> > +libinit_a_SOURCES = init.c
> > +
> > +# most platforms are expected not to support multiple ODP inits
> > +# following each other: therefore 3 separate binaries are
> > +# created, each containing its ODP init test.
> > +bin_PROGRAMS = init_main_abort init_main_log init_main_ok
> > +dist_init_main_abort_SOURCES = init_main_abort.c
> > +dist_init_main_log_SOURCES   = init_main_log.c
> > +dist_init_main_ok_SOURCES    = init_main_ok.c
> > +init_main_abort_LDADD = libinit.a $(LIBCUNIT_COMMON) $(LIBODP)
> > +init_main_log_LDADD   = libinit.a $(LIBCUNIT_COMMON) $(LIBODP)
> > +init_main_ok_LDADD    = libinit.a $(LIBCUNIT_COMMON) $(LIBODP)
> > diff --git a/test/validation/init/init.c b/test/validation/init/init.c
> > new file mode 100644
> > index 0000000..169bd5c
> > --- /dev/null
> > +++ b/test/validation/init/init.c
> > @@ -0,0 +1,151 @@
> > +/* Copyright (c) 2015, Linaro Limited
> > + * All rights reserved.
> > + *
> > + * SPDX-License-Identifier:     BSD-3-Clause
> > + */
> > +
> > +#include <stdarg.h>
> > +#include <stdlib.h>
> > +#include <odp.h>
> > +#include <CUnit/Basic.h>
> > +#include "odp_cunit_common.h"
> > +#include "init.h"
> > +
> > +/* flag set when the replacement logging function is used */
> > +int replacement_logging_used;
> > +
> > +/* replacement abort function: */
> > +static void odp_init_abort(void) ODP_NORETURN;
>
> Checkpatch generates a CHECK on this line, but it looks like a false
> positive so I'm ignoring it.
>
>
Yes. This is not a cast and suppressing the space won't make it clearer. I
thought it should be ignored .

Christophe.

--
> Stuart.
>
diff mbox

Patch

diff --git a/configure.ac b/configure.ac
index 68b65d5..f58b472 100644
--- a/configure.ac
+++ b/configure.ac
@@ -306,6 +306,7 @@  AC_CONFIG_FILES([Makefile
 		 test/validation/classification/Makefile
 		 test/validation/common/Makefile
 		 test/validation/crypto/Makefile
+		 test/validation/init/Makefile
 		 test/validation/pktio/Makefile
 		 test/validation/random/Makefile
 		 test/validation/system/Makefile
diff --git a/test/validation/.gitignore b/test/validation/.gitignore
index 8f78055..067914f 100644
--- a/test/validation/.gitignore
+++ b/test/validation/.gitignore
@@ -3,9 +3,6 @@ 
 odp_ver_abt_log_dbg
 odp_buffer
 odp_cpumask
-odp_init
-odp_init_abort
-odp_init_log
 odp_packet
 odp_pool
 odp_queue
diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
index bccc886..44a5a74 100644
--- a/test/validation/Makefile.am
+++ b/test/validation/Makefile.am
@@ -6,9 +6,6 @@  AM_LDFLAGS += -static
 
 EXECUTABLES = odp_buffer \
 	      odp_cpumask \
-	      odp_init \
-	      odp_init_abort \
-	      odp_init_log \
 	      odp_packet \
 	      odp_pool \
 	      odp_queue \
@@ -20,7 +17,10 @@  EXECUTABLES = odp_buffer \
 	      odp_ver_abt_log_dbg
 
 if test_vald
-TESTS = $(EXECUTABLES)
+TESTS = $(EXECUTABLES) \
+	init/init_main_ok \
+	init/init_main_abort \
+	init/init_main_log
 endif
 
 bin_PROGRAMS = $(EXECUTABLES) $(COMPILE_ONLY)
@@ -30,16 +30,6 @@  ODP_CU_COMMON=common/odp_cunit_common.c
 odp_buffer_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/buffer
 dist_odp_buffer_SOURCES = odp_buffer.c
 odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto
-odp_init_LDADD = $(top_builddir)/test/validation/common/libcunit_common.a \
-		 $(LIB)/libodp.la
-dist_odp_init_SOURCES	= init/odp_init.c
-odp_init_abort_LDADD = \
-		 $(top_builddir)/test/validation/common/libcunit_common.a \
-		 $(LIB)/libodp.la
-dist_odp_init_abort_SOURCES = init/odp_init_abort.c
-odp_init_log_LDADD = $(top_builddir)/test/validation/common/libcunit_common.a \
-		     $(LIB)/libodp.la
-dist_odp_init_log_SOURCES = init/odp_init_log.c
 dist_odp_queue_SOURCES	= odp_queue.c
 odp_random_LDADD = $(top_builddir)/test/validation/common/libcunit_common.a \
 		   $(LIB)/libodp.la
@@ -58,6 +48,7 @@  dist_odp_ver_abt_log_dbg_SOURCES  = ver_abt_log_dbg/odp_system.c \
 
 ODP_MODULES = classification \
 	      crypto \
+	      init \
 	      pktio \
 	      random \
 	      system
diff --git a/test/validation/init/.gitignore b/test/validation/init/.gitignore
new file mode 100644
index 0000000..79eb713
--- /dev/null
+++ b/test/validation/init/.gitignore
@@ -0,0 +1,4 @@ 
+libinit.a
+init_main_abort
+init_main_log
+init_main_ok
diff --git a/test/validation/init/Makefile.am b/test/validation/init/Makefile.am
new file mode 100644
index 0000000..08b1ca7
--- /dev/null
+++ b/test/validation/init/Makefile.am
@@ -0,0 +1,14 @@ 
+include ../Makefile.inc
+noinst_LIBRARIES = libinit.a
+libinit_a_SOURCES = init.c
+
+# most platforms are expected not to support multiple ODP inits
+# following each other: therefore 3 separate binaries are
+# created, each containing its ODP init test.
+bin_PROGRAMS = init_main_abort init_main_log init_main_ok
+dist_init_main_abort_SOURCES = init_main_abort.c
+dist_init_main_log_SOURCES   = init_main_log.c
+dist_init_main_ok_SOURCES    = init_main_ok.c
+init_main_abort_LDADD = libinit.a $(LIBCUNIT_COMMON) $(LIBODP)
+init_main_log_LDADD   = libinit.a $(LIBCUNIT_COMMON) $(LIBODP)
+init_main_ok_LDADD    = libinit.a $(LIBCUNIT_COMMON) $(LIBODP)
diff --git a/test/validation/init/init.c b/test/validation/init/init.c
new file mode 100644
index 0000000..169bd5c
--- /dev/null
+++ b/test/validation/init/init.c
@@ -0,0 +1,151 @@ 
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include <stdarg.h>
+#include <stdlib.h>
+#include <odp.h>
+#include <CUnit/Basic.h>
+#include "odp_cunit_common.h"
+#include "init.h"
+
+/* flag set when the replacement logging function is used */
+int replacement_logging_used;
+
+/* replacement abort function: */
+static void odp_init_abort(void) ODP_NORETURN;
+
+/* replacement log function: */
+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)
+{
+	int status;
+	struct odp_init_t init_data;
+
+	memset(&init_data, 0, sizeof(init_data));
+	init_data.abort_fn = &odp_init_abort;
+
+	status = odp_init_global(&init_data, NULL);
+	CU_ASSERT_FATAL(status == 0);
+
+	status = odp_term_global();
+	CU_ASSERT(status == 0);
+}
+
+static CU_TestInfo init_suite_abort[] = {
+	{"replace abort",  init_test_odp_init_global_replace_abort},
+	CU_TEST_INFO_NULL,
+};
+
+static CU_SuiteInfo init_suites_abort[] = {
+	{"Init", NULL, NULL, NULL, NULL, init_suite_abort},
+	CU_SUITE_INFO_NULL,
+};
+
+static void odp_init_abort(void)
+{
+	abort();
+}
+
+int init_main_abort(void)
+{
+	/* prevent default ODP init: */
+	odp_cunit_register_global_init(NULL);
+	odp_cunit_register_global_term(NULL);
+
+	/* run the tests: */
+	return odp_cunit_run(init_suites_abort);
+}
+
+/* test ODP global init, with alternate log function */
+static void init_test_odp_init_global_replace_log(void)
+{
+	int status;
+	struct odp_init_t init_data;
+
+	memset(&init_data, 0, sizeof(init_data));
+	init_data.log_fn = &odp_init_log;
+
+	replacement_logging_used = 0;
+
+	status = odp_init_global(&init_data, NULL);
+	CU_ASSERT_FATAL(status == 0);
+
+	CU_ASSERT_TRUE(replacement_logging_used);
+
+	status = odp_term_global();
+	CU_ASSERT(status == 0);
+}
+
+static CU_TestInfo init_suite_log[] = {
+	{"replace log",  init_test_odp_init_global_replace_log},
+	CU_TEST_INFO_NULL,
+};
+
+static CU_SuiteInfo init_suites_log[] = {
+	{"Init", NULL, NULL, NULL, NULL, init_suite_log},
+	CU_SUITE_INFO_NULL,
+};
+
+static int odp_init_log(odp_log_level_e level __attribute__((unused)),
+			const char *fmt, ...)
+{
+	va_list args;
+	int r;
+
+	/* just set a flag to be sure the replacement fn was used */
+	replacement_logging_used = 1;
+
+	va_start(args, fmt);
+	r = vfprintf(stderr, fmt, args);
+	va_end(args);
+
+	return r;
+}
+
+int init_main_log(void)
+{
+	/* prevent default ODP init: */
+	odp_cunit_register_global_init(NULL);
+	odp_cunit_register_global_term(NULL);
+
+	/* run the tests: */
+	return odp_cunit_run(init_suites_log);
+}
+
+/* test normal ODP global init */
+static void init_test_odp_init_global(void)
+{
+	int status;
+
+	status = odp_init_global(NULL, NULL);
+	CU_ASSERT_FATAL(status == 0);
+
+	status = odp_term_global();
+	CU_ASSERT(status == 0);
+}
+
+static CU_TestInfo init_suite_ok[] = {
+	{"test_odp_init_global",  init_test_odp_init_global},
+	CU_TEST_INFO_NULL,
+};
+
+static CU_SuiteInfo init_suites_ok[] = {
+	{"Init", NULL, NULL, NULL, NULL, init_suite_ok},
+	CU_SUITE_INFO_NULL,
+};
+
+int init_main_ok(void)
+{
+	/* prevent default ODP init: */
+	odp_cunit_register_global_init(NULL);
+	odp_cunit_register_global_term(NULL);
+
+	/* run the tests: */
+	return odp_cunit_run(init_suites_ok);
+}
diff --git a/test/validation/init/init.h b/test/validation/init/init.h
new file mode 100644
index 0000000..ca03994
--- /dev/null
+++ b/test/validation/init/init.h
@@ -0,0 +1,9 @@ 
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+int init_main_abort(void);
+int init_main_log(void);
+int init_main_ok(void);
diff --git a/test/validation/init/init_main_abort.c b/test/validation/init/init_main_abort.c
new file mode 100644
index 0000000..c7bdd9d
--- /dev/null
+++ b/test/validation/init/init_main_abort.c
@@ -0,0 +1,11 @@ 
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+#include "init.h"
+
+int main(void)
+{
+	return init_main_abort();
+}
diff --git a/test/validation/init/init_main_log.c b/test/validation/init/init_main_log.c
new file mode 100644
index 0000000..f35ac38
--- /dev/null
+++ b/test/validation/init/init_main_log.c
@@ -0,0 +1,11 @@ 
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+#include "init.h"
+
+int main(void)
+{
+	return init_main_log();
+}
diff --git a/test/validation/init/init_main_ok.c b/test/validation/init/init_main_ok.c
new file mode 100644
index 0000000..285c747
--- /dev/null
+++ b/test/validation/init/init_main_ok.c
@@ -0,0 +1,11 @@ 
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+#include "init.h"
+
+int main(void)
+{
+	return init_main_ok();
+}
diff --git a/test/validation/init/odp_init.c b/test/validation/init/odp_init.c
deleted file mode 100644
index 0e159ac..0000000
--- a/test/validation/init/odp_init.c
+++ /dev/null
@@ -1,57 +0,0 @@ 
-/* Copyright (c) 2014, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier:     BSD-3-Clause
- */
-
-#include <stdarg.h>
-#include <odp.h>
-#include <CUnit/Basic.h>
-#include "odp_cunit_common.h"
-
-#define DEFAULT_MSG_POOL_SIZE	(4 * 1024 * 1024)
-#define DEFAULT_MSG_SIZE	(8)
-
-/* overwrite common default so as not to perform odp init in main */
-int tests_global_init(void)
-{
-	return 0;
-}
-
-/* overwrite common default so as not to perform odp term in main */
-int tests_global_term(void)
-{
-	return 0;
-}
-
-static void init_test_odp_init_global(void)
-{
-	int status;
-
-	status = odp_init_global(NULL, NULL);
-	CU_ASSERT_FATAL(status == 0);
-
-	status = odp_term_global();
-	CU_ASSERT(status == 0);
-}
-
-static CU_TestInfo init_suite_ok[] = {
-	{"test_odp_init_global",  init_test_odp_init_global},
-	CU_TEST_INFO_NULL,
-};
-
-static CU_SuiteInfo init_suites_ok[] = {
-	{"Init", NULL, NULL, NULL, NULL, init_suite_ok},
-	CU_SUITE_INFO_NULL,
-};
-
-static int init_main_ok(void)
-{
-	return odp_cunit_run(init_suites_ok);
-}
-
-/* the following main function will be separated when lib is created */
-int main(void)
-{
-	return init_main_ok();
-}
diff --git a/test/validation/init/odp_init_abort.c b/test/validation/init/odp_init_abort.c
deleted file mode 100644
index 675c6b9..0000000
--- a/test/validation/init/odp_init_abort.c
+++ /dev/null
@@ -1,67 +0,0 @@ 
-/* Copyright (c) 2015, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier:     BSD-3-Clause
- */
-
-#include <stdarg.h>
-#include <stdlib.h>
-#include <odp.h>
-#include <CUnit/Basic.h>
-#include "odp_cunit_common.h"
-
-/* overwrite common default so as not to perform odp init in main */
-int tests_global_init(void)
-{
-	return 0;
-}
-
-/* overwrite common default so as not to perform odp term in main */
-int tests_global_term(void)
-{
-	return 0;
-}
-
-
-static void odp_init_abort(void) ODP_NORETURN;
-
-static void init_test_odp_init_global_replace_abort(void)
-{
-	int status;
-	struct odp_init_t init_data;
-
-	memset(&init_data, 0, sizeof(init_data));
-	init_data.abort_fn = &odp_init_abort;
-
-	status = odp_init_global(&init_data, NULL);
-	CU_ASSERT_FATAL(status == 0);
-
-	status = odp_term_global();
-	CU_ASSERT(status == 0);
-}
-
-static CU_TestInfo init_suite_abort[] = {
-	{"replace abort",  init_test_odp_init_global_replace_abort},
-	CU_TEST_INFO_NULL,
-};
-
-static CU_SuiteInfo init_suites_abort[] = {
-	{"Init", NULL, NULL, NULL, NULL, init_suite_abort},
-	CU_SUITE_INFO_NULL,
-};
-
-void odp_init_abort(void)
-{
-	abort();
-}
-
-static int init_main_abort(void)
-{
-	return odp_cunit_run(init_suites_abort);
-}
-
-/* the following main function will be separated when lib is created */
-int main(void)
-{
-	return init_main_abort();
-}
diff --git a/test/validation/init/odp_init_log.c b/test/validation/init/odp_init_log.c
deleted file mode 100644
index 303fe6f..0000000
--- a/test/validation/init/odp_init_log.c
+++ /dev/null
@@ -1,83 +0,0 @@ 
-/* Copyright (c) 2015, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier:     BSD-3-Clause
- */
-
-#include <stdarg.h>
-#include <odp.h>
-#include <CUnit/Basic.h>
-#include "odp_cunit_common.h"
-
-int replacement_logging_used;
-
-/* overwrite common default so as not to perform odp init in main */
-int tests_global_init(void)
-{
-	return 0;
-}
-
-/* overwrite common default so as not to perform odp term in main */
-int tests_global_term(void)
-{
-	return 0;
-}
-
-ODP_PRINTF_FORMAT(2, 3)
-static int odp_init_log(odp_log_level_e level, const char *fmt, ...);
-
-static void init_test_odp_init_global_replace_log(void)
-{
-	int status;
-	struct odp_init_t init_data;
-
-	memset(&init_data, 0, sizeof(init_data));
-	init_data.log_fn = &odp_init_log;
-
-	replacement_logging_used = 0;
-
-	status = odp_init_global(&init_data, NULL);
-	CU_ASSERT_FATAL(status == 0);
-
-	CU_ASSERT_TRUE(replacement_logging_used);
-
-	status = odp_term_global();
-	CU_ASSERT(status == 0);
-}
-
-static CU_TestInfo init_suite_log[] = {
-	{"replace log",  init_test_odp_init_global_replace_log},
-	CU_TEST_INFO_NULL,
-};
-
-static CU_SuiteInfo init_suites_log[] = {
-	{"Init", NULL, NULL, NULL, NULL, init_suite_log},
-	CU_SUITE_INFO_NULL,
-};
-
-int odp_init_log(odp_log_level_e level __attribute__((unused)),
-		 const char *fmt, ...)
-{
-	va_list args;
-	int r;
-
-	/* just set a flag to be sure the replacement fn was used */
-	replacement_logging_used = 1;
-
-	va_start(args, fmt);
-	r = vfprintf(stderr, fmt, args);
-	va_end(args);
-
-	return r;
-}
-
-static int init_main_log(void)
-{
-	return odp_cunit_run(init_suites_log);
-}
-
-/* the following main function will be separated when lib is created */
-int main(void)
-{
-	return init_main_log();
-}