Package fml_unittests in a .far file for fml unit tests on Fuchsia (flutter/engine#13471)

Add fml_tests target for the fml unit tests on Fuchsia
This commit is contained in:
George Wright
2019-11-06 13:01:54 -08:00
committed by GitHub
parent 5e7e183369
commit 04e239fc43
4 changed files with 69 additions and 9 deletions

View File

@@ -91,6 +91,11 @@ group("flutter") {
]
}
}
# Fuchsia currently only supports a subset of our unit tests
if (is_fuchsia) {
public_deps += [ "$flutter_root/fml:fml_tests" ]
}
}
config("config") {

View File

@@ -5,6 +5,10 @@
import("//build/fuchsia/sdk.gni")
import("$flutter_root/testing/testing.gni")
if (is_fuchsia) {
import("$flutter_root/tools/fuchsia/fuchsia_archive.gni")
}
source_set("fml") {
sources = [
"base32.cc",
@@ -199,26 +203,32 @@ executable("fml_unittests") {
sources = [
"base32_unittest.cc",
"command_line_unittest.cc",
"file_unittest.cc",
"gpu_thread_merger_unittests.cc",
"memory/ref_counted_unittest.cc",
"memory/weak_ptr_unittest.cc",
"message_loop_task_queues_merge_unmerge_unittests.cc",
"message_loop_task_queues_unittests.cc",
"message_loop_unittests.cc",
"message_unittests.cc",
"paths_unittests.cc",
"platform/darwin/string_range_sanitization_unittests.mm",
"synchronization/count_down_latch_unittests.cc",
"synchronization/semaphore_unittest.cc",
"synchronization/waitable_event_unittest.cc",
"thread_local_unittests.cc",
"thread_unittests.cc",
"time/time_delta_unittest.cc",
"time/time_point_unittest.cc",
"time/time_unittest.cc",
]
# TODO(gw280): Figure out why these tests don't work currently on Fuchsia
if (!is_fuchsia) {
sources += [
"file_unittest.cc",
"gpu_thread_merger_unittests.cc",
"message_loop_task_queues_unittests.cc",
"message_loop_unittests.cc",
"synchronization/count_down_latch_unittests.cc",
"thread_unittests.cc",
]
}
deps = [
":fml_fixtures",
"$flutter_root/fml",
@@ -227,6 +237,16 @@ executable("fml_unittests") {
]
}
if (is_fuchsia) {
fuchsia_test_archive("fml_tests") {
deps = [
":fml_unittests",
]
binary = "fml_unittests"
}
}
executable("fml_benchmarks") {
testonly = true

View File

@@ -0,0 +1,15 @@
{
"program": {
"binary": "bin/app"
},
"sandbox": {
"features": [
"vulkan",
"deprecated-ambient-replace-as-executable"
],
"services": [
"fuchsia.accessibility.semantics.SemanticsManager",
"fuchsia.sys.Launcher"
]
}
}

View File

@@ -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_root/tools/fuchsia/common_libs.gni")
import("$flutter_root/tools/fuchsia/fuchsia_debug_symbols.gni")
# Creates a Fuchsia archive (.far) file using PM from the Fuchsia SDK.
@@ -54,13 +55,17 @@ template("fuchsia_archive") {
copy_outputs += [ "$far_base_dir/lib/${lib.name}" ]
}
meta_dir = pkg.meta_dir
cmx_target = "$pkg_target_name.copy_cmx"
if (defined(invoker.cmx_file)) {
cmx_file = invoker.cmx_file
} else {
cmx_file = "${pkg.meta_dir}/${pkg_target_name}.cmx"
}
copy("$cmx_target") {
sources = [
"${meta_dir}/${pkg_target_name}.cmx",
"$cmx_file",
]
outputs = [
"$far_base_dir/meta/{{source_file_part}}",
@@ -123,3 +128,18 @@ template("fuchsia_archive") {
testonly = pkg_testonly
}
}
template("fuchsia_test_archive") {
fuchsia_archive(target_name) {
testonly = true
libraries = common_libs
assert(defined(invoker.deps), "package must define deps")
deps = invoker.deps
binary = invoker.binary
meta_dir = "$flutter_root/testing/fuchsia/meta"
cmx_file = "$meta_dir/fuchsia_test.cmx"
}
}