[PATCH] xfstests: Sort recursive getfattr output in 062

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Test 062 was made "generic" a while back, but it fails on any filesystem
which returns getfattr -R results (aka readdir results) in something
other than inode-order.

With a little awk-fu we can sort the records from getfattr -R so that
the output is the same for xfs as well as ext4, etc.

Also filter out lost+found which extN creates at mkfs time, but
some other filesystems do not.

Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
- ---

diff --git a/062 b/062
index f666e1b..7005c4e 100755
- --- a/062
+++ b/062
@@ -46,6 +46,13 @@ _cleanup()
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
+# getfattr -R returns info in readdir order which varies from fs to fs.
+# This sorts the output by filename
+_sort_getfattr_output()
+{
+	awk '{a[FNR]=$0}END{n = asort(a); for(i=1; i <= n; i++) print a[i],"\n"}' RS=''
+}
+
 getfattr()
 {
     $GETFATTR_PROG --absolute-names -dh $@ 2>&1 | _filter_scratch
@@ -67,7 +74,7 @@ _create_test_bed()
 	mknod $SCRATCH_MNT/dev/c c 0 0
 	mknod $SCRATCH_MNT/dev/p p
 	# sanity check
- -	find $SCRATCH_MNT | LC_COLLATE=POSIX sort | _filter_scratch
+	find $SCRATCH_MNT | LC_COLLATE=POSIX sort | _filter_scratch | grep -v "lost+found"
 }
 
 # real QA test starts here
@@ -160,18 +167,18 @@ _extend_test_bed()
 	# whack a symlink in the middle, just to be difficult
 	ln -s $SCRATCH_MNT/here/up $SCRATCH_MNT/descend/and
 	# dump out our new starting point
- -	find $SCRATCH_MNT | LC_COLLATE=POSIX sort | _filter_scratch
+	find $SCRATCH_MNT | LC_COLLATE=POSIX sort | _filter_scratch | grep -v "lost+found"
 }
 
 _extend_test_bed
 
 echo
 echo "*** directory descent with us following symlinks"
- -getfattr -h -L -R -m '.' -e hex $SCRATCH_MNT
+getfattr -h -L -R -m '.' -e hex $SCRATCH_MNT | _sort_getfattr_output
 
 echo
 echo "*** directory descent without following symlinks"
- -getfattr -h -P -R -m '.' -e hex $SCRATCH_MNT
+getfattr -h -P -R -m '.' -e hex $SCRATCH_MNT | _sort_getfattr_output
 
 
 # 
diff --git a/062.out b/062.out
index 699254a..7d05c85 100644
- --- a/062.out
+++ b/062.out
@@ -508,115 +508,115 @@ SCRATCH_MNT/lnk
 SCRATCH_MNT/reg
 
 *** directory descent with us following symlinks
- -# file: SCRATCH_MNT/reg
- -trusted.name=0xbabe
- -trusted.name3=0xdeface
- -user.name=0xbabe
- -user.name3=0xdeface
+# file: SCRATCH_MNT/descend
+user.1=0x3233
+user.x=0x797a 
 
- -# file: SCRATCH_MNT/dir
- -trusted.name=0xbabe
- -trusted.name3=0xdeface
- -user.name=0xbabe
- -user.name3=0xdeface
+# file: SCRATCH_MNT/descend/and/ascend
+trusted.9=0x3837
+trusted.a=0x6263 
 
- -# file: SCRATCH_MNT/lnk
- -trusted.name=0xbabe
- -trusted.name3=0xdeface
+# file: SCRATCH_MNT/descend/down
+user.1=0x3233
+user.x=0x797a 
+
+# file: SCRATCH_MNT/descend/down/here
+user.1=0x3233
+user.x=0x797a 
 
 # file: SCRATCH_MNT/dev/b
 trusted.name=0xbabe
- -trusted.name3=0xdeface
+trusted.name3=0xdeface 
 
 # file: SCRATCH_MNT/dev/c
 trusted.name=0xbabe
- -trusted.name3=0xdeface
+trusted.name3=0xdeface 
 
 # file: SCRATCH_MNT/dev/p
 trusted.name=0xbabe
+trusted.name3=0xdeface 
+
+# file: SCRATCH_MNT/dir
+trusted.name=0xbabe
 trusted.name3=0xdeface
+user.name=0xbabe
+user.name3=0xdeface 
 
 # file: SCRATCH_MNT/here
 trusted.9=0x3837
- -trusted.a=0x6263
+trusted.a=0x6263 
 
 # file: SCRATCH_MNT/here/up
 trusted.9=0x3837
- -trusted.a=0x6263
+trusted.a=0x6263 
 
 # file: SCRATCH_MNT/here/up/ascend
 trusted.9=0x3837
- -trusted.a=0x6263
+trusted.a=0x6263 
 
+# file: SCRATCH_MNT/lnk
+trusted.name=0xbabe
+trusted.name3=0xdeface 
+
+# file: SCRATCH_MNT/reg
+trusted.name=0xbabe
+trusted.name3=0xdeface
+user.name=0xbabe
+user.name3=0xdeface 
+
+
+*** directory descent without following symlinks
 # file: SCRATCH_MNT/descend
 user.1=0x3233
- -user.x=0x797a
+user.x=0x797a 
 
 # file: SCRATCH_MNT/descend/down
 user.1=0x3233
- -user.x=0x797a
+user.x=0x797a 
 
 # file: SCRATCH_MNT/descend/down/here
 user.1=0x3233
- -user.x=0x797a
- -
- -# file: SCRATCH_MNT/descend/and/ascend
- -trusted.9=0x3837
- -trusted.a=0x6263
- -
- -
- -*** directory descent without following symlinks
- -# file: SCRATCH_MNT/reg
- -trusted.name=0xbabe
- -trusted.name3=0xdeface
- -user.name=0xbabe
- -user.name3=0xdeface
- -
- -# file: SCRATCH_MNT/dir
- -trusted.name=0xbabe
- -trusted.name3=0xdeface
- -user.name=0xbabe
- -user.name3=0xdeface
- -
- -# file: SCRATCH_MNT/lnk
- -trusted.name=0xbabe
- -trusted.name3=0xdeface
+user.x=0x797a 
 
 # file: SCRATCH_MNT/dev/b
 trusted.name=0xbabe
- -trusted.name3=0xdeface
+trusted.name3=0xdeface 
 
 # file: SCRATCH_MNT/dev/c
 trusted.name=0xbabe
- -trusted.name3=0xdeface
+trusted.name3=0xdeface 
 
 # file: SCRATCH_MNT/dev/p
 trusted.name=0xbabe
+trusted.name3=0xdeface 
+
+# file: SCRATCH_MNT/dir
+trusted.name=0xbabe
 trusted.name3=0xdeface
+user.name=0xbabe
+user.name3=0xdeface 
 
 # file: SCRATCH_MNT/here
 trusted.9=0x3837
- -trusted.a=0x6263
+trusted.a=0x6263 
 
 # file: SCRATCH_MNT/here/up
 trusted.9=0x3837
- -trusted.a=0x6263
+trusted.a=0x6263 
 
 # file: SCRATCH_MNT/here/up/ascend
 trusted.9=0x3837
- -trusted.a=0x6263
+trusted.a=0x6263 
 
- -# file: SCRATCH_MNT/descend
- -user.1=0x3233
- -user.x=0x797a
- -
- -# file: SCRATCH_MNT/descend/down
- -user.1=0x3233
- -user.x=0x797a
+# file: SCRATCH_MNT/lnk
+trusted.name=0xbabe
+trusted.name3=0xdeface 
 
- -# file: SCRATCH_MNT/descend/down/here
- -user.1=0x3233
- -user.x=0x797a
+# file: SCRATCH_MNT/reg
+trusted.name=0xbabe
+trusted.name3=0xdeface
+user.name=0xbabe
+user.name3=0xdeface 
 
 
 


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

iQIcBAEBAgAGBQJOzSjQAAoJECCuFpLhPd7gsJIP/j2BKTvft/QjnLxs+gJT/f0S
H7L9r/izHcQ5Z/xk9t4unpOr35EsXOuwMzWN8OrB3fCx0J7gkIj7s7dNFrou8K8w
bkVW6lzy5VUOHPzkqFSNLHSf2YLrrXNfPBLgOQl8A4lkNzY4gjy74uw05bLL4z3y
u+gmjwuOMRTwGe3N9l/q6VR7UybHRyYBE62Ee2SPBa59FFWdicqzQBGVj0OOAdQg
asTekASb8fXv/A4GNMFyNpZtA65ov8puISeGjV/A9Dhrx843qn1IFLA3UfcWEPEf
qF5MDkg0ZuDDzN8YOiZM5S6mY7KAGSiKAHlF9nNZistCMJy4UDWh2lGLCIDEoO8l
oRpbEOQy8tq7v7ppgp4kmh+8aIj0bletjZbgumPiu8KrRNCyXlBpGYGsBIPH+wgn
P0i7EKILkF7gRM6Gs4U7Ek88mLcDSrsRGjI7JWQgOufUoo9noZM4pBlfw+ngx3DC
NlhxisqyWcwDAVV1MBNvoSNGB5iLNCTgb/Ppgb7SdwNJ/heX9EAgKTsTnyENjtYe
ILcuWf0CLYRPG9gun3JIXS/IibJY4Eqi3E9jo+Et5q6eOGTFuD0hjgERULUzH9d2
wwWFq7KPtdJJbWK0mANn2HK0GQH79gskmWsFS8Mxl7JCSMfPOFdbHNSbqdzNKXJS
+OIS7v24/L/pNQNtuqEt
=hW9Q
-----END PGP SIGNATURE-----
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux