Skip to content

Commit 98b30bb

Browse files
committed
Auto merge of #11725 - Muscraft:reduce-build-in-tests, r=epage
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.
2 parents 17b3d0d + b152e10 commit 98b30bb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1413
-1414
lines changed

Diff for: tests/testsuite/alt_registry.rs

+37-37
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ fn depend_on_alt_registry() {
2828

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

31-
p.cargo("build")
31+
p.cargo("check")
3232
.with_stderr(
3333
"\
3434
[UPDATING] `alternative` index
3535
[DOWNLOADING] crates ...
3636
[DOWNLOADED] bar v0.0.1 (registry `alternative`)
37-
[COMPILING] bar v0.0.1 (registry `alternative`)
38-
[COMPILING] foo v0.0.1 ([CWD])
37+
[CHECKING] bar v0.0.1 (registry `alternative`)
38+
[CHECKING] foo v0.0.1 ([CWD])
3939
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
4040
",
4141
)
@@ -44,11 +44,11 @@ fn depend_on_alt_registry() {
4444
p.cargo("clean").run();
4545

4646
// Don't download a second time
47-
p.cargo("build")
47+
p.cargo("check")
4848
.with_stderr(
4949
"\
50-
[COMPILING] bar v0.0.1 (registry `alternative`)
51-
[COMPILING] foo v0.0.1 ([CWD])
50+
[CHECKING] bar v0.0.1 (registry `alternative`)
51+
[CHECKING] foo v0.0.1 ([CWD])
5252
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
5353
",
5454
)
@@ -81,16 +81,16 @@ fn depend_on_alt_registry_depends_on_same_registry_no_index() {
8181
.alternative(true)
8282
.publish();
8383

84-
p.cargo("build")
84+
p.cargo("check")
8585
.with_stderr(
8686
"\
8787
[UPDATING] `alternative` index
8888
[DOWNLOADING] crates ...
8989
[DOWNLOADED] [..] v0.0.1 (registry `alternative`)
9090
[DOWNLOADED] [..] v0.0.1 (registry `alternative`)
91-
[COMPILING] baz v0.0.1 (registry `alternative`)
92-
[COMPILING] bar v0.0.1 (registry `alternative`)
93-
[COMPILING] foo v0.0.1 ([CWD])
91+
[CHECKING] baz v0.0.1 (registry `alternative`)
92+
[CHECKING] bar v0.0.1 (registry `alternative`)
93+
[CHECKING] foo v0.0.1 ([CWD])
9494
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
9595
",
9696
)
@@ -123,16 +123,16 @@ fn depend_on_alt_registry_depends_on_same_registry() {
123123
.alternative(true)
124124
.publish();
125125

126-
p.cargo("build")
126+
p.cargo("check")
127127
.with_stderr(
128128
"\
129129
[UPDATING] `alternative` index
130130
[DOWNLOADING] crates ...
131131
[DOWNLOADED] [..] v0.0.1 (registry `alternative`)
132132
[DOWNLOADED] [..] v0.0.1 (registry `alternative`)
133-
[COMPILING] baz v0.0.1 (registry `alternative`)
134-
[COMPILING] bar v0.0.1 (registry `alternative`)
135-
[COMPILING] foo v0.0.1 ([CWD])
133+
[CHECKING] baz v0.0.1 (registry `alternative`)
134+
[CHECKING] bar v0.0.1 (registry `alternative`)
135+
[CHECKING] foo v0.0.1 ([CWD])
136136
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
137137
",
138138
)
@@ -165,17 +165,17 @@ fn depend_on_alt_registry_depends_on_crates_io() {
165165
.alternative(true)
166166
.publish();
167167

168-
p.cargo("build")
168+
p.cargo("check")
169169
.with_stderr_unordered(
170170
"\
171171
[UPDATING] `alternative` index
172172
[UPDATING] `dummy-registry` index
173173
[DOWNLOADING] crates ...
174174
[DOWNLOADED] baz v0.0.1 (registry `dummy-registry`)
175175
[DOWNLOADED] bar v0.0.1 (registry `alternative`)
176-
[COMPILING] baz v0.0.1
177-
[COMPILING] bar v0.0.1 (registry `alternative`)
178-
[COMPILING] foo v0.0.1 ([CWD])
176+
[CHECKING] baz v0.0.1
177+
[CHECKING] bar v0.0.1 (registry `alternative`)
178+
[CHECKING] foo v0.0.1 ([CWD])
179179
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
180180
",
181181
)
@@ -205,11 +205,11 @@ fn registry_and_path_dep_works() {
205205
.file("bar/src/lib.rs", "")
206206
.build();
207207

208-
p.cargo("build")
208+
p.cargo("check")
209209
.with_stderr(
210210
"\
211-
[COMPILING] bar v0.0.1 ([CWD]/bar)
212-
[COMPILING] foo v0.0.1 ([CWD])
211+
[CHECKING] bar v0.0.1 ([CWD]/bar)
212+
[CHECKING] foo v0.0.1 ([CWD])
213213
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
214214
",
215215
)
@@ -237,7 +237,7 @@ fn registry_incompatible_with_git() {
237237
.file("src/main.rs", "fn main() {}")
238238
.build();
239239

240-
p.cargo("build")
240+
p.cargo("check")
241241
.with_status(101)
242242
.with_stderr_contains(
243243
" dependency (bar) specification is ambiguous. \
@@ -377,17 +377,17 @@ fn alt_registry_and_crates_io_deps() {
377377
.alternative(true)
378378
.publish();
379379

380-
p.cargo("build")
380+
p.cargo("check")
381381
.with_stderr_unordered(
382382
"\
383383
[UPDATING] `alternative` index
384384
[UPDATING] `dummy-registry` index
385385
[DOWNLOADING] crates ...
386386
[DOWNLOADED] crates_io_dep v0.0.1 (registry `dummy-registry`)
387387
[DOWNLOADED] alt_reg_dep v0.1.0 (registry `alternative`)
388-
[COMPILING] alt_reg_dep v0.1.0 (registry `alternative`)
389-
[COMPILING] crates_io_dep v0.0.1
390-
[COMPILING] foo v0.0.1 ([CWD])
388+
[CHECKING] alt_reg_dep v0.1.0 (registry `alternative`)
389+
[CHECKING] crates_io_dep v0.0.1
390+
[CHECKING] foo v0.0.1 ([CWD])
391391
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
392392
",
393393
)
@@ -580,12 +580,12 @@ fn patch_alt_reg() {
580580
.file("bar/src/lib.rs", "pub fn bar() {}")
581581
.build();
582582

583-
p.cargo("build")
583+
p.cargo("check")
584584
.with_stderr(
585585
"\
586586
[UPDATING] `alternative` index
587-
[COMPILING] bar v0.1.0 ([CWD]/bar)
588-
[COMPILING] foo v0.0.1 ([CWD])
587+
[CHECKING] bar v0.1.0 ([CWD]/bar)
588+
[CHECKING] foo v0.0.1 ([CWD])
589589
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
590590
",
591591
)
@@ -662,14 +662,14 @@ fn no_api() {
662662
.file("src/lib.rs", "")
663663
.build();
664664

665-
p.cargo("build")
665+
p.cargo("check")
666666
.with_stderr(
667667
"\
668668
[UPDATING] `alternative` index
669669
[DOWNLOADING] crates ...
670670
[DOWNLOADED] bar v0.0.1 (registry `alternative`)
671-
[COMPILING] bar v0.0.1 (registry `alternative`)
672-
[COMPILING] foo v0.0.1 ([CWD])
671+
[CHECKING] bar v0.0.1 (registry `alternative`)
672+
[CHECKING] foo v0.0.1 ([CWD])
673673
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
674674
",
675675
)
@@ -1050,7 +1050,7 @@ fn unknown_registry() {
10501050
config.insert(start + start_index, '#');
10511051
fs::write(&cfg_path, config).unwrap();
10521052

1053-
p.cargo("build").run();
1053+
p.cargo("check").run();
10541054

10551055
// Important parts:
10561056
// foo -> bar registry = null
@@ -1212,14 +1212,14 @@ fn registries_index_relative_url() {
12121212

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

1215-
p.cargo("build")
1215+
p.cargo("check")
12161216
.with_stderr(
12171217
"\
12181218
[UPDATING] `relative` index
12191219
[DOWNLOADING] crates ...
12201220
[DOWNLOADED] bar v0.0.1 (registry `relative`)
1221-
[COMPILING] bar v0.0.1 (registry `relative`)
1222-
[COMPILING] foo v0.0.1 ([CWD])
1221+
[CHECKING] bar v0.0.1 (registry `relative`)
1222+
[CHECKING] foo v0.0.1 ([CWD])
12231223
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
12241224
",
12251225
)
@@ -1259,7 +1259,7 @@ fn registries_index_relative_path_not_allowed() {
12591259

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

1262-
p.cargo("build")
1262+
p.cargo("check")
12631263
.with_stderr(&format!(
12641264
"\
12651265
error: failed to parse manifest at `{root}/foo/Cargo.toml`

0 commit comments

Comments
 (0)