[LTP] [PATCH] syscalls/getdents02: Fix make check warnings and use TST_EXP macro

Avinesh Kumar akumar@suse.de
Tue Aug 20 15:32:57 CEST 2024


Signed-off-by: Avinesh Kumar <akumar@suse.de>
---
 .../kernel/syscalls/getdents/getdents02.c     | 20 ++-----------------
 1 file changed, 2 insertions(+), 18 deletions(-)

diff --git a/testcases/kernel/syscalls/getdents/getdents02.c b/testcases/kernel/syscalls/getdents/getdents02.c
index 578db9d1e..132fffcc0 100644
--- a/testcases/kernel/syscalls/getdents/getdents02.c
+++ b/testcases/kernel/syscalls/getdents/getdents02.c
@@ -24,12 +24,9 @@
 #include "tst_test.h"
 #include "getdents.h"
 
-#define DIR_MODE	(S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP| \
-			 S_IXGRP|S_IROTH|S_IXOTH)
+#define DIR_MODE	0755
 #define TEST_DIR	"test_dir"
 
-char *TCID = "getdents02";
-
 static char *dirp;
 static size_t size;
 
@@ -77,20 +74,7 @@ static void run(unsigned int i)
 {
 	struct tcase *tc = tcases + i;
 
-	TEST(tst_getdents(*tc->fd, *tc->dirp, *tc->size));
-
-	if (TST_RET != -1) {
-		tst_res(TFAIL, "getdents() returned %ld", TST_RET);
-		return;
-	}
-
-	if (TST_ERR == tc->exp_errno) {
-		tst_res(TPASS | TTERRNO, "getdents failed as expected");
-	} else if (errno == ENOSYS) {
-		tst_res(TCONF, "syscall not implemented");
-	} else {
-		tst_res(TFAIL | TTERRNO, "getdents failed unexpectedly");
-	}
+	TST_EXP_FAIL2(tst_getdents(*tc->fd, *tc->dirp, *tc->size), tc->exp_errno);
 }
 
 static struct tst_test test = {
-- 
2.45.2



More information about the ltp mailing list