@@ -475,6 +475,11 @@ def run_shell_cmd(cmd_name, files, args, _, target_output, target_retcode):
475475 filtered_warnings_count = (filtered_actual != before_filter )
476476 # Filter errors from macOS SDK system headers
477477 lines = filtered_actual .split (b"\n " )
478+ # Check if there are any test file errors (errors from files in test_repo/)
479+ has_test_file_errors = any (
480+ b"/test_repo/" in l and b": error:" in l and b"/MacOSX.sdk/" not in l
481+ for l in lines
482+ )
478483 filtered_lines = []
479484 skip_next_error_processing = False
480485 in_system_header_error = False
@@ -489,6 +494,9 @@ def run_shell_cmd(cmd_name, files, args, _, target_output, target_retcode):
489494 if b"/opt/homebrew/Cellar/llvm/" in line or b"/usr/local/Cellar/llvm/" in line :
490495 filtered_system_headers = True
491496 continue
497+ # Reset in_system_header_error when we encounter a test file error
498+ if b"/test_repo/" in line and b": error:" in line and b"/MacOSX.sdk/" not in line :
499+ in_system_header_error = False
492500 # Skip code context lines (start with spaces, line number, |)
493501 if re .match (rb"^\s+\d+\s*\|" , line ):
494502 if in_system_header_error :
@@ -510,13 +518,13 @@ def run_shell_cmd(cmd_name, files, args, _, target_output, target_retcode):
510518 in_system_header_error = True
511519 filtered_system_headers = True
512520 continue
513- # Skip "X errors generated." when we've seen system header errors
521+ # Skip "X errors generated." only if there are no test file errors
514522 if line .strip () and re .match (rb"\d+ errors? generated\.$" , line .strip ()):
515- if in_system_header_error or any (b"/MacOSX.sdk/" in l for l in lines [:i ]):
523+ if ( in_system_header_error or any (b"/MacOSX.sdk/" in l for l in lines [:i ])) and not has_test_file_errors :
516524 skip_next_error_processing = True
517525 filtered_system_headers = True
518526 continue
519- # Skip "Error while processing" only if it follows system header errors
527+ # Skip "Error while processing" only if it follows system header errors (not test file errors)
520528 if line .startswith (b"Error while processing" ) and skip_next_error_processing :
521529 skip_next_error_processing = False
522530 in_system_header_error = False
0 commit comments