Refactor golden_tests_harvester, throw when not --dry-run, add tests.#51364
Refactor golden_tests_harvester, throw when not --dry-run, add tests.#51364auto-submit[bot] merged 9 commits intoflutter:mainfrom
golden_tests_harvester, throw when not --dry-run, add tests.#51364Conversation
| ## 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.
| 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 |
| /// } | ||
| /// ``` | ||
| /// | ||
| /// If [dryRun] is true, the images will _not_ be uploaded to Skia Gold, and |
There was a problem hiding this comment.
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.
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.
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.
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.
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.
Reasonable suggestion, done!
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.