Skip to contentSkip to conversation

syscalls/getdents02: Fix make check warnings and use TST_EXP macro

PATCH In review Avinesh Kumar 2 participants 2 messages Aug 20, 2024 – Sep 17, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 syscalls/getdents02: Fix make check warnings and use TST_EXP macro

---
 .../kernel/syscalls/getdents/getdents02.c     | 20 ++-----------------
 1 file changed, 2 insertions(+), 18 deletions(-)
testcases/kernel/syscalls/getdents/getdents02.c +2 -18
index 578db9d1e..132fffcc0 100644
@@ -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 = {
Signature · 5 lines
2.45.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

Hi!

testcases/kernel/syscalls/getdents/getdents02.c static void run(unsigned int i) · line 77

Quoted 1 line
testcases/kernel/syscalls/getdents/getdents02.c +1 -0
+	TST_EXP_FAIL2(tst_getdents(*tc->fd, *tc->dirp, *tc->size), tc->exp_errno);

I've added a format string here so that we have slightly better messages and pushed, thanks.

Signature · 5 lines
Cyril Hrubis
[email protected]

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