mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-25 11:14:46 +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()
|
||||
),
|
||||
)
|
||||
.file(
|
||||
"src/main.rs",
|
||||
&format!(
|
||||
r#"
|
||||
use std::env;
|
||||
fn main() {{
|
||||
assert_eq!(env::consts::ARCH, "{}");
|
||||
}}
|
||||
"#,
|
||||
cross_compile::native_arch()
|
||||
),
|
||||
)
|
||||
.file("src/lib.rs", r#""#)
|
||||
.build();
|
||||
|
||||
let target = rustc_host();
|
||||
p.cargo(&format!("build -v --target {target}")).run();
|
||||
assert!(p.target_bin(target, "foo").is_file());
|
||||
|
||||
if cross_compile_can_run_on_host() {
|
||||
p.process(&p.target_bin(target, "foo")).run();
|
||||
}
|
||||
p.cargo("build -v --target host")
|
||||
.with_stderr_contains("[RUNNING] `rustc [..] --target [HOST_TARGET] [..]`")
|
||||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
@ -215,27 +200,12 @@ fn target_host_config() {
|
||||
rustc_host()
|
||||
),
|
||||
)
|
||||
.file(
|
||||
"src/main.rs",
|
||||
&format!(
|
||||
r#"
|
||||
use std::env;
|
||||
fn main() {{
|
||||
assert_eq!(env::consts::ARCH, "{}");
|
||||
}}
|
||||
"#,
|
||||
cross_compile::native_arch()
|
||||
),
|
||||
)
|
||||
.file("src/lib.rs", r#""#)
|
||||
.build();
|
||||
|
||||
let target = rustc_host();
|
||||
p.cargo("build -v").run();
|
||||
assert!(p.target_bin(target, "foo").is_file());
|
||||
|
||||
if cross_compile_can_run_on_host() {
|
||||
p.process(&p.target_bin(target, "foo")).run();
|
||||
}
|
||||
p.cargo("build -v")
|
||||
.with_stderr_contains("[RUNNING] `rustc [..] --target [HOST_TARGET] [..]`")
|
||||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
|
Loading…
x
Reference in New Issue
Block a user