mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: config: Add unit test for VFIO device parsing
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
@@ -1657,4 +1657,36 @@ mod tests {
|
|||||||
);
|
);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_device_parsing() -> Result<()> {
|
||||||
|
assert_eq!(
|
||||||
|
DeviceConfig::parse("path=/path/to/device")?,
|
||||||
|
DeviceConfig {
|
||||||
|
path: PathBuf::from("/path/to/device"),
|
||||||
|
id: None,
|
||||||
|
iommu: false
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
DeviceConfig::parse("path=/path/to/device,iommu=on")?,
|
||||||
|
DeviceConfig {
|
||||||
|
path: PathBuf::from("/path/to/device"),
|
||||||
|
id: None,
|
||||||
|
iommu: true
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
DeviceConfig::parse("path=/path/to/device,iommu=on,id=mydevice0")?,
|
||||||
|
DeviceConfig {
|
||||||
|
path: PathBuf::from("/path/to/device"),
|
||||||
|
id: Some("mydevice0".to_owned()),
|
||||||
|
iommu: true
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user