diff mbox

[5/5] validation: odp_init: add test for replace abort

Message ID 1422571952-5132-5-git-send-email-mike.holmes@linaro.org
State New
Headers show

Commit Message

Mike Holmes Jan. 29, 2015, 10:52 p.m. UTC
Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
---
 test/validation/odp_init.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
diff mbox

Patch

diff --git a/test/validation/odp_init.c b/test/validation/odp_init.c
index c8e5a11..cbb04b0 100644
--- a/test/validation/odp_init.c
+++ b/test/validation/odp_init.c
@@ -14,6 +14,7 @@ 
 int replacement_logging_used;
 
 static int odp_init_log(odp_log_level_e level , const char *fmt, ...);
+static void odp_init_abort(void) ODP_NORETURN;
 
 static void test_odp_init_global(void)
 {
@@ -30,6 +31,7 @@  static void 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;
@@ -43,9 +45,25 @@  static void test_odp_init_global_replace_log(void)
 	CU_ASSERT(status == 0);
 }
 
+static void 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);
+}
+
 CU_TestInfo test_odp_init[] = {
 	{"test_odp_init_global",  test_odp_init_global},
 	{"replace log",  test_odp_init_global_replace_log},
+	{"replace abort",  test_odp_init_global_replace_abort},
 	CU_TEST_INFO_NULL,
 };
 
@@ -90,3 +108,8 @@  int odp_init_log(odp_log_level_e level __attribute__((unused)),
 
 	return r;
 }
+
+void odp_init_abort(void)
+{
+	abort();
+}