context:
  test_character_delay: 10

device_type: hi6220-hikey
job_name: armv8-ilp32-ltp-${TESTNAME}-${BUILD_NUMBER}
timeouts:
  job:
    minutes: 60
  action:
    minutes: 10
  connection:
    minutes: 2
priority: medium
visibility: public

# run udhcpc in the test shell before accessing the internet

metadata:
  build-location: ${PUBLISH_SERVER}/${PUB_DEST}
  series: ilp32

protocols:
  lava-lxc:
    name: lxc-hikey-oe
    template: debian
    distribution: debian
    release: jessie
    arch: amd64
    mirror: http://deb.debian.org/debian

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

- boot:
    namespace: tlxc
    prompts:
    - 'root@(.*):/#'
    - 'hikey:/'
    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: 15
    to: fastboot
    namespace: hikey-oe
    connection: lxc
    images:
      ptable:
        url: http://releases.linaro.org/reference-platform/embedded/hikey/16.12/rpb/bootloader/ptable-linux-8g.img
        reboot: hard-reset
      boot:
        url: ${BOOT_URL}
        reboot: hard-reset
      system:
        url: ${SYSTEM_URL}
        compression: gz
        apply-overlay: true
        # ensure that this job raises a network interface with DHCP before relying on internet access
    os: oe
    protocols:
      lava-lxc:
      - action: fastboot-deploy
        request: pre-power-command
        timeout:
          minutes: 2

- boot:
    namespace: hikey-oe
    auto_login:
      login_prompt: 'login:'
      username: linaro
      login_commands:
        # Become super user to run tests
        - su
    prompts:
    - 'hikey:~'
    - 'root@(.*):(.*)#'
    timeout:
      minutes: 5
    method: uefi-menu
    commands: fastboot
    protocols:
      lava-lxc:
      # other action could be boot-fastboot
      - action: uefi-commands
        request: pre-os-command
        timeout:
          minutes: 2
- test:
    namespace: hikey-oe
    timeout:
      minutes: 60
    definitions:
    - from: inline
      repository:
        metadata:
          format: Lava-Test Test Definition 1.0
          name: prep-tests
          description: "Device preparation"
        run:
          steps:
          # the image does not raise the interface itself
          # force a DHCP request to avoid avahi using a zero conf address.
          - udhcpc
          - netstat
          - ip a
          - ifconfig
          - df
          - cat /sys/class/thermal/thermal_zone0/policy || true
          - echo "power_allocator" > /sys/class/thermal/thermal_zone0/policy || true
          - cat /sys/class/thermal/thermal_zone0/policy || true
          - cat /sys/devices/system/cpu/cpufreq/policy0/scaling_available_frequencies  | awk '{ print $(NF-1) }'  > /sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq
          - cat /sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq || true
      name: prep-inline
      path: inline/prep.yaml
    - repository: git://git.linaro.org/qa/test-definitions.git
      from: git
      path: automated/linux/ltp/ltp.yaml
      parameters:
        SKIP_INSTALL: 'true'
        TST_CMDFILES: '${TESTNAME}'
        SKIPFILE: 'skipfile-lkft.yaml'
        BOARD: hi6220-hikey
        TIMEOUT_MULTIPLIER: 3
      name: ltp-${TESTNAME}-tests
      timeout:
        minutes: 60
