diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index f84ddf8a17d13..e987d3fa4fa6e 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -1457,6 +1457,7 @@ mod __test { fail_fast: true, doc_tests: DocTests::No, bless: false, + compare_mode: None, }; let build = Build::new(config); diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs index 90dd5d819b0da..f1473d19393aa 100644 --- a/src/bootstrap/flags.rs +++ b/src/bootstrap/flags.rs @@ -61,6 +61,7 @@ pub enum Subcommand { paths: Vec, /// Whether to automatically update stderr/stdout files bless: bool, + compare_mode: Option, test_args: Vec, rustc_args: Vec, fail_fast: bool, @@ -176,6 +177,7 @@ To learn more about a subcommand, run `./x.py -h`"); opts.optflag("", "no-doc", "do not run doc tests"); opts.optflag("", "doc", "only run doc 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"); }, "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 --stage 0 ./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 compiled and tested. @@ -327,6 +330,7 @@ Arguments: Subcommand::Test { paths, bless: matches.opt_present("bless"), + compare_mode: matches.opt_str("compare-mode"), test_args: matches.opt_strs("test-args"), rustc_args: matches.opt_strs("rustc-args"), fail_fast: !matches.opt_present("no-fail-fast"), @@ -436,6 +440,13 @@ impl Subcommand { _ => 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) -> Vec { diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 7a4924f03c8d2..a0a51659ba3dc 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -887,7 +887,6 @@ impl Step for Compiletest { let target = self.target; let mode = self.mode; let suite = self.suite; - let compare_mode = self.compare_mode; // Path for test suite let suite_path = self.path.unwrap_or(""); @@ -965,6 +964,8 @@ impl Step for Compiletest { cmd.arg("--bless"); } + let compare_mode = builder.config.cmd.compare_mode().or(self.compare_mode); + if let Some(ref nodejs) = builder.config.nodejs { cmd.arg("--nodejs").arg(nodejs); }