Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions shell/common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ shell_host_executable("shell_benchmarks") {
]

deps = [
":shell_unittests_fixtures",
"$flutter_root/benchmarking",
"$flutter_root/testing:testing_lib",
]
}
34 changes: 33 additions & 1 deletion shell/common/shell_benchmarks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@

#include "flutter/benchmarking/benchmarking.h"
#include "flutter/fml/logging.h"
#include "flutter/runtime/dart_vm.h"
#include "flutter/shell/common/shell.h"
#include "flutter/shell/common/thread_host.h"
#include "flutter/testing/testing.h"

namespace flutter {

static void StartupAndShutdownShell(benchmark::State& state,
bool measure_startup,
bool measure_shutdown) {
auto assets_dir = fml::OpenDirectory(testing::GetFixturesPath(), false,
fml::FilePermission::kRead);
std::unique_ptr<Shell> shell;
std::unique_ptr<ThreadHost> thread_host;
{
Expand All @@ -20,7 +24,35 @@ static void StartupAndShutdownShell(benchmark::State& state,
settings.task_observer_add = [](intptr_t, fml::closure) {};
settings.task_observer_remove = [](intptr_t) {};

// Measure the time it takes to setup the threads as well.
if (DartVM::IsRunningPrecompiledCode()) {
settings.vm_snapshot_data = [&]() {
return fml::FileMapping::CreateReadOnly(assets_dir, "vm_snapshot_data");
};

settings.isolate_snapshot_data = [&]() {
return fml::FileMapping::CreateReadOnly(assets_dir,
"isolate_snapshot_data");
};

settings.vm_snapshot_instr = [&]() {
return fml::FileMapping::CreateReadExecute(assets_dir,
"vm_snapshot_instr");
};

settings.isolate_snapshot_instr = [&]() {
return fml::FileMapping::CreateReadExecute(assets_dir,
"isolate_snapshot_instr");
};

} else {
settings.application_kernels = [&]() {
std::vector<std::unique_ptr<const fml::Mapping>> kernel_mappings;
kernel_mappings.emplace_back(
fml::FileMapping::CreateReadOnly(assets_dir, "kernel_blob.bin"));
return kernel_mappings;
};
}

thread_host = std::make_unique<ThreadHost>(
"io.flutter.bench.", ThreadHost::Type::Platform |
ThreadHost::Type::GPU | ThreadHost::Type::IO |
Expand Down
20 changes: 15 additions & 5 deletions testing/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,35 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

source_set("testing") {
source_set("testing_lib") {
testonly = true

sources = [
"$flutter_root/testing/run_all_unittests.cc",
"$flutter_root/testing/testing.cc",
"$flutter_root/testing/testing.h",
"$flutter_root/testing/thread_test.cc",
"$flutter_root/testing/thread_test.h",
]

public_deps = [
"$flutter_root/fml",
"//third_party/googletest:gtest",
]

public_configs = [ "$flutter_root:config" ]
}

source_set("testing") {
testonly = true

sources = [
"$flutter_root/testing/run_all_unittests.cc",
"$flutter_root/testing/thread_test.cc",
"$flutter_root/testing/thread_test.h",
]

public_deps = [
":testing_lib",
]
}

source_set("dart") {
testonly = true

Expand Down
9 changes: 9 additions & 0 deletions testing/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,18 @@ echo "Running flow_unittests..."
echo "Running fml_unittests..."
"$HOST_DIR/fml_unittests" --gtest_filter="-*TimeSensitiveTest*"

echo "Running fml_benchmarks..."
"$HOST_DIR/fml_benchmarks"

echo "Running runtime_unittests..."
"$HOST_DIR/runtime_unittests"

echo "Running shell_unittests..."
"$HOST_DIR/shell_unittests"

echo "Running shell_benchmarks..."
"$HOST_DIR/shell_benchmarks"

echo "Running client_wrapper_unittests..."
"$HOST_DIR/client_wrapper_unittests"

Expand All @@ -47,6 +53,9 @@ echo "Running client_wrapper_glfw_unittests..."
echo "Running txt_unittests..."
"$HOST_DIR/txt_unittests" --font-directory="$BUILDROOT_DIR/flutter/third_party/txt/third_party/fonts"

echo "Running txt_benchmarks..."
"$HOST_DIR/txt_benchmarks" --font-directory="$BUILDROOT_DIR/flutter/third_party/txt/third_party/fonts"

# Build flutter/sky/packages.
#
# flutter/testing/dart/pubspec.yaml contains harcoded path deps to
Expand Down