simplify tests for host target specifier

This commit is contained in:
zdivelbiss 2025-08-16 17:32:49 -05:00
parent b23e0a99b2
commit 8f66af7194
No known key found for this signature in database
GPG Key ID: C23B2502264BFF51

View File

@ -154,27 +154,12 @@ fn target_host_arg() {
rustc_host() rustc_host()
), ),
) )
.file( .file("src/lib.rs", r#""#)
"src/main.rs",
&format!(
r#"
use std::env;
fn main() {{
assert_eq!(env::consts::ARCH, "{}");
}}
"#,
cross_compile::native_arch()
),
)
.build(); .build();
let target = rustc_host(); p.cargo("build -v --target host")
p.cargo(&format!("build -v --target {target}")).run(); .with_stderr_contains("[RUNNING] `rustc [..] --target [HOST_TARGET] [..]`")
assert!(p.target_bin(target, "foo").is_file()); .run();
if cross_compile_can_run_on_host() {
p.process(&p.target_bin(target, "foo")).run();
}
} }
#[cargo_test] #[cargo_test]
@ -215,27 +200,12 @@ fn target_host_config() {
rustc_host() rustc_host()
), ),
) )
.file( .file("src/lib.rs", r#""#)
"src/main.rs",
&format!(
r#"
use std::env;
fn main() {{
assert_eq!(env::consts::ARCH, "{}");
}}
"#,
cross_compile::native_arch()
),
)
.build(); .build();
let target = rustc_host(); p.cargo("build -v")
p.cargo("build -v").run(); .with_stderr_contains("[RUNNING] `rustc [..] --target [HOST_TARGET] [..]`")
assert!(p.target_bin(target, "foo").is_file()); .run();
if cross_compile_can_run_on_host() {
p.process(&p.target_bin(target, "foo")).run();
}
} }
#[cargo_test] #[cargo_test]