7 #-----------------------------------------------------------------------
8 # Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
10 # This program is free software; you can redistribute it and/or modify it
11 # under the terms of version 2 of the GNU General Public License as
12 # published by the Free Software Foundation.
14 # This program is distributed in the hope that it would be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 # Further, this software is distributed without any warranty that it is
19 # free of the rightful claim of any third person regarding infringement
20 # or the like. Any license provided herein, whether implied or
21 # otherwise, applies only to this software file. Patent licenses, if
22 # any, provided herein do not apply to combinations of this program with
23 # other software, or any other product whatsoever.
25 # You should have received a copy of the GNU General Public License along
26 # with this program; if not, write the Free Software Foundation, Inc., 59
27 # Temple Place - Suite 330, Boston MA 02111-1307, USA.
29 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
30 # Mountain View, CA 94043, or:
34 # For further information regarding this notice, see:
36 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
37 #-----------------------------------------------------------------------
43 echo "QA output created by $seq"
47 status=0 # success is the default!
48 trap "rm -f $tmp.* $testfile; exit \$status" 0 1 2 3 15
50 # get standard environment, filters and checks
56 sed "s#$TEST_DIR[^ :]*#<TESTFILE>#g;
57 s#$tmp[^ :]*#<TMPFILE>#g;
58 s#/proc[^ :]*#<PROCFILE>#g" $1
63 attr $* 2>$tmp.err >$tmp.out
74 echo " *** print attributes"
75 if ! _attr -l $file >$tmp.raw
77 echo " !!! error return"
81 $AWK_PROG -v file=$file '
83 print substr($2,2,length($2)-2)
89 ' <$tmp.raw >$tmp.list
91 echo " *** $? attribute(s)"
92 for l in `cat $tmp.list`
94 if ! _attr -g $l $file >$tmp.raw
97 echo " !!! error return"
102 print " *** field: " substr($2,2,length($2)-2) \
115 # real QA test starts here
117 testfile=$TEST_DIR/attribute_$$
119 echo "*** list non-existant file"
122 echo "*** list non-xfs file (in /proc)"
123 _attr_list /proc/devices
125 echo "*** list empty file"
129 echo "*** query non-existant attribute"
130 _attr -g "nonexistant" $testfile 2>&1
132 echo "*** one attribute"
133 echo "fish" | _attr -s fish $testfile
136 echo "*** replace attribute"
137 echo "fish3" | _attr -s fish $testfile
140 echo "*** add attribute"
141 echo "fish2" | _attr -s snrub $testfile
144 echo "*** remove attribute"
145 _attr -r fish $testfile
148 echo "*** add lots of attributes"
150 while [ $v -lt 1000 ]
152 echo "value_$v" | attr -s "attribute_$v" $testfile >/dev/null
155 echo "!!! failed to add \"attribute_$v\""
163 # don't print it all out...
165 | $AWK_PROG '{ l++ } END {print " *** " l " attribute(s)" }'
167 echo "*** remove lots of attributes"
169 while [ $v -lt 1000 ]
171 if ! attr -r "attribute_$v" $testfile >/dev/null
173 echo "!!! failed to add \"attribute_$v\""
182 echo "*** really long value"
183 dd if=/dev/zero bs=1024 count=100 2>/dev/null \
184 | _attr -s "long_attr" $testfile >/dev/null
186 _attr -g "long_attr" $testfile | tail -n +2 | od -t x1
187 _attr -r "long_attr" $testfile >/dev/null
190 echo "*** set/get/remove really long names (expect failure)"
192 long="$short$short$short$short$short$short$short$short$short$short"
193 vlong="$long$long$long"
195 _attr -s $vlong -V fish $testfile 2>&1 >/dev/null
196 _attr -g $vlong $testfile 2>&1 >/dev/null
197 _attr -r $vlong $testfile 2>&1 >/dev/null
199 echo "*** check final"