Skip to content

Commit 04a0ac0

Browse files
committed
[nextest-runner] ignore test-list lines that end with ': benchmark'
These lines are produced by the default Rust benchmark harness. Fixes #46.
1 parent 8e31f06 commit 04a0ac0

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

nextest-runner/src/test_list.rs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -382,13 +382,23 @@ impl<'g> TestList<'g> {
382382
// <test name>: test
383383
// ...
384384

385-
list_output.lines().map(move |line| {
386-
line.strip_suffix(": test").ok_or_else(|| {
385+
list_output.lines().filter_map(move |line| {
386+
if line.ends_with(": benchmark") {
387+
// These lines are produced by the default Rust benchmark harness (#[bench]).
388+
// Ignore them.
389+
return None;
390+
}
391+
392+
let res = line.strip_suffix(": test").ok_or_else(|| {
387393
ParseTestListError::parse_line(
388-
format!("line '{}' did not end with the string ': test'", line),
394+
format!(
395+
"line '{}' did not end with the string ': test' or ': benchmark'",
396+
line
397+
),
389398
list_output,
390399
)
391-
})
400+
});
401+
Some(res)
392402
})
393403
}
394404

@@ -569,11 +579,14 @@ mod tests {
569579

570580
#[test]
571581
fn test_parse() {
582+
// Lines ending in ': benchmark' (output by the default Rust bencher) should be skipped.
572583
let non_ignored_output = indoc! {"
573584
tests::foo::test_bar: test
574585
tests::baz::test_quux: test
586+
benches::should_be_skipped: benchmark
575587
"};
576588
let ignored_output = indoc! {"
589+
benches::ignored_should_be_skipped: benchmark
577590
tests::ignored::test_bar: test
578591
tests::baz::test_ignored: test
579592
"};

0 commit comments

Comments
 (0)