Skip to content

Commit e57a2f4

Browse files
committed
test: show that -Awarnings fails target info probing
This will be resolved in the next commit
1 parent 4a88f92 commit e57a2f4

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ jobs:
161161
- run: rustup update --no-self-update stable
162162
- run: rustup update --no-self-update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
163163
- run: rustup target add ${{ matrix.other }}
164+
- run: rustup target add wasm32-unknown-unknown
164165
- run: rustup target add aarch64-unknown-none # need this for build-std mock tests
165166
if: startsWith(matrix.rust, 'nightly')
166167
- run: rustup component add rustc-dev llvm-tools-preview rust-docs
@@ -225,6 +226,7 @@ jobs:
225226
- uses: actions/checkout@v4
226227
- run: rustup update --no-self-update stable && rustup default stable
227228
- run: rustup target add i686-unknown-linux-gnu
229+
- run: rustup target add wasm32-unknown-unknown
228230
- run: sudo apt update -y && sudo apt install gcc-multilib libsecret-1-0 libsecret-1-dev -y
229231
- run: rustup component add rustfmt || echo "rustfmt not available"
230232
- run: cargo test -p cargo

tests/testsuite/cross_compile.rs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,3 +1260,38 @@ fn doctest_xcompile_linker() {
12601260
"#]])
12611261
.run();
12621262
}
1263+
1264+
#[cargo_test]
1265+
fn always_emit_warnings_as_warnings_when_learning_target_info() {
1266+
if cross_compile::disabled() {
1267+
return;
1268+
}
1269+
1270+
let target = "wasm32-unknown-unknown";
1271+
if !cross_compile::requires_target_installed(target) {
1272+
return;
1273+
}
1274+
1275+
let p = project()
1276+
.file(
1277+
"Cargo.toml",
1278+
r#"
1279+
[package]
1280+
name = "foo"
1281+
edition = "2015"
1282+
"#,
1283+
)
1284+
.file("src/lib.rs", "")
1285+
.build();
1286+
1287+
p.cargo("build -v --target")
1288+
.env("RUSTFLAGS", "-Awarnings")
1289+
.arg(target)
1290+
.with_status(101)
1291+
.with_stderr_data(str![[r#"
1292+
[ERROR] output of --print=file-names missing when learning about target-specific information from rustc
1293+
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`
1294+
...
1295+
"#]])
1296+
.run();
1297+
}

0 commit comments

Comments
 (0)