Message ID | 20210507083321.167998-2-xieziyao@huawei.com |
---|---|
State | Changes Requested |
Headers | show |
Series | syscalls/aio: Add testcases for native AIO | expand |
Hi! Test looks good but there is one minor problem that has to be solwed, see below. > +/* > + * 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 verify_io_destroy(void) > +{ > + aio_context_t ctx; > + memset(&ctx, 0xff, sizeof(ctx)); > + TST_EXP_FAIL(tst_syscall(__NR_io_destroy, ctx), EINVAL); This may fail the test if CONFIG_AIO has been disabled in kernel, which I think is common for embedded tests. Thinking of solution the easiest fix would probably be to add .needs_kconfigs with "CONFIG_AIO" to the tst_test structure. > +} > + > +static struct tst_test test = { > + .test_all = verify_io_destroy, > +}; > -- > 2.17.1 >
diff --git a/runtest/syscalls b/runtest/syscalls index aa7fa24dd..bd6ec6a2e 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..357e61f10 --- /dev/null +++ b/testcases/kernel/syscalls/io_destroy/io_destroy02.c @@ -0,0 +1,32 @@ +// 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 verify_io_destroy(void) +{ + aio_context_t ctx; + memset(&ctx, 0xff, sizeof(ctx)); + TST_EXP_FAIL(tst_syscall(__NR_io_destroy, ctx), EINVAL); +} + +static struct tst_test test = { + .test_all = verify_io_destroy, +};
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> --- runtest/syscalls | 1 + .../kernel/syscalls/io_destroy/.gitignore | 1 + .../kernel/syscalls/io_destroy/io_destroy02.c | 32 +++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 testcases/kernel/syscalls/io_destroy/io_destroy02.c -- 2.17.1