All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/1] Fix TBROK usage in timer tests
@ 2019-11-22  9:40 Martin Doucha
  2019-11-22 10:57 ` Thadeu Lima de Souza Cascardo
  2019-11-22 13:24 ` Cyril Hrubis
  0 siblings, 2 replies; 3+ messages in thread
From: Martin Doucha @ 2019-11-22  9:40 UTC (permalink / raw)
  To: ltp

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.

Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
 .../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(-)

diff --git a/testcases/kernel/syscalls/timer_create/timer_create01.c b/testcases/kernel/syscalls/timer_create/timer_create01.c
index b03d184dd..1cb9a9fdc 100644
--- a/testcases/kernel/syscalls/timer_create/timer_create01.c
+++ b/testcases/kernel/syscalls/timer_create/timer_create01.c
@@ -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,
diff --git a/testcases/kernel/syscalls/timer_delete/timer_delete01.c b/testcases/kernel/syscalls/timer_delete/timer_delete01.c
index 16e50ccec..962eb5670 100644
--- a/testcases/kernel/syscalls/timer_delete/timer_delete01.c
+++ b/testcases/kernel/syscalls/timer_delete/timer_delete01.c
@@ -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));
 			}
diff --git a/testcases/kernel/syscalls/timer_settime/timer_settime01.c b/testcases/kernel/syscalls/timer_settime/timer_settime01.c
index fc1cf86a6..7bf00f527 100644
--- a/testcases/kernel/syscalls/timer_settime/timer_settime01.c
+++ b/testcases/kernel/syscalls/timer_settime/timer_settime01.c
@@ -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;
diff --git a/testcases/kernel/syscalls/timer_settime/timer_settime02.c b/testcases/kernel/syscalls/timer_settime/timer_settime02.c
index 9b410a399..74cb33d73 100644
--- a/testcases/kernel/syscalls/timer_settime/timer_settime02.c
+++ b/testcases/kernel/syscalls/timer_settime/timer_settime02.c
@@ -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));
 			}
-- 
2.24.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [LTP] [PATCH 1/1] Fix TBROK usage in timer tests
  2019-11-22  9:40 [LTP] [PATCH 1/1] Fix TBROK usage in timer tests Martin Doucha
@ 2019-11-22 10:57 ` Thadeu Lima de Souza Cascardo
  2019-11-22 13:24 ` Cyril Hrubis
  1 sibling, 0 replies; 3+ messages in thread
From: Thadeu Lima de Souza Cascardo @ 2019-11-22 10:57 UTC (permalink / raw)
  To: ltp

Acked-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [LTP] [PATCH 1/1] Fix TBROK usage in timer tests
  2019-11-22  9:40 [LTP] [PATCH 1/1] Fix TBROK usage in timer tests Martin Doucha
  2019-11-22 10:57 ` Thadeu Lima de Souza Cascardo
@ 2019-11-22 13:24 ` Cyril Hrubis
  1 sibling, 0 replies; 3+ messages in thread
From: Cyril Hrubis @ 2019-11-22 13:24 UTC (permalink / raw)
  To: ltp

Hi!
Applied, thanks.

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-11-22 13:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-22  9:40 [LTP] [PATCH 1/1] Fix TBROK usage in timer tests Martin Doucha
2019-11-22 10:57 ` Thadeu Lima de Souza Cascardo
2019-11-22 13:24 ` Cyril Hrubis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.