Skip to content

Commit 8d3a859

Browse files
authored
Unrolled build for #143825
Rollup merge of #143825 - RalfJung:clippy-test-filter, r=llogiq clippy: fix test filtering when TESTNAME is empty Fixes #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.
2 parents 7e310f4 + 73edfe7 commit 8d3a859

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/bootstrap/src/core/build_steps/test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -685,9 +685,9 @@ impl Step for CargoMiri {
685685
cargo.arg("--doc");
686686
}
687687
}
688-
689-
// Finally, pass test-args and run everything.
690688
cargo.arg("--").args(builder.config.test_args());
689+
690+
// Finally, run everything.
691691
let mut cargo = BootstrapCommand::from(cargo);
692692
{
693693
let _guard = builder.msg_sysroot_tool(Kind::Test, stage, "cargo-miri", host, target);

src/tools/clippy/tests/compile-test.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,17 @@ impl TestContext {
144144
let target_dir = PathBuf::from(var_os("CARGO_TARGET_DIR").unwrap_or_else(|| "target".into()));
145145
let mut config = Config {
146146
output_conflict_handling: error_on_output_conflict,
147+
// Pre-fill filters with TESTNAME; will be later extended with `self.args`.
147148
filter_files: env::var("TESTNAME")
148-
.map(|filters| filters.split(',').map(str::to_string).collect())
149+
.map(|filters| {
150+
filters
151+
.split(',')
152+
// Make sure that if TESTNAME is empty we produce the empty list here,
153+
// not a list containing an empty string.
154+
.filter(|s| !s.is_empty())
155+
.map(str::to_string)
156+
.collect()
157+
})
149158
.unwrap_or_default(),
150159
target: None,
151160
bless_command: Some(if IS_RUSTC_TEST_SUITE {

0 commit comments

Comments
 (0)