diff --git a/performance-metrics/src/main.rs b/performance-metrics/src/main.rs index c48e5a906..34986395a 100644 --- a/performance-metrics/src/main.rs +++ b/performance-metrics/src/main.rs @@ -1214,7 +1214,6 @@ fn run_test_with_timeout( let _ = sender.send(output); }); - // Todo: Need to cleanup/kill all hanging child processes let test_timeout = test.calc_timeout(&test_iterations, &test_timeout); receiver .recv_timeout(Duration::from_secs(test_timeout)) @@ -1223,10 +1222,18 @@ fn run_test_with_timeout( "[Error] Test '{}' time-out after {} seconds", test.name, test_timeout ); + cleanup_stale_processes(); Error::TestTimeout })? } +fn cleanup_stale_processes() { + for proc in &["cloud-hypervisor", "iperf3", "ethr"] { + let _ = Command::new("pkill").args(["-9", "-f", proc]).status(); + } + thread::sleep(Duration::from_secs(2)); +} + fn date() -> String { let output = test_infra::exec_host_command_output("date"); String::from_utf8_lossy(&output.stdout).trim().to_string()