Khasim Syed Mohammed | 430d594 | 2021-08-09 21:26:15 +0530 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | # |
| 3 | # Copyright (c) 2021 Arm Limited. All rights reserved. |
| 4 | # |
| 5 | # SPDX-License-Identifier: BSD-3-Clause |
| 6 | # |
| 7 | |
| 8 | # Generate a YAML file in order to dispatch N1SDP runs on LAVA. Note that this |
| 9 | # script would produce a meaningful output when run via. Jenkins |
| 10 | # |
| 11 | # $bin_mode must be set. This script outputs to STDOUT |
| 12 | |
| 13 | ci_root="$(readlink -f "$(dirname "$0")/..")" |
| 14 | source "$ci_root/utils.sh" |
| 15 | source "$ci_root/n1sdp_utils.sh" |
| 16 | |
| 17 | get_recovery_image_url() { |
| 18 | local build_job="tf-build" |
| 19 | local bin_mode="${bin_mode:?}" |
| 20 | |
| 21 | if upon "$jenkins_run"; then |
| 22 | echo "$jenkins_url/job/$JOB_NAME/$BUILD_NUMBER/artifact/artefacts/$bin_mode/n1sdp-board-firmware_primary.zip" |
| 23 | else |
| 24 | echo "file://$workspace/artefacts/$bin_mode/n1sdp-board-firmware_primary.zip" |
| 25 | fi |
| 26 | } |
| 27 | |
| 28 | recovery_img_url="${recovery_img_url:-$(get_recovery_image_url)}" |
| 29 | |
| 30 | cat <<EOF |
| 31 | device_type: n1sdp |
| 32 | job_name: tf-n1sdp |
| 33 | timeouts: |
| 34 | job: |
| 35 | minutes: 30 |
| 36 | |
| 37 | priority: medium |
| 38 | visibility: public |
| 39 | context: |
| 40 | extra_nfsroot_args: ',vers=3' |
| 41 | extra_kernel_args: rootwait |
| 42 | actions: |
| 43 | # |
| 44 | # Any firmware bundle deployed must be configured to boot automatically without |
| 45 | # intervention. This means "PMIC_FORCE" must be set "TRUE" in the config file |
| 46 | # to be deployed. |
| 47 | # |
| 48 | # |
| 49 | # Deploy a firmware bundle with the customised "uefi.bin" installed. This |
| 50 | # enables an EFI network driver, allowing us to force a TFTP boot from GRUB (assuming cobbler is setup) |
| 51 | # |
| 52 | - deploy: |
| 53 | namespace: recovery |
| 54 | to: flasher |
| 55 | images: |
| 56 | recovery_image: |
| 57 | url: http://files.oss.arm.com/downloads/lava/health-checks/n1sdp/4/n1sdp-board-firmware-force-netboot.zip |
| 58 | compression: zip |
| 59 | |
| 60 | - deploy: |
| 61 | namespace: debian |
| 62 | to: tftp |
| 63 | os: debian |
| 64 | kernel: |
| 65 | url: http://files.oss.arm.com/downloads/lava/health-checks/n1sdp/4/debian/linux |
| 66 | type: image |
| 67 | ramdisk: |
| 68 | url: http://files.oss.arm.com/downloads/lava/health-checks/n1sdp/4/debian/ramdisk.img |
| 69 | nfsrootfs: |
| 70 | url: http://files.oss.arm.com/downloads/lava/health-checks/n1sdp/4/debian/debian-buster-arm64-rootfs.tar.xz |
| 71 | compression: xz |
| 72 | |
| 73 | - boot: |
| 74 | namespace: recovery |
| 75 | timeout: |
| 76 | minutes: 3 |
| 77 | method: minimal |
| 78 | parameters: |
| 79 | kernel-start-message: '' |
| 80 | prompts: ['Cmd>'] |
| 81 | |
| 82 | - boot: |
| 83 | namespace: uart1 |
| 84 | method: new_connection |
| 85 | connection: uart1 |
| 86 | |
| 87 | - boot: |
| 88 | namespace: debian |
| 89 | connection-namespace: uart1 |
| 90 | timeout: |
| 91 | minutes: 5 |
| 92 | method: grub |
| 93 | commands: nfs |
| 94 | prompts: |
| 95 | - '/ # ' |
| 96 | |
| 97 | - test: |
| 98 | namespace: debian |
| 99 | timeout: |
| 100 | minutes: 5 |
| 101 | definitions: |
| 102 | - repository: |
| 103 | metadata: |
| 104 | format: Lava-Test Test Definition 1.0 |
| 105 | name: device-network |
| 106 | description: '"Test device network connection"' |
| 107 | os: |
| 108 | - debian |
| 109 | scope: |
| 110 | - functional |
| 111 | run: |
| 112 | steps: |
| 113 | - apt -q update |
| 114 | - apt -q install -y iputils-ping |
sahil | 4621848 | 2022-07-26 12:53:17 +0530 | [diff] [blame] | 115 | - ping -c 5 www.arm.com || lava-test-raise "Device failed to reach a remote host" |
Khasim Syed Mohammed | 430d594 | 2021-08-09 21:26:15 +0530 | [diff] [blame] | 116 | - hostname -I |
| 117 | from: inline |
| 118 | name: device-network |
| 119 | path: inline/device-network.yaml |
| 120 | |
| 121 | - test: |
| 122 | namespace: debian |
| 123 | timeout: |
| 124 | minutes: 5 |
| 125 | definitions: |
| 126 | - repository: |
| 127 | metadata: |
| 128 | format: Lava-Test Test Definition 1.0 |
| 129 | name: install-dependancies |
| 130 | description: '"Install dependancies for secondary media deployment"' |
| 131 | os: |
| 132 | - debian |
| 133 | scope: |
| 134 | - functional |
| 135 | run: |
| 136 | steps: |
| 137 | - apt-get update -q |
Khasim Syed Mohammed | 2c2c834 | 2022-01-29 20:43:33 +0530 | [diff] [blame] | 138 | - apt-get install -qy wget |
Khasim Syed Mohammed | 430d594 | 2021-08-09 21:26:15 +0530 | [diff] [blame] | 139 | from: inline |
| 140 | name: install-dependancies |
| 141 | path: inline/install-dependancies.yaml |
| 142 | |
| 143 | - deploy: |
| 144 | namespace: secondary_media |
| 145 | connection-namespace: uart1 |
| 146 | timeout: |
| 147 | minutes: 10 |
| 148 | to: usb |
Khasim Syed Mohammed | 2c2c834 | 2022-01-29 20:43:33 +0530 | [diff] [blame] | 149 | os: busybox |
Khasim Syed Mohammed | 430d594 | 2021-08-09 21:26:15 +0530 | [diff] [blame] | 150 | images: |
| 151 | image: |
sahil | 4621848 | 2022-07-26 12:53:17 +0530 | [diff] [blame] | 152 | url: "$n1sdp_prebuilts/busybox.img" |
Khasim Syed Mohammed | 430d594 | 2021-08-09 21:26:15 +0530 | [diff] [blame] | 153 | uniquify: false |
| 154 | device: usb_storage_device |
Khasim Syed Mohammed | 2c2c834 | 2022-01-29 20:43:33 +0530 | [diff] [blame] | 155 | download: |
| 156 | tool: /usr/bin/wget |
| 157 | prompt: HTTP request sent, awaiting response |
| 158 | options: --no-check-certificate --no-proxy --connect-timeout=30 -S --progress=dot:giga -O - {DOWNLOAD_URL} |
Khasim Syed Mohammed | 430d594 | 2021-08-09 21:26:15 +0530 | [diff] [blame] | 159 | |
| 160 | # |
| 161 | # Deploy the primary board firmware bundle (this time without the additinal |
| 162 | # network driver). |
| 163 | # |
| 164 | - deploy: |
| 165 | namespace: recovery |
| 166 | to: flasher |
| 167 | images: |
| 168 | recovery_image: |
| 169 | url: $recovery_img_url |
| 170 | compression: zip |
| 171 | |
| 172 | # |
| 173 | # Do not verify the flash second time around as cached serial output on the |
| 174 | # connection will immediately match the prompt. |
| 175 | # |
| 176 | - boot: |
| 177 | namespace: secondary_media |
| 178 | timeout: |
| 179 | minutes: 10 |
| 180 | method: minimal |
Khasim Syed Mohammed | 430d594 | 2021-08-09 21:26:15 +0530 | [diff] [blame] | 181 | prompts: |
Khasim Syed Mohammed | 2c2c834 | 2022-01-29 20:43:33 +0530 | [diff] [blame] | 182 | - '/ #' |
Khasim Syed Mohammed | 430d594 | 2021-08-09 21:26:15 +0530 | [diff] [blame] | 183 | transfer_overlay: |
| 184 | download_command: wget -S |
| 185 | unpack_command: tar -C / -xzf |
| 186 | |
| 187 | - test: |
| 188 | namespace: secondary_media |
| 189 | timeout: |
| 190 | minutes: 5 |
| 191 | definitions: |
| 192 | - repository: |
| 193 | metadata: |
| 194 | format: Lava-Test Test Definition 1.0 |
| 195 | name: linux-console-test-in-deployed-image |
| 196 | description: '"Run LAVA test steps inside the deployed image"' |
| 197 | os: |
| 198 | - oe |
| 199 | scope: |
| 200 | - functional |
| 201 | run: |
| 202 | steps: |
| 203 | - fdisk -l |
| 204 | - ip addr show |
| 205 | - cat /proc/cpuinfo |
| 206 | from: inline |
| 207 | name: linux-console-test |
| 208 | path: inline/linux-console-test.yaml |
| 209 | EOF |