summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSantiago Pastorino <spastorino@gmail.com>2018-05-28 19:44:33 -0300
committerSantiago Pastorino <spastorino@gmail.com>2018-05-30 14:35:43 -0300
commitb970feedc272f324a27103b39d5d0b67646d10f0 (patch)
tree0734cef294638c3e1338ae135d921e8e33af9916
parentAdd polonius compare mode (diff)
downloadgrust-b970feedc272f324a27103b39d5d0b67646d10f0.tar.gz
grust-b970feedc272f324a27103b39d5d0b67646d10f0.tar.bz2
grust-b970feedc272f324a27103b39d5d0b67646d10f0.tar.xz
Add compare-mode to x.py
-rw-r--r--src/bootstrap/builder.rs1
-rw-r--r--src/bootstrap/flags.rs11
-rw-r--r--src/bootstrap/test.rs3
3 files changed, 14 insertions, 1 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index f84ddf8a17..e987d3fa4f 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -1457,6 +1457,7 @@ mod __test {
1457 fail_fast: true, 1457 fail_fast: true,
1458 doc_tests: DocTests::No, 1458 doc_tests: DocTests::No,
1459 bless: false, 1459 bless: false,
1460 compare_mode: None,
1460 }; 1461 };
1461 1462
1462 let build = Build::new(config); 1463 let build = Build::new(config);
diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs
index 90dd5d819b..f1473d1939 100644
--- a/src/bootstrap/flags.rs
+++ b/src/bootstrap/flags.rs
@@ -61,6 +61,7 @@ pub enum Subcommand {
61 paths: Vec<PathBuf>, 61 paths: Vec<PathBuf>,
62 /// Whether to automatically update stderr/stdout files 62 /// Whether to automatically update stderr/stdout files
63 bless: bool, 63 bless: bool,
64 compare_mode: Option<String>,
64 test_args: Vec<String>, 65 test_args: Vec<String>,
65 rustc_args: Vec<String>, 66 rustc_args: Vec<String>,
66 fail_fast: bool, 67 fail_fast: bool,
@@ -176,6 +177,7 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`");
176 opts.optflag("", "no-doc", "do not run doc tests"); 177 opts.optflag("", "no-doc", "do not run doc tests");
177 opts.optflag("", "doc", "only run doc tests"); 178 opts.optflag("", "doc", "only run doc tests");
178 opts.optflag("", "bless", "update all stderr/stdout files of failing ui tests"); 179 opts.optflag("", "bless", "update all stderr/stdout files of failing ui tests");
180 opts.optopt("", "compare-mode", "mode describing what file the actual ui output will be compared to", "COMPARE MODE");
179 }, 181 },
180 "bench" => { opts.optmulti("", "test-args", "extra arguments", "ARGS"); }, 182 "bench" => { opts.optmulti("", "test-args", "extra arguments", "ARGS"); },
181 "clean" => { opts.optflag("", "all", "clean all build artifacts"); }, 183 "clean" => { opts.optflag("", "all", "clean all build artifacts"); },
@@ -262,6 +264,7 @@ Arguments:
262 ./x.py test src/libstd --test-args hash_map 264 ./x.py test src/libstd --test-args hash_map
263 ./x.py test src/libstd --stage 0 265 ./x.py test src/libstd --stage 0
264 ./x.py test src/test/ui --bless 266 ./x.py test src/test/ui --bless
267 ./x.py test src/test/ui --compare-mode nll
265 268
266 If no arguments are passed then the complete artifacts for that stage are 269 If no arguments are passed then the complete artifacts for that stage are
267 compiled and tested. 270 compiled and tested.
@@ -327,6 +330,7 @@ Arguments:
327 Subcommand::Test { 330 Subcommand::Test {
328 paths, 331 paths,
329 bless: matches.opt_present("bless"), 332 bless: matches.opt_present("bless"),
333 compare_mode: matches.opt_str("compare-mode"),
330 test_args: matches.opt_strs("test-args"), 334 test_args: matches.opt_strs("test-args"),
331 rustc_args: matches.opt_strs("rustc-args"), 335 rustc_args: matches.opt_strs("rustc-args"),
332 fail_fast: !matches.opt_present("no-fail-fast"), 336 fail_fast: !matches.opt_present("no-fail-fast"),
@@ -436,6 +440,13 @@ impl Subcommand {
436 _ => false, 440 _ => false,
437 } 441 }
438 } 442 }
443
444 pub fn compare_mode(&self) -> Option<&str> {
445 match *self {
446 Subcommand::Test { ref compare_mode, .. } => compare_mode.as_ref().map(|s| &s[..]),
447 _ => None,
448 }
449 }
439} 450}
440 451
441fn split(s: Vec<String>) -> Vec<String> { 452fn split(s: Vec<String>) -> Vec<String> {
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index 7a4924f03c..a0a51659ba 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -887,7 +887,6 @@ impl Step for Compiletest {
887 let target = self.target; 887 let target = self.target;
888 let mode = self.mode; 888 let mode = self.mode;
889 let suite = self.suite; 889 let suite = self.suite;
890 let compare_mode = self.compare_mode;
891 890
892 // Path for test suite 891 // Path for test suite
893 let suite_path = self.path.unwrap_or(""); 892 let suite_path = self.path.unwrap_or("");
@@ -965,6 +964,8 @@ impl Step for Compiletest {
965 cmd.arg("--bless"); 964 cmd.arg("--bless");
966 } 965 }
967 966
967 let compare_mode = builder.config.cmd.compare_mode().or(self.compare_mode);
968
968 if let Some(ref nodejs) = builder.config.nodejs { 969 if let Some(ref nodejs) = builder.config.nodejs {
969 cmd.arg("--nodejs").arg(nodejs); 970 cmd.arg("--nodejs").arg(nodejs);
970 } 971 }