about summary refs log tree commit diff
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
parent9df0a41321b8dd3fc48da9b34b3f79b0c37051b7 (diff)
downloadrust-b970feedc272f324a27103b39d5d0b67646d10f0.tar.gz
rust-b970feedc272f324a27103b39d5d0b67646d10f0.zip
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 f84ddf8a17d..e987d3fa4fa 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 90dd5d819b0..f1473d19393 100644
--- a/src/bootstrap/flags.rs
+++ b/src/bootstrap/flags.rs
@@ -61,6 +61,7 @@ pub enum Subcommand {
         paths: Vec<PathBuf>,
         /// Whether to automatically update stderr/stdout files
         bless: bool,
+        compare_mode: Option<String>,
         test_args: Vec<String>,
         rustc_args: Vec<String>,
         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("", "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<String>) -> Vec<String> {
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index 7a4924f03c8..a0a51659ba3 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);
         }