2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-22 01:57:43 +00:00

Merge 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 <zygmunt.krynicki@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1714
Approved-by: Georgia Garcia <georgia.garcia@canonical.com>
Merged-by: Georgia Garcia <georgia.garcia@canonical.com>
This commit is contained in:
Georgia Garcia 2025-06-10 09:28:09 -03:00
commit 2d58858c27
2 changed files with 5 additions and 3 deletions

View File

@ -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

View File

@ -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\)'