Skip to content

Commit

Permalink
Add run flag to bootstrap test
Browse files Browse the repository at this point in the history
  • Loading branch information
tmandry committed Apr 30, 2021
1 parent 051f9ec commit 0978381
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/bootstrap/builder/tests.rs
Expand Up @@ -489,6 +489,7 @@ mod dist {
compare_mode: None,
rustfix_coverage: false,
pass: None,
run: None,
};

let build = Build::new(config);
Expand Down Expand Up @@ -529,6 +530,7 @@ mod dist {
compare_mode: None,
rustfix_coverage: false,
pass: None,
run: None,
};

let build = Build::new(config);
Expand Down Expand Up @@ -584,6 +586,7 @@ mod dist {
compare_mode: None,
rustfix_coverage: false,
pass: None,
run: None,
};
// Make sure rustfmt binary not being found isn't an error.
config.channel = "beta".to_string();
Expand Down
15 changes: 15 additions & 0 deletions src/bootstrap/flags.rs
Expand Up @@ -103,6 +103,7 @@ pub enum Subcommand {
bless: bool,
compare_mode: Option<String>,
pass: Option<String>,
run: Option<String>,
test_args: Vec<String>,
rustc_args: Vec<String>,
fail_fast: bool,
Expand Down Expand Up @@ -293,6 +294,12 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`",
"force {check,build,run}-pass tests to this mode.",
"check | build | run",
);
opts.optopt(
"",
"run",
"whether to execute run-* tests",
"auto | always | never",
);
opts.optflag(
"",
"rustfix-coverage",
Expand Down Expand Up @@ -556,6 +563,7 @@ Arguments:
bless: matches.opt_present("bless"),
compare_mode: matches.opt_str("compare-mode"),
pass: matches.opt_str("pass"),
run: matches.opt_str("run"),
test_args: matches.opt_strs("test-args"),
rustc_args: matches.opt_strs("rustc-args"),
fail_fast: !matches.opt_present("no-fail-fast"),
Expand Down Expand Up @@ -742,6 +750,13 @@ impl Subcommand {
}
}

pub fn run(&self) -> Option<&str> {
match *self {
Subcommand::Test { ref run, .. } => run.as_ref().map(|s| &s[..]),
_ => None,
}
}

pub fn open(&self) -> bool {
match *self {
Subcommand::Doc { open, .. } => open,
Expand Down
5 changes: 5 additions & 0 deletions src/bootstrap/test.rs
Expand Up @@ -1207,6 +1207,11 @@ note: if you're sure you want to do this, please open an issue as to why. In the
cmd.arg(pass);
}

if let Some(ref run) = builder.config.cmd.run() {
cmd.arg("--run");
cmd.arg(run);
}

if let Some(ref nodejs) = builder.config.nodejs {
cmd.arg("--nodejs").arg(nodejs);
}
Expand Down

0 comments on commit 0978381

Please sign in to comment.