[LTP] [PATCH v4 2/2] testcases/clock_nanosleep01: convert to use new test library API

Cyril Hrubis chrubis@suse.cz
Mon Nov 28 15:45:28 CET 2016


Hi!
Pushed with cosmetic changes (see below), thanks.

diff --git a/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep01.c b/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep01.c
index cee0a45..f64378c 100644
--- a/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep01.c
+++ b/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep01.c
@@ -117,15 +117,14 @@ static void do_test(unsigned int i)
 {
 	struct test_case *tc = &tcase[i];
 	struct timespec rm = {0};
-	long long elapsed_ms, expect_ms = 0, remain_ms = 0;
+	long long elapsed_ms, expect_ms, remain_ms = 0;
 	pid_t pid = 0;
 
 	tst_res(TINFO, "case %s", tc->desc);
 
 	/* setup */
-	if (tc->ttype == SEND_SIGINT) {
+	if (tc->ttype == SEND_SIGINT)
 		pid = create_sig_proc(SIGINT, 40, 500000);
-	}
 
 	/* test */
 	tst_timer_start(CLOCK_MONOTONIC);
@@ -140,7 +139,7 @@ static void do_test(unsigned int i)
 	}
 
 	/* cleanup */
-	if (pid > 0) {
+	if (pid) {
 		SAFE_KILL(pid, SIGTERM);
 		SAFE_WAIT(NULL);
 	}
@@ -174,7 +173,8 @@ static void do_test(unsigned int i)
 		return;
 	}
 
-	tst_res(TPASS, "returned %ld", TEST_RETURN);
+	tst_res(TPASS, "returned %s (%ld)",
+		tst_strerrno(TEST_RETURN), TEST_RETURN);
 }
 
 static struct tst_test test = {

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list