timeouts:
  job:
    minutes: 140
  connection:
    minutes: 2
  actions:
    finalize:
      seconds: 60
context:
  test_character_delay: 10
device_type: dragonboard-845c
job_name: linaro-test-definitions-validation
priority: medium
visibility: public
protocols:
  lava-lxc:
    name: lxc-target
    template: debian
    distribution: debian
    release: stretch
    arch: amd64
    mirror: http://deb.debian.org/debian
actions:
- deploy:
    namespace: tlxc
    timeout:
      minutes: 15
    to: lxc
    packages:
    - wget
    - unzip
    - img2simg
    - simg2img
    - e2fsprogs
    - gzip
    - cpio
    - git
    - mktemp
    - abootimg
    os: debian
- boot:
    namespace: tlxc
    prompts:
    - root@(.*):/#
    timeout:
      minutes: 5
    method: lxc
- test:
    namespace: tlxc
    timeout:
      minutes: 10
    definitions:
    - repository: https://github.com/Linaro/test-definitions.git
      from: git
      path: automated/linux/android-platform-tools/install.yaml
      name: install-android-platform-tools-r2905
      parameters:
        LINK: https://dl.google.com/android/repository/platform-tools_r29.0.5-linux.zip
- deploy:
    timeout:
      minutes: 40
    to: download
    namespace: target
    images:
      boot:
        url: https://snapshots.linaro.org/96boards/dragonboard845c/linaro/debian/389/boot-linaro-sid-dragonboard-845c-389.img.gz
        compression: gz
      partition:0:
        url: https://images.validation.linaro.org/snapshots.linaro.org/96boards/dragonboard845c/linaro/rescue/28/dragonboard-845c-bootloader-ufs-linux-28/gpt_both0.bin
      rootfs:
        url: https://snapshots.linaro.org/96boards/dragonboard845c/linaro/debian/389/linaro-sid-gnome-dragonboard-845c-389.img.gz
        compression: gz
    os: debian
- test:
    namespace: tlxc
    timeout:
      minutes: 30
    definitions:
    - from: inline
      name: resize-rootfs
      path: inline/resize-rootfs.yaml
      repository:
        metadata:
          description: resize rootfs image for test overlay
          format: Lava-Test Test Definition 1.0
          name: resize-rootfs
        run:
          steps:
          - cd /lava-lxc
          - overlay_file=/lava-lxc/overlays/target/overlay.tar.gz
          - overlay_size=$(gzip -l $overlay_file | tail -1 | awk '{print $2}')
          - overlay_size=$(( $overlay_size / 1024 ))
          - simg2img linaro-sid-gnome-dragonboard-845c-389.img linaro-sid-gnome-dragonboard-845c-389.img.ext4
          - free_blocks=$(dumpe2fs -h linaro-sid-gnome-dragonboard-845c-389.img.ext4
            | grep "Free blocks" | awk '{print $3}')
          - block_size=$(dumpe2fs -h linaro-sid-gnome-dragonboard-845c-389.img.ext4
            | grep "Block size" | awk '{print $3}')
          - free_size=$(( $block_size * $free_blocks / 1024 ))
          - if [ "$free_size" -lt "$overlay_size" ]; then
          - block_count=$(dumpe2fs -h linaro-sid-gnome-dragonboard-845c-389.img.ext4
            | grep "Block count" | awk '{print $3}')
          - current_size=$(( $block_size * $block_count / 1024 ))
          - extra_size=32768
          - final_size=$(( $current_size + $overlay_size + $extra_size ))
          - fsck_code=$(e2fsck -y -f linaro-sid-gnome-dragonboard-845c-389.img.ext4)
          - resize2fs linaro-sid-gnome-dragonboard-845c-389.img.ext4 "$final_size"K
          - img2simg linaro-sid-gnome-dragonboard-845c-389.img.ext4 linaro-sid-gnome-dragonboard-845c-389.img
          - lava-test-case "resize_rootfs" --result "pass"
          - else
          - lava-test-case "resize_rootfs" --result "skip"
          - fi
- deploy:
    timeout:
      minutes: 40
    to: fastboot
    namespace: target
    images:
      boot:
        url: lxc:///boot-linaro-sid-dragonboard-845c-389.img
      partition:0:
        url: lxc:///gpt_both0.bin
      rootfs:
        url: lxc:///linaro-sid-gnome-dragonboard-845c-389.img
        apply-overlay: true
    os: debian
    protocols:
      lava-lxc:
      - action: fastboot-deploy
        request: pre-power-command
        timeout:
          minutes: 2
- boot:
    namespace: target
    auto_login:
      login_prompt: 'login:'
      username: root
    prompts:
    - root@(.*):[/~]#
    - root@linaro-gnome:~#
    timeout:
      minutes: 15
    method: fastboot
    commands:
    - oem select-display-panel none
    - reboot
    protocols:
      lava-lxc:
      - action: auto-login-action
        request: pre-os-command
        timeout:
          minutes: 2
- test:
    namespace: target
    timeout:
      minutes: 120
    definitions:
    - name: memtester
      from: git
      history: false
      repository: https://github.com/Linaro/test-definitions
      path: automated/linux/memtester/memtester.yaml
    - name: apache-apache-bench
      from: git
      history: false
      repository: https://github.com/Linaro/test-definitions
      path: automated/linux/apache-apache-bench/apache-bench.yaml
    - name: blogbench
      from: git
      history: false
      repository: https://github.com/Linaro/test-definitions
      path: automated/linux/blogbench/blogbench.yaml
    - repository: https://git.linaro.org/qa/test-definitions.git
      from: git
      path: automated/linux/cyclictest/cyclictest.yaml
      name: cyclictest
    - repository: https://git.linaro.org/qa/test-definitions.git
      from: git
      path: automated/linux/cyclicdeadline/cyclicdeadline.yaml
      name: cyclicdeadline
    - repository: https://git.linaro.org/qa/test-definitions.git
      from: git
      path: automated/linux/fio-test/fio-test.yaml
      name: fio-test
