-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Part 1: Skia Gold Testing #33688
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
Part 1: Skia Gold Testing #33688
Conversation
This comment has been minimized.
This comment has been minimized.
…tion for Skia Gold test names.
Piinks
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.
Ready for another go.
| /// repository, nested within the `bin/cache` directory of the caller's Flutter | ||
| /// repository. | ||
| /// A base class that provides shared information to the [SkiaGoldClient] and | ||
| /// [GoldensRepositoryClient]. |
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.
Can do & done! :)
| /// repository, nested within the `bin/cache` directory of the caller's Flutter | ||
| /// repository. | ||
| /// A base class that provides shared information to the [SkiaGoldClient] and | ||
| /// [GoldensRepositoryClient]. |
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.
GoldensClient is still not abstract.
|
|
||
| @override | ||
| Uri getTestUri(Uri key, int version) { | ||
| if (version == null) |
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.
Any way we can avoid the code duplication of this method?
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 think I found a way. :)
tvolkert
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.
@goderbauer will probably want to review and approve as well.
| fs: fs, | ||
| platform: platform, | ||
| ) { | ||
| _skiaClient = SkiaGoldClient(fs.directory(basedir)); |
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 could be set in the initializer as well and made final
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 don't know that I can do that since the SkiaGoldClient is not a const constructor. cc/ @goderbauer for offline chat.
| await goldenFile.writeAsBytes(imageBytes, flush: true); | ||
| Future<bool> compare(Uint8List imageBytes, Uri golden) async { | ||
| golden = _addPrefix(golden); | ||
| await update(golden, imageBytes); |
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.
How come we update() during compare()?
Is it that we update the version in Gold that's associated with this test run whenever we compare, and that's separate from approving which is the new golden?
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.
We update to create the golden file that will be uploaded to Skia.
The master golden file is never downloaded or stored locally for comparison like in the flutter/goldens implementation, so the only file that exists is the current golden that needs to be compared. So when compare() is called, is calls update() to write out the bytes to file for the test.
Piinks
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.
Addressed comments, will run another round of testing across all environments tomorrow.
| await goldenFile.writeAsBytes(imageBytes, flush: true); | ||
| Future<bool> compare(Uint8List imageBytes, Uri golden) async { | ||
| golden = _addPrefix(golden); | ||
| await update(golden, imageBytes); |
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.
We update to create the golden file that will be uploaded to Skia.
The master golden file is never downloaded or stored locally for comparison like in the flutter/goldens implementation, so the only file that exists is the current golden that needs to be compared. So when compare() is called, is calls update() to write out the bytes to file for the test.
| /// repository, nested within the `bin/cache` directory of the caller's Flutter | ||
| /// repository. | ||
| /// A base class that provides shared information to the [SkiaGoldClient] and | ||
| /// [GoldensRepositoryClient]. |
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.
It can't be abstract since it is called in fromDefaultComparator by the FlutterSkiaGoldFileComparator to access the base information.
|
|
||
| @override | ||
| Uri getTestUri(Uri key, int version) { | ||
| if (version == null) |
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 think I found a way. :)
| fs: fs, | ||
| platform: platform, | ||
| ) { | ||
| _skiaClient = SkiaGoldClient(fs.directory(basedir)); |
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 don't know that I can do that since the SkiaGoldClient is not a const constructor. cc/ @goderbauer for offline chat.
goderbauer
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
| /// repository, nested within the `bin/cache` directory of the caller's Flutter | ||
| /// repository. | ||
| /// A base class that provides shared information to the [SkiaGoldClient] and | ||
| /// [GoldensRepositoryClient]. |
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 never seem to instantiate a GoldensClient, though. Only its subclasses get instantiated, so you should be able to still mark this class as abstract.
goderbauer
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
| /// informed by the basedir of the [FlutterSkiaGoldFileComparator]. | ||
| Future<void> auth() async { | ||
| Future<void> auth(Directory workDirectory) async { | ||
| assert(workDirectory != null); |
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.
Maybe add an error message here indicating that auth can only be called once?
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 don't know that I would want to throw an error if it is already authorized, I just made it a no-op in that case.
|
|
|
FYI for future reference: https://github.com/flutter/flutter/wiki/Tree-hygiene#squashing-commits (as seen in eb0b179) |
* Fresh PR for Gold integration. * Nits * WIP * Artifacts from merge * Changed some platform dependencies for web, added library prefix notation for Skia Gold test names. * Updating for CI implementation * Write out service account * Writing to skip out * WIP * ++ * Fixing depot tools deps * Windows depot_tools * Fixing setup scripts * ++ * depot tools * ++ * WIP * Tracing depot_tools clone * WIP * ++ * analyzer * WIP * chrome typo * copy artifact * Working on tests * Code cleanup * ++ * Code cleanup, updated tests * ++ review feedback * Review * Analyzer * Review feedback * Nits from review * PRogress * ++ * Fixing tests * ++ * Testing repo route * Just needing documention around new structures. * cleanup * Analyzer * Documentation updates * Documentation updates * Cirrus updates * cirrus nit * Review feedback * Review feedback * Fixing skip comparator * Fix base directory for Skia Gold case * ++ * Feedback * ++ * Fixed uri assertion * Made GoldensClient abstract, altered SkiaGoldClient constructor * Analyzer
This reverts commit eb0b179. Skia Gold post-submit test were failing due to the service account not being found on Cirrus.
Description
Integrating Flutter golden file testing with Skia Gold
Re-worked into a phased transition from #31630
This PR keeps in place the current structure of Gold file testing via the flutter/goldens repository for local and pre-submit testing, while Skia Gold is used for post-submit testing.
Golden tests in this implementation will not turn the tree red. Instead, once this lands and is validated by CI on post-submit, commenting on associated PR's will be added as a method of notification.
Once Pre-submit testing is enabled by the Skia Gold team, the former testing structure used through flutter/goldens will be removed, with Skia Gold taking its place.
Related Issues
Dependent on:
Add web safe indirection to Platform.isPlatform getters #33406Splitting golden file versioning out as an argument of matchesGoldenFile #33880Correct version name for BottomNavigationBar golden test #33865Check for duplicate Golden File names #33806- will implement later through use of the analyzer. Testing in Skia Gold will incorporate a pre-fix naming convention for all tests based on library so as to reduce the chance of a naming conflict.Addresses:
testWidgets#16859Tests
Added/Relocated/Updated:
flutter_test/test/matchers_test.dartflutter_test/test/goldens_test.dartflutter_goldens/test/flutter_goldens_test.dartmatchesGoldenFilewith askipin place for platforms other than Linux.Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Does your PR require Flutter developers to manually update their apps to accommodate your change?