6 #-----------------------------------------------------------------------
7 # Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
9 # This program is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation.
13 # This program is distributed in the hope that it would be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write the Free Software Foundation,
20 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #-----------------------------------------------------------------------
26 echo "QA output created by $seq"
30 status=0 # success is the default!
31 trap "_cleanup; rm -f $tmp.* $testfile; exit \$status" 0 1 2 3 15
33 # get standard environment, filters and checks
45 sed "s#$testdir[^ :]*#<TESTFILE>#g;
46 s#$tmp[^ :]*#<TMPFILE>#g" $1
51 $ATTR_PROG $* 2>$tmp.err >$tmp.out
60 $GETFATTR_PROG $* 2>$tmp.err >$tmp.out
71 echo " *** print attributes"
72 if ! _getfattr -d -e text --absolute-names $file
74 echo " !!! error return"
80 # real QA test starts here
90 testfile=$testdir/attribute_$$
92 echo "*** list non-existant file"
95 echo "*** list empty file"
99 echo "*** query non-existant attribute"
100 _attr -g "nonexistant" $testfile 2>&1
102 echo "*** one attribute"
103 echo "fish" | _attr -s fish $testfile
106 echo "*** replace attribute"
107 echo "fish3" | _attr -s fish $testfile
110 echo "*** add attribute"
111 echo "fish2" | _attr -s snrub $testfile
114 echo "*** remove attribute"
115 _attr -r fish $testfile
118 echo "*** add lots of attributes"
121 while [ $v -lt $MAX_ATTRS ]
123 echo -n "value_$v" | attr -s "attribute_$v" $testfile >>$seq.full
126 echo "!!! failed to add \"attribute_$v\""
134 # don't print it all out...
135 getfattr --absolute-names $testfile \
141 END {print " *** " (l - 1) " attribute(s)" }' \
142 | sed s/$MAX_ATTRS/MAX_ATTRS/
144 echo "*** remove lots of attributes"
146 while [ $v -lt $MAX_ATTRS ]
148 if ! $ATTR_PROG -r "attribute_$v" $testfile >>$seq.full
150 echo "!!! failed to remove \"attribute_$v\""
159 echo "*** really long value"
160 dd if=/dev/zero bs=1 count=$MAX_ATTRVAL_SIZE 2>/dev/null \
161 | _attr -s "long_attr" $testfile >/dev/null
163 OCTAL_SIZE=`echo "obase=8; $MAX_ATTRVAL_SIZE" | bc`
164 _attr -q -g "long_attr" $testfile | od -t x1 | sed -e "s/^0*$OCTAL_SIZE$/ATTRSIZE/"
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"