Add the known-bug compiletest prop

This commit is contained in:
Jack Huey 2022-02-12 14:39:58 -05:00
parent 5d8767cb22
commit 7c6ff4b269
2 changed files with 23 additions and 1 deletions

View file

@ -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 {

View file

@ -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,