public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] kcmp03: Use TST_EXP_PASS()
@ 2024-11-12 23:35 Petr Vorel
  2024-11-12 23:35 ` [LTP] [PATCH 2/2] kcmp02: Use TST_EXP_FAIL + print more info Petr Vorel
  2024-12-03 13:00 ` [LTP] [PATCH 1/2] kcmp03: Use TST_EXP_PASS() Cyril Hrubis
  0 siblings, 2 replies; 5+ messages in thread
From: Petr Vorel @ 2024-11-12 23:35 UTC (permalink / raw)
  To: ltp

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/kernel/syscalls/kcmp/kcmp03.c | 25 ++++++++-----------------
 1 file changed, 8 insertions(+), 17 deletions(-)

diff --git a/testcases/kernel/syscalls/kcmp/kcmp03.c b/testcases/kernel/syscalls/kcmp/kcmp03.c
index 4ae6e02953..37d5118d55 100644
--- a/testcases/kernel/syscalls/kcmp/kcmp03.c
+++ b/testcases/kernel/syscalls/kcmp/kcmp03.c
@@ -30,14 +30,16 @@ static int pid1;
 static int pid2;
 static void *stack;
 
+#define ARGS(x, y) .clone_type = x, .kcmp_type = y, .desc = #x ", " #y
 static struct tcase {
 	int clone_type;
 	int kcmp_type;
+	char *desc;
 } tcases[] = {
-	{CLONE_VM, KCMP_VM},
-	{CLONE_FS, KCMP_FS},
-	{CLONE_IO, KCMP_IO},
-	{CLONE_SYSVSEM, KCMP_SYSVSEM}
+	{ARGS(CLONE_VM, KCMP_VM)},
+	{ARGS(CLONE_FS, KCMP_FS)},
+	{ARGS(CLONE_IO, KCMP_IO)},
+	{ARGS(CLONE_SYSVSEM, KCMP_SYSVSEM)}
 };
 
 static void setup(void)
@@ -53,28 +55,17 @@ static void cleanup(void)
 static int do_child(void *arg)
 {
 	pid2 = getpid();
-
-	TEST(kcmp(pid1, pid2, *(int *)arg, 0, 0));
-	if (TST_RET == -1) {
-		tst_res(TFAIL | TTERRNO, "kcmp() failed unexpectedly");
-		return 0;
-	}
-
-	if (TST_RET == 0)
-		tst_res(TPASS, "kcmp() returned the expected value");
-	else
-		tst_res(TFAIL, "kcmp() returned the unexpected value");
-
+	TST_EXP_PASS(kcmp(pid1, pid2, *(int *)arg, 0, 0));
 	return 0;
 }
 
 static void verify_kcmp(unsigned int n)
 {
 	int res;
-
 	struct tcase *tc = &tcases[n];
 
 	pid1 = getpid();
+	tst_res(TINFO, "Testing %s", tc->desc);
 
 	res = ltp_clone(tc->clone_type | SIGCHLD, do_child, &tc->kcmp_type,
 			STACK_SIZE, stack);
-- 
2.45.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

end of thread, other threads:[~2024-12-03 13:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-12 23:35 [LTP] [PATCH 1/2] kcmp03: Use TST_EXP_PASS() Petr Vorel
2024-11-12 23:35 ` [LTP] [PATCH 2/2] kcmp02: Use TST_EXP_FAIL + print more info Petr Vorel
2024-12-03 13:07   ` Cyril Hrubis
2024-12-03 13:42     ` Petr Vorel
2024-12-03 13:00 ` [LTP] [PATCH 1/2] kcmp03: Use TST_EXP_PASS() Cyril Hrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox