mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-11-04 19:11:11 +00:00
vmm: config: Add unit testing for vsock
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
8665898ff3
commit
37264cf21b
@ -1682,4 +1682,27 @@ mod tests {
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_vsock_parsing() -> Result<()> {
|
||||
// sock and cid is required
|
||||
assert!(VsockConfig::parse("").is_err());
|
||||
assert_eq!(
|
||||
VsockConfig::parse("sock=/tmp/sock,cid=1")?,
|
||||
VsockConfig {
|
||||
cid: 1,
|
||||
sock: PathBuf::from("/tmp/sock"),
|
||||
iommu: false
|
||||
}
|
||||
);
|
||||
assert_eq!(
|
||||
VsockConfig::parse("sock=/tmp/sock,cid=1,iommu=on")?,
|
||||
VsockConfig {
|
||||
cid: 1,
|
||||
sock: PathBuf::from("/tmp/sock"),
|
||||
iommu: true
|
||||
}
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user