From: Karel Zak Date: Thu, 3 Feb 2022 11:55:07 +0000 (+0100) Subject: tests: (libmount) add X-* and x-8 options strings tests X-Git-Tag: v2.38-rc2~51 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=27a9b47c0bf595331b26c8ffa2a56b5068c44000;p=thirdparty%2Futil-linux.git tests: (libmount) add X-* and x-8 options strings tests Addresses: https://github.com/util-linux/util-linux/issues/1583 Signed-off-by: Karel Zak --- diff --git a/tests/expected/libmount/optstr-apply-user-X b/tests/expected/libmount/optstr-apply-user-X new file mode 100644 index 0000000000..5cdc2c02cc --- /dev/null +++ b/tests/expected/libmount/optstr-apply-user-X @@ -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 index 0000000000..d340ed7df7 --- /dev/null +++ b/tests/expected/libmount/optstr-apply-user-Xx @@ -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 index 0000000000..8f5d5fc7c0 --- /dev/null +++ b/tests/expected/libmount/optstr-apply-user-x @@ -0,0 +1,2 @@ +flags: 0x00002000 +optstr: something,x-gvfs-hide,x-gdu.hide,x-canary diff --git a/tests/ts/libmount/optstr b/tests/ts/libmount/optstr index 774fe5685e..d15e6bd079 100755 --- a/tests/ts/libmount/optstr +++ b/tests/ts/libmount/optstr @@ -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