From d68dea45f1b6aa2ec2ec7c89021644f9e6ef7e46 Mon Sep 17 00:00:00 2001 From: Zygmunt Krynicki Date: Tue, 10 Jun 2025 08:06:19 +0200 Subject: [PATCH 1/2] ci: add emulated USB devices for lsusb profile test With this lsusb sees a non-empty emulated bus and the test is successful. ``` zyga@x13:~/apparmor$ spread garden:ubuntu-cloud-24.04:tests/profiles/lsusb 2025-06-10 08:01:13 Project content is packed for delivery (6.93MB). 2025-06-10 08:01:13 If killed, discard servers with: spread -reuse-pid=290633 -discard 2025-06-10 08:01:13 Allocating garden:ubuntu-cloud-24.04... 2025-06-10 08:03:25 Waiting for garden:ubuntu-cloud-24.04 to make SSH available at localhost:5000... 2025-06-10 08:03:25 Allocated garden:ubuntu-cloud-24.04. 2025-06-10 08:03:25 Connecting to garden:ubuntu-cloud-24.04... 2025-06-10 08:03:32 Connected to garden:ubuntu-cloud-24.04 at localhost:5000. 2025-06-10 08:03:32 Sending project content to garden:ubuntu-cloud-24.04... 2025-06-10 08:03:34 Preparing garden:ubuntu-cloud-24.04 (garden:ubuntu-cloud-24.04)... 2025-06-10 08:04:26 Preparing garden:ubuntu-cloud-24.04:tests/profiles/lsusb (garden:ubuntu-cloud-24.04)... 2025-06-10 08:04:26 Executing garden:ubuntu-cloud-24.04:tests/profiles/lsusb (garden:ubuntu-cloud-24.04) (1/1)... 2025-06-10 08:04:26 Restoring garden:ubuntu-cloud-24.04:tests/profiles/lsusb (garden:ubuntu-cloud-24.04)... 2025-06-10 08:04:26 Discarding garden:ubuntu-cloud-24.04... 2025-06-10 08:04:27 Successful tasks: 1 2025-06-10 08:04:27 Aborted tasks: 0 ``` Signed-off-by: Zygmunt Krynicki --- spread.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spread.yaml b/spread.yaml index b278f6400..eeee192bc 100644 --- a/spread.yaml +++ b/spread.yaml @@ -41,12 +41,14 @@ backends: # to the Ubuntu cloud images that have the rootfs as the first # partition. exec image-garden allocate "$SPREAD_SYSTEM"."$ARCH" \ + -usb -usbdevice keyboard -usbdevice mouse \ -kernel bzImage \ -append 'root=/dev/sda1 ro console=tty1 console=ttyS0' fi # Ask image garden to allocate the system and relay the result back # to spread as either success of failure. - exec image-garden allocate "$SPREAD_SYSTEM"."$ARCH" + exec image-garden allocate "$SPREAD_SYSTEM"."$ARCH" \ + -usb -usbdevice keyboard -usbdevice mouse \ discard: | # See above for an explanation. if [ -n "${SPREAD_HOST_PATH-}" ]; then From ddba3bb5b55bc8cb568409f98fe38dcf6e7a0b95 Mon Sep 17 00:00:00 2001 From: Zygmunt Krynicki Date: Tue, 10 Jun 2025 08:14:53 +0200 Subject: [PATCH 2/2] tests: match printed output from lsusb This is a small improvement that makes sure lsusb is able to read some properties of the virtual USB devices provisioned for the test. Signed-off-by: Zygmunt Krynicki --- tests/profiles/lsusb/task.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/profiles/lsusb/task.yaml b/tests/profiles/lsusb/task.yaml index 3f7ee6152..ff393c37e 100644 --- a/tests/profiles/lsusb/task.yaml +++ b/tests/profiles/lsusb/task.yaml @@ -2,8 +2,8 @@ summary: smoke test for the lsusb profile execute: | # lsusb works (this is a very basic test). # try printing the physical USB device hierarchy as a tree - lsusb -t + lsusb -t | MATCH 'Class=Human Interface Device, Driver=usbhid' # be verbose - lsusb -v + lsusb -v | MATCH 'QEMU USB Keyboard' # The profile is attached based on the program path. "$SPREAD_PATH"/tests/bin/actual-profile-of lsusb | MATCH 'lsusb \(enforce\)'