-
Notifications
You must be signed in to change notification settings - Fork 6k
Refactor golden_tests_harvester, throw when not --dry-run, add tests.
#51364
Conversation
gaaclarke
left a comment
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.
LGTM, just a few notes
| ## Usage | ||
|
|
||
| This program assumes you've _already run_ a suite of golden tests that produce | ||
| a directory of images, of which the format, a JSON file named `digests.json`, is |
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.
| a directory of images, of which the format, a JSON file named `digests.json`, is | |
| a directory of images with a JSON digest named `digests.json`, which is |
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.
Done!
| /// } | ||
| /// ``` | ||
| /// | ||
| /// If [dryRun] is true, the images will _not_ be uploaded to Skia Gold, and |
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.
dryRun is not apropos to harvest, I think you refactored this and didn't yet update the docstring.
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.
Right, thanks for catching the refactor!
| /// Other tools (perhaps implemented in other languages, like C++) can use this | ||
| /// format to communicate with the `golden_tests_harvester` tool without | ||
| /// relying on the tool directly (or the Dart SDK). | ||
| final class Digests { |
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.
This code seems like the sort of thing we should be automating, can we use the dart json parser to do this? We would probably need custom builders which is a showstopper, eh?
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.
I am guessing (?) this format will virtually never change, or if it does, we'll catch it in a unit test.
I am not opposed to generating this, but it wouldn't be a priority for me.
| test('should require a file named "digests.json" in the working directory', () async { | ||
| await withTempDirectory((io.Directory tempDirectory) async { | ||
| final StringSink stderr = StringBuffer(); | ||
| try { |
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.
You use this pattern a few times. You could factor this out to
expectThrow<io.FileSystemException>((){ await harvest(...);}, (io.FileExceptionException e) {
expect(e.path, contains('digest.json'));
});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.
Reasonable suggestion, done!
…145067) flutter/engine@285b9fb...2871c26 2024-03-13 [email protected] Add et lint command (flutter/engine#51238) 2024-03-13 [email protected] Refactor `golden_tests_harvester`, throw when not `--dry-run`, add tests. (flutter/engine#51364) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Closes flutter/flutter#144948.
I went a little farther, as I'm not looking forward to debugging this in the future without tests or examples.