test: show that -Awarnings fails target info probing

This will be resolved in the next commit
This commit is contained in:
Weihang Lo 2025-01-08 15:36:23 -05:00
parent 4a88f924c6
commit e57a2f43c2
No known key found for this signature in database
GPG Key ID: D7DBF189825E82E7
2 changed files with 37 additions and 0 deletions

View File

@ -161,6 +161,7 @@ jobs:
- run: rustup update --no-self-update stable
- run: rustup update --no-self-update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
- run: rustup target add ${{ matrix.other }}
- run: rustup target add wasm32-unknown-unknown
- run: rustup target add aarch64-unknown-none # need this for build-std mock tests
if: startsWith(matrix.rust, 'nightly')
- run: rustup component add rustc-dev llvm-tools-preview rust-docs
@ -225,6 +226,7 @@ jobs:
- uses: actions/checkout@v4
- run: rustup update --no-self-update stable && rustup default stable
- run: rustup target add i686-unknown-linux-gnu
- run: rustup target add wasm32-unknown-unknown
- run: sudo apt update -y && sudo apt install gcc-multilib libsecret-1-0 libsecret-1-dev -y
- run: rustup component add rustfmt || echo "rustfmt not available"
- run: cargo test -p cargo

View File

@ -1260,3 +1260,38 @@ fn doctest_xcompile_linker() {
"#]])
.run();
}
#[cargo_test]
fn always_emit_warnings_as_warnings_when_learning_target_info() {
if cross_compile::disabled() {
return;
}
let target = "wasm32-unknown-unknown";
if !cross_compile::requires_target_installed(target) {
return;
}
let p = project()
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
edition = "2015"
"#,
)
.file("src/lib.rs", "")
.build();
p.cargo("build -v --target")
.env("RUSTFLAGS", "-Awarnings")
.arg(target)
.with_status(101)
.with_stderr_data(str![[r#"
[ERROR] output of --print=file-names missing when learning about target-specific information from rustc
command was: `rustc - --crate-name ___ --print=file-names -Awarnings --target wasm32-unknown-unknown --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=split-debuginfo --print=crate-name --print=cfg`
...
"#]])
.run();
}