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

Function parse_valgrind_codspeed_version

src/executor/valgrind/setup.rs:112–131  ·  view source on GitHub ↗

Parse a valgrind version string and extract the upstream semver plus the optional CodSpeed iteration number. Accepted formats: - `valgrind-3.25.1.codspeed` (legacy, no iteration) - `valgrind-3.25.1.codspeed2` (with iteration) - same forms without the `valgrind-` prefix

(version_str: &str)

Source from the content-addressed store, hash-verified

110/// - `valgrind-3.25.1.codspeed2` (with iteration)
111/// - same forms without the `valgrind-` prefix
112fn parse_valgrind_codspeed_version(version_str: &str) -> Option<ValgrindVersion> {
113 let stripped = version_str
114 .trim()
115 .strip_prefix("valgrind-")
116 .unwrap_or(version_str.trim());
117
118 let (semver_part, iteration_part) = stripped.split_once(".codspeed")?;
119 let semver = Version::parse(semver_part).ok()?;
120
121 let codspeed_iteration = if iteration_part.is_empty() {
122 None
123 } else {
124 Some(iteration_part.parse::<u32>().ok()?)
125 };
126
127 Some(ValgrindVersion {
128 semver,
129 codspeed_iteration,
130 })
131}
132
133const TOOL_NAME: &str = "valgrind";
134

Calls 1

is_emptyMethod · 0.45