Add compare-mode to x.py

This commit is contained in:
Santiago Pastorino
2018-05-28 19:44:33 -03:00
parent 9df0a41321
commit b970feedc2
3 changed files with 14 additions and 1 deletions

View File

@@ -1457,6 +1457,7 @@ mod __test {
fail_fast: true, fail_fast: true,
doc_tests: DocTests::No, doc_tests: DocTests::No,
bless: false, bless: false,
compare_mode: None,
}; };
let build = Build::new(config); let build = Build::new(config);

View File

@@ -61,6 +61,7 @@ pub enum Subcommand {
paths: Vec<PathBuf>, paths: Vec<PathBuf>,
/// Whether to automatically update stderr/stdout files /// Whether to automatically update stderr/stdout files
bless: bool, bless: bool,
compare_mode: Option<String>,
test_args: Vec<String>, test_args: Vec<String>,
rustc_args: Vec<String>, rustc_args: Vec<String>,
fail_fast: bool, fail_fast: bool,
@@ -176,6 +177,7 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`");
opts.optflag("", "no-doc", "do not run doc tests"); opts.optflag("", "no-doc", "do not run doc tests");
opts.optflag("", "doc", "only run doc tests"); opts.optflag("", "doc", "only run doc tests");
opts.optflag("", "bless", "update all stderr/stdout files of failing ui tests"); opts.optflag("", "bless", "update all stderr/stdout files of failing ui tests");
opts.optopt("", "compare-mode", "mode describing what file the actual ui output will be compared to", "COMPARE MODE");
}, },
"bench" => { opts.optmulti("", "test-args", "extra arguments", "ARGS"); }, "bench" => { opts.optmulti("", "test-args", "extra arguments", "ARGS"); },
"clean" => { opts.optflag("", "all", "clean all build artifacts"); }, "clean" => { opts.optflag("", "all", "clean all build artifacts"); },
@@ -262,6 +264,7 @@ Arguments:
./x.py test src/libstd --test-args hash_map ./x.py test src/libstd --test-args hash_map
./x.py test src/libstd --stage 0 ./x.py test src/libstd --stage 0
./x.py test src/test/ui --bless ./x.py test src/test/ui --bless
./x.py test src/test/ui --compare-mode nll
If no arguments are passed then the complete artifacts for that stage are If no arguments are passed then the complete artifacts for that stage are
compiled and tested. compiled and tested.
@@ -327,6 +330,7 @@ Arguments:
Subcommand::Test { Subcommand::Test {
paths, paths,
bless: matches.opt_present("bless"), bless: matches.opt_present("bless"),
compare_mode: matches.opt_str("compare-mode"),
test_args: matches.opt_strs("test-args"), test_args: matches.opt_strs("test-args"),
rustc_args: matches.opt_strs("rustc-args"), rustc_args: matches.opt_strs("rustc-args"),
fail_fast: !matches.opt_present("no-fail-fast"), fail_fast: !matches.opt_present("no-fail-fast"),
@@ -436,6 +440,13 @@ impl Subcommand {
_ => false, _ => false,
} }
} }
pub fn compare_mode(&self) -> Option<&str> {
match *self {
Subcommand::Test { ref compare_mode, .. } => compare_mode.as_ref().map(|s| &s[..]),
_ => None,
}
}
} }
fn split(s: Vec<String>) -> Vec<String> { fn split(s: Vec<String>) -> Vec<String> {

View File

@@ -887,7 +887,6 @@ impl Step for Compiletest {
let target = self.target; let target = self.target;
let mode = self.mode; let mode = self.mode;
let suite = self.suite; let suite = self.suite;
let compare_mode = self.compare_mode;
// Path for test suite // Path for test suite
let suite_path = self.path.unwrap_or(""); let suite_path = self.path.unwrap_or("");
@@ -965,6 +964,8 @@ impl Step for Compiletest {
cmd.arg("--bless"); cmd.arg("--bless");
} }
let compare_mode = builder.config.cmd.compare_mode().or(self.compare_mode);
if let Some(ref nodejs) = builder.config.nodejs { if let Some(ref nodejs) = builder.config.nodejs {
cmd.arg("--nodejs").arg(nodejs); cmd.arg("--nodejs").arg(nodejs);
} }