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 seqres=$RESULT_DIR/$seq
27 echo "QA output created by $seq"
31 status=0 # success is the default!
32 trap "rm -f $tmp.* $testfile; exit \$status" 0 1 2 3 15
34 # get standard environment, filters and checks
41 sed "s#$TEST_DIR[^ :]*#<TESTFILE>#g;
42 s#$tmp[^ :]*#<TMPFILE>#g" $1
47 $ATTR_PROG $* 2>$tmp.err >$tmp.out
56 $GETFATTR_PROG $* 2>$tmp.err >$tmp.out
67 echo " *** print attributes"
68 if ! _getfattr -d -e text --absolute-names $file
70 echo " !!! error return"
75 # real QA test starts here
84 testfile=$TEST_DIR/attribute_$$
86 echo "*** list non-existant file"
89 echo "*** list empty file"
93 echo "*** query non-existant attribute"
94 _attr -g "nonexistant" $testfile 2>&1
96 echo "*** one attribute"
97 echo "fish" | _attr -s fish $testfile
100 echo "*** replace attribute"
101 echo "fish3" | _attr -s fish $testfile
104 echo "*** add attribute"
105 echo "fish2" | _attr -s snrub $testfile
108 echo "*** remove attribute"
109 _attr -r fish $testfile
112 echo "*** add lots of attributes"
115 while [ $v -lt $MAX_ATTRS ]
117 echo -n "value_$v" | attr -s "attribute_$v" $testfile >>$seqres.full
120 echo "!!! failed to add \"attribute_$v\""
128 # don't print it all out...
129 getfattr --absolute-names $testfile \
130 | tee -a $seqres.full \
135 END {print " *** " (l - 1) " attribute(s)" }' \
136 | sed s/$MAX_ATTRS/MAX_ATTRS/
138 echo "*** remove lots of attributes"
140 while [ $v -lt $MAX_ATTRS ]
142 if ! $ATTR_PROG -r "attribute_$v" $testfile >>$seqres.full
144 echo "!!! failed to remove \"attribute_$v\""
153 echo "*** really long value"
154 dd if=/dev/zero bs=1 count=$MAX_ATTRVAL_SIZE 2>/dev/null \
155 | _attr -s "long_attr" $testfile >/dev/null
157 OCTAL_SIZE=`echo "obase=8; $MAX_ATTRVAL_SIZE" | bc`
158 _attr -q -g "long_attr" $testfile | od -t x1 | sed -e "s/^0*$OCTAL_SIZE$/ATTRSIZE/"
159 _attr -r "long_attr" $testfile >/dev/null
161 echo "*** set/get/remove really long names (expect failure)"
163 long="$short$short$short$short$short$short$short$short$short$short"
164 vlong="$long$long$long"
166 _attr -s $vlong -V fish $testfile 2>&1 >/dev/null
167 _attr -g $vlong $testfile 2>&1 >/dev/null
168 _attr -r $vlong $testfile 2>&1 >/dev/null
170 echo "*** check final"