All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfstests: make xattr test 020 generic
@ 2011-11-23 19:11 ` Eric Sandeen
  0 siblings, 0 replies; 8+ messages in thread
From: Eric Sandeen @ 2011-11-23 19:11 UTC (permalink / raw)
  To: xfs-oss; +Cc: ext4 development

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

020 can be made generic by limiting the total attribute space
used in the tests as appropriate.  Unless we know we have a
large-xattr-capable fs, limit total space to a bit under one
fs block.

Now passes for me on ext3, ext4, btrfs, as well as xfs.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
- ---

incidentally the test used to send a 100k xattr value to
the attr command on xfs; it wrote only 64k but did not complain.
Feature or bug?

diff --git a/020 b/020
index 56b9c3c..d196318 100755
- --- a/020
+++ b/020
@@ -80,7 +80,7 @@ _attr_list()
 
 
 # real QA test starts here
- -_supported_fs xfs udf
+_supported_fs generic
 _supported_os Linux
 
 _require_attrs
@@ -119,9 +119,19 @@ _attr_list $testfile
 
 echo "*** add lots of attributes"
 v=0
- -while [ $v -lt 1000 ]
+
+# set maximum total attr space based on fs type
+if [ "$FSTYP" == "xfs" -o "$FSTYP" == "udf" ]; then
+	NUMATTRS=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 NUMATTRS=$BLOCK_SIZE/40
+fi
+
+while [ $v -lt $NUMATTRS ]
 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\""
@@ -139,11 +149,12 @@ getfattr --absolute-names $testfile \
     	/^#/ { next }
 	/^[ 	]*$/ { next }
         { l++ } 
- -	END {print "   *** " (l - 1) " attribute(s)" }'
+	END {print "   *** " (l - 1) " attribute(s)" }' \
+    | sed s/$NUMATTRS/NUMATTRS/
 
 echo "*** remove lots of attributes"
 v=0
- -while [ $v -lt 1000 ]
+while [ $v -lt $NUMATTRS ]
 do
     if ! $ATTR_PROG -r "attribute_$v" $testfile >>$seq.full
     then
@@ -156,11 +167,21 @@ done
 
 _attr_list $testfile
 
+# Set max attr vlue size based on fs type
+if [ "$FSTYP" == "xfs" -o "$FSTYP" == "udf" -o "$FSTYP" == "btrfs" ]; then
+	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 ATTRVAL_SIZE=$BLOCK_SIZE-256
+fi
+
 echo "*** really long value"
- -dd if=/dev/zero bs=1024 count=100 2>/dev/null \
+dd if=/dev/zero bs=1 count=$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; $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
 
 
diff --git a/020.out b/020.out
index 3e444be..b303200 100644
- --- a/020.out
+++ b/020.out
@@ -40,7 +40,7 @@ user.snrub="fish2\012"
 
 *** add lots of attributes
 *** check
- -   *** 1000 attribute(s)
+   *** NUMATTRS attribute(s)
 *** remove lots of attributes
    *** print attributes
 # file: <TESTFILE>
@@ -49,8 +49,7 @@ user.snrub="fish2\012"
 *** 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>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOzUV4AAoJECCuFpLhPd7gZ6QP/39tqAYI/Luh4s8YaMADgop0
w/zH6swZDZni2/iBgBbfvx4Gg+UEYYVZ3CnJ6Q5LnIUbD/L5/IXNDxmxmin4782C
M8Hdl1Tjy/tQDu/AtIPI7e9FOAxCJVO781ArO9BXwgtPEk8CJVZFOnQ1ZZkpyI0T
JVKS+I/iuDxX97kYLCCwLkk8tVPzr8X61nymrwSkf/YMxlcMXrVuGbr1Usoac97o
QyRy53ivePGdW62eRVpUSHNU7jm1SaCAWX6OrnC31EzRwUdpeO8yHiVEFhI0he3x
g1ODe/fxCoXbT+EkmEAWbBx6TvyscgOTWcQ7tGWmcNkjP2xN7jVde7NJDrRWAS2C
aFzC3qbtl6Bw9AMX3roglxWFbFsheggtspDiO/El4Vx/zEbdMEFvrAP51rtRqFha
VK6W98FweFY1Zb73ZRqR7EozFN86JXroEIPnvLlqoxcRF2M0iRerZuf/8CWE/rqb
LAwfmZbDmXlPpK+lskbS3LJnMJZ6LaDnx64z0EUQFRT3jmSRKV949E2/V/mtx/t4
Fj9ECrGbD+f7fBe7kqdkb6RdtCDCU4ZdD20G++n7+Uiype82cUrPnrPBxDrDOD3Q
BQRYCsBsRIyVXrcLsZ0YicAPAPJGa8bxd0Hg2ZI4WTnBEpQhuvXdk69IHBMX3NFN
aMIIVDdshJ+bPCC/0jor
=A/u5
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] xfstests: make xattr test 020 generic
@ 2011-11-23 19:11 ` Eric Sandeen
  0 siblings, 0 replies; 8+ messages in thread
From: Eric Sandeen @ 2011-11-23 19:11 UTC (permalink / raw)
  To: xfs-oss; +Cc: ext4 development

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

020 can be made generic by limiting the total attribute space
used in the tests as appropriate.  Unless we know we have a
large-xattr-capable fs, limit total space to a bit under one
fs block.

Now passes for me on ext3, ext4, btrfs, as well as xfs.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
- ---

incidentally the test used to send a 100k xattr value to
the attr command on xfs; it wrote only 64k but did not complain.
Feature or bug?

diff --git a/020 b/020
index 56b9c3c..d196318 100755
- --- a/020
+++ b/020
@@ -80,7 +80,7 @@ _attr_list()
 
 
 # real QA test starts here
- -_supported_fs xfs udf
+_supported_fs generic
 _supported_os Linux
 
 _require_attrs
@@ -119,9 +119,19 @@ _attr_list $testfile
 
 echo "*** add lots of attributes"
 v=0
- -while [ $v -lt 1000 ]
+
+# set maximum total attr space based on fs type
+if [ "$FSTYP" == "xfs" -o "$FSTYP" == "udf" ]; then
+	NUMATTRS=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 NUMATTRS=$BLOCK_SIZE/40
+fi
+
+while [ $v -lt $NUMATTRS ]
 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\""
@@ -139,11 +149,12 @@ getfattr --absolute-names $testfile \
     	/^#/ { next }
 	/^[ 	]*$/ { next }
         { l++ } 
- -	END {print "   *** " (l - 1) " attribute(s)" }'
+	END {print "   *** " (l - 1) " attribute(s)" }' \
+    | sed s/$NUMATTRS/NUMATTRS/
 
 echo "*** remove lots of attributes"
 v=0
- -while [ $v -lt 1000 ]
+while [ $v -lt $NUMATTRS ]
 do
     if ! $ATTR_PROG -r "attribute_$v" $testfile >>$seq.full
     then
@@ -156,11 +167,21 @@ done
 
 _attr_list $testfile
 
+# Set max attr vlue size based on fs type
+if [ "$FSTYP" == "xfs" -o "$FSTYP" == "udf" -o "$FSTYP" == "btrfs" ]; then
+	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 ATTRVAL_SIZE=$BLOCK_SIZE-256
+fi
+
 echo "*** really long value"
- -dd if=/dev/zero bs=1024 count=100 2>/dev/null \
+dd if=/dev/zero bs=1 count=$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; $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
 
 
diff --git a/020.out b/020.out
index 3e444be..b303200 100644
- --- a/020.out
+++ b/020.out
@@ -40,7 +40,7 @@ user.snrub="fish2\012"
 
 *** add lots of attributes
 *** check
- -   *** 1000 attribute(s)
+   *** NUMATTRS attribute(s)
 *** remove lots of attributes
    *** print attributes
 # file: <TESTFILE>
@@ -49,8 +49,7 @@ user.snrub="fish2\012"
 *** 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>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOzUV4AAoJECCuFpLhPd7gZ6QP/39tqAYI/Luh4s8YaMADgop0
w/zH6swZDZni2/iBgBbfvx4Gg+UEYYVZ3CnJ6Q5LnIUbD/L5/IXNDxmxmin4782C
M8Hdl1Tjy/tQDu/AtIPI7e9FOAxCJVO781ArO9BXwgtPEk8CJVZFOnQ1ZZkpyI0T
JVKS+I/iuDxX97kYLCCwLkk8tVPzr8X61nymrwSkf/YMxlcMXrVuGbr1Usoac97o
QyRy53ivePGdW62eRVpUSHNU7jm1SaCAWX6OrnC31EzRwUdpeO8yHiVEFhI0he3x
g1ODe/fxCoXbT+EkmEAWbBx6TvyscgOTWcQ7tGWmcNkjP2xN7jVde7NJDrRWAS2C
aFzC3qbtl6Bw9AMX3roglxWFbFsheggtspDiO/El4Vx/zEbdMEFvrAP51rtRqFha
VK6W98FweFY1Zb73ZRqR7EozFN86JXroEIPnvLlqoxcRF2M0iRerZuf/8CWE/rqb
LAwfmZbDmXlPpK+lskbS3LJnMJZ6LaDnx64z0EUQFRT3jmSRKV949E2/V/mtx/t4
Fj9ECrGbD+f7fBe7kqdkb6RdtCDCU4ZdD20G++n7+Uiype82cUrPnrPBxDrDOD3Q
BQRYCsBsRIyVXrcLsZ0YicAPAPJGa8bxd0Hg2ZI4WTnBEpQhuvXdk69IHBMX3NFN
aMIIVDdshJ+bPCC/0jor
=A/u5
-----END PGP SIGNATURE-----

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] xfstests: make xattr test 020 generic
  2011-11-23 19:11 ` Eric Sandeen
@ 2011-11-28 11:01   ` Christoph Hellwig
  -1 siblings, 0 replies; 8+ messages in thread
From: Christoph Hellwig @ 2011-11-28 11:01 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: xfs-oss, ext4 development

On Wed, Nov 23, 2011 at 01:11:53PM -0600, Eric Sandeen wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> 020 can be made generic by limiting the total attribute space
> used in the tests as appropriate.  Unless we know we have a
> large-xattr-capable fs, limit total space to a bit under one
> fs block.
> 
> Now passes for me on ext3, ext4, btrfs, as well as xfs.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> - ---
> 
> incidentally the test used to send a 100k xattr value to
> the attr command on xfs; it wrote only 64k but did not complain.
> Feature or bug?
> 
> diff --git a/020 b/020
> index 56b9c3c..d196318 100755
> - --- a/020
> +++ b/020
> @@ -80,7 +80,7 @@ _attr_list()
>  
>  
>  # real QA test starts here
> - -_supported_fs xfs udf
> +_supported_fs generic
>  _supported_os Linux
>  
>  _require_attrs
> @@ -119,9 +119,19 @@ _attr_list $testfile
>  
>  echo "*** add lots of attributes"
>  v=0
> - -while [ $v -lt 1000 ]
> +
> +# set maximum total attr space based on fs type
> +if [ "$FSTYP" == "xfs" -o "$FSTYP" == "udf" ]; then
> +	NUMATTRS=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 NUMATTRS=$BLOCK_SIZE/40
> +fi

I'd prefer if we define the limits in common.rc - we shouldn't have to
spread too much fs knowledege over individual tests.

> +if [ "$FSTYP" == "xfs" -o "$FSTYP" == "udf" -o "$FSTYP" == "btrfs" ]; then
> +	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 ATTRVAL_SIZE=$BLOCK_SIZE-256
> +fi

same for this one.

Except for that these changes looks fine to me.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] xfstests: make xattr test 020 generic
@ 2011-11-28 11:01   ` Christoph Hellwig
  0 siblings, 0 replies; 8+ messages in thread
From: Christoph Hellwig @ 2011-11-28 11:01 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: ext4 development, xfs-oss

On Wed, Nov 23, 2011 at 01:11:53PM -0600, Eric Sandeen wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> 020 can be made generic by limiting the total attribute space
> used in the tests as appropriate.  Unless we know we have a
> large-xattr-capable fs, limit total space to a bit under one
> fs block.
> 
> Now passes for me on ext3, ext4, btrfs, as well as xfs.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> - ---
> 
> incidentally the test used to send a 100k xattr value to
> the attr command on xfs; it wrote only 64k but did not complain.
> Feature or bug?
> 
> diff --git a/020 b/020
> index 56b9c3c..d196318 100755
> - --- a/020
> +++ b/020
> @@ -80,7 +80,7 @@ _attr_list()
>  
>  
>  # real QA test starts here
> - -_supported_fs xfs udf
> +_supported_fs generic
>  _supported_os Linux
>  
>  _require_attrs
> @@ -119,9 +119,19 @@ _attr_list $testfile
>  
>  echo "*** add lots of attributes"
>  v=0
> - -while [ $v -lt 1000 ]
> +
> +# set maximum total attr space based on fs type
> +if [ "$FSTYP" == "xfs" -o "$FSTYP" == "udf" ]; then
> +	NUMATTRS=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 NUMATTRS=$BLOCK_SIZE/40
> +fi

I'd prefer if we define the limits in common.rc - we shouldn't have to
spread too much fs knowledege over individual tests.

> +if [ "$FSTYP" == "xfs" -o "$FSTYP" == "udf" -o "$FSTYP" == "btrfs" ]; then
> +	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 ATTRVAL_SIZE=$BLOCK_SIZE-256
> +fi

same for this one.

Except for that these changes looks fine to me.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH V2] xfstests: 020: make this xattr test generic
  2011-11-28 11:01   ` Christoph Hellwig
@ 2012-01-27 18:34     ` Eric Sandeen
  -1 siblings, 0 replies; 8+ messages in thread
From: Eric Sandeen @ 2012-01-27 18:34 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: ext4 development, xfs-oss

020 can be made generic by limiting the total attribute space
used in the tests as appropriate.  Unless we know we have a
large-xattr-capable fs, limit total space to a bit under one
fs block.

Now passes for me on ext3, ext4, btrfs, as well as xfs.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

V2: Move max attr definitions to common.attr, and change
their names a bit.

diff --git a/020 b/020
index 56b9c3c..8b8db30 100755
--- a/020
+++ b/020
@@ -80,7 +80,7 @@ _attr_list()
 
 
 # real QA test starts here
-_supported_fs xfs udf
+_supported_fs generic
 _supported_os Linux
 
 _require_attrs
@@ -119,9 +119,10 @@ _attr_list $testfile
 
 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\""
@@ -139,11 +140,12 @@ getfattr --absolute-names $testfile \
     	/^#/ { 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
@@ -157,10 +159,11 @@ done
 _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
 
 
diff --git a/020.out b/020.out
index 3e444be..7e3e65b 100644
--- a/020.out
+++ b/020.out
@@ -40,7 +40,7 @@ user.snrub="fish2\012"
 
 *** add lots of attributes
 *** check
-   *** 1000 attribute(s)
+   *** MAX_ATTRS attribute(s)
 *** remove lots of attributes
    *** print attributes
 # file: <TESTFILE>
@@ -49,8 +49,7 @@ user.snrub="fish2\012"
 *** 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>
diff --git a/common.attr b/common.attr
index 37d0927..3e2ba85 100644
--- a/common.attr
+++ b/common.attr
@@ -176,5 +176,26 @@ _require_attrs()
     rm -f $TEST_DIR/syscalltest.out
 }
 
+# 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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH V2] xfstests: 020: make this xattr test generic
@ 2012-01-27 18:34     ` Eric Sandeen
  0 siblings, 0 replies; 8+ messages in thread
From: Eric Sandeen @ 2012-01-27 18:34 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: ext4 development, xfs-oss

020 can be made generic by limiting the total attribute space
used in the tests as appropriate.  Unless we know we have a
large-xattr-capable fs, limit total space to a bit under one
fs block.

Now passes for me on ext3, ext4, btrfs, as well as xfs.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

V2: Move max attr definitions to common.attr, and change
their names a bit.

diff --git a/020 b/020
index 56b9c3c..8b8db30 100755
--- a/020
+++ b/020
@@ -80,7 +80,7 @@ _attr_list()
 
 
 # real QA test starts here
-_supported_fs xfs udf
+_supported_fs generic
 _supported_os Linux
 
 _require_attrs
@@ -119,9 +119,10 @@ _attr_list $testfile
 
 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\""
@@ -139,11 +140,12 @@ getfattr --absolute-names $testfile \
     	/^#/ { 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
@@ -157,10 +159,11 @@ done
 _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
 
 
diff --git a/020.out b/020.out
index 3e444be..7e3e65b 100644
--- a/020.out
+++ b/020.out
@@ -40,7 +40,7 @@ user.snrub="fish2\012"
 
 *** add lots of attributes
 *** check
-   *** 1000 attribute(s)
+   *** MAX_ATTRS attribute(s)
 *** remove lots of attributes
    *** print attributes
 # file: <TESTFILE>
@@ -49,8 +49,7 @@ user.snrub="fish2\012"
 *** 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>
diff --git a/common.attr b/common.attr
index 37d0927..3e2ba85 100644
--- a/common.attr
+++ b/common.attr
@@ -176,5 +176,26 @@ _require_attrs()
     rm -f $TEST_DIR/syscalltest.out
 }
 
+# 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

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH V2] 020: make this xattr test generic
  2012-01-27 18:34     ` Eric Sandeen
@ 2012-03-31 20:11       ` Christoph Hellwig
  -1 siblings, 0 replies; 8+ messages in thread
From: Christoph Hellwig @ 2012-03-31 20:11 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: Christoph Hellwig, ext4 development, xfs-oss

I've applied this one.

On Fri, Jan 27, 2012 at 12:34:31PM -0600, Eric Sandeen wrote:
> 020 can be made generic by limiting the total attribute space
> used in the tests as appropriate.  Unless we know we have a
> large-xattr-capable fs, limit total space to a bit under one
> fs block.
> 
> Now passes for me on ext3, ext4, btrfs, as well as xfs.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
> 
> V2: Move max attr definitions to common.attr, and change
> their names a bit.
> 
> Index: xfstests-dev/020
> ===================================================================
> --- xfstests-dev.orig/020	2010-10-21 19:57:08.000000000 +0000
> +++ xfstests-dev/020	2012-03-31 16:09:53.000000000 +0000
> @@ -80,7 +80,7 @@ _attr_list()
>  
>  
>  # real QA test starts here
> -_supported_fs xfs udf
> +_supported_fs generic
>  _supported_os Linux
>  
>  _require_attrs
> @@ -119,9 +119,10 @@ _attr_list $testfile
>  
>  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\""
> @@ -139,11 +140,12 @@ getfattr --absolute-names $testfile \
>      	/^#/ { 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
> @@ -157,10 +159,11 @@ done
>  _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
>  
>  
> Index: xfstests-dev/020.out
> ===================================================================
> --- xfstests-dev.orig/020.out	2009-05-10 16:48:46.000000000 +0000
> +++ xfstests-dev/020.out	2012-03-31 16:09:53.000000000 +0000
> @@ -40,7 +40,7 @@ user.snrub="fish2\012"
>  
>  *** add lots of attributes
>  *** check
> -   *** 1000 attribute(s)
> +   *** MAX_ATTRS attribute(s)
>  *** remove lots of attributes
>     *** print attributes
>  # file: <TESTFILE>
> @@ -49,8 +49,7 @@ user.snrub="fish2\012"
>  *** 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>
> Index: xfstests-dev/common.attr
> ===================================================================
> --- xfstests-dev.orig/common.attr	2012-02-13 17:59:51.000000000 +0000
> +++ xfstests-dev/common.attr	2012-03-31 16:09:53.000000000 +0000
> @@ -183,5 +183,26 @@ _sort_getfattr_output()
>      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
---end quoted text---

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH V2] 020: make this xattr test generic
@ 2012-03-31 20:11       ` Christoph Hellwig
  0 siblings, 0 replies; 8+ messages in thread
From: Christoph Hellwig @ 2012-03-31 20:11 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: Christoph Hellwig, ext4 development, xfs-oss

I've applied this one.

On Fri, Jan 27, 2012 at 12:34:31PM -0600, Eric Sandeen wrote:
> 020 can be made generic by limiting the total attribute space
> used in the tests as appropriate.  Unless we know we have a
> large-xattr-capable fs, limit total space to a bit under one
> fs block.
> 
> Now passes for me on ext3, ext4, btrfs, as well as xfs.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
> 
> V2: Move max attr definitions to common.attr, and change
> their names a bit.
> 
> Index: xfstests-dev/020
> ===================================================================
> --- xfstests-dev.orig/020	2010-10-21 19:57:08.000000000 +0000
> +++ xfstests-dev/020	2012-03-31 16:09:53.000000000 +0000
> @@ -80,7 +80,7 @@ _attr_list()
>  
>  
>  # real QA test starts here
> -_supported_fs xfs udf
> +_supported_fs generic
>  _supported_os Linux
>  
>  _require_attrs
> @@ -119,9 +119,10 @@ _attr_list $testfile
>  
>  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\""
> @@ -139,11 +140,12 @@ getfattr --absolute-names $testfile \
>      	/^#/ { 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
> @@ -157,10 +159,11 @@ done
>  _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
>  
>  
> Index: xfstests-dev/020.out
> ===================================================================
> --- xfstests-dev.orig/020.out	2009-05-10 16:48:46.000000000 +0000
> +++ xfstests-dev/020.out	2012-03-31 16:09:53.000000000 +0000
> @@ -40,7 +40,7 @@ user.snrub="fish2\012"
>  
>  *** add lots of attributes
>  *** check
> -   *** 1000 attribute(s)
> +   *** MAX_ATTRS attribute(s)
>  *** remove lots of attributes
>     *** print attributes
>  # file: <TESTFILE>
> @@ -49,8 +49,7 @@ user.snrub="fish2\012"
>  *** 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>
> Index: xfstests-dev/common.attr
> ===================================================================
> --- xfstests-dev.orig/common.attr	2012-02-13 17:59:51.000000000 +0000
> +++ xfstests-dev/common.attr	2012-03-31 16:09:53.000000000 +0000
> @@ -183,5 +183,26 @@ _sort_getfattr_output()
>      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
---end quoted text---

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-03-31 20:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-23 19:11 [PATCH] xfstests: make xattr test 020 generic Eric Sandeen
2011-11-23 19:11 ` Eric Sandeen
2011-11-28 11:01 ` Christoph Hellwig
2011-11-28 11:01   ` Christoph Hellwig
2012-01-27 18:34   ` [PATCH V2] xfstests: 020: make this xattr test generic Eric Sandeen
2012-01-27 18:34     ` Eric Sandeen
2012-03-31 20:11     ` [PATCH V2] " Christoph Hellwig
2012-03-31 20:11       ` Christoph Hellwig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.