[PATCH 5/7] erofs-utils: tests: check battach on full buffer block

Hu Weiwen sehuww at mail.scut.edu.cn
Fri Jan 22 03:37:13 AEDT 2021


regression test for
https://lore.kernel.org/linux-erofs/20210118123945.23676-1-sehuww@mail.scut.edu.cn/

Signed-off-by: Hu Weiwen <sehuww at mail.scut.edu.cn>
---
 tests/Makefile.am   |  4 ++++
 tests/erofs/015     | 55 +++++++++++++++++++++++++++++++++++++++++++++
 tests/erofs/015-out |  2 ++
 3 files changed, 61 insertions(+)
 create mode 100755 tests/erofs/015
 create mode 100644 tests/erofs/015-out

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3702f91..03f3ab3 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -82,6 +82,10 @@ TESTS_OUT += erofs/013-out
 TESTS += erofs/014
 TESTS_OUT += erofs/014-out
 
+# 015 - battach on full buffer block
+TESTS += erofs/015
+TESTS_OUT += erofs/015-out
+
 dist_check_SCRIPTS = common/rc $(TESTS)
 dist_check_DATA = $(TESTS_OUT)
 
diff --git a/tests/erofs/015 b/tests/erofs/015
new file mode 100755
index 0000000..f445ba1
--- /dev/null
+++ b/tests/erofs/015
@@ -0,0 +1,55 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+
+# 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
+
+localdir="$tmp/$seq"
+rm -rf $localdir
+mkdir -p $localdir
+
+# collect files pending for verification
+head -c 4032 /dev/urandom > $localdir/1
+head -c 4095 /dev/urandom > $localdir/2
+head -c 12345 /dev/urandom > $localdir/3  # arbitrary size
+
+_scratch_mkfs -Eforce-inode-compact $localdir || _fail "failed to mkfs"
+
+# verify the uncompressed image
+_require_erofs
+
+_scratch_mount 2>>$seqres.full
+
+FSSUM_OPTS="-MAC"
+[ $FSTYP = "erofsfuse" ] && FSSUM_OPTS="${FSSUM_OPTS}T"
+
+sum1=`$FSSUM_PROG $FSSUM_OPTS $localdir`
+echo "$localdir checksum is $sum1" >>$seqres.full
+sum2=`$FSSUM_PROG $FSSUM_OPTS $SCRATCH_MNT`
+echo "$SCRATCH_MNT checksum is $sum2" >>$seqres.full
+
+[ "x$sum1" = "x$sum2" ] || _fail "-->checkMD5 FAILED"
+_scratch_unmount
+
+echo Silence is golden
+status=0
+exit 0
diff --git a/tests/erofs/015-out b/tests/erofs/015-out
new file mode 100644
index 0000000..fee0fcf
--- /dev/null
+++ b/tests/erofs/015-out
@@ -0,0 +1,2 @@
+QA output created by 015
+Silence is golden
-- 
2.30.0



More information about the Linux-erofs mailing list