xfstests: move xfs specific tests out of top directory
[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
32 seq=`basename $0`
33 echo "QA output created by $seq"
34
35 here=`pwd`
36 tmp=/tmp/$$
37 status=1        # failure is the default!
38 trap "_cleanup; exit \$status" 0 1 2 3 15
39
40 _cleanup()
41 {
42     rm -f $tmp.*
43 }
44
45 # get standard environment, filters and checks
46 . ./common.rc
47 . ./common.filter
48
49 _db_filter()
50 {
51     awk '
52         /<file_entry name=/ { fe_on=1 }
53         /<timestamp/  { ts_on=1; next }
54         /<\/timestamp/ { ts_on=0; next }
55         /<cksum/      { next }
56         /<desc_crc/   { next }
57         /<pos/        { next }
58         /<tag_loc/    { next }
59         /<lb_num/     { next }
60         fe_on == 1 && ts_on == 0 { print; next }
61                       { next }
62     '
63 }
64
65 _umount_check_mount()
66 {
67     cd /
68     umount $SCRATCH_MNT
69
70     udf_db -f $SCRATCH_DEV | _db_filter
71
72     _scratch_mount
73     cd $SCRATCH_MNT
74 }
75
76 # real QA test starts here
77 _supported_fs udf
78 _supported_os IRIX
79
80 _require_scratch
81 _require_attrs
82
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_PROG} -l foo
93
94 echo "set EA <noise,woof>:"
95 ${ATTR_PROG} -s noise -V woof foo
96
97 echo "set EA <colour,blue>:"
98 ${ATTR_PROG} -s colour -V blue foo
99
100 echo "set EA <size,small>:"
101 ${ATTR_PROG} -s size -V small foo
102
103 echo "list the EAs for foo: noise, colour, size" 
104 ${ATTR_PROG} -l foo
105
106 echo "check the list again for foo"
107 ${ATTR_PROG} -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_PROG} -l foo
114
115 echo "get the value of the noise EA"
116 ${ATTR_PROG} -g noise foo
117
118 echo "get the value of the colour EA which was removed earlier"
119 ${ATTR_PROG} -g colour foo
120
121 echo "get the value of the size EA"
122 ${ATTR_PROG} -g size foo
123
124 echo "remove the colour EA on foo"
125 ${ATTR_PROG} -r colour foo
126
127 echo "list EAs for foo: noise, size"
128 ${ATTR_PROG} -l foo
129
130 echo "get the value of the noise EA"
131 ${ATTR_PROG} -g noise foo
132
133 echo "get the value of the colour EA which was removed earlier"
134 ${ATTR_PROG} -g colour foo
135
136 echo "get the value of the size EA"
137 ${ATTR_PROG} -g size foo
138
139 echo "list all the EAs again: noise, size"
140 ${ATTR_PROG} -l foo
141
142 echo "change the value of the size EA from small to huge"
143 ${ATTR_PROG} -s size -V huge foo
144
145 echo "get the size EA which should now have value huge"
146 ${ATTR_PROG} -g size foo
147
148 echo "list EAs: noise, size"
149 ${ATTR_PROG} -l foo
150
151 echo "remove the size EA from foo"
152 ${ATTR_PROG} -r size foo
153
154 echo "list EAs: noise (size EA has been removed)"
155 ${ATTR_PROG} -l foo
156
157 echo "get the noise EA: woof"
158 ${ATTR_PROG} -g noise foo
159
160 echo "try removing non-existent EA named woof"
161 ${ATTR_PROG} -r woof foo
162
163 echo "try removing already removed EA size"
164 ${ATTR_PROG} -r size foo
165
166 echo "list EAs: noise"
167 ${ATTR_PROG} -l foo
168
169 echo "try removing already removed EA colour"
170 ${ATTR_PROG} -r colour foo
171
172 echo "list EAs: noise"
173 ${ATTR_PROG} -l foo
174
175 echo "remove remaining EA noise"
176 ${ATTR_PROG} -r noise foo
177
178 echo "list EAs: should be no EAs left now"
179 ${ATTR_PROG} -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_PROG} -l foo
186
187 echo ""
188 echo "*** Test out the root namespace ***"
189 echo ""
190
191 echo "set EA <root:colour,marone>:"
192 ${ATTR_PROG} -R -s colour -V marone foo
193
194 echo "set EA <user:colour,beige>:"
195 ${ATTR_PROG} -s colour -V beige foo
196
197 echo "set EA <user:vomit,pizza>:"
198 ${ATTR_PROG} -s vomit -V pizza foo
199
200 echo "set EA <root:noise,whack>:"
201 ${ATTR_PROG} -R -s noise -V whack foo
202
203 echo "list root EAs: <root:colour,noise>:"
204 ${ATTR_PROG} -R -l foo
205
206 echo "list user EAs: <user:colour,vomit>:"
207 ${ATTR_PROG} -l foo
208
209 echo "get root EA colour: marone"
210 ${ATTR_PROG} -R -g colour foo
211
212 echo "get root EA noise: whack"
213 ${ATTR_PROG} -R -g noise foo
214
215 echo "get root EA vomit which is a user EA => find nothing"
216 ${ATTR_PROG} -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_PROG} -R -g colour foo
225
226 echo "get root EA noise: whack"
227 ${ATTR_PROG} -R -g noise foo
228
229 echo "get user EA vomit: pizza" 
230 ${ATTR_PROG} -g vomit foo
231
232 echo "remove the root colour EA"
233 ${ATTR_PROG} -R -r colour foo
234
235 echo "list root EAs: <root:noise>:"
236 ${ATTR_PROG} -R -l foo
237
238 echo "list user EAs: <user:colour,vomit>:"
239 ${ATTR_PROG} -l foo
240
241 echo "remove the final root EA noise"
242 ${ATTR_PROG} -R -r noise foo
243
244 echo "list root EAs: none"
245 ${ATTR_PROG} -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