From: Nithurshen <nithurshen.dev@gmail.com>
To: linux-erofs@lists.ozlabs.org
Cc: hsiangkao@linux.alibaba.com, zhaoyifan28@huawei.com,
xiang@kernel.org, Nithurshen <nithurshen.dev@gmail.com>
Subject: [PATCH experimental-tests] erofs-utils: tests: add test for blobdev block map support
Date: Thu, 19 Mar 2026 08:46:43 +0530 [thread overview]
Message-ID: <20260319031643.97106-1-nithurshen.dev@gmail.com> (raw)
Recent changes to mkfs.erofs enabled the use of the block map chunk
format in conjunction with extra blob devices.
Add a test case to ensure this functionality works as expected and
to prevent future regressions. The test creates a dummy source
directory, formats it using `--blobdev` and `-E force-inode-blockmap`,
extracts the resulting image using `fsck.erofs`, and performs a strict
diff to verify that the data mapped to the external blob device is
read correctly without corruption.
Signed-off-by: Nithurshen <nithurshen.dev@gmail.com>
---
tests/Makefile.am | 3 +++
tests/erofs/028 | 48 +++++++++++++++++++++++++++++++++++++++++++++
tests/erofs/028.out | 2 ++
3 files changed, 53 insertions(+)
create mode 100755 tests/erofs/028
create mode 100644 tests/erofs/028.out
diff --git a/tests/Makefile.am b/tests/Makefile.am
index fe7fb47..03c6212 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -119,6 +119,9 @@ TESTS += erofs/026
# 027 - ensure that uncompressed filesystems should not have LZ4_0PADDING set
TESTS += erofs/027
+# 028 - test mkfs with block map for blob devices
+TESTS += erofs/028
+
EXTRA_DIST = common/rc erofs
clean-local: clean-local-check
diff --git a/tests/erofs/028 b/tests/erofs/028
new file mode 100755
index 0000000..cfd1531
--- /dev/null
+++ b/tests/erofs/028
@@ -0,0 +1,48 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0+
+#
+# test mkfs with block map for blob devices
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$(echo $0 | awk '{print $((NF-1))"/"$NF}' FS="/")
+
+# get standard environment, filters and checks
+. "${srcdir}/common/rc"
+
+cleanup()
+{
+ cd /
+ rm -rf $tmp.*
+}
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# real QA test starts here
+echo "QA output created by $seq"
+
+if [ -z $SCRATCH_DEV ]; then
+ SCRATCH_DEV=$tmp/erofs_$seq.img
+ rm -f SCRATCH_DEV
+fi
+
+blob_dev=$tmp/erofs_blob_$seq.img
+rm -f $blob_dev
+
+localdir="$tmp/$seq"
+rm -rf $localdir
+mkdir -p $localdir/test-source
+
+dd if=/dev/urandom of=$localdir/test-source/large_file.bin bs=1M count=2 status=none
+echo "Hello EROFS Block Map" > $localdir/test-source/small_file.txt
+
+_scratch_mkfs $localdir/test-source -E force-inode-blockmap --chunksize=4096 --blobdev=$blob_dev >> $seqres.full 2>&1 || _fail "failed to mkfs"
+
+mkdir -p $localdir/extract-dir
+$FSCK_EROFS_PROG --extract=$localdir/extract-dir --device=$blob_dev $SCRATCH_DEV >> $seqres.full 2>&1 || _fail "failed to extract image"
+
+diff -r --no-dereference $localdir/test-source/ $localdir/extract-dir/ >> $seqres.full 2>&1 || _fail "content mismatch! Data read from blob device is corrupted."
+
+echo Silence is golden
+status=0
+exit 0
\ No newline at end of file
diff --git a/tests/erofs/028.out b/tests/erofs/028.out
new file mode 100644
index 0000000..2615f73
--- /dev/null
+++ b/tests/erofs/028.out
@@ -0,0 +1,2 @@
+QA output created by 028
+Silence is golden
--
2.43.0
reply other threads:[~2026-03-19 3:17 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=20260319031643.97106-1-nithurshen.dev@gmail.com \
--to=nithurshen.dev@gmail.com \
--cc=hsiangkao@linux.alibaba.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=xiang@kernel.org \
--cc=zhaoyifan28@huawei.com \
/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