2 # FS QA Test No. 097. Modifed from UDFQA test 033.
4 # simple attr tests for EAs:
11 #-----------------------------------------------------------------------
12 # Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved.
13 # Copyright (c) 2017 Google, Inc. All Rights Reserved.
15 # This program is free software; you can redistribute it and/or
16 # modify it under the terms of the GNU General Public License as
17 # published by the Free Software Foundation.
19 # This program is distributed in the hope that it would be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU General Public License for more details.
24 # You should have received a copy of the GNU General Public License
25 # along with this program; if not, write the Free Software Foundation,
26 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 #-----------------------------------------------------------------------
32 seqres=$RESULT_DIR/$seq
33 echo "QA output created by $seq"
37 status=1 # failure is the default!
38 trap "_cleanup; exit \$status" 0 1 2 3 15
49 $GETFATTR_PROG --absolute-names "$@" |& _filter_test_dir
54 $SETFATTR_PROG "$@" |& _filter_test_dir
57 # get standard environment, filters and checks
62 # real QA test starts here
69 echo -e "\ncreate file foo"
73 echo -e "\nshould be no EAs for foo:"
76 echo -e "\nset EA <noise,woof>:"
77 setfattr -n user.noise -v woof $file
79 echo -e "\nset EA <colour,blue>:"
80 setfattr -n user.colour -v blue $file
82 echo -e "\nset EA <size,small>:"
83 setfattr -n user.size -v small $file
85 echo -e "\nlist the EAs for foo: noise, colour, size"
88 echo -e "\ncheck the list again for foo"
91 echo -e "\nunmount the FS and see if EAs are persistent"
94 echo -e "\ncheck the list again for foo after umount/mount"
97 echo -e "\nremove the colour EA on foo"
98 setfattr -x user.colour $file
100 echo -e "\nlist EAs for foo: noise, size"
103 echo -e "\nget the value of the noise EA"
104 getfattr -n user.noise $file
106 echo -e "\nget the value of the colour EA which was removed earlier"
107 getfattr -n user.colour $file
109 echo -e "\nget the value of the size EA"
110 getfattr -n user.size $file
112 echo -e "\nlist all the EAs again: noise, size"
115 echo -e "\nchange the value of the size EA from small to huge"
116 setfattr -n user.size -v huge $file
118 echo -e "\nget the size EA which should now have value huge"
119 getfattr -n user.size $file
121 echo -e "\nlist EAs: noise, size"
124 echo -e "\nremove the size EA from foo"
125 setfattr -x user.size $file
127 echo -e "\nlist EAs: noise (size EA has been removed)"
130 echo -e "\ntry removing non-existent EA named woof"
131 setfattr -x user.woof $file
133 echo -e "\ntry removing already removed EA size"
134 setfattr -x user.size $file
136 echo -e "\nlist EAs: noise"
139 echo -e "\ntry removing already removed EA colour"
140 setfattr -x user.colour $file
142 echo -e "\nlist EAs: noise"
145 echo -e "\nremove remaining EA noise"
146 setfattr -x user.noise $file
148 echo -e "\nlist EAs: should be no EAs left now"
151 echo -e "\nunmount the FS and see if EAs are persistent"
154 echo -e "\nlist EAs: should still be no EAs left"
157 echo -e "\n*** Test out the trusted namespace ***"
159 echo -e "\nset EA <trusted:colour,marone>:"
160 setfattr -n trusted.colour -v marone $file
162 echo -e "\nset EA <user:colour,beige>:"
163 setfattr -n user.colour -v beige $file
165 echo -e "\nset EA <user:vomit,pizza>:"
166 setfattr -n user.vomit -v pizza $file
168 echo -e "\nset EA <trusted:noise,whack>:"
169 setfattr -n trusted.noise -v whack $file
171 echo -e "\nlist trusted EAs: <trusted:colour,noise>:"
172 getfattr -d -m '^trusted\.' $file
174 echo -e "\nlist user EAs: <user:colour,vomit>:"
177 echo -e "\nget trusted EA colour: marone"
178 getfattr -n trusted.colour $file
180 echo -e "\nget trusted EA noise: whack"
181 getfattr -n trusted.noise $file
183 echo -e "\nget trusted EA vomit which is a user EA => find nothing"
184 getfattr -n trusted.vomit $file
186 echo -e "\nunmount the FS and see if EAs are persistent"
189 echo -e "\nget trusted EA colour: marone"
190 getfattr -n trusted.colour $file
192 echo -e "\nget trusted EA noise: whack"
193 getfattr -n trusted.noise $file
195 echo -e "\nget user EA vomit: pizza"
196 getfattr -n user.vomit $file
198 echo -e "\nremove the trusted colour EA"
199 setfattr -x trusted.colour $file
201 echo -e "\nlist trusted EAs: <trusted:noise>:"
202 getfattr -d -m '^trusted\.' $file
204 echo -e "\nlist user EAs: <user:colour,vomit>:"
207 echo -e "\nremove the final trusted EA noise"
208 setfattr -x trusted.noise $file
210 echo -e "\nlist trusted EAs: none"
211 getfattr -d -m '^trusted\.' $file