Zelalem | 1af7a7b | 2020-08-04 17:34:32 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Copyright (c) 2019, Arm Limited. All rights reserved. |
| 4 | # |
| 5 | # SPDX-License-Identifier: BSD-3-Clause |
| 6 | # |
| 7 | |
| 8 | # Generate a YAML file in order to dispatch Juno runs on LAVA. |
| 9 | # This file will boot Linux, reboot Linux, and then wait for the shell prompt |
| 10 | # to declare the test as a pass after the successful reboot. Note that this |
| 11 | # script would produce a meaningful output when run via. Jenkins |
| 12 | # |
| 13 | # $bin_mode must be set. This script outputs to STDOUT |
| 14 | |
| 15 | ci_root="$(readlink -f "$(dirname "$0")/..")" |
| 16 | source "$ci_root/utils.sh" |
| 17 | source "$ci_root/juno_utils.sh" |
| 18 | |
| 19 | get_recovery_image_url() { |
| 20 | local build_job="tf-build" |
| 21 | local bin_mode="${bin_mode:?}" |
| 22 | |
| 23 | if upon "$jenkins_run"; then |
| 24 | echo "$jenkins_url/job/$JOB_NAME/$BUILD_NUMBER/artifact/artefacts/$bin_mode/juno_recovery.zip" |
| 25 | else |
| 26 | echo "file://$workspace/artefacts/$bin_mode/juno_recovery.zip" |
| 27 | fi |
| 28 | } |
| 29 | |
| 30 | bootloader_prompt="${bootloader_prompt:-juno#}" |
| 31 | juno_revision="${juno_revision:-juno-r0}" |
| 32 | recovery_img_url="${recovery_img_url:-$(get_recovery_image_url)}" |
| 33 | nfs_rootfs="${nfs_rootfs:-$juno_rootfs_url}" |
| 34 | linux_prompt="${linux_prompt:-root@(.*):~#}" |
| 35 | os="${os:-debian}" |
| 36 | |
| 37 | cat <<EOF |
| 38 | device_type: juno |
| 39 | job_name: tf-juno |
| 40 | |
| 41 | context: |
| 42 | bootloader_prompt: $bootloader_prompt |
| 43 | |
| 44 | tags: |
| 45 | - $juno_revision |
| 46 | |
| 47 | timeouts: |
| 48 | # Global timeout value for the whole job. |
| 49 | job: |
| 50 | minutes: 30 |
| 51 | # Unless explicitly overridden, no single action should take more than |
| 52 | # 10 minutes to complete. |
| 53 | action: |
| 54 | minutes: 10 |
| 55 | |
| 56 | priority: medium |
| 57 | visibility: public |
| 58 | |
| 59 | actions: |
| 60 | |
| 61 | - deploy: |
| 62 | namespace: recovery |
| 63 | to: vemsd |
| 64 | recovery_image: |
| 65 | url: $recovery_img_url |
| 66 | compression: zip |
| 67 | |
| 68 | - deploy: |
| 69 | namespace: target |
| 70 | to: nfs |
| 71 | os: $os |
| 72 | nfsrootfs: |
| 73 | url: $nfs_rootfs |
| 74 | compression: gz |
| 75 | |
| 76 | - boot: |
| 77 | # Drastically increase the timeout for the boot action because of the udev |
| 78 | # issues when using TF build config "juno-all-cpu-reset-ops". |
| 79 | # TODO: Should increase the timeout only for this TF build config, not all! |
| 80 | timeout: |
| 81 | minutes: 15 |
| 82 | namespace: target |
| 83 | connection-namespace: recovery |
| 84 | method: u-boot |
| 85 | commands: norflash |
| 86 | auto-login: |
| 87 | login_prompt: 'login:' |
| 88 | username: root |
| 89 | prompts: |
| 90 | - $linux_prompt |
| 91 | |
| 92 | - test: |
| 93 | namespace: target |
| 94 | timeout: |
| 95 | minutes: 10 |
| 96 | definitions: |
| 97 | - repository: |
| 98 | metadata: |
| 99 | format: Lava-Test Test Definition 1.0 |
| 100 | name: container-test-run |
| 101 | description: '"Prepare system..."' |
| 102 | os: |
| 103 | - $os |
| 104 | scope: |
| 105 | - functional |
| 106 | run: |
| 107 | steps: |
| 108 | - echo "Rebooting..." |
| 109 | from: inline |
| 110 | name: target-configure |
| 111 | path: inline/target-configure.yaml |
| 112 | |
| 113 | - boot: |
| 114 | timeout: |
| 115 | minutes: 15 |
| 116 | namespace: target |
| 117 | connection-namespace: recovery |
| 118 | method: u-boot |
| 119 | commands: norflash |
| 120 | auto-login: |
| 121 | login_prompt: 'login:' |
| 122 | username: root |
| 123 | prompts: |
| 124 | - $linux_prompt |
| 125 | EOF |