Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@matanlurey
Copy link
Contributor

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.

Copy link
Member

@gaaclarke gaaclarke left a 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Copy link
Contributor Author

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
Copy link
Member

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.

Copy link
Contributor Author

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 {
Copy link
Member

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?

Copy link
Contributor Author

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 {
Copy link
Member

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'));
});

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reasonable suggestion, done!

@matanlurey matanlurey added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 13, 2024
@auto-submit auto-submit bot merged commit 8888229 into flutter:main Mar 13, 2024
@matanlurey matanlurey deleted the golden_tests_harvester branch March 13, 2024 05:23
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

autosubmit Merge PR when tree becomes green via auto submit App

Projects

None yet

Development

Successfully merging this pull request may close these issues.

golden_tests_harvester should panic if !SkiaGoldClient.isAvailable

2 participants