Do not try to test target if flash failed 22/121922/1
authorAleksander Mistewicz <a.mistewicz@samsung.com>
Tue, 10 Jan 2017 10:38:49 +0000 (11:38 +0100)
committerAleksander Mistewicz <a.mistewicz@samsung.com>
Wed, 29 Mar 2017 10:48:09 +0000 (12:48 +0200)
Change-Id: If6566029affbbcba4013858cdbf7e2e9109a2f7b
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
tsp/scripts/common_prep_flash_conf.sh

index 066139b..880922d 100755 (executable)
@@ -66,17 +66,40 @@ fi
 
 echo "sdmux allocated: ${SDMUX}"
 
+clean() {
+    case "$TARGET" in
+        *odroid*|*artik*)
+            rm -v "$USR_IMG" "$BOOT_IMG"
+            ;;
+        *minnow*)
+            rm -v "$USR_IMG" "$USR_IMG_BMAP"
+            ;;
+        *mbr64*)
+            rm -v "$USR_IMG" "$KERNEL" tizen-common.img
+            ;;
+    esac
+}
+
+failed() {
+    echo "$1"
+    echo "FAILED 1" >> sysctl.result
+    python "${TESTLAB_MAJOR}/tct/resource_locking.py" --unlockfailed "${SDMUX}"
+    echo "$(date): ${SDMUX}" >> "${FAILED_DEVICE_LOG}"
+    clean
+    exit 1
+}
+
 case "$TARGET" in
     *odroid*)
-        "${TESTLAB_MAJOR}/tct/odroid_prepare_flash_conf.sh" "$SDMUX" "$USR_IMG" "$BOOT_IMG"
+        "${TESTLAB_MAJOR}/tct/odroid_prepare_flash_conf.sh" "$SDMUX" "$USR_IMG" "$BOOT_IMG" || failed "Flash failed"
         "${TESTLAB_MAJOR}/tct/odroid_run.sh" "$SDMUX"
         ;;
     *artik*)
-        "${TESTLAB_MAJOR}/tct/artik_prepare_flash_conf.sh" "$SDMUX" "$USR_IMG" "$BOOT_IMG"
+        "${TESTLAB_MAJOR}/tct/artik_prepare_flash_conf.sh" "$SDMUX" "$USR_IMG" "$BOOT_IMG" || failed "Flash failed"
         "${TESTLAB_MAJOR}/tct/odroid_run.sh" "$SDMUX"
         ;;
     *minnow*)
-        "${TESTLAB_MAJOR}/tct/minnow_prepare_flash_conf.sh" "$SDMUX" "$USR_IMG"
+        "${TESTLAB_MAJOR}/tct/minnow_prepare_flash_conf.sh" "$SDMUX" "$USR_IMG" || failed "Flash failed"
         "${TESTLAB_MAJOR}/tct/minnow_run.sh" "$SDMUX"
         ;;
     *mbr64*)
@@ -96,9 +119,7 @@ esac
 
 if grep -q "Testing failed." sysctl.result
 then
-    echo "FAILED 1" >> sysctl.result
-    python "${TESTLAB_MAJOR}/tct/resource_locking.py" --unlockfailed "${SDMUX}"
-    echo "$(date): ${SDMUX}" >> "${FAILED_DEVICE_LOG}"
+    failed "Testing failed"
 else
     echo "FAILED 0" >> sysctl.result
     python "${TESTLAB_MAJOR}/tct/resource_locking.py" --unlock "${SDMUX}"
@@ -106,14 +127,4 @@ fi
 
 echo "sdmux used: ${SDMUX}" >> sysctl.result
 
-case "$TARGET" in
-    *odroid*|*artik*)
-        rm -v "$USR_IMG" "$BOOT_IMG"
-        ;;
-    *minnow*)
-        rm -v "$USR_IMG" "$USR_IMG_BMAP"
-        ;;
-    *mbr64*)
-        rm -v "$USR_IMG" "$KERNEL" tizen-common.img
-        ;;
-esac
+clean