# SPDX-License-Identifier: GPL-2.0-only
# Copyright (C) 2021 Foundries.io
metadata:
    format: Lava-Test Test Definition 1.0
    name: ota-rollback-download
    description: "Download OTA update and corrupt
    kernel or uboot to force rollback."

    maintainer:
        - milosz.wasilewski@foundries.io
    os:
        - openembedded
    scope:
        - functional

    devices:
        - imx8mm
        - imx6ull

params:
        UBOOT_VAR_TOOL: "fw_printenv"
        UBOOT_VAR_SET_TOOL: "fw_setenv"
        UBOOT_IMAGE_NAME: "u-boot.itb"
        TYPE: "kernel"
        PACMAN_TYPE: "ostree+compose_apps"
        DEBUG: "false"
run:
    steps:
        - cd ./automated/linux/ota-rollback
        - ./download-update.sh -t "${TYPE}" -u "${UBOOT_VAR_TOOL}" -s "${UBOOT_VAR_SET_TOOL}" -o "${PACMAN_TYPE}" -f "${UBOOT_IMAGE_NAME}" -d "${DEBUG}"
        - ../../utils/send-to-lava.sh ./output/result.txt
