Repository navigation
vmotherboard: add chipset, base chipset, and PCIe unit tests - #5243
Merged
Sunil Muthuswamy (sunilmut) merged 2 commits intoNov 26, 2026
Merged
Sunil Muthuswamy (sunilmut) merged 2 commits into
Sunil Muthuswamy (sunilmut) merged 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The test calls unmap() after the mapping conflict has already left the region unmapped, so its assertions do not verify removal of a live mapping.
1 open issue
What changed in this PR
Adds nine unit tests for vmotherboard’s guest I/O dispatch and chipset builder validation, using a shared fixture and configurable test device. Production code is unchanged.
Changes:
- Tests MMIO and port I/O routing, unclaimed accesses, device errors, deferred completion, and fallback behavior.
- Exercises runtime MMIO mapping and static range conflict validation.
- Checks PCI wiring errors, interrupt dispatch, and duplicate handler rejection.
| File | Description |
|---|---|
vmm_core/vmotherboard/src/chipset/mod.rs |
Adds test helpers and nine tests covering chipset dispatch and builder validation. |
Review effort: Balanced
Before this change, vmotherboard had no unit tests for how the chipset routes guest I/O to devices, how the base chipset wires up its devices, or the errors its builder reports. This PR adds 24 tests. Each one builds a real chipset with a small test device and checks only what callers can see. Tests prefixed with gen1_ cover devices used only by Gen1 VMs. | Test | Checks | |---|---| | accesses_reach_owning_device | Only owner gets I/O | | unclaimed_accesses_read_all_ones | Unclaimed reads all 1s | | device_errors_read_all_ones | Errors read all 1s | | deferred_accesses_complete_with_device_result | Deferred I/O completes | | fallback_device_receives_only_unclaimed_mmio | Fallback gets MMIO | | overlapping_static_ranges_fail_build | Overlaps fail build | | pci_device_wiring_errors_are_reported | Bad PCI wiring fails | | runtime_region_mapping_moves_dispatch | Remap moves I/O | | pic_and_eoi_route_to_registered_handlers | PIC/EOI reach handlers | | generic_pci_bus_routes_config_space | Config space routed | | gen1_piix4_pci_bus_resets_and_hosts_legacy_pci_devices | PIIX4 bus works | | base_chipset_forwards_unclaimed_mmio_to_fallback | Fallback gets MMIO | | generic_cmos_rtc_exposes_cmos_ram | CMOS RAM works | | gen1_piix4_cmos_rtc_exposes_cmos_ram | CMOS RAM works | | gen1_isa_dma_controller_is_resolved_and_programmable | DMA programmable | | gen1_floppy_controllers_require_isa_dma | Floppy needs DMA | | irq_lines_reach_the_pic_and_external_targets | IRQ to CPU vector | | pcie_config_space_reaches_root_complex_devices | ECAM reaches devices | | pcie_placement_errors_fail_build | Misplaced fails | | integrated_endpoint_at_nonzero_device_is_reachable | Ignored: known bug | | dynamic_device_is_reachable_until_removed | Removal unmaps | | vm_state_transitions_reach_devices | Lifecycle reaches all | | inspect_controls_debug_breaks_and_lists_ranges | Break filters match | | device_builder_variants | Builder variants work | This PR changes tests only. Coverage of the crate's production code rises from 32.5% to 92.4% (540 to 1,535 of 1,661 lines).
Sunil Muthuswamy (sunilmut)
force-pushed
the
user/sunilmut/vmotherboard-unit-tests
branch
from
November 23, 2026 23:32
4d09a44 to
0aa13d1
Compare
Run floppy DMA prerequisite checks for each enabled controller, including single-feature and two-feature builds. Check that a conflicting MMIO map revokes the old mapping immediately, then establish and verify a live mapping before testing explicit unmap. Validation on Linux x64: package check, clippy, docs, and formatting passed. Default tests: 32 passed, 1 ignored. With all floppy features: 33 passed, 1 ignored. Focused DMA tests passed in all six partial-feature combinations.
John Starks (jstarks)
approved these changes
Nov 25, 2026
Sunil Muthuswamy (sunilmut)
merged commit Nov 26, 2026
6d4b917
into
microsoft:main
108 of 109 checks passed
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.


Before this change, vmotherboard had no unit tests for how the chipset routes
guest I/O to devices, how the base chipset wires up its devices, or the errors
its builder reports. This PR adds 24 tests. Each one builds a real chipset with
a small test device and checks only what callers can see. Tests prefixed with
gen1_ cover devices used only by Gen1 VMs.
This PR changes tests only. Coverage of the crate's production code rises from
32.5% to 92.4% (540 to 1,535 of 1,661 lines).