From 8f66af71945147c3fbcaf156fe9cc617d16e519b Mon Sep 17 00:00:00 2001 From: zdivelbiss <8019570+zdivelbiss@users.noreply.github.com> Date: Sat, 16 Aug 2025 17:32:49 -0500 Subject: [PATCH] simplify tests for `host` target specifier --- tests/testsuite/cross_compile.rs | 46 ++++++-------------------------- 1 file changed, 8 insertions(+), 38 deletions(-) diff --git a/tests/testsuite/cross_compile.rs b/tests/testsuite/cross_compile.rs index 89fe628ca..e2f9009f0 100644 --- a/tests/testsuite/cross_compile.rs +++ b/tests/testsuite/cross_compile.rs @@ -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]