All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 0/4 v2] syscalls/aio: Add testcases for native AIO
@ 2021-06-08 13:57 Xie Ziyao
  2021-06-08 13:57 ` [LTP] [PATCH 1/4 v2] syscalls/io_destroy: Add io_destroy02 test " Xie Ziyao
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Xie Ziyao @ 2021-06-08 13:57 UTC (permalink / raw)
  To: ltp

1. Split io_submit02 into two, one for negative and one for positive cases.
2. Add .needs_kconfig in this test.
3. Print values not variable names in TST_EXP_PASS/FAIL().

Xie Ziyao (4):
  syscalls/io_destroy: Add io_destroy02 test for native AIO
  syscalls/io_setup: Add io_setup02 test for native AIO
  syscalls/io_submit: Add io_submit02 test for native AIO
  syscalls/io_submit: Add io_submit03 test for native AIO

 runtest/syscalls                              |   4 +
 .../kernel/syscalls/io_destroy/.gitignore     |   1 +
 .../kernel/syscalls/io_destroy/io_destroy02.c |  38 ++++++
 testcases/kernel/syscalls/io_setup/.gitignore |   1 +
 .../kernel/syscalls/io_setup/io_setup02.c     |  64 ++++++++++
 .../kernel/syscalls/io_submit/.gitignore      |   2 +
 .../kernel/syscalls/io_submit/io_submit02.c   |  89 +++++++++++++
 .../kernel/syscalls/io_submit/io_submit03.c   | 118 ++++++++++++++++++
 8 files changed, 317 insertions(+)
 create mode 100644 testcases/kernel/syscalls/io_destroy/io_destroy02.c
 create mode 100644 testcases/kernel/syscalls/io_setup/io_setup02.c
 create mode 100644 testcases/kernel/syscalls/io_submit/io_submit02.c
 create mode 100644 testcases/kernel/syscalls/io_submit/io_submit03.c

--
2.17.1


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

* [LTP] [PATCH 1/4 v2] syscalls/io_destroy: Add io_destroy02 test for native AIO
  2021-06-08 13:57 [LTP] [PATCH 0/4 v2] syscalls/aio: Add testcases for native AIO Xie Ziyao
@ 2021-06-08 13:57 ` Xie Ziyao
  2021-06-08 13:57 ` [LTP] [PATCH 2/4 v2] syscalls/io_setup: Add io_setup02 " Xie Ziyao
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Xie Ziyao @ 2021-06-08 13:57 UTC (permalink / raw)
  To: ltp

Test io_destroy invoked via syscall(2) with an invalid ctx and expects it to return EINVAL.

Signed-off-by: Xie Ziyao <xieziyao@huawei.com>
---
v1->v2:
1. Add .needs_kconfig in this test.
2. Print values not variable names in TST_EXP_PASS().

 runtest/syscalls                              |  1 +
 .../kernel/syscalls/io_destroy/.gitignore     |  1 +
 .../kernel/syscalls/io_destroy/io_destroy02.c | 38 +++++++++++++++++++
 3 files changed, 40 insertions(+)
 create mode 100644 testcases/kernel/syscalls/io_destroy/io_destroy02.c

diff --git a/runtest/syscalls b/runtest/syscalls
index 9df181b76..01d26ad5a 100644
--- a/runtest/syscalls
+++ b/runtest/syscalls
@@ -607,6 +607,7 @@ ioprio_set03 ioprio_set03

 io_cancel01 io_cancel01
 io_destroy01 io_destroy01
+io_destroy02 io_destroy02
 io_getevents01 io_getevents01

 io_pgetevents01 io_pgetevents01
diff --git a/testcases/kernel/syscalls/io_destroy/.gitignore b/testcases/kernel/syscalls/io_destroy/.gitignore
index 025aa0f4a..48a16cd2f 100644
--- a/testcases/kernel/syscalls/io_destroy/.gitignore
+++ b/testcases/kernel/syscalls/io_destroy/.gitignore
@@ -1 +1,2 @@
 /io_destroy01
+/io_destroy02
diff --git a/testcases/kernel/syscalls/io_destroy/io_destroy02.c b/testcases/kernel/syscalls/io_destroy/io_destroy02.c
new file mode 100644
index 000000000..c8cc63818
--- /dev/null
+++ b/testcases/kernel/syscalls/io_destroy/io_destroy02.c
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) Crackerjack Project., 2007
+ * Ported from Crackerjack to LTP by Masatake YAMATO <yamato@redhat.com>
+ * Copyright (c) 2011 Cyril Hrubis <chrubis@suse.cz>
+ * Copyright (c) 2017 Xiao Yang <yangx.jy@cn.fujitsu.com>
+ * Copyright (c) 2021 Xie Ziyao <xieziyao@huawei.com>
+ */
+
+/*\
+ * [Description]
+ *
+ * Test io_destroy invoked via syscall(2) with an invalid ctx and expects
+ * it to return EINVAL.
+ */
+
+#include <linux/aio_abi.h>
+
+#include "config.h"
+#include "tst_test.h"
+#include "lapi/syscalls.h"
+
+static void run(void)
+{
+	aio_context_t ctx;
+
+	memset(&ctx, 0xff, sizeof(ctx));
+	TST_EXP_FAIL(tst_syscall(__NR_io_destroy, ctx), EINVAL,
+		     "io_destroy() with an invalid ctx");
+}
+
+static struct tst_test test = {
+	.needs_kconfigs = (const char *[]) {
+		"CONFIG_AIO=y",
+		NULL
+	},
+	.test_all = run,
+};
--
2.17.1


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

* [LTP] [PATCH 2/4 v2] syscalls/io_setup: Add io_setup02 test for native AIO
  2021-06-08 13:57 [LTP] [PATCH 0/4 v2] syscalls/aio: Add testcases for native AIO Xie Ziyao
  2021-06-08 13:57 ` [LTP] [PATCH 1/4 v2] syscalls/io_destroy: Add io_destroy02 test " Xie Ziyao
@ 2021-06-08 13:57 ` Xie Ziyao
  2021-06-08 13:57 ` [LTP] [PATCH 3/4 v2] syscalls/io_submit: Add io_submit02 " Xie Ziyao
  2021-06-08 13:57 ` [LTP] [PATCH 4/4 v2] syscalls/io_submit: Add io_submit03 " Xie Ziyao
  3 siblings, 0 replies; 6+ messages in thread
From: Xie Ziyao @ 2021-06-08 13:57 UTC (permalink / raw)
  To: ltp

Test io_setup invoked via syscall(2):
1. io_setup fails and returns -EFAULT if ctxp is NULL.
2. io_setup fails and returns -EINVAL if ctxp is not initialized to 0.
3. io_setup fails and returns -EINVAL if nr_events is -1.
4. io_setup fails and returns -EAGAIN if nr_events exceeds the limit.
5. io_setup succeeds if both nr_events and ctxp are valid.

Signed-off-by: Xie Ziyao <xieziyao@huawei.com>
---
v1->v2:
1. Add .needs_kconfig in this test.
2. Print values not variable names in TST_EXP_PASS().
3. Use TST_EXP_PASS_SILENT() instead of TST_EXP_PASS() in cleanup.

 runtest/syscalls                              |  1 +
 testcases/kernel/syscalls/io_setup/.gitignore |  1 +
 .../kernel/syscalls/io_setup/io_setup02.c     | 64 +++++++++++++++++++
 3 files changed, 66 insertions(+)
 create mode 100644 testcases/kernel/syscalls/io_setup/io_setup02.c

diff --git a/runtest/syscalls b/runtest/syscalls
index 01d26ad5a..d1ec32754 100644
--- a/runtest/syscalls
+++ b/runtest/syscalls
@@ -614,6 +614,7 @@ io_pgetevents01 io_pgetevents01
 io_pgetevents02 io_pgetevents02

 io_setup01 io_setup01
+io_setup02 io_setup02
 io_submit01 io_submit01

 keyctl01 keyctl01
diff --git a/testcases/kernel/syscalls/io_setup/.gitignore b/testcases/kernel/syscalls/io_setup/.gitignore
index 4fd03960c..37a4b8321 100644
--- a/testcases/kernel/syscalls/io_setup/.gitignore
+++ b/testcases/kernel/syscalls/io_setup/.gitignore
@@ -1 +1,2 @@
 /io_setup01
+/io_setup02
diff --git a/testcases/kernel/syscalls/io_setup/io_setup02.c b/testcases/kernel/syscalls/io_setup/io_setup02.c
new file mode 100644
index 000000000..292b7440d
--- /dev/null
+++ b/testcases/kernel/syscalls/io_setup/io_setup02.c
@@ -0,0 +1,64 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) Crackerjack Project., 2007
+ * Ported from Crackerjack to LTP by Masatake YAMATO <yamato@redhat.com>
+ * Copyright (c) 2011 Cyril Hrubis <chrubis@suse.cz>
+ * Copyright (c) 2017 Xiao Yang <yangx.jy@cn.fujitsu.com>
+ * Copyright (c) 2021 Xie Ziyao <xieziyao@huawei.com>
+ */
+
+/*\
+ * [Description]
+ *
+ * Test io_setup invoked via syscall(2):
+ *
+ * 1. io_setup fails and returns -EFAULT if ctxp is NULL.
+ * 2. io_setup fails and returns -EINVAL if ctxp is not initialized to 0.
+ * 3. io_setup fails and returns -EINVAL if nr_events is -1.
+ * 4. io_setup fails and returns -EAGAIN if nr_events exceeds the limit
+ *    of available events.
+ * 5. io_setup succeeds if both nr_events and ctxp are valid.
+ */
+
+#include <linux/aio_abi.h>
+
+#include "config.h"
+#include "tst_test.h"
+#include "lapi/syscalls.h"
+
+static void run(void)
+{
+	aio_context_t ctx;
+
+	TST_EXP_FAIL(tst_syscall(__NR_io_setup, 1, NULL), EFAULT,
+		     "io_setup() when ctxp is NULL");
+
+	memset(&ctx, 1, sizeof(ctx));
+	TST_EXP_FAIL(tst_syscall(__NR_io_setup, 1, &ctx), EINVAL,
+		     "io_setup() when ctxp is not initialized to 0");
+
+	memset(&ctx, 0, sizeof(ctx));
+	TST_EXP_FAIL(tst_syscall(__NR_io_setup, -1, &ctx), EINVAL,
+		     "io_setup() when nr_events is -1");
+
+	unsigned aio_max = 0;
+	if (!access("/proc/sys/fs/aio-max-nr", F_OK)) {
+		SAFE_FILE_SCANF("/proc/sys/fs/aio-max-nr", "%u", &aio_max);
+		TST_EXP_FAIL(tst_syscall(__NR_io_setup, aio_max + 1, &ctx), EAGAIN,
+			     "io_setup() when nr_events exceeds the limit");
+	} else {
+		tst_res(TCONF, "the aio-max-nr file did not exist");
+	}
+
+	TST_EXP_PASS(tst_syscall(__NR_io_setup, 1, &ctx),
+		     "io_setup() when both nr_events and ctxp are valid");
+	TST_EXP_PASS_SILENT(tst_syscall(__NR_io_destroy, ctx));
+}
+
+static struct tst_test test = {
+	.needs_kconfigs = (const char *[]) {
+		"CONFIG_AIO=y",
+		NULL
+	},
+	.test_all = run,
+};
--
2.17.1


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

* [LTP] [PATCH 3/4 v2] syscalls/io_submit: Add io_submit02 test for native AIO
  2021-06-08 13:57 [LTP] [PATCH 0/4 v2] syscalls/aio: Add testcases for native AIO Xie Ziyao
  2021-06-08 13:57 ` [LTP] [PATCH 1/4 v2] syscalls/io_destroy: Add io_destroy02 test " Xie Ziyao
  2021-06-08 13:57 ` [LTP] [PATCH 2/4 v2] syscalls/io_setup: Add io_setup02 " Xie Ziyao
@ 2021-06-08 13:57 ` Xie Ziyao
  2021-06-08 13:57 ` [LTP] [PATCH 4/4 v2] syscalls/io_submit: Add io_submit03 " Xie Ziyao
  3 siblings, 0 replies; 6+ messages in thread
From: Xie Ziyao @ 2021-06-08 13:57 UTC (permalink / raw)
  To: ltp

Test io_submit invoked via syscall(2):
1. io_submit() returns the number of iocbs submitted.
2. io_submit() returns 0 if nr is zero.

Signed-off-by: Xie Ziyao <xieziyao@huawei.com>
---
v1->v2:
1. Split io_submit02 into two, one for negative and one for positive cases.
2. Print values not variable names in TST_EXP_PASS().
3. Add .needs_kconfig in this test.

 runtest/syscalls                              |  1 +
 .../kernel/syscalls/io_submit/.gitignore      |  1 +
 .../kernel/syscalls/io_submit/io_submit02.c   | 89 +++++++++++++++++++
 3 files changed, 91 insertions(+)
 create mode 100644 testcases/kernel/syscalls/io_submit/io_submit02.c

diff --git a/runtest/syscalls b/runtest/syscalls
index d1ec32754..9c4c64fa3 100644
--- a/runtest/syscalls
+++ b/runtest/syscalls
@@ -616,6 +616,7 @@ io_pgetevents02 io_pgetevents02
 io_setup01 io_setup01
 io_setup02 io_setup02
 io_submit01 io_submit01
+io_submit02 io_submit02

 keyctl01 keyctl01
 keyctl02 keyctl02
diff --git a/testcases/kernel/syscalls/io_submit/.gitignore b/testcases/kernel/syscalls/io_submit/.gitignore
index cac043b6c..5f2a2cff2 100644
--- a/testcases/kernel/syscalls/io_submit/.gitignore
+++ b/testcases/kernel/syscalls/io_submit/.gitignore
@@ -1 +1,2 @@
 /io_submit01
+/io_submit02
diff --git a/testcases/kernel/syscalls/io_submit/io_submit02.c b/testcases/kernel/syscalls/io_submit/io_submit02.c
new file mode 100644
index 000000000..b0ed35eec
--- /dev/null
+++ b/testcases/kernel/syscalls/io_submit/io_submit02.c
@@ -0,0 +1,89 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) Crackerjack Project., 2007
+ * Ported from Crackerjack to LTP by Masatake YAMATO <yamato@redhat.com>
+ * Copyright (c) 2011-2017 Cyril Hrubis <chrubis@suse.cz>
+ * Copyright (c) 2021 Xie Ziyao <xieziyao@huawei.com>
+ */
+
+/*\
+ * [Description]
+ *
+ * Test io_submit invoked via syscall(2):
+ *
+ * 1. io_submit() returns the number of iocbs submitted.
+ * 2. io_submit() returns 0 if nr is zero.
+ */
+
+#include <linux/aio_abi.h>
+
+#include "config.h"
+#include "tst_test.h"
+#include "lapi/syscalls.h"
+
+#define TEST_FILE "test_file"
+#define MODE 0777
+
+static int fd;
+static char buf[100];
+
+static aio_context_t ctx;
+static struct iocb iocb;
+static struct iocb *iocbs[] = {&iocb};
+
+static struct tcase {
+	aio_context_t *ctx;
+	long nr;
+	struct iocb **iocbs;
+	const char *desc;
+} tc[] = {
+	{&ctx, 1, iocbs, "returns the number of iocbs submitted"},
+	{&ctx, 0, NULL, "returns 0 if nr is zero"},
+};
+
+static inline void io_prep_option(struct iocb *cb, int fd, void *buf,
+			size_t count, long long offset, unsigned opcode)
+{
+	memset(cb, 0, sizeof(*cb));
+	cb->aio_fildes = fd;
+	cb->aio_lio_opcode = opcode;
+	cb->aio_buf = (uint64_t)buf;
+	cb->aio_offset = offset;
+	cb->aio_nbytes = count;
+}
+
+static void setup(void)
+{
+	TST_EXP_PASS_SILENT(tst_syscall(__NR_io_setup, 1, &ctx));
+	fd = SAFE_OPEN(TEST_FILE, O_RDONLY | O_CREAT, MODE);
+	io_prep_option(&iocb, fd, buf, 0, 0, IOCB_CMD_PREAD);
+}
+
+static void cleanup(void)
+{
+	if (fd > 0)
+		SAFE_CLOSE(fd);
+	TST_EXP_PASS_SILENT(tst_syscall(__NR_io_destroy, ctx));
+}
+
+static void run(unsigned int i)
+{
+	TEST(tst_syscall(__NR_io_submit, *tc[i].ctx, tc[i].nr, tc[i].iocbs));
+
+	if (TST_RET == tc[i].nr)
+		tst_res(TPASS, "io_submit() %s", tc[i].desc);
+	else
+		tst_res(TFAIL, "io_submit() returns %ld, expected %ld", TST_RET, tc[i].nr);
+}
+
+static struct tst_test test = {
+	.tcnt = ARRAY_SIZE(tc),
+	.needs_tmpdir = 1,
+	.needs_kconfigs = (const char *[]) {
+		"CONFIG_AIO=y",
+		NULL
+	},
+	.setup = setup,
+	.cleanup = cleanup,
+	.test = run,
+};
--
2.17.1


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

* [LTP] [PATCH 4/4 v2] syscalls/io_submit: Add io_submit03 test for native AIO
  2021-06-08 13:57 [LTP] [PATCH 0/4 v2] syscalls/aio: Add testcases for native AIO Xie Ziyao
                   ` (2 preceding siblings ...)
  2021-06-08 13:57 ` [LTP] [PATCH 3/4 v2] syscalls/io_submit: Add io_submit02 " Xie Ziyao
@ 2021-06-08 13:57 ` Xie Ziyao
  2021-06-10  8:26   ` Cyril Hrubis
  3 siblings, 1 reply; 6+ messages in thread
From: Xie Ziyao @ 2021-06-08 13:57 UTC (permalink / raw)
  To: ltp

Test io_submit invoked via syscall(2):
1. io_submit fails and returns EINVAL if ctx is invalid.
2. io_submit fails and returns EINVAL if nr is invalid.
3. io_submit fails and returns EFAULT if iocbpp pointer is invalid.
4. io_submit fails and returns EBADF if fd is invalid.

Signed-off-by: Xie Ziyao <xieziyao@huawei.com>
---
v1->v2:
1. Split io_submit02 into two, one for negative and one for positive cases.
2. Print values not variable names in TST_EXP_PASS().
3. Add .needs_kconfig in this test.

runtest/syscalls                              |   1 +
 .../kernel/syscalls/io_submit/.gitignore      |   1 +
 .../kernel/syscalls/io_submit/io_submit03.c   | 118 ++++++++++++++++++
 3 files changed, 120 insertions(+)
 create mode 100644 testcases/kernel/syscalls/io_submit/io_submit03.c

diff --git a/runtest/syscalls b/runtest/syscalls
index 9c4c64fa3..e1a02ef7f 100644
--- a/runtest/syscalls
+++ b/runtest/syscalls
@@ -617,6 +617,7 @@ io_setup01 io_setup01
 io_setup02 io_setup02
 io_submit01 io_submit01
 io_submit02 io_submit02
+io_submit03 io_submit03

 keyctl01 keyctl01
 keyctl02 keyctl02
diff --git a/testcases/kernel/syscalls/io_submit/.gitignore b/testcases/kernel/syscalls/io_submit/.gitignore
index 5f2a2cff2..60b07970a 100644
--- a/testcases/kernel/syscalls/io_submit/.gitignore
+++ b/testcases/kernel/syscalls/io_submit/.gitignore
@@ -1,2 +1,3 @@
 /io_submit01
 /io_submit02
+/io_submit03
diff --git a/testcases/kernel/syscalls/io_submit/io_submit03.c b/testcases/kernel/syscalls/io_submit/io_submit03.c
new file mode 100644
index 000000000..e0e596d00
--- /dev/null
+++ b/testcases/kernel/syscalls/io_submit/io_submit03.c
@@ -0,0 +1,118 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) Crackerjack Project., 2007
+ * Ported from Crackerjack to LTP by Masatake YAMATO <yamato@redhat.com>
+ * Copyright (c) 2011-2017 Cyril Hrubis <chrubis@suse.cz>
+ * Copyright (c) 2021 Xie Ziyao <xieziyao@huawei.com>
+ */
+
+/*\
+ * [Description]
+ *
+ * Test io_submit invoked via syscall(2):
+ *
+ * 1. io_submit fails and returns EINVAL if ctx is invalid.
+ * 2. io_submit fails and returns EINVAL if nr is invalid.
+ * 3. io_submit fails and returns EFAULT if iocbpp pointer is invalid.
+ * 4. io_submit fails and returns EBADF if fd is invalid.
+ */
+
+#include <linux/aio_abi.h>
+
+#include "config.h"
+#include "tst_test.h"
+#include "lapi/syscalls.h"
+
+#define RDONLY_FILE "rdonly_file"
+#define WRONLY_FILE "wronly_file"
+#define MODE 0777
+
+static char buf[100];
+static aio_context_t ctx;
+static aio_context_t invalid_ctx;
+
+static struct iocb iocb;
+static struct iocb *iocbs[] = {&iocb};
+
+static struct iocb inv_fd_iocb;
+static struct iocb *inv_fd_iocbs[] = {&inv_fd_iocb};
+
+static int rdonly_fd;
+static struct iocb rdonly_fd_iocb;
+static struct iocb *rdonly_fd_iocbs[] = {&rdonly_fd_iocb};
+
+static int wronly_fd;
+static struct iocb wronly_fd_iocb;
+static struct iocb *wronly_fd_iocbs[] = {&wronly_fd_iocb};
+
+static struct iocb *zero_iocbs[1];
+
+static struct tcase {
+	aio_context_t *ctx;
+	long nr;
+	struct iocb **iocbs;
+	int exp_errno;
+	const char *desc;
+} tc[] = {
+	/* Invalid ctx */
+	{&invalid_ctx, 1, iocbs, EINVAL, "invalid ctx"},
+	/* Invalid nr */
+	{&ctx, -1, iocbs, EINVAL, "invalid nr"},
+	/* Invalid pointer */
+	{&ctx, 1, (void*)-1, EFAULT, "invalid iocbpp pointer"},
+	{&ctx, 1, zero_iocbs, EFAULT, "NULL iocb pointers"},
+	/* Invalid fd */
+	{&ctx, 1, inv_fd_iocbs, EBADF, "invalid fd"},
+	{&ctx, 1, rdonly_fd_iocbs, EBADF, "readonly fd for write"},
+	{&ctx, 1, wronly_fd_iocbs, EBADF, "writeonly fd for read"},
+};
+
+static inline void io_prep_option(struct iocb *cb, int fd, void *buf,
+			size_t count, long long offset, unsigned opcode)
+{
+	memset(cb, 0, sizeof(*cb));
+	cb->aio_fildes = fd;
+	cb->aio_lio_opcode = opcode;
+	cb->aio_buf = (uint64_t)buf;
+	cb->aio_offset = offset;
+	cb->aio_nbytes = count;
+}
+
+static void setup(void)
+{
+	TST_EXP_PASS_SILENT(tst_syscall(__NR_io_setup, 1, &ctx));
+	io_prep_option(&inv_fd_iocb, -1, buf, sizeof(buf), 0, IOCB_CMD_PREAD);
+
+	rdonly_fd = SAFE_OPEN(RDONLY_FILE, O_RDONLY | O_CREAT, MODE);
+	io_prep_option(&rdonly_fd_iocb, rdonly_fd, buf, sizeof(buf), 0, IOCB_CMD_PWRITE);
+
+	wronly_fd = SAFE_OPEN(WRONLY_FILE, O_WRONLY | O_CREAT, MODE);
+	io_prep_option(&wronly_fd_iocb, wronly_fd, buf, sizeof(buf), 0, IOCB_CMD_PREAD);
+}
+
+static void cleanup(void)
+{
+	if (rdonly_fd > 0)
+		SAFE_CLOSE(rdonly_fd);
+	if (wronly_fd > 0)
+		SAFE_CLOSE(wronly_fd);
+	TST_EXP_PASS_SILENT(tst_syscall(__NR_io_destroy, ctx));
+}
+
+static void run(unsigned int i)
+{
+	TST_EXP_FAIL(tst_syscall(__NR_io_submit, *tc[i].ctx, tc[i].nr, tc[i].iocbs),
+		     tc[i].exp_errno, "io_submit() with %s", tc[i].desc);
+}
+
+static struct tst_test test = {
+	.tcnt = ARRAY_SIZE(tc),
+	.needs_tmpdir = 1,
+	.needs_kconfigs = (const char *[]) {
+		"CONFIG_AIO=y",
+		NULL
+	},
+	.setup = setup,
+	.cleanup = cleanup,
+	.test = run,
+};
--
2.17.1


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

* [LTP] [PATCH 4/4 v2] syscalls/io_submit: Add io_submit03 test for native AIO
  2021-06-08 13:57 ` [LTP] [PATCH 4/4 v2] syscalls/io_submit: Add io_submit03 " Xie Ziyao
@ 2021-06-10  8:26   ` Cyril Hrubis
  0 siblings, 0 replies; 6+ messages in thread
From: Cyril Hrubis @ 2021-06-10  8:26 UTC (permalink / raw)
  To: ltp

Hi!
> +static void cleanup(void)
> +{
> +	if (rdonly_fd > 0)
> +		SAFE_CLOSE(rdonly_fd);
> +	if (wronly_fd > 0)
> +		SAFE_CLOSE(wronly_fd);
> +	TST_EXP_PASS_SILENT(tst_syscall(__NR_io_destroy, ctx));

I've replaced these PASS_SILENT() with plain old tst_brk(TBROK ...) in
the last two tests and pushed, thanks.


The TST_EXP_* macros are intended for the actual test and not for
setup/cleanup where the test is supposed to report TBROK if something
goes wrong.

-- 
Cyril Hrubis
chrubis@suse.cz

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

end of thread, other threads:[~2021-06-10  8:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-08 13:57 [LTP] [PATCH 0/4 v2] syscalls/aio: Add testcases for native AIO Xie Ziyao
2021-06-08 13:57 ` [LTP] [PATCH 1/4 v2] syscalls/io_destroy: Add io_destroy02 test " Xie Ziyao
2021-06-08 13:57 ` [LTP] [PATCH 2/4 v2] syscalls/io_setup: Add io_setup02 " Xie Ziyao
2021-06-08 13:57 ` [LTP] [PATCH 3/4 v2] syscalls/io_submit: Add io_submit02 " Xie Ziyao
2021-06-08 13:57 ` [LTP] [PATCH 4/4 v2] syscalls/io_submit: Add io_submit03 " Xie Ziyao
2021-06-10  8:26   ` Cyril Hrubis

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.