Skip to content
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 alloc unit tests in a separate alloctests package #136642

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

bjorn3
Copy link
Member

@bjorn3 bjorn3 commented Feb 6, 2025

Same rationale as #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.

@rustbot
Copy link
Collaborator

rustbot commented Feb 6, 2025

r? @cuviper

rustbot has assigned @cuviper.
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

@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Feb 6, 2025
@rustbot
Copy link
Collaborator

rustbot commented Feb 6, 2025

These commits modify the library/Cargo.lock file. Unintentional changes to library/Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

@rust-log-analyzer

This comment has been minimized.

@bjorn3 bjorn3 force-pushed the separate_alloctest_crate branch from d40470e to 34a86f7 Compare February 6, 2025 13:09
@rustbot rustbot added the A-tidy Area: The tidy tool label Feb 6, 2025
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@bjorn3 bjorn3 force-pushed the separate_alloctest_crate branch from 68120bf to 8f1c7c3 Compare February 6, 2025 17:32
@bors
Copy link
Contributor

bors commented Feb 7, 2025

☔ The latest upstream changes (presumably #136697) made this pull request unmergeable. Please resolve the merge conflicts.

@bjorn3 bjorn3 force-pushed the separate_alloctest_crate branch from 8f1c7c3 to 1726670 Compare February 13, 2025 15:38
@cuviper
Copy link
Member

cuviper commented Feb 13, 2025

@bors r+

@bors
Copy link
Contributor

bors commented Feb 13, 2025

📌 Commit 1726670 has been approved by cuviper

It is now in the queue for this repository.

@bors bors 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 Feb 13, 2025
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Feb 14, 2025
…=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.
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 14, 2025
…kingjubilee

Rollup of 13 pull requests

Successful merges:

 - rust-lang#135439 (Make `-O` mean `OptLevel::Aggressive`)
 - rust-lang#136460 (Simplify `rustc_span` `analyze_source_file`)
 - rust-lang#136642 (Put the alloc unit tests in a separate alloctests package)
 - rust-lang#136904 (add `IntoBounds` trait)
 - rust-lang#136908 ([AIX] expect `EINVAL` for `pthread_mutex_destroy`)
 - rust-lang#136924 (Add profiling of bootstrap commands using Chrome events)
 - rust-lang#136951 (Use the right binder for rebinding `PolyTraitRef`)
 - rust-lang#136956 (add vendor directory to .gitignore)
 - rust-lang#136967 (Use `slice::fill` in `io::Repeat` implementation)
 - rust-lang#136976 (alloc boxed: docs: use MaybeUninit::write instead of as_mut_ptr)
 - rust-lang#136981 (ci: switch loongarch jobs to free runners)
 - rust-lang#136992 (Update backtrace)
 - rust-lang#136993 ([cg_llvm] Remove dead error message)

r? `@ghost`
`@rustbot` modify labels: rollup
@workingjubilee
Copy link
Member

Testing for #136998 (comment)
@bors r-
@bors try

@bors bors removed the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Feb 14, 2025
For the tests that make use of internal implementation details, we
include the module to test using #[path] in alloctests now.
@bjorn3 bjorn3 force-pushed the separate_alloctest_crate branch from e8647ec to da1371b Compare February 21, 2025 11:24
@rust-log-analyzer

This comment has been minimized.

cargo test -p core -p alloc overrides the test=false in Cargo.toml so we
have to avoid passing -p core and -p alloc to cargo test.
@bjorn3 bjorn3 force-pushed the separate_alloctest_crate branch from da1371b to 9c88f10 Compare February 21, 2025 12:40
@bjorn3
Copy link
Member Author

bjorn3 commented Feb 21, 2025

Locally miri works now.

@bors try

@bors
Copy link
Contributor

bors commented Feb 21, 2025

⌛ Trying commit 9c88f10 with merge 749bcb7...

bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 21, 2025
…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
@bors
Copy link
Contributor

bors commented Feb 21, 2025

☀️ Try build successful - checks-actions
Build commit: 749bcb7 (749bcb7405345c1ecd999f2477f7b63e2060087d)

@bjorn3
Copy link
Member Author

bjorn3 commented Feb 21, 2025

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 21, 2025
@cuviper
Copy link
Member

cuviper commented Feb 21, 2025

@bors r+

@bors
Copy link
Contributor

bors commented Feb 21, 2025

📌 Commit 9c88f10 has been approved by cuviper

It is now in the queue for this repository.

@bors bors 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 Feb 21, 2025
compiler-errors added a commit to compiler-errors/rust that referenced this pull request Feb 22, 2025
…=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.
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 22, 2025
…mpiler-errors

Rollup of 10 pull requests

Successful merges:

 - rust-lang#136642 (Put the alloc unit tests in a separate alloctests package)
 - rust-lang#136910 (Implement feature `isolate_most_least_significant_one` for integer types)
 - rust-lang#137183 (Prune dead regionck code)
 - rust-lang#137333 (Use `edition = "2024"` in the compiler (redux))
 - rust-lang#137356 (Ferris 🦀 Identifier naming conventions)
 - rust-lang#137362 (Add build step log for `run-make-support`)
 - rust-lang#137377 (Always allow reusing cratenum in CrateLoader::load)
 - rust-lang#137388 (Fix(lib/fs/tests): Disable rename POSIX semantics FS tests under Windows 7)
 - rust-lang#137410 (Use StableHasher + Hash64 for dep_tracking_hash)
 - rust-lang#137413 (jubilee cleared out the review queue)

r? `@ghost`
`@rustbot` modify labels: rollup
@matthiaskrgr
Copy link
Member

@bors r-
probably failed here #137416 (comment)

@bors bors 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 Feb 22, 2025
@RalfJung
Copy link
Member

RalfJung commented Feb 23, 2025

Any way we can keep ./x test work as before? It is quite jarring to have ./x test library/alloc and ./x miri library/alloc "succeed" (exit code 0) without actually doing anything. (Well, they do something. They still run doctests. That only makes this even more jarring, and it's actually non-trivial to run regular tests and doctests together now.)

Comment on lines +2791 to +2793
// The core and alloc crates can't directly be tested. We could
// silently ignore them, but replacing them with their test crate
// is less confusing for users.
Copy link
Member

Choose a reason for hiding this comment

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

Is it still possible to run doc-tests now? If ./x test library/core silently aliases ./x test library/coretests, then it becomes impossible to run the doctests in libcore...

Copy link
Member Author

Choose a reason for hiding this comment

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

Right, that should probably be handled using a separate doctest only cargo test invocation. cargo test -p core -p alloc will override the test = false in their respective Cargo.toml. So cargo test -p core -p alloc --doc would be necessary to only test doctests I think.

@bors
Copy link
Contributor

bors commented Feb 25, 2025

☔ The latest upstream changes (presumably #137571) made this pull request unmergeable. Please resolve the merge conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc A-tidy Area: The tidy tool S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants