Stop creating shit files.
[xfstests-dev.git] / 098
1 #! /bin/sh
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 #
17 # creator
18 owner=ajones@sgi.com
19
20 seq=`basename $0`
21 echo "QA output created by $seq"
22
23 here=`pwd`
24 tmp=/tmp/$$
25 status=1        # failure is the default!
26 trap "_cleanup; exit \$status" 0 1 2 3 15
27
28 _cleanup()
29 {
30     rm -f $tmp.*
31 }
32
33 # get standard environment, filters and checks
34 . ./common.rc
35 . ./common.filter
36
37 _db_filter()
38 {
39     awk '
40         /<file_entry name=/ { fe_on=1 }
41         /<timestamp/  { ts_on=1; next }
42         /<\/timestamp/ { ts_on=0; next }
43         /<cksum/      { next }
44         /<desc_crc/   { next }
45         /<pos/        { next }
46         /<tag_loc/    { next }
47         /<lb_num/     { next }
48         fe_on == 1 && ts_on == 0 { print; next }
49                       { next }
50     '
51 }
52
53 _umount_check_mount()
54 {
55     cd /
56     umount $SCRATCH_MNT
57
58     udf_db -f $SCRATCH_DEV | _db_filter
59
60     _scratch_mount
61     cd $SCRATCH_MNT
62 }
63
64 # real QA test starts here
65 _supported_fs udf
66 _supported_os IRIX
67
68 _require_scratch
69 _setup_testdir
70
71 cd $SCRATCH_MNT
72
73 echo "create file foo"
74 echo "file_contents" >foo
75 cat foo
76
77 echo "should be no EAs for foo:"
78 attr -l foo
79
80 echo "set EA <noise,woof>:"
81 attr -s noise -V woof foo
82
83 echo "set EA <colour,blue>:"
84 attr -s colour -V blue foo
85
86 echo "set EA <size,small>:"
87 attr -s size -V small foo
88
89 echo "list the EAs for foo: noise, colour, size" 
90 attr -l foo
91
92 echo "check the list again for foo"
93 attr -l foo
94
95 echo "unmount the FS and see if EAs are persistent"
96 _umount_check_mount
97
98 echo "check the list again for foo after umount/mount"
99 attr -l foo
100
101 echo "get the value of the noise EA"
102 attr -g noise foo
103
104 echo "get the value of the colour EA which was removed earlier"
105 attr -g colour foo
106
107 echo "get the value of the size EA"
108 attr -g size foo
109
110 echo "remove the colour EA on foo"
111 attr -r colour foo
112
113 echo "list EAs for foo: noise, size"
114 attr -l foo
115
116 echo "get the value of the noise EA"
117 attr -g noise foo
118
119 echo "get the value of the colour EA which was removed earlier"
120 attr -g colour foo
121
122 echo "get the value of the size EA"
123 attr -g size foo
124
125 echo "list all the EAs again: noise, size"
126 attr -l foo
127
128 echo "change the value of the size EA from small to huge"
129 attr -s size -V huge foo
130
131 echo "get the size EA which should now have value huge"
132 attr -g size foo
133
134 echo "list EAs: noise, size"
135 attr -l foo
136
137 echo "remove the size EA from foo"
138 attr -r size foo
139
140 echo "list EAs: noise (size EA has been removed)"
141 attr -l foo
142
143 echo "get the noise EA: woof"
144 attr -g noise foo
145
146 echo "try removing non-existent EA named woof"
147 attr -r woof foo
148
149 echo "try removing already removed EA size"
150 attr -r size foo
151
152 echo "list EAs: noise"
153 attr -l foo
154
155 echo "try removing already removed EA colour"
156 attr -r colour foo
157
158 echo "list EAs: noise"
159 attr -l foo
160
161 echo "remove remaining EA noise"
162 attr -r noise foo
163
164 echo "list EAs: should be no EAs left now"
165 attr -l foo
166
167 echo "unmount the FS and see if EAs are persistent"
168 _umount_check_mount
169
170 echo "list EAs: should still be no EAs left"
171 attr -l foo
172
173 echo ""
174 echo "*** Test out the root namespace ***"
175 echo ""
176
177 echo "set EA <root:colour,marone>:"
178 attr -R -s colour -V marone foo
179
180 echo "set EA <user:colour,beige>:"
181 attr -s colour -V beige foo
182
183 echo "set EA <user:vomit,pizza>:"
184 attr -s vomit -V pizza foo
185
186 echo "set EA <root:noise,whack>:"
187 attr -R -s noise -V whack foo
188
189 echo "list root EAs: <root:colour,noise>:"
190 attr -R -l foo
191
192 echo "list user EAs: <user:colour,vomit>:"
193 attr -l foo
194
195 echo "get root EA colour: marone"
196 attr -R -g colour foo
197
198 echo "get root EA noise: whack"
199 attr -R -g noise foo
200
201 echo "get root EA vomit which is a user EA => find nothing"
202 attr -R -g vomit foo
203
204 echo ""
205 echo "unmount the FS and see if EAs are persistent"
206 echo ""
207 _umount_check_mount
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 user EA vomit: pizza" 
216 attr -g vomit foo
217
218 echo "remove the root colour EA"
219 attr -R -r colour foo
220
221 echo "list root EAs: <root:noise>:"
222 attr -R -l foo
223
224 echo "list user EAs: <user:colour,vomit>:"
225 attr -l foo
226
227 echo "remove the final root EA noise"
228 attr -R -r noise foo
229
230 echo "list root EAs: none"
231 attr -R -l foo
232
233 cd /
234 umount $SCRATCH_MNT
235
236 udf_db -f $SCRATCH_DEV | _db_filter
237
238 # Checks the udf filesystem
239 _check_udf_filesystem $SCRATCH_DEV
240
241 _scratch_mount
242 cd $SCRATCH_MNT
243
244 echo "delete the file foo - which will delete the associated streams"
245 rm 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 # optional stuff if your test has verbose output to help resolve problems
256 #echo
257 #echo "If failure, check $seq.full (this) and $seq.full.ok (reference)"
258
259 # success, all done
260 status=0
261 exit