From: "xuyang2018.jy@fujitsu.com" <xuyang2018.jy@fujitsu.com>
To: QI Fuli <fukuri.sai@gmail.com>
Cc: "qi.fuli@fujitsu.com" <qi.fuli@fujitsu.com>,
"ltp@lists.linux.it" <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH v3 0/2] Convert syscalls/dup3_{01,02} to new API
Date: Tue, 16 Nov 2021 05:30:49 +0000 [thread overview]
Message-ID: <61934225.1030101@fujitsu.com> (raw)
In-Reply-To: <20211116025354.2566-1-qi.fuli@fujitsu.com>
Hi Qi
I pushed this patch set with modifying some minor things.
Thanks for your patch!
diff --git a/testcases/kernel/syscalls/dup3/dup3_01.c
b/testcases/kernel/syscalls/dup3/dup3_01.c
index e8ed3a2..e34379b 100644
--- a/testcases/kernel/syscalls/dup3/dup3_01.c
+++ b/testcases/kernel/syscalls/dup3/dup3_01.c
@@ -5,8 +5,10 @@
* Created - Jan 13 2009 - Ulrich Drepper <drepper@redhat.com>
* Ported to LTP - Jan 13 2009 - Subrata <subrata@linux.vnet.ibm.com>
*/
+
/*\
* [Description]
+ *
* Testcase to check whether dup3() supports O_CLOEXEC flag.
*/
@@ -31,22 +33,17 @@ static struct tcase {
static void cleanup(void)
{
- if (fd > 0)
+ if (fd > -1)
close(fd);
}
+
static void run(unsigned int i)
{
int ret;
struct tcase *tc = tcases + i;
-
- TEST(dup3(1, 4, tc->coe_flag));
+ TST_EXP_FD_SILENT(dup3(1, 4, tc->coe_flag), "dup3(1, 4, %d)",
tc->coe_flag);
fd = TST_RET;
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "%s failed", tc->desc);
- goto free;
- }
-
ret = SAFE_FCNTL(fd, F_GETFD);
if (tc->coe_flag) {
if (ret & FD_CLOEXEC)
@@ -59,9 +56,6 @@ static void run(unsigned int i)
else
tst_res(TPASS, "%s set close-on-exec flag",
tc->desc);
}
-
-free:
- SAFE_CLOSE(fd);
};
static struct tst_test test = {
diff --git a/testcases/kernel/syscalls/dup3/dup3_02.c
b/testcases/kernel/syscalls/dup3/dup3_02.c
index e31a758..009b003 100644
--- a/testcases/kernel/syscalls/dup3/dup3_02.c
+++ b/testcases/kernel/syscalls/dup3/dup3_02.c
@@ -3,12 +3,15 @@
* Copyright (c) 2013 Fujitsu Ltd.
* Author: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
*/
+
/*\
* [Description]
+ *
* Test for various EINVAL error.
- * - EINVAL - oldfd is equal to newfd without using O_CLOEXEC flag
- * - EINVAL - oldfd is equal to newfd with using O_CLOEXEC flag
- * - EINVAL - flags contain an invalid value
+ *
+ * - oldfd is equal to newfd without using O_CLOEXEC flag
+ * - oldfd is equal to newfd with using O_CLOEXEC flag
+ * - flags contain an invalid value
*/
#define _GNU_SOURCE
@@ -18,7 +21,7 @@
#include "tst_test.h"
#include "tst_safe_macros.h"
-static int old_fd;
+static int old_fd = 3;
static int new_fd = 5;
static struct tcase {
@@ -39,21 +42,7 @@ static void run(unsigned int i)
"dup3(%d, %d, %d)", *tc->oldfd, *tc->newfd, tc->flags);
}
-static void setup(void)
-{
- old_fd = SAFE_CREAT("testeinval.file", 0644);
-}
-
-static void cleanup(void)
-{
- if (old_fd > 0)
- SAFE_CLOSE(old_fd);
-}
-
static struct tst_test test = {
.tcnt = ARRAY_SIZE(tcases),
.test = run,
- .setup = setup,
- .cleanup = cleanup,
- .needs_tmpdir = 1,
};
Best Regards
Yang Xu
> From: QI Fuli<qi.fuli@fujitsu.com>
>
> Convert syscalls/dup3_{01,02} to new API
>
> QI Fuli (2):
> syscalls/dup3_01: Rewrite dup3_01 and convert it to new API
> syscalls/dup3_02: Convert to new API
>
> testcases/kernel/syscalls/dup3/dup3_01.c | 163 ++++++++---------------
> testcases/kernel/syscalls/dup3/dup3_02.c | 119 +++++------------
> 2 files changed, 87 insertions(+), 195 deletions(-)
>
--
Mailing list info: https://lists.linux.it/listinfo/ltp
prev parent reply other threads:[~2021-11-16 5:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-16 2:53 [LTP] [PATCH v3 0/2] Convert syscalls/dup3_{01,02} to new API QI Fuli
2021-11-16 2:53 ` [LTP] [PATCH v3 1/2] syscalls/dup3_01: Rewrite dup3_01 and convert it " QI Fuli
2021-11-16 2:53 ` [LTP] [PATCH v3 2/2] syscalls/dup3_02: Convert " QI Fuli
2021-11-16 5:30 ` xuyang2018.jy [this message]
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=61934225.1030101@fujitsu.com \
--to=xuyang2018.jy@fujitsu.com \
--cc=fukuri.sai@gmail.com \
--cc=ltp@lists.linux.it \
--cc=qi.fuli@fujitsu.com \
/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