metadata:
    name: kselftest-chroot
    format: "Lava-Test Test Definition 1.0"
    description: "Run a chroot"
    maintainer:
        - anders.roxell@linaro.org
        - chase.qi@linaro.org
    os:
        - OE
    scope:
        - functional
    devices:
        - qemu-arm64
params:
    #Parameters that is here for the chroot
    NEW_ROOTFS: https://snapshots.linaro.org/openembedded/lkft/lkft/rocko/am57xx-evm/lkft/linux-next/441/rpb-console-image-lkft-am57xx-evm-20190115034131-441.rootfs.tar.xz
    TEST_SUITE: kselftest

run:
    steps:
        - df -h
        - pwd
        - TESTDEF_URL=$(pwd)
        - cd ./automated/linux/chroot
        - ./download_and_mount.sh ${NEW_ROOTFS}
        - . ./pre_setup_run.sh ${TEST_SUITE} ${TESTDEF_URL}
        - |
          # overwrite default params.
          cat << EOF >> /new_root/run.sh
          KSELFTEST_PATH=$KSELFTEST_PATH
          SKIPFILE=$SKIPFILE
          BOARD=$BOARD
          BRANCH=$BRANCH
          ENVIRONMENT=$ENVIRONMENT
          SKIP_INSTALL=$SKIP_INSTALL
          EOF
        - . ./post_setup_run.sh ${TEST_SUITE}
        - cat /new_root/run.sh
        - chroot /new_root /bin/bash /run.sh

parse:
    pattern: "^selftests:\\s(?P<test_case_id>\\S+)\\s[[](?P<result>(FAIL|PASS|SKIP))[]]"
    fixupdict:
        FAIL: fail
        PASS: pass
        SKIP: skip
