Test-runner device and USB axes, and a Drivers test suite - #3259
Closed
valentinbreiz wants to merge 5 commits into
Closed
valentinbreiz wants to merge 5 commits into
valentinbreiz wants to merge 5 commits into
Conversation
Profiles had fixed axes only, so a suite could not boot QEMU with a device no built-in driver handles: no edu or rtl8139, and no USB device without a USB stick, since qemu-xhci was only emitted alongside one. On ARM64 virt, which has no USB bus of its own, a bare "mouse": "usb-mouse" even stops QEMU from starting. - "devices": ["edu", "rtl8139", "e1000e"] adds one -device per model. A NIC model gets its own user netdev (devnet0, devnet1, ...) through the existing AppendNetworkCardArgs, so it never collides with net0. - "usb": ["usb-mouse", "usb-kbd"] adds one qemu-xhci controller and puts each device on its bus, on x64 and ARM64. A profile that also has a USB stick shares that controller, and the stick keeps its ids (usbxhci0, usbdisk0, usbstick0), so QemuHotPlug works unchanged. Both lists are checked against an allow-list when the catalog loads, so a typo, a duplicate, an empty list or a model another axis already attaches fails on the host instead of in QEMU. Every listed model is accepted by both q35 and virt. Existing profiles emit the same arguments as before.
The loader tests cover parsing both axes and every validation error (unknown model, a model in the wrong axis, duplicates, conflicts with nic/keyboard/mouse/gpu, empty lists, blank or non-string entries). The launcher tests pin the exact arguments of a devices profile, a usb profile, and a usb profile sharing its controller with a USB stick. ProfileLaunchArgs builds those arguments through the same methods BuildAsync uses, without resolving a QEMU binary or probing for KVM.
Cosmos.Kernel.Tests.Drivers boots hardware that the upcoming driver kit's test drivers will bind: edu, rtl8139, e1000e on ARM64 (the E1000E built-in is x64 only) and a USB mouse. Each profile runs bare and with the gicv2 and gicv3 modifiers on ARM64: 3 cells on x64, 12 on ARM64. Its 7 tests check what holds before any user driver exists: the profile is one the suite knows, the profile's PCI function is enumerated exactly once with the expected IDs and class and no owner, and in the USB cell the xHCI function is owned by "xhci" and the HID boot mouse interface is enumerated once with no class driver bound. The suite reads HAL internals through a temporary InternalsVisibleTo that goes away once the driver kit's public API lands. Catalog tests pin each Drivers cell and its QEMU arguments, and the arguments of the existing USB stick and virtio profiles.
Adds the Drivers suite to the kernel tests on x64 and ARM64, with its results job and summary row, on the same timeouts as the Pci and Virtio suites.
🧪 Interrupts Tests
Skipped
📎 Artifacts
|
🧪 Storage Tests
Skipped
📎 Artifacts
|
This was referenced Sep 26, 2026
🧪 Graphic Tests
Skipped
📎 Artifacts
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #3258 (base
feature/driver-kit-boot-owners), itself on #3257. Retarget togen3once those merge.Third step towards letting a user kernel register its own PCI and USB drivers. It adds no kernel code. It teaches the test runner to attach hardware that no built-in driver claims, and adds a
Driverstest suite that the driver-engine PRs build on. The onlysrc/changes are in the QEMU launcher shared with thecosmostool, and one temporaryInternalsVisibleToline in HAL for the new suite.Problem
The driver-engine cells need hardware that is on the bus but that no built-in driver takes: QEMU's
edutest device, an RTL8139 NIC, an e1000e on ARM64 (the E1000E built-in is x64-only), and a USB mouse. The runner could not express any of these.nic, a keyboard, a mouse, a VGA backend and a GPU. There was no way to add an arbitrary PCI device such asedu.qemu-xhciwas emitted only inside the USB-disk branch ofQemuLauncher."mouse": "usb-mouse"emitted a bare-device usb-mouse, and ARM64virthas no USB bus of its own, so QEMU refused to start.Fix
Two new profile axes (
tests/profiles.json,TestProfile,ProfileDeviceModels,QemuLauncher):"devices"edu,rtl8139,e1000e-device <model>. A NIC model gets its own user-mode netdev (devnet<n>) through the existingAppendNetworkCardArgs, and, like"nic", drops QEMU's default NIC."usb"usb-mouse,usb-kbdqemu-xhci,id=usbxhci0and-device <model>,bus=usbxhci0.0per entry. A profile that also has a USB disk shares that one controller, so the hot-plug path keeps its QEMU ids.nic,keyboard,mouse,gpu) fails the load with the profile and axis named, rather than failing QEMU at run time.q35andvirtaccept every listed model. A profile that only makes sense on one arch uses the existing"architectures"filter.testing.mddocument both axes.Cosmos.Kernel.Tests.Drivers(new suite):edu,rtl8139,e1000e-arm64andusb-mouse, composed with thegicv2/gicv3modifiers on ARM64. That gives 3 cells on x64 and 12 on ARM64.Profile_Recognized;Pci_ProfileFunctionEnumeratedOnce,Pci_ProfileFunctionClassMatches,Pci_ProfileFunctionUnowned;Usb_XhciOwnedByXhci,Usb_MouseEnumeratedOnce,Usb_MouseInterfaceUnbound.InternalsVisibleTofrom HAL lets it read PCI owners and USB interfaces until the kit's public seam lands.CI.
kernel-tests.ymlruns the suite on x64 and ARM64.Verification
Build.
make setup: 0 errors.Host tests.
Cosmos.Tests.Patcher: 138 passed, 0 failed.Cosmos.Tests.Tools: 37 passed, 0 failed.QEMU arguments. A harness built the argument line for every existing suite, profile and modifier combination, with the old and the new launcher. The 128 existing combinations are byte-identical; the 30 differences are all new Drivers cells.
Test suites, QEMU (JUnit tests / failed / skipped):
Real hardware. The runs above are QEMU only. No kernel code changes.
Known gaps.
kernel-testsdoes not trigger on a change totests/profiles.jsonalone.machineOptionssilently replace the profile's own. No current profile sets both.xhci; this reuses the existingusbxhci0id so the USB-disk hot-plug path keeps its ids.