@@ -22,13 +22,7 @@ fn configure(cmd: &str, host: &[&str], target: &[&str]) -> Config {
2222}
2323
2424fn configure_with_args ( cmd : & [ & str ] , host : & [ & str ] , target : & [ & str ] ) -> Config {
25- TestCtx :: new ( )
26- . config ( cmd[ 0 ] )
27- . args ( & cmd[ 1 ..] )
28- . hosts ( host)
29- . targets ( target)
30- . args ( & [ "--build" , TEST_TRIPLE_1 ] )
31- . create_config ( )
25+ TestCtx :: new ( ) . config ( cmd[ 0 ] ) . args ( & cmd[ 1 ..] ) . hosts ( host) . targets ( target) . create_config ( )
3226}
3327
3428fn first < A , B > ( v : Vec < ( A , B ) > ) -> Vec < A > {
@@ -218,25 +212,25 @@ fn prepare_rustc_checkout(ctx: &mut GitCtx) {
218212
219213/// Parses a Config directory from `path`, with the given value of `download_rustc`.
220214fn parse_config_download_rustc_at ( path : & Path , download_rustc : & str , ci : bool ) -> Config {
221- Config :: parse_inner (
222- Flags :: parse ( & [
223- "build" . to_owned ( ) ,
224- "--dry-run" . to_owned ( ) ,
225- "--ci" . to_owned ( ) ,
226- if ci { "true" } else { "false" } . to_owned ( ) ,
227- format ! ( "--set=rust.download-rustc='{download_rustc}'" ) ,
228- "--src" . to_owned ( ) ,
229- path. to_str ( ) . unwrap ( ) . to_owned ( ) ,
230- ] ) ,
231- |& _| Ok ( Default :: default ( ) ) ,
232- )
215+ TestCtx :: new ( )
216+ . config ( "build" )
217+ . args ( & [
218+ "--ci" ,
219+ if ci { "true" } else { "false" } ,
220+ format ! ( "--set=rust.download-rustc='{download_rustc}'" ) . as_str ( ) ,
221+ "--src" ,
222+ path. to_str ( ) . unwrap ( ) ,
223+ ] )
224+ . no_override_download_ci_llvm ( )
225+ . create_config ( )
233226}
234227
235228mod dist {
236229 use pretty_assertions:: assert_eq;
237230
238231 use super :: { Config , TEST_TRIPLE_1 , TEST_TRIPLE_2 , TEST_TRIPLE_3 , first, run_build} ;
239232 use crate :: Flags ;
233+ use crate :: core:: builder:: tests:: host_target;
240234 use crate :: core:: builder:: * ;
241235
242236 fn configure ( host : & [ & str ] , target : & [ & str ] ) -> Config {
@@ -245,11 +239,11 @@ mod dist {
245239
246240 #[ test]
247241 fn llvm_out_behaviour ( ) {
248- let mut config = configure ( & [ TEST_TRIPLE_1 ] , & [ TEST_TRIPLE_2 ] ) ;
242+ let mut config = configure ( & [ ] , & [ TEST_TRIPLE_2 ] ) ;
249243 config. llvm_from_ci = true ;
250244 let build = Build :: new ( config. clone ( ) ) ;
251245
252- let target = TargetSelection :: from_user ( TEST_TRIPLE_1 ) ;
246+ let target = TargetSelection :: from_user ( & host_target ( ) ) ;
253247 assert ! ( build. llvm_out( target) . ends_with( "ci-llvm" ) ) ;
254248 let target = TargetSelection :: from_user ( TEST_TRIPLE_2 ) ;
255249 assert ! ( build. llvm_out( target) . ends_with( "llvm" ) ) ;
@@ -314,7 +308,7 @@ mod sysroot_target_dirs {
314308/// cg_gcc tests instead.
315309#[ test]
316310fn test_test_compiler ( ) {
317- let config = configure_with_args ( & [ "test" , "compiler" ] , & [ TEST_TRIPLE_1 ] , & [ TEST_TRIPLE_1 ] ) ;
311+ let config = configure_with_args ( & [ "test" , "compiler" ] , & [ & host_target ( ) ] , & [ TEST_TRIPLE_1 ] ) ;
318312 let cache = run_build ( & config. paths . clone ( ) , config) ;
319313
320314 let compiler = cache. contains :: < test:: CrateLibrustc > ( ) ;
@@ -347,7 +341,7 @@ fn test_test_coverage() {
347341 // Print each test case so that if one fails, the most recently printed
348342 // case is the one that failed.
349343 println ! ( "Testing case: {cmd:?}" ) ;
350- let config = configure_with_args ( cmd, & [ TEST_TRIPLE_1 ] , & [ TEST_TRIPLE_1 ] ) ;
344+ let config = configure_with_args ( cmd, & [ ] , & [ TEST_TRIPLE_1 ] ) ;
351345 let mut cache = run_build ( & config. paths . clone ( ) , config) ;
352346
353347 let modes =
@@ -359,14 +353,7 @@ fn test_test_coverage() {
359353#[ test]
360354fn test_prebuilt_llvm_config_path_resolution ( ) {
361355 fn configure ( config : & str ) -> Config {
362- Config :: parse_inner (
363- Flags :: parse ( & [
364- "build" . to_string ( ) ,
365- "--dry-run" . to_string ( ) ,
366- "--config=/does/not/exist" . to_string ( ) ,
367- ] ) ,
368- |& _| toml:: from_str ( & config) ,
369- )
356+ TestCtx :: new ( ) . config ( "build" ) . with_default_toml_config ( config) . create_config ( )
370357 }
371358
372359 // Removes Windows disk prefix if present
0 commit comments