Skip to content

Commit 6adbb3a

Browse files
committed
remove explicit target assignment in config during rustc initialization
1 parent 33e262e commit 6adbb3a

File tree

2 files changed

+8
-15
lines changed

2 files changed

+8
-15
lines changed

src/bootstrap/src/core/builder/tests.rs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,7 @@ fn configure(cmd: &str, host: &[&str], target: &[&str]) -> Config {
2222
}
2323

2424
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()
3226
}
3327

3428
fn first<A, B>(v: Vec<(A, B)>) -> Vec<A> {
@@ -236,6 +230,7 @@ mod dist {
236230

237231
use super::{Config, TEST_TRIPLE_1, TEST_TRIPLE_2, TEST_TRIPLE_3, first, run_build};
238232
use crate::Flags;
233+
use crate::core::builder::tests::host_target;
239234
use crate::core::builder::*;
240235

241236
fn configure(host: &[&str], target: &[&str]) -> Config {
@@ -244,11 +239,11 @@ mod dist {
244239

245240
#[test]
246241
fn llvm_out_behaviour() {
247-
let mut config = configure(&[TEST_TRIPLE_1], &[TEST_TRIPLE_2]);
242+
let mut config = configure(&[], &[TEST_TRIPLE_2]);
248243
config.llvm_from_ci = true;
249244
let build = Build::new(config.clone());
250245

251-
let target = TargetSelection::from_user(TEST_TRIPLE_1);
246+
let target = TargetSelection::from_user(&host_target());
252247
assert!(build.llvm_out(target).ends_with("ci-llvm"));
253248
let target = TargetSelection::from_user(TEST_TRIPLE_2);
254249
assert!(build.llvm_out(target).ends_with("llvm"));
@@ -313,14 +308,14 @@ mod sysroot_target_dirs {
313308
/// cg_gcc tests instead.
314309
#[test]
315310
fn test_test_compiler() {
316-
let config = configure_with_args(&["test", "compiler"], &[TEST_TRIPLE_1], &[TEST_TRIPLE_1]);
311+
let config = configure_with_args(&["test", "compiler"], &[], &[TEST_TRIPLE_1]);
317312
let cache = run_build(&config.paths.clone(), config);
318313

319314
let compiler = cache.contains::<test::CrateLibrustc>();
320315
let cranelift = cache.contains::<test::CodegenCranelift>();
321316
let gcc = cache.contains::<test::CodegenGCC>();
322317

323-
assert_eq!((compiler, cranelift, gcc), (true, false, false));
318+
assert_eq!((compiler, cranelift, gcc), (false, false, false));
324319
}
325320

326321
#[test]
@@ -346,7 +341,7 @@ fn test_test_coverage() {
346341
// Print each test case so that if one fails, the most recently printed
347342
// case is the one that failed.
348343
println!("Testing case: {cmd:?}");
349-
let config = configure_with_args(cmd, &[TEST_TRIPLE_1], &[TEST_TRIPLE_1]);
344+
let config = configure_with_args(cmd, &[], &[TEST_TRIPLE_1]);
350345
let mut cache = run_build(&config.paths.clone(), config);
351346

352347
let modes =

src/bootstrap/src/core/config/config.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -688,9 +688,7 @@ impl Config {
688688

689689
let initial_rustc = build_rustc.unwrap_or_else(|| {
690690
download_beta_toolchain(&dwn_ctx, &out);
691-
let target = if cfg!(test) { get_host_target() } else { host_target };
692-
693-
out.join(target).join("stage0").join("bin").join(exe("rustc", host_target))
691+
out.join(host_target).join("stage0").join("bin").join(exe("rustc", host_target))
694692
});
695693

696694
let initial_sysroot = t!(PathBuf::from_str(

0 commit comments

Comments
 (0)