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

Switch some tests from build to check #11725

Merged
merged 50 commits into from
Feb 22, 2023

Conversation

Muscraft
Copy link
Member

@Muscraft Muscraft commented Feb 16, 2023

#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.

@rustbot
Copy link
Collaborator

rustbot commented Feb 16, 2023

r? @ehuss

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 16, 2023
@Muscraft Muscraft force-pushed the reduce-build-in-tests branch 2 times, most recently from 0396fed to b152e10 Compare February 17, 2023 16:39
@Muscraft Muscraft marked this pull request as ready for review February 17, 2023 16:42
@Muscraft Muscraft changed the title WIP: Reduce testsuite overhead Switch some tests from build to check` Feb 17, 2023
@Muscraft Muscraft changed the title Switch some tests from build to check` Switch some tests from build to check Feb 17, 2023
@Muscraft
Copy link
Member Author

Muscraft commented Feb 17, 2023

I think this is ready for review. I dropped debug=0 from this PR, so the changes switching build to check can be seen alone. There isn't a massive drop in size (or runtime, I haven't had time to retest), but it seems like a set of worthwhile changes. I could not switch all build to check, but I got many of the low-hanging ones.

If it is better to squash all of these commits after review, I would be happy to!

@epage
Copy link
Contributor

epage commented Feb 17, 2023

@bors r+

@bors
Copy link
Contributor

bors commented Feb 17, 2023

📌 Commit b152e10 has been approved by epage

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 17, 2023
bors added a commit that referenced this pull request Feb 17, 2023
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.
@bors
Copy link
Contributor

bors commented Feb 17, 2023

⌛ Testing commit b152e10 with merge 98b30bb...

@ehuss
Copy link
Contributor

ehuss commented Feb 17, 2023

Hang on a bit, there are a number of changes I'd like to make before this merges.

@bors
Copy link
Contributor

bors commented Feb 17, 2023

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 17, 2023
@@ -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();
Copy link
Contributor

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")
Copy link
Contributor

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.

@@ -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();
Copy link
Contributor

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.

@@ -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();
Copy link
Contributor

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.

@@ -21,10 +21,10 @@ fn pathless_tools() {
)
.build();

foo.cargo("build --verbose")
foo.cargo("check --verbose")
Copy link
Contributor

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.

@@ -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();
Copy link
Contributor

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.

@@ -256,11 +256,11 @@ fn profile_config_all_options() {
)
.build();

p.cargo("build --release -v")
p.cargo("check --release -v")
Copy link
Contributor

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.

@@ -21,7 +21,7 @@ fn inherits_on_release() {
.file("src/lib.rs", "")
.build();

p.cargo("build")
p.cargo("check")
Copy link
Contributor

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.

@@ -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")
Copy link
Contributor

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.

@@ -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();
Copy link
Contributor

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.

@ehuss
Copy link
Contributor

ehuss commented Feb 21, 2023

Thanks!

@bors r+

@bors
Copy link
Contributor

bors commented Feb 21, 2023

📌 Commit 45c9c8e has been approved by ehuss

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, 2023
@bors
Copy link
Contributor

bors commented Feb 21, 2023

⌛ Testing commit 45c9c8e with merge 0c33172...

@bors
Copy link
Contributor

bors commented Feb 22, 2023

☀️ Test successful - checks-actions
Approved by: ehuss
Pushing 0c33172 to master...

@bors bors merged commit 0c33172 into rust-lang:master Feb 22, 2023
@bors bors mentioned this pull request Feb 22, 2023
16 tasks
@Muscraft Muscraft deleted the reduce-build-in-tests branch February 22, 2023 00:58
weihanglo added a commit to weihanglo/rust that referenced this pull request Feb 23, 2023
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)
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 23, 2023
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)
@ehuss ehuss added this to the 1.69.0 milestone Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants