device_type: hi6220-hikey-r2
tags:
  - static-ip
job_name: hikey-android-enable-adb-over-wired-tcpip
timeouts:
  job:
    minutes: 600
  action:
    minutes: 15
  connection:
    minutes: 2
priority: high
visibility: public
reboot_to_fastboot: false

metadata:
  build: https://developers.google.com/android/images-preview#hikey

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

actions:
- deploy:
    namespace: tlxc
    timeout:
      minutes: 15
    to: lxc
    packages:
    - wget
    - unzip
    os: debian

- boot:
    namespace: tlxc
    prompts:
    - root@(.*):/#
    - :/
    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-latest

- deploy:
    timeout:
      minutes: 15
    to: fastboot
    namespace: droid
    images:
      #ptable:
        #url: file:///images/hikey-3606021/ptable-aosp-8g.img
        #reboot: hard-reset
      boot:
        url: file:///images/hikey-3606021/boot.img
        reboot: hard-reset
      #cache:
        #url: file:///images/hikey-3606021/cache.img
      #userdata:
        #url: file:///images/hikey-3606021/userdata.img
      #system:
        #url: file:///images/hikey-3606021/system.img
        #apply-overlay: true
    os: debian
    protocols:
      lava-lxc:
      - action: fastboot-deploy
        request: pre-power-command
        timeout:
          minutes: 2

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

- test:
    namespace: tlxc
    timeout:
      minutes: 10
    definitions:
    - repository: https://github.com/Linaro/test-definitions
      from: git
      path: automated/android/wait-single-boot-completed.yaml
      name: wait-single-boot-completed
    - repository:
        metadata:
          format: Lava-Test Test Definition 1.0
          name: enable-adb-tcpip
          description: "enable adb over tcpip"
          os:
          - ubuntu
          scope:
          - functional
        run:
          steps:
          - adb devices || true
          - adb tcpip 5555 || lava-test-raise "failed to enable adb over tcpip"
      from: inline
      name: enable-adb-tcpip
      path: inline/enable-adb-tcpip.yaml

- test:
    namespace: tlxc
    timeout:
      minutes: 10
    protocols:
      lava-lxc:
      - action: lava-test-shell
        request: pre-os-command
        timeout:
          minutes: 2
    definitions:
    - repository:
        metadata:
          format: Lava-Test Test Definition 1.0
          name: test-adb-tcpip
          description: "test adb over tcpip"
          os:
          - ubuntu
          scope:
          - functional
        run:
          steps:
          - sleep 15
          - adb connect $(lava-target-ip) || lava-test-raise "failed to enable adb over tcpip"
          - adb devices
          - adb -s $(lava-target-ip):5555 shell echo ok
      from: inline
      name: test-adb-tcpip
      path: inline/test-adb-tcpip.yaml

