From: Jingbo Xu <jefflexu@linux.alibaba.com>
To: xiang@kernel.org, chao@kernel.org, huyue2@coolpad.com,
linux-erofs@lists.ozlabs.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] erofs-utils: tests: enhance erofs/019
Date: Sat, 25 Mar 2023 14:09:54 +0800 [thread overview]
Message-ID: <20230325060954.63062-1-jefflexu@linux.alibaba.com> (raw)
Test xattr in following cases:
- multiple inline xattrs for one single file
- multiple share xattrs for one single file
- mixed inline and share xattrs for one single file
- name/value field of xattr crosses block boundary
Signed-off-by: Jingbo Xu <jefflexu@linux.alibaba.com>
---
This is used to test the refactoring on xattr on kernel side[1].
This patch relies on the "-b #blocksize" feature, and thus it needs to
be rebased to "-b experimental" branch of erofs-utils.
[1] https://lore.kernel.org/all/20230323000949.57608-1-jefflexu@linux.alibaba.com/
---
tests/erofs/019 | 38 +++++++++++++++++++++++++++++++-------
1 file changed, 31 insertions(+), 7 deletions(-)
diff --git a/tests/erofs/019 b/tests/erofs/019
index dac2ae3..f733516 100755
--- a/tests/erofs/019
+++ b/tests/erofs/019
@@ -15,6 +15,11 @@ cleanup()
rm -rf $tmp.*
}
+generate_random()
+{
+ head -20 /dev/urandom | base64 -w0 | head -c $1
+}
+
_require_erofs
# remove previous $seqres.full before test
@@ -37,18 +42,37 @@ rm -rf $localdir
mkdir -p $localdir
# set random xattrs
-cp -nR ../ $localdir
-dirs=`ls $localdir`
-for d in $dirs; do
- key=`head -20 /dev/urandom | cksum | cut -f1 -d " "`
- val="0s"`head -3 /dev/urandom | base64 -w0`
- setfattr -n user.$key -v $val $localdir/$d
-done
+# file1: multiple inline xattrs
+touch $localdir/file1
+setfattr -n user.p$(generate_random 16) -v $(generate_random 16) $localdir/file1
+# inline xattr (large name/value crossing block boundary)
+setfattr -n user.p$(generate_random 249) -v $(generate_random 1024) $localdir/file1
+
+# file2: multiple share xattrs
+s_key_1=$(generate_random 16)
+s_key_2=$(generate_random 16)
+s_val=$(generate_random 16)
+
+touch $localdir/file2
+setfattr -n user.s$s_key_1 -v $s_val $localdir/file2
+setfattr -n user.s$s_key_2 -v $s_val $localdir/file2
+
+# file3: mixed inline and share xattrs
+touch $localdir/file3
+setfattr -n user.p$(generate_random 16) -v $(generate_random 16) $localdir/file3
+setfattr -n user.s$s_key_1 -v $s_val $localdir/file3
+
+# file4: share xattr
+touch $localdir/file4
+setfattr -n user.s$s_key_2 -v $s_val $localdir/file4
+
+MKFS_OPTIONS="$MKFS_OPTIONS -b1024 -x1"
_scratch_mkfs $localdir >> $seqres.full 2>&1 || _fail "failed to mkfs"
_scratch_mount 2>>$seqres.full
# check xattrs
+dirs=`ls $localdir`
for d in $dirs; do
xattr1=`getfattr --absolute-names -d $localdir/$d | tail -n+2`
xattr2=`getfattr --absolute-names -d $SCRATCH_MNT/$d | tail -n+2`
--
1.8.3.1
reply other threads:[~2023-03-25 6:10 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230325060954.63062-1-jefflexu@linux.alibaba.com \
--to=jefflexu@linux.alibaba.com \
--cc=chao@kernel.org \
--cc=huyue2@coolpad.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=xiang@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®