diff mbox

[1/3] validation: remove WEAK def of global_test_init

Message ID 1436433933-16911-2-git-send-email-christophe.milard@linaro.org
State Accepted
Commit 40bee6bb8c308458696d56f647604128a57a6c3d
Headers show

Commit Message

Christophe Milard July 9, 2015, 9:25 a.m. UTC
Removal of the weak definitions of global_test_init and global_test_term.
This removes the last shared symbols between tests and therefore gives
the possibility to create a test "superlib" containing all tests of
all modules, if so wished.
Also, it forces the definition of these functions into each lib using
them.
Test executable init and term function are called:
<Module>_init[_*] and <Module>_term[_*]
Where the possible suffix (_*) identifies the test executable, if needed.
These functions are part of their module test library (<Module>lib.a)
and they are registered using:
odp_cunit_register_global_init(), and odp_cunit_register_global_term();

Signed-off-by: Christophe Milard <christophe.milard@linaro.org>
---
 test/validation/common/odp_cunit_common.c     | 8 ++++----
 test/validation/common/odp_cunit_common.h     | 6 +-----
 test/validation/crypto/crypto.c               | 6 ++++--
 test/validation/synchronizers/synchronizers.c | 3 ++-
 4 files changed, 11 insertions(+), 12 deletions(-)
diff mbox

Patch

diff --git a/test/validation/common/odp_cunit_common.c b/test/validation/common/odp_cunit_common.c
index 67938f2..56493ac 100644
--- a/test/validation/common/odp_cunit_common.c
+++ b/test/validation/common/odp_cunit_common.c
@@ -15,6 +15,8 @@  static odph_linux_pthread_t thread_tbl[MAX_WORKERS];
  * global init/term functions which may be registered
  * defaults to functions performing odp init/term.
  */
+static int tests_global_init(void);
+static int tests_global_term(void);
 static struct {
 	int (*global_init_ptr)(void);
 	int (*global_term_ptr)(void);
@@ -42,7 +44,7 @@  int odp_cunit_thread_exit(pthrd_arg *arg)
 	return 0;
 }
 
-ODP_WEAK_SYMBOL int tests_global_init(void)
+static int tests_global_init(void)
 {
 	if (0 != odp_init_global(NULL, NULL)) {
 		fprintf(stderr, "error: odp_init_global() failed.\n");
@@ -56,7 +58,7 @@  ODP_WEAK_SYMBOL int tests_global_init(void)
 	return 0;
 }
 
-ODP_WEAK_SYMBOL int tests_global_term(void)
+static int tests_global_term(void)
 {
 	if (0 != odp_term_local()) {
 		fprintf(stderr, "error: odp_term_local() failed.\n");
@@ -76,8 +78,6 @@  ODP_WEAK_SYMBOL int tests_global_term(void)
  * If some of these functions are not registered, the defaults functions
  * (tests_global_init() and tests_global_term()) defined above are used.
  * One should use these register functions when defining these hooks.
- * (overloading the weak symbol above is obsolete and will be removed in
- * the future).
  * Note that passing NULL as function pointer is valid and will simply
  * prevent the default (odp init/term) to be done.
  */
diff --git a/test/validation/common/odp_cunit_common.h b/test/validation/common/odp_cunit_common.h
index bfb4cbf..92a22a9 100644
--- a/test/validation/common/odp_cunit_common.h
+++ b/test/validation/common/odp_cunit_common.h
@@ -50,16 +50,12 @@  extern int odp_cunit_thread_exit(pthrd_arg *);
  * Initialize global resources needed by the test executable. Default
  * definition does ODP init / term (both global and local).
  * Test executables can override it by calling one of the register function
- * below (or by defining a strong version, but this is deprecated).
+ * below.
  * The functions are called at the very beginning and very end of the test
  * execution. Passing NULL to odp_cunit_register_global_init() and/or
  * odp_cunit_register_global_term() is legal and will simply prevent the
  * default (ODP init/term) to be done.
  */
-extern int tests_global_init(void);
-
-extern int tests_global_term(void);
-
 void odp_cunit_register_global_init(int (*func_init_ptr)(void));
 
 void odp_cunit_register_global_term(int (*func_term_ptr)(void));
diff --git a/test/validation/crypto/crypto.c b/test/validation/crypto/crypto.c
index 899fb51..5b06cdc 100644
--- a/test/validation/crypto/crypto.c
+++ b/test/validation/crypto/crypto.c
@@ -23,7 +23,7 @@  static CU_SuiteInfo crypto_suites[] = {
 	CU_SUITE_INFO_NULL,
 };
 
-int tests_global_init(void)
+static int crypto_init(void)
 {
 	odp_pool_param_t params;
 	odp_pool_t pool;
@@ -60,7 +60,7 @@  int tests_global_init(void)
 	return 0;
 }
 
-int tests_global_term(void)
+static int crypto_term(void)
 {
 	odp_pool_t pool;
 	odp_queue_t out_queue;
@@ -96,5 +96,7 @@  int tests_global_term(void)
 
 int crypto_main(void)
 {
+	odp_cunit_register_global_init(crypto_init);
+	odp_cunit_register_global_term(crypto_term);
 	return odp_cunit_run(crypto_suites);
 }
diff --git a/test/validation/synchronizers/synchronizers.c b/test/validation/synchronizers/synchronizers.c
index 61c6026..fb12a05 100644
--- a/test/validation/synchronizers/synchronizers.c
+++ b/test/validation/synchronizers/synchronizers.c
@@ -1052,7 +1052,7 @@  static int synchronizers_suite_init(void)
 	return 0;
 }
 
-int tests_global_init(void)
+static int synchronizers_init(void)
 {
 	uint32_t core_count, max_threads;
 	int ret = 0;
@@ -1210,5 +1210,6 @@  static CU_SuiteInfo synchronizers_suites[] = {
 
 int synchronizers_main(void)
 {
+	odp_cunit_register_global_init(synchronizers_init);
 	return odp_cunit_run(synchronizers_suites);
 }