6 #-----------------------------------------------------------------------
7 # Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
8 #-----------------------------------------------------------------------
14 echo "QA output created by $seq"
18 status=0 # success is the default!
19 trap "_cleanup; rm -f $tmp.* $testfile; exit \$status" 0 1 2 3 15
21 # get standard environment, filters and checks
32 sed "s#$testdir[^ :]*#<TESTFILE>#g;
33 s#$tmp[^ :]*#<TMPFILE>#g;
34 s#/proc[^ :]*#<PROCFILE>#g" $1
39 attr $* 2>$tmp.err >$tmp.out
48 getfattr $* 2>$tmp.err >$tmp.out
59 echo " *** print attributes"
60 if ! _getfattr -d -e text --absolute-names $file
62 echo " !!! error return"
68 # real QA test starts here
72 [ -x /usr/bin/attr ] || _notrun "attr is not installed"
73 [ -x /usr/bin/getfattr ] || _notrun "getfattr is not installed"
79 testfile=$testdir/attribute_$$
81 echo "*** list non-existant file"
84 echo "*** list non-xfs file (in /proc)"
85 _attr_list /proc/devices
87 echo "*** list empty file"
91 echo "*** query non-existant attribute"
92 _attr -g "nonexistant" $testfile 2>&1
94 echo "*** one attribute"
95 echo "fish" | _attr -s fish $testfile
98 echo "*** replace attribute"
99 echo "fish3" | _attr -s fish $testfile
102 echo "*** add attribute"
103 echo "fish2" | _attr -s snrub $testfile
106 echo "*** remove attribute"
107 _attr -r fish $testfile
110 echo "*** add lots of attributes"
112 while [ $v -lt 1000 ]
114 echo "value_$v" | attr -s "attribute_$v" $testfile >>$seq.full
117 echo "!!! failed to add \"attribute_$v\""
125 # don't print it all out...
126 getfattr --absolute-names $testfile \
132 END {print " *** " (l - 1) " attribute(s)" }'
134 echo "*** remove lots of attributes"
136 while [ $v -lt 1000 ]
138 if ! attr -r "attribute_$v" $testfile >>$seq.full
140 echo "!!! failed to remove \"attribute_$v\""
149 echo "*** really long value"
150 dd if=/dev/zero bs=1024 count=100 2>/dev/null \
151 | _attr -s "long_attr" $testfile >/dev/null
153 _attr -g "long_attr" $testfile | tail -n +2 | od -t x1
154 _attr -r "long_attr" $testfile >/dev/null
157 echo "*** set/get/remove really long names (expect failure)"
159 long="$short$short$short$short$short$short$short$short$short$short"
160 vlong="$long$long$long"
162 _attr -s $vlong -V fish $testfile 2>&1 >/dev/null
163 _attr -g $vlong $testfile 2>&1 >/dev/null
164 _attr -r $vlong $testfile 2>&1 >/dev/null
166 echo "*** check final"