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*)
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}"
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