mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
tests: Fix missing wait() on spawned support commands
Compiling cloud-hypervisor v41.0.0 (/home/rob/src/cloud-hypervisor)
warning: spawned process is never `wait()`ed on
--> tests/integration.rs:4250:31
|
4250 | let mut socat_child = socat_command.spawn().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: consider calling `.wait()`
= note: not doing so might leave behind zombie processes
= note: see https://doc.rust-lang.org/stable/std/process/struct.Child.html#warning
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zombie_processes
= note: `#[warn(clippy::zombie_processes)]` on by default
warning: spawned process is never `wait()`ed on
--> tests/integration.rs:6687:9
|
6687 | / Command::new("/usr/local/bin/spdk-nvme/nvmf_tgt")
6688 | | .args(["-i", "0", "-m", "0x1"])
6689 | | .spawn()
6690 | | .unwrap();
| | ^- help: try: `.wait()`
| |_____________________|
|
|
= note: not doing so might leave behind zombie processes
= note: see https://doc.rust-lang.org/stable/std/process/struct.Child.html#warning
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zombie_processes
warning: `cloud-hypervisor` (test "integration") generated 2 warnings
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.83s
Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
This commit is contained in:
@@ -4255,6 +4255,7 @@ mod common_parallel {
|
|||||||
});
|
});
|
||||||
|
|
||||||
let _ = socat_child.kill();
|
let _ = socat_child.kill();
|
||||||
|
let _ = socat_child.wait();
|
||||||
|
|
||||||
let r = std::panic::catch_unwind(|| {
|
let r = std::panic::catch_unwind(|| {
|
||||||
guest.ssh_command("sudo shutdown -h now").unwrap();
|
guest.ssh_command("sudo shutdown -h now").unwrap();
|
||||||
@@ -6664,7 +6665,7 @@ mod common_parallel {
|
|||||||
handle_child_output(r, &output);
|
handle_child_output(r, &output);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn setup_spdk_nvme(nvme_dir: &std::path::Path) {
|
fn setup_spdk_nvme(nvme_dir: &std::path::Path) -> Child {
|
||||||
cleanup_spdk_nvme();
|
cleanup_spdk_nvme();
|
||||||
|
|
||||||
assert!(exec_host_command_status(&format!(
|
assert!(exec_host_command_status(&format!(
|
||||||
@@ -6684,7 +6685,7 @@ mod common_parallel {
|
|||||||
.success());
|
.success());
|
||||||
|
|
||||||
// Start the SPDK nvmf_tgt daemon to present NVMe device as a VFIO user device
|
// Start the SPDK nvmf_tgt daemon to present NVMe device as a VFIO user device
|
||||||
Command::new("/usr/local/bin/spdk-nvme/nvmf_tgt")
|
let child = Command::new("/usr/local/bin/spdk-nvme/nvmf_tgt")
|
||||||
.args(["-i", "0", "-m", "0x1"])
|
.args(["-i", "0", "-m", "0x1"])
|
||||||
.spawn()
|
.spawn()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
@@ -6713,6 +6714,8 @@ mod common_parallel {
|
|||||||
nvme_dir.join("nvme-vfio-user").to_str().unwrap()
|
nvme_dir.join("nvme-vfio-user").to_str().unwrap()
|
||||||
))
|
))
|
||||||
.success());
|
.success());
|
||||||
|
|
||||||
|
child
|
||||||
}
|
}
|
||||||
|
|
||||||
fn cleanup_spdk_nvme() {
|
fn cleanup_spdk_nvme() {
|
||||||
@@ -6726,7 +6729,7 @@ mod common_parallel {
|
|||||||
let guest = Guest::new(Box::new(jammy));
|
let guest = Guest::new(Box::new(jammy));
|
||||||
|
|
||||||
let spdk_nvme_dir = guest.tmp_dir.as_path().join("test-vfio-user");
|
let spdk_nvme_dir = guest.tmp_dir.as_path().join("test-vfio-user");
|
||||||
setup_spdk_nvme(spdk_nvme_dir.as_path());
|
let mut spdk_child = setup_spdk_nvme(spdk_nvme_dir.as_path());
|
||||||
|
|
||||||
let api_socket = temp_api_path(&guest.tmp_dir);
|
let api_socket = temp_api_path(&guest.tmp_dir);
|
||||||
let mut child = GuestCommand::new(&guest)
|
let mut child = GuestCommand::new(&guest)
|
||||||
@@ -6797,7 +6800,8 @@ mod common_parallel {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
cleanup_spdk_nvme();
|
let _ = spdk_child.kill();
|
||||||
|
let _ = spdk_child.wait();
|
||||||
|
|
||||||
kill_child(&mut child);
|
kill_child(&mut child);
|
||||||
let output = child.wait_with_output().unwrap();
|
let output = child.wait_with_output().unwrap();
|
||||||
|
|||||||
Reference in New Issue
Block a user