[PATCH experimental-tests] erofs-utils: tests: add test for blobdev block map support
Nithurshen
nithurshen.dev at gmail.com
Thu Mar 19 14:16:43 AEDT 2026
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 at 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
More information about the Linux-erofs
mailing list