Skip to content

Commit b838617

Browse files
committed
ci: run libusb VM guest commands via --exec script (fix arg mangling) [wip]
1 parent d2815a4 commit b838617

2 files changed

Lines changed: 29 additions & 6 deletions

File tree

.github/vmrun-libusb.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/sh
2+
# Guest-side commands for the libusb virtual-device test, run inside a virtme-ng
3+
# VM (see .github/workflows/libusb-vhid-test.yml). Kept as a file so a complex
4+
# command line doesn't have to survive vng's argument parser.
5+
#
6+
# Runs as root in the guest, with the host filesystem mounted, cwd at the
7+
# workspace root (which contains the host-built 'build' tree).
8+
set -x
9+
10+
# The guest's modules.dep may be trimmed; regenerate it so dummy_hcd /
11+
# raw_gadget (and their dependencies) resolve from the overlaid /lib/modules.
12+
depmod -a || true
13+
modprobe dummy_hcd || true
14+
modprobe raw_gadget || true
15+
ls -l /dev/raw-gadget || true
16+
17+
ctest --test-dir build --output-on-failure
18+
rc=$?
19+
20+
echo "=== diag ==="
21+
lsmod | grep -E "raw_gadget|dummy_hcd|udc" || true
22+
ls -l /sys/bus/usb/devices/ 2>/dev/null || true
23+
dmesg | tail -40 || true
24+
25+
echo "VNG_CTEST_EXIT=${rc}"

.github/workflows/libusb-vhid-test.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,9 @@ jobs:
6666
# guest runs as root with the host fs mounted; load the gadget modules
6767
# and run the test against the host build tree. vng exit-code
6868
# propagation varies, so derive pass/fail from a sentinel line.
69-
# The full host /lib/modules is overlaid into the guest, but the guest's
70-
# modules.dep may be trimmed; regenerate it with depmod so dummy_hcd /
71-
# raw_gadget (and their deps) are resolvable, then load and run.
72-
vng -v -r "${KIMG}" -- \
73-
bash -c 'set -x; depmod -a || true; modprobe dummy_hcd; modprobe raw_gadget; ls -l /dev/raw-gadget || true; ctest --test-dir build --output-on-failure; rc=$?; echo "=== diag ==="; lsmod | grep -E "raw_gadget|dummy_hcd|udc" || true; ls -l /sys/bus/usb/devices/ 2>/dev/null || true; dmesg | tail -30 || true; echo "VNG_CTEST_EXIT=$rc"' \
74-
2>&1 | tee vng.log
69+
# Boot the kernel in a VM and run the guest script via --exec (vng's
70+
# native flag; passing a complex command after '--' gets mangled). The
71+
# script loads dummy_hcd/raw_gadget and runs the test (see it for why).
72+
vng -v --pwd -r "${KIMG}" --exec "bash hidapisrc/.github/vmrun-libusb.sh" 2>&1 | tee vng.log
7573
echo "--- VM run result ---"
7674
grep -q "VNG_CTEST_EXIT=0" vng.log

0 commit comments

Comments
 (0)