diff --git a/build_system/src/test.rs b/build_system/src/test.rs index ca2a2a7dc2d..902026a3c68 100644 --- a/build_system/src/test.rs +++ b/build_system/src/test.rs @@ -834,8 +834,9 @@ fn valid_ui_error_pattern_test(file: &str) -> bool { .any(|to_ignore| file.ends_with(to_ignore)) } -fn contains_ui_error_patterns(file_path: &Path, keep_lto_tests: bool) -> Result { - // Tests generating errors. +fn contains_ui_error_patterns(file_path: &Path, _keep_lto_tests: bool) -> Result { + // Inverted logic: UI tests are expected to fail by default unless marked with pass markers. + // Return false (keep) for tests with pass markers, true (remove) for everything else. let file = File::open(file_path) .map_err(|error| format!("Failed to read `{}`: {:?}", file_path.display(), error))?; for line in BufReader::new(file).lines().map_while(Result::ok) { @@ -843,43 +844,22 @@ fn contains_ui_error_patterns(file_path: &Path, keep_lto_tests: bool) -> Result< if line.is_empty() { continue; } + + // Check for pass markers - these tests should be kept (return false) if [ - "//@ error-pattern:", - "//@ build-fail", - "//@ run-fail", - "//@ known-bug", - "-Cllvm-args", - "//~", - "thread", + "//@ check-pass", + "//@ build-pass", + "//@ run-pass", ] .iter() - .any(|check| line.contains(check)) + .any(|marker| line.contains(marker)) { - return Ok(true); + return Ok(false); } - - if !keep_lto_tests - && (line.contains("-Clto") - || line.contains("-C lto") - || line.contains("compile-flags: -Clinker-plugin-lto")) - && !line.contains("-Clto=thin") - { - return Ok(true); - } - - if line.contains("//[") && line.contains("]~") { - return Ok(true); - } - } - 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) + + // Default: remove tests without pass markers (expected to fail by default) + Ok(true) } // # Parameters