You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
command.arg("--bench");// Walltime targets need this additional argument (inherited from running them with `cargo bench`)
129
138
}
@@ -132,33 +141,89 @@ pub fn run_benches(
132
141
command.arg(bench_name_filter);
133
142
}
134
143
135
-
command
136
-
.status()
137
-
.map_err(|e| anyhow!("failed to execute the benchmark process: {}", e))
138
-
.and_then(|status| {
139
-
if status.success(){
140
-
Ok(())
141
-
}else{
142
-
#[cfg(unix)]
143
-
{
144
-
let code = status
145
-
.code()
146
-
.or(status.signal().map(|s| 128 + s))// 128+N indicates that a command was interrupted by signal N (see: https://tldp.org/LDP/abs/html/exitcodes.html)
147
-
.unwrap_or(1);
148
-
149
-
eprintln!("failed to execute the benchmark process, exit code: {code}");
150
-
151
-
std::process::exit(code);
152
-
}
153
-
#[cfg(not(unix))]
154
-
{
155
-
bail!("failed to execute the benchmark process: {}", status)
156
-
}
144
+
if show_details {
145
+
// Only capture and process output when details are requested
146
+
let output = command
147
+
.output()
148
+
.map_err(|e| anyhow!("failed to execute the benchmark process: {}", e))?;
149
+
150
+
// Count benchmarks by looking for "Measured:" or "Checked:" lines
151
+
let stdout = String::from_utf8_lossy(&output.stdout);
152
+
let benchmark_count = stdout
153
+
.lines()
154
+
.filter(|line| {
155
+
line.trim_start().starts_with("Measured:")
156
+
|| line.trim_start().starts_with("Checked:")
157
+
|| line.trim_start().starts_with(" Checked:")
158
+
|| line.trim_start().starts_with(" Measured:")
159
+
})
160
+
.count();
161
+
total_benchmark_count += benchmark_count;
162
+
163
+
// Print captured output
164
+
print!("{stdout}");
165
+
io::stdout().flush().unwrap();
166
+
167
+
if !output.status.success(){
168
+
#[cfg(unix)]
169
+
{
170
+
let code = output
171
+
.status
172
+
.code()
173
+
.or(output.status.signal().map(|s| 128 + s))// 128+N indicates that a command was interrupted by signal N (see: https://tldp.org/LDP/abs/html/exitcodes.html)
174
+
.unwrap_or(1);
175
+
176
+
eprintln!("failed to execute the benchmark process, exit code: {code}");
177
+
178
+
std::process::exit(code);
157
179
}
158
-
})?;
159
-
eprintln!("Done running {bench_target_name}");
180
+
#[cfg(not(unix))]
181
+
{
182
+
bail!("failed to execute the benchmark process: {}", output.status)
183
+
}
184
+
}
185
+
186
+
if benchmark_count == 0 && !stdout.is_empty(){
187
+
eprintln!("Warning: No benchmarks detected in output for {bench_target_name}");
0 commit comments