Skip to content

Commit 7cad097

Browse files
authored
Rollup merge of rust-lang#146601 - Enselic:fix-test-args, r=Mark-Simulacrum
compiletest: Make `./x test --test-args ...` work again It accidentally broke with rust-lang#146501. The intention of that PR was to keep existing behavior if `--exact` is not used, but it had a bug. This PR fixes that bug.
2 parents f3c395b + bf73aac commit 7cad097

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/tools/compiletest/src/executor.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,11 +295,14 @@ fn filter_tests(opts: &Config, tests: Vec<CollectedTest>) -> Vec<CollectedTest>
295295
let mut filtered = tests;
296296

297297
let matches_filter = |test: &CollectedTest, filter_str: &str| {
298-
let filterable_path = test.desc.filterable_path.as_str();
299298
if opts.filter_exact {
300-
filterable_path == filter_str
299+
// When `--exact` is used we must use `filterable_path` to get
300+
// reasonable filtering behavior.
301+
test.desc.filterable_path.as_str() == filter_str
301302
} else {
302-
filterable_path.contains(filter_str)
303+
// For compatibility we use the name (which includes the full path)
304+
// if `--exact` is not used.
305+
test.desc.name.contains(filter_str)
303306
}
304307
};
305308

0 commit comments

Comments
 (0)