From 371933c7ab488f289544ad3a10953dad4164f265 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Thu, 3 Aug 2023 14:00:40 -0700 Subject: [PATCH 1/3] [Impeller] Fail loudly if --enable-software-rendering is used. --- shell/common/shell.cc | 2 ++ shell/common/shell_unittests.cc | 14 ++++++++++++++ testing/scenario_app/run_ios_tests.sh | 3 ++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/shell/common/shell.cc b/shell/common/shell.cc index d6e94c6345362..136c09b9c39d0 100644 --- a/shell/common/shell.cc +++ b/shell/common/shell.cc @@ -419,6 +419,8 @@ Shell::Shell(DartVMRef vm, volatile_path_tracker_(std::move(volatile_path_tracker)), weak_factory_gpu_(nullptr), weak_factory_(this) { + FML_CHECK(!settings.enable_software_rendering || !settings.enable_impeller) + << "Software rendering is incompatible with Impeller."; FML_CHECK(vm_) << "Must have access to VM to create a shell."; FML_DCHECK(task_runners_.IsValid()); FML_DCHECK(task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread()); diff --git a/shell/common/shell_unittests.cc b/shell/common/shell_unittests.cc index 4c4c85f8b768b..078f188df56fd 100644 --- a/shell/common/shell_unittests.cc +++ b/shell/common/shell_unittests.cc @@ -4342,6 +4342,20 @@ TEST_F(ShellTest, PrintsErrorWhenPlatformMessageSentFromWrongThread) { ASSERT_FALSE(DartVMRef::IsInstanceRunning()); } +TEST_F(ShellTest, DiesIfSoftwareRenderingAndImpellerAreEnabled) { + Settings settings = CreateSettingsForFixture(); + settings.enable_impeller = true; + settings.enable_software_rendering = true; + ThreadHost thread_host("io.flutter.test." + GetCurrentTestName() + ".", + ThreadHost::Type::Platform); + auto task_runner = thread_host.platform_thread->GetTaskRunner(); + TaskRunners task_runners("test", task_runner, task_runner, task_runner, + task_runner); + EXPECT_DEATH_IF_SUPPORTED( + CreateShell(settings, task_runners), + "Software rendering is incompatible with Impeller."); +} + } // namespace testing } // namespace flutter diff --git a/testing/scenario_app/run_ios_tests.sh b/testing/scenario_app/run_ios_tests.sh index 37ab3a76f11d0..f91a875feea22 100755 --- a/testing/scenario_app/run_ios_tests.sh +++ b/testing/scenario_app/run_ios_tests.sh @@ -78,13 +78,14 @@ echo "Running simulator tests with Impeller" echo "" # Skip testFontRenderingWhenSuppliedWithBogusFont: https://github.com/flutter/flutter/issues/113250 +# Skip golden tests that use software rendering: https://github.com/flutter/flutter/issues/131888 if set -o pipefail && xcodebuild -sdk iphonesimulator \ -scheme Scenarios \ -resultBundlePath "$RESULT_BUNDLE_PATH/ios_scenario.xcresult" \ -destination 'platform=iOS Simulator,OS=16.2,name=iPhone SE (3rd generation)' \ clean test \ FLUTTER_ENGINE="$FLUTTER_ENGINE" \ - -skip-testing "ScenariosUITests/BogusFontTextTest/testFontRenderingWhenSuppliedWithBogusFont" \ + -skip-testing "ScenariosUITests/BogusFontTextTest/testFontRenderingWhenSuppliedWithBogusFont,ScenarioUITests/PlatformViewMutationLargeClipRRectWithTransformTests/testPlatformView,ScenarioUITests/MultiplePlatformViewsTest/testPlatformView,ScenarioUITests/PlatformViewWithOtherBackdropFilterTests/testPlatformView,ScenarioUITests/TwoPlatformViewsWithOtherBackDropFilterTests/testPlatformView,ScenarioUITests/PlatformViewMutationClipPathTests/testPlatformView,ScenarioUITests/PlatformViewMutationClipRectWithTransformTests/testPlatformView,ScenarioUITests/PlatformViewGestureRecognizerTests/testRejectPolicyUtilTouchesEnded,ScenarioUITests/NonFullScreenFlutterViewPlatformViewUITests/testPlatformView,ScenarioUITests/PlatformViewUITests/testPlatformView,ScenarioUITests/PlatformViewMutationClipRectAfterMovedTests/testPlatformView,ScenarioUITests/PlatformViewMutationClipRectTests/testPlatformView,ScenarioUITests/TwoPlatformViewClipPathTests/testPlatformView,ScenarioUITests/MultiplePlatformViewsBackgroundForegroundTest/testPlatformView,ScenarioUITests/PlatformViewMutationOpacityTests/testPlatformView,ScenarioUITests/PlatformViewMutationClipRRectTests/testPlatformView,ScenarioUITests/PlatformViewMutationClipRRectWithTransformTests/testPlatformView,ScenarioUITests/PlatformViewMutationClipPathWithTransformTests/testPlatformView,ScenarioUITests/SpawnEngineTest/testSpawnEngineWorks,ScenarioUITests/PlatformViewRotation/testPlatformView,ScenarioUITests/TwoPlatformViewClipRRectTests/testPlatformView,ScenarioUITests/TwoPlatformViewClipRectTests/testPlatformView,ScenarioUITests/RenderingSelectionTest/testSoftwareRendering,ScenarioUITests/UnobstructedPlatformViewTests/testMultiplePlatformViewsWithOverlays,ScenarioUITests/UnobstructedPlatformViewTests/testNoOverlay,ScenarioUITests/PlatformViewMutationTransformTests/testPlatformView,ScenarioUITests/PlatformViewMutationLargeClipRRectTests/testPlatformView,ScenarioUITests/PlatformViewWithNegativeOtherBackDropFilterTests/testPlatformView" \ INFOPLIST_FILE="Scenarios/Info_Impeller.plist"; then # Plist with FLTEnableImpeller=YES echo "test success." else From 8a9fa32c63f8841c4c95613cf4f46c1289c0d4db Mon Sep 17 00:00:00 2001 From: Dan Field Date: Thu, 3 Aug 2023 14:37:31 -0700 Subject: [PATCH 2/3] Fix test --- shell/common/shell_unittests.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shell/common/shell_unittests.cc b/shell/common/shell_unittests.cc index 078f188df56fd..01474c29edc11 100644 --- a/shell/common/shell_unittests.cc +++ b/shell/common/shell_unittests.cc @@ -4342,7 +4342,8 @@ TEST_F(ShellTest, PrintsErrorWhenPlatformMessageSentFromWrongThread) { ASSERT_FALSE(DartVMRef::IsInstanceRunning()); } -TEST_F(ShellTest, DiesIfSoftwareRenderingAndImpellerAreEnabled) { +TEST_F(ShellTest, DiesIfSoftwareRenderingAndImpellerAreEnabledDeathTest) { + ::testing::FLAGS_gtest_death_test_style = "threadsafe"; Settings settings = CreateSettingsForFixture(); settings.enable_impeller = true; settings.enable_software_rendering = true; From 9a3dc6c6cb6b447dc02ae20293e8be436dd619bc Mon Sep 17 00:00:00 2001 From: Dan Field Date: Thu, 3 Aug 2023 15:16:08 -0700 Subject: [PATCH 3/3] Skip fuchsia --- shell/common/shell_unittests.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/shell/common/shell_unittests.cc b/shell/common/shell_unittests.cc index 01474c29edc11..2c94ca7e7ad4b 100644 --- a/shell/common/shell_unittests.cc +++ b/shell/common/shell_unittests.cc @@ -4343,6 +4343,9 @@ TEST_F(ShellTest, PrintsErrorWhenPlatformMessageSentFromWrongThread) { } TEST_F(ShellTest, DiesIfSoftwareRenderingAndImpellerAreEnabledDeathTest) { +#if defined(OS_FUCHSIA) + GTEST_SKIP() << "Fuchsia"; +#endif // OS_FUCHSIA ::testing::FLAGS_gtest_death_test_style = "threadsafe"; Settings settings = CreateSettingsForFixture(); settings.enable_impeller = true;