Check if all required partitions are present 39/181839/1
authorAleksander Mistewicz <a.mistewicz@samsung.com>
Tue, 26 Sep 2017 13:13:20 +0000 (15:13 +0200)
committerAleksander Mistewicz <a.mistewicz@samsung.com>
Mon, 16 Oct 2017 11:21:47 +0000 (13:21 +0200)
Very often some partition were missing or were replaced with regular
files. It caused system to write to disk instead of sdcard.

Change-Id: Ie2c6b975d01cb2628b04d593294ac5314e80a2ca

tct/artik_prepare_flash_conf.sh
tct/flash/flash.sh
tct/odroid_prepare_flash_conf.sh
tct/rpi3_prepare_flash_conf.sh

index 7b8483c..2d74a8c 100755 (executable)
@@ -80,6 +80,8 @@ echo "### flash ###"
 UUID_FILE="/var/tmp/uuid-${SDMUX}"
 DEV_SDCARD=$(uuid2dev "${UUID_FILE}" "${SDMUX}") || die "sdcard not found!"
 
+check_parts "$DEV_SDCARD" 1 2 3 5 6
+
 "${ARTIK_FLASH_SCRIPT}" -d "${DEV_SDCARD}" -m "${MODEL}" -p "${TMP_TAR}"
 RET=$?
 
index 542763b..85323a1 100755 (executable)
@@ -1,4 +1,4 @@
-# Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+# Copyright (c) 2016-2017 Samsung Electronics Co., Ltd All Rights Reserved
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -60,6 +60,19 @@ uuid2dev() {
     echo "/dev/${DEV%[0-9]}"
 }
 
+check_parts() {
+    test $# -ge 2 || die "Too few arguments!"
+    DEVICE="$1"
+    test -b "${DEVICE}" || die "No such device!"
+    shift
+
+    while [ $# -ge 1 ]; do
+        PART="$1"
+        test -b "${DEVICE}${PART}" || die "Missing partition: $PART of $DEVICE"
+        shift
+    done
+}
+
 change_uuid() {
     FILE="$1"
     DEV_SDCARD="$2"
index 03bfd23..2da5933 100755 (executable)
@@ -62,6 +62,8 @@ echo "### flash ###"
 UUID_FILE="/var/tmp/uuid-${SDMUX}"
 DEV_SDCARD=$(uuid2dev "${UUID_FILE}" "${SDMUX}") || die "sdcard not found!"
 
+check_parts "$DEV_SDCARD" 1 2 3 5 6
+
 cd "${IMAGE_UNPACKED}"
 "${TESTLAB_SCRIPTS}/flash/flash_dd.sh" "${DEV_SDCARD}"
 RET=$?
index 92916d0..44520af 100755 (executable)
@@ -53,9 +53,11 @@ DEV_SDCARD=$(uuid2dev "${UUID_FILE}" "${SDMUX}") || die "sdcard not found!"
 cd "${IMAGE_UNPACKED}"
 case "$IMAGE" in
     *2parts*)
+        check_parts "$DEV_SDCARD" 1 2 3 6
         "${TESTLAB_SCRIPTS}/flash/flash_dd_rpi3-2parts.sh" "${DEV_SDCARD}"
         ;;
     *)
+        check_parts "$DEV_SDCARD" 1 2 3 5 6
         "${TESTLAB_SCRIPTS}/flash/flash_dd_rpi3.sh" "${DEV_SDCARD}"
         ;;
 esac