validation: odp_timer.c: remove usage of perror/abort

Message ID 1422266920-14724-1-git-send-email-ola.liljedahl@linaro.org
State New
Headers show

Commit Message

Ola Liljedahl Jan. 26, 2015, 10:08 a.m.
Replace usage of perror and abort with CU_FAIL_FATAL in order for fatal
errors not to disturb the overall validation flow.

Signed-off-by: Ola Liljedahl <ola.liljedahl@linaro.org>
---
(This document/code contribution attached is provided under the terms of
agreement LES-LTM-21309)

 test/validation/odp_timer.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Patch

diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c
index d893646..291e5a9 100644
--- a/test/validation/odp_timer.c
+++ b/test/validation/odp_timer.c
@@ -11,7 +11,6 @@ 
 /* For rand_r and nanosleep */
 #define _POSIX_C_SOURCE 200112L
 #include <time.h>
-#include <unistd.h>
 #include <odp.h>
 #include "odp_cunit_common.h"
 #include "test_debug.h"
@@ -124,7 +123,7 @@  static void *worker_entrypoint(void *arg)
 
 	struct test_timer *tt = malloc(sizeof(struct test_timer) * NTIMERS);
 	if (tt == NULL)
-		perror("malloc"), abort();
+		CU_FAIL_FATAL("malloc failed");
 
 	/* Prepare all timers */
 	for (i = 0; i < NTIMERS; i++) {
@@ -215,7 +214,7 @@  static void *worker_entrypoint(void *arg)
 		ts.tv_sec = 0;
 		ts.tv_nsec = 1000000; /* 1ms */
 		if (nanosleep(&ts, NULL) < 0)
-			perror("nanosleep"), abort();
+			CU_FAIL_FATAL("nanosleep failed");
 	}
 
 	/* Cancel and free all timers */
@@ -246,7 +245,7 @@  static void *worker_entrypoint(void *arg)
 	ts.tv_sec = 0;
 	ts.tv_nsec = 1000000; /* 1ms */
 	if (nanosleep(&ts, NULL) < 0)
-		perror("nanosleep"), abort();
+		CU_FAIL_FATAL("nanosleep failed");
 	while (nstale != 0) {
 		odp_buffer_t buf = odp_queue_deq(queue);
 		if (buf != ODP_BUFFER_INVALID) {