All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avinesh Kumar <akumar@suse.de>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] dup204.c: use TST_EXP_VAL() and TST_EXP_EQ_LU() macros
Date: Tue, 26 Jul 2022 14:45:28 +0530	[thread overview]
Message-ID: <20220726091528.29864-1-akumar@suse.de> (raw)

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

             reply	other threads:[~2022-07-26  9:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-26  9:15 Avinesh Kumar [this message]
2022-08-02 17:19 ` [LTP] [PATCH] dup204.c: use TST_EXP_VAL() and TST_EXP_EQ_LU() macros Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220726091528.29864-1-akumar@suse.de \
    --to=akumar@suse.de \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.