about summary refs log tree commit diff
path: root/src/tools/compiletest
diff options
context:
space:
mode:
authorJack Huey <31162821+jackh726@users.noreply.github.com>2022-02-12 14:39:58 -0500
committerJack Huey <31162821+jackh726@users.noreply.github.com>2022-02-12 18:44:08 -0500
commit7c6ff4b269a588ddd39f80fa443d3cd161cfc88b (patch)
tree9ee402c2a1cdacceec19a357b864d70dbe4cdd3b /src/tools/compiletest
parent5d8767cb229b097fedb1dd4bd9420d463c37774f (diff)
Add the known-bug compiletest prop
Diffstat (limited to 'src/tools/compiletest')
-rw-r--r--src/tools/compiletest/src/header.rs15
-rw-r--r--src/tools/compiletest/src/runtest.rs9
2 files changed, 23 insertions, 1 deletions
diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs
index da7a19139c6..82630c7a2f9 100644
--- a/src/tools/compiletest/src/header.rs
+++ b/src/tools/compiletest/src/header.rs
@@ -126,6 +126,12 @@ pub struct TestProps {
     // empty before the test starts. Incremental mode tests will reuse the
     // incremental directory between passes in the same test.
     pub incremental: bool,
+    // If `true`, this test is a known bug.
+    //
+    // When set, some requirements are relaxed. Currently, this only means no
+    // error annotations are needed, but this may be updated in the future to
+    // include other relaxations.
+    pub known_bug: bool,
     // How far should the test proceed while still passing.
     pass_mode: Option<PassMode>,
     // Ignore `--pass` overrides from the command line for this test.
@@ -176,6 +182,7 @@ impl TestProps {
             forbid_output: vec![],
             incremental_dir: None,
             incremental: false,
+            known_bug: false,
             pass_mode: None,
             fail_mode: None,
             ignore_pass: false,
@@ -362,6 +369,10 @@ impl TestProps {
                 if !self.incremental {
                     self.incremental = config.parse_incremental(ln);
                 }
+
+                if !self.known_bug {
+                    self.known_bug = config.parse_known_bug(ln);
+                }
             });
         }
 
@@ -751,6 +762,10 @@ impl Config {
     fn parse_incremental(&self, line: &str) -> bool {
         self.parse_name_directive(line, "incremental")
     }
+
+    fn parse_known_bug(&self, line: &str) -> bool {
+        self.parse_name_directive(line, "known-bug")
+    }
 }
 
 fn expand_variables(mut value: String, config: &Config) -> String {
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index f6ddac3a65e..03f8256d5e3 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -1310,7 +1310,14 @@ impl<'test> TestCx<'test> {
                 }
 
                 None => {
-                    if self.is_unexpected_compiler_message(actual_error, expect_help, expect_note) {
+                    // If the test is a known bug, don't require that the error is annotated
+                    if !self.props.known_bug
+                        && self.is_unexpected_compiler_message(
+                            actual_error,
+                            expect_help,
+                            expect_note,
+                        )
+                    {
                         self.error(&format!(
                             "{}:{}: unexpected {}: '{}'",
                             file_name,