-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Scripts: be more robust when parsing test logs #21160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR improves the robustness of the test log parsing script by adding exception handling to prevent crashes when encountering unexpected log formats. The script previously failed with a StopIteration error when parsing logs with unexpected content.
Changes:
- Added try-except block to handle
StopIterationgracefully when parsing test failure blocks - Logs a warning message when encountering unexpected end of logs instead of crashing
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Copilot
AI
Jan 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable filename_match may be undefined when accessed at this line. If StopIteration is caught at line 134, the code breaks out of the try block, but filename_match will not have been assigned if the exception occurred before line 127 or if no match was found before the exception. This will cause an UnboundLocalError. The continue statement should be used instead of break in the exception handler to skip to the next iteration of the outer for loop.
The script was falling over on this log, I believe because of the unexpected
getSignatureParameterNameline in this section:The terminal output was as follow:
I asked copilot to fix it and it added this try-except block so that at least other patches could be produced. Now when I run the script I get this output:
(And then a C# patch failed to apply, but I assume that's unrelated.)