@@ -154,27 +154,12 @@ fn target_host_arg() {
154154 rustc_host( )
155155 ) ,
156156 )
157- . file (
158- "src/main.rs" ,
159- & format ! (
160- r#"
161- use std::env;
162- fn main() {{
163- assert_eq!(env::consts::ARCH, "{}");
164- }}
165- "# ,
166- cross_compile:: native_arch( )
167- ) ,
168- )
157+ . file ( "src/lib.rs" , r#""# )
169158 . build ( ) ;
170159
171- let target = rustc_host ( ) ;
172- p. cargo ( & format ! ( "build -v --target {target}" ) ) . run ( ) ;
173- assert ! ( p. target_bin( target, "foo" ) . is_file( ) ) ;
174-
175- if cross_compile_can_run_on_host ( ) {
176- p. process ( & p. target_bin ( target, "foo" ) ) . run ( ) ;
177- }
160+ p. cargo ( "build -v --target host" )
161+ . with_stderr_contains ( "[RUNNING] `rustc [..] --target [HOST_TARGET] [..]`" )
162+ . run ( ) ;
178163}
179164
180165#[ cargo_test]
@@ -215,27 +200,12 @@ fn target_host_config() {
215200 rustc_host( )
216201 ) ,
217202 )
218- . file (
219- "src/main.rs" ,
220- & format ! (
221- r#"
222- use std::env;
223- fn main() {{
224- assert_eq!(env::consts::ARCH, "{}");
225- }}
226- "# ,
227- cross_compile:: native_arch( )
228- ) ,
229- )
203+ . file ( "src/lib.rs" , r#""# )
230204 . build ( ) ;
231205
232- let target = rustc_host ( ) ;
233- p. cargo ( "build -v" ) . run ( ) ;
234- assert ! ( p. target_bin( target, "foo" ) . is_file( ) ) ;
235-
236- if cross_compile_can_run_on_host ( ) {
237- p. process ( & p. target_bin ( target, "foo" ) ) . run ( ) ;
238- }
206+ p. cargo ( "build -v" )
207+ . with_stderr_contains ( "[RUNNING] `rustc [..] --target [HOST_TARGET] [..]`" )
208+ . run ( ) ;
239209}
240210
241211#[ cargo_test]
0 commit comments