Skip to content

Commit 04cc4bb

Browse files
authored
Side: Fix ci tool when running with --test-threads (#20346)
# Objective `ci` tool fails if you run with `--test-threads` because `cargo test --benches` does not take `--test-threads` ## Solution Split the command that call `cargo test` into one for `--benches` and other for `--lib --bins --tests`. ## Testing Ran `cargo run -p ci -- --build-jobs 4 --test-threads 4` ## Note This is a cherry-pick of a commit that was added to #19011 but was unrelated to the PR
1 parent a79e52b commit 04cc4bb

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

tools/ci/src/commands/test.rs

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,26 @@ impl Prepare for TestCommand {
1313
let jobs = args.build_jobs();
1414
let test_threads = args.test_threads();
1515

16-
vec![PreparedCommand::new::<Self>(
17-
cmd!(
18-
sh,
19-
// `--benches` runs each benchmark once in order to verify that they behave
20-
// correctly and do not panic.
21-
"cargo test --workspace --lib --bins --tests --benches {no_fail_fast...} {jobs...} -- {test_threads...}"
16+
let jobs_ref = &jobs;
17+
let test_threads_ref = &test_threads;
18+
19+
vec![
20+
PreparedCommand::new::<Self>(
21+
cmd!(
22+
sh,
23+
"cargo test --workspace --lib --bins --tests {no_fail_fast...} {jobs_ref...} -- {test_threads_ref...}"
24+
),
25+
"Please fix failing tests in output above.",
2226
),
23-
"Please fix failing tests in output above.",
24-
)]
27+
PreparedCommand::new::<Self>(
28+
cmd!(
29+
sh,
30+
// `--benches` runs each benchmark once in order to verify that they behave
31+
// correctly and do not panic.
32+
"cargo test --workspace --benches {no_fail_fast...} {jobs...}"
33+
),
34+
"Please fix failing tests in output above.",
35+
)
36+
]
2537
}
2638
}

0 commit comments

Comments
 (0)