Linux Test Project
 help / color / mirror / Atom feed
* [LTP] [PATCH] dup204.c: use TST_EXP_VAL() and TST_EXP_EQ_LU() macros
@ 2022-07-26  9:15 Avinesh Kumar
  2022-08-02 17:19 ` Petr Vorel
  0 siblings, 1 reply; 2+ messages in thread
From: Avinesh Kumar @ 2022-07-26  9:15 UTC (permalink / raw)
  To: ltp

Signed-off-by: Avinesh Kumar <akumar@suse.de>
---
 testcases/kernel/syscalls/dup2/dup204.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/testcases/kernel/syscalls/dup2/dup204.c b/testcases/kernel/syscalls/dup2/dup204.c
index 0fb6b0dc2..112ce0c9d 100644
--- a/testcases/kernel/syscalls/dup2/dup204.c
+++ b/testcases/kernel/syscalls/dup2/dup204.c
@@ -35,23 +35,14 @@ static void run(unsigned int i)
 {
 	struct stat oldbuf, newbuf;
 
-	TEST(dup2(fd[i], nfd[i]));
-	if (TST_RET == -1) {
-		tst_res(TFAIL, "call failed unexpectedly");
+	TST_EXP_VAL(dup2(fd[i], nfd[i]), nfd[i]);
+	if (TST_RET == -1)
 		return;
-	}
 
 	SAFE_FSTAT(fd[i], &oldbuf);
 	SAFE_FSTAT(nfd[i], &newbuf);
 
-	if (oldbuf.st_ino != newbuf.st_ino)
-		tst_res(TFAIL,
-			"original inode(%ld) and duped inode(%ld) do not match",
-			oldbuf.st_ino, newbuf.st_ino);
-	else
-		tst_res(TPASS,
-			"original inode(%ld) and duped inode(%ld) are the same",
-			oldbuf.st_ino, newbuf.st_ino);
+	TST_EXP_EQ_LU(oldbuf.st_ino, newbuf.st_ino);
 
 	SAFE_CLOSE(TST_RET);
 }
-- 
2.36.1


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

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

end of thread, other threads:[~2022-08-02 17:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-26  9:15 [LTP] [PATCH] dup204.c: use TST_EXP_VAL() and TST_EXP_EQ_LU() macros Avinesh Kumar
2022-08-02 17:19 ` Petr Vorel

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