add only modified for compiletest

This commit is contained in:
yukang 2023-02-04 00:23:11 +08:00
parent a94b9fd0ac
commit 414eb48b66
9 changed files with 137 additions and 29 deletions

View file

@ -124,6 +124,7 @@ pub enum Subcommand {
fail_fast: bool,
doc_tests: DocTests,
rustfix_coverage: bool,
only_modified: bool,
},
Bench {
paths: Vec<PathBuf>,
@ -301,6 +302,7 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`",
opts.optflag("", "doc", "only run doc tests");
opts.optflag("", "bless", "update all stderr/stdout files of failing ui tests");
opts.optflag("", "force-rerun", "rerun tests even if the inputs are unchanged");
opts.optflag("", "only-modified", "only run tests that result has been changed");
opts.optopt(
"",
"compare-mode",
@ -598,6 +600,7 @@ Arguments:
rustc_args: matches.opt_strs("rustc-args"),
fail_fast: !matches.opt_present("no-fail-fast"),
rustfix_coverage: matches.opt_present("rustfix-coverage"),
only_modified: matches.opt_present("only-modified"),
doc_tests: if matches.opt_present("doc") {
DocTests::Only
} else if matches.opt_present("no-doc") {
@ -777,6 +780,13 @@ impl Subcommand {
}
}
pub fn only_modified(&self) -> bool {
match *self {
Subcommand::Test { only_modified, .. } => only_modified,
_ => false,
}
}
pub fn force_rerun(&self) -> bool {
match *self {
Subcommand::Test { force_rerun, .. } => force_rerun,