mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-18 10:35:23 +00:00
tests: Stabilize 'test_vfio_user' with retries to run host commands
The 'test_vfio_user' is prone to fail when the system is under high workloads with errors: ``` Error while connecting to /var/tmp/spdk.sock Is SPDK application running? Error details: Invalid or non-existing address: '/var/tmp/spdk.sock' ``` This is because SPDK is not fully functional before we request to create a nvme device using the vfio_user protocol. This patch stabilize this test with allowing retires to execute host commands. Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
parent
38a2808d85
commit
602d704558
@ -718,6 +718,20 @@ pub fn ssh_command_ip(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn exec_host_command_with_retries(command: &str, retries: u32, interval: Duration) -> bool {
|
||||||
|
for _ in 0..retries {
|
||||||
|
let s = exec_host_command_output(command).status;
|
||||||
|
if !s.success() {
|
||||||
|
eprintln!("\n\n==== retrying in {:?} ===\n\n", interval);
|
||||||
|
thread::sleep(interval);
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
pub fn exec_host_command_status(command: &str) -> ExitStatus {
|
pub fn exec_host_command_status(command: &str) -> ExitStatus {
|
||||||
exec_host_command_output(command).status
|
exec_host_command_output(command).status
|
||||||
}
|
}
|
||||||
|
@ -6776,10 +6776,11 @@ mod common_parallel {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
thread::sleep(std::time::Duration::new(2, 0));
|
thread::sleep(std::time::Duration::new(2, 0));
|
||||||
|
|
||||||
assert!(exec_host_command_status(
|
assert!(exec_host_command_with_retries(
|
||||||
"/usr/local/bin/spdk-nvme/rpc.py nvmf_create_transport -t VFIOUSER"
|
"/usr/local/bin/spdk-nvme/rpc.py nvmf_create_transport -t VFIOUSER",
|
||||||
)
|
3,
|
||||||
.success());
|
std::time::Duration::new(5, 0),
|
||||||
|
));
|
||||||
assert!(exec_host_command_status(&format!(
|
assert!(exec_host_command_status(&format!(
|
||||||
"/usr/local/bin/spdk-nvme/rpc.py bdev_aio_create {} test 512",
|
"/usr/local/bin/spdk-nvme/rpc.py bdev_aio_create {} test 512",
|
||||||
nvme_dir.join("test-disk.raw").to_str().unwrap()
|
nvme_dir.join("test-disk.raw").to_str().unwrap()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user