Skip to contentSkip to conversation

erofs-utils: tests: check xattrs for all descendants under target directory

PATCH In review Jingbo Xu 2 participants 3 messages Jun 14, 2023

lore
Share & tools
lore

Jingbo Xu

author
#0 lore raw

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

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

---
 tests/common/rc | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tests/common/rc +4 -4
index dcd63a9..f234fdc 100644
@@ -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
 }
Signature · 1 line
1.8.3.1
author
#1 lore raw

PATCH 2/2 erofs-utils: tests: add test for xattrs in random layouts

Generate and check random xattrs. Set xattrs on tested file as much as possible until the number or size of xattrs has reached the upper limit for single file, e.g. maximum one block size for xattrs for single file in ext4.

The same xattr may be shared among multiple tested files or not. Thus the layout of mixed inline and shared xattrs is tested.

---
 tests/Makefile.am   |   3 ++
 tests/erofs/023     | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/erofs/023.out |   2 +
 3 files changed, 109 insertions(+)
 create mode 100755 tests/erofs/023
 create mode 100644 tests/erofs/023.out
tests/Makefile.am +3 -0
index 6295964..b0e7806 100644
@@ -100,6 +100,9 @@ TESTS += erofs/021
 # 022 - check long extended attribute name prefixes
 TESTS += erofs/022
 
+# 023 - check extended attributes in random layouts
+TESTS += erofs/023
+
 EXTRA_DIST = common/rc erofs
 
 clean-local: clean-local-check
tests/erofs/023 new file +104 -0

104 lines not on this page · raw message

tests/erofs/023.out new file +2 -0
new file mode 100644
index 0000000..5c4197b
@@ -0,0 +1,2 @@
+QA output created by 023
+Silence is golden
Signature · 1 line
1.8.3.1