Update smoke tests utilities

according to recent changes

Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>
This commit is contained in:
Slawomir Jankowski
2020-12-07 16:56:27 +01:00
committed by Robert Baldyga
parent 031a37a041
commit 0d9a56b4f0
5 changed files with 49 additions and 30 deletions

View File

@@ -30,6 +30,21 @@ check_if_root_or_exit() {
fi
}
resolve_path() {
local BY_ID_DIR="/dev/disk/by-id"
local BY_ID_LINKS=$(ls $BY_ID_DIR)
for BY_ID_PATH in $BY_ID_LINKS
do
FULL_PATH="${BY_ID_DIR}/${BY_ID_PATH}"
if [[ "$(realpath $FULL_PATH)" -ef "$(realpath $DEVICE)" ]]
then
DEVICE=$FULL_PATH
break
fi
done
}
parse_args() {
while [ -n "$1" ] ; do
@@ -51,10 +66,14 @@ parse_args() {
-i | --ignore ) export IGNORE_WARNINGS="1"
;;
-c | --cache ) shift
CACHE_DEVICE="$1"
DEVICE="$1"
resolve_path
CACHE_DEVICE=$DEVICE
;;
-d | --core ) shift
CORE_DEVICE="$1"
DEVICE="$1"
resolve_path
CORE_DEVICE=$DEVICE
;;
* ) echo "Unrecognized option"
usage