MCPcopy Create free account
hub / github.com/CodSpeedHQ/codspeed / classify_valgrind_version

Function classify_valgrind_version

src/executor/valgrind/setup.rs:141–174  ·  view source on GitHub ↗

Classify a trimmed `valgrind --version` output against the pinned CodSpeed valgrind version.

(version: String)

Source from the content-addressed store, hash-verified

139/// Classify a trimmed `valgrind --version` output against the pinned CodSpeed
140/// valgrind version.
141fn classify_valgrind_version(version: String) -> ToolInstallStatus {
142 // Check if it's a codspeed version
143 if !version.contains(".codspeed") {
144 return ToolInstallStatus::IncorrectVersion {
145 version,
146 message: "not a CodSpeed build".to_string(),
147 };
148 }
149
150 // Parse the installed version
151 let Some(installed_version) = parse_valgrind_codspeed_version(&version) else {
152 return ToolInstallStatus::IncorrectVersion {
153 version,
154 message: "could not parse version".to_string(),
155 };
156 };
157
158 // Legacy `.codspeed` builds (no iteration suffix) predate iteration
159 // tracking, so they count as iteration 0.
160 let installed_iteration = installed_version.codspeed_iteration.unwrap_or(0);
161 let is_version_outdated = (installed_version.semver, installed_iteration)
162 < (VALGRIND_CODSPEED_VERSION, VALGRIND_CODSPEED_ITERATION);
163 if is_version_outdated {
164 return ToolInstallStatus::IncorrectVersion {
165 version,
166 message: format!(
167 "version too old, expecting {} or higher",
168 VALGRIND_CODSPEED_VERSION_STRING.as_str()
169 ),
170 };
171 }
172
173 ToolInstallStatus::Installed { version }
174}
175
176fn is_valgrind_installed(system_info: &SystemInfo) -> bool {
177 if !matches!(

Calls 1