diff mbox

validation: init: split cases into executables

Message ID 1422896501-4027-1-git-send-email-mike.holmes@linaro.org
State Accepted
Commit 4778bd252abe6419cf33de2d58a4a536626d773b
Headers show

Commit Message

Mike Holmes Feb. 2, 2015, 5:01 p.m. UTC
init_global can only be called once per executable, split the
init_global testing into multiple executables.

Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
---
 test/validation/Makefile.am    |  4 +--
 test/validation/odp_init.c     | 39 --------------------
 test/validation/odp_init_log.c | 81 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 83 insertions(+), 41 deletions(-)
 create mode 100644 test/validation/odp_init_log.c
diff mbox

Patch

diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
index 2942b85..3ee59c8 100644
--- a/test/validation/Makefile.am
+++ b/test/validation/Makefile.am
@@ -6,10 +6,10 @@  AM_LDFLAGS += -static
 TESTS_ENVIRONMENT = ODP_PLATFORM=${with_platform}
 
 if test_vald
-TESTS = odp_init odp_queue odp_crypto odp_shm odp_schedule odp_pktio_run odp_buffer odp_system odp_timer odp_time odp_synchronizers odp_classification
+TESTS = odp_init odp_init_log odp_queue odp_crypto odp_shm odp_schedule odp_pktio_run odp_buffer odp_system odp_timer odp_time odp_synchronizers odp_classification
 endif
 
-bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule odp_pktio odp_buffer odp_system odp_timer odp_time odp_synchronizers odp_classification
+bin_PROGRAMS = odp_init odp_init_log odp_queue odp_crypto odp_shm odp_schedule odp_pktio odp_buffer odp_system odp_timer odp_time odp_synchronizers odp_classification
 odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto
 odp_buffer_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/buffer
 odp_classification_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/classification
diff --git a/test/validation/odp_init.c b/test/validation/odp_init.c
index c8e5a11..82f8849 100644
--- a/test/validation/odp_init.c
+++ b/test/validation/odp_init.c
@@ -11,10 +11,6 @@ 
 #define DEFAULT_MSG_POOL_SIZE	(4*1024*1024)
 #define DEFAULT_MSG_SIZE	(8)
 
-int replacement_logging_used;
-
-static int odp_init_log(odp_log_level_e level , const char *fmt, ...);
-
 static void test_odp_init_global(void)
 {
 	int status;
@@ -25,27 +21,8 @@  static void test_odp_init_global(void)
 	CU_ASSERT(status == 0);
 }
 
-static void test_odp_init_global_replace_log(void)
-{
-	int status;
-	struct odp_init_t 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);
-}
-
 CU_TestInfo test_odp_init[] = {
 	{"test_odp_init_global",  test_odp_init_global},
-	{"replace log",  test_odp_init_global_replace_log},
 	CU_TEST_INFO_NULL,
 };
 
@@ -74,19 +51,3 @@  int main(void)
 
 	return ret;
 }
-
-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;
-}
diff --git a/test/validation/odp_init_log.c b/test/validation/odp_init_log.c
new file mode 100644
index 0000000..fbf54cc
--- /dev/null
+++ b/test/validation/odp_init_log.c
@@ -0,0 +1,81 @@ 
+/* Copyright (c) 2014, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include <stdarg.h>
+#include <odp.h>
+#include <CUnit/Basic.h>
+
+#define DEFAULT_MSG_POOL_SIZE	(4*1024*1024)
+#define DEFAULT_MSG_SIZE	(8)
+
+int replacement_logging_used;
+
+static int odp_init_log(odp_log_level_e level , const char *fmt, ...);
+
+static void test_odp_init_global_replace_log(void)
+{
+	int status;
+	struct odp_init_t 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);
+}
+
+CU_TestInfo test_odp_init[] = {
+	{"replace log",  test_odp_init_global_replace_log},
+	CU_TEST_INFO_NULL,
+};
+
+CU_SuiteInfo odp_testsuites[] = {
+	{"Init", NULL, NULL, NULL, NULL, test_odp_init},
+	CU_SUITE_INFO_NULL,
+};
+
+int main(void)
+{
+	int ret;
+
+	printf("\tODP API version: %s\n", odp_version_api_str());
+	printf("\tODP implementation version: %s\n", odp_version_impl_str());
+
+	CU_set_error_action(CUEA_ABORT);
+
+	CU_initialize_registry();
+	CU_register_suites(odp_testsuites);
+	CU_basic_set_mode(CU_BRM_VERBOSE);
+	CU_basic_run_tests();
+
+	ret = CU_get_number_of_failure_records();
+
+	CU_cleanup_registry();
+
+	return ret;
+}
+
+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;
+}