about summary refs log tree commit diff
path: root/src/tools
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2018-02-24 00:07:51 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2018-02-26 20:24:41 +0300
commite650eef8b045c57be36d230f2a911a3775aefd1e (patch)
treefb60559a6fd26eeabbfe29f012913443571cdf93 /src/tools
parentfa2d9fc4b9e578d95fbf65613d1bf732fbdfb0d4 (diff)
downloadrust-e650eef8b045c57be36d230f2a911a3775aefd1e.tar.gz
rust-e650eef8b045c57be36d230f2a911a3775aefd1e.zip
Implement opt-out from UI testing normalization
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/compiletest/src/header.rs15
-rw-r--r--src/tools/compiletest/src/runtest.rs4
2 files changed, 16 insertions, 3 deletions
diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs
index d4d3d6c6e9a..e48f42705f1 100644
--- a/src/tools/compiletest/src/header.rs
+++ b/src/tools/compiletest/src/header.rs
@@ -226,9 +226,10 @@ pub struct TestProps {
     pub must_compile_successfully: bool,
     // rustdoc will test the output of the `--test` option
     pub check_test_line_numbers_match: bool,
-    // The test must be compiled and run successfully. Only used in UI tests for
-    // now.
+    // The test must be compiled and run successfully. Only used in UI tests for now.
     pub run_pass: bool,
+    // Do not pass `-Z ui-testing` to UI tests
+    pub disable_ui_testing_normalization: bool,
     // customized normalization rules
     pub normalize_stdout: Vec<(String, String)>,
     pub normalize_stderr: Vec<(String, String)>,
@@ -259,6 +260,7 @@ impl TestProps {
             must_compile_successfully: false,
             check_test_line_numbers_match: false,
             run_pass: false,
+            disable_ui_testing_normalization: false,
             normalize_stdout: vec![],
             normalize_stderr: vec![],
             failure_status: 101,
@@ -379,6 +381,11 @@ impl TestProps {
                     config.parse_must_compile_successfully(ln) || self.run_pass;
             }
 
+            if !self.disable_ui_testing_normalization {
+                self.disable_ui_testing_normalization =
+                    config.parse_disable_ui_testing_normalization(ln);
+            }
+
             if let Some(rule) = config.parse_custom_normalization(ln, "normalize-stdout") {
                 self.normalize_stdout.push(rule);
             }
@@ -505,6 +512,10 @@ impl Config {
         self.parse_name_directive(line, "must-compile-successfully")
     }
 
+    fn parse_disable_ui_testing_normalization(&self, line: &str) -> bool {
+        self.parse_name_directive(line, "disable-ui-testing-normalization")
+    }
+
     fn parse_check_test_line_numbers_match(&self, line: &str) -> bool {
         self.parse_name_directive(line, "check-test-line-numbers-match")
     }
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 3d751de3dbe..d3f571dd8ae 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -1632,7 +1632,9 @@ impl<'test> TestCx<'test> {
                 // a first time to get the compiler's output then compile with
                 // "--error-format json" to check if all expected errors are actually there
                 // and that no new one appeared.
-                rustc.arg("-Zui-testing");
+                if !self.props.disable_ui_testing_normalization {
+                    rustc.arg("-Zui-testing");
+                }
             }
             MirOpt => {
                 rustc.args(&[