device_type: hi6220-hikey
job_name: "%%JOB_NAME%%-%%ANDROID_META_BUILD%%-boottime"
timeouts:
  job:
    minutes: 90
  action:
    minutes: 15
  connection:
    minutes: 2
priority: high
visibility: public

metadata:
  android.build: "%%ANDROID_META_BUILD%%"
  android.name: "%%ANDROID_META_NAME%%"
  android.url: "%%ANDROID_META_URL%%"
  android.fastboot: "platform-tools_r26.0.0"

protocols:
  lava-lxc:
    name: lxc-hikey-test
    template: ubuntu
    distribution: ubuntu
    release: xenial
    arch: amd64

actions:
- deploy:
    namespace: tlxc
    timeout:
      minutes: 5
    to: lxc
    packages:
    - wget
    - zip
    - unzip
    os: ubuntu

- boot:
    namespace: tlxc
    prompts:
    - 'root@(.*):/#'
    - 'hikey:/'
    - 'console:/'

    timeout:
      minutes: 5
    method: lxc

- test:
    namespace: tlxc
    timeout:
      minutes: 10
    definitions:
    - repository: https://git.linaro.org/qa/test-definitions.git
      from: git
      path: automated/linux/android-platform-tools/install.yaml
      name: install-android-platform-tools-r2600
      parameters:
        LINK: 'https://dl.google.com/android/repository/platform-tools_r26.0.0-linux.zip'

- deploy:
    timeout:
      minutes: 30
    to: fastboot
    namespace: droid
    images:
      ptable:
        reboot: hard-reset
        url: http://releases.linaro.org/96boards/archive/reference-platform/aosp/hikey/16.03/bootloader/ptable-aosp-8g.img
      boot:
        reboot: hard-reset
        url: "%%DOWNLOAD_URL%%/boot.img.xz"
        compression: xz
      cache:
        url: "%%ANDROID_CACHE%%"
        compression: xz
      userdata:
        url: "%%ANDROID_DATA%%"
        compression: xz
      system:
        url: "%%ANDROID_SYSTEM%%"
        compression: xz
    protocols:
      lava-lxc:
      - action: fastboot-deploy
        request: pre-power-command
        timeout:
            minutes: 2

- boot:
    namespace: droid
    prompts:
    - 'root@(.*):/#'
    - 'hikey:/'
    - 'console:/'
    - ':/'
    timeout:
      minutes: 15
    method: fastboot

- test:
      namespace: tlxc
      timeout:
        minutes: 300
      definitions:
        - repository: https://git.linaro.org/qa/test-definitions.git
          from: git
          path: automated/android/boottime/boottime.yaml
          name: first-boot
          params:
            OPERATION: COLLECT
            COLLECT_NO: "0"
        - repository: https://git.linaro.org/qa/test-definitions.git
          from: git
          path: automated/android/boottime/boottime.yaml
          name: boottime-first-analyze
          params:
            OPERATION: ANALYZE
            COLLECT_NO: "0"

- boot:
    namespace: droid
    prompts:
    - 'root@(.*):/#'
    - 'hikey:/'
    - 'console:/'
    - ':/'
    timeout:
      minutes: 15
    method: fastboot

- test:
      namespace: tlxc
      timeout:
        minutes: 300
      definitions:
        - repository: https://git.linaro.org/qa/test-definitions.git
          from: git
          path: automated/android/boottime/boottime.yaml
          name: boottime-1
          params:
            OPERATION: COLLECT
            COLLECT_NO: 1

- boot:
    namespace: droid
    prompts:
    - 'root@(.*):/#'
    - 'hikey:/'
    - 'console:/'
    - ':/'
    timeout:
      minutes: 15
    method: fastboot

- test:
      namespace: tlxc
      timeout:
        minutes: 300
      definitions:
        - repository: https://git.linaro.org/qa/test-definitions.git
          from: git
          path: automated/android/boottime/boottime.yaml
          name: boottime-2
          params:
            OPERATION: COLLECT
            COLLECT_NO: 2

- boot:
    namespace: droid
    prompts:
    - 'root@(.*):/#'
    - 'hikey:/'
    - 'console:/'
    - ':/'
    timeout:
      minutes: 15
    method: fastboot

- test:
      namespace: tlxc
      timeout:
        minutes: 300
      definitions:
        - repository: https://git.linaro.org/qa/test-definitions.git
          from: git
          path: automated/android/boottime/boottime.yaml
          name: boottime-3
          params:
            OPERATION: COLLECT
            COLLECT_NO: 3

- boot:
    namespace: droid
    prompts:
    - 'root@(.*):/#'
    - 'hikey:/'
    - 'console:/'
    - ':/'
    timeout:
      minutes: 15
    method: fastboot

- test:
      namespace: tlxc
      timeout:
        minutes: 300
      definitions:
        - repository: https://git.linaro.org/qa/test-definitions.git
          from: git
          path: automated/android/boottime/boottime.yaml
          name: boottime-4
          params:
            OPERATION: COLLECT
            COLLECT_NO: 4

- boot:
    namespace: droid
    prompts:
    - 'root@(.*):/#'
    - 'hikey:/'
    - 'console:/'
    - ':/'
    timeout:
      minutes: 15
    method: fastboot

- test:
      namespace: tlxc
      timeout:
        minutes: 300
      definitions:
        - repository: https://git.linaro.org/qa/test-definitions.git
          from: git
          path: automated/android/boottime/boottime.yaml
          name: boottime-5
          params:
            OPERATION: COLLECT
            COLLECT_NO: 5

- boot:
    namespace: droid
    prompts:
    - 'root@(.*):/#'
    - 'hikey:/'
    - 'console:/'
    - ':/'
    timeout:
      minutes: 15
    method: fastboot

- test:
      namespace: tlxc
      timeout:
        minutes: 300
      definitions:
        - repository: https://git.linaro.org/qa/test-definitions.git
          from: git
          path: automated/android/boottime/boottime.yaml
          name: boottime-6
          params:
            OPERATION: COLLECT
            COLLECT_NO: 6

- boot:
    namespace: droid
    prompts:
    - 'root@(.*):/#'
    - 'hikey:/'
    - 'console:/'
    - ':/'
    timeout:
      minutes: 15
    method: fastboot

- test:
      namespace: tlxc
      timeout:
        minutes: 300
      definitions:
        - repository: https://git.linaro.org/qa/test-definitions.git
          from: git
          path: automated/android/boottime/boottime.yaml
          name: boottime-7
          params:
            OPERATION: COLLECT
            COLLECT_NO: 7
        - repository: https://git.linaro.org/qa/test-definitions.git
          from: git
          path: automated/android/boottime/boottime.yaml
          name: boottime-second-analyze
          params:
            OPERATION: ANALYZE
            COLLECT_NO: 7

        - repository: https://git.linaro.org/qa/test-definitions.git
          from: git
          path: automated/android/bootchart/bootchart.yaml
          name: bootchart-start
          params:
            OPERATION: start

- boot:
    namespace: droid
    prompts:
    - 'root@(.*):/#'
    - 'hikey:/'
    - 'console:/'
    - ':/'
    timeout:
      minutes: 15
    method: fastboot

- test:
      namespace: tlxc
      timeout:
        minutes: 300
      definitions:
        - repository: https://git.linaro.org/qa/test-definitions.git
          from: git
          path: automated/android/bootchart/bootchart.yaml
          name: bootchart-stop
          params:
            OPERATION: stop
