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