2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
15 status=0 # success is the default!
16 trap "rm -f $tmp.* $testfile; exit \$status" 0 1 2 3 15
18 # get standard environment, filters and checks
25 sed "s#$TEST_DIR[^ :]*#<TESTFILE>#g;
26 s#$tmp[^ :]*#<TMPFILE>#g" $1
31 $ATTR_PROG $* 2>$tmp.err >$tmp.out
40 _getfattr $* 2>$tmp.err >$tmp.out
51 echo " *** print attributes"
52 if ! do_getfattr -d -e text --absolute-names $file
54 echo " !!! error return"
59 # real QA test starts here
67 testfile=$TEST_DIR/attribute_$$
69 echo "*** list non-existant file"
72 echo "*** list empty file"
76 echo "*** query non-existant attribute"
77 _attr -g "nonexistant" $testfile 2>&1
79 echo "*** one attribute"
80 echo "fish" | _attr -s fish $testfile
83 echo "*** replace attribute"
84 echo "fish3" | _attr -s fish $testfile
87 echo "*** add attribute"
88 echo "fish2" | _attr -s snrub $testfile
91 echo "*** remove attribute"
92 _attr -r fish $testfile
95 echo "*** add lots of attributes"
98 while [ $v -lt $MAX_ATTRS ]
100 echo -n "value_$v" | attr -s "attribute_$v" $testfile >>$seqres.full
103 echo "!!! failed to add \"attribute_$v\""
111 # don't print it all out...
112 _getfattr --absolute-names $testfile \
113 | tee -a $seqres.full \
118 END {print " *** " (l - 1) " attribute(s)" }' \
119 | sed s/$MAX_ATTRS/MAX_ATTRS/
121 echo "*** remove lots of attributes"
123 while [ $v -lt $MAX_ATTRS ]
125 if ! $ATTR_PROG -r "attribute_$v" $testfile >>$seqres.full
127 echo "!!! failed to remove \"attribute_$v\""
136 echo "*** really long value"
137 dd if=/dev/zero bs=1 count=$MAX_ATTRVAL_SIZE 2>/dev/null \
138 | _attr -s "long_attr" $testfile >/dev/null
140 OCTAL_SIZE=`echo "obase=8; $MAX_ATTRVAL_SIZE" | bc`
141 _attr -q -g "long_attr" $testfile | od -t x1 | sed -e "s/^0*$OCTAL_SIZE$/ATTRSIZE/"
142 _attr -r "long_attr" $testfile >/dev/null
144 echo "*** set/get/remove really long names (expect failure)"
146 long="$short$short$short$short$short$short$short$short$short$short"
147 vlong="$long$long$long"
149 _attr -s $vlong -V fish $testfile 2>&1 >/dev/null
150 _attr -g $vlong $testfile 2>&1 >/dev/null
151 _attr -r $vlong $testfile 2>&1 >/dev/null
153 echo "*** check final"