-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
rustbuild: Add support for crate tests + doctests #33282
Conversation
r? @brson |
r? @aturon (rust_highfive has picked a reviewer for you, use r? to override) |
cargo.args(&build.flags.args); | ||
|
||
build.run(&mut cargo); | ||
} |
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.
This is fairly ugly function. Why search the dag like this and run cargo with a bunch of -p
flags instead of calling cargo test
on every individual crate?
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.
Running cargo test
with a bunch of -p
flags gives us the ability to compile all the crate tests in parallel (but run them sequentially). Ideally this'd just be cargo test --all
, but unfortunately that's not implemented yet :(
Running cargo test
on each individual crate would work, but we'd still have to discover the list of crates somewhere and we unfortunately wouldn't get the same parallelism :(
@bors r+ |
📌 Commit 58902f5 has been approved by |
⌛ Testing commit 58902f5 with merge b0e3f7a... |
💔 Test failed - auto-win-msvc-64-cargotest |
58902f5
to
4c42905
Compare
@bors: r=brson 4c42905 |
⌛ Testing commit 4c42905 with merge 4f41647... |
💔 Test failed - auto-win-gnu-32-opt-rustbuild |
4c42905
to
7606bfd
Compare
@bors: r=brson 7606bfd |
⌛ Testing commit 7606bfd with merge 58a22a2... |
💔 Test failed - auto-win-gnu-32-opt-rustbuild |
7606bfd
to
f5a73cb
Compare
@bors: r=brson f5a73cb Chalking up another segfault to opt-level=3 ... |
⌛ Testing commit f5a73cb with merge de696cd... |
💔 Test failed - auto-win-gnu-32-opt-rustbuild |
Ensure that `rerun-if-changed` is printed for all build scripts to ensure that they've all got the right list of dependencies.
f5a73cb
to
afbcf90
Compare
882e878
to
d11e3c1
Compare
@bors: r=brson d11e3c1 |
⌛ Testing commit d11e3c1 with merge 4d9c301... |
💔 Test failed - auto-win-msvc-64-opt-rustbuild |
This commit adds support to rustbuild to run crate unit tests (those defined by `#[test]`) as well as documentation tests. All tests are powered by `cargo test` under the hood. Each step requires the `libtest` library is built for that corresponding stage. Ideally the `test` crate would be a dev-dependency, but for now it's just easier to ensure that we sequence everything in the right order. Currently no filtering is implemented, so there's not actually a method of testing *only* libstd or *only* libcore, but rather entire swaths of crates are tested all at once. A few points of note here are: * The `coretest` and `collectionstest` crates are just listed as `[[test]]` entires for `cargo test` to naturally pick up. This mean that `cargo test -p core` actually runs all the tests for libcore. * Libraries that aren't tested all mention `test = false` in their `Cargo.toml` * Crates aren't currently allowed to have dev-dependencies due to rust-lang/cargo#860, but we can likely alleviate this restriction once workspaces are implemented. cc rust-lang#31590
d11e3c1
to
bb9062a
Compare
⌛ Testing commit bb9062a with merge 584f1b5... |
⛄ The build was interrupted to prioritize another pull request. |
⌛ Testing commit bb9062a with merge 7c8476a... |
… r=brson rustbuild: Add support for crate tests + doctests This commit adds support to rustbuild to run crate unit tests (those defined by `#[test]`) as well as documentation tests. All tests are powered by `cargo test` under the hood. Each step requires the `libtest` library is built for that corresponding stage. Ideally the `test` crate would be a dev-dependency, but for now it's just easier to ensure that we sequence everything in the right order. Currently no filtering is implemented, so there's not actually a method of testing *only* libstd or *only* libcore, but rather entire swaths of crates are tested all at once. A few points of note here are: * The `coretest` and `collectionstest` crates are just listed as `[[test]]` entires for `cargo test` to naturally pick up. This mean that `cargo test -p core` actually runs all the tests for libcore. * Libraries that aren't tested all mention `test = false` in their `Cargo.toml` * Crates aren't currently allowed to have dev-dependencies due to rust-lang/cargo#860, but we can likely alleviate this restriction once workspaces are implemented. cc rust-lang#31590
⛄ The build was interrupted to prioritize another pull request. |
… r=brson rustbuild: Add support for crate tests + doctests This commit adds support to rustbuild to run crate unit tests (those defined by `#[test]`) as well as documentation tests. All tests are powered by `cargo test` under the hood. Each step requires the `libtest` library is built for that corresponding stage. Ideally the `test` crate would be a dev-dependency, but for now it's just easier to ensure that we sequence everything in the right order. Currently no filtering is implemented, so there's not actually a method of testing *only* libstd or *only* libcore, but rather entire swaths of crates are tested all at once. A few points of note here are: * The `coretest` and `collectionstest` crates are just listed as `[[test]]` entires for `cargo test` to naturally pick up. This mean that `cargo test -p core` actually runs all the tests for libcore. * Libraries that aren't tested all mention `test = false` in their `Cargo.toml` * Crates aren't currently allowed to have dev-dependencies due to rust-lang/cargo#860, but we can likely alleviate this restriction once workspaces are implemented. cc rust-lang#31590
rustbuild: Add support for crate tests + doctests This commit adds support to rustbuild to run crate unit tests (those defined by `#[test]`) as well as documentation tests. All tests are powered by `cargo test` under the hood. Each step requires the `libtest` library is built for that corresponding stage. Ideally the `test` crate would be a dev-dependency, but for now it's just easier to ensure that we sequence everything in the right order. Currently no filtering is implemented, so there's not actually a method of testing *only* libstd or *only* libcore, but rather entire swaths of crates are tested all at once. A few points of note here are: * The `coretest` and `collectionstest` crates are just listed as `[[test]]` entires for `cargo test` to naturally pick up. This mean that `cargo test -p core` actually runs all the tests for libcore. * Libraries that aren't tested all mention `test = false` in their `Cargo.toml` * Crates aren't currently allowed to have dev-dependencies due to rust-lang/cargo#860, but we can likely alleviate this restriction once workspaces are implemented. cc #31590
Enable tests on rustc_codegen_ssa This enables unittests in rustc_codegen_ssa. There are some tests, primarily in [`back/rpath/tests.rs`](https://github.com/rust-lang/rust/blob/HEAD/compiler/rustc_codegen_ssa/src/back/rpath/tests.rs) that haven't ever been running since the unittests are disabled. From what I can tell, this was just a consequence of how things evolved. When testing was initially added in rust-lang#33282, `librustc_trans` had test=false because it didn't have any tests. `rustc_codegen_ssa` eventually split off from that (rust-lang#55627), and the rpath module eventually got merged in too (from `librustc_back` where it used to live). That migration didn't enable the tests. This also includes some fluent diagnostic tests, though I'm not sure what exactly they are testing.
Enable tests on rustc_codegen_ssa This enables unittests in rustc_codegen_ssa. There are some tests, primarily in [`back/rpath/tests.rs`](https://github.com/rust-lang/rust/blob/HEAD/compiler/rustc_codegen_ssa/src/back/rpath/tests.rs) that haven't ever been running since the unittests are disabled. From what I can tell, this was just a consequence of how things evolved. When testing was initially added in rust-lang#33282, `librustc_trans` had test=false because it didn't have any tests. `rustc_codegen_ssa` eventually split off from that (rust-lang#55627), and the rpath module eventually got merged in too (from `librustc_back` where it used to live). That migration didn't enable the tests. This also includes some fluent diagnostic tests, though I'm not sure what exactly they are testing.
This commit adds support to rustbuild to run crate unit tests (those defined by
#[test]
) as well as documentation tests. All tests are powered bycargo test
under the hood.
Each step requires the
libtest
library is built for that corresponding stage.Ideally the
test
crate would be a dev-dependency, but for now it's just easierto ensure that we sequence everything in the right order.
Currently no filtering is implemented, so there's not actually a method of
testing only libstd or only libcore, but rather entire swaths of crates are
tested all at once.
A few points of note here are:
coretest
andcollectionstest
crates are just listed as[[test]]
entires for
cargo test
to naturally pick up. This mean thatcargo test -p core
actually runs all the tests for libcore.test = false
in theirCargo.toml
Dev-dependencies
are not linked when testing subpackages cargo#860, but we can likely alleviate this restriction onceworkspaces are implemented.
cc #31590