-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Switch some tests from build
to check
#11725
Conversation
r? @ehuss (rustbot has picked a reviewer for you, use r? to override) |
0396fed
to
b152e10
Compare
build
to check`
build
to check`build
to check
I think this is ready for review. I dropped If it is better to squash all of these commits after review, I would be happy to! |
@bors r+ |
Switch some tests from `build` to `check` #11341 brought up issues with cargo's `testsute` size and speed. One of the suggested fixes was switching most tests to `check` instead of `build`. This PR did that. Before size on `nightly`: 4.4GB After size on `nightly`: 4.2GB Regex to find `build` in `tests/testsuite`: `cargo\(".*build.*\)` Before: 1607 After: 626 Note I did not remove all `build` I only did the easy ones that required minimal changes. I also tried not to touch systems I was unsure about. There could be other uses of `build` I missed as well. I still need to play around with `opt-level`, `debug=0`, and a few other tweaks, but there should be more time/memory to drop. Each test file changed is in a commit of its own, so you should look commit by commit.
Hang on a bit, there are a number of changes I'd like to make before this merges. |
💔 Test failed - checks-actions |
tests/testsuite/build_script.rs
Outdated
@@ -450,7 +450,7 @@ fn custom_build_env_var_rustc_linker() { | |||
|
|||
// no crate type set => linker never called => build succeeds if and | |||
// only if build.rs succeeds, despite linker binary not existing. | |||
p.cargo("build --target").arg(&target).run(); | |||
p.cargo("check --target").arg(&target).run(); |
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.
I might suggest dropping all of the changes to build_script.rs
. Many of these tests are related to linking, and I think there is some risk that using check builds will reduce coverage here.
@@ -22,7 +22,7 @@ fn build_script_extra_link_arg_bin() { | |||
) | |||
.build(); | |||
|
|||
p.cargo("build -v") | |||
p.cargo("check -v") |
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.
I would also probably not touch anything in build_script_extra_link_arg
since it is related to linking.
tests/testsuite/clean.rs
Outdated
@@ -15,7 +15,7 @@ fn cargo_clean_simple() { | |||
.file("src/foo.rs", &main_file(r#""i am foo""#, &[])) | |||
.build(); | |||
|
|||
p.cargo("build").run(); | |||
p.cargo("check").run(); |
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.
I might avoid changing clean.rs
as well, since several of these tests are related to the artifacts produced, and the set of artifacts is different with check
.
tests/testsuite/concurrent.rs
Outdated
@@ -231,8 +231,8 @@ fn git_same_repo_different_tags() { | |||
); | |||
let p = p.build(); | |||
|
|||
let mut a = p.cargo("build -v").cwd("a").build_command(); | |||
let mut b = p.cargo("build -v").cwd("b").build_command(); | |||
let mut a = p.cargo("check -v").cwd("a").build_command(); |
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.
I think I would probably avoid modifying concurrent.rs
. These involve generating artifacts, and cargo has had issues with collisions of artifacts. Since check
generates different artifacts, I'd be concerned about the change in test coverage here.
tests/testsuite/tool_paths.rs
Outdated
@@ -21,10 +21,10 @@ fn pathless_tools() { | |||
) | |||
.build(); | |||
|
|||
foo.cargo("build --verbose") | |||
foo.cargo("check --verbose") |
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.
Since these are involved with linker flags, I think tool_paths.rs
probably shouldn't be changed.
tests/testsuite/plugins.rs
Outdated
@@ -94,7 +94,7 @@ fn plugin_to_the_max() { | |||
.file("src/lib.rs", "pub fn baz() -> i32 { 1 }") | |||
.build(); | |||
|
|||
foo.cargo("build").run(); | |||
foo.cargo("check").run(); |
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.
I would avoid any changes to plugins.rs
, since these involve linking and such.
tests/testsuite/profile_config.rs
Outdated
@@ -256,11 +256,11 @@ fn profile_config_all_options() { | |||
) | |||
.build(); | |||
|
|||
p.cargo("build --release -v") | |||
p.cargo("check --release -v") |
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 test involves codegen, so I don't think it should be modified.
I would probably avoid any changes to profile_config.rs
to be safe, since they involve profile settings.
tests/testsuite/profile_custom.rs
Outdated
@@ -21,7 +21,7 @@ fn inherits_on_release() { | |||
.file("src/lib.rs", "") | |||
.build(); | |||
|
|||
p.cargo("build") | |||
p.cargo("check") |
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.
I'd also suggest not modifying profile_custom
as any profile-oriented things might involve codgen.
tests/testsuite/profiles.rs
Outdated
@@ -269,14 +269,14 @@ fn profile_in_non_root_manifest_triggers_a_warning() { | |||
.file("bar/src/main.rs", "fn main() {}") | |||
.build(); | |||
|
|||
p.cargo("build -v") | |||
p.cargo("check -v") |
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.
I suggest not modifying anything in profiles.rs
since they often involve codegen.
tests/testsuite/rename_deps.rs
Outdated
@@ -27,7 +27,7 @@ fn rename_dependency() { | |||
.file("src/lib.rs", "extern crate bar; extern crate baz;") | |||
.build(); | |||
|
|||
p.cargo("build").run(); | |||
p.cargo("check").run(); |
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.
Since these involve making sure that the renamed libraries can be linked, I would probably avoid any changes to rename_deps.rs
.
b152e10
to
45c9c8e
Compare
Thanks! @bors r+ |
☀️ Test successful - checks-actions |
15 commits in 17b3d0de0897e1c6b8ca347bd39f850bb0a5b9f6..9d5b32f503fc099c4064298465add14d4bce11e6 2023-02-17 19:45:09 +0000 to 2023-02-22 23:04:16 +0000 - refactor(job_queue): docs and move types around (rust-lang/cargo#11758) - Scrub more of the test environment (rust-lang/cargo#11757) - Make more reads of environment variables go through the `Config` (rust-lang/cargo#11754) - Revert "Update curl-sys to use libcurl 7.88.1" (rust-lang/cargo#11755) - use consistent case (rust-lang/cargo#11748) - Switch some tests from `build` to `check` (rust-lang/cargo#11725) - Fix typo in sparse-registry warning message (rust-lang/cargo#11753) - reuse url encoding from `url` crate, don't use separate `percent-encoding` (rust-lang/cargo#11750) - Read environment variables through `Config` instead of `std::env::var(_os)` (rust-lang/cargo#11727) - Update curl-sys to use libcurl 7.88.1 (rust-lang/cargo#11749) - mdman: update pretty_assertions to reduce deps (rust-lang/cargo#11747) - Cleanup tests (rust-lang/cargo#11745) - Enhance help texts of position args (rust-lang/cargo#11740) - Fix typo (rust-lang/cargo#11741) - Update comment about cargo-ok (rust-lang/cargo#11724)
Update cargo 15 commits in 17b3d0de0897e1c6b8ca347bd39f850bb0a5b9f6..9d5b32f503fc099c4064298465add14d4bce11e6 2023-02-17 19:45:09 +0000 to 2023-02-22 23:04:16 +0000 - refactor(job_queue): docs and move types around (rust-lang/cargo#11758) - Scrub more of the test environment (rust-lang/cargo#11757) - Make more reads of environment variables go through the `Config` (rust-lang/cargo#11754) - Revert "Update curl-sys to use libcurl 7.88.1" (rust-lang/cargo#11755) - use consistent case (rust-lang/cargo#11748) - Switch some tests from `build` to `check` (rust-lang/cargo#11725) - Fix typo in sparse-registry warning message (rust-lang/cargo#11753) - reuse url encoding from `url` crate, don't use separate `percent-encoding` (rust-lang/cargo#11750) - Read environment variables through `Config` instead of `std::env::var(_os)` (rust-lang/cargo#11727) - Update curl-sys to use libcurl 7.88.1 (rust-lang/cargo#11749) - mdman: update pretty_assertions to reduce deps (rust-lang/cargo#11747) - Cleanup tests (rust-lang/cargo#11745) - Enhance help texts of position args (rust-lang/cargo#11740) - Fix typo (rust-lang/cargo#11741) - Update comment about cargo-ok (rust-lang/cargo#11724)
#11341 brought up issues with cargo's
testsute
size and speed. One of the suggested fixes was switching most tests tocheck
instead ofbuild
. This PR did that.Before size on
nightly
: 4.4GBAfter size on
nightly
: 4.2GBRegex to find
build
intests/testsuite
:cargo\(".*build.*\)
Before: 1607
After: 626
Note I did not remove all
build
I only did the easy ones that required minimal changes. I also tried not to touch systems I was unsure about. There could be other uses ofbuild
I missed as well.I still need to play around with
opt-level
,debug=0
, and a few other tweaks, but there should be more time/memory to drop.Each test file changed is in a commit of its own, so you should look commit by commit.