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
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2783,10 +2783,28 @@ impl Step for Crate {
_ => panic!("can only test libraries"),
};

let crates = self
.crates
.iter()
.cloned()
.map(|crate_| {
// 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.
Comment on lines +2791 to +2793
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.

if crate_ == "core" {
"coretests".to_owned()
} else if crate_ == "alloc" {
"alloctests".to_owned()
} else {
crate_
}
})
.collect::<Vec<_>>();

run_cargo_test(
cargo,
&[],
&self.crates,
&crates,
&self.crates[0],
&*crate_description(&self.crates),
target,
Expand Down
Loading