xfstests: honor comments in the test group file
[xfstests-dev.git] / 098
1 #! /bin/bash
2 # FS QA Test No. 098. Modified from UDFQA test 035
3 #
4 # simple attr tests for EAs:
5 #  - set
6 #  - get
7 #  - list
8 #  - remove
9 # Basic testing.
10 # + udf_db checks.
11 # (033 + udf_db)
12 #
13 #-----------------------------------------------------------------------
14 # Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
15 #
16 # This program is free software; you can redistribute it and/or
17 # modify it under the terms of the GNU General Public License as
18 # published by the Free Software Foundation.
19 #
20 # This program is distributed in the hope that it would be useful,
21 # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23 # GNU General Public License for more details.
24 #
25 # You should have received a copy of the GNU General Public License
26 # along with this program; if not, write the Free Software Foundation,
27 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
28 #
29 #-----------------------------------------------------------------------
30 #
31 # creator
32 owner=ajones@sgi.com
33
34 seq=`basename $0`
35 echo "QA output created by $seq"
36
37 here=`pwd`
38 tmp=/tmp/$$
39 status=1        # failure is the default!
40 trap "_cleanup; exit \$status" 0 1 2 3 15
41
42 _cleanup()
43 {
44     rm -f $tmp.*
45 }
46
47 # get standard environment, filters and checks
48 . ./common.rc
49 . ./common.filter
50
51 _db_filter()
52 {
53     awk '
54         /<file_entry name=/ { fe_on=1 }
55         /<timestamp/  { ts_on=1; next }
56         /<\/timestamp/ { ts_on=0; next }
57         /<cksum/      { next }
58         /<desc_crc/   { next }
59         /<pos/        { next }
60         /<tag_loc/    { next }
61         /<lb_num/     { next }
62         fe_on == 1 && ts_on == 0 { print; next }
63                       { next }
64     '
65 }
66
67 _umount_check_mount()
68 {
69     cd /
70     umount $SCRATCH_MNT
71
72     udf_db -f $SCRATCH_DEV | _db_filter
73
74     _scratch_mount
75     cd $SCRATCH_MNT
76 }
77
78 # real QA test starts here
79 _supported_fs udf
80 _supported_os IRIX
81
82 _require_scratch
83 _setup_testdir
84
85 cd $SCRATCH_MNT
86
87 echo "create file foo"
88 echo "file_contents" >foo
89 cat foo
90
91 echo "should be no EAs for foo:"
92 attr -l foo
93
94 echo "set EA <noise,woof>:"
95 attr -s noise -V woof foo
96
97 echo "set EA <colour,blue>:"
98 attr -s colour -V blue foo
99
100 echo "set EA <size,small>:"
101 attr -s size -V small foo
102
103 echo "list the EAs for foo: noise, colour, size" 
104 attr -l foo
105
106 echo "check the list again for foo"
107 attr -l foo
108
109 echo "unmount the FS and see if EAs are persistent"
110 _umount_check_mount
111
112 echo "check the list again for foo after umount/mount"
113 attr -l foo
114
115 echo "get the value of the noise EA"
116 attr -g noise foo
117
118 echo "get the value of the colour EA which was removed earlier"
119 attr -g colour foo
120
121 echo "get the value of the size EA"
122 attr -g size foo
123
124 echo "remove the colour EA on foo"
125 attr -r colour foo
126
127 echo "list EAs for foo: noise, size"
128 attr -l foo
129
130 echo "get the value of the noise EA"
131 attr -g noise foo
132
133 echo "get the value of the colour EA which was removed earlier"
134 attr -g colour foo
135
136 echo "get the value of the size EA"
137 attr -g size foo
138
139 echo "list all the EAs again: noise, size"
140 attr -l foo
141
142 echo "change the value of the size EA from small to huge"
143 attr -s size -V huge foo
144
145 echo "get the size EA which should now have value huge"
146 attr -g size foo
147
148 echo "list EAs: noise, size"
149 attr -l foo
150
151 echo "remove the size EA from foo"
152 attr -r size foo
153
154 echo "list EAs: noise (size EA has been removed)"
155 attr -l foo
156
157 echo "get the noise EA: woof"
158 attr -g noise foo
159
160 echo "try removing non-existent EA named woof"
161 attr -r woof foo
162
163 echo "try removing already removed EA size"
164 attr -r size foo
165
166 echo "list EAs: noise"
167 attr -l foo
168
169 echo "try removing already removed EA colour"
170 attr -r colour foo
171
172 echo "list EAs: noise"
173 attr -l foo
174
175 echo "remove remaining EA noise"
176 attr -r noise foo
177
178 echo "list EAs: should be no EAs left now"
179 attr -l foo
180
181 echo "unmount the FS and see if EAs are persistent"
182 _umount_check_mount
183
184 echo "list EAs: should still be no EAs left"
185 attr -l foo
186
187 echo ""
188 echo "*** Test out the root namespace ***"
189 echo ""
190
191 echo "set EA <root:colour,marone>:"
192 attr -R -s colour -V marone foo
193
194 echo "set EA <user:colour,beige>:"
195 attr -s colour -V beige foo
196
197 echo "set EA <user:vomit,pizza>:"
198 attr -s vomit -V pizza foo
199
200 echo "set EA <root:noise,whack>:"
201 attr -R -s noise -V whack foo
202
203 echo "list root EAs: <root:colour,noise>:"
204 attr -R -l foo
205
206 echo "list user EAs: <user:colour,vomit>:"
207 attr -l foo
208
209 echo "get root EA colour: marone"
210 attr -R -g colour foo
211
212 echo "get root EA noise: whack"
213 attr -R -g noise foo
214
215 echo "get root EA vomit which is a user EA => find nothing"
216 attr -R -g vomit foo
217
218 echo ""
219 echo "unmount the FS and see if EAs are persistent"
220 echo ""
221 _umount_check_mount
222
223 echo "get root EA colour: marone"
224 attr -R -g colour foo
225
226 echo "get root EA noise: whack"
227 attr -R -g noise foo
228
229 echo "get user EA vomit: pizza" 
230 attr -g vomit foo
231
232 echo "remove the root colour EA"
233 attr -R -r colour foo
234
235 echo "list root EAs: <root:noise>:"
236 attr -R -l foo
237
238 echo "list user EAs: <user:colour,vomit>:"
239 attr -l foo
240
241 echo "remove the final root EA noise"
242 attr -R -r noise foo
243
244 echo "list root EAs: none"
245 attr -R -l foo
246
247 cd /
248 umount $SCRATCH_MNT
249
250 udf_db -f $SCRATCH_DEV | _db_filter
251
252 # Checks the udf filesystem
253 _check_udf_filesystem $SCRATCH_DEV
254
255 _scratch_mount
256 cd $SCRATCH_MNT
257
258 echo "delete the file foo - which will delete the associated streams"
259 rm foo
260
261 cd /
262 umount $SCRATCH_MNT
263
264 udf_db -f $SCRATCH_DEV | _db_filter
265
266 # Checks the udf filesystem
267 _check_udf_filesystem $SCRATCH_DEV
268
269 # optional stuff if your test has verbose output to help resolve problems
270 #echo
271 #echo "If failure, check $seq.full (this) and $seq.full.ok (reference)"
272
273 # success, all done
274 status=0
275 exit