From b776c6d317d9911a9f9b36aa20e9ca4bea2a85c2 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Sat, 16 May 2026 15:48:02 +0200 Subject: [PATCH] virtio-devices: Test cfg_type of VIRTIO_PCI_CAP_PCI_CFG Assert the emitted VirtioPciCfgCap carries cfg_type 5, the value assigned to PciCapabilityType::Pci by virtio 1.2 section 4.1.4.1. Signed-off-by: Anatol Belski --- virtio-devices/src/transport/pci_device.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/virtio-devices/src/transport/pci_device.rs b/virtio-devices/src/transport/pci_device.rs index a41a935d6..4b8fe3dbf 100644 --- a/virtio-devices/src/transport/pci_device.rs +++ b/virtio-devices/src/transport/pci_device.rs @@ -1451,4 +1451,11 @@ mod unit_tests { assert_eq!(cap.cap.cap_len, expected); assert_eq!(cap.cap.cap_len, 20); } + + #[test] + fn pci_cfg_cap_cfg_type_is_pci() { + let cap = VirtioPciCfgCap::new(); + assert_eq!(cap.cap.cfg_type, PciCapabilityType::Pci as u8); + assert_eq!(cap.cap.cfg_type, 5); + } }