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

Conversation

flar
Copy link
Contributor

@flar flar commented Apr 8, 2024

The engine has ostream conversions for most Skia objects, but none of the test files include the files where they are defined. Adding the include file to the layer_test.h file will include them on any file which does unit testing on the engine layers.

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@flar
Copy link
Contributor Author

flar commented Apr 8, 2024

This PR has no tests because it only affects the console output while running unit tests with failures.

@flar flar requested a review from jason-simmons April 8, 2024 23:20
@matanlurey
Copy link
Contributor

Wait just adding this #include changes the test output?

@flar
Copy link
Contributor Author

flar commented Apr 9, 2024

Wait just adding this #include changes the test output?

Yes, it includes a bunch of ostream operators that teach the gtest macros how to print out the Skia objects. Without them gtest just defaults to a hex dump of the memory.

@jason-simmons
Copy link
Member

GoogleTest is using template lookup to find the best available print function for a given data type (see PrintWithFallback in https://github.com/google/googletest/blob/main/googletest/include/gtest/gtest-printers.h)

Skia does not provide implementations of operator<< or any of the other options for a GoogleTest print function. The engine tree has its own operator<< implementations for Skia types in https://github.com/flutter/engine/blob/main/testing/assertions_skia.h

So there is a risk that the availability of operator<< for Skia types may be inconsistent across TUs, causing GoogleTest's templates to get different results when the lookup is instantiated. The linker may select an instance where the default hex dump print function is the best available, and if that happens the Skia types in the output will not be printed with operator<<.

assertions_skia.h should always be included before gtest.h to ensure that this does not happen.

@jason-simmons
Copy link
Member

To ensure that this is always done consistently I'd suggest:

  • creating a header that includes assertions_skia.h followed by gtest/gtest.h
  • replacing all uses of #include "gtest/gtest.h" in these tests with that header.

@flar
Copy link
Contributor Author

flar commented Apr 9, 2024

To ensure that this is always done consistently I'd suggest:

  • creating a header that includes assertions_skia.h followed by gtest/gtest.h
  • replacing all uses of #include "gtest/gtest.h" in these tests with that header.

I don't think this is worth it. We are on a path to remove Skia geometry objects from most of the engine so we don't need a long term solution. This simple change works fine with minimal changes. I'd like to keep it that simple.

@matanlurey
Copy link
Contributor

test-exempt: header only change for bizarre gtest semantics.

@flar flar added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 9, 2024
@auto-submit auto-submit bot merged commit a17f8d1 into flutter:main Apr 9, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 9, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 9, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 9, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Apr 9, 2024
…146524)

flutter/engine@5a824e2...5dca50d

2024-04-09 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Delete engine v1 android embedding (#51229)" (flutter/engine#51996)
2024-04-09 34871572+gmackall@users.noreply.github.com Delete engine v1 android embedding (flutter/engine#51229)
2024-04-09 flar@google.com better output from engine layer unit test failures (flutter/engine#51975)
2024-04-09 zanderso@users.noreply.github.com Revert "Roll Dart SDK from 78174b41ab0f to 7a5e410f982e (1 revision) (#51980)" (flutter/engine#51990)
2024-04-09 jacksongardner@google.com [skwasm] Reify the SkPicture pointer as the right type. (flutter/engine#51991)
2024-04-09 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Roll Dart SDK from 7a5e410f982e to db99af14c4bc (1 revision) (#51986)" (flutter/engine#51989)
2024-04-09 jason-simmons@users.noreply.github.com Move the Dart SDK to //flutter/third_party/dart (flutter/engine#51917)
2024-04-09 matej.knopp@gmail.com [macOS] Implement hit testing and handle platform view cursor changes (flutter/engine#43101)
2024-04-09 skia-flutter-autoroll@skia.org Roll Dart SDK from 7a5e410f982e to db99af14c4bc (1 revision) (flutter/engine#51986)
2024-04-09 skia-flutter-autoroll@skia.org Roll Dart SDK from 78174b41ab0f to 7a5e410f982e (1 revision) (flutter/engine#51980)

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 chinmaygarde@google.com,rmistry@google.com,zra@google.com 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
gilnobrega pushed a commit to gilnobrega/flutter that referenced this pull request Apr 22, 2024
…lutter#146524)

flutter/engine@5a824e2...5dca50d

2024-04-09 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Delete engine v1 android embedding (flutter#51229)" (flutter/engine#51996)
2024-04-09 34871572+gmackall@users.noreply.github.com Delete engine v1 android embedding (flutter/engine#51229)
2024-04-09 flar@google.com better output from engine layer unit test failures (flutter/engine#51975)
2024-04-09 zanderso@users.noreply.github.com Revert "Roll Dart SDK from 78174b41ab0f to 7a5e410f982e (1 revision) (flutter#51980)" (flutter/engine#51990)
2024-04-09 jacksongardner@google.com [skwasm] Reify the SkPicture pointer as the right type. (flutter/engine#51991)
2024-04-09 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Roll Dart SDK from 7a5e410f982e to db99af14c4bc (1 revision) (flutter#51986)" (flutter/engine#51989)
2024-04-09 jason-simmons@users.noreply.github.com Move the Dart SDK to //flutter/third_party/dart (flutter/engine#51917)
2024-04-09 matej.knopp@gmail.com [macOS] Implement hit testing and handle platform view cursor changes (flutter/engine#43101)
2024-04-09 skia-flutter-autoroll@skia.org Roll Dart SDK from 7a5e410f982e to db99af14c4bc (1 revision) (flutter/engine#51986)
2024-04-09 skia-flutter-autoroll@skia.org Roll Dart SDK from 78174b41ab0f to 7a5e410f982e (1 revision) (flutter/engine#51980)

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 chinmaygarde@google.com,rmistry@google.com,zra@google.com 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
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.

3 participants