Test for the file-backed mount feature. Signed-off-by: Hongzhen Luo <hongz...@linux.alibaba.com> --- tests/Makefile.am | 3 +++ tests/erofs/026 | 54 +++++++++++++++++++++++++++++++++++++++++++++ tests/erofs/026.out | 2 ++ 3 files changed, 59 insertions(+) create mode 100755 tests/erofs/026 create mode 100644 tests/erofs/026.out
diff --git a/tests/Makefile.am b/tests/Makefile.am index 93016e5..70044a3 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -110,6 +110,9 @@ TESTS += erofs/024 # 025 - regression test for corrupted directories with hardlinks TESTS += erofs/025 +# 026 - test for file-backed mount +TESTS += erofs/026 + EXTRA_DIST = common/rc erofs clean-local: clean-local-check diff --git a/tests/erofs/026 b/tests/erofs/026 new file mode 100755 index 0000000..2228f4b --- /dev/null +++ b/tests/erofs/026 @@ -0,0 +1,54 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0+ +# +# Test for file-backed moount +# +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.* +} + +_require_root +_require_erofs +_require_fssum + +# 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 + +input_dir="../lib/" +FSSUM_OPTS="-MAC" +sum_std=`$FSSUM_PROG $FSSUM_OPTS "$input_dir"` + +# test uncompressed files +_scratch_mkfs "$input_dir" >> $seqres.full 2>&1 || _fail "failed to mkfs (uncompressed)" +_do_mount "-t $FSTYP $SCRATCH_DEV $SCRATCH_MNT" 2>>$seqres.full +sum_uncompressed=`$FSSUM_PROG $FSSUM_OPTS $SCRATCH_MNT` +[ "x$sum_std" = "x$sum_uncompressed" ] || _fail "-->test uncompressed files FAILED" +_scratch_unmount + +_require_erofs_compression "-zdeflate,9" +MKFS_OPTIONS=" -zdeflate,9" +_scratch_mkfs "$input_dir" >> $seqres.full 2>&1 || _fail "failed to mkfs (compressed)" +_do_mount "-t $FSTYP $SCRATCH_DEV $SCRATCH_MNT" 2>>$seqres.full +sum_compressed=`$FSSUM_PROG $FSSUM_OPTS $SCRATCH_MNT` +[ "x$sum_std" = "x$sum_compressed" ] || _fail "-->test compressed files FAILED" +_scratch_unmount + +echo Silence is golden +status=0 +exit 0 diff --git a/tests/erofs/026.out b/tests/erofs/026.out new file mode 100644 index 0000000..e45c6a3 --- /dev/null +++ b/tests/erofs/026.out @@ -0,0 +1,2 @@ +QA output created by 026 +Silence is golden -- 2.43.5