# real QA test starts here
-_supported_fs xfs udf
+_supported_fs generic
_supported_os Linux
_require_attrs
echo "*** add lots of attributes"
v=0
-while [ $v -lt 1000 ]
+
+while [ $v -lt $MAX_ATTRS ]
do
- echo "value_$v" | attr -s "attribute_$v" $testfile >>$seq.full
+ echo -n "value_$v" | attr -s "attribute_$v" $testfile >>$seq.full
if [ $? -ne 0 ]
then
echo "!!! failed to add \"attribute_$v\""
/^#/ { next }
/^[ ]*$/ { next }
{ l++ }
- END {print " *** " (l - 1) " attribute(s)" }'
+ END {print " *** " (l - 1) " attribute(s)" }' \
+ | sed s/$MAX_ATTRS/MAX_ATTRS/
echo "*** remove lots of attributes"
v=0
-while [ $v -lt 1000 ]
+while [ $v -lt $MAX_ATTRS ]
do
if ! $ATTR_PROG -r "attribute_$v" $testfile >>$seq.full
then
_attr_list $testfile
echo "*** really long value"
-dd if=/dev/zero bs=1024 count=100 2>/dev/null \
+dd if=/dev/zero bs=1 count=$MAX_ATTRVAL_SIZE 2>/dev/null \
| _attr -s "long_attr" $testfile >/dev/null
-
-_attr -g "long_attr" $testfile | tail -n +2 | od -t x1
+
+OCTAL_SIZE=`echo "obase=8; $MAX_ATTRVAL_SIZE" | bc`
+_attr -q -g "long_attr" $testfile | od -t x1 | sed -e "s/^0*$OCTAL_SIZE$/ATTRSIZE/"
_attr -r "long_attr" $testfile >/dev/null
*** add lots of attributes
*** check
- *** 1000 attribute(s)
+ *** MAX_ATTRS attribute(s)
*** remove lots of attributes
*** print attributes
# file: <TESTFILE>
*** really long value
0000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
-0200000 0a
-0200001
+ATTRSIZE
*** set/get/remove really long names (expect failure)
attr_set: Invalid argument
Could not set "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" for <TESTFILE>
awk '{a[FNR]=$0}END{n = asort(a); for(i=1; i <= n; i++) print a[i]"\n"}' RS=''
}
+# set maximum total attr space based on fs type
+if [ "$FSTYP" == "xfs" -o "$FSTYP" == "udf" ]; then
+ MAX_ATTRS=1000
+else # Assume max ~1 block of attrs
+ BLOCK_SIZE=`stat -f $TEST_DEV | grep "Block size" | cut -d " " -f3`
+ # user.attribute_XXX="value.XXX" is about 32 bytes; leave some overhead
+ let MAX_ATTRS=$BLOCK_SIZE/40
+fi
+
+export MAX_ATTRS
+
+# Set max attr value size based on fs type
+if [ "$FSTYP" == "xfs" -o "$FSTYP" == "udf" -o "$FSTYP" == "btrfs" ]; then
+ MAX_ATTRVAL_SIZE=64
+else # Assume max ~1 block of attrs
+ BLOCK_SIZE=`stat -f $TEST_DEV | grep "Block size" | cut -d " " -f3`
+ # leave a little overhead
+ let MAX_ATTRVAL_SIZE=$BLOCK_SIZE-256
+fi
+
+export MAX_ATTRVAL_SIZE
# make sure this script returns success
/bin/true