diff --git a/src/bootstrap/builder/tests.rs b/src/bootstrap/builder/tests.rs index 4a9082d3e8576..3ca41be0a9f3b 100644 --- a/src/bootstrap/builder/tests.rs +++ b/src/bootstrap/builder/tests.rs @@ -342,31 +342,29 @@ mod dist { } #[test] - fn dist_with_target_flag() { - let mut config = configure(&["B"], &["C"]); - config.skip_only_host_steps = true; // as-if --target=C was passed + fn dist_with_empty_host() { + let mut config = configure(&[], &["C"]); + config.skip_only_host_steps = true; let build = Build::new(config); let mut builder = Builder::new(&build); builder.run_step_descriptions(&Builder::get_step_descriptions(Kind::Dist), &[]); let a = TargetSelection::from_user("A"); - let b = TargetSelection::from_user("B"); let c = TargetSelection::from_user("C"); assert_eq!( first(builder.cache.all::()), - &[dist::Docs { host: a }, dist::Docs { host: b }, dist::Docs { host: c },] + &[dist::Docs { host: a }, dist::Docs { host: c },] ); assert_eq!( first(builder.cache.all::()), - &[dist::Mingw { host: a }, dist::Mingw { host: b }, dist::Mingw { host: c },] + &[dist::Mingw { host: a }, dist::Mingw { host: c },] ); assert_eq!(first(builder.cache.all::()), &[]); assert_eq!( first(builder.cache.all::()), &[ dist::Std { compiler: Compiler { host: a, stage: 1 }, target: a }, - dist::Std { compiler: Compiler { host: a, stage: 1 }, target: b }, dist::Std { compiler: Compiler { host: a, stage: 2 }, target: c }, ] ); @@ -464,15 +462,14 @@ mod dist { } #[test] - fn build_with_target_flag() { - let mut config = configure(&["B"], &["C"]); + fn build_with_empty_host() { + let mut config = configure(&[], &["C"]); config.skip_only_host_steps = true; let build = Build::new(config); let mut builder = Builder::new(&build); builder.run_step_descriptions(&Builder::get_step_descriptions(Kind::Build), &[]); let a = TargetSelection::from_user("A"); - let b = TargetSelection::from_user("B"); let c = TargetSelection::from_user("C"); assert_eq!( @@ -481,8 +478,6 @@ mod dist { compile::Std { compiler: Compiler { host: a, stage: 0 }, target: a }, compile::Std { compiler: Compiler { host: a, stage: 1 }, target: a }, compile::Std { compiler: Compiler { host: a, stage: 2 }, target: a }, - compile::Std { compiler: Compiler { host: a, stage: 1 }, target: b }, - compile::Std { compiler: Compiler { host: a, stage: 2 }, target: b }, compile::Std { compiler: Compiler { host: a, stage: 2 }, target: c }, ] ); diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index b14746dabb93a..942d1178a641d 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -586,11 +586,6 @@ impl Config { let build = toml.build.unwrap_or_default(); - // If --target was specified but --host wasn't specified, don't run any host-only tests. - let has_hosts = build.host.is_some() || flags.host.is_some(); - let has_targets = build.target.is_some() || flags.target.is_some(); - config.skip_only_host_steps = !has_hosts && has_targets; - config.hosts = if let Some(arg_host) = flags.host { arg_host } else if let Some(file_host) = build.host { @@ -598,6 +593,8 @@ impl Config { } else { vec![config.build] }; + // If host was explicitly given an empty list, don't run any host-only steps. + config.skip_only_host_steps = config.hosts.is_empty(); config.targets = if let Some(arg_target) = flags.target { arg_target } else if let Some(file_target) = build.target {