summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPawel Wieczorek <p.wieczorek2@samsung.com>2018-11-22 12:23:21 +0100
committerPawel Wieczorek <p.wieczorek2@samsung.com>2018-11-22 12:47:16 +0100
commitfe8227aa0a052aa03939ccac6d06131791c0605e (patch)
tree8e1b263d59f3ec993060fb3fd581946e66085204
parent9e631a057ed6439ae099d71626703c80dbef2dab (diff)
downloadhost-fe8227aa0a052aa03939ccac6d06131791c0605e.tar.gz
host-fe8227aa0a052aa03939ccac6d06131791c0605e.tar.bz2
host-fe8227aa0a052aa03939ccac6d06131791c0605e.zip
Add UUID healthcheck alias
Change-Id: I8a544e38c2c6c2b22899a0d350bff493629d2558 Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
-rw-r--r--util/aliases33
1 files changed, 33 insertions, 0 deletions
diff --git a/util/aliases b/util/aliases
index 23dc107..683f9da 100644
--- a/util/aliases
+++ b/util/aliases
@@ -4,6 +4,7 @@
. /opt/testlab-major/tsp/common.sh
export TARGET_LIST="$(sd-mux-ctrl --list | awk '/^Dev/ {sub(/_.*,/, "", $6); print $6}' | sort -u)"
+export DEVICES_LIST="$(sd-mux-ctrl --list | awk '/^Dev/ {sub(/,/, "", $6); print $6}')"
# hurry makes requested task from given target queue urgent, i.e. moves it to
# the front of said queue; it takes two mandatory arguments:
@@ -79,3 +80,35 @@ exit_maintenance() {
done
echo "Remember to increase slot sizes!"
}
+
+# get_uuid retrieves UUID of second partition for a device; it assumes there
+# is exactly one device available at the time of its call
+#
+# following might seem hard to read due to glueing single quoted strings with
+# actual single quotation marks in double quotes, but it's worth it - this way
+# neither alias not AWK script won't be interpreted prior execution
+alias get_uuid='ls -la /dev/disk/by-uuid/ | awk '"'"'/2$/ {print $(NF-2)}'"'"
+
+# set_uuid writes actual UUID of second partition for requested device to file
+# used by testlab-major to identify block devices; it takes one mandatory
+# argument:
+# - device name
+set_uuid() {
+ local device="$1"
+ test -n "$device" || echo "Missing argument: device"
+ sd-mux-ctrl -e "$device" -s
+ get_uuid > "/var/tmp/uuid-${device}"
+}
+
+# uuid_healthcheck checks if there are mismatches between files used by
+# testlab-major to identify block devices and actual UUIDs for corresponding
+# devices
+uuid_healthcheck() {
+ for device in ${DEVICES_LIST}; do
+ echo "$device"
+ sd-mux-ctrl -e "$device" -s
+ sleep 20 # TODO: implement device detection
+ get_uuid | diff -s "/var/tmp/uuid-${device}" - || true # ignore non-zero status if difference is found
+ sd-mux-ctrl -e "$device" -d
+ done
+}