Skip to contentSkip to conversation

Fix TBROK usage in timer tests

PATCH New Martin Doucha 3 participants 3 messages Nov 22, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix TBROK usage in timer tests

timer_delete01, timer_settime01 and timer_settime02 incorrectly use tst_res(TBROK, ...). Change it to tst_res(TFAIL, ...)

Also check errno for ENOTSUP and use tst_res(TCONF, ...) when the tested functionality is not supported by kernel, including in timer_create01.

---
 .../kernel/syscalls/timer_create/timer_create01.c      |  3 +--
 .../kernel/syscalls/timer_delete/timer_delete01.c      |  8 ++++----
 .../kernel/syscalls/timer_settime/timer_settime01.c    | 10 +++++-----
 .../kernel/syscalls/timer_settime/timer_settime02.c    |  8 ++++----
 4 files changed, 14 insertions(+), 15 deletions(-)
testcases/kernel/syscalls/timer_create/timer_create01.c +1 -2
index b03d184dd..1cb9a9fdc 100644
@@ -82,8 +82,7 @@ static void run(unsigned int n)
 		if (TST_RET != 0) {
 			if (possibly_unsupported(clock) &&
 			    (TST_ERR == EINVAL || TST_ERR == ENOTSUP)) {
-				tst_res(TPASS | TTERRNO,
-					"%s unsupported, failed as expected",
+				tst_res(TCONF | TTERRNO, "%s unsupported",
 					get_clock_str(clock));
 			} else {
 				tst_res(TFAIL | TTERRNO,
testcases/kernel/syscalls/timer_delete/timer_delete01.c +4 -4
index 16e50ccec..962eb5670 100644
@@ -37,12 +37,12 @@ static void run(void)
 
 		TEST(tst_syscall(__NR_timer_create, clock, NULL, &timer_id));
 		if (TST_RET != 0) {
-			if (possibly_unsupported(clock) && TST_ERR == EINVAL) {
-				tst_res(TPASS | TTERRNO,
-					"%s unsupported, failed as expected",
+			if (possibly_unsupported(clock) &&
+				(TST_ERR == EINVAL || TST_ERR == ENOTSUP)) {
+				tst_res(TCONF | TTERRNO, "%s unsupported",
 					get_clock_str(clock));
 			} else {
-				tst_res(TBROK | TTERRNO,
+				tst_res(TFAIL | TTERRNO,
 					"Aborting test - timer_create(%s) failed",
 					get_clock_str(clock));
 			}
testcases/kernel/syscalls/timer_settime/timer_settime01.c +5 -5
index fc1cf86a6..7bf00f527 100644
@@ -60,12 +60,12 @@ static void run(unsigned int n)
 
 		TEST(tst_syscall(__NR_timer_create, clock, NULL, &timer));
 		if (TST_RET != 0) {
-			if (possibly_unsupported(clock) && TST_ERR == EINVAL) {
-				tst_res(TPASS | TTERRNO,
-					"%s unsupported, failed as expected",
+			if (possibly_unsupported(clock) &&
+				(TST_ERR == EINVAL || TST_ERR == ENOTSUP)) {
+				tst_res(TCONF | TTERRNO, "%s unsupported",
 					get_clock_str(clock));
 			} else {
-				tst_res(TBROK | TTERRNO,
+				tst_res(TFAIL | TTERRNO,
 					"timer_create(%s) failed",
 					get_clock_str(clock));
 			}
@@ -80,7 +80,7 @@ static void run(unsigned int n)
 
 		if (tc->flag & TIMER_ABSTIME) {
 			if (clock_gettime(clock, &timenow) < 0) {
-				tst_res(TBROK,
+				tst_res(TFAIL,
 					"clock_gettime(%s) failed - skipping the test",
 					get_clock_str(clock));
 				continue;
testcases/kernel/syscalls/timer_settime/timer_settime02.c +4 -4
index 9b410a399..74cb33d73 100644
@@ -73,12 +73,12 @@ static void run(unsigned int n)
 		/* Init temporary timer */
 		TEST(tst_syscall(__NR_timer_create, clock, NULL, &timer));
 		if (TST_RET != 0) {
-			if (possibly_unsupported(clock) && TST_ERR == EINVAL) {
-				tst_res(TPASS | TTERRNO,
-					"%s unsupported, failed as expected",
+			if (possibly_unsupported(clock) &&
+				(TST_ERR == EINVAL || TST_ERR == ENOTSUP)) {
+				tst_res(TCONF | TTERRNO, "%s unsupported",
 					get_clock_str(clock));
 			} else {
-				tst_res(TBROK | TTERRNO,
+				tst_res(TFAIL | TTERRNO,
 					"timer_create(%s) failed",
 					get_clock_str(clock));
 			}
Signature · 1 line
2.24.0