Skip to content

libtest: Allow passing --test-threads and --color multiple times, with later arguments overriding earlier - #161312

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
joshtriplett:libtest-multi
Sep 12, 2026
Merged

rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
joshtriplett:libtest-multi

Conversation

@joshtriplett

@joshtriplett joshtriplett commented Aug 18, 2026 •

Copy link
Copy Markdown
Member

Cargo would like to be able to pass these arguments, without breaking the ability for the user to do the same and override cargo's value. Currently, the option only allows one instance, failing if it sees multiple.

Accept --test-threads=N and --color=... multiple times, and have the last instance win.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Aug 18, 2026
@rustbot

rustbot commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

r? @clarfonthey

rustbot has assigned @clarfonthey.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: libs
  • libs expanded to 12 candidates
  • Random selection from JohnTitor, Mark-Simulacrum, clarfonthey, nia-e

@epage epage added the T-testing-devex Relevant to the testing devex team (testing DX), which will review and decide on the PR/issue. label Aug 18, 2026
@epage

epage commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Looks good from my side. Starting fcp for this as it is a one-way door.

@rfcbot fcp merge testing-devex

@rust-rfcbot

rust-rfcbot commented Aug 18, 2026 •

Copy link
Copy Markdown
Collaborator

@epage has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rust-rfcbot rust-rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Aug 18, 2026
Comment thread library/test/src/cli.rs Outdated
Comment thread library/test/src/cli.rs Outdated
Cargo would like to be able to pass `--test-threads=N`, without breaking
the ability for the user to do the same and override cargo's value.
Currently, the option only allows one instance, failing if it sees
multiple.

Accept `--test-threads=N` multiple times, and have the last instance win.
Cargo would like to be able to pass a `--color` option, without breaking
the ability for the user to do the same and override cargo's value.
Currently, the option only allows one instance, failing if it sees
multiple.

Accept `--color` multiple times, and have the last instance win.
@weihanglo

Copy link
Copy Markdown
Member

@rfcbot reviewed

Comment thread library/test/src/cli.rs
fn get_test_threads(matches: &getopts::Matches) -> OptPartRes<Option<usize>> {
let test_threads = match matches.opt_str("test-threads") {
Some(n_str) => match n_str.parse::<usize>() {
let mut last_test_threads = None;

@clarfonthey clarfonthey Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking not-important note: this could be done with a map(...).last() instead of this setup, but it doesn't actually matter imho.

Ditto for below.

View changes since the review

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I realise why you did this, since it's actually more complicated. It'd have to be try_fold instead which is just more confusing.

@clarfonthey

Copy link
Copy Markdown
Contributor

r=me for code review once FCP passes.

@rust-rfcbot rust-rfcbot added final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. and removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. labels Sep 1, 2026
@rust-rfcbot

Copy link
Copy Markdown
Collaborator

🔔 This is now entering its final comment period, as per the review above. 🔔

@rust-rfcbot rust-rfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. to-announce Announce this issue on triage meeting and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Sep 11, 2026
@rust-rfcbot

Copy link
Copy Markdown
Collaborator

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

@clarfonthey

Copy link
Copy Markdown
Contributor

@bors r+

@rust-bors

rust-bors Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

📌 Commit ef65ece has been approved by clarfonthey

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 11, 2026
rust-bors Bot pushed a commit that referenced this pull request Sep 11, 2026
…uwer

Rollup of 2 pull requests

Successful merges:

 - #161312 (libtest: Allow passing --test-threads and --color multiple times, with later arguments overriding earlier)
 - #162193 (Make -Zsanitizer-cfi-{recover,diag} require -Zsanitizer=cfi)
@rust-bors
rust-bors Bot merged commit 76a14b7 into rust-lang:main Sep 12, 2026
13 checks passed
rust-bors Bot pushed a commit that referenced this pull request Sep 12, 2026
Rollup merge of #161312 - joshtriplett:libtest-multi, r=clarfonthey

libtest: Allow passing --test-threads and --color multiple times, with later arguments overriding earlier

Cargo would like to be able to pass these arguments, without breaking the ability for the user to do the same and override cargo's value. Currently, the option only allows one instance, failing if it sees multiple.

Accept `--test-threads=N` and `--color=...` multiple times, and have the last instance win.
@rustbot rustbot added this to the 1.100.0 milestone Sep 12, 2026
@joshtriplett
joshtriplett deleted the libtest-multi branch October 7, 2026 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-testing-devex Relevant to the testing devex team (testing DX), which will review and decide on the PR/issue. to-announce Announce this issue on triage meeting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants