Skip to content

Commit cedab5d

Browse files
committed
Add test for cargo rustc --print cfg that relies on an env target
1 parent 05f54fd commit cedab5d

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

tests/testsuite/rustc.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,38 @@ windows
794794
.run();
795795
}
796796

797+
#[cargo_test]
798+
fn rustc_with_print_cfg_config_toml_env() {
799+
let p = project()
800+
.file("Cargo.toml", &basic_bin_manifest("foo"))
801+
.file(
802+
"targets/best-target.json",
803+
r#"{
804+
"llvm-target": "x86_64-unknown-none",
805+
"target-pointer-width": "64",
806+
"data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128",
807+
"arch": "x86_64"
808+
}"#,
809+
)
810+
.file(
811+
".cargo/config.toml",
812+
r#"
813+
[build]
814+
target = "best-target"
815+
[env]
816+
RUST_TARGET_PATH = { value = "./targets", relative = true }
817+
"#,
818+
)
819+
.file("src/main.rs", r#"fn main() {} "#)
820+
.build();
821+
822+
p.cargo("rustc -Z unstable-options --print cfg")
823+
.masquerade_as_nightly_cargo(&["print"])
824+
.with_status(101)
825+
.with_stdout_data(str!["..."].unordered())
826+
.run();
827+
}
828+
797829
#[cargo_test]
798830
fn precedence() {
799831
// Ensure that the precedence of cargo-rustc is only lower than RUSTFLAGS,

0 commit comments

Comments
 (0)