Skip to content

Commit

Permalink
Abort test when failing to unmount ramdisk
Browse files Browse the repository at this point in the history
Checking the existence of DEFAULT_RAMDISK_PATH
and checking the permission of it if it is.

Signed-off-by: Ayato Tokubi <tokubi.ayato@gmail.com>
  • Loading branch information
bitoku authored and alindima committed Jul 16, 2021
1 parent a442af9 commit 3f1c98c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tools/devtool
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,15 @@ mount_ramdisk() {
}

umount_ramdisk() {
if [ ! -e "${DEFAULT_RAMDISK_PATH}" ]; then
return 0
fi
if [ ! -d "${DEFAULT_RAMDISK_PATH}" ]; then
die "${DEFAULT_RAMDISK_PATH} is not a directory."
fi
if [ ! -w "${DEFAULT_RAMDISK_PATH}" ]; then
die "Failed to unmount ${DEFAULT_RAMDISK_PATH}. Check the permission."
fi
umount ${DEFAULT_RAMDISK_PATH} &>/dev/null
rmdir ${DEFAULT_RAMDISK_PATH} &>/dev/null
}
Expand Down

0 comments on commit 3f1c98c

Please sign in to comment.