about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-07-13 15:16:02 +0200
committerGitHub <noreply@github.com>2025-07-13 15:16:02 +0200
commit41510cc46c0b653ac1e30f01302c22b1590801e8 (patch)
tree6317e0c6189a49f1a4e549f4ce601c2456348825
parent519ad87c752444e877f00f49917b789685ce4382 (diff)
parent0cc60617d766220df60749c141533b344ee5f7e7 (diff)
downloadrust-41510cc46c0b653ac1e30f01302c22b1590801e8.tar.gz
rust-41510cc46c0b653ac1e30f01302c22b1590801e8.zip
Rollup merge of #143825 - RalfJung:clippy-test-filter, r=llogiq
clippy: fix test filtering when TESTNAME is empty

Fixes https://github.com/rust-lang/rust/issues/143824. Turns out bootstrap was just fine, the TESTNAME logic in clippy was wrong... I still made this a rustc PR as that's where I did all the debugging.

The bootstrap change is not really related, but it's comment-only so not worth a separate PR... adding the `test_args` is also part of what `prepare_cargo_test` would usually do so let's group the code properly.
-rw-r--r--tests/compile-test.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/compile-test.rs b/tests/compile-test.rs
index cefe654fef6..a7f38275a60 100644
--- a/tests/compile-test.rs
+++ b/tests/compile-test.rs
@@ -144,8 +144,17 @@ impl TestContext {
         let target_dir = PathBuf::from(var_os("CARGO_TARGET_DIR").unwrap_or_else(|| "target".into()));
         let mut config = Config {
             output_conflict_handling: error_on_output_conflict,
+            // Pre-fill filters with TESTNAME; will be later extended with `self.args`.
             filter_files: env::var("TESTNAME")
-                .map(|filters| filters.split(',').map(str::to_string).collect())
+                .map(|filters| {
+                    filters
+                        .split(',')
+                        // Make sure that if TESTNAME is empty we produce the empty list here,
+                        // not a list containing an empty string.
+                        .filter(|s| !s.is_empty())
+                        .map(str::to_string)
+                        .collect()
+                })
                 .unwrap_or_default(),
             target: None,
             bless_command: Some(if IS_RUSTC_TEST_SUITE {