summaryrefslogtreecommitdiffstats
path: root/tests/ts/libmount/optstr
blob: 979517e06090eddbadff5713cb1b9bae22a6f01d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#!/bin/bash

# Copyright (C) 2010 Karel Zak <kzak@redhat.com>

TS_TOPDIR="${0%/*}/../.."
TS_DESC="options string"

. "$TS_TOPDIR"/functions.sh
ts_init "$*"

ts_check_test_command $TS_HELPER_LIBMOUNT_OPTSTR

TESTPROG="$TS_HELPER_LIBMOUNT_OPTSTR"

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-list"
ts_run $TESTPROG --prepend "aaa,bbb=BBB,ccc" "ddd,eee=EEE,fff" &> $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 "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_init_subtest "match"
ts_run $TESTPROG --match "xxx,yyy,zzz" "nozzz"		&>> $TS_OUTPUT
ts_run $TESTPROG --match "xxx,yyy,zzz" "xxx,noeee"	&>> $TS_OUTPUT
ts_run $TESTPROG --match "bar,zzz"     "nofoo"		&>> $TS_OUTPUT
ts_run $TESTPROG --match "nofoo,bar"   "nofoo"		&>> $TS_OUTPUT
ts_run $TESTPROG --match "nofoo,bar"   "+nofoo"		&>> $TS_OUTPUT
ts_run $TESTPROG --match "bar,zzz"     "+nofoo"		&>> $TS_OUTPUT
ts_run $TESTPROG --match "bar,zzz"     ""		&>> $TS_OUTPUT
ts_run $TESTPROG --match "bar,zzz"     "+"		&>> $TS_OUTPUT
ts_run $TESTPROG --match ""            ""		&>> $TS_OUTPUT
ts_run $TESTPROG --match ""            "foo"		&>> $TS_OUTPUT
ts_run $TESTPROG --match ""            "nofoo"		&>> $TS_OUTPUT
ts_run $TESTPROG --match ""            "no,foo"		&>> $TS_OUTPUT
ts_run $TESTPROG --match "no"          "+no"		&>> $TS_OUTPUT
ts_finalize_subtest

ts_finalize