aboutsummaryrefslogtreecommitdiff
path: root/tests/ubifs_tools-tests/lib/common.sh.in
diff options
context:
space:
mode:
authorZhihao Cheng <chengzhihao1@huawei.com>2024-11-11 17:08:27 +0800
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2024-11-11 10:32:46 +0100
commit389048a771e625a559b53b804a8e0739312cb12c (patch)
treee9edcadf5504fe7160803aa359ef8e1645e5362d /tests/ubifs_tools-tests/lib/common.sh.in
parent60fd097fb0c436956e58d0a30535a04a35258225 (diff)
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 <chengzhihao1@huawei.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tests/ubifs_tools-tests/lib/common.sh.in')
-rwxr-xr-xtests/ubifs_tools-tests/lib/common.sh.in8
1 files changed, 8 insertions, 0 deletions
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"