Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions build_system/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -835,14 +835,16 @@ fn valid_ui_error_pattern_test(file: &str) -> bool {
}

fn contains_ui_error_patterns(file_path: &Path, keep_lto_tests: bool) -> Result<bool, String> {
// Tests generating errors.
let file = File::open(file_path)
.map_err(|error| format!("Failed to read `{}`: {:?}", file_path.display(), error))?;

let mut has_pass_marker = false;
for line in BufReader::new(file).lines().map_while(Result::ok) {
let line = line.trim();
if line.is_empty() {
continue;
}

if [
"//@ error-pattern:",
"//@ build-fail",
Expand Down Expand Up @@ -870,16 +872,30 @@ fn contains_ui_error_patterns(file_path: &Path, keep_lto_tests: bool) -> Result<
if line.contains("//[") && line.contains("]~") {
return Ok(true);
}

// Check for pass markers
if ["//@ check-pass", "//@ build-pass", "//@ run-pass"]
.iter()
.any(|marker| line.contains(marker))
{
has_pass_marker = true;
}

if ["//@ ignore-auxiliary"].iter().any(|marker| line.contains(marker)) {
return Ok(false);
}
}
let file_path = file_path.display().to_string();
if file_path.contains("ambiguous-4-extern.rs") {
eprintln!("nothing found for {file_path:?}");
}

// The files in this directory contain errors.
if file_path.contains("/error-emitter/") {
return Ok(true);
}
Ok(false)

Ok(!has_pass_marker)
}

// # Parameters
Expand Down