xfstests: some refinements on "make depend"
[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 _require_attrs
84
85 _setup_testdir
86
87 cd $SCRATCH_MNT
88
89 echo "create file foo"
90 echo "file_contents" >foo
91 cat foo
92
93 echo "should be no EAs for foo:"
94 ${ATTR_PROG} -l foo
95
96 echo "set EA <noise,woof>:"
97 ${ATTR_PROG} -s noise -V woof foo
98
99 echo "set EA <colour,blue>:"
100 ${ATTR_PROG} -s colour -V blue foo
101
102 echo "set EA <size,small>:"
103 ${ATTR_PROG} -s size -V small foo
104
105 echo "list the EAs for foo: noise, colour, size" 
106 ${ATTR_PROG} -l foo
107
108 echo "check the list again for foo"
109 ${ATTR_PROG} -l foo
110
111 echo "unmount the FS and see if EAs are persistent"
112 _umount_check_mount
113
114 echo "check the list again for foo after umount/mount"
115 ${ATTR_PROG} -l foo
116
117 echo "get the value of the noise EA"
118 ${ATTR_PROG} -g noise foo
119
120 echo "get the value of the colour EA which was removed earlier"
121 ${ATTR_PROG} -g colour foo
122
123 echo "get the value of the size EA"
124 ${ATTR_PROG} -g size foo
125
126 echo "remove the colour EA on foo"
127 ${ATTR_PROG} -r colour foo
128
129 echo "list EAs for foo: noise, size"
130 ${ATTR_PROG} -l foo
131
132 echo "get the value of the noise EA"
133 ${ATTR_PROG} -g noise foo
134
135 echo "get the value of the colour EA which was removed earlier"
136 ${ATTR_PROG} -g colour foo
137
138 echo "get the value of the size EA"
139 ${ATTR_PROG} -g size foo
140
141 echo "list all the EAs again: noise, size"
142 ${ATTR_PROG} -l foo
143
144 echo "change the value of the size EA from small to huge"
145 ${ATTR_PROG} -s size -V huge foo
146
147 echo "get the size EA which should now have value huge"
148 ${ATTR_PROG} -g size foo
149
150 echo "list EAs: noise, size"
151 ${ATTR_PROG} -l foo
152
153 echo "remove the size EA from foo"
154 ${ATTR_PROG} -r size foo
155
156 echo "list EAs: noise (size EA has been removed)"
157 ${ATTR_PROG} -l foo
158
159 echo "get the noise EA: woof"
160 ${ATTR_PROG} -g noise foo
161
162 echo "try removing non-existent EA named woof"
163 ${ATTR_PROG} -r woof foo
164
165 echo "try removing already removed EA size"
166 ${ATTR_PROG} -r size foo
167
168 echo "list EAs: noise"
169 ${ATTR_PROG} -l foo
170
171 echo "try removing already removed EA colour"
172 ${ATTR_PROG} -r colour foo
173
174 echo "list EAs: noise"
175 ${ATTR_PROG} -l foo
176
177 echo "remove remaining EA noise"
178 ${ATTR_PROG} -r noise foo
179
180 echo "list EAs: should be no EAs left now"
181 ${ATTR_PROG} -l foo
182
183 echo "unmount the FS and see if EAs are persistent"
184 _umount_check_mount
185
186 echo "list EAs: should still be no EAs left"
187 ${ATTR_PROG} -l foo
188
189 echo ""
190 echo "*** Test out the root namespace ***"
191 echo ""
192
193 echo "set EA <root:colour,marone>:"
194 ${ATTR_PROG} -R -s colour -V marone foo
195
196 echo "set EA <user:colour,beige>:"
197 ${ATTR_PROG} -s colour -V beige foo
198
199 echo "set EA <user:vomit,pizza>:"
200 ${ATTR_PROG} -s vomit -V pizza foo
201
202 echo "set EA <root:noise,whack>:"
203 ${ATTR_PROG} -R -s noise -V whack foo
204
205 echo "list root EAs: <root:colour,noise>:"
206 ${ATTR_PROG} -R -l foo
207
208 echo "list user EAs: <user:colour,vomit>:"
209 ${ATTR_PROG} -l foo
210
211 echo "get root EA colour: marone"
212 ${ATTR_PROG} -R -g colour foo
213
214 echo "get root EA noise: whack"
215 ${ATTR_PROG} -R -g noise foo
216
217 echo "get root EA vomit which is a user EA => find nothing"
218 ${ATTR_PROG} -R -g vomit foo
219
220 echo ""
221 echo "unmount the FS and see if EAs are persistent"
222 echo ""
223 _umount_check_mount
224
225 echo "get root EA colour: marone"
226 ${ATTR_PROG} -R -g colour foo
227
228 echo "get root EA noise: whack"
229 ${ATTR_PROG} -R -g noise foo
230
231 echo "get user EA vomit: pizza" 
232 ${ATTR_PROG} -g vomit foo
233
234 echo "remove the root colour EA"
235 ${ATTR_PROG} -R -r colour foo
236
237 echo "list root EAs: <root:noise>:"
238 ${ATTR_PROG} -R -l foo
239
240 echo "list user EAs: <user:colour,vomit>:"
241 ${ATTR_PROG} -l foo
242
243 echo "remove the final root EA noise"
244 ${ATTR_PROG} -R -r noise foo
245
246 echo "list root EAs: none"
247 ${ATTR_PROG} -R -l foo
248
249 cd /
250 umount $SCRATCH_MNT
251
252 udf_db -f $SCRATCH_DEV | _db_filter
253
254 # Checks the udf filesystem
255 _check_udf_filesystem $SCRATCH_DEV
256
257 _scratch_mount
258 cd $SCRATCH_MNT
259
260 echo "delete the file foo - which will delete the associated streams"
261 rm foo
262
263 cd /
264 umount $SCRATCH_MNT
265
266 udf_db -f $SCRATCH_DEV | _db_filter
267
268 # Checks the udf filesystem
269 _check_udf_filesystem $SCRATCH_DEV
270
271 # optional stuff if your test has verbose output to help resolve problems
272 #echo
273 #echo "If failure, check $seq.full (this) and $seq.full.ok (reference)"
274
275 # success, all done
276 status=0
277 exit