Skip to content

Commit

Permalink
Auto merge of #11725 - Muscraft:reduce-build-in-tests, r=ehuss
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bors committed Feb 21, 2023
2 parents 1c3f7a5 + 45c9c8e commit 0c33172
Show file tree
Hide file tree
Showing 50 changed files with 1,059 additions and 1,059 deletions.
74 changes: 37 additions & 37 deletions tests/testsuite/alt_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ fn depend_on_alt_registry() {

Package::new("bar", "0.0.1").alternative(true).publish();

p.cargo("build")
p.cargo("check")
.with_stderr(
"\
[UPDATING] `alternative` index
[DOWNLOADING] crates ...
[DOWNLOADED] bar v0.0.1 (registry `alternative`)
[COMPILING] bar v0.0.1 (registry `alternative`)
[COMPILING] foo v0.0.1 ([CWD])
[CHECKING] bar v0.0.1 (registry `alternative`)
[CHECKING] foo v0.0.1 ([CWD])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
",
)
Expand All @@ -44,11 +44,11 @@ fn depend_on_alt_registry() {
p.cargo("clean").run();

// Don't download a second time
p.cargo("build")
p.cargo("check")
.with_stderr(
"\
[COMPILING] bar v0.0.1 (registry `alternative`)
[COMPILING] foo v0.0.1 ([CWD])
[CHECKING] bar v0.0.1 (registry `alternative`)
[CHECKING] foo v0.0.1 ([CWD])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
",
)
Expand Down Expand Up @@ -81,16 +81,16 @@ fn depend_on_alt_registry_depends_on_same_registry_no_index() {
.alternative(true)
.publish();

p.cargo("build")
p.cargo("check")
.with_stderr(
"\
[UPDATING] `alternative` index
[DOWNLOADING] crates ...
[DOWNLOADED] [..] v0.0.1 (registry `alternative`)
[DOWNLOADED] [..] v0.0.1 (registry `alternative`)
[COMPILING] baz v0.0.1 (registry `alternative`)
[COMPILING] bar v0.0.1 (registry `alternative`)
[COMPILING] foo v0.0.1 ([CWD])
[CHECKING] baz v0.0.1 (registry `alternative`)
[CHECKING] bar v0.0.1 (registry `alternative`)
[CHECKING] foo v0.0.1 ([CWD])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
",
)
Expand Down Expand Up @@ -123,16 +123,16 @@ fn depend_on_alt_registry_depends_on_same_registry() {
.alternative(true)
.publish();

p.cargo("build")
p.cargo("check")
.with_stderr(
"\
[UPDATING] `alternative` index
[DOWNLOADING] crates ...
[DOWNLOADED] [..] v0.0.1 (registry `alternative`)
[DOWNLOADED] [..] v0.0.1 (registry `alternative`)
[COMPILING] baz v0.0.1 (registry `alternative`)
[COMPILING] bar v0.0.1 (registry `alternative`)
[COMPILING] foo v0.0.1 ([CWD])
[CHECKING] baz v0.0.1 (registry `alternative`)
[CHECKING] bar v0.0.1 (registry `alternative`)
[CHECKING] foo v0.0.1 ([CWD])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
",
)
Expand Down Expand Up @@ -165,17 +165,17 @@ fn depend_on_alt_registry_depends_on_crates_io() {
.alternative(true)
.publish();

p.cargo("build")
p.cargo("check")
.with_stderr_unordered(
"\
[UPDATING] `alternative` index
[UPDATING] `dummy-registry` index
[DOWNLOADING] crates ...
[DOWNLOADED] baz v0.0.1 (registry `dummy-registry`)
[DOWNLOADED] bar v0.0.1 (registry `alternative`)
[COMPILING] baz v0.0.1
[COMPILING] bar v0.0.1 (registry `alternative`)
[COMPILING] foo v0.0.1 ([CWD])
[CHECKING] baz v0.0.1
[CHECKING] bar v0.0.1 (registry `alternative`)
[CHECKING] foo v0.0.1 ([CWD])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
",
)
Expand Down Expand Up @@ -205,11 +205,11 @@ fn registry_and_path_dep_works() {
.file("bar/src/lib.rs", "")
.build();

p.cargo("build")
p.cargo("check")
.with_stderr(
"\
[COMPILING] bar v0.0.1 ([CWD]/bar)
[COMPILING] foo v0.0.1 ([CWD])
[CHECKING] bar v0.0.1 ([CWD]/bar)
[CHECKING] foo v0.0.1 ([CWD])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
",
)
Expand Down Expand Up @@ -237,7 +237,7 @@ fn registry_incompatible_with_git() {
.file("src/main.rs", "fn main() {}")
.build();

p.cargo("build")
p.cargo("check")
.with_status(101)
.with_stderr_contains(
" dependency (bar) specification is ambiguous. \
Expand Down Expand Up @@ -377,17 +377,17 @@ fn alt_registry_and_crates_io_deps() {
.alternative(true)
.publish();

p.cargo("build")
p.cargo("check")
.with_stderr_unordered(
"\
[UPDATING] `alternative` index
[UPDATING] `dummy-registry` index
[DOWNLOADING] crates ...
[DOWNLOADED] crates_io_dep v0.0.1 (registry `dummy-registry`)
[DOWNLOADED] alt_reg_dep v0.1.0 (registry `alternative`)
[COMPILING] alt_reg_dep v0.1.0 (registry `alternative`)
[COMPILING] crates_io_dep v0.0.1
[COMPILING] foo v0.0.1 ([CWD])
[CHECKING] alt_reg_dep v0.1.0 (registry `alternative`)
[CHECKING] crates_io_dep v0.0.1
[CHECKING] foo v0.0.1 ([CWD])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
",
)
Expand Down Expand Up @@ -580,12 +580,12 @@ fn patch_alt_reg() {
.file("bar/src/lib.rs", "pub fn bar() {}")
.build();

p.cargo("build")
p.cargo("check")
.with_stderr(
"\
[UPDATING] `alternative` index
[COMPILING] bar v0.1.0 ([CWD]/bar)
[COMPILING] foo v0.0.1 ([CWD])
[CHECKING] bar v0.1.0 ([CWD]/bar)
[CHECKING] foo v0.0.1 ([CWD])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)
Expand Down Expand Up @@ -662,14 +662,14 @@ fn no_api() {
.file("src/lib.rs", "")
.build();

p.cargo("build")
p.cargo("check")
.with_stderr(
"\
[UPDATING] `alternative` index
[DOWNLOADING] crates ...
[DOWNLOADED] bar v0.0.1 (registry `alternative`)
[COMPILING] bar v0.0.1 (registry `alternative`)
[COMPILING] foo v0.0.1 ([CWD])
[CHECKING] bar v0.0.1 (registry `alternative`)
[CHECKING] foo v0.0.1 ([CWD])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
",
)
Expand Down Expand Up @@ -1050,7 +1050,7 @@ fn unknown_registry() {
config.insert(start + start_index, '#');
fs::write(&cfg_path, config).unwrap();

p.cargo("build").run();
p.cargo("check").run();

// Important parts:
// foo -> bar registry = null
Expand Down Expand Up @@ -1212,14 +1212,14 @@ fn registries_index_relative_url() {

Package::new("bar", "0.0.1").alternative(true).publish();

p.cargo("build")
p.cargo("check")
.with_stderr(
"\
[UPDATING] `relative` index
[DOWNLOADING] crates ...
[DOWNLOADED] bar v0.0.1 (registry `relative`)
[COMPILING] bar v0.0.1 (registry `relative`)
[COMPILING] foo v0.0.1 ([CWD])
[CHECKING] bar v0.0.1 (registry `relative`)
[CHECKING] foo v0.0.1 ([CWD])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
",
)
Expand Down Expand Up @@ -1259,7 +1259,7 @@ fn registries_index_relative_path_not_allowed() {

Package::new("bar", "0.0.1").alternative(true).publish();

p.cargo("build")
p.cargo("check")
.with_stderr(&format!(
"\
error: failed to parse manifest at `{root}/foo/Cargo.toml`
Expand Down
Loading

0 comments on commit 0c33172

Please sign in to comment.