erofs-utils: tests: check uncompressed image with random dirs

In order to check uncompressed data behavior.

Signed-off-by: Gao Xiang <xiang@kernel.org>
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 5c1d5e1..1d73a1b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -70,6 +70,9 @@
 # 015 - regression test for battach on full buffer block
 TESTS += erofs/015
 
+# 006 - verify the uncompressed image with 2-level random files
+TESTS += erofs/016
+
 EXTRA_DIST = common/rc erofs
 
 clean-local: clean-local-check
diff --git a/tests/erofs/016 b/tests/erofs/016
new file mode 100755
index 0000000..3d3355b
--- /dev/null
+++ b/tests/erofs/016
@@ -0,0 +1,64 @@
+#!/bin/bash
+# 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/empty"
+
+IFS=': '
+# collect files pending for verification
+for i in `seq -s':' 0 $((RANDOM % 200))`; do
+	d1=`tr -dc A-Za-z0-9 </dev/urandom | head -c $((RANDOM % 150 + 1))`
+	mkdir -p "$localdir/$d1"
+	for j in `seq -s':' 0 $((RANDOM % 100))`; do
+		d2=`tr -dc A-Za-z0-9 </dev/urandom | head -c $((RANDOM % 150 + 1))`
+		dd if=/dev/urandom of="$localdir/$d1/$d2" count=1 \
+			bs=$((RANDOM % 13315)) 2> /dev/null
+	done
+done
+unset IFS
+
+_scratch_mkfs $localdir || _fail "failed to mkfs"
+
+# verify the uncompressed image
+_require_erofs
+_require_fssum
+
+_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/016.out b/tests/erofs/016.out
new file mode 100644
index 0000000..aa2526b
--- /dev/null
+++ b/tests/erofs/016.out
@@ -0,0 +1,2 @@
+QA output created by 016
+Silence is golden