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 |
| 115 | - ping -c 5 10.6.43.131 || lava-test-raise "Device failed to reach a remote host" |
| 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 |
| 138 | - apt-get install -qy bmap-tools |
| 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 |
| 149 | os: oe |
| 150 | images: |
| 151 | image: |
| 152 | url: http://files.oss.arm.com/downloads/lava/health-checks/n1sdp/4/secondary/core-image-minimal-n1sdp.wic.gz |
| 153 | compression: gz |
| 154 | bmap: |
| 155 | url: http://files.oss.arm.com/downloads/lava/health-checks/n1sdp/4/secondary/core-image-minimal-n1sdp.wic.bmap |
| 156 | uniquify: false |
| 157 | device: usb_storage_device |
| 158 | writer: |
| 159 | tool: /usr/bin/bmaptool |
| 160 | options: copy {DOWNLOAD_URL} {DEVICE} |
| 161 | prompt: 'bmaptool: info' |
| 162 | tool: |
| 163 | prompts: ['copying time: [0-9ms\.\ ]+, copying speed [0-9\.]+ MiB\/sec'] |
| 164 | |
| 165 | # |
| 166 | # Deploy the primary board firmware bundle (this time without the additinal |
| 167 | # network driver). |
| 168 | # |
| 169 | - deploy: |
| 170 | namespace: recovery |
| 171 | to: flasher |
| 172 | images: |
| 173 | recovery_image: |
| 174 | url: $recovery_img_url |
| 175 | compression: zip |
| 176 | |
| 177 | # |
| 178 | # Do not verify the flash second time around as cached serial output on the |
| 179 | # connection will immediately match the prompt. |
| 180 | # |
| 181 | - boot: |
| 182 | namespace: secondary_media |
| 183 | timeout: |
| 184 | minutes: 10 |
| 185 | method: minimal |
| 186 | auto_login: |
| 187 | login_prompt: '(.*)login:' |
| 188 | username: root |
| 189 | prompts: |
| 190 | - 'root@(.*):~#' |
| 191 | transfer_overlay: |
| 192 | download_command: wget -S |
| 193 | unpack_command: tar -C / -xzf |
| 194 | |
| 195 | - test: |
| 196 | namespace: secondary_media |
| 197 | timeout: |
| 198 | minutes: 5 |
| 199 | definitions: |
| 200 | - repository: |
| 201 | metadata: |
| 202 | format: Lava-Test Test Definition 1.0 |
| 203 | name: linux-console-test-in-deployed-image |
| 204 | description: '"Run LAVA test steps inside the deployed image"' |
| 205 | os: |
| 206 | - oe |
| 207 | scope: |
| 208 | - functional |
| 209 | run: |
| 210 | steps: |
| 211 | - fdisk -l |
| 212 | - ip addr show |
| 213 | - cat /proc/cpuinfo |
| 214 | from: inline |
| 215 | name: linux-console-test |
| 216 | path: inline/linux-console-test.yaml |
| 217 | EOF |