* [LTP] [PATCH 0/7] syscalls/aio: Add tests for libaio and docparse formatting
@ 2021-06-18 9:42 Xie Ziyao
2021-06-18 9:42 ` [LTP] [PATCH 1/7] io_cancel02: Add io_cancel02 test for libaio Xie Ziyao
` (6 more replies)
0 siblings, 7 replies; 17+ messages in thread
From: Xie Ziyao @ 2021-06-18 9:42 UTC (permalink / raw)
To: ltp
Xie Ziyao (7):
io_cancel02: Add io_cancel02 test for libaio
io_cancel01: Add .needs_kconfigs and more detailed description
io_destroy01: Add docparse formatting and more detailed description
io_getevents01: Add .needs_kconfigs and more detailed description
io_getevents02: Add io_getevents02 test for libaio
io_setup: Add docparse formatting and more detailed description
io_submit01: Add docparse formatting and more detailed description
runtest/syscalls | 2 +
.../kernel/syscalls/io_cancel/.gitignore | 1 +
.../kernel/syscalls/io_cancel/io_cancel01.c | 9 +++-
.../kernel/syscalls/io_cancel/io_cancel02.c | 51 +++++++++++++++++++
.../kernel/syscalls/io_destroy/io_destroy01.c | 15 +++---
.../kernel/syscalls/io_getevents/.gitignore | 1 +
.../syscalls/io_getevents/io_getevents01.c | 8 ++-
.../syscalls/io_getevents/io_getevents02.c | 51 +++++++++++++++++++
.../kernel/syscalls/io_setup/io_setup01.c | 24 +++++----
.../kernel/syscalls/io_setup/io_setup02.c | 8 +--
.../kernel/syscalls/io_submit/io_submit01.c | 15 +++++-
11 files changed, 158 insertions(+), 27 deletions(-)
create mode 100644 testcases/kernel/syscalls/io_cancel/io_cancel02.c
create mode 100644 testcases/kernel/syscalls/io_getevents/io_getevents02.c
--
2.17.1
^ permalink raw reply [flat|nested] 17+ messages in thread
* [LTP] [PATCH 1/7] io_cancel02: Add io_cancel02 test for libaio
2021-06-18 9:42 [LTP] [PATCH 0/7] syscalls/aio: Add tests for libaio and docparse formatting Xie Ziyao
@ 2021-06-18 9:42 ` Xie Ziyao
2021-06-21 8:42 ` Cyril Hrubis
2021-06-18 9:42 ` [LTP] [PATCH 2/7] io_cancel01: Add .needs_kconfigs and more detailed description Xie Ziyao
` (5 subsequent siblings)
6 siblings, 1 reply; 17+ messages in thread
From: Xie Ziyao @ 2021-06-18 9:42 UTC (permalink / raw)
To: ltp
Test io_cancel invoked via libaio with one of the data structures
points to invalid data and expects it to return -EFAULT.
Signed-off-by: Xie Ziyao <xieziyao@huawei.com>
---
runtest/syscalls | 1 +
.../kernel/syscalls/io_cancel/.gitignore | 1 +
.../kernel/syscalls/io_cancel/io_cancel02.c | 51 +++++++++++++++++++
3 files changed, 53 insertions(+)
create mode 100644 testcases/kernel/syscalls/io_cancel/io_cancel02.c
diff --git a/runtest/syscalls b/runtest/syscalls
index 6c42c0b09..28ffa1286 100644
--- a/runtest/syscalls
+++ b/runtest/syscalls
@@ -606,6 +606,7 @@ ioprio_set02 ioprio_set02
ioprio_set03 ioprio_set03
io_cancel01 io_cancel01
+io_cancel02 io_cancel02
io_destroy01 io_destroy01
io_destroy02 io_destroy02
io_getevents01 io_getevents01
diff --git a/testcases/kernel/syscalls/io_cancel/.gitignore b/testcases/kernel/syscalls/io_cancel/.gitignore
index 1728695a6..f01afa592 100644
--- a/testcases/kernel/syscalls/io_cancel/.gitignore
+++ b/testcases/kernel/syscalls/io_cancel/.gitignore
@@ -1 +1,2 @@
/io_cancel01
+/io_cancel02
diff --git a/testcases/kernel/syscalls/io_cancel/io_cancel02.c b/testcases/kernel/syscalls/io_cancel/io_cancel02.c
new file mode 100644
index 000000000..9fc131065
--- /dev/null
+++ b/testcases/kernel/syscalls/io_cancel/io_cancel02.c
@@ -0,0 +1,51 @@
+// 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) 2021 Xie Ziyao <xieziyao@huawei.com>
+ */
+
+/*\
+ * [Description]
+ *
+ * Test io_cancel invoked via libaio with one of the data structures points
+ * to invalid data and expects it to return -EFAULT.
+ */
+
+#include "config.h"
+#include "tst_test.h"
+
+#ifdef HAVE_LIBAIO
+#define EXP_RET (-EFAULT)
+
+#include <libaio.h>
+
+static void run(void)
+{
+ io_context_t ctx;
+
+ memset(&ctx, 0, sizeof(ctx));
+ TEST(io_cancel(ctx, NULL, NULL));
+
+ if (TST_RET == 0)
+ tst_res(TFAIL, "call succeeded unexpectedly");
+ else if (TST_RET == EXP_RET)
+ tst_res(TPASS, "io_cancel(ctx, NULL, NULL) returns %ld : %s",
+ TST_RET, strerror(-TST_RET));
+ else
+ tst_res(TFAIL, "io_cancel(ctx, NULL, NULL) returns %ld : %s, expected %d : %s",
+ TST_RET, strerror(-TST_RET), EXP_RET, strerror(-EXP_RET));
+}
+
+static struct tst_test test = {
+ .needs_kconfigs = (const char *[]) {
+ "CONFIG_AIO=y",
+ NULL
+ },
+ .test_all = run,
+};
+
+#else
+TST_TEST_TCONF("test requires libaio and it's development packages");
+#endif
--
2.17.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [LTP] [PATCH 2/7] io_cancel01: Add .needs_kconfigs and more detailed description
2021-06-18 9:42 [LTP] [PATCH 0/7] syscalls/aio: Add tests for libaio and docparse formatting Xie Ziyao
2021-06-18 9:42 ` [LTP] [PATCH 1/7] io_cancel02: Add io_cancel02 test for libaio Xie Ziyao
@ 2021-06-18 9:42 ` Xie Ziyao
2021-06-21 8:46 ` Cyril Hrubis
2021-06-18 9:42 ` [LTP] [PATCH 3/7] io_destroy01: Add docparse formatting " Xie Ziyao
` (4 subsequent siblings)
6 siblings, 1 reply; 17+ messages in thread
From: Xie Ziyao @ 2021-06-18 9:42 UTC (permalink / raw)
To: ltp
Add .needs_kconfigs and more detailed description to distinguish it from io_cancel02.
Signed-off-by: Xie Ziyao <xieziyao@huawei.com>
---
testcases/kernel/syscalls/io_cancel/io_cancel01.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/testcases/kernel/syscalls/io_cancel/io_cancel01.c b/testcases/kernel/syscalls/io_cancel/io_cancel01.c
index 11f789b78..8bd65bd4a 100644
--- a/testcases/kernel/syscalls/io_cancel/io_cancel01.c
+++ b/testcases/kernel/syscalls/io_cancel/io_cancel01.c
@@ -8,8 +8,8 @@
/*\
* [Description]
*
- * Calls io_cancel() with one of the data structures points to invalid data and
- * expects it to return EFAULT.
+ * Test io_cancel invoked via syscall(2) with one of the data structures
+ * points to invalid data and expects it to return EFAULT.
*/
#include <linux/aio_abi.h>
@@ -21,10 +21,15 @@
static void run(void)
{
aio_context_t ctx;
+
memset(&ctx, 0, sizeof(ctx));
TST_EXP_FAIL(tst_syscall(__NR_io_cancel, ctx, NULL, NULL), EFAULT);
}
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] 17+ messages in thread
* [LTP] [PATCH 3/7] io_destroy01: Add docparse formatting and more detailed description
2021-06-18 9:42 [LTP] [PATCH 0/7] syscalls/aio: Add tests for libaio and docparse formatting Xie Ziyao
2021-06-18 9:42 ` [LTP] [PATCH 1/7] io_cancel02: Add io_cancel02 test for libaio Xie Ziyao
2021-06-18 9:42 ` [LTP] [PATCH 2/7] io_cancel01: Add .needs_kconfigs and more detailed description Xie Ziyao
@ 2021-06-18 9:42 ` Xie Ziyao
2021-06-21 8:52 ` Cyril Hrubis
2021-06-18 9:42 ` [LTP] [PATCH 4/7] io_getevents01: Add .needs_kconfigs " Xie Ziyao
` (3 subsequent siblings)
6 siblings, 1 reply; 17+ messages in thread
From: Xie Ziyao @ 2021-06-18 9:42 UTC (permalink / raw)
To: ltp
Add docparse formatting and more detailed description to distinguish it
from io_destroy02.
Signed-off-by: Xie Ziyao <xieziyao@huawei.com>
---
.../kernel/syscalls/io_destroy/io_destroy01.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/testcases/kernel/syscalls/io_destroy/io_destroy01.c b/testcases/kernel/syscalls/io_destroy/io_destroy01.c
index bb89f61f5..79c685faa 100644
--- a/testcases/kernel/syscalls/io_destroy/io_destroy01.c
+++ b/testcases/kernel/syscalls/io_destroy/io_destroy01.c
@@ -1,15 +1,16 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) Crackerjack Project., 2007
- * Copyright (c) 2011 Cyril Hrubis <chrubis@suse.cz>
- * Copyright (c) 2017 Xiao Yang <yangx.jy@cn.fujitsu.com>
+ * 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>
*/
-/* Porting from Crackerjack to LTP is done
- * by Masatake YAMATO <yamato@redhat.com>
+/*\
+ * [Description]
*
- * Description:
- * io_destroy(2) fails and returns -EINVAL if ctx is invalid.
+ * Test io_destroy invoked via libaio with invalid ctx and expects it to
+ * return -EINVAL.
*/
#include <errno.h>
--
2.17.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [LTP] [PATCH 4/7] io_getevents01: Add .needs_kconfigs and more detailed description
2021-06-18 9:42 [LTP] [PATCH 0/7] syscalls/aio: Add tests for libaio and docparse formatting Xie Ziyao
` (2 preceding siblings ...)
2021-06-18 9:42 ` [LTP] [PATCH 3/7] io_destroy01: Add docparse formatting " Xie Ziyao
@ 2021-06-18 9:42 ` Xie Ziyao
2021-06-21 8:55 ` Cyril Hrubis
2021-06-18 9:42 ` [LTP] [PATCH 5/7] io_getevents02: Add io_getevents02 test for libaio Xie Ziyao
` (2 subsequent siblings)
6 siblings, 1 reply; 17+ messages in thread
From: Xie Ziyao @ 2021-06-18 9:42 UTC (permalink / raw)
To: ltp
Add .needs_kconfigs and more detailed description to distinguish it from
io_getevents02.
Signed-off-by: Xie Ziyao <xieziyao@huawei.com>
---
testcases/kernel/syscalls/io_getevents/io_getevents01.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/testcases/kernel/syscalls/io_getevents/io_getevents01.c b/testcases/kernel/syscalls/io_getevents/io_getevents01.c
index ad85cdaa5..9dba4addf 100644
--- a/testcases/kernel/syscalls/io_getevents/io_getevents01.c
+++ b/testcases/kernel/syscalls/io_getevents/io_getevents01.c
@@ -8,7 +8,8 @@
/*\
* [Description]
*
- * Calls io_getevents() when ctx is invalid and expects it to return EINVAL.
+ * Test io_getevents invoked via syscall(2) with invalid ctx and expects it to
+ * return EINVAL.
*/
#include <linux/aio_abi.h>
@@ -20,10 +21,15 @@
static void run(void)
{
aio_context_t ctx;
+
memset(&ctx, 0, sizeof(ctx));
TST_EXP_FAIL(tst_syscall(__NR_io_getevents, ctx, 0, 0, NULL, NULL), EINVAL);
}
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] 17+ messages in thread
* [LTP] [PATCH 5/7] io_getevents02: Add io_getevents02 test for libaio
2021-06-18 9:42 [LTP] [PATCH 0/7] syscalls/aio: Add tests for libaio and docparse formatting Xie Ziyao
` (3 preceding siblings ...)
2021-06-18 9:42 ` [LTP] [PATCH 4/7] io_getevents01: Add .needs_kconfigs " Xie Ziyao
@ 2021-06-18 9:42 ` Xie Ziyao
2021-06-21 9:02 ` Cyril Hrubis
2021-06-18 9:42 ` [LTP] [PATCH 6/7] io_setup: Add docparse formatting and more detailed description Xie Ziyao
2021-06-18 9:42 ` [LTP] [PATCH 7/7] io_submit01: " Xie Ziyao
6 siblings, 1 reply; 17+ messages in thread
From: Xie Ziyao @ 2021-06-18 9:42 UTC (permalink / raw)
To: ltp
Test io_getevents invoked via libaio with invalid ctx and expects it to
return -EINVAL.
Signed-off-by: Xie Ziyao <xieziyao@huawei.com>
---
runtest/syscalls | 1 +
.../kernel/syscalls/io_getevents/.gitignore | 1 +
.../syscalls/io_getevents/io_getevents02.c | 51 +++++++++++++++++++
3 files changed, 53 insertions(+)
create mode 100644 testcases/kernel/syscalls/io_getevents/io_getevents02.c
diff --git a/runtest/syscalls b/runtest/syscalls
index 28ffa1286..bf5a42b1f 100644
--- a/runtest/syscalls
+++ b/runtest/syscalls
@@ -610,6 +610,7 @@ io_cancel02 io_cancel02
io_destroy01 io_destroy01
io_destroy02 io_destroy02
io_getevents01 io_getevents01
+io_getevents02 io_getevents02
io_pgetevents01 io_pgetevents01
io_pgetevents02 io_pgetevents02
diff --git a/testcases/kernel/syscalls/io_getevents/.gitignore b/testcases/kernel/syscalls/io_getevents/.gitignore
index b3a5f4df1..b57022f73 100644
--- a/testcases/kernel/syscalls/io_getevents/.gitignore
+++ b/testcases/kernel/syscalls/io_getevents/.gitignore
@@ -1 +1,2 @@
/io_getevents01
+/io_getevents02
diff --git a/testcases/kernel/syscalls/io_getevents/io_getevents02.c b/testcases/kernel/syscalls/io_getevents/io_getevents02.c
new file mode 100644
index 000000000..d91319151
--- /dev/null
+++ b/testcases/kernel/syscalls/io_getevents/io_getevents02.c
@@ -0,0 +1,51 @@
+// 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) 2021 Xie Ziyao <xieziyao@huawei.com>
+ */
+
+/*\
+ * [Description]
+ *
+ * Test io_getevents invoked via libaio with invalid ctx and expects it to
+ * return -EINVAL.
+ */
+
+#include "config.h"
+#include "tst_test.h"
+
+#ifdef HAVE_LIBAIO
+#include <libaio.h>
+
+#define EXP_RET (-EINVAL)
+
+static void run(void)
+{
+ io_context_t ctx;
+
+ memset(&ctx, 0, sizeof(ctx));
+ TEST(io_getevents(ctx, 0, 0, NULL, NULL));
+
+ if (TST_RET == 0)
+ tst_res(TFAIL, "call succeeded unexpectedly");
+ else if (TST_RET == EXP_RET)
+ tst_res(TPASS, "io_cancel(ctx, NULL, NULL) returns %ld : %s",
+ TST_RET, strerror(-TST_RET));
+ else
+ tst_res(TFAIL, "io_cancel(ctx, NULL, NULL) returns %ld : %s, expected %d : %s",
+ TST_RET, strerror(-TST_RET), EXP_RET, strerror(-EXP_RET));
+}
+
+static struct tst_test test = {
+ .needs_kconfigs = (const char *[]) {
+ "CONFIG_AIO=y",
+ NULL
+ },
+ .test_all = run,
+};
+
+#else
+TST_TEST_TCONF("test requires libaio and it's development packages");
+#endif
--
2.17.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [LTP] [PATCH 6/7] io_setup: Add docparse formatting and more detailed description
2021-06-18 9:42 [LTP] [PATCH 0/7] syscalls/aio: Add tests for libaio and docparse formatting Xie Ziyao
` (4 preceding siblings ...)
2021-06-18 9:42 ` [LTP] [PATCH 5/7] io_getevents02: Add io_getevents02 test for libaio Xie Ziyao
@ 2021-06-18 9:42 ` Xie Ziyao
2021-06-21 12:58 ` Cyril Hrubis
2021-06-18 9:42 ` [LTP] [PATCH 7/7] io_submit01: " Xie Ziyao
6 siblings, 1 reply; 17+ messages in thread
From: Xie Ziyao @ 2021-06-18 9:42 UTC (permalink / raw)
To: ltp
Add docparse formatting and more detailed description to distinguish
io_setup01 from io_setup02.
Signed-off-by: Xie Ziyao <xieziyao@huawei.com>
---
.../kernel/syscalls/io_setup/io_setup01.c | 24 ++++++++++---------
.../kernel/syscalls/io_setup/io_setup02.c | 8 +++----
2 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/testcases/kernel/syscalls/io_setup/io_setup01.c b/testcases/kernel/syscalls/io_setup/io_setup01.c
index 28aee7831..0377ca193 100644
--- a/testcases/kernel/syscalls/io_setup/io_setup01.c
+++ b/testcases/kernel/syscalls/io_setup/io_setup01.c
@@ -1,19 +1,21 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) Crackerjack Project., 2007
- * Copyright (c) 2011 Cyril Hrubis <chrubis@suse.cz>
- * Copyright (c) 2017 Xiao Yang <yangx.jy@cn.fujitsu.com>
+ * 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>
*/
-/* Porting from Crackerjack to LTP is done
- * by Masatake YAMATO <yamato@redhat.com>
+/*\
+ * [Description]
*
- * Description:
- * 1) io_setup(2) succeeds if both nr_events and ctxp are valid.
- * 2) io_setup(2) fails and returns -EINVAL if ctxp is not initialized to 0.
- * 3) io_setup(2) fails and returns -EINVAL if nr_events is invalid.
- * 4) io_setup(2) fails and returns -EFAULT if ctxp is NULL.
- * 5) io_setup(2) fails and returns -EAGAIN if nr_events exceeds the limit
+ * Test io_setup invoked via libaio:
+ *
+ * 1. io_setup succeeds if both nr_events and ctxp are valid.
+ * 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 invalid.
+ * 4. io_setup fails and returns -EFAULT if ctxp is NULL.
+ * 5. io_setup fails and returns -EAGAIN if nr_events exceeds the limit
* of available events.
*/
diff --git a/testcases/kernel/syscalls/io_setup/io_setup02.c b/testcases/kernel/syscalls/io_setup/io_setup02.c
index 292b7440d..4ef0ad1a7 100644
--- a/testcases/kernel/syscalls/io_setup/io_setup02.c
+++ b/testcases/kernel/syscalls/io_setup/io_setup02.c
@@ -12,10 +12,10 @@
*
* 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
+ * 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.
*/
--
2.17.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [LTP] [PATCH 7/7] io_submit01: Add docparse formatting and more detailed description
2021-06-18 9:42 [LTP] [PATCH 0/7] syscalls/aio: Add tests for libaio and docparse formatting Xie Ziyao
` (5 preceding siblings ...)
2021-06-18 9:42 ` [LTP] [PATCH 6/7] io_setup: Add docparse formatting and more detailed description Xie Ziyao
@ 2021-06-18 9:42 ` Xie Ziyao
2021-06-21 13:17 ` Cyril Hrubis
6 siblings, 1 reply; 17+ messages in thread
From: Xie Ziyao @ 2021-06-18 9:42 UTC (permalink / raw)
To: ltp
Add docparse formatting and more detailed description to distinguish it
from io_submit{02, 03}.
Signed-off-by: Xie Ziyao <xieziyao@huawei.com>
---
testcases/kernel/syscalls/io_submit/io_submit01.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/testcases/kernel/syscalls/io_submit/io_submit01.c b/testcases/kernel/syscalls/io_submit/io_submit01.c
index bbbbc9101..cfaf56f8e 100644
--- a/testcases/kernel/syscalls/io_submit/io_submit01.c
+++ b/testcases/kernel/syscalls/io_submit/io_submit01.c
@@ -1,11 +1,22 @@
// 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>
*/
-/* Porting from Crackerjack to LTP is done
- by Masatake YAMATO <yamato@redhat.com> */
+/*\
+ * [Description]
+ *
+ * Test io_submit invoked via libaio:
+ *
+ * 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.
+ * 5. io_submit() succeeds and returns the number of iocbs submitted.
+ * 6. io_submit() succeeds and returns 0 if nr is zero.
+ */
#include <errno.h>
#include <string.h>
--
2.17.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [LTP] [PATCH 1/7] io_cancel02: Add io_cancel02 test for libaio
2021-06-18 9:42 ` [LTP] [PATCH 1/7] io_cancel02: Add io_cancel02 test for libaio Xie Ziyao
@ 2021-06-21 8:42 ` Cyril Hrubis
2021-06-21 9:01 ` Cyril Hrubis
0 siblings, 1 reply; 17+ messages in thread
From: Cyril Hrubis @ 2021-06-21 8:42 UTC (permalink / raw)
To: ltp
Hi!
> +#include "config.h"
> +#include "tst_test.h"
> +
> +#ifdef HAVE_LIBAIO
> +#define EXP_RET (-EFAULT)
> +
> +#include <libaio.h>
> +
> +static void run(void)
> +{
> + io_context_t ctx;
> +
> + memset(&ctx, 0, sizeof(ctx));
> + TEST(io_cancel(ctx, NULL, NULL));
> +
> + if (TST_RET == 0)
> + tst_res(TFAIL, "call succeeded unexpectedly");
> + else if (TST_RET == EXP_RET)
> + tst_res(TPASS, "io_cancel(ctx, NULL, NULL) returns %ld : %s",
> + TST_RET, strerror(-TST_RET));
> + else
> + tst_res(TFAIL, "io_cancel(ctx, NULL, NULL) returns %ld : %s, expected %d : %s",
> + TST_RET, strerror(-TST_RET), EXP_RET, strerror(-EXP_RET));
Please use TST_EXP_FAIL() instead.
> +}
> +
> +static struct tst_test test = {
> + .needs_kconfigs = (const char *[]) {
> + "CONFIG_AIO=y",
> + NULL
> + },
> + .test_all = run,
> +};
> +
> +#else
> +TST_TEST_TCONF("test requires libaio and it's development packages");
> +#endif
> --
> 2.17.1
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 17+ messages in thread
* [LTP] [PATCH 2/7] io_cancel01: Add .needs_kconfigs and more detailed description
2021-06-18 9:42 ` [LTP] [PATCH 2/7] io_cancel01: Add .needs_kconfigs and more detailed description Xie Ziyao
@ 2021-06-21 8:46 ` Cyril Hrubis
0 siblings, 0 replies; 17+ messages in thread
From: Cyril Hrubis @ 2021-06-21 8:46 UTC (permalink / raw)
To: ltp
Hi!
I've adjusted the documentation comment a bit and pushed, thanks.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 17+ messages in thread
* [LTP] [PATCH 3/7] io_destroy01: Add docparse formatting and more detailed description
2021-06-18 9:42 ` [LTP] [PATCH 3/7] io_destroy01: Add docparse formatting " Xie Ziyao
@ 2021-06-21 8:52 ` Cyril Hrubis
0 siblings, 0 replies; 17+ messages in thread
From: Cyril Hrubis @ 2021-06-21 8:52 UTC (permalink / raw)
To: ltp
Hi!
Applied, thanks.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 17+ messages in thread
* [LTP] [PATCH 4/7] io_getevents01: Add .needs_kconfigs and more detailed description
2021-06-18 9:42 ` [LTP] [PATCH 4/7] io_getevents01: Add .needs_kconfigs " Xie Ziyao
@ 2021-06-21 8:55 ` Cyril Hrubis
0 siblings, 0 replies; 17+ messages in thread
From: Cyril Hrubis @ 2021-06-21 8:55 UTC (permalink / raw)
To: ltp
Hi!
Applied, thanks.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 17+ messages in thread
* [LTP] [PATCH 1/7] io_cancel02: Add io_cancel02 test for libaio
2021-06-21 8:42 ` Cyril Hrubis
@ 2021-06-21 9:01 ` Cyril Hrubis
0 siblings, 0 replies; 17+ messages in thread
From: Cyril Hrubis @ 2021-06-21 9:01 UTC (permalink / raw)
To: ltp
Hi!
> > +#include "config.h"
> > +#include "tst_test.h"
> > +
> > +#ifdef HAVE_LIBAIO
> > +#define EXP_RET (-EFAULT)
> > +
> > +#include <libaio.h>
> > +
> > +static void run(void)
> > +{
> > + io_context_t ctx;
> > +
> > + memset(&ctx, 0, sizeof(ctx));
> > + TEST(io_cancel(ctx, NULL, NULL));
> > +
> > + if (TST_RET == 0)
> > + tst_res(TFAIL, "call succeeded unexpectedly");
It's usually easier to read to use return instead of else if branches:
if (TST_RET == 0) {
tst_res(TFAIL, "io_cancel() succeeded unexpectedly");
return;
}
Also you should never use strerror() in tests, we do have tst_strerrno()
for that purpose, also if you have checked that TST_RET == EFAULT there
is no point in converting the value into a string and you can do:
if (TST_RET == -EFAULT) {
tst_res(TPASS, "io_cancel() failed with EFAULT");
return;
}
Followed by:
tst_res(TFAIL, "io_cancel() failed unexpectedly %s (%d) expected EFAULT",
tst_strerrno(-TST_RET), -TST_RET);
> > + else if (TST_RET == EXP_RET)
> > + tst_res(TPASS, "io_cancel(ctx, NULL, NULL) returns %ld : %s",
> > + TST_RET, strerror(-TST_RET));
> > + else
> > + tst_res(TFAIL, "io_cancel(ctx, NULL, NULL) returns %ld : %s, expected %d : %s",
> > + TST_RET, strerror(-TST_RET), EXP_RET, strerror(-EXP_RET));
>
> Please use TST_EXP_FAIL() instead.
Looking again, these calls do return -error on failure, we can't use
TST_EXP_FAIL() here.
But even then there are a couple of problems to fix (commented above).
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 17+ messages in thread
* [LTP] [PATCH 5/7] io_getevents02: Add io_getevents02 test for libaio
2021-06-18 9:42 ` [LTP] [PATCH 5/7] io_getevents02: Add io_getevents02 test for libaio Xie Ziyao
@ 2021-06-21 9:02 ` Cyril Hrubis
2021-06-22 9:18 ` Xie Ziyao
0 siblings, 1 reply; 17+ messages in thread
From: Cyril Hrubis @ 2021-06-21 9:02 UTC (permalink / raw)
To: ltp
Hi!
The comments for io_cancel02 apply here as well.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 17+ messages in thread
* [LTP] [PATCH 6/7] io_setup: Add docparse formatting and more detailed description
2021-06-18 9:42 ` [LTP] [PATCH 6/7] io_setup: Add docparse formatting and more detailed description Xie Ziyao
@ 2021-06-21 12:58 ` Cyril Hrubis
0 siblings, 0 replies; 17+ messages in thread
From: Cyril Hrubis @ 2021-06-21 12:58 UTC (permalink / raw)
To: ltp
Hi!
> + * 1. io_setup succeeds if both nr_events and ctxp are valid.
> + * 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 invalid.
> + * 4. io_setup fails and returns -EFAULT if ctxp is NULL.
> + * 5. io_setup fails and returns -EAGAIN if nr_events exceeds the limit
> * of available events.
I've changed the numbered list to a asciidoc list (items start with -)
so that it renders nicely and pushed, thanks.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 17+ messages in thread
* [LTP] [PATCH 7/7] io_submit01: Add docparse formatting and more detailed description
2021-06-18 9:42 ` [LTP] [PATCH 7/7] io_submit01: " Xie Ziyao
@ 2021-06-21 13:17 ` Cyril Hrubis
0 siblings, 0 replies; 17+ messages in thread
From: Cyril Hrubis @ 2021-06-21 13:17 UTC (permalink / raw)
To: ltp
Hi!
> + * 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.
> + * 5. io_submit() succeeds and returns the number of iocbs submitted.
> + * 6. io_submit() succeeds and returns 0 if nr is zero.
Did the same change here and pushed as well, thanks.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 17+ messages in thread
* [LTP] [PATCH 5/7] io_getevents02: Add io_getevents02 test for libaio
2021-06-21 9:02 ` Cyril Hrubis
@ 2021-06-22 9:18 ` Xie Ziyao
0 siblings, 0 replies; 17+ messages in thread
From: Xie Ziyao @ 2021-06-22 9:18 UTC (permalink / raw)
To: ltp
Hi, Cyril,
> Hi!
> The comments for io_cancel02 apply here as well.
>
Both have been modified in the v2 patchset. Thx.
Kind Regards,
Ziyao
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2021-06-22 9:18 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-18 9:42 [LTP] [PATCH 0/7] syscalls/aio: Add tests for libaio and docparse formatting Xie Ziyao
2021-06-18 9:42 ` [LTP] [PATCH 1/7] io_cancel02: Add io_cancel02 test for libaio Xie Ziyao
2021-06-21 8:42 ` Cyril Hrubis
2021-06-21 9:01 ` Cyril Hrubis
2021-06-18 9:42 ` [LTP] [PATCH 2/7] io_cancel01: Add .needs_kconfigs and more detailed description Xie Ziyao
2021-06-21 8:46 ` Cyril Hrubis
2021-06-18 9:42 ` [LTP] [PATCH 3/7] io_destroy01: Add docparse formatting " Xie Ziyao
2021-06-21 8:52 ` Cyril Hrubis
2021-06-18 9:42 ` [LTP] [PATCH 4/7] io_getevents01: Add .needs_kconfigs " Xie Ziyao
2021-06-21 8:55 ` Cyril Hrubis
2021-06-18 9:42 ` [LTP] [PATCH 5/7] io_getevents02: Add io_getevents02 test for libaio Xie Ziyao
2021-06-21 9:02 ` Cyril Hrubis
2021-06-22 9:18 ` Xie Ziyao
2021-06-18 9:42 ` [LTP] [PATCH 6/7] io_setup: Add docparse formatting and more detailed description Xie Ziyao
2021-06-21 12:58 ` Cyril Hrubis
2021-06-18 9:42 ` [LTP] [PATCH 7/7] io_submit01: " Xie Ziyao
2021-06-21 13:17 ` 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.