Skip to content

Commit

Permalink
feat(runner/setup): do not install valgrind if correct version is ins…
Browse files Browse the repository at this point in the history
…talled
  • Loading branch information
adriencaccia committed Jun 6, 2024
1 parent 73dc4a1 commit 1de4682
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/run/runner/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,30 @@ lazy_static! {
};
}

fn check_installed_valgrind() -> Result<bool> {
let is_valgrind_installed = Command::new("which")
.arg("valgrind")
.output()
.is_ok_and(|output| output.status.success());
if !is_valgrind_installed {
return Ok(false);
}

let version_output = Command::new("valgrind").arg("--version").output()?;
if !version_output.status.success() {
return Ok(false);
}

let version = String::from_utf8_lossy(&version_output.stdout);
// TODO: use only VALGRIND_CODSPEED_VERSION here, the other value is when valgrind has been built locally
Ok(version.contains("valgrind-3.21.0.codspeed") || version.contains(VALGRIND_CODSPEED_VERSION))
}

async fn install_valgrind(system_info: &SystemInfo) -> Result<()> {
if check_installed_valgrind()? {
debug!("Valgrind is already installed with the correct version, skipping installation");
return Ok(());
}
debug!("Installing valgrind");
let valgrind_deb_url = format!(
"https://github.com/CodSpeedHQ/valgrind-codspeed/releases/download/{}/{}",
Expand Down

0 comments on commit 1de4682

Please sign in to comment.