Skip to contentSkip to conversation

Add ioctl_ficlone04 test

PATCH Superseded Andrea Cervesato 3 participants 4 messages Jul 26, 2024 – Jul 30, 2024

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

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
index 9f995b1ad..1f099ff95 100644
@@ -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
Reviewed-by on v4 1/1
#1 lore raw

Hi!

Quoted 54 lines

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
index 9f995b1ad..1f099ff95 100644
@@ -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 +9 -0
new file mode 100644
index 000000000..b7711ac30
@@ -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
Reviewed-by
#2 lore raw
Quoted 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
#3 lore raw

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

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