Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Closed
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
188 changes: 101 additions & 87 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -157,118 +157,132 @@ group("flutter") {
}
}

group("unittests") {
testonly = true

public_deps = []
if (is_android) {
public_deps += [
"//flutter/impeller/toolkit/android:apk_unittests",
"//flutter/impeller/toolkit/android:unittests",
"//flutter/shell/platform/android:flutter_shell_native_unittests",
_unittest_targets = []
_runable_tests = []
_common_targets = []
if (is_android) {
_unittest_targets += [
"//flutter/impeller/toolkit/android:apk_unittests",
"//flutter/impeller/toolkit/android:unittests",
"//flutter/shell/platform/android:flutter_shell_native_unittests",
]
}
if (is_ios) {
_unittest_targets +=
[ "//flutter/shell/platform/darwin/ios:ios_test_flutter" ]
}
if (enable_unittests) {
_common_targets += [
"//flutter/display_list:display_list_rendertests",
"//flutter/display_list:display_list_unittests",
"//flutter/flow:flow_unittests",
"//flutter/fml:fml_arc_unittests",
"//flutter/fml:fml_unittests",
"//flutter/lib/ui:ui_unittests",
"//flutter/runtime:dart_plugin_registrant_unittests",
"//flutter/runtime:no_dart_plugin_registrant_unittests",
"//flutter/runtime:runtime_unittests",
"//flutter/shell/common:shell_unittests",
"//flutter/shell/platform/embedder:embedder_a11y_unittests",
"//flutter/shell/platform/embedder:embedder_proctable_unittests",
"//flutter/shell/platform/embedder:embedder_unittests",
"//flutter/testing:testing_unittests",
"//flutter/testing/dart:dart",
"//flutter/testing/smoke_test_failure:smoke_test_failure",
"//flutter/third_party/tonic/tests:tonic_unittests",
"//flutter/third_party/txt:txt_unittests",
]
if (is_mac || is_win) {
_common_targets +=
[ "//flutter/third_party/accessibility:accessibility_unittests" ]
}
if (is_fuchsia) {
_unittest_targets += [ "//flutter/shell/platform/fuchsia:tests" ]
}
if (is_mac || is_linux || is_win) {
_common_targets += [
"//flutter/impeller:impeller_dart_unittests",
"//flutter/impeller:impeller_unittests",
]
}

if (is_ios) {
public_deps += [ "//flutter/shell/platform/darwin/ios:ios_test_flutter" ]
if (is_mac) {
_common_targets += [
"//flutter/impeller/golden_tests:impeller_golden_tests",
"//flutter/shell/gpu:gpu_surface_metal_unittests",
"//flutter/shell/platform/darwin/common:framework_common_unittests",
"//flutter/third_party/spring_animation:spring_animation_unittests",
]
}
if (!is_win && !is_fuchsia) {
_common_targets += [
"//flutter/shell/platform/android/external_view_embedder:android_external_view_embedder_unittests",
"//flutter/shell/platform/android/jni:jni_unittests",
"//flutter/shell/platform/android/platform_view_android_delegate:platform_view_android_delegate_unittests",
]
}

# Compile all unittests targets if enabled.
if (enable_unittests) {
public_deps += [
"//flutter/display_list:display_list_rendertests",
"//flutter/display_list:display_list_unittests",
"//flutter/flow:flow_unittests",
"//flutter/fml:fml_arc_unittests",
"//flutter/fml:fml_unittests",
"//flutter/lib/ui:ui_unittests",
"//flutter/runtime:dart_plugin_registrant_unittests",
"//flutter/runtime:no_dart_plugin_registrant_unittests",
"//flutter/runtime:runtime_unittests",
"//flutter/shell/common:shell_unittests",
"//flutter/shell/platform/embedder:embedder_a11y_unittests",
"//flutter/shell/platform/embedder:embedder_proctable_unittests",
"//flutter/shell/platform/embedder:embedder_unittests",
"//flutter/testing:testing_unittests",
"//flutter/testing/dart",
"//flutter/testing/smoke_test_failure",
"//flutter/third_party/tonic/tests:tonic_unittests",
"//flutter/third_party/txt:txt_unittests",
# Unit tests for desktop embeddings should only be built if the desktop
# embeddings are being built.
if (enable_desktop_embeddings) {
_common_targets += [
"//flutter/shell/platform/common:common_cpp_core_unittests",
"//flutter/shell/platform/common/client_wrapper:client_wrapper_unittests",
]

# The accessibility library only supports Mac and Windows at the moment.
if (is_mac || is_win) {
public_deps +=
[ "//flutter/third_party/accessibility:accessibility_unittests" ]
}
if (!is_fuchsia) {
# These tests require the embedder and thus cannot run on Fuchsia.
_common_targets +=
[ "//flutter/shell/platform/common:common_cpp_unittests" ]

if (is_fuchsia) {
public_deps += [ "//flutter/shell/platform/fuchsia:tests" ]
# These tests require GLFW and thus cannot run on fuchsia.
_common_targets += [ "//flutter/shell/platform/glfw/client_wrapper:client_wrapper_glfw_unittests" ]
}

if (is_mac || is_linux || is_win) {
public_deps += [
"//flutter/impeller:impeller_dart_unittests",
"//flutter/impeller:impeller_unittests",
]
if (is_linux) {
_unittest_targets +=
[ "//flutter/shell/platform/linux:flutter_linux_unittests" ]
if (build_glfw_shell) {
_unittest_targets +=
[ "//flutter/shell/platform/glfw:flutter_glfw_unittests" ]
}
}

if (is_mac) {
public_deps += [
_common_targets += [
"//flutter/impeller/golden_tests:impeller_golden_tests",
"//flutter/shell/gpu:gpu_surface_metal_unittests",
"//flutter/shell/platform/darwin/common:availability_version_check_unittests",
"//flutter/shell/platform/darwin/common:framework_common_unittests",
"//flutter/shell/platform/darwin/macos:flutter_desktop_darwin_unittests",
"//flutter/third_party/spring_animation:spring_animation_unittests",
]
}

if (!is_win && !is_fuchsia) {
public_deps += [
"//flutter/shell/platform/android/external_view_embedder:android_external_view_embedder_unittests",
"//flutter/shell/platform/android/jni:jni_unittests",
"//flutter/shell/platform/android/platform_view_android_delegate:platform_view_android_delegate_unittests",
if (is_win) {
_unittest_targets += [
"//flutter/shell/platform/windows:flutter_windows_unittests",
"//flutter/shell/platform/windows/client_wrapper:client_wrapper_windows_unittests",
]
}
}
}
_unittest_targets += _common_targets
_runable_tests += _common_targets

# Unit tests for desktop embeddings should only be built if the desktop
# embeddings are being built.
if (enable_desktop_embeddings) {
public_deps += [
"//flutter/shell/platform/common:common_cpp_core_unittests",
"//flutter/shell/platform/common/client_wrapper:client_wrapper_unittests",
]

if (!is_fuchsia) {
# These tests require the embedder and thus cannot run on fuchsia.
# TODO(): Enable when embedder works on fuchsia.
public_deps +=
[ "//flutter/shell/platform/common:common_cpp_unittests" ]

# These tests require GLFW and thus cannot run on fuchsia.
public_deps += [ "//flutter/shell/platform/glfw/client_wrapper:client_wrapper_glfw_unittests" ]
}

if (is_linux) {
public_deps +=
[ "//flutter/shell/platform/linux:flutter_linux_unittests" ]
if (build_glfw_shell) {
public_deps +=
[ "//flutter/shell/platform/glfw:flutter_glfw_unittests" ]
}
}
group("unittests") {
testonly = true

if (is_mac) {
public_deps += [ "//flutter/shell/platform/darwin/macos:flutter_desktop_darwin_unittests" ]
}
public_deps = _unittest_targets
}

if (is_win) {
public_deps += [
"//flutter/shell/platform/windows:flutter_windows_unittests",
"//flutter/shell/platform/windows/client_wrapper:client_wrapper_windows_unittests",
]
}
}
group("run_tests") {
testonly = true
public_deps = []
foreach(test_target, _runable_tests) {
test_target_name = get_label_info(test_target, "name")
test_target_dir = get_label_info(test_target, "dir")
run_target = "$test_target_dir:_run_tests_py_$test_target_name"
public_deps += [ run_target ]
}
}

Expand Down
16 changes: 16 additions & 0 deletions ci/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//flutter/build/dart/rules.gni")
import("//flutter/testing/run_tests.gni")

host_dart_test("format_test") {
test_name = "flutter/ci"
main_dart = "test/format_test.dart"
runtime_inputs = [
"//.clang-format",
"//flutter/.clang-format",
"//flutter/.style.yapf",
]
}
5 changes: 3 additions & 2 deletions display_list/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import("//flutter/common/config.gni")
import("//flutter/impeller/tools/impeller.gni")
import("//flutter/testing/run_tests.gni")
import("//flutter/testing/testing.gni")

if (is_fuchsia) {
Expand Down Expand Up @@ -105,7 +106,7 @@ test_fixtures("display_list_fixtures") {
}

if (enable_unittests) {
executable("display_list_unittests") {
engine_native_unittests("display_list_unittests") {
testonly = true

sources = [
Expand Down Expand Up @@ -149,7 +150,7 @@ if (enable_unittests) {
}
}

executable("display_list_rendertests") {
engine_native_unittests("display_list_rendertests") {
testonly = true

sources = [ "testing/dl_rendering_unittests.cc" ]
Expand Down
3 changes: 2 additions & 1 deletion flow/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import("//flutter/common/config.gni")
import("//flutter/impeller/tools/impeller.gni")
import("//flutter/shell/config.gni")
import("//flutter/testing/run_tests.gni")
import("//flutter/testing/testing.gni")

if (is_fuchsia) {
Expand Down Expand Up @@ -146,7 +147,7 @@ if (enable_unittests) {
]
}

executable("flow_unittests") {
engine_native_unittests("flow_unittests") {
testonly = true

sources = [
Expand Down
10 changes: 10 additions & 0 deletions flutter_frontend_server/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
# found in the LICENSE file.

import("//flutter/build/dart/dart.gni")
import("//flutter/build/dart/rules.gni")
import("//flutter/common/config.gni")
import("//flutter/testing/run_tests.gni")

copy("frontend_server") {
if (flutter_prebuilt_dart_sdk) {
Expand All @@ -16,3 +18,11 @@ copy("frontend_server") {
sources = [ snapshot ]
outputs = [ "$root_gen_dir/frontend_server_aot.dart.snapshot" ]
}

if (build_engine_artifacts) {
host_dart_test("to_string_test") {
test_name = "flutter/flutter_frontend_server"
main_dart = "test/to_string_test.dart"
runtime_deps = [ ":frontend_server" ]
}
}
5 changes: 3 additions & 2 deletions fml/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# found in the LICENSE file.

import("//flutter/common/config.gni")
import("//flutter/testing/run_tests.gni")
import("//flutter/testing/testing.gni")

if (is_fuchsia) {
Expand Down Expand Up @@ -333,7 +334,7 @@ if (enable_unittests) {
]
}

executable("fml_unittests") {
engine_native_unittests("fml_unittests") {
testonly = true

sources = [
Expand Down Expand Up @@ -418,7 +419,7 @@ if (enable_unittests) {
}
}

executable("fml_arc_unittests") {
engine_native_unittests("fml_arc_unittests") {
testonly = true
if (is_mac || is_ios) {
cflags_objcc = flutter_cflags_objc_arc
Expand Down
15 changes: 15 additions & 0 deletions impeller/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//flutter/testing/run_tests.gni")
import("//flutter/third_party/glfw/glfw_args.gni")
import("tools/impeller.gni")

Expand Down Expand Up @@ -123,6 +124,13 @@ impeller_component("impeller_unittests") {
}
}

run_tests_py("impeller_unittests") {
testonly = true
deps = [ ":impeller_unittests" ]
name = "impeller_unittests"
type = "engine"
}

if (impeller_supports_rendering) {
impeller_component("impeller_dart_unittests") {
target_type = "executable"
Expand All @@ -131,4 +139,11 @@ if (impeller_supports_rendering) {

deps = [ "renderer:renderer_dart_unittests" ]
}

run_tests_py("impeller_dart_unittests") {
testonly = true
deps = [ ":impeller_dart_unittests" ]
name = "impeller_dart_unittests"
type = "engine"
}
}
8 changes: 8 additions & 0 deletions impeller/golden_tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import("//flutter/common/config.gni")
import("//flutter/impeller/tools/impeller.gni")
import("//flutter/testing/run_tests.gni")

impeller_component("golden_playground_test") {
testonly = true
Expand Down Expand Up @@ -89,4 +90,11 @@ if (is_mac) {
"//flutter/third_party/swiftshader",
]
}

run_tests_py("impeller_golden_tests") {
testonly = true
deps = [ ":impeller_golden_tests" ]
name = "impeller_golden_tests"
type = "engine"
}
}
3 changes: 2 additions & 1 deletion lib/ui/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import("//flutter/common/config.gni")
import("//flutter/impeller/tools/impeller.gni")
import("//flutter/shell/config.gni")
import("//flutter/testing/run_tests.gni")
import("//flutter/testing/testing.gni")

if (is_fuchsia) {
Expand Down Expand Up @@ -259,7 +260,7 @@ if (enable_unittests) {
]
}

executable("ui_unittests") {
engine_native_unittests("ui_unittests") {
testonly = true

public_configs = [ "//flutter:export_dynamic_symbols" ]
Expand Down
Loading