Skip to content

Commit 52ca5ca

Browse files
committed
Remove skip_only_host_steps
And make tests explicitly list their hosts and targets.
1 parent e715c7f commit 52ca5ca

File tree

3 files changed

+23
-58
lines changed

3 files changed

+23
-58
lines changed

src/bootstrap/builder.rs

+1-9
Original file line numberDiff line numberDiff line change
@@ -172,15 +172,7 @@ impl StepDescription {
172172
}
173173

174174
// Determine the targets participating in this rule.
175-
let targets = if self.only_hosts {
176-
if builder.config.skip_only_host_steps {
177-
return; // don't run anything
178-
} else {
179-
&builder.hosts
180-
}
181-
} else {
182-
&builder.targets
183-
};
175+
let targets = if self.only_hosts { &builder.hosts } else { &builder.targets };
184176

185177
for target in targets {
186178
let run = RunConfig { builder, path: pathset.path(builder), target: *target };

src/bootstrap/builder/tests.rs

+22-45
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ fn configure(cmd: &str, host: &[&str], target: &[&str]) -> Config {
66
let mut config = Config::parse(&[cmd.to_owned()]);
77
// don't save toolstates
88
config.save_toolstates = None;
9-
config.skip_only_host_steps = false;
109
config.dry_run = true;
1110
config.ninja_in_file = false;
1211
// try to avoid spurious failures in dist where we create/delete each others file
@@ -20,16 +19,8 @@ fn configure(cmd: &str, host: &[&str], target: &[&str]) -> Config {
2019
t!(fs::create_dir_all(&dir));
2120
config.out = dir;
2221
config.build = TargetSelection::from_user("A");
23-
config.hosts = vec![config.build]
24-
.into_iter()
25-
.chain(host.iter().map(|s| TargetSelection::from_user(s)))
26-
.collect::<Vec<_>>();
27-
config.targets = config
28-
.hosts
29-
.clone()
30-
.into_iter()
31-
.chain(target.iter().map(|s| TargetSelection::from_user(s)))
32-
.collect::<Vec<_>>();
22+
config.hosts = host.iter().map(|s| TargetSelection::from_user(s)).collect();
23+
config.targets = target.iter().map(|s| TargetSelection::from_user(s)).collect();
3324
config
3425
}
3526

@@ -45,7 +36,7 @@ mod defaults {
4536

4637
#[test]
4738
fn build_default() {
48-
let build = Build::new(configure("build", &[], &[]));
39+
let build = Build::new(configure("build", &["A"], &["A"]));
4940
let mut builder = Builder::new(&build);
5041
builder.run_step_descriptions(&Builder::get_step_descriptions(Kind::Build), &[]);
5142

@@ -73,7 +64,7 @@ mod defaults {
7364

7465
#[test]
7566
fn build_stage_0() {
76-
let config = Config { stage: 0, ..configure("build", &[], &[]) };
67+
let config = Config { stage: 0, ..configure("build", &["A"], &["A"]) };
7768
let build = Build::new(config);
7869
let mut builder = Builder::new(&build);
7970
builder.run_step_descriptions(&Builder::get_step_descriptions(Kind::Build), &[]);
@@ -95,7 +86,7 @@ mod defaults {
9586

9687
#[test]
9788
fn build_cross_compile() {
98-
let config = Config { stage: 1, ..configure("build", &["B"], &["B"]) };
89+
let config = Config { stage: 1, ..configure("build", &["A", "B"], &["A", "B"]) };
9990
let build = Build::new(config);
10091
let mut builder = Builder::new(&build);
10192
builder.run_step_descriptions(&Builder::get_step_descriptions(Kind::Build), &[]);
@@ -143,7 +134,7 @@ mod defaults {
143134

144135
#[test]
145136
fn doc_default() {
146-
let mut config = configure("doc", &[], &[]);
137+
let mut config = configure("doc", &["A"], &["A"]);
147138
config.compiler_docs = true;
148139
config.cmd = Subcommand::Doc { paths: Vec::new(), open: false };
149140
let build = Build::new(config);
@@ -182,7 +173,7 @@ mod dist {
182173

183174
#[test]
184175
fn dist_baseline() {
185-
let build = Build::new(configure(&[], &[]));
176+
let build = Build::new(configure(&["A"], &["A"]));
186177
let mut builder = Builder::new(&build);
187178
builder.run_step_descriptions(&Builder::get_step_descriptions(Kind::Dist), &[]);
188179

@@ -208,7 +199,7 @@ mod dist {
208199

209200
#[test]
210201
fn dist_with_targets() {
211-
let build = Build::new(configure(&[], &["B"]));
202+
let build = Build::new(configure(&["A"], &["A", "B"]));
212203
let mut builder = Builder::new(&build);
213204
builder.run_step_descriptions(&Builder::get_step_descriptions(Kind::Dist), &[]);
214205

@@ -239,7 +230,7 @@ mod dist {
239230

240231
#[test]
241232
fn dist_with_hosts() {
242-
let build = Build::new(configure(&["B"], &[]));
233+
let build = Build::new(configure(&["A", "B"], &["A", "B"]));
243234
let mut builder = Builder::new(&build);
244235
builder.run_step_descriptions(&Builder::get_step_descriptions(Kind::Dist), &[]);
245236

@@ -285,7 +276,7 @@ mod dist {
285276
fn dist_only_cross_host() {
286277
let a = TargetSelection::from_user("A");
287278
let b = TargetSelection::from_user("B");
288-
let mut build = Build::new(configure(&["B"], &[]));
279+
let mut build = Build::new(configure(&["A", "B"], &["A", "B"]));
289280
build.config.docs = false;
290281
build.config.extended = true;
291282
build.hosts = vec![b];
@@ -307,7 +298,7 @@ mod dist {
307298

308299
#[test]
309300
fn dist_with_targets_and_hosts() {
310-
let build = Build::new(configure(&["B"], &["C"]));
301+
let build = Build::new(configure(&["A", "B"], &["A", "B", "C"]));
311302
let mut builder = Builder::new(&build);
312303
builder.run_step_descriptions(&Builder::get_step_descriptions(Kind::Dist), &[]);
313304

@@ -343,37 +334,25 @@ mod dist {
343334

344335
#[test]
345336
fn dist_with_empty_host() {
346-
let mut config = configure(&[], &["C"]);
347-
config.skip_only_host_steps = true;
337+
let config = configure(&[], &["C"]);
348338
let build = Build::new(config);
349339
let mut builder = Builder::new(&build);
350340
builder.run_step_descriptions(&Builder::get_step_descriptions(Kind::Dist), &[]);
351341

352342
let a = TargetSelection::from_user("A");
353343
let c = TargetSelection::from_user("C");
354344

355-
assert_eq!(
356-
first(builder.cache.all::<dist::Docs>()),
357-
&[dist::Docs { host: a }, dist::Docs { host: c },]
358-
);
359-
assert_eq!(
360-
first(builder.cache.all::<dist::Mingw>()),
361-
&[dist::Mingw { host: a }, dist::Mingw { host: c },]
362-
);
363-
assert_eq!(first(builder.cache.all::<dist::Rustc>()), &[]);
345+
assert_eq!(first(builder.cache.all::<dist::Docs>()), &[dist::Docs { host: c },]);
346+
assert_eq!(first(builder.cache.all::<dist::Mingw>()), &[dist::Mingw { host: c },]);
364347
assert_eq!(
365348
first(builder.cache.all::<dist::Std>()),
366-
&[
367-
dist::Std { compiler: Compiler { host: a, stage: 1 }, target: a },
368-
dist::Std { compiler: Compiler { host: a, stage: 2 }, target: c },
369-
]
349+
&[dist::Std { compiler: Compiler { host: a, stage: 2 }, target: c },]
370350
);
371-
assert_eq!(first(builder.cache.all::<dist::Src>()), &[]);
372351
}
373352

374353
#[test]
375354
fn dist_with_same_targets_and_hosts() {
376-
let build = Build::new(configure(&["B"], &["B"]));
355+
let build = Build::new(configure(&["A", "B"], &["A", "B"]));
377356
let mut builder = Builder::new(&build);
378357
builder.run_step_descriptions(&Builder::get_step_descriptions(Kind::Dist), &[]);
379358

@@ -426,7 +405,7 @@ mod dist {
426405

427406
#[test]
428407
fn build_all() {
429-
let build = Build::new(configure(&["B"], &["C"]));
408+
let build = Build::new(configure(&["A", "B"], &["A", "B", "C"]));
430409
let mut builder = Builder::new(&build);
431410
builder.run_step_descriptions(
432411
&Builder::get_step_descriptions(Kind::Build),
@@ -463,8 +442,7 @@ mod dist {
463442

464443
#[test]
465444
fn build_with_empty_host() {
466-
let mut config = configure(&[], &["C"]);
467-
config.skip_only_host_steps = true;
445+
let config = configure(&[], &["C"]);
468446
let build = Build::new(config);
469447
let mut builder = Builder::new(&build);
470448
builder.run_step_descriptions(&Builder::get_step_descriptions(Kind::Build), &[]);
@@ -477,7 +455,6 @@ mod dist {
477455
&[
478456
compile::Std { compiler: Compiler { host: a, stage: 0 }, target: a },
479457
compile::Std { compiler: Compiler { host: a, stage: 1 }, target: a },
480-
compile::Std { compiler: Compiler { host: a, stage: 2 }, target: a },
481458
compile::Std { compiler: Compiler { host: a, stage: 2 }, target: c },
482459
]
483460
);
@@ -500,7 +477,7 @@ mod dist {
500477

501478
#[test]
502479
fn test_with_no_doc_stage0() {
503-
let mut config = configure(&[], &[]);
480+
let mut config = configure(&["A"], &["A"]);
504481
config.stage = 0;
505482
config.cmd = Subcommand::Test {
506483
paths: vec!["library/std".into()],
@@ -540,7 +517,7 @@ mod dist {
540517

541518
#[test]
542519
fn test_exclude() {
543-
let mut config = configure(&[], &[]);
520+
let mut config = configure(&["A"], &["A"]);
544521
config.exclude = vec!["src/tools/tidy".into()];
545522
config.cmd = Subcommand::Test {
546523
paths: Vec::new(),
@@ -567,7 +544,7 @@ mod dist {
567544

568545
#[test]
569546
fn doc_ci() {
570-
let mut config = configure(&[], &[]);
547+
let mut config = configure(&["A"], &["A"]);
571548
config.compiler_docs = true;
572549
config.cmd = Subcommand::Doc { paths: Vec::new(), open: false };
573550
let build = Build::new(config);
@@ -596,7 +573,7 @@ mod dist {
596573
#[test]
597574
fn test_docs() {
598575
// Behavior of `x.py test` doing various documentation tests.
599-
let mut config = configure(&[], &[]);
576+
let mut config = configure(&["A"], &["A"]);
600577
config.cmd = Subcommand::Test {
601578
paths: vec![],
602579
test_args: vec![],

src/bootstrap/config.rs

-4
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ pub struct Config {
6666
pub test_compare_mode: bool,
6767
pub llvm_libunwind: bool,
6868

69-
pub skip_only_host_steps: bool,
70-
7169
pub on_fail: Option<String>,
7270
pub stage: u32,
7371
pub keep_stage: Vec<u32>,
@@ -593,8 +591,6 @@ impl Config {
593591
} else {
594592
vec![config.build]
595593
};
596-
// If host was explicitly given an empty list, don't run any host-only steps.
597-
config.skip_only_host_steps = config.hosts.is_empty();
598594
config.targets = if let Some(arg_target) = flags.target {
599595
arg_target
600596
} else if let Some(file_target) = build.target {

0 commit comments

Comments
 (0)