<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">This patch updates the fsmount01.c file to make it look similar to all<br>
other fsmount related syscall tests and here is the list of all changes:<br>
<br>
- Test all fsmount flags and mount attributes<br>
- Remove extra PASS messages as all we want to test here is fsmount()<br>
and not other syscalls.<br>
- On the same lines, print TFAIL for fsmount() syscall and TBROK for<br>
other calls.<br>
- close sfd on failures<br>
- Make the file look similar to other fsmount related tests<br>
- General cleanup<br>
<br>
Signed-off-by: Viresh Kumar <<a href="mailto:viresh.kumar@linaro.org" target="_blank">viresh.kumar@linaro.org</a>><br>
---<br>
testcases/kernel/syscalls/fsmount/fsmount01.c | 92 ++++++++++++-------<br>
1 file changed, 60 insertions(+), 32 deletions(-)<br>
<br>
diff --git a/testcases/kernel/syscalls/fsmount/fsmount01.c b/testcases/kernel/syscalls/fsmount/fsmount01.c<br>
index c3cf8106f63b..b746a14ba472 100644<br>
--- a/testcases/kernel/syscalls/fsmount/fsmount01.c<br>
+++ b/testcases/kernel/syscalls/fsmount/fsmount01.c<br>
@@ -3,67 +3,95 @@<br>
* Copyright (C) 2020 Red Hat, Inc. All rights reserved.<br>
* Author: Zorro Lang <<a href="mailto:zlang@redhat.com" target="_blank">zlang@redhat.com</a>><br>
*<br>
- * Use new mount API from v5.2 (fsopen(), fsconfig(), fsmount(), move_mount())<br>
- * to mount a filesystem without any specified mount options.<br>
+ * Description:<br>
+ * Basic fsmount() test.<br>
*/<br>
<br>
-#include <sys/mount.h><br>
-<br>
#include "tst_test.h"<br>
#include "lapi/fsmount.h"<br>
<br>
-#define MNTPOINT "newmount_point"<br>
-static int sfd, mfd, is_mounted;<br>
+#define MNTPOINT "mntpoint"<br>
+<br>
+static struct tcase {<br>
+ char *name;<br>
+ unsigned int flags;<br>
+ unsigned int mount_attrs;<br>
+} tcases[] = {<br>
+ {"Flag 0, attr RDONLY", 0, MOUNT_ATTR_RDONLY},<br>
+ {"Flag 0, attr NOSUID", 0, MOUNT_ATTR_NOSUID},<br>
+ {"Flag 0, attr NODEV", 0, MOUNT_ATTR_NODEV},<br>
+ {"Flag 0, attr NOEXEC", 0, MOUNT_ATTR_NOEXEC},<br>
+ {"Flag 0, attr RELATIME", 0, MOUNT_ATTR_RELATIME},<br>
+ {"Flag 0, attr NOATIME", 0, MOUNT_ATTR_NOATIME},<br>
+ {"Flag 0, attr STRICTATIME", 0, MOUNT_ATTR_STRICTATIME},<br>
+ {"Flag 0, attr NODIRATIME", 0, MOUNT_ATTR_NODIRATIME},<br>
+ {"Flag CLOEXEC, attr RDONLY", FSMOUNT_CLOEXEC, MOUNT_ATTR_RDONLY},<br>
+ {"Flag CLOEXEC, attr NOSUID", FSMOUNT_CLOEXEC, MOUNT_ATTR_NOSUID},<br>
+ {"Flag CLOEXEC, attr NODEV", FSMOUNT_CLOEXEC, MOUNT_ATTR_NODEV},<br>
+ {"Flag CLOEXEC, attr NOEXEC", FSMOUNT_CLOEXEC, MOUNT_ATTR_NOEXEC},<br>
+ {"Flag CLOEXEC, attr RELATIME", FSMOUNT_CLOEXEC, MOUNT_ATTR_RELATIME},<br>
+ {"Flag CLOEXEC, attr NOATIME", FSMOUNT_CLOEXEC, MOUNT_ATTR_NOATIME},<br>
+ {"Flag CLOEXEC, attr STRICTATIME", FSMOUNT_CLOEXEC, MOUNT_ATTR_STRICTATIME},<br>
+ {"Flag CLOEXEC, attr NODIRATIME", FSMOUNT_CLOEXEC, MOUNT_ATTR_NODIRATIME},<br>
+};<br></blockquote><div><br></div><div class="gmail_default" style="font-size:small">Again, if you move the 'Flag & attr' to print info, this patch looks pretty good to me.</div><div class="gmail_default" style="font-size:small"></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+ if (!tst_ismount(MNTPOINT))<br>
+ tst_res(TPASS, "%s: fsmount() passed", tc->name);<br></blockquote><div> </div><div><div class="gmail_default" style="font-size:small">What about:</div></div><div><span class="gmail_default" style="font-size:small"> tst_res(TPASS, "'Flag & mount_attr: %s': fsmount() passed", tc->name);</span></div></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>