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

Commit b5d8096

Browse files
committed
Use the ELF loader to setup AOT symbols in benchmark runner.
We no longer package AOT artifacts as discrete blobs. The portable ELF loader from the testing library may be used instead. Fixes flutter/flutter#52263
1 parent 06bb649 commit b5d8096

File tree

6 files changed

+13
-24
lines changed

6 files changed

+13
-24
lines changed

lib/ui/BUILD.gn

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,7 @@ if (current_toolchain == host_toolchain) {
175175
":ui",
176176
":ui_unittests_fixtures",
177177
"//flutter/common",
178-
"//flutter/fml",
179-
"//flutter/lib/snapshot",
180-
"//flutter/runtime",
181-
"//flutter/shell/common",
178+
"//flutter/testing",
182179
"//flutter/testing:dart",
183180
"//flutter/testing:opengl",
184181
"//flutter/third_party/tonic",

runtime/BUILD.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ source_set("runtime_unittests_common") {
150150
"//flutter/fml",
151151
"//flutter/lib/snapshot",
152152
"//flutter/shell/common",
153+
"//flutter/testing",
153154
"//flutter/testing:dart",
154155
"//flutter/third_party/tonic",
155156
"//third_party/dart/runtime/bin:elf_loader",

shell/common/BUILD.gn

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ if (enable_unittests) {
209209
"//flutter/fml/dart",
210210
"//flutter/lib/ui:ui",
211211
"//flutter/shell",
212+
"//flutter/testing",
212213
"//flutter/testing:dart",
213214
]
214215

@@ -278,6 +279,7 @@ if (enable_unittests) {
278279
deps = [
279280
":shell_unittests_fixtures",
280281
"//flutter/benchmarking",
282+
"//flutter/testing:dart",
281283
"//flutter/testing:testing_lib",
282284
]
283285
}

shell/common/shell_benchmarks.cc

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "flutter/runtime/dart_vm.h"
88
#include "flutter/shell/common/shell.h"
99
#include "flutter/shell/common/thread_host.h"
10+
#include "flutter/testing/elf_loader.h"
1011
#include "flutter/testing/testing.h"
1112

1213
namespace flutter {
@@ -18,32 +19,19 @@ static void StartupAndShutdownShell(benchmark::State& state,
1819
fml::FilePermission::kRead);
1920
std::unique_ptr<Shell> shell;
2021
std::unique_ptr<ThreadHost> thread_host;
22+
testing::ELFAOTSymbols aot_symbols;
23+
2124
{
2225
benchmarking::ScopedPauseTiming pause(state, !measure_startup);
2326
Settings settings = {};
2427
settings.task_observer_add = [](intptr_t, fml::closure) {};
2528
settings.task_observer_remove = [](intptr_t) {};
2629

2730
if (DartVM::IsRunningPrecompiledCode()) {
28-
settings.vm_snapshot_data = [&]() {
29-
return fml::FileMapping::CreateReadOnly(assets_dir, "vm_snapshot_data");
30-
};
31-
32-
settings.isolate_snapshot_data = [&]() {
33-
return fml::FileMapping::CreateReadOnly(assets_dir,
34-
"isolate_snapshot_data");
35-
};
36-
37-
settings.vm_snapshot_instr = [&]() {
38-
return fml::FileMapping::CreateReadExecute(assets_dir,
39-
"vm_snapshot_instr");
40-
};
41-
42-
settings.isolate_snapshot_instr = [&]() {
43-
return fml::FileMapping::CreateReadExecute(assets_dir,
44-
"isolate_snapshot_instr");
45-
};
46-
31+
aot_symbols = testing::LoadELFSymbolFromFixturesIfNeccessary();
32+
FML_CHECK(
33+
testing::PrepareSettingsForAOTWithSymbols(settings, aot_symbols))
34+
<< "Could not setup settings with AOT symbols.";
4735
} else {
4836
settings.application_kernels = [&]() {
4937
std::vector<std::unique_ptr<const fml::Mapping>> kernel_mappings;

shell/platform/embedder/BUILD.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ if (current_toolchain == host_toolchain) {
137137
"//flutter/flow",
138138
"//flutter/lib/ui",
139139
"//flutter/runtime",
140+
"//flutter/testing",
140141
"//flutter/testing:dart",
141142
"//flutter/testing:opengl",
142143
"//flutter/testing:skia",

testing/BUILD.gn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ source_set("dart") {
5252
]
5353

5454
public_deps = [
55-
":testing",
55+
":testing_lib",
5656
"//flutter/common",
5757
"//flutter/runtime",
5858
"//flutter/runtime:libdart",

0 commit comments

Comments
 (0)