mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
src: Add integration test for vhost-user-net backend
An integration test relying on the new vhost-user-net backend now replaces the previous test using the QEMU test backend. This allows us to avoid building the QEMU backend, and we now really exercise the vhost-user-net implementation as it is used for the ssh communication in this test. Signed-off-by: Cathy Zhang <cathy.zhang@intel.com> Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
committed by
Sebastien Boeuf
parent
f6d1a9d9b8
commit
8c33eb3069
31
src/main.rs
31
src/main.rs
@@ -1237,15 +1237,18 @@ mod tests {
|
||||
let mut clear = ClearDiskConfig::new();
|
||||
let guest = Guest::new(&mut clear);
|
||||
|
||||
let mut workload_path = dirs::home_dir().unwrap();
|
||||
workload_path.push("workloads");
|
||||
|
||||
let mut vubridge_path = workload_path.clone();
|
||||
vubridge_path.push("vubridge");
|
||||
let vubridge_path = String::from(vubridge_path.to_str().unwrap());
|
||||
|
||||
// Start the daemon
|
||||
let mut daemon_child = Command::new(vubridge_path.as_str()).spawn().unwrap();
|
||||
let mut daemon_child = Command::new("target/debug/vhost_user_net")
|
||||
.args(&[
|
||||
"--backend",
|
||||
format!(
|
||||
"ip={},mask=255.255.255.0,sock=/tmp/vunet.sock",
|
||||
guest.network.host_ip
|
||||
)
|
||||
.as_str(),
|
||||
])
|
||||
.spawn()
|
||||
.unwrap();
|
||||
|
||||
let mut cloud_child = Command::new("target/debug/cloud-hypervisor")
|
||||
.args(&["--cpus", "1"])
|
||||
@@ -1266,13 +1269,17 @@ mod tests {
|
||||
])
|
||||
.args(&[
|
||||
"--vhost-user-net",
|
||||
"mac=52:54:00:02:d9:01,sock=/tmp/vubr.sock",
|
||||
format!("mac={},sock=/tmp/vunet.sock", guest.network.guest_mac).as_str(),
|
||||
])
|
||||
.args(&["--net", guest.default_net_string().as_str()])
|
||||
.spawn()
|
||||
.unwrap();
|
||||
|
||||
// 2 network interfaces + default localhost ==> 3 interfaces
|
||||
// 1 network interface + default localhost ==> 2 interfaces
|
||||
// It's important to note that this test is fully exercising the
|
||||
// vhost-user-net implementation and the associated backend since
|
||||
// it does not define any --net network interface. That means all
|
||||
// the ssh communication in that test happens through the network
|
||||
// interface backed by vhost-user-net.
|
||||
aver_eq!(
|
||||
tb,
|
||||
guest
|
||||
@@ -1281,7 +1288,7 @@ mod tests {
|
||||
.trim()
|
||||
.parse::<u32>()
|
||||
.unwrap_or_default(),
|
||||
3
|
||||
2
|
||||
);
|
||||
|
||||
guest.ssh_command("sudo shutdown -h now")?;
|
||||
|
||||
Reference in New Issue
Block a user