summaryrefslogtreecommitdiffstats
path: root/tests/ts/libmount/optstr
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 14:30:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 14:30:35 +0000
commit378c18e5f024ac5a8aef4cb40d7c9aa9633d144c (patch)
tree44dfb6ca500d32cabd450649b322a42e70a30683 /tests/ts/libmount/optstr
parentInitial commit. (diff)
downloadutil-linux-upstream.tar.xz
util-linux-upstream.zip
Adding upstream version 2.38.1.upstream/2.38.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ts/libmount/optstr')
-rwxr-xr-xtests/ts/libmount/optstr148
1 files changed, 148 insertions, 0 deletions
diff --git a/tests/ts/libmount/optstr b/tests/ts/libmount/optstr
new file mode 100755
index 0000000..03a1635
--- /dev/null
+++ b/tests/ts/libmount/optstr
@@ -0,0 +1,148 @@
+#!/bin/bash
+
+# Copyright (C) 2010 Karel Zak <kzak@redhat.com>
+
+TS_TOPDIR="${0%/*}/../.."
+TS_DESC="options string"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+TESTPROG="$TS_HELPER_LIBMOUNT_OPTSTR"
+
+[ -x $TESTPROG ] || ts_skip "test not compiled"
+
+ts_init_subtest "append"
+ts_run $TESTPROG --append "aaa,bbb=BBB,context=\"foo,bar,gogo\",ccc" "ddd" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "append-value"
+ts_run $TESTPROG --append "aaa,bbb=BBB,ccc" "ddd" "DDD" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "append-empty-value"
+ts_run $TESTPROG --append "aaa,bbb=BBB,ccc" "ddd" "" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "prepend"
+ts_run $TESTPROG --prepend "aaa,bbb=BBB,ccc" "ddd" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "prepend-value"
+ts_run $TESTPROG --prepend "aaa,bbb=BBB,ccc" "ddd" "DDD" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "prepend-empty-value"
+ts_run $TESTPROG --prepend "aaa,bbb=BBB,ccc" "ddd" "" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "set-remove"
+ts_run $TESTPROG --set "aaa,bbb=BBB,ccc" "bbb" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "set-small"
+ts_run $TESTPROG --set "aaa,bbb=BBB,ccc" "bbb" "X" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "set-large"
+ts_run $TESTPROG --set "aaa,bbb=BBB,ccc" "bbb" "XXX-YYY-ZZZ" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "set-empty"
+ts_run $TESTPROG --set "aaa,bbb=BBB,ccc" "bbb" "" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "set-new"
+ts_run $TESTPROG --set "aaa,bbb=BBB,ccc" "aaa" "XXX" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "set-new-empty"
+ts_run $TESTPROG --set "aaa,bbb=BBB,ccc" "aaa" "" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "set-new-end"
+ts_run $TESTPROG --set "aaa,bbb=BBB,ccc" "ccc" "XXX" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "set-new-end-empty"
+ts_run $TESTPROG --set "aaa,bbb=BBB,ccc" "ccc" "" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "get"
+ts_run $TESTPROG --get "aaa,bbb=BBB,ccc" "aaa" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "get-value"
+ts_run $TESTPROG --get "aaa,bbb=BBB,ccc" "bbb" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "remove"
+ts_run $TESTPROG --remove "aaa,bbb=BBB,ccc" "aaa" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "remove-quoted"
+ts_run $TESTPROG --remove "aaa,context=\"foo,bar,gogo\",bbb=BBB,ccc" "context" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "remove-value"
+ts_run $TESTPROG --remove "aaa,bbb=BBB,ccc" "bbb" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "remove-empty-value"
+ts_run $TESTPROG --remove "aaa,bbb=,ccc" "bbb" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "split"
+ts_run $TESTPROG --split "aaa,bbb=BBB,ccc,x-bar,x-foo=foodata,user=kzak,noexec,nosuid,loop=/dev/loop0" &> $TS_OUTPUT
+ts_finalize_subtest
+
+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"
+# 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"
+# 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-small-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-large-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
+
+ts_init_subtest "deduplicate"
+ts_run $TESTPROG --dedup bbb,ccc,AAA,xxx,AAA=a,AAA=bbb,ddd,AAA=ccc,fff=eee AAA &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "deduplicate-empty"
+ts_run $TESTPROG --dedup bbb,ccc,AAA,xxx,AAA=a,AAA=bbb,ddd,AAA=,fff=eee AAA &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_finalize