<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Feb 19, 2020 at 5:28 PM Viresh Kumar <<a href="mailto:viresh.kumar@linaro.org">viresh.kumar@linaro.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Add tests to check working of fsconfig() syscall.<br>
<br>
Signed-off-by: Viresh Kumar <<a href="mailto:viresh.kumar@linaro.org" target="_blank">viresh.kumar@linaro.org</a>><br>
---<br>
runtest/syscalls | 3 +<br>
testcases/kernel/syscalls/fsconfig/.gitignore | 2 +<br>
testcases/kernel/syscalls/fsconfig/Makefile | 6 +<br>
.../kernel/syscalls/fsconfig/fsconfig01.c | 110 ++++++++++++++++++<br>
.../kernel/syscalls/fsconfig/fsconfig02.c | 100 ++++++++++++++++<br>
5 files changed, 221 insertions(+)<br>
create mode 100644 testcases/kernel/syscalls/fsconfig/.gitignore<br>
create mode 100644 testcases/kernel/syscalls/fsconfig/Makefile<br>
create mode 100644 testcases/kernel/syscalls/fsconfig/fsconfig01.c<br>
create mode 100644 testcases/kernel/syscalls/fsconfig/fsconfig02.c<br>
<br>
diff --git a/runtest/syscalls b/runtest/syscalls<br>
index f113342f0ded..4fcbd5f710eb 100644<br>
--- a/runtest/syscalls<br>
+++ b/runtest/syscalls<br>
@@ -341,6 +341,9 @@ fpathconf01 fpathconf01<br>
fremovexattr01 fremovexattr01<br>
fremovexattr02 fremovexattr02<br>
<br>
+fsconfig01 fsconfig01<br>
+fsconfig02 fsconfig02<br>
+<br>
fsmount01 fsmount01<br>
<br>
fsopen01 fsopen01<br>
diff --git a/testcases/kernel/syscalls/fsconfig/.gitignore b/testcases/kernel/syscalls/fsconfig/.gitignore<br>
new file mode 100644<br>
index 000000000000..2bc54b82751b<br>
--- /dev/null<br>
+++ b/testcases/kernel/syscalls/fsconfig/.gitignore<br>
@@ -0,0 +1,2 @@<br>
+/fsconfig01<br>
+/fsconfig02<br>
diff --git a/testcases/kernel/syscalls/fsconfig/Makefile b/testcases/kernel/syscalls/fsconfig/Makefile<br>
new file mode 100644<br>
index 000000000000..5ea7d67db123<br>
--- /dev/null<br>
+++ b/testcases/kernel/syscalls/fsconfig/Makefile<br>
@@ -0,0 +1,6 @@<br>
+# SPDX-License-Identifier: GPL-2.0-or-later<br>
+<br>
+top_srcdir ?= ../../../..<br>
+<br>
+include $(top_srcdir)/include/mk/<a href="http://testcases.mk" rel="noreferrer" target="_blank">testcases.mk</a><br>
+include $(top_srcdir)/include/mk/<a href="http://generic_leaf_target.mk" rel="noreferrer" target="_blank">generic_leaf_target.mk</a><br>
diff --git a/testcases/kernel/syscalls/fsconfig/fsconfig01.c b/testcases/kernel/syscalls/fsconfig/fsconfig01.c<br>
new file mode 100644<br>
index 000000000000..96bf8eef8e4b<br>
--- /dev/null<br>
+++ b/testcases/kernel/syscalls/fsconfig/fsconfig01.c<br>
@@ -0,0 +1,110 @@<br>
+// SPDX-License-Identifier: GPL-2.0-or-later<br>
+/*<br>
+ * Copyright (c) 2020 Viresh Kumar <<a href="mailto:viresh.kumar@linaro.org" target="_blank">viresh.kumar@linaro.org</a>><br>
+ *<br>
+ * Description:<br>
+ * Basic fsconfig() test which tries to configure and mount the filesystem as<br>
+ * well.<br>
+ */<br>
+#include "tst_test.h"<br>
+#include "lapi/fsmount.h"<br>
+<br>
+#define MNTPOINT "mntpoint"<br>
+<br>
+static void setup(void)<br>
+{<br>
+ fsopen_supported_by_kernel();<br>
+}<br>
+<br>
+static void run(void)<br>
+{<br>
+ int fd, fsmfd;<br>
+<br>
+ TEST(fsopen(tst_device->fs_type, 0));<br>
+ fd = TST_RET;<br>
+<br>
+ if (fd == -1)<br>
+ tst_brk(TBROK | TERRNO, "fsopen() failed");<br>
+<br>
+ TEST(fsconfig(fd, FSCONFIG_SET_FLAG, "rw", NULL, 0));<br>
+ if (TST_RET == -1) {<br>
+ tst_res(TFAIL | TERRNO, "fsconfig() failed");<br>
+ goto out;<br>
+ }<br>
+<br>
+ TEST(fsconfig(fd, FSCONFIG_SET_STRING, "source", tst_device->dev, 0));<br>
+ if (TST_RET == -1) {<br>
+ tst_res(TFAIL | TERRNO, "fsconfig() failed");<br>
+ goto out;<br>
+ }<br>
+<br>
+ TEST(fsconfig(fd, FSCONFIG_SET_PATH, "foo", tst_device->dev, AT_FDCWD));<br>
+ if (TST_RET == -1) {<br>
+ if (TST_ERR == EOPNOTSUPP) {<br>
+ tst_res(TINFO, "fsconfig(): FSCONFIG_SET_PATH not supported");<br>
+ } else {<br>
+ tst_res(TFAIL | TERRNO, "fsconfig() failed");<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">The test reports an EINVAL error when testing fsconfig() with 'FSCONFIG_SET_PATH' on XFS. I'm now trying to look close to this issue.</div><div class="gmail_default" style="font-size:small"><br>kernel: 5.6.0-rc2+ x86_64<br></div><div class="gmail_default" style="font-size:small"><br></div>tst_test.c:1278: INFO: Testing on xfs<br>tst_mkfs.c:90: INFO: Formatting /dev/loop0 with xfs opts='' extra opts=''<br>tst_test.c:1217: INFO: Timeout per run is 0h 05m 00s<br>fsconfig01.c:46: FAIL: fsconfig() failed: EINVAL (22)<br><div class="gmail_default" style="font-size:small"></div></div></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>