mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
add build script failure test when requesting backtraces
it displays an additional message on how to improve these backtraces, now that debuginfo is turned off most of the time in `dev.build-override`.
This commit is contained in:
parent
881533b590
commit
7dfabdc681
@ -47,6 +47,44 @@ Caused by:
|
||||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn custom_build_script_failed_backtraces_message() {
|
||||
// In this situation (no dependency sharing), debuginfo is turned off in
|
||||
// `dev.build-override`. However, if an error occurs running e.g. a build
|
||||
// script, and backtraces are opted into: a message explaining how to
|
||||
// improve backtraces is also displayed.
|
||||
let p = project()
|
||||
.file(
|
||||
"Cargo.toml",
|
||||
r#"
|
||||
[package]
|
||||
|
||||
name = "foo"
|
||||
version = "0.5.0"
|
||||
authors = ["wycats@example.com"]
|
||||
build = "build.rs"
|
||||
"#,
|
||||
)
|
||||
.file("src/main.rs", "fn main() {}")
|
||||
.file("build.rs", "fn main() { std::process::exit(101); }")
|
||||
.build();
|
||||
p.cargo("build -v")
|
||||
.env("RUST_BACKTRACE", "1")
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"\
|
||||
[COMPILING] foo v0.5.0 ([CWD])
|
||||
[RUNNING] `rustc --crate-name build_script_build build.rs [..]--crate-type bin [..]`
|
||||
[RUNNING] `[..]/build-script-build`
|
||||
[ERROR] failed to run custom build command for `foo v0.5.0 ([CWD])`
|
||||
note: To improve backtraces for build dependencies[..]
|
||||
|
||||
Caused by:
|
||||
process didn't exit successfully: `[..]/build-script-build` (exit [..]: 101)",
|
||||
)
|
||||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn custom_build_env_vars() {
|
||||
let p = project()
|
||||
|
Loading…
x
Reference in New Issue
Block a user