From bf73aac8cbdfeff983dce44b883993be2ae89151 Mon Sep 17 00:00:00 2001 From: Martin Nordholts Date: Mon, 15 Sep 2025 18:34:02 +0200 Subject: [PATCH] compiletest: Make `./x test --test-args ...` work again It accidentally broke with a48c8e337d1. The intention of that commit was to keep existing behavior if `--exact` is not used, but it had a bug. This commit fixes that bug. --- src/tools/compiletest/src/executor.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/tools/compiletest/src/executor.rs b/src/tools/compiletest/src/executor.rs index 37cc17351d5fe..c8e13d4457383 100644 --- a/src/tools/compiletest/src/executor.rs +++ b/src/tools/compiletest/src/executor.rs @@ -295,11 +295,14 @@ fn filter_tests(opts: &Config, tests: Vec) -> Vec let mut filtered = tests; let matches_filter = |test: &CollectedTest, filter_str: &str| { - let filterable_path = test.desc.filterable_path.as_str(); if opts.filter_exact { - filterable_path == filter_str + // When `--exact` is used we must use `filterable_path` to get + // reasonable filtering behavior. + test.desc.filterable_path.as_str() == filter_str } else { - filterable_path.contains(filter_str) + // For compatibility we use the name (which includes the full path) + // if `--exact` is not used. + test.desc.name.contains(filter_str) } };