From 389048a771e625a559b53b804a8e0739312cb12c Mon Sep 17 00:00:00 2001 From: Zhihao Cheng Date: Mon, 11 Nov 2024 17:08:27 +0800 Subject: tests: ubifs_tools: mkfs_tests: Add fs content check test Initialize UBIFS image from a given directory, then check whether the fs content in mounted UBIFS is consistent with the original directory. Both UBI volume and file are chosen as storage mediums to test. Signed-off-by: Zhihao Cheng Signed-off-by: David Oberhollenzer --- tests/ubifs_tools-tests/lib/common.sh.in | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests/ubifs_tools-tests/lib/common.sh.in') diff --git a/tests/ubifs_tools-tests/lib/common.sh.in b/tests/ubifs_tools-tests/lib/common.sh.in index a27fe10..8d1b3c0 100755 --- a/tests/ubifs_tools-tests/lib/common.sh.in +++ b/tests/ubifs_tools-tests/lib/common.sh.in @@ -8,8 +8,10 @@ UBI_NUM=0 DEV=/dev/ubi0_0 MNT=/mnt/test_file_system TMP_FILE=/tmp/ubifs_test_file +TMP_MNT=/tmp/ubifs_tmp_mnt LOG_FILE=/tmp/ubifs_log KEY_FILE=/tmp/key +IMG_FILE=ubifs.img nandsim_patt="NAND simulator" mtdram_patt="mtdram test device" @@ -35,6 +37,8 @@ function cleanup_handler() { local ret="$1" + umount $TMP_MNT >/dev/null 2>&1 ||: + rm -rf $TMP_MNT >/dev/null 2>&1 ||: if [ "$ret" == "0" ]; then umount $MNT >/dev/null 2>&1 ||: modprobe -r ubifs >/dev/null 2>&1 ||: @@ -45,6 +49,7 @@ function cleanup_handler() rm -f $TMP_FILE >/dev/null 2>&1 ||: rm -f $KEY_FILE >/dev/null 2>&1 ||: rm -f $LOG_FILE >/dev/null 2>&1 ||: + rm -f $IMG_FILE >/dev/null 2>&1 ||: exit 0 else exit 1 @@ -344,6 +349,9 @@ function cancel_io_err() if ! [ -d $MNT ]; then mkdir -p $MNT fi +if ! [ -d $TMP_MNT ]; then + mkdir -p $TMP_MNT +fi modprobe ubi || fatal "common.sh: cannot load ubi" modprobe ubifs || fatal "common.sh: cannot load ubifs" -- cgit v1.2.3