Add ioctl_ficlone04 test
PATCH v4 1/1 Add ioctl_ficlone04 test
From: Andrea Cervesato <[email protected]>
This test verifies that ioctl() FICLONE/FICLONERANGE feature raises the right error according with bad file descriptors.
---
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/[email protected]
Changes in v3:
- ioctl_ficlone04: use a generic array for expected errors
- Link to v2: https://lore.kernel.org/r/[email protected]
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/[email protected]
--- testcases/kernel/syscalls/ioctl/.gitignore | 1 + testcases/kernel/syscalls/ioctl/ioctl_ficlone04.c | 52 +++++++++++++++++++++++ 2 files changed, 53 insertions(+)
testcases/kernel/syscalls/ioctl/.gitignore +1 -0
@@ -25,5 +25,6 @@ /ioctl_ficlone01 /ioctl_ficlone02 /ioctl_ficlone03 +/ioctl_ficlone04 /ioctl_ficlonerange01 /ioctl_ficlonerange02
testcases/kernel/syscalls/ioctl/ioctl_ficlone04.c new file +52 -0
52 lines not on this page · raw message
---
base-commit: eee3b2dd6d9dae6120646bc14c30e460989d7df6
change-id: 20240529-ioctl_ficlone-95c603f71d53
Best regards,
Signature · 5 lines
Andrea Cervesato <[email protected]> -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Quoted 54 lines
This test verifies that
ioctl()FICLONE/FICLONERANGE feature raises the right error according with bad file descriptors.Signed-off-by Andrea Cervesato <[email protected]>---
This testing suite is testingioctl()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/[email protected]Changes in v3:
-ioctl_ficlone04: use a generic array for expected errors
- Link to v2: https://lore.kernel.org/r/[email protected]Changes in v2:
- add fallback definitions
- algorithm steps using '-'
- avoid assigning -1 to file descriptors afterclose()
- useSAFE_UNLINK()instead ofremove()
- enable both xfs and btrs for all tests
- Link to v1: https://lore.kernel.org/r/[email protected]--- testcases/kernel/syscalls/ioctl/.gitignore | 1 + testcases/kernel/syscalls/ioctl/ioctl_ficlone04.c | 52 +++++++++++++++++++++++ 2 files changed, 53 insertions(+)testcases/kernel/syscalls/ioctl/.gitignore +1
-0@@ -25,5 +25,6 @@ /ioctl_ficlone01 /ioctl_ficlone02 /ioctl_ficlone03 +/ioctl_ficlone04 /ioctl_ficlonerange01 /ioctl_ficlonerange02testcases/kernel/syscalls/ioctl/ioctl_ficlone04.c new file +9
-0@@ -0,0 +1,52 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* Copyright (C) 2024 Andrea Cervesato [email protected] +*/ + +/*\ +* [Description] +* +* This test verifies that ioctl() FICLONE/FICLONERANGE feature raises the right
testcases/kernel/syscalls/ioctl/ioctl_ficlone04.c line 19
Quoted 10 lines
testcases/kernel/syscalls/ioctl/ioctl_ficlone04.c new file +10
-0+* 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:
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Petr Vorel
Reviewed-byQuoted 3 lines
testcases/kernel/syscalls/ioctl/ioctl_ficlone04.c line 3
Quoted 3 lines
testcases/kernel/syscalls/ioctl/ioctl_ficlone04.c new file +3
-0+// SPDX-License-Identifier: GPL-2.0-or-later +/* +* Copyright (C) 2024 Andrea Cervesato [email protected]
nit: ve usually put email into < > (e.g. <[email protected]>)
Quoted 1 line
Quoted 1 line
+ */
...
Quoted 6 lines
testcases/kernel/syscalls/ioctl/ioctl_ficlone04.c line 19
Quoted 4 lines
testcases/kernel/syscalls/ioctl/ioctl_ficlone04.c new file +4
-0+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
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
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Quoted 7 lines
Quoted 6 lines
testcases/kernel/syscalls/ioctl/ioctl_ficlone04.c line 19
Quoted 4 lines
testcases/kernel/syscalls/ioctl/ioctl_ficlone04.c new file +4
-0+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.
Quoted 6 lines
+1
Reviewed-by Petr Vorel <[email protected]>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.
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp