[01/13] validation: factorise _CU_TEST_INFO definition

Message ID 1438001035-21900-2-git-send-email-christophe.milard@linaro.org
State New
Headers show

Commit Message

Christophe Milard July 27, 2015, 12:43 p.m.
The macro _CU_TEST_INFO (used ensure a match between test function names
and test names (strings)) is now defined in .../common/odp_cunit_common.h
as it is common to many API module tests.
Local definitions are also removed.

Signed-off-by: Christophe Milard <christophe.milard@linaro.org>
---
 test/validation/buffer/buffer.c                                | 3 ---
 test/validation/classification/odp_classification_basic.c      | 1 +
 test/validation/classification/odp_classification_testsuites.h | 3 ---
 test/validation/common/odp_cunit_common.h                      | 3 +++
 test/validation/packet/packet.c                                | 3 ---
 test/validation/pool/pool.c                                    | 2 --
 test/validation/random/random.c                                | 3 ---
 test/validation/thread/thread.c                                | 3 ---
 8 files changed, 4 insertions(+), 17 deletions(-)

Patch

diff --git a/test/validation/buffer/buffer.c b/test/validation/buffer/buffer.c
index f67c55f..816ed9b 100644
--- a/test/validation/buffer/buffer.c
+++ b/test/validation/buffer/buffer.c
@@ -8,9 +8,6 @@ 
 #include "odp_cunit_common.h"
 #include "buffer.h"
 
-/* Helper macro for CU_TestInfo initialization */
-#define _CU_TEST_INFO(test_func) {#test_func, test_func}
-
 static odp_pool_t raw_pool;
 static odp_buffer_t raw_buffer = ODP_BUFFER_INVALID;
 static const size_t raw_buffer_size = 1500;
diff --git a/test/validation/classification/odp_classification_basic.c b/test/validation/classification/odp_classification_basic.c
index 99202ee..d33f8a9 100644
--- a/test/validation/classification/odp_classification_basic.c
+++ b/test/validation/classification/odp_classification_basic.c
@@ -4,6 +4,7 @@ 
  * SPDX-License-Identifier:	BSD-3-Clause
  */
 
+#include <odp_cunit_common.h>
 #include "odp_classification_testsuites.h"
 
 #define PMR_SET_NUM	5
diff --git a/test/validation/classification/odp_classification_testsuites.h b/test/validation/classification/odp_classification_testsuites.h
index f603f30..37c019d 100644
--- a/test/validation/classification/odp_classification_testsuites.h
+++ b/test/validation/classification/odp_classification_testsuites.h
@@ -11,9 +11,6 @@ 
 #include <CUnit/CUnit.h>
 #include <CUnit/Basic.h>
 
-/* Helper macro for CU_TestInfo initialization */
-#define _CU_TEST_INFO(test_func) {#test_func, test_func}
-
 extern CU_TestInfo classification_suite[];
 extern CU_TestInfo classification_suite_basic[];
 
diff --git a/test/validation/common/odp_cunit_common.h b/test/validation/common/odp_cunit_common.h
index 7c2a9dd..6cafaaa 100644
--- a/test/validation/common/odp_cunit_common.h
+++ b/test/validation/common/odp_cunit_common.h
@@ -21,6 +21,9 @@ 
 /* the function, called by module main(), to run the testsuites: */
 int odp_cunit_run(CU_SuiteInfo testsuites[]);
 
+/* the macro used to have test names (strings) matching function symbols */
+#define _CU_TEST_INFO(test_func) {#test_func, test_func}
+
 typedef struct {
 	uint32_t foo;
 	uint32_t bar;
diff --git a/test/validation/packet/packet.c b/test/validation/packet/packet.c
index e6fb18a..16d3597 100644
--- a/test/validation/packet/packet.c
+++ b/test/validation/packet/packet.c
@@ -10,9 +10,6 @@ 
 #include "odp_cunit_common.h"
 #include "packet.h"
 
-/* Helper macro for CU_TestInfo initialization */
-#define _CU_TEST_INFO(test_func) {#test_func, test_func}
-
 #define PACKET_BUF_LEN	ODP_CONFIG_PACKET_SEG_LEN_MIN
 /* Reserve some tailroom for tests */
 #define PACKET_TAILROOM_RESERVE  4
diff --git a/test/validation/pool/pool.c b/test/validation/pool/pool.c
index a888b68..fa123c8 100644
--- a/test/validation/pool/pool.c
+++ b/test/validation/pool/pool.c
@@ -99,8 +99,6 @@  static void pool_test_lookup_info_print(void)
 	CU_ASSERT(odp_pool_destroy(pool) == 0);
 }
 
-#define _CU_TEST_INFO(test_func) {#test_func, test_func}
-
 static CU_TestInfo pool_suite[] = {
 	_CU_TEST_INFO(pool_test_create_destroy_buffer),
 	_CU_TEST_INFO(pool_test_create_destroy_packet),
diff --git a/test/validation/random/random.c b/test/validation/random/random.c
index a42523f..b305162 100644
--- a/test/validation/random/random.c
+++ b/test/validation/random/random.c
@@ -8,9 +8,6 @@ 
 #include <odp_cunit_common.h>
 #include "random.h"
 
-/* Helper macro for CU_TestInfo initialization */
-#define _CU_TEST_INFO(test_func) {#test_func, test_func}
-
 static void random_test_get_size(void)
 {
 	int32_t ret;
diff --git a/test/validation/thread/thread.c b/test/validation/thread/thread.c
index 6fbdaef..a815239 100644
--- a/test/validation/thread/thread.c
+++ b/test/validation/thread/thread.c
@@ -10,9 +10,6 @@ 
 #include <test_debug.h>
 #include "thread.h"
 
-/* Helper macro for CU_TestInfo initialization */
-#define _CU_TEST_INFO(test_func) {#test_func, test_func}
-
 /* Test thread entry and exit synchronization barriers */
 odp_barrier_t bar_entry;
 odp_barrier_t bar_exit;