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_PROG $* 2>$tmp.err >$tmp.out
51 echo " *** print attributes"
52 if ! _getfattr -d -e text --absolute-names $file
54 echo " !!! error return"
59 # real QA test starts here
68 testfile=$TEST_DIR/attribute_$$
70 echo "*** list non-existant file"
73 echo "*** list empty file"
77 echo "*** query non-existant attribute"
78 _attr -g "nonexistant" $testfile 2>&1
80 echo "*** one attribute"
81 echo "fish" | _attr -s fish $testfile
84 echo "*** replace attribute"
85 echo "fish3" | _attr -s fish $testfile
88 echo "*** add attribute"
89 echo "fish2" | _attr -s snrub $testfile
92 echo "*** remove attribute"
93 _attr -r fish $testfile
96 echo "*** add lots of attributes"
99 while [ $v -lt $MAX_ATTRS ]
101 echo -n "value_$v" | attr -s "attribute_$v" $testfile >>$seqres.full
104 echo "!!! failed to add \"attribute_$v\""
112 # don't print it all out...
113 getfattr --absolute-names $testfile \
114 | tee -a $seqres.full \
119 END {print " *** " (l - 1) " attribute(s)" }' \
120 | sed s/$MAX_ATTRS/MAX_ATTRS/
122 echo "*** remove lots of attributes"
124 while [ $v -lt $MAX_ATTRS ]
126 if ! $ATTR_PROG -r "attribute_$v" $testfile >>$seqres.full
128 echo "!!! failed to remove \"attribute_$v\""
137 echo "*** really long value"
138 dd if=/dev/zero bs=1 count=$MAX_ATTRVAL_SIZE 2>/dev/null \
139 | _attr -s "long_attr" $testfile >/dev/null
141 OCTAL_SIZE=`echo "obase=8; $MAX_ATTRVAL_SIZE" | bc`
142 _attr -q -g "long_attr" $testfile | od -t x1 | sed -e "s/^0*$OCTAL_SIZE$/ATTRSIZE/"
143 _attr -r "long_attr" $testfile >/dev/null
145 echo "*** set/get/remove really long names (expect failure)"
147 long="$short$short$short$short$short$short$short$short$short$short"
148 vlong="$long$long$long"
150 _attr -s $vlong -V fish $testfile 2>&1 >/dev/null
151 _attr -g $vlong $testfile 2>&1 >/dev/null
152 _attr -r $vlong $testfile 2>&1 >/dev/null
154 echo "*** check final"