mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-11-04 19:11:11 +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:
parent
bed282b801
commit
a85e2fa735
@ -1657,4 +1657,36 @@ mod tests {
|
||||
);
|
||||
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(())
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user