Skip to content

Commit d0b12c0

Browse files
committed
add assertions checking the absence of debuginfo
Add some assertions to ensure that debuginfo is not used to compile build dependencies, in a way that differs between the old and new defaults: some of the assert elision could match the previous defaults with debuginfo. These new assertions break if `-C debuginfo` is present in the commands cargo ran.
1 parent e27336e commit d0b12c0

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

tests/testsuite/profile_targets.rs

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,10 @@ fn profile_selection_build() {
8282
// NOTES:
8383
// - bdep `panic` is not set because it thinks `build.rs` is a plugin.
8484
// - build_script_build is built without panic because it thinks `build.rs` is a plugin.
85-
p.cargo("build -vv").with_stderr_unordered("\
85+
// - We make sure that the build dependencies bar, bdep, and build.rs
86+
// are built without debuginfo.
87+
p.cargo("build -vv")
88+
.with_stderr_unordered("\
8689
[COMPILING] bar [..]
8790
[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C panic=abort[..]-C codegen-units=1 -C debuginfo=2 [..]
8891
[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=5 [..]
@@ -95,7 +98,12 @@ fn profile_selection_build() {
9598
[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=[..]link -C panic=abort[..]-C codegen-units=1 -C debuginfo=2 [..]
9699
[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--crate-type bin --emit=[..]link -C panic=abort[..]-C codegen-units=1 -C debuginfo=2 [..]
97100
[FINISHED] dev [unoptimized + debuginfo] [..]
98-
").run();
101+
"
102+
)
103+
.with_stderr_line_without(&["[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]-C codegen-units=5 [..]"], &["-C debuginfo"])
104+
.with_stderr_line_without(&["[RUNNING] `[..] rustc --crate-name bdep bdep/src/lib.rs [..]-C codegen-units=5 [..]"], &["-C debuginfo"])
105+
.with_stderr_line_without(&["[RUNNING] `[..] rustc --crate-name build_script_build build.rs [..]-C codegen-units=5 [..]"], &["-C debuginfo"])
106+
.run();
99107
p.cargo("build -vv")
100108
.with_stderr_unordered(
101109
"\
@@ -149,6 +157,8 @@ fn profile_selection_build_all_targets() {
149157
// `build.rs` is a plugin.
150158
// - Benchmark dependencies are compiled in `dev` mode, which may be
151159
// surprising. See issue rust-lang/cargo#4929.
160+
// - We make sure that the build dependencies bar, bdep, and build.rs
161+
// are built without debuginfo.
152162
//
153163
// - Dependency profiles:
154164
// Pkg Target Profile Reason
@@ -169,7 +179,8 @@ fn profile_selection_build_all_targets() {
169179
// bin dev dev
170180
// bin dev build
171181
// example dev build
172-
p.cargo("build --all-targets -vv").with_stderr_unordered("\
182+
p.cargo("build --all-targets -vv")
183+
.with_stderr_unordered("\
173184
[COMPILING] bar [..]
174185
[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=1 -C debuginfo=2 [..]
175186
[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C panic=abort[..]-C codegen-units=1 -C debuginfo=2 [..]
@@ -189,7 +200,12 @@ fn profile_selection_build_all_targets() {
189200
[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--crate-type bin --emit=[..]link -C panic=abort[..]-C codegen-units=1 -C debuginfo=2 [..]`
190201
[RUNNING] `[..] rustc --crate-name ex1 examples/ex1.rs [..]--crate-type bin --emit=[..]link -C panic=abort[..]-C codegen-units=1 -C debuginfo=2 [..]`
191202
[FINISHED] dev [unoptimized + debuginfo] [..]
192-
").run();
203+
"
204+
)
205+
.with_stderr_line_without(&["[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]-C codegen-units=5 [..]"], &["-C debuginfo"])
206+
.with_stderr_line_without(&["[RUNNING] `[..] rustc --crate-name bdep bdep/src/lib.rs [..]-C codegen-units=5 [..]"], &["-C debuginfo"])
207+
.with_stderr_line_without(&["[RUNNING] `[..] rustc --crate-name build_script_build build.rs [..]-C codegen-units=5 [..]"], &["-C debuginfo"])
208+
.run();
193209
p.cargo("build -vv")
194210
.with_stderr_unordered(
195211
"\

0 commit comments

Comments
 (0)