@@ -22,13 +22,7 @@ fn configure(cmd: &str, host: &[&str], target: &[&str]) -> Config {
22
22
}
23
23
24
24
fn 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 ( )
32
26
}
33
27
34
28
fn first < A , B > ( v : Vec < ( A , B ) > ) -> Vec < A > {
@@ -218,25 +212,25 @@ fn prepare_rustc_checkout(ctx: &mut GitCtx) {
218
212
219
213
/// Parses a Config directory from `path`, with the given value of `download_rustc`.
220
214
fn 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 ( )
233
226
}
234
227
235
228
mod dist {
236
229
use pretty_assertions:: assert_eq;
237
230
238
231
use super :: { Config , TEST_TRIPLE_1 , TEST_TRIPLE_2 , TEST_TRIPLE_3 , first, run_build} ;
239
232
use crate :: Flags ;
233
+ use crate :: core:: builder:: tests:: host_target;
240
234
use crate :: core:: builder:: * ;
241
235
242
236
fn configure ( host : & [ & str ] , target : & [ & str ] ) -> Config {
@@ -245,11 +239,11 @@ mod dist {
245
239
246
240
#[ test]
247
241
fn llvm_out_behaviour ( ) {
248
- let mut config = configure ( & [ TEST_TRIPLE_1 ] , & [ TEST_TRIPLE_2 ] ) ;
242
+ let mut config = configure ( & [ ] , & [ TEST_TRIPLE_2 ] ) ;
249
243
config. llvm_from_ci = true ;
250
244
let build = Build :: new ( config. clone ( ) ) ;
251
245
252
- let target = TargetSelection :: from_user ( TEST_TRIPLE_1 ) ;
246
+ let target = TargetSelection :: from_user ( & host_target ( ) ) ;
253
247
assert ! ( build. llvm_out( target) . ends_with( "ci-llvm" ) ) ;
254
248
let target = TargetSelection :: from_user ( TEST_TRIPLE_2 ) ;
255
249
assert ! ( build. llvm_out( target) . ends_with( "llvm" ) ) ;
@@ -314,7 +308,7 @@ mod sysroot_target_dirs {
314
308
/// cg_gcc tests instead.
315
309
#[ test]
316
310
fn 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 ] ) ;
318
312
let cache = run_build ( & config. paths . clone ( ) , config) ;
319
313
320
314
let compiler = cache. contains :: < test:: CrateLibrustc > ( ) ;
@@ -347,7 +341,7 @@ fn test_test_coverage() {
347
341
// Print each test case so that if one fails, the most recently printed
348
342
// case is the one that failed.
349
343
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 ] ) ;
351
345
let mut cache = run_build ( & config. paths . clone ( ) , config) ;
352
346
353
347
let modes =
@@ -359,14 +353,7 @@ fn test_test_coverage() {
359
353
#[ test]
360
354
fn test_prebuilt_llvm_config_path_resolution ( ) {
361
355
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 ( )
370
357
}
371
358
372
359
// Removes Windows disk prefix if present
0 commit comments