3 #-----------------------------------------------------------------------
4 # Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License as
8 # published by the Free Software Foundation.
10 # This program is distributed in the hope that it would be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write the Free Software Foundation,
17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 #-----------------------------------------------------------------------
29 echo "QA output created by $seq"
33 status=0 # success is the default!
34 trap "_cleanup; rm -f $tmp.* $testfile; exit \$status" 0 1 2 3 15
36 # get standard environment, filters and checks
47 sed "s#$testdir[^ :]*#<TESTFILE>#g;
48 s#$tmp[^ :]*#<TMPFILE>#g" $1
53 attr $* 2>$tmp.err >$tmp.out
62 getfattr $* 2>$tmp.err >$tmp.out
73 echo " *** print attributes"
74 if ! _getfattr -d -e text --absolute-names $file
76 echo " !!! error return"
82 # real QA test starts here
86 [ -x /usr/bin/attr ] || _notrun "attr is not installed"
87 [ -x /usr/bin/getfattr ] || _notrun "getfattr is not installed"
93 testfile=$testdir/attribute_$$
95 echo "*** list non-existant file"
98 echo "*** list empty file"
102 echo "*** query non-existant attribute"
103 _attr -g "nonexistant" $testfile 2>&1
105 echo "*** one attribute"
106 echo "fish" | _attr -s fish $testfile
109 echo "*** replace attribute"
110 echo "fish3" | _attr -s fish $testfile
113 echo "*** add attribute"
114 echo "fish2" | _attr -s snrub $testfile
117 echo "*** remove attribute"
118 _attr -r fish $testfile
121 echo "*** add lots of attributes"
123 while [ $v -lt 1000 ]
125 echo "value_$v" | attr -s "attribute_$v" $testfile >>$seq.full
128 echo "!!! failed to add \"attribute_$v\""
136 # don't print it all out...
137 getfattr --absolute-names $testfile \
143 END {print " *** " (l - 1) " attribute(s)" }'
145 echo "*** remove lots of attributes"
147 while [ $v -lt 1000 ]
149 if ! attr -r "attribute_$v" $testfile >>$seq.full
151 echo "!!! failed to remove \"attribute_$v\""
160 echo "*** really long value"
161 dd if=/dev/zero bs=1024 count=100 2>/dev/null \
162 | _attr -s "long_attr" $testfile >/dev/null
164 _attr -g "long_attr" $testfile | tail -n +2 | od -t x1
165 _attr -r "long_attr" $testfile >/dev/null
168 echo "*** set/get/remove really long names (expect failure)"
170 long="$short$short$short$short$short$short$short$short$short$short"
171 vlong="$long$long$long"
173 _attr -s $vlong -V fish $testfile 2>&1 >/dev/null
174 _attr -g $vlong $testfile 2>&1 >/dev/null
175 _attr -r $vlong $testfile 2>&1 >/dev/null
177 echo "*** check final"