mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
simplify tests for host
target specifier
This commit is contained in:
parent
b23e0a99b2
commit
8f66af7194
@ -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]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user