Skip to content

core: Use autotests to split up coretests - #166487

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
tgross35:split-coretests
Nov 25, 2026
Merged

rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
tgross35:split-coretests

Conversation

@tgross35

@tgross35 tgross35 commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

View all comments

This crate currently takes a rather long time to build, 40s-1m, which makes iteration difficult. Switch to the same pattern as std using Cargo's test detection so this automatically gets split into more crates.

The change cuts off about 50% of the cold build time on my machine, and avoids needing to rebuild everything when a single test file is changed (incremental unfortunately does not work great). num is the limiting test, as it alone takes about 20s to build, but that could possibly be split further in the future.

This change also caught that error.rs was not being run because it wasn't listed as a test module.

deny(unsafe_op_in_unsafe_fn) is also removed as that is now implied by the edition.

Zulip discussion: https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Library.20tests.20build.20time/with/643081197

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 24, 2026
@rustbot

rustbot commented Nov 24, 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 38 candidates
  • Random selection from JohnTitor, Mark-Simulacrum, clarfonthey

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rustbot

rustbot commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

rustc_codegen_cranelift is developed in its own repository. If possible, consider making this change to rust-lang/rustc_codegen_cranelift instead.

cc @bjorn3

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Nov 24, 2026
@rust-log-analyzer

This comment has been minimized.

@clarfonthey

Copy link
Copy Markdown
Contributor

Note it might be nice to do this for alloctests as well.

@tgross35

Copy link
Copy Markdown
Member Author

Huh, I didn't realize alloctests was also in rough shape, about 14 seconds for me. I wonder if we got hit by a compiler regression at some point or if it's been like this for a while.

@clarfonthey

Copy link
Copy Markdown
Contributor

Well, if coretests is bad, alloctests is also bad, since a lot of alloc tests are just core tests deferred so we can use vec and string.

@tgross35

Copy link
Copy Markdown
Member Author

Hm, but coretests has access to std?

@clarfonthey

Copy link
Copy Markdown
Contributor

Yeah, but if we access std, we're not actually testing core, are we?

Whereas at least in alloctests we can verify that the things we're testing are actually in this version of std.

@tgross35

Copy link
Copy Markdown
Member Author

I'm not sure I follow, aren't tests only ever built against a single core+alloc+std version? Even coretests mostly tests API via its std reexport. My understanding was that the coretests/alloctests/std/tests separation mostly just exists to match where the API is defined, with a bit of "someday™ somebody may want to make this work on no-std".

@rust-bors

This comment has been minimized.

@clarfonthey

Copy link
Copy Markdown
Contributor

Realising now how easy this is to create merge conflicts, I figure you may end up wanting to take this week off, but whenever you're next ready to get to this we can arrange to ensure that we rebase and high-priority merge this. Feel free to ping me when you want do that. (I don't mind being bothered whenever.)

@tgross35

Copy link
Copy Markdown
Member Author

I'm ready whenever, but also in no hurry so feel free to take your time looking through. I wasn't planning on rebasing until approved anyway.

@clarfonthey

Copy link
Copy Markdown
Contributor

To be clear, I have skimmed it and it looks very reasonable to me, assuming it runs as expected. I'm fine calling that r=me and letting you add in whatever rebasing/extras you want.

When approving, do:

bors r=clarfonthey p=1 rollup=iffy note="Highly prone to merge conflicts, modifies several library tests"

Prepare for splitting tests. Done in a separate commit so git has an
easier time tracking these.
@rustbot

rustbot commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@tgross35

Copy link
Copy Markdown
Member Author

Yeah it's pretty mechanical, mostly feature moving. Thanks for taking a look.

@bors r=clarfonthey p=1 rollup=iffy note="Highly prone to merge conflicts, modifies several library tests"

@rust-bors

rust-bors Bot commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 003d452 has been tentatively approved by clarfonthey

It will be put into the queue for this repository once PR CI succeeds.

@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 Nov 25, 2026
@rust-log-analyzer

This comment has been minimized.

This crate currently takes a rather long time to build, 40s-1m, which
makes iteration difficult. Switch to the same pattern as std using
Cargo's test detection so this automatically gets split into more
crates.

The change cuts off about 50% of the cold build time on my machine, and
avoids needing to rebuild everything when a single test file is changed
(incremental unfortunately does not work great). `num` is the limiting
test, as it alone takes about 20s to build, but that could possibly be
split further in the future.

This change also caught that error.rs was not being run because it
wasn't listed as a test module.

`deny(unsafe_op_in_unsafe_fn)` is also removed as that is now implied by
the edition.

Zulip discussion: https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Library.20tests.20build.20time/with/643081197
@rust-bors rust-bors Bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 25, 2026
@rust-bors

rust-bors Bot commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

⚠️ A new commit ff043eec629e06d817cce8ed4f07574deeed7a62 was pushed.

This pull request was unapproved.

@tgross35

Copy link
Copy Markdown
Member Author

Can't sort apparently

@bors r=clarfonthey

@rust-bors

rust-bors Bot commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

📌 Commit ff043ee has been tentatively approved by clarfonthey

It will be put into the queue for this repository once PR CI succeeds.

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 25, 2026
@clarfonthey

Copy link
Copy Markdown
Contributor

The note gets removed on new r+, so, you have to add it every time.

@bors r=clarfonthey p=1 rollup=iffy note="Highly prone to merge conflicts, modifies several library tests"

@rust-bors

rust-bors Bot commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

📌 Commit ff043ee has been tentatively approved by clarfonthey

It will be put into the queue for this repository once PR CI succeeds.

@clarfonthey

Copy link
Copy Markdown
Contributor

Wait, maybe not. Whatever, the priority should make it clear.

@JonathanBrouwer

Copy link
Copy Markdown
Member

The note gets removed on new r+, so, you have to add it every time.

I fixed this recently :3

rust-bors Bot pushed a commit that referenced this pull request Nov 25, 2026
…uwer

Rollup of 9 pull requests

Successful merges:

 - #166487 (core: Use autotests to split up coretests)
 - #165145 (Various incr comp session refactors)
 - #165337 (Windows: Don't make RwLock writers race readers)
 - #165732 (feat: rename region obligations)
 - #166061 (Offload: generic kernels in a lib)
 - #166539 (Restore the section in `global-target-feature.rs`)
 - #165721 (avoid Terminator:None in coroutine drop shim building)
 - #166453 (perf: remove cache in `FoldEscapingRegions`)
 - #166547 (Pin i686 msvc)
@rust-bors
rust-bors Bot merged commit d667ee0 into rust-lang:main Nov 25, 2026
14 checks passed
@rustbot rustbot added this to the 1.102.0 milestone Nov 25, 2026
rust-bors Bot pushed a commit that referenced this pull request Nov 25, 2026
Rollup merge of #166487 - tgross35:split-coretests, r=clarfonthey

core: Use autotests to split up coretests

This crate currently takes a rather long time to build, 40s-1m, which makes iteration difficult. Switch to the same pattern as std using Cargo's test detection so this automatically gets split into more crates.

The change cuts off about 50% of the cold build time on my machine, and avoids needing to rebuild everything when a single test file is changed (incremental unfortunately does not work great). `num` is the limiting test, as it alone takes about 20s to build, but that could possibly be split further in the future.

This change also caught that error.rs was not being run because it wasn't listed as a test module.

`deny(unsafe_op_in_unsafe_fn)` is also removed as that is now implied by the edition.

Zulip discussion: https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Library.20tests.20build.20time/with/643081197
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants