Skip to content

Commit

Permalink
test: show that -Awarnings fails target info probing
Browse files Browse the repository at this point in the history
This will be resolved in the next commit
  • Loading branch information
weihanglo committed Jan 8, 2025
1 parent 5124054 commit f90f298
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
35 changes: 35 additions & 0 deletions tests/testsuite/cross_compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

0 comments on commit f90f298

Please sign in to comment.