xfstests 241: run longer
[xfstests-dev.git] / 097
1 #! /bin/bash
2 # FS QA Test No. 097. Modifed from UDFQA test 033.
3 #
4 # simple attr tests for EAs:
5 #  - set
6 #  - get
7 #  - list
8 #  - remove
9 # Basic testing.
10 #
11 #-----------------------------------------------------------------------
12 # Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
13 #
14 # This program is free software; you can redistribute it and/or
15 # modify it under the terms of the GNU General Public License as
16 # published by the Free Software Foundation.
17 #
18 # This program is distributed in the hope that it would be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 # GNU General Public License for more details.
22 #
23 # You should have received a copy of the GNU General Public License
24 # along with this program; if not, write the Free Software Foundation,
25 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
26 #
27 #-----------------------------------------------------------------------
28 #
29 # creator
30 owner=ajones@sgi.com
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 TARGET_DIR=
39 trap "_cleanup; exit \$status" 0 1 2 3 15
40
41 _cleanup()
42 {
43     rm -f $tmp.*
44     cd $TARGET_DIR
45     rm -f foo
46 }
47
48 _umount_and_mount()
49 {
50     cd /
51     umount $TARGET_DIR
52     if [ "$FSTYP" == "xfs" ]; then
53         _test_mount
54     else
55         _scratch_mount
56     fi
57     
58     cd $TARGET_DIR
59 }
60
61 # get standard environment, filters and checks
62 . ./common.rc
63 . ./common.filter
64
65 # link correct .out file
66 # This is done bacause udf and xfs print attrs in different orders.
67 rm -rf $seq.out
68 if [ "$FSTYP" == "xfs" ]; then
69     ln -s $seq.out.xfs $seq.out
70 else
71     ln -s $seq.out.udf $seq.out
72 fi
73
74 # real QA test starts here
75 _supported_fs generic
76 _supported_os IRIX
77
78 _require_scratch
79 _require_attrs
80
81 _setup_testdir 
82
83 TARGET_DIR=$SCRATCH_MNT
84 [ "$FSTYP" == "xfs" ] && TARGET_DIR=$TEST_DIR
85 cd $TARGET_DIR
86
87 echo "create file foo"
88 rm -f foo 
89 touch 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_and_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_and_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_and_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 _cleanup_testdir
249
250 # Check the filesystem
251 _check_scratch_fs
252
253 # optional stuff if your test has verbose output to help resolve problems
254 #echo
255 #echo "If failure, check $seq.full (this) and $seq.full.ok (reference)"
256
257 # success, all done
258 status=0
259 exit