[LTP] [PATCH] setuid01: use TST_EXP_PASS() macro, docparse comment and reword

Avinesh Kumar akumar@suse.de
Wed Aug 10 07:14:37 CEST 2022


Signed-off-by: Avinesh Kumar <akumar@suse.de>
---
 testcases/kernel/syscalls/setuid/setuid01.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/testcases/kernel/syscalls/setuid/setuid01.c b/testcases/kernel/syscalls/setuid/setuid01.c
index 0a0a03a48..ed42ceda1 100644
--- a/testcases/kernel/syscalls/setuid/setuid01.c
+++ b/testcases/kernel/syscalls/setuid/setuid01.c
@@ -3,10 +3,11 @@
  * Copyright (c) International Business Machines Corp., 2001
  */
 
-/* DESCRIPTION
- *	This test will verify that setuid(2) syscall basic functionality.
- *	setuid(2) returns a value of 0 and uid has been set successfully
- *	as a normal or super user.
+/*
+ * [Description]
+ *
+ * Verify that setuid(2) returns 0 and effective uid has
+ * been set successfully as a normal or super user.
  */
 
 #include <errno.h>
@@ -19,15 +20,10 @@ static void verify_setuid(void)
 {
 	uid_t uid;
 
-	/* Set the effective user ID to the current real uid */
 	uid = getuid();
 	UID16_CHECK(uid, setuid);
 
-	TEST(SETUID(uid));
-	if (TST_RET == -1)
-		tst_res(TFAIL | TTERRNO, "setuid(%d) failed", uid);
-	else
-		tst_res(TPASS, "setuid(%d) successfully", uid);
+	TST_EXP_PASS(SETUID(uid), "setuid(%d)", uid);
 }
 
 static struct tst_test test = {
-- 
2.36.1



More information about the ltp mailing list