Started handling duplicate validation layer messages (#156375)

fixes https://github.com/flutter/flutter/issues/151528

Those tests were failing because the validation layers messages were
printing out twice. This now only starts failing if a backend is
reported that is not vulkan with validation layers. See
https://github.com/flutter/flutter/issues/151528#issuecomment-2398189205

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
This commit is contained in:
gaaclarke 2024-10-09 08:40:04 -07:00 committed by GitHub
parent 0baf7a5904
commit 5c6e3f03c0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -22,24 +22,25 @@ Future<TaskResult> run() async {
bool isUsingValidationLayers = false; bool isUsingValidationLayers = false;
bool hasValidationErrors = false; bool hasValidationErrors = false;
int impellerBackendCount = 0; int invalidBackendCount = 0;
final Completer<void> didReceiveBackendMessage = Completer<void>(); final Completer<void> didReceiveBackendMessage = Completer<void>();
await inDirectory(appDir, () async { await inDirectory(appDir, () async {
await flutter('packages', options: <String>['get']); await flutter('packages', options: <String>['get']);
const String validationLayersMessage = 'Using the Impeller rendering backend (Vulkan with Validation Layers)';
final StreamSubscription<String> adb = device.logcat.listen( final StreamSubscription<String> adb = device.logcat.listen(
(String data) { (String data) {
if (data.contains('Using the Impeller rendering backend')) { if (data.contains('Using the Impeller rendering backend')) {
// Sometimes more than one of these will be printed out if there is a // Sometimes more than one of these will be printed out if there is a
// fallback. // fallback.
if (!data.contains(validationLayersMessage)) {
invalidBackendCount += 1;
}
if (!didReceiveBackendMessage.isCompleted) { if (!didReceiveBackendMessage.isCompleted) {
didReceiveBackendMessage.complete(); didReceiveBackendMessage.complete();
} }
impellerBackendCount += 1;
} }
if (data.contains( if (data.contains(validationLayersMessage)) {
'Using the Impeller rendering backend (Vulkan with Validation Layers)')) {
isUsingValidationLayers = true; isUsingValidationLayers = true;
} }
// "ImpellerValidationBreak" comes from the engine: // "ImpellerValidationBreak" comes from the engine:
@ -68,7 +69,7 @@ Future<TaskResult> run() async {
await adb.cancel(); await adb.cancel();
}); });
if (!isUsingValidationLayers || impellerBackendCount != 1) { if (!isUsingValidationLayers || invalidBackendCount != 0) {
return TaskResult.failure('Not using Vulkan validation layers.'); return TaskResult.failure('Not using Vulkan validation layers.');
} }
if (hasValidationErrors){ if (hasValidationErrors){