[PATCH 1/2] erofs-utils: tests: check xattrs for all descendants under target directory

Jingbo Xu jefflexu at linux.alibaba.com
Wed Jun 14 13:26:41 AEST 2023


Enhance _check_xattrs() helper checking all descendants under the
target directory.

Signed-off-by: Jingbo Xu <jefflexu at linux.alibaba.com>
---
 tests/common/rc | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/common/rc b/tests/common/rc
index dcd63a9..f234fdc 100644
--- a/tests/common/rc
+++ b/tests/common/rc
@@ -350,11 +350,11 @@ _check_xattrs()
 {
 	local dir1="$1"
 	local dir2="$2"
-	local dirs=`ls $dir1`
+	local entries=`find $dir1 -mindepth 1 -printf '%P\n' -type f`
 
-	for d in $dirs; do
-		xattr1=`getfattr --absolute-names -d $dir1/$d | tail -n+2`
-		xattr2=`getfattr --absolute-names -d $dir2/$d | tail -n+2`
+	for entry in $entries; do
+		xattr1=`getfattr --absolute-names -d $dir1/$entry | tail -n+2`
+		xattr2=`getfattr --absolute-names -d $dir2/$entry | tail -n+2`
 		[ "x$xattr1" = "x$xattr2" ] || _fail "-->check xattrs FAILED"
 	done
 }
-- 
1.8.3.1



More information about the Linux-erofs mailing list