mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
virtio-devices: Test cap_len of VIRTIO_PCI_CAP_PCI_CFG
Regression test for the cap_len fix. The emitted VirtioPciCfgCap must report cap_len 20, covering the trailing pci_cfg_data window per virtio 1.2 section 4.1.4.9. Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
committed by
Rob Bradford
parent
b4dea599a3
commit
e7d394e286
@@ -1443,4 +1443,12 @@ mod unit_tests {
|
|||||||
intr.trigger(VirtioInterruptType::Queue(0)).unwrap();
|
intr.trigger(VirtioInterruptType::Queue(0)).unwrap();
|
||||||
assert!(!intr.config_changed.load(Ordering::Acquire));
|
assert!(!intr.config_changed.load(Ordering::Acquire));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn pci_cfg_cap_len_includes_data_window() {
|
||||||
|
let cap = VirtioPciCfgCap::new();
|
||||||
|
let expected = (size_of::<VirtioPciCfgCap>() as u8) + VIRTIO_PCI_CAP_LEN_OFFSET;
|
||||||
|
assert_eq!(cap.cap.cap_len, expected);
|
||||||
|
assert_eq!(cap.cap.cap_len, 20);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user