6 #-----------------------------------------------------------------------
7 # Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
9 # This program is free software; you can redistribute it and/or modify it
10 # under the terms of version 2 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, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 # Further, this software is distributed without any warranty that it is
18 # free of the rightful claim of any third person regarding infringement
19 # or the like. Any license provided herein, whether implied or
20 # otherwise, applies only to this software file. Patent licenses, if
21 # any, provided herein do not apply to combinations of this program with
22 # other software, or any other product whatsoever.
24 # You should have received a copy of the GNU General Public License along
25 # with this program; if not, write the Free Software Foundation, Inc., 59
26 # Temple Place - Suite 330, Boston MA 02111-1307, USA.
28 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
29 # Mountain View, CA 94043, or:
33 # For further information regarding this notice, see:
35 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
36 #-----------------------------------------------------------------------
42 echo "QA output created by $seq"
46 status=0 # success is the default!
47 trap "rm -f $tmp.* $testfile; exit \$status" 0 1 2 3 15
49 # get standard environment, filters and checks
55 sed "s#$TEST_DIR[^ :]*#<TESTFILE>#g;
56 s#$tmp[^ :]*#<TMPFILE>#g;
57 s#/proc[^ :]*#<PROCFILE>#g" $1
62 attr $* 2>$tmp.err >$tmp.out
71 getfattr $* 2>$tmp.err >$tmp.out
82 echo " *** print attributes"
83 if ! _getfattr -d -e text --absolute-names $file
85 echo " !!! error return"
90 [ -x /usr/bin/attr ] || _notrun "attr is not installed"
91 [ -x /usr/bin/getfattr ] || _notrun "getfattr is not installed"
93 # real QA test starts here
97 testfile=$TEST_DIR/attribute_$$
99 echo "*** list non-existant file"
102 echo "*** list non-xfs file (in /proc)"
103 _attr_list /proc/devices
105 echo "*** list empty file"
109 echo "*** query non-existant attribute"
110 _attr -g "nonexistant" $testfile 2>&1
112 echo "*** one attribute"
113 echo "fish" | _attr -s fish $testfile
116 echo "*** replace attribute"
117 echo "fish3" | _attr -s fish $testfile
120 echo "*** add attribute"
121 echo "fish2" | _attr -s snrub $testfile
124 echo "*** remove attribute"
125 _attr -r fish $testfile
128 echo "*** add lots of attributes"
130 while [ $v -lt 1000 ]
132 echo "value_$v" | attr -s "attribute_$v" $testfile >>$seq.full
135 echo "!!! failed to add \"attribute_$v\""
143 # don't print it all out...
144 getfattr --absolute-names $testfile \
150 END {print " *** " (l - 1) " attribute(s)" }'
152 echo "*** remove lots of attributes"
154 while [ $v -lt 1000 ]
156 if ! attr -r "attribute_$v" $testfile >>$seq.full
158 echo "!!! failed to remove \"attribute_$v\""
167 echo "*** really long value"
168 dd if=/dev/zero bs=1024 count=100 2>/dev/null \
169 | _attr -s "long_attr" $testfile >/dev/null
171 _attr -g "long_attr" $testfile | tail -n +2 | od -t x1
172 _attr -r "long_attr" $testfile >/dev/null
175 echo "*** set/get/remove really long names (expect failure)"
177 long="$short$short$short$short$short$short$short$short$short$short"
178 vlong="$long$long$long"
180 _attr -s $vlong -V fish $testfile 2>&1 >/dev/null
181 _attr -g $vlong $testfile 2>&1 >/dev/null
182 _attr -r $vlong $testfile 2>&1 >/dev/null
184 echo "*** check final"