Skip to content

clippy: fix test filtering when TESTNAME is empty #143825

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -680,9 +680,9 @@ impl Step for CargoMiri {
cargo.arg("--doc");
}
}

// Finally, pass test-args and run everything.
cargo.arg("--").args(builder.config.test_args());

// Finally, run everything.
let mut cargo = BootstrapCommand::from(cargo);
{
let _guard = builder.msg_sysroot_tool(Kind::Test, stage, "cargo-miri", host, target);
Expand Down
11 changes: 10 additions & 1 deletion src/tools/clippy/tests/compile-test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading