mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Migrate non-scenic-based fuchsia tests to cfv2. (flutter/engine#27241)
This PR also wraps up the soft transition for #27417. Because some unit tests depend on the real Scenic which isn't hermetic, `flutter_runner_tests` and `flutter_runner_scenic_tests` aren't currently compatible with cfv2. This will change once a FakeScenic is created (https://fxbug.dev/79873). See https://fxbug.dev/79691.
This commit is contained in:
parent
aff2ab3714
commit
cbcbbf7102
@ -1407,7 +1407,6 @@ FILE: ../../../flutter/shell/platform/fuchsia/flutter/meta/flutter_jit_product_r
|
||||
FILE: ../../../flutter/shell/platform/fuchsia/flutter/meta/flutter_jit_runner.cmx
|
||||
FILE: ../../../flutter/shell/platform/fuchsia/flutter/meta/flutter_runner_scenic_tests.cmx
|
||||
FILE: ../../../flutter/shell/platform/fuchsia/flutter/meta/flutter_runner_tests.cmx
|
||||
FILE: ../../../flutter/shell/platform/fuchsia/flutter/meta/flutter_runner_tzdata_tests.cmx
|
||||
FILE: ../../../flutter/shell/platform/fuchsia/flutter/meta/jit_product_runtime
|
||||
FILE: ../../../flutter/shell/platform/fuchsia/flutter/meta/jit_runtime
|
||||
FILE: ../../../flutter/shell/platform/fuchsia/flutter/platform_view.cc
|
||||
|
||||
@ -1,16 +0,0 @@
|
||||
{
|
||||
"program": {
|
||||
"binary": "bin/app"
|
||||
},
|
||||
"sandbox": {
|
||||
"features": [
|
||||
"deprecated-ambient-replace-as-executable",
|
||||
"vulkan"
|
||||
],
|
||||
"services": [
|
||||
"fuchsia.accessibility.semantics.SemanticsManager",
|
||||
"fuchsia.intl.PropertyProvider",
|
||||
"fuchsia.process.Launcher"
|
||||
]
|
||||
}
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
# This configuration file specifies disabled tests as gtest_filters to be passed
|
||||
# as test arguments for flutter on FEMU tests.
|
||||
|
||||
txt_tests: -ParagraphTest.*
|
||||
fml_tests: -MessageLoop.TimeSensitiveTest_*:FileTest.CanTruncateAndWrite:FileTest.CreateDirectoryStructure
|
||||
shell_tests: -ShellTest.ReportTimingsIsCalledLaterInReleaseMode:ShellTest.ReportTimingsIsCalledSoonerInNonReleaseMode:ShellTest.DisallowedDartVMFlag:FuchsiaShellTest.LocaltimesVaryOnTimezoneChanges
|
||||
flutter_runner_scenic_tests: -DefaultSessionConnectionTest.*:CalculateNextLatchPointTest.*
|
||||
@ -1,34 +0,0 @@
|
||||
{
|
||||
"program": {
|
||||
"binary": "bin/app"
|
||||
},
|
||||
"facets": {
|
||||
"fuchsia.test": {
|
||||
"system-services": [
|
||||
"fuchsia.sysmem.Allocator",
|
||||
"fuchsia.vulkan.loader.Loader"
|
||||
]
|
||||
}
|
||||
},
|
||||
"sandbox": {
|
||||
"features": [
|
||||
"vulkan",
|
||||
"deprecated-ambient-replace-as-executable",
|
||||
"isolated-cache-storage",
|
||||
"isolated-temp"
|
||||
],
|
||||
"services": [
|
||||
"fuchsia.accessibility.semantics.SemanticsManager",
|
||||
"fuchsia.deprecatedtimezone.Timezone",
|
||||
"fuchsia.fonts.Provider",
|
||||
"fuchsia.intl.PropertyProvider",
|
||||
"fuchsia.logger.LogSink",
|
||||
"fuchsia.process.Launcher",
|
||||
"fuchsia.settings.Intl",
|
||||
"fuchsia.sysmem.Allocator",
|
||||
"fuchsia.tracing.provider.Registry",
|
||||
"fuchsia.ui.input3.Keyboard",
|
||||
"fuchsia.vulkan.loader.Loader"
|
||||
]
|
||||
}
|
||||
}
|
||||
72
engine/src/flutter/testing/fuchsia/meta/test_suite.cml
Normal file
72
engine/src/flutter/testing/fuchsia/meta/test_suite.cml
Normal file
@ -0,0 +1,72 @@
|
||||
{
|
||||
program: {
|
||||
// TODO(fxbug.dev/80338): Switch to gtest_runner after the filters in
|
||||
// `gtest_filters.yaml` are supported by `--test-filter` and
|
||||
// deprecated-ambient-replace-as-executable is available.
|
||||
// Equivalent to the "deprecated-ambient-replace-as-executable" sandbox
|
||||
// feature in cfv1.
|
||||
runner: "elf_test_ambient_exec_runner",
|
||||
binary: "bin/app",
|
||||
|
||||
// Part of //sdk/lib/diagnostics/syslog/elf_stdio.shard.cml.
|
||||
forward_stderr_to: "log",
|
||||
forward_stdout_to: "log",
|
||||
},
|
||||
capabilities: [
|
||||
{ protocol: "fuchsia.test.Suite" },
|
||||
],
|
||||
expose: [
|
||||
{
|
||||
protocol: "fuchsia.test.Suite",
|
||||
from: "self",
|
||||
},
|
||||
],
|
||||
use: [
|
||||
{
|
||||
protocol: [
|
||||
"fuchsia.logger.LogSink",
|
||||
"fuchsia.process.Launcher",
|
||||
"fuchsia.tracing.provider.Registry",
|
||||
"fuchsia.vulkan.loader.Loader",
|
||||
],
|
||||
},
|
||||
{
|
||||
storage: "cache",
|
||||
path: "/cache",
|
||||
},
|
||||
{
|
||||
storage: "tmp",
|
||||
path: "/tmp",
|
||||
},
|
||||
|
||||
// The following lines are equivalent to the "vulkan" sandbox feature in
|
||||
// cfv1.
|
||||
// TODO(fxbug.dev/79792): Remove after vulkan cml shard is available in
|
||||
// the fuchsia sdk.
|
||||
{
|
||||
directory: "dev-gpu",
|
||||
rights: [ "rw*" ],
|
||||
path: "/dev/class/gpu",
|
||||
},
|
||||
{
|
||||
directory: "dev-goldfish-address-space",
|
||||
rights: [ "rw*" ],
|
||||
path: "/dev/class/goldfish-address-space",
|
||||
},
|
||||
{
|
||||
directory: "dev-goldfish-control",
|
||||
rights: [ "rw*" ],
|
||||
path: "/dev/class/goldfish-control",
|
||||
},
|
||||
{
|
||||
directory: "dev-goldfish-pipe",
|
||||
rights: [ "rw*" ],
|
||||
path: "/dev/class/goldfish-pipe",
|
||||
},
|
||||
{
|
||||
directory: "dev-goldfish-sync",
|
||||
rights: [ "rw*" ],
|
||||
path: "/dev/class/goldfish-sync",
|
||||
},
|
||||
],
|
||||
}
|
||||
@ -1,12 +0,0 @@
|
||||
flutter_runner_tests-0.far
|
||||
flutter_runner_scenic_tests-0.far
|
||||
flutter_runner_tzdata_tests-0.far
|
||||
fml_tests-0.far
|
||||
flow_tests-0.far
|
||||
runtime_tests-0.far
|
||||
shell_tests-0.far
|
||||
testing_tests-0.far
|
||||
txt_tests-0.far
|
||||
ui_tests-0.far
|
||||
embedder_tests-0.far
|
||||
dart_utils_tests-0.far
|
||||
@ -2,25 +2,27 @@
|
||||
# test command for femu_test.py.
|
||||
|
||||
- package: flutter_runner_tzdata_tests-0.far
|
||||
test_command: run-test-component fuchsia-pkg://fuchsia.com/flutter_runner_tzdata_tests#meta/flutter_runner_tzdata_tests.cmx
|
||||
test_command: run-test-suite fuchsia-pkg://fuchsia.com/flutter_runner_tzdata_tests#meta/flutter_runner_tzdata_tests.cm
|
||||
- package: fml_tests-0.far
|
||||
test_command: run-test-component fuchsia-pkg://fuchsia.com/fml_tests#meta/fml_tests.cmx -- --gtest_filter=-MessageLoop.TimeSensitiveTest_*:FileTest.CanTruncateAndWrite:FileTest.CreateDirectoryStructure
|
||||
test_command: run-test-suite fuchsia-pkg://fuchsia.com/fml_tests#meta/fml_tests.cm -- --gtest_filter=-MessageLoop.TimeSensitiveTest_*:FileTest.CanTruncateAndWrite:FileTest.CreateDirectoryStructure
|
||||
- package: flow_tests-0.far
|
||||
test_command: run-test-component fuchsia-pkg://fuchsia.com/flow_tests#meta/flow_tests.cmx
|
||||
test_command: run-test-suite fuchsia-pkg://fuchsia.com/flow_tests#meta/flow_tests.cm
|
||||
- package: runtime_tests-0.far
|
||||
test_command: run-test-component fuchsia-pkg://fuchsia.com/runtime_tests#meta/runtime_tests.cmx
|
||||
test_command: run-test-suite fuchsia-pkg://fuchsia.com/runtime_tests#meta/runtime_tests.cm
|
||||
- package: shell_tests-0.far
|
||||
test_command: run-test-component fuchsia-pkg://fuchsia.com/shell_tests#meta/shell_tests.cmx -- --gtest_filter=-ShellTest.ReportTimingsIsCalledLaterInReleaseMode:ShellTest.ReportTimingsIsCalledSoonerInNonReleaseMode:ShellTest.DisallowedDartVMFlag:FuchsiaShellTest.LocaltimesVaryOnTimezoneChanges
|
||||
test_command: run-test-suite fuchsia-pkg://fuchsia.com/shell_tests#meta/shell_tests.cm -- --gtest_filter=-ShellTest.ReportTimingsIsCalledLaterInReleaseMode:ShellTest.ReportTimingsIsCalledSoonerInNonReleaseMode:ShellTest.DisallowedDartVMFlag:FuchsiaShellTest.LocaltimesVaryOnTimezoneChanges
|
||||
- package: testing_tests-0.far
|
||||
test_command: run-test-component fuchsia-pkg://fuchsia.com/testing_tests#meta/testing_tests.cmx
|
||||
test_command: run-test-suite fuchsia-pkg://fuchsia.com/testing_tests#meta/testing_tests.cm
|
||||
- package: txt_tests-0.far
|
||||
test_command: run-test-component fuchsia-pkg://fuchsia.com/txt_tests#meta/txt_tests.cmx -- --gtest_filter=-ParagraphTest.*
|
||||
test_command: run-test-suite fuchsia-pkg://fuchsia.com/txt_tests#meta/txt_tests.cm -- --gtest_filter=-ParagraphTest.*
|
||||
- package: ui_tests-0.far
|
||||
test_command: run-test-component fuchsia-pkg://fuchsia.com/ui_tests#meta/ui_tests.cmx
|
||||
test_command: run-test-suite fuchsia-pkg://fuchsia.com/ui_tests#meta/ui_tests.cm
|
||||
- package: embedder_tests-0.far
|
||||
test_command: run-test-component fuchsia-pkg://fuchsia.com/embedder_tests#meta/embedder_tests.cmx
|
||||
test_command: run-test-suite fuchsia-pkg://fuchsia.com/embedder_tests#meta/embedder_tests.cm
|
||||
- package: dart_utils_tests-0.far
|
||||
test_command: run-test-component fuchsia-pkg://fuchsia.com/dart_utils_tests#meta/dart_utils_tests.cmx
|
||||
test_command: run-test-suite fuchsia-pkg://fuchsia.com/dart_utils_tests#meta/dart_utils_tests.cm
|
||||
|
||||
# Legacy v1 components.
|
||||
- package: flutter_runner_tests-0.far
|
||||
test_command: run-test-component fuchsia-pkg://fuchsia.com/flutter_runner_tests#meta/flutter_runner_tests.cmx
|
||||
- package: flutter_runner_scenic_tests-0.far
|
||||
|
||||
@ -12,23 +12,20 @@ template("_compile_cml") {
|
||||
action(target_name) {
|
||||
forward_variables_from(invoker,
|
||||
[
|
||||
"visibility",
|
||||
"deps",
|
||||
"testonly",
|
||||
"visibility",
|
||||
])
|
||||
script = "//flutter/tools/fuchsia/compile_cml.py"
|
||||
|
||||
sources = [ invoker.manifest ]
|
||||
if (defined(invoker.cml_includes)) {
|
||||
sources += invoker.cml_includes
|
||||
}
|
||||
|
||||
inputs = [ "//fuchsia/sdk/$host_os/tools/cmc" ]
|
||||
sources = [ invoker.manifest ]
|
||||
|
||||
args = [
|
||||
"--cmc-bin",
|
||||
rebase_path("//fuchsia/sdk/$host_os/tools/cmc"),
|
||||
"--manifest-file",
|
||||
invoker.manifest,
|
||||
rebase_path(invoker.manifest),
|
||||
"--output",
|
||||
rebase_path(invoker.output, root_build_dir),
|
||||
"--includepath",
|
||||
@ -41,10 +38,8 @@ template("_compile_cml") {
|
||||
}
|
||||
|
||||
# Creates a Fuchsia archive (.far) file using PM from the Fuchsia SDK.
|
||||
template("fuchsia_archive") {
|
||||
template("_fuchsia_archive") {
|
||||
assert(defined(invoker.binary), "package must define binary")
|
||||
assert(defined(invoker.cmx_file) || defined(invoker.cml_file),
|
||||
"must specify either a cmx file, cml file or both")
|
||||
|
||||
pkg_testonly = defined(invoker.testonly) && invoker.testonly
|
||||
pkg_target_name = target_name
|
||||
@ -117,16 +112,6 @@ template("fuchsia_archive") {
|
||||
binary = invoker.binary
|
||||
}
|
||||
|
||||
if (defined(invoker.cml_file)) {
|
||||
_compile_cml(target_name + "_compile_cml") {
|
||||
forward_variables_from(invoker, [ "cml_includes" ])
|
||||
|
||||
manifest = invoker.cml_file
|
||||
output = "$far_base_dir/meta/${pkg_target_name}.cm"
|
||||
}
|
||||
pkg_dir_deps += [ ":${target_name}_compile_cml" ]
|
||||
}
|
||||
|
||||
action("${target_name}_dir") {
|
||||
script = "//flutter/tools/fuchsia/copy_path.py"
|
||||
sources = copy_sources
|
||||
@ -174,20 +159,88 @@ template("fuchsia_archive") {
|
||||
}
|
||||
}
|
||||
|
||||
template("fuchsia_test_archive") {
|
||||
fuchsia_archive(target_name) {
|
||||
testonly = true
|
||||
libraries = common_libs
|
||||
template("fuchsia_archive") {
|
||||
assert(defined(invoker.cmx_file) || defined(invoker.cml_file),
|
||||
"must specify either a cmx file, cml file or both")
|
||||
_deps = []
|
||||
if (defined(invoker.deps)) {
|
||||
_deps += invoker.deps
|
||||
}
|
||||
|
||||
assert(defined(invoker.deps), "package must define deps")
|
||||
if (defined(invoker.cml_file)) {
|
||||
_far_base_dir = "$root_out_dir/${target_name}_far"
|
||||
_cml_file_name = get_path_info(invoker.cml_file, "name")
|
||||
_compile_cml_target = "${target_name}_${_cml_file_name}_compile_cml"
|
||||
|
||||
deps = invoker.deps
|
||||
binary = invoker.binary
|
||||
_compile_cml(_compile_cml_target) {
|
||||
forward_variables_from(invoker, [ "testonly" ])
|
||||
|
||||
if (defined(invoker.resources)) {
|
||||
resources = invoker.resources
|
||||
manifest = invoker.cml_file
|
||||
output = "$_far_base_dir/meta/${_cml_file_name}.cm"
|
||||
}
|
||||
_deps += [ ":$_compile_cml_target" ]
|
||||
}
|
||||
|
||||
_fuchsia_archive(target_name) {
|
||||
deps = _deps
|
||||
forward_variables_from(invoker,
|
||||
[
|
||||
"binary",
|
||||
"cmx_file",
|
||||
"inputs",
|
||||
"libraries",
|
||||
"meta_dir",
|
||||
"resources",
|
||||
"testonly",
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
# Creates a Fuchsia archive (.far) file containing a generated test root
|
||||
# component and test driver component, using PM from the Fuchsia SDK.
|
||||
template("fuchsia_test_archive") {
|
||||
assert(defined(invoker.deps), "package must define deps")
|
||||
|
||||
# Interpolate test_suite.cml template with the test suite's name.
|
||||
test_suite = target_name
|
||||
interpolate_cml_target = "${test_suite}_interpolate_cml"
|
||||
generated_cml_file = "$root_out_dir/$test_suite.cml"
|
||||
action(interpolate_cml_target) {
|
||||
testonly = true
|
||||
script = "//flutter/tools/fuchsia/interpolate_test_suite.py"
|
||||
sources = [ "//flutter/testing/fuchsia/meta/test_suite.cml" ]
|
||||
args = [
|
||||
"--input",
|
||||
rebase_path("//flutter/testing/fuchsia/meta/test_suite.cml"),
|
||||
"--test-suite",
|
||||
test_suite,
|
||||
"--output",
|
||||
rebase_path(generated_cml_file),
|
||||
]
|
||||
outputs = [ generated_cml_file ]
|
||||
}
|
||||
|
||||
far_base_dir = "$root_out_dir/${target_name}_far"
|
||||
|
||||
# Compile the resulting interpolated test suite's cml.
|
||||
compile_test_suite_cml_target = "${test_suite}_test_suite_compile_cml"
|
||||
_compile_cml(compile_test_suite_cml_target) {
|
||||
testonly = true
|
||||
deps = [ ":$interpolate_cml_target" ]
|
||||
|
||||
manifest = generated_cml_file
|
||||
output = "$far_base_dir/meta/${test_suite}.cm"
|
||||
}
|
||||
|
||||
_fuchsia_archive(target_name) {
|
||||
testonly = true
|
||||
forward_variables_from(invoker,
|
||||
[
|
||||
"binary",
|
||||
"resources",
|
||||
])
|
||||
|
||||
libraries = common_libs
|
||||
if (defined(invoker.libraries)) {
|
||||
libraries += invoker.libraries
|
||||
}
|
||||
@ -196,14 +249,11 @@ template("fuchsia_test_archive") {
|
||||
# FakeScenic is available.
|
||||
if (defined(invoker.cmx_file)) {
|
||||
cmx_file = invoker.cmx_file
|
||||
|
||||
# Don't include cml files.
|
||||
deps = invoker.deps
|
||||
} else {
|
||||
# TODO(fxbug.dev/79691): Default to cml after soft transition.
|
||||
# cml_file =
|
||||
# rebase_path("//flutter/testing/fuchsia/meta/fuchsia_test.cml")
|
||||
# if (defined(invoker.cml_file)) {
|
||||
# cml_file = invoker.cml_file
|
||||
# }
|
||||
cmx_file = rebase_path("//flutter/testing/fuchsia/meta/fuchsia_test.cmx")
|
||||
deps = invoker.deps + [ ":$compile_test_suite_cml_target" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
29
engine/src/flutter/tools/fuchsia/interpolate_test_suite.py
Executable file
29
engine/src/flutter/tools/fuchsia/interpolate_test_suite.py
Executable file
@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# 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.
|
||||
""" Interpolates test suite information into a cml file.
|
||||
"""
|
||||
|
||||
from argparse import ArgumentParser
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
# Parse arguments.
|
||||
parser = ArgumentParser()
|
||||
parser.add_argument('--input', action='store', required=True)
|
||||
parser.add_argument('--test-suite', action='store', required=True)
|
||||
parser.add_argument('--output', action='store', required=True)
|
||||
args = parser.parse_args()
|
||||
|
||||
# Read, interpolate, write.
|
||||
with open(args.input, 'r') as i, open(args.output, 'w') as o:
|
||||
o.write(i.read().replace('{{TEST_SUITE}}', args.test_suite))
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
Loading…
x
Reference in New Issue
Block a user