]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: (libmount) add X-* and x-8 options strings tests
authorKarel Zak <kzak@redhat.com>
Thu, 3 Feb 2022 11:55:07 +0000 (12:55 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 3 Feb 2022 11:58:59 +0000 (12:58 +0100)
Addresses: https://github.com/util-linux/util-linux/issues/1583
Signed-off-by: Karel Zak <kzak@redhat.com>
tests/expected/libmount/optstr-apply-user-X [new file with mode: 0644]
tests/expected/libmount/optstr-apply-user-Xx [new file with mode: 0644]
tests/expected/libmount/optstr-apply-user-x [new file with mode: 0644]
tests/ts/libmount/optstr

diff --git a/tests/expected/libmount/optstr-apply-user-X b/tests/expected/libmount/optstr-apply-user-X
new file mode 100644 (file)
index 0000000..5cdc2c0
--- /dev/null
@@ -0,0 +1,2 @@
+flags:  0x00020000
+optstr: something,X-foo,X-bar
diff --git a/tests/expected/libmount/optstr-apply-user-Xx b/tests/expected/libmount/optstr-apply-user-Xx
new file mode 100644 (file)
index 0000000..d340ed7
--- /dev/null
@@ -0,0 +1,2 @@
+flags:  0x00022400
+optstr: something,x-gvfs-hide,x-gdu.hide,x-canary,X-foo,X-bar,nofail
diff --git a/tests/expected/libmount/optstr-apply-user-x b/tests/expected/libmount/optstr-apply-user-x
new file mode 100644 (file)
index 0000000..8f5d5fc
--- /dev/null
@@ -0,0 +1,2 @@
+flags:  0x00002000
+optstr: something,x-gvfs-hide,x-gdu.hide,x-canary
index 774fe5685e2629748b04d352b3ef21657a6b5afe..d15e6bd079065c70d4a0f2f78eb2a24febb74335 100755 (executable)
@@ -100,14 +100,39 @@ ts_init_subtest "flags"
 ts_run $TESTPROG --flags "aaa,bbb=BBB,x-foo,ccc,user=kzak,nodev,noexec,nosuid,loop=/dev/loop0" &> $TS_OUTPUT
 ts_finalize_subtest
 
-ts_init_subtest "apply-linux"  # add noatime and remove noexec and nosuid
+ts_init_subtest "apply-linux"
+# Use kernel mount options man (--linux), add noatime, remove noexec and nosuid,
+# and keep unknown(e.g. user=kzak)
 ts_run $TESTPROG --apply --linux "user=kzak,noexec,nosuid" 0x400 &> $TS_OUTPUT
 ts_finalize_subtest
 
-ts_init_subtest "apply-user"   # add user,nofail and remove loop
+ts_init_subtest "apply-user"
+# Use userspace options map (--user), add user and nofail, remove loop,
+# and keep unknown (e.g. noexec, nosuid)
 ts_run $TESTPROG --apply --user "noexec,nosuid,loop=/dev/looop0" 0x408 &> $TS_OUTPUT
 ts_finalize_subtest
 
+ts_init_subtest "apply-user-x"
+# Use userspace options map (--user), remove X-* and loop=, keep unknown 'something' and
+# keep by flags specified x-*
+ts_run $TESTPROG --apply --user \
+       "something,loop=/dev/looop0,x-gvfs-hide,x-gdu.hide,x-canary,X-foo" 0x00002000 &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "apply-user-X"
+# Use userspace options map (--user), remove x-* and loop=, keep unknown 'something' and
+# keep by flags specified X-*
+ts_run $TESTPROG --apply --user \
+       "something,loop=/dev/looop0,x-gvfs-hide,x-gdu.hide,x-canary,X-foo,X-bar" 0x00020000 &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "apply-user-Xx"
+# Use userspace options map (--user), remove loop=, keep unknown 'something' and
+# keep by flags specified X-* and x-*, add by flag specified nofail
+ts_run $TESTPROG --apply --user \
+       "something,loop=/dev/looop0,x-gvfs-hide,x-gdu.hide,x-canary,X-foo,X-bar" 0x00022400 &> $TS_OUTPUT
+ts_finalize_subtest
+
 ts_init_subtest "fix"
 ts_run $TESTPROG --fix "uid=root,gid=root" &> $TS_OUTPUT
 ts_finalize_subtest