* [LTP] [PATCH v4] Add ioctl_ficlone04 test
@ 2024-07-26 13:12 Andrea Cervesato
2024-07-26 15:10 ` Cyril Hrubis
0 siblings, 1 reply; 4+ messages in thread
From: Andrea Cervesato @ 2024-07-26 13:12 UTC (permalink / raw)
To: ltp
From: Andrea Cervesato <andrea.cervesato@suse.com>
This test verifies that ioctl() FICLONE/FICLONERANGE feature raises
the right error according with bad file descriptors.
Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
This testing suite is testing ioctl() FICLONE and FICLONERANGE
functionalities. In particular, file clone and error codes.
---
Changes in v4:
- ioctl_ficlone04: add EPERM and EOPNOTSUP
- Link to v3: https://lore.kernel.org/r/20240724-ioctl_ficlone-v3-1-bdf7551380ee@suse.com
Changes in v3:
- ioctl_ficlone04: use a generic array for expected errors
- Link to v2: https://lore.kernel.org/r/20240723-ioctl_ficlone-v2-0-33075bbc117f@suse.com
Changes in v2:
- add fallback definitions
- algorithm steps using '-'
- avoid assigning -1 to file descriptors after close()
- use SAFE_UNLINK() instead of remove()
- enable both xfs and btrs for all tests
- Link to v1: https://lore.kernel.org/r/20240530-ioctl_ficlone-v1-0-fa96f07d0fca@suse.com
---
testcases/kernel/syscalls/ioctl/.gitignore | 1 +
testcases/kernel/syscalls/ioctl/ioctl_ficlone04.c | 52 +++++++++++++++++++++++
2 files changed, 53 insertions(+)
diff --git a/testcases/kernel/syscalls/ioctl/.gitignore b/testcases/kernel/syscalls/ioctl/.gitignore
index 9f995b1ad..1f099ff95 100644
--- a/testcases/kernel/syscalls/ioctl/.gitignore
+++ b/testcases/kernel/syscalls/ioctl/.gitignore
@@ -25,5 +25,6 @@
/ioctl_ficlone01
/ioctl_ficlone02
/ioctl_ficlone03
+/ioctl_ficlone04
/ioctl_ficlonerange01
/ioctl_ficlonerange02
diff --git a/testcases/kernel/syscalls/ioctl/ioctl_ficlone04.c b/testcases/kernel/syscalls/ioctl/ioctl_ficlone04.c
new file mode 100644
index 000000000..b7711ac30
--- /dev/null
+++ b/testcases/kernel/syscalls/ioctl/ioctl_ficlone04.c
@@ -0,0 +1,52 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2024 Andrea Cervesato andrea.cervesato@suse.com
+ */
+
+/*\
+ * [Description]
+ *
+ * This test verifies that ioctl() FICLONE/FICLONERANGE feature raises the right
+ * error according with bad file descriptors.
+ */
+
+#include "tst_test.h"
+#include "lapi/ficlone.h"
+
+static void test_bad_fd(struct tst_fd *fd_src, struct tst_fd *fd_dst)
+{
+ if (fd_src->type == TST_FD_FILE && fd_src->type == fd_dst->type) {
+ tst_res(TCONF, "Skipping file: SUCCESS");
+ return;
+ }
+
+ int exp_errnos[] = {
+ EOPNOTSUPP,
+ EPERM,
+ EISDIR,
+ EBADF,
+ EINVAL,
+ EXDEV,
+ };
+
+ TST_EXP_FAIL2_ARR(ioctl(fd_dst->fd, FICLONE, fd_src->fd),
+ exp_errnos, ARRAY_SIZE(exp_errnos),
+ "ioctl(%s, FICLONE, %s)",
+ tst_fd_desc(fd_src),
+ tst_fd_desc(fd_dst));
+}
+
+static void run(void)
+{
+ TST_FD_FOREACH(fd_src) {
+ TST_FD_FOREACH(fd_dst)
+ test_bad_fd(&fd_src, &fd_dst);
+ }
+}
+
+static struct tst_test test = {
+ .test_all = run,
+ .min_kver = "4.5",
+ .needs_root = 1,
+ .needs_tmpdir = 1,
+};
---
base-commit: eee3b2dd6d9dae6120646bc14c30e460989d7df6
change-id: 20240529-ioctl_ficlone-95c603f71d53
Best regards,
--
Andrea Cervesato <andrea.cervesato@suse.com>
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [LTP] [PATCH v4] Add ioctl_ficlone04 test
2024-07-26 13:12 [LTP] [PATCH v4] Add ioctl_ficlone04 test Andrea Cervesato
@ 2024-07-26 15:10 ` Cyril Hrubis
2024-07-29 21:53 ` Petr Vorel
0 siblings, 1 reply; 4+ messages in thread
From: Cyril Hrubis @ 2024-07-26 15:10 UTC (permalink / raw)
To: Andrea Cervesato; +Cc: ltp
Hi!
> This test verifies that ioctl() FICLONE/FICLONERANGE feature raises
> the right error according with bad file descriptors.
>
> Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
> ---
> This testing suite is testing ioctl() FICLONE and FICLONERANGE
> functionalities. In particular, file clone and error codes.
> ---
> Changes in v4:
> - ioctl_ficlone04: add EPERM and EOPNOTSUP
> - Link to v3: https://lore.kernel.org/r/20240724-ioctl_ficlone-v3-1-bdf7551380ee@suse.com
>
> Changes in v3:
> - ioctl_ficlone04: use a generic array for expected errors
> - Link to v2: https://lore.kernel.org/r/20240723-ioctl_ficlone-v2-0-33075bbc117f@suse.com
>
> Changes in v2:
> - add fallback definitions
> - algorithm steps using '-'
> - avoid assigning -1 to file descriptors after close()
> - use SAFE_UNLINK() instead of remove()
> - enable both xfs and btrs for all tests
> - Link to v1: https://lore.kernel.org/r/20240530-ioctl_ficlone-v1-0-fa96f07d0fca@suse.com
> ---
> testcases/kernel/syscalls/ioctl/.gitignore | 1 +
> testcases/kernel/syscalls/ioctl/ioctl_ficlone04.c | 52 +++++++++++++++++++++++
> 2 files changed, 53 insertions(+)
>
> diff --git a/testcases/kernel/syscalls/ioctl/.gitignore b/testcases/kernel/syscalls/ioctl/.gitignore
> index 9f995b1ad..1f099ff95 100644
> --- a/testcases/kernel/syscalls/ioctl/.gitignore
> +++ b/testcases/kernel/syscalls/ioctl/.gitignore
> @@ -25,5 +25,6 @@
> /ioctl_ficlone01
> /ioctl_ficlone02
> /ioctl_ficlone03
> +/ioctl_ficlone04
> /ioctl_ficlonerange01
> /ioctl_ficlonerange02
> diff --git a/testcases/kernel/syscalls/ioctl/ioctl_ficlone04.c b/testcases/kernel/syscalls/ioctl/ioctl_ficlone04.c
> new file mode 100644
> index 000000000..b7711ac30
> --- /dev/null
> +++ b/testcases/kernel/syscalls/ioctl/ioctl_ficlone04.c
> @@ -0,0 +1,52 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (C) 2024 Andrea Cervesato andrea.cervesato@suse.com
> + */
> +
> +/*\
> + * [Description]
> + *
> + * This test verifies that ioctl() FICLONE/FICLONERANGE feature raises the right
> + * error according with bad file descriptors.
> + */
> +
> +#include "tst_test.h"
> +#include "lapi/ficlone.h"
> +
> +static void test_bad_fd(struct tst_fd *fd_src, struct tst_fd *fd_dst)
> +{
> + if (fd_src->type == TST_FD_FILE && fd_src->type == fd_dst->type) {
> + tst_res(TCONF, "Skipping file: SUCCESS");
Maybe just a TINFO here.
Otherwise:
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [LTP] [PATCH v4] Add ioctl_ficlone04 test
2024-07-26 15:10 ` Cyril Hrubis
@ 2024-07-29 21:53 ` Petr Vorel
2024-07-30 7:42 ` Cyril Hrubis
0 siblings, 1 reply; 4+ messages in thread
From: Petr Vorel @ 2024-07-29 21:53 UTC (permalink / raw)
To: Andrea Cervesato; +Cc: ltp
> > +// SPDX-License-Identifier: GPL-2.0-or-later
> > +/*
> > + * Copyright (C) 2024 Andrea Cervesato andrea.cervesato@suse.com
nit: ve usually put email into < > (e.g. <andrea.cervesato@suse.com>)
> > + */
...
> > +static void test_bad_fd(struct tst_fd *fd_src, struct tst_fd *fd_dst)
> > +{
> > + if (fd_src->type == TST_FD_FILE && fd_src->type == fd_dst->type) {
> > + tst_res(TCONF, "Skipping file: SUCCESS");
> Maybe just a TINFO here.
+1
Reviewed-by: Petr Vorel <pvorel@suse.cz>
FYI with 2 extra errno (ENOTTY, EFAULT) it would run also on 4.4 kernel (the
oldest still supported - SLE12-SP3) one with this result:
passed 360
failed 0
broken 0
skipped 121
warnings 0
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [LTP] [PATCH v4] Add ioctl_ficlone04 test
2024-07-29 21:53 ` Petr Vorel
@ 2024-07-30 7:42 ` Cyril Hrubis
0 siblings, 0 replies; 4+ messages in thread
From: Cyril Hrubis @ 2024-07-30 7:42 UTC (permalink / raw)
To: Petr Vorel; +Cc: ltp
Hi!
> > > +static void test_bad_fd(struct tst_fd *fd_src, struct tst_fd *fd_dst)
> > > +{
> > > + if (fd_src->type == TST_FD_FILE && fd_src->type == fd_dst->type) {
> > > + tst_res(TCONF, "Skipping file: SUCCESS");
>
> > Maybe just a TINFO here.
>
> +1
>
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
>
> FYI with 2 extra errno (ENOTTY, EFAULT) it would run also on 4.4 kernel (the
> oldest still supported - SLE12-SP3) one with this result:
I'm pretty sure EFAULT there is a kernel bug, ENOTTY sounds strange too.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-07-30 7:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-26 13:12 [LTP] [PATCH v4] Add ioctl_ficlone04 test Andrea Cervesato
2024-07-26 15:10 ` Cyril Hrubis
2024-07-29 21:53 ` Petr Vorel
2024-07-30 7:42 ` Cyril Hrubis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox