From: Avinesh Kumar <akumar@suse.de>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 4/5] dup04.c: use TST_EXP_FD macro and make check fixes
Date: Thu, 27 Apr 2023 17:37:59 +0530 [thread overview]
Message-ID: <20230427120800.27849-4-akumar@suse.de> (raw)
In-Reply-To: <20230427120800.27849-1-akumar@suse.de>
+ updade copyright
Signed-off-by: Avinesh Kumar <akumar@suse.de>
---
testcases/kernel/syscalls/dup/dup04.c | 44 ++++++++-------------------
1 file changed, 12 insertions(+), 32 deletions(-)
diff --git a/testcases/kernel/syscalls/dup/dup04.c b/testcases/kernel/syscalls/dup/dup04.c
index 8d45f7a9c..053fb40c2 100644
--- a/testcases/kernel/syscalls/dup/dup04.c
+++ b/testcases/kernel/syscalls/dup/dup04.c
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
* 06/1994 AUTHOR: Richard Logan CO-PILOT: William Roske
+ * Copyright (c) 2023 SUSE LLC
*/
/*\
- * [DESCRIPTION]
+ * [Description]
*
* Basic test for dup(2) of a system pipe descriptor.
*/
@@ -17,38 +17,18 @@
#include "tst_test.h"
-int fd[2];
+static int fd[2];
static void run(void)
{
- TEST(dup(fd[0]));
-
- if (TST_RET == -1)
- tst_res(TFAIL | TTERRNO,
- "dup of read side of pipe failed");
- else {
- tst_res(TPASS,
- "dup(%d) read side of syspipe returned %ld",
- fd[0], TST_RET);
-
- SAFE_CLOSE(TST_RET);
- }
-
- TEST(dup(fd[1]));
-
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO,
- "dup of write side of pipe failed");
- } else {
- tst_res(TPASS,
- "dup(%d) write side of syspipe returned %ld",
- fd[1], TST_RET);
-
- SAFE_CLOSE(TST_RET);
- }
+ TST_EXP_FD(dup(fd[0]), "dup(%d) read end of the pipe", fd[0]);
+ SAFE_CLOSE(TST_RET);
+
+ TST_EXP_FD(dup(fd[1]), "dup(%d) write end of the pipe", fd[1]);
+ SAFE_CLOSE(TST_RET);
}
-void setup(void)
+static void setup(void)
{
fd[0] = -1;
@@ -56,7 +36,7 @@ void setup(void)
}
static struct tst_test test = {
- .test_all = run,
- .setup = setup,
- .needs_tmpdir = 1,
+ .test_all = run,
+ .setup = setup,
+ .needs_tmpdir = 1,
};
--
2.40.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2023-04-27 12:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-27 12:07 [LTP] [PATCH 1/5] dup01.c: use TST_EXP_FD macro and add inode check Avinesh Kumar
2023-04-27 12:07 ` [LTP] [PATCH 2/5] dup02.c: Simplify using TST_EXP macro and doc rewording Avinesh Kumar
2023-04-27 12:07 ` [LTP] [PATCH 3/5] dup03.c: use TST_EXP macro and make check fixes Avinesh Kumar
2023-04-27 12:07 ` Avinesh Kumar [this message]
2023-04-27 12:08 ` [LTP] [PATCH 5/5] dup05.c: use TST_EXP_FD() " Avinesh Kumar
2023-05-29 18:20 ` Petr Vorel
2023-05-02 11:18 ` [LTP] [PATCH 1/5] dup01.c: use TST_EXP_FD macro and add inode check Petr Vorel
2023-05-05 4:55 ` Avinesh Kumar
2023-05-29 5:42 ` 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=20230427120800.27849-4-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).