compile a flutter tester with SUPPORT_FRACTIONAL_TRANSLATION and raster cache disabled (flutter/engine#33272)

This commit is contained in:
Jonah Williams 2022-05-12 12:49:04 -07:00 committed by GitHub
parent 15d552606e
commit a4895a7315
5 changed files with 64 additions and 4 deletions

View File

@ -101,6 +101,7 @@ group("flutter") {
if (build_engine_artifacts) {
public_deps += [
"//flutter/shell/testing",
"//flutter/shell/testing:testing_fractional_translation",
"//flutter/tools/const_finder",
"//flutter/tools/font-subset",
]

View File

@ -13,6 +13,7 @@ if (build_engine_artifacts) {
"//flutter/impeller/tessellator:tessellator_shared",
"//flutter/lib/snapshot:generate_snapshot_bin",
"//flutter/shell/testing:testing",
"//flutter/shell/testing:testing_fractional_translation",
]
prefix = "$full_target_platform_name/"
if (flutter_runtime_mode != "debug") {

View File

@ -36,3 +36,44 @@ executable("testing") {
"//third_party/skia",
]
}
# A second tester binary with SUPPORT_FRACTIONAL_TRANSLATION enabled
# and the raster cache disabled.
executable("testing_fractional_translation") {
output_name = "flutter_tester_fractional_translation"
public_configs = [
"//flutter:config",
"//flutter:export_dynamic_symbols",
]
sources = [ "tester_main.cc" ]
if (is_win) {
libs = [
"psapi.lib",
"user32.lib",
"FontSub.lib",
"shlwapi.lib",
]
}
defines = [
"SUPPORT_FRACTIONAL_TRANSLATION=1",
"DISABLE_SOFTWARE_RASTER_CACHE=1",
]
deps = [
"//flutter/assets",
"//flutter/common",
"//flutter/flow",
"//flutter/fml",
"//flutter/lib/snapshot",
"//flutter/shell/common",
"//flutter/shell/gpu:gpu_surface_software",
"//flutter/third_party/tonic",
"//third_party/dart/runtime:libdart_jit",
"//third_party/dart/runtime/bin:dart_io_api",
"//third_party/skia",
]
}

View File

@ -62,6 +62,18 @@ class TesterExternalViewEmbedder : public ExternalViewEmbedder {
SkCanvas canvas_;
};
class TesterGPUSurfaceSoftware : public GPUSurfaceSoftware {
public:
TesterGPUSurfaceSoftware(GPUSurfaceSoftwareDelegate* delegate,
bool render_to_surface)
: GPUSurfaceSoftware(delegate, render_to_surface) {}
#if DISABLE_SOFTWARE_RASTER_CACHE
// |Surface|
bool EnableRasterCache() const override { return false; }
#endif // DISABLE_SOFTWARE_RASTER_CACHE
};
class TesterPlatformView : public PlatformView,
public GPUSurfaceSoftwareDelegate {
public:
@ -70,7 +82,7 @@ class TesterPlatformView : public PlatformView,
// |PlatformView|
std::unique_ptr<Surface> CreateRenderingSurface() override {
auto surface = std::make_unique<GPUSurfaceSoftware>(
auto surface = std::make_unique<TesterGPUSurfaceSoftware>(
this, true /* render to surface */);
FML_DCHECK(surface->IsValid());
return surface;

View File

@ -267,7 +267,7 @@ def RunEngineBenchmarks(build_dir, filter):
def RunDartTest(build_dir, test_packages, dart_file, verbose_dart_snapshot, multithreaded,
enable_observatory=False, expect_failure=False):
enable_observatory=False, expect_failure=False, alternative_tester=False):
kernel_file_name = os.path.basename(dart_file) + '.dill'
kernel_file_output = os.path.join(build_dir, 'gen', kernel_file_name)
error_message = "%s doesn't exist. Please run the build that populates %s" % (
@ -296,9 +296,12 @@ def RunDartTest(build_dir, test_packages, dart_file, verbose_dart_snapshot, mult
else:
threading = 'single-threaded'
print("Running test '%s' using 'flutter_tester' (%s)" % (kernel_file_name, threading))
tester_name = 'flutter_tester'
if alternative_tester:
tester_name = 'flutter_tester_fractional_translation'
print("Running test '%s' using '%s' (%s)" % (kernel_file_name, tester_name, threading))
forbidden_output = [] if 'unopt' in build_dir or expect_failure else ['[ERROR']
RunEngineExecutable(build_dir, 'flutter_tester', None, command_args,
RunEngineExecutable(build_dir, tester_name, None, command_args,
forbidden_output=forbidden_output, expect_failure=expect_failure)
@ -442,6 +445,8 @@ def RunDartTests(build_dir, filter, verbose_dart_snapshot):
print("Testing dart file %s with observatory enabled" % dart_test_file)
RunDartTest(build_dir, test_packages, dart_test_file, verbose_dart_snapshot, True, True)
RunDartTest(build_dir, test_packages, dart_test_file, verbose_dart_snapshot, False, True)
# Smoke test with tester variant that has no raster cache and enabled fractional translation
RunDartTest(build_dir, test_packages, dart_test_file, verbose_dart_snapshot, False, True, True)
for dart_test_file in dart_tests:
if filter is not None and os.path.basename(dart_test_file) not in filter: