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 #-----------------------------------------------------------------------
28 echo "QA output created by $seq"
32 status=0 # success is the default!
33 trap "_cleanup; rm -f $tmp.* $testfile; exit \$status" 0 1 2 3 15
35 # get standard environment, filters and checks
47 sed "s#$testdir[^ :]*#<TESTFILE>#g;
48 s#$tmp[^ :]*#<TMPFILE>#g" $1
53 $ATTR_PROG $* 2>$tmp.err >$tmp.out
62 $GETFATTR_PROG $* 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
92 testfile=$testdir/attribute_$$
94 echo "*** list non-existant file"
97 echo "*** list empty file"
101 echo "*** query non-existant attribute"
102 _attr -g "nonexistant" $testfile 2>&1
104 echo "*** one attribute"
105 echo "fish" | _attr -s fish $testfile
108 echo "*** replace attribute"
109 echo "fish3" | _attr -s fish $testfile
112 echo "*** add attribute"
113 echo "fish2" | _attr -s snrub $testfile
116 echo "*** remove attribute"
117 _attr -r fish $testfile
120 echo "*** add lots of attributes"
123 while [ $v -lt $MAX_ATTRS ]
125 echo -n "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)" }' \
144 | sed s/$MAX_ATTRS/MAX_ATTRS/
146 echo "*** remove lots of attributes"
148 while [ $v -lt $MAX_ATTRS ]
150 if ! $ATTR_PROG -r "attribute_$v" $testfile >>$seq.full
152 echo "!!! failed to remove \"attribute_$v\""
161 echo "*** really long value"
162 dd if=/dev/zero bs=1 count=$MAX_ATTRVAL_SIZE 2>/dev/null \
163 | _attr -s "long_attr" $testfile >/dev/null
165 OCTAL_SIZE=`echo "obase=8; $MAX_ATTRVAL_SIZE" | bc`
166 _attr -q -g "long_attr" $testfile | od -t x1 | sed -e "s/^0*$OCTAL_SIZE$/ATTRSIZE/"
167 _attr -r "long_attr" $testfile >/dev/null
170 echo "*** set/get/remove really long names (expect failure)"
172 long="$short$short$short$short$short$short$short$short$short$short"
173 vlong="$long$long$long"
175 _attr -s $vlong -V fish $testfile 2>&1 >/dev/null
176 _attr -g $vlong $testfile 2>&1 >/dev/null
177 _attr -r $vlong $testfile 2>&1 >/dev/null
179 echo "*** check final"