|
| 1 | +job_queue: $JOB_QUEUE |
| 2 | +global_timeout: 3600 |
| 3 | +output_timeout: 1800 |
| 4 | +provision_data: |
| 5 | + distro: $DISTRO |
| 6 | + |
| 7 | +test_data: |
| 8 | + test_cmds: | |
| 9 | + #!/bin/bash |
| 10 | +
|
| 11 | + set -xeuo pipefail |
| 12 | +
|
| 13 | + # This is used, along with DEVICE_IP, by all scriptlets to access the device |
| 14 | + export DEVICE_USER="ubuntu" |
| 15 | +
|
| 16 | + # retrieve the tools installer |
| 17 | + curl -Ls -o install_tools.sh https://raw.githubusercontent.com/canonical/hwcert-jenkins-tools/main/install_tools.sh |
| 18 | +
|
| 19 | + # install the scriptlets and other tools on the agent and the device, as necessary |
| 20 | + export TOOLS_PATH=tools |
| 21 | + source install_tools.sh $TOOLS_PATH |
| 22 | +
|
| 23 | + # ensure device is available before continuing |
| 24 | + wait_for_ssh --allow-degraded |
| 25 | +
|
| 26 | + # Wait for snapd to become available |
| 27 | + retry -- _run "timeout 5 sudo snap wait system seed.loaded" |
| 28 | + wait_for_snap_changes |
| 29 | +
|
| 30 | + # Install AMD GPU drivers and utilities |
| 31 | + _run install_packages mesa-utils libdrm-amdgpu1 radeontop |
| 32 | +
|
| 33 | + # Show kernel boot arguments for debugging |
| 34 | + _run cat /proc/cmdline |
| 35 | +
|
| 36 | + # verify that AMD GPU devices are available |
| 37 | + _run lspci -k | grep -A 3 -i "vga\|display\|3d" |
| 38 | + _run ls -la /dev/dri/ |
| 39 | + _run ls -la /dev/kfd |
| 40 | +
|
| 41 | + # LXD working |
| 42 | + _run sudo snap install lxd --channel=$SNAP_CHANNEL --no-wait |
| 43 | + wait_for_snap_changes |
| 44 | +
|
| 45 | + _run sudo lxd init --auto |
| 46 | + _run sudo usermod -G lxd ubuntu |
| 47 | +
|
| 48 | + _run lxc init ubuntu:noble c1 & |
| 49 | + for i in $( seq 1 60 ); do |
| 50 | + [ $i -lt 60 ] |
| 51 | + _run lxc config device add c1 gpu0 gpu id=amd.com/gpu=0 && break || /bin/true |
| 52 | + sleep 1 |
| 53 | + done |
| 54 | +
|
| 55 | + _run lxc start c1 |
| 56 | +
|
| 57 | + # print out all mounts we have so we can compare it later if anything goes wrong |
| 58 | + _run lxc exec c1 -- cat /proc/self/mountinfo |
| 59 | +
|
| 60 | + # check that AMD devices are accessible in the container |
| 61 | + _run lxc exec c1 -- ls -la /dev/dri/ |
| 62 | + _run lxc exec c1 -- ls -la /dev/kfd |
| 63 | +
|
| 64 | + # Verify that card and renderD devices exist |
| 65 | + _run lxc exec c1 -- test -e /dev/dri/card0 |
| 66 | + _run lxc exec c1 -- test -e /dev/dri/renderD128 |
| 67 | +
|
| 68 | + # Check that KFD device is accessible |
| 69 | + _run lxc exec c1 -- test -c /dev/kfd |
0 commit comments