Skip to content

Commit 0aa13d1

Browse files
committed
vmotherboard: add chipset, base chipset, and PCIe unit tests
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).
1 parent bf35346 commit 0aa13d1

4 files changed

Lines changed: 1864 additions & 0 deletions

File tree

‎Cargo.lock‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11461,12 +11461,14 @@ dependencies = [
1146111461
"ide",
1146211462
"inspect",
1146311463
"inspect_counters",
11464+
"memory_range",
1146411465
"mesh",
1146511466
"missing_dev",
1146611467
"pal_async",
1146711468
"parking_lot",
1146811469
"paste",
1146911470
"pci_bus",
11471+
"pci_core",
1147011472
"pcie",
1147111473
"range_map_vec",
1147211474
"state_unit",

‎vmm_core/vmotherboard/Cargo.toml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ thiserror.workspace = true
5858
tracing.workspace = true
5959

6060
[dev-dependencies]
61+
inspect = { workspace = true, features = ["initiate"] }
62+
memory_range.workspace = true
63+
pci_core.workspace = true
6164
test_with_tracing.workspace = true
6265

6366
[lints]

0 commit comments

Comments
 (0)