-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Put the core unit tests in a separate coretests package #135937
Conversation
There's a libcore comment that should be updated: Lines 46 to 47 in fc0094f
|
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
@@ -45,7 +45,7 @@ impl Step for Std { | |||
const DEFAULT: bool = true; | |||
|
|||
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { | |||
run.crate_or_deps("sysroot").path("library") | |||
run.crate_or_deps("sysroot").crate_or_deps("coretests").path("library") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @onur-ozkan: do you know if this invocation (and the one in test) is correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems right to me
FYI @rust-lang/libs since this is restructuring libcore tests |
I'll do some more local testing tmrw. |
This comment has been minimized.
This comment has been minimized.
libs-nominating for awareness. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this, I believe this is definitely an improvement over the current setup. I did some local manual testing, and here are my findings:
With profile = "library"
1:
- Basic
library/coretests
test:./x test library/coretests
... OK - Basic
library/coretests
test (unmodified re-run):./x test library/coretests
... RERUNS TESTS- Is it expected to re-run all coretests tests even though nothing changed?
- Alias:
./x test coretests
... OK - Alias (unmodified re-run):
./x test coretests
... RERUNS TESTS - Basic test:
./x test core
... OK2 - Basic test (unmodified re-run):
./x test core
... RERUNS TESTS- Is it expected to re-run all core tests even though nothing changed?
The test reruns here are not very problematic because they are very fast to run (at least on my
machine).
Unrelated sanity checks:
- Basic doc:
./x doc core
... OK - Basic build:
./x build library/core
... OK - Basic build (unmodified re-run):
./x build library/core
... OK
The bootstrap changes look good to me (even with the test re-run because they are really fast anyway) and @onur-ozkan, but I'll hand this PR off to a libs reviewer for final sign-off (to really make sure libs contributors are aware of the change).
Footnotes
Note that unfortunately this also has a merge conflict against latest master because a @bors rollup=never p=10 (conflict-prone, and also non-trivial coretests movement) |
r? libs (for final sign-off) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks correct to me from a technical perspective, but this definitely needs an ack from a few team members (was there a discussion on Zulip?)
Opened a T-libs zulip thread: https://rust-lang.zulipchat.com/#narrow/channel/219381-t-libs/topic/Moving.20libcore.20unit.20tests.20into.20dedicated.20.60coretests.60.20package. Marking PR as waiting on T-libs consensus. |
There seems to be some consensus, so @rustbot review |
Finished benchmarking commit (633a3fe): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results (primary -2.4%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResults (primary 0.3%, secondary -1.2%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 772.928s -> 773.067s (0.02%) |
…=cuviper Put the alloc unit tests in a separate alloctests package Same rationale as rust-lang#135937. This PR has some extra complexity though as a decent amount of tests are testing internal implementation details rather than the public api. As such I opted to include the modules containing the types under test using `#[path]` into the alloctests package. This means that those modules still need `#[cfg(test)]`, but the rest of liballoc no longer need it.
…try> Put the alloc unit tests in a separate alloctests package Same rationale as rust-lang#135937. This PR has some extra complexity though as a decent amount of tests are testing internal implementation details rather than the public api. As such I opted to include the modules containing the types under test using `#[path]` into the alloctests package. This means that those modules still need `#[cfg(test)]`, but the rest of liballoc no longer need it. try-job: x86_64-gnu-aux
…try> Put the alloc unit tests in a separate alloctests package Same rationale as rust-lang#135937. This PR has some extra complexity though as a decent amount of tests are testing internal implementation details rather than the public api. As such I opted to include the modules containing the types under test using `#[path]` into the alloctests package. This means that those modules still need `#[cfg(test)]`, but the rest of liballoc no longer need it. try-job: x86_64-gnu-aux
…try> Put the alloc unit tests in a separate alloctests package Same rationale as rust-lang#135937. This PR has some extra complexity though as a decent amount of tests are testing internal implementation details rather than the public api. As such I opted to include the modules containing the types under test using `#[path]` into the alloctests package. This means that those modules still need `#[cfg(test)]`, but the rest of liballoc no longer need it. try-job: x86_64-gnu-aux
…=cuviper Put the alloc unit tests in a separate alloctests package Same rationale as rust-lang#135937. This PR has some extra complexity though as a decent amount of tests are testing internal implementation details rather than the public api. As such I opted to include the modules containing the types under test using `#[path]` into the alloctests package. This means that those modules still need `#[cfg(test)]`, but the rest of liballoc no longer need it.
I just spent 15min trying to figure out why |
#137679 will fix both |
…=cuviper Put the alloc unit tests in a separate alloctests package Same rationale as rust-lang#135937. This PR has some extra complexity though as a decent amount of tests are testing internal implementation details rather than the public api. As such I opted to include the modules containing the types under test using `#[path]` into the alloctests package. This means that those modules still need `#[cfg(test)]`, but the rest of liballoc no longer need it.
…=cuviper Put the alloc unit tests in a separate alloctests package Same rationale as rust-lang#135937. This PR has some extra complexity though as a decent amount of tests are testing internal implementation details rather than the public api. As such I opted to include the modules containing the types under test using `#[path]` into the alloctests package. This means that those modules still need `#[cfg(test)]`, but the rest of liballoc no longer need it.
…=cuviper Put the alloc unit tests in a separate alloctests package Same rationale as rust-lang#135937. This PR has some extra complexity though as a decent amount of tests are testing internal implementation details rather than the public api. As such I opted to include the modules containing the types under test using `#[path]` into the alloctests package. This means that those modules still need `#[cfg(test)]`, but the rest of liballoc no longer need it.
Rollup merge of rust-lang#136642 - bjorn3:separate_alloctest_crate, r=cuviper Put the alloc unit tests in a separate alloctests package Same rationale as rust-lang#135937. This PR has some extra complexity though as a decent amount of tests are testing internal implementation details rather than the public api. As such I opted to include the modules containing the types under test using `#[path]` into the alloctests package. This means that those modules still need `#[cfg(test)]`, but the rest of liballoc no longer need it.
Having standard library tests in the same package as a standard library crate has bad side effects. It causes the test to have a dependency on a locally built standard library crate, while also indirectly depending on it through libtest. Currently this works out fine in the context of rust's build system as both copies are identical, but for example in cg_clif's tests I've found it basically impossible to compile both copies with the exact same compiler flags and thus the two copies would cause lang item conflicts.
This PR moves the tests of libcore to a separate package which doesn't depend on libcore, thus preventing the duplicate crates even when compiler flags don't exactly match between building the sysroot (for libtest) and building the test itself. The rest of the standard library crates do still have this issue however.