Made the bad lines exception print out the bad lines#180909
Conversation
There was a problem hiding this comment.
Code Review
This pull request improves the debugging experience for 'bad line' failures in flutter_test_performance.dart by including the actual problematic lines in the exception message instead of just a count. The implementation is sound. I have one suggestion to further improve the readability of the error output.
| const seperator = '\n '; | ||
| throw Exception('flutter test rendered unexpected output ${badLines.join(seperator)}'); |
There was a problem hiding this comment.
For better readability of the exception message, it's helpful to start the list of bad lines on a new line and ensure all of them are indented consistently. This makes the output cleaner and easier to parse visually.
Additionally, there's a typo in the variable name seperator; it should be separator.
Here's a more concise way to achieve this that addresses both points:
| const seperator = '\n '; | |
| throw Exception('flutter test rendered unexpected output ${badLines.join(seperator)}'); | |
| throw Exception('flutter test rendered unexpected output:\n ${badLines.join('\n ')}'); |
jtmcdole
left a comment
There was a problem hiding this comment.
nits - but prefixed by "thankyou!"
| final Match? match = testOutputPattern.matchAsPrefix(entry); | ||
| if (match == null) { | ||
| badLines += 1; | ||
| badLines.add(entry); |
| step = TestStep.testPassed; | ||
| } else { | ||
| badLines += 1; | ||
| badLines.add(entry); |
There was a problem hiding this comment.
'badline(fallthrough): $entry'
| ) { | ||
| print('test stderr: $entry'); | ||
| badLines += 1; | ||
| badLines.add(entry); |
| const seperator = '\n '; | ||
| throw Exception('flutter test rendered unexpected output ${badLines.join(seperator)}'); |
|
autosubmit label was removed for flutter/flutter/180909, because - The status or check suite Linux analyze has failed. Please fix the issues identified (or deflake) before re-applying this label. |
| if (badLines.isNotEmpty) { | ||
| const seperator = '\n '; | ||
| throw Exception('flutter test rendered unexpected output ${badLines.join(seperator)}'); | ||
| throw Exception('flutter test rendered unexpected output:$seperator${badLines.join(seperator)}'); |
There was a problem hiding this comment.
I think it's complaining about this line.
throw Exception(
'flutter test rendered unexpected output:$seperator${badLines.join(seperator)}',
);|
(still lgtm from me) |
|
autosubmit label was removed for flutter/flutter/180909, because - The status or check suite Windows tool_integration_tests_8_9 has failed. Please fix the issues identified (or deflake) before re-applying this label. |
issues: #180903
adds better logging for debugging "bad line" failures
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.