diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /third_party/libwebrtc/build/config/fuchsia | |
parent | Initial commit. (diff) | |
download | firefox-upstream.tar.xz firefox-upstream.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/libwebrtc/build/config/fuchsia')
26 files changed, 968 insertions, 0 deletions
diff --git a/third_party/libwebrtc/build/config/fuchsia/BUILD.gn b/third_party/libwebrtc/build/config/fuchsia/BUILD.gn new file mode 100644 index 0000000000..88922a11e8 --- /dev/null +++ b/third_party/libwebrtc/build/config/fuchsia/BUILD.gn @@ -0,0 +1,30 @@ +# Copyright 2017 The Chromium 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("//build/config/chromecast_build.gni") + +assert(is_fuchsia) +assert(!is_posix) + +config("compiler") { + configs = [ "//third_party/fuchsia-sdk/sdk/build/config:compiler" ] + + # TODO(https://crbug.com/706592): The stack defaults to 256k on Fuchsia (see + # https://fuchsia.googlesource.com/zircon/+/master/system/private/zircon/stack.h#9), + # but on other platforms it's much higher, so a variety of code assumes more + # will be available. Raise to 8M which matches e.g. macOS. + ldflags = [ "-Wl,-z,stack-size=0x800000" ] + + # Allow this in chromium-only builds, but do not allow this in Chromecast + # builds. + if (!is_chromecast) { + cflags_cc = [ "-fexperimental-relative-c++-abi-vtables" ] + ldflags += [ "-fexperimental-relative-c++-abi-vtables" ] + } +} + +# Settings for executables. +config("executable_config") { + ldflags = [ "-pie" ] +} diff --git a/third_party/libwebrtc/build/config/fuchsia/DIR_METADATA b/third_party/libwebrtc/build/config/fuchsia/DIR_METADATA new file mode 100644 index 0000000000..6d8f079aa5 --- /dev/null +++ b/third_party/libwebrtc/build/config/fuchsia/DIR_METADATA @@ -0,0 +1,7 @@ +monorail { + component: "Fuchsia" +} + +team_email: "cr-fuchsia@chromium.org" + +os: FUCHSIA diff --git a/third_party/libwebrtc/build/config/fuchsia/OWNERS b/third_party/libwebrtc/build/config/fuchsia/OWNERS new file mode 100644 index 0000000000..3a1056b296 --- /dev/null +++ b/third_party/libwebrtc/build/config/fuchsia/OWNERS @@ -0,0 +1,4 @@ +file://build/fuchsia/OWNERS + +per-file *.cmx=set noparent +per-file *.cmx=file://fuchsia/SECURITY_OWNERS diff --git a/third_party/libwebrtc/build/config/fuchsia/build_cmx_from_fragment.py b/third_party/libwebrtc/build/config/fuchsia/build_cmx_from_fragment.py new file mode 100644 index 0000000000..ac7e34988d --- /dev/null +++ b/third_party/libwebrtc/build/config/fuchsia/build_cmx_from_fragment.py @@ -0,0 +1,49 @@ +# Copyright 2020 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +"""Creates a complete CMX (v1) component manifest, from a program name and + manifest fragment file.""" + +import argparse +import json +import sys + + +def BuildCmxFromFragment(output_file, fragment_file, program_binary): + """Reads a CMX fragment specifying e.g. features & sandbox, and a program + binary's filename, and writes out the full CMX. + + output_file: Build-relative filename at which to write the full CMX. + fragment_file: Build-relative filename of the CMX fragment to read from. + program_binary: Package-relative filename of the program binary. + """ + + with open(output_file, 'w') as component_manifest_file: + component_manifest = json.load(open(fragment_file, 'r')) + component_manifest.update({ + 'program': { + 'binary': program_binary + }, + }) + json.dump(component_manifest, component_manifest_file) + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument( + '--cmx-fragment', + required=True, + help='Path to the CMX fragment to read from') + parser.add_argument( + '--cmx', required=True, help='Path to write the complete CMX file to') + parser.add_argument( + '--program', + required=True, + help='Package-relative path to the program binary') + args = parser.parse_args() + + return BuildCmxFromFragment(args.cmx, args.cmx_fragment, args.program) + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/third_party/libwebrtc/build/config/fuchsia/build_symbol_archive.py b/third_party/libwebrtc/build/config/fuchsia/build_symbol_archive.py new file mode 100755 index 0000000000..c763627bf9 --- /dev/null +++ b/third_party/libwebrtc/build/config/fuchsia/build_symbol_archive.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python +# +# Copyright 2018 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Creates a compressed archive of unstripped binaries cataloged by +"ids.txt".""" + +import argparse +import os +import subprocess +import sys +import tarfile + + +def main(args): + parser = argparse.ArgumentParser() + parser.add_argument('ids_txt', type=str, nargs=1, + help='Path to ids.txt files.') + parser.add_argument('-o', '--output_tarball', nargs=1, type=str, + help='Path which the tarball will be written to.') + parser.add_argument('--fuchsia-build-id-dir', type=str, required=True, + help='Directory containing symbols for SDK prebuilts.') + args = parser.parse_args(args) + + ids_txt = args.ids_txt[0] + build_ids_archive = tarfile.open(args.output_tarball[0], 'w:bz2') + for line in open(ids_txt, 'r'): + build_id, binary_path = line.strip().split(' ') + + # Look for prebuilt symbols in the SDK first. + symbol_source_path = os.path.join(args.fuchsia_build_id_dir, + build_id[:2], + build_id[2:] + '.debug') + if not os.path.exists(symbol_source_path): + symbol_source_path = os.path.abspath( + os.path.join(os.path.dirname(ids_txt), binary_path)) + + if os.path.getsize(symbol_source_path) == 0: + # This is a prebuilt which wasn't accompanied by SDK symbols. + continue + + # Exclude stripped binaries (indicated by their lack of symbol tables). + readelf_output = subprocess.check_output( + ['readelf', '-S', symbol_source_path], universal_newlines=True) + if not '.symtab' in readelf_output: + continue + + # Archive the unstripped ELF binary, placing it in a hierarchy keyed to the + # GNU build ID. The binary resides in a directory whose name is the first + # two characters of the build ID, with the binary file itself named after + # the remaining characters of the build ID. So, a binary file with the build + # ID "deadbeef" would be located at the path 'de/adbeef.debug'. + build_ids_archive.add(symbol_source_path, + '%s/%s.debug' % (build_id[:2], build_id[2:])) + + return 0 + + +if __name__ == '__main__': + sys.exit(main(sys.argv[1:])) diff --git a/third_party/libwebrtc/build/config/fuchsia/config.gni b/third_party/libwebrtc/build/config/fuchsia/config.gni new file mode 100644 index 0000000000..5a00cc5a85 --- /dev/null +++ b/third_party/libwebrtc/build/config/fuchsia/config.gni @@ -0,0 +1,11 @@ +# Copyright 2017 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +assert(is_fuchsia) + +# Compute the AEMU path. +aemu_root = "//third_party/aemu-${host_os}-${target_cpu}" + +# Compute the path to the arch-specific boot image directory. +boot_image_root = "//third_party/fuchsia-sdk/images/${target_cpu}" diff --git a/third_party/libwebrtc/build/config/fuchsia/extend_fvm.py b/third_party/libwebrtc/build/config/fuchsia/extend_fvm.py new file mode 100644 index 0000000000..44e5ee30e1 --- /dev/null +++ b/third_party/libwebrtc/build/config/fuchsia/extend_fvm.py @@ -0,0 +1,26 @@ +# Copyright 2018 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Copies a FVM file and extends it by a specified amount. + +Arg #1: path to 'fvm'. + #2: the path to the source fvm.blk. + #3: the path that the extended FVM file will be written to. + #4: the additional number of bytes to grow fvm.blk by.""" + +import os +import shutil +import subprocess +import sys + +def ExtendFVM(fvm_tool_path, src_path, dest_path, delta): + old_size = os.path.getsize(src_path) + new_size = old_size + int(delta) + shutil.copyfile(src_path, dest_path) + subprocess.check_call([fvm_tool_path, dest_path, 'extend', '--length', + str(new_size)]) + return 0 + +if __name__ == '__main__': + sys.exit(ExtendFVM(*sys.argv[1:])) diff --git a/third_party/libwebrtc/build/config/fuchsia/generate_runner_scripts.gni b/third_party/libwebrtc/build/config/fuchsia/generate_runner_scripts.gni new file mode 100644 index 0000000000..3349b2b869 --- /dev/null +++ b/third_party/libwebrtc/build/config/fuchsia/generate_runner_scripts.gni @@ -0,0 +1,284 @@ +# Copyright 2018 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +assert(is_fuchsia) + +import("//build/config/chromecast_build.gni") +import("//build/config/fuchsia/config.gni") +import("//build/config/fuchsia/package.gni") +import("//build/config/gclient_args.gni") +import("//build/config/sysroot.gni") +import("//build/util/generate_wrapper.gni") + +declare_args() { + # Sets the Fuchsia Amber repository which will be used by default by the + # generated installation scripts. If not specified, then no default directory + # will be used. + default_fuchsia_build_dir_for_installation = "" + + # Sets the Fuchsia device node name which will be used by default by the + # generated runner scripts. If not specficed, then no default node name will + # be used. + default_fuchsia_device_node_name = "" + + # CPU architecture of the host used to run the tests. + test_host_cpu = host_cpu + + # Sets whether emulators need to be included in the test isolates + test_isolate_uses_emulator = true + + # A list of additional Fuchsia boot images to include in the test isolates. + fuchsia_additional_boot_images = [] +} + +# Generates a script which deploys and optionally executes a package on a +# device. +# +# Parameters: +# package: The package() target which will be run. +# package_name_override: Specifies the name of the generated package, if its +# name is different than the |package| target name. This value must match +# package_name_override in the |package| target. +# package_deps: An array of [package, package_name_override] array pairs +# which specify additional dependency packages to be installed +# prior to execution. +# runner_script: The runner script implementation to use, relative to +# "build/fuchsia". Defaults to "test_runner.py". +# install_only: If true, executing the script will only install the package +# on the device, but not run it. +# is_test_exe: If true, the generated script will run the command under +# test_env.py and add arguments expected to be passed to test exes. +template("fuchsia_package_runner") { + forward_variables_from(invoker, TESTONLY_AND_VISIBILITY + [ "runner_script" ]) + + if (defined(invoker.package_name_override)) { + _pkg_shortname = invoker.package_name_override + } else { + _pkg_shortname = get_label_info(invoker.package, "name") + } + + _pkg_dir = "$root_out_dir/gen/" + get_label_info(invoker.package, "dir") + + "/" + _pkg_shortname + _package_path = "$_pkg_dir/${_pkg_shortname}.far" + + generated_run_pkg_script_path = "$root_build_dir/bin/run_${_pkg_shortname}" + generated_install_pkg_script_path = + "$root_build_dir/bin/install_$_pkg_shortname" + + _generate_runner_target = "${target_name}__generate_runner" + _generate_installer_target = "${target_name}__generate_installer" + + # Generates a script which installs and runs a test. + generate_wrapper(_generate_runner_target) { + forward_variables_from(invoker, [ "target" ]) + + _is_test_exe = defined(invoker.is_test_exe) && invoker.is_test_exe + + if (defined(runner_script)) { + _runner_script = runner_script + } else { + _runner_script = "//build/fuchsia/test_runner.py" + } + + if (_is_test_exe) { + executable = "//testing/test_env.py" + executable_args = + [ "@WrappedPath(" + rebase_path(_runner_script, root_out_dir) + ")" ] + data = [ + _runner_script, + "//.vpython", + ] + data_deps = [ "//testing:test_scripts_shared" ] + } else { + executable = rebase_path(_runner_script) + executable_args = [] + data = [] + data_deps = [] + } + + if (defined(invoker.data)) { + data += invoker.data + } + + wrapper_script = generated_run_pkg_script_path + + data_deps += [ + invoker.package, + + # Runner scripts require access to "ids.txt" for symbolization, and to + # the "package" from which to get the name & version to deploy, which + # are outputs of the archive manifest generation action. + "${invoker.package}__archive-manifest", + + # Runner scripts require access to "meta.far" from which to calculate the + # expected Merkle root for the package, to verify it has been cached. + "${invoker.package}__archive-metadata", + ] + if (defined(invoker.data_deps)) { + data_deps += invoker.data_deps + } + + # Declares the files that are needed for test execution on the + # swarming test client. + data += [ + "//build/fuchsia/", + "//build/util/lib/", + "//third_party/fuchsia-sdk/sdk/.build-id/", + "//third_party/fuchsia-sdk/sdk/bin/fpave.sh", + "//third_party/fuchsia-sdk/sdk/bin/fuchsia-common.sh", + "//third_party/fuchsia-sdk/sdk/meta/manifest.json", + ] + + # TODO(crbug.com/1137662): Remove checkout_fuchsia_for_arm64_host from + # gclient_gn_args in //DEPS as well as this condition when builders have + # test_host_cpu set correctly. + if (checkout_fuchsia_for_arm64_host) { + test_host_cpu = "arm64" + } + + if (test_host_cpu == "x64") { + data_deps += + [ "//build/config/clang:llvm-symbolizer_data($host_toolchain)" ] + } + + data += [ + "//third_party/fuchsia-sdk/sdk/tools/${test_host_cpu}/device-finder", + "//third_party/fuchsia-sdk/sdk/tools/${test_host_cpu}/ffx", + "//third_party/fuchsia-sdk/sdk/tools/${test_host_cpu}/fvm", + "//third_party/fuchsia-sdk/sdk/tools/${test_host_cpu}/merkleroot", + "//third_party/fuchsia-sdk/sdk/tools/${test_host_cpu}/pm", + + # TODO(crbug.com/1162314) Remove "symbolize" when transition to + # "symbolizer" is complete. + "//third_party/fuchsia-sdk/sdk/tools/${test_host_cpu}/symbolize", + + "//third_party/fuchsia-sdk/sdk/tools/${test_host_cpu}/symbolizer", + "//third_party/fuchsia-sdk/sdk/tools/${test_host_cpu}/zbi", + ] + + if (test_isolate_uses_emulator) { + data += [ + "${boot_image_root}/qemu/qemu-kernel.kernel", + "${boot_image_root}/qemu/storage-full.blk", + "${boot_image_root}/qemu/zircon-a.zbi", + "//third_party/fuchsia-sdk/sdk/tools/${test_host_cpu}/fvdl", + "//third_party/qemu-${host_os}-${test_host_cpu}/", + "${aemu_root}/", + ] + } + + foreach(fuchsia_additional_boot_image, fuchsia_additional_boot_images) { + data += [ "${fuchsia_additional_boot_image}/" ] + } + + package_paths = [ rebase_path(_package_path, root_build_dir) ] + if (defined(invoker.package_deps)) { + foreach(package_dep, invoker.package_deps) { + package_dep_target = package_dep[0] + package_dep_name = package_dep[1] + + data_deps += [ + package_dep_target, + package_dep_target + "__archive-manifest", + package_dep_target + "__archive-metadata", + ] + package_dep_path = rebase_path( + get_label_info(package_dep_target, "target_gen_dir") + "/" + + package_dep_name + "/" + package_dep_name + ".far", + root_build_dir) + package_paths += [ package_dep_path ] + } + } + + foreach(package_path, package_paths) { + executable_args += [ + "--package", + "@WrappedPath(${package_path})", + ] + } + + executable_args += [ + "--out-dir", + "@WrappedPath(.)", + "--target-cpu", + target_cpu, + "--package-name", + _pkg_shortname, + ] + + if (defined(invoker.use_run_test_component) && + invoker.use_run_test_component) { + executable_args += [ "--use-run-test-component" ] + } + + if (defined(invoker.use_test_server) && invoker.use_test_server) { + executable_args += [ "--enable-test-server" ] + } + + if (default_fuchsia_build_dir_for_installation != "") { + executable_args += [ + "--fuchsia-out-dir", + default_fuchsia_build_dir_for_installation, + ] + } + + if (default_fuchsia_device_node_name != "") { + executable_args += [ + "--node-name", + default_fuchsia_device_node_name, + ] + } + } + + # Produces a script which installs a package and its dependencies into the + # package repository of a pre-existing Fuchsia build directory. + generate_wrapper(_generate_installer_target) { + executable = rebase_path("//build/fuchsia/deploy_to_pkg_repo.py") + wrapper_script = generated_install_pkg_script_path + + data_deps = [ invoker.package ] + if (defined(invoker.data_deps)) { + data_deps += invoker.data_deps + } + + # Build a list of all packages to install, and pass the list to the runner + # script. + package_paths = [ rebase_path(_package_path, root_build_dir) ] + if (defined(invoker.package_deps)) { + foreach(package_dep, invoker.package_deps) { + package_dep_target = package_dep[0] + package_dep_name = package_dep[1] + + data_deps += [ package_dep_target ] + package_dep_path = rebase_path( + get_label_info(package_dep_target, "target_gen_dir") + "/" + + package_dep_name + "/" + package_dep_name + ".far", + root_build_dir) + package_paths += [ package_dep_path ] + } + } + executable_args = [] + foreach(package_path, package_paths) { + executable_args += [ + "--package", + "@WrappedPath(${package_path})", + ] + + if (default_fuchsia_build_dir_for_installation != "") { + executable_args += [ + "--fuchsia-out-dir", + default_fuchsia_build_dir_for_installation, + ] + } + } + } + + group(target_name) { + deps = [ ":${_generate_installer_target}" ] + + if (!defined(invoker.install_only) || invoker.install_only == false) { + deps += [ ":${_generate_runner_target}" ] + } + } +} diff --git a/third_party/libwebrtc/build/config/fuchsia/gfx_tests.cmx b/third_party/libwebrtc/build/config/fuchsia/gfx_tests.cmx new file mode 100644 index 0000000000..0786fb0b98 --- /dev/null +++ b/third_party/libwebrtc/build/config/fuchsia/gfx_tests.cmx @@ -0,0 +1,31 @@ +{ + "sandbox": { + "features": [ + "deprecated-ambient-replace-as-executable", + "isolated-persistent-storage", + "isolated-temp", + "vulkan" + ], + "dev": [ + "null", + "zero" + ], + "services": [ + "fuchsia.accessibility.semantics.SemanticsManager", + "fuchsia.device.NameProvider", + "fuchsia.fonts.Provider", + "fuchsia.intl.PropertyProvider", + "fuchsia.logger.LogSink", + "fuchsia.media.ProfileProvider", + "fuchsia.memorypressure.Provider", + "fuchsia.process.Launcher", + "fuchsia.sys.Environment", + "fuchsia.sys.Loader", + "fuchsia.sysmem.Allocator", + "fuchsia.tracing.provider.Registry", + "fuchsia.ui.policy.Presenter", + "fuchsia.ui.scenic.Scenic", + "fuchsia.vulkan.loader.Loader" + ] + } +} diff --git a/third_party/libwebrtc/build/config/fuchsia/package.gni b/third_party/libwebrtc/build/config/fuchsia/package.gni new file mode 100644 index 0000000000..ff6ffd0a3d --- /dev/null +++ b/third_party/libwebrtc/build/config/fuchsia/package.gni @@ -0,0 +1,114 @@ +# Copyright 2018 The Chromium 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("//third_party/fuchsia-sdk/sdk/build/component.gni") +import("//third_party/fuchsia-sdk/sdk/build/package.gni") + +# DEPRECATED: Use the Fuchsia SDK's fuchsia_component() and fuchsia_package() +# templates directly, in new code. +# +# Creates a Fuchsia .far package file containing a Fuchsia component. +# +# Parameters are: +# package_name_override: Specifies the name of the package to generate, +# if different than |target_name|. +# binary: The executable target which should be launched. +# manifest: A path to the manifest that will be used. +# "testonly" targets default to using +# //build/config/fuchsia/tests-with-exec.cmx. +# Non-test targets must explicitly specify a |manifest|. +# additional_manifests: Manifest files that should be included in the package in +# the /meta directory. This allows to package more than one component per +# manifest. These manifest files must specify program/binary to run, which +# is not required for the main manifest file where this parameter is added +# during build. +# component_name_override: If set, specifies the name of the component. +# By default, the component name is the same as the package name. +# deps: Additional targets to build and include in the package (optional). +# +# TODO(https://crbug.com/1050703): Migrate consumers to GN SDK equivalents. +template("cr_fuchsia_package") { + assert(defined(invoker.binary)) + + if (defined(invoker.package_name_override)) { + _package_name = invoker.package_name_override + } else { + _package_name = invoker.target_name + } + + _package_contents = [ invoker.binary ] + if (defined(invoker.deps)) { + _package_contents += invoker.deps + } + + _component_cmx_target = target_name + "__cr-component-cmx" + _component_target = target_name + "__cr-component" + _package_components = [ ":${_component_target}" ] + _component_manifest = "${target_gen_dir}/${target_name}.cmx" + + # Process the CMX fragment in |manifest| to get a full manifest. + action(_component_cmx_target) { + forward_variables_from(invoker, + [ + "deps", + "testonly", + ]) + + script = "//build/config/fuchsia/build_cmx_from_fragment.py" + + inputs = [ invoker.manifest ] + outputs = [ _component_manifest ] + + args = [ + "--cmx-fragment", + rebase_path(invoker.manifest), + "--cmx", + rebase_path(_component_manifest), + "--program", + get_label_info(invoker.binary, "name"), + ] + } + + # Declare the primary component for this package. + fuchsia_component(_component_target) { + forward_variables_from(invoker, [ "testonly" ]) + + deps = [ ":${_component_cmx_target}" ] + data_deps = _package_contents + manifest = _component_manifest + + if (defined(invoker.component_name_override)) { + manifest_output_name = "${invoker.component_name_override}" + } else { + manifest_output_name = "${_package_name}" + } + } + + # Bundle manifests providing additional entrypoints into the package. + if (defined(invoker.additional_manifests)) { + foreach(filename, invoker.additional_manifests) { + _additional_component_target = + target_name + "_" + get_path_info(filename, "name") + _package_components += [ ":${_additional_component_target}" ] + fuchsia_component(_additional_component_target) { + forward_variables_from(invoker, [ "testonly" ]) + data_deps = _package_contents + manifest = filename + + # Depend upon the invoker's |deps|, in case they include a dependency + # responsible for generating this additional component's manifest file. + deps = _package_contents + } + } + } + + fuchsia_package(target_name) { + forward_variables_from(invoker, [ "testonly" ]) + package_name = _package_name + if (defined(invoker.excluded_files)) { + excluded_files = invoker.excluded_files + } + deps = _package_components + } +} diff --git a/third_party/libwebrtc/build/config/fuchsia/rules.gni b/third_party/libwebrtc/build/config/fuchsia/rules.gni new file mode 100644 index 0000000000..689e130b65 --- /dev/null +++ b/third_party/libwebrtc/build/config/fuchsia/rules.gni @@ -0,0 +1,5 @@ +# Copyright 2019 The Chromium 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("//build/config/fuchsia/generate_runner_scripts.gni") diff --git a/third_party/libwebrtc/build/config/fuchsia/sizes.gni b/third_party/libwebrtc/build/config/fuchsia/sizes.gni new file mode 100644 index 0000000000..20a5bf831e --- /dev/null +++ b/third_party/libwebrtc/build/config/fuchsia/sizes.gni @@ -0,0 +1,46 @@ +# Copyright 2020 The Chromium 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("//build/util/generate_wrapper.gni") + +template("compute_fuchsia_package_sizes") { + generate_wrapper(target_name) { + forward_variables_from(invoker, + [ + "data", + "data_deps", + ]) + testonly = true + executable = "//build/fuchsia/binary_sizes.py" + wrapper_script = "$root_out_dir/bin/run_${target_name}" + + assert(target_cpu == "arm64" || target_cpu == "x64", + "target_cpu must be arm64 or x64") + + if (!defined(data)) { + data = [] + } + + if (!defined(data_deps)) { + data_deps = [] + } + + # Declares the files that are needed for test execution on the + # swarming test client. + data += [ + "//build/fuchsia/", + "//fuchsia/release/size_tests/", + "//third_party/fuchsia-sdk/sdk/arch/", + "//third_party/fuchsia-sdk/sdk/tools/${target_cpu}/", + ] + + executable_args = [ + "--output-directory", + "@WrappedPath(.)", + ] + if (defined(invoker.executable_args)) { + executable_args += invoker.executable_args + } + } +} diff --git a/third_party/libwebrtc/build/config/fuchsia/symbol_archive.gni b/third_party/libwebrtc/build/config/fuchsia/symbol_archive.gni new file mode 100644 index 0000000000..9dcb53cae0 --- /dev/null +++ b/third_party/libwebrtc/build/config/fuchsia/symbol_archive.gni @@ -0,0 +1,47 @@ +# Copyright 2019 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +assert(is_fuchsia) + +# Creates a tarball of unstripped binaries, structured according to the +# ".build_ids" convention used by the symbolizer and GNU GDB. +# +# Parameters: +# deps: Must all be cr_fuchsia_package() or fuchsia_package() targets. +# ids_txt: The "ids.txt" file which lists the relative paths to unstripped +# executables and libraries, along with their build IDs. +# archive_name: The path to the compressed tarball that will be generated. +template("symbol_archive") { + assert(!is_debug) + + action(target_name) { + _ids_txt = invoker.ids_txt + _build_ids = invoker.archive_name + + script = "//build/config/fuchsia/build_symbol_archive.py" + + inputs = [ _ids_txt ] + + outputs = [ _build_ids ] + + # For each package in |deps| it is necessary to additionally depend upon + # the corresponding archive-manifest target, which is what creates the + # ids.txt file. + deps = [] + foreach(package, invoker.deps) { + deps += [ + package, + package + "__archive-manifest", + ] + } + + args = [ + rebase_path(_ids_txt), + "-o", + rebase_path(_build_ids), + "--fuchsia-build-id-dir", + rebase_path("//third_party/fuchsia-sdk/sdk/.build-id"), + ] + } +} diff --git a/third_party/libwebrtc/build/config/fuchsia/test/OWNERS b/third_party/libwebrtc/build/config/fuchsia/test/OWNERS new file mode 100644 index 0000000000..3be17de545 --- /dev/null +++ b/third_party/libwebrtc/build/config/fuchsia/test/OWNERS @@ -0,0 +1,7 @@ +file://build/fuchsia/OWNERS + +per-file *.test-cmx=set noparent +per-file *.test-cmx=ddorwin@chromium.org +per-file *.test-cmx=wez@chromium.org +# Please prefer the above when possible. +per-file *.test-cmx=file://fuchsia/SECURITY_OWNERS diff --git a/third_party/libwebrtc/build/config/fuchsia/test/README.md b/third_party/libwebrtc/build/config/fuchsia/test/README.md new file mode 100644 index 0000000000..8427f4a49f --- /dev/null +++ b/third_party/libwebrtc/build/config/fuchsia/test/README.md @@ -0,0 +1,61 @@ +## CMX Fragments + +This directory contains the cmx fragments that are required for running +Fuchsia tests hermetically. Tests start from `minimum_capabilities.test-cmx` +and add additional capabilities as necessary by providing the +`additional_manifest_fragments` argument. Some fragments are explained in detail +below: + +### General Purpose Fragments + +#### font_capabilities.test-cmx +For tests that test fonts by providing `fuchsia.fonts.Provider`. + +#### jit_capabilities.test-cmx +Required by tests that execute JavaScript. Should only be required in a small +number of tests. + +#### minimum_capabilites.test-cmx +Capabilities required by anything that uses `//base/test`, used as the base +fragment for all test suites. + +#### read_debug_data.test-cmx +Required by tests that need access to its debug directory. Should only be +required in a small number of tests. + +#### test_logger_capabilities.test-cmx +For tests that test logging functionality by providing `fuchsia.logger.Log`. + +### WebEngine Fragments +The following fragments are specific to WebEngine functionality as documented +documentation at +https://fuchsia.dev/reference/fidl/fuchsia.web#CreateContextParams and +https://fuchsia.dev/reference/fidl/fuchsia.web#ContextFeatureFlags. +Any test-specific exceptions are documented for each file. + +#### audio_capabilities.test-cmx +Corresponds to the `AUDIO` flag. Required for enabling audio input and output. + +#### network_capabilities.test-cmx +Corresponds to the `NETWORK` flag. Required for enabling network access. Note +that access to the root SSL certificates is not needed if ContextProvider is +used to launch the `Context`. The `fuchsia.device.NameProvider` dependency comes +from fdio. + +#### present_view_capabilities.test-cmx +Services that are needed to render web content in a Scenic view and present it. +Most services are required per the FIDL documentation. +`fuchsia.ui.policy.Presenter` is additionally required by tests that create +views. + +#### vulkan_capabilities.test-cmx +Corresponds to the `VULKAN` flag. Required for enabling GPU-accelerated +rendering of the web content. + +#### web_engine_required_capabilities.test-cmx +Contains services that need to be present when creating a +`fuchsia.web.Context`. Note that the `fuchsia.scheduler.ProfileProvider` service +is only used in tests that encounter memory pressure code. + +#### web_instance_host_capabilities.test-cmx +Contains services that need to be present to use `WebInstanceHost`.
\ No newline at end of file diff --git a/third_party/libwebrtc/build/config/fuchsia/test/audio_capabilities.test-cmx b/third_party/libwebrtc/build/config/fuchsia/test/audio_capabilities.test-cmx new file mode 100644 index 0000000000..2e2013f9ea --- /dev/null +++ b/third_party/libwebrtc/build/config/fuchsia/test/audio_capabilities.test-cmx @@ -0,0 +1,18 @@ +{ + "facets": { + "fuchsia.test": { + "injected-services": { + "fuchsia.mediacodec.CodecFactory": "fuchsia-pkg://fuchsia.com/codec_factory#meta/codec_factory.cmx" + }, + "system-services": [ + "fuchsia.media.Audio" + ] + } + }, + "sandbox": { + "services": [ + "fuchsia.media.Audio", + "fuchsia.mediacodec.CodecFactory" + ] + } +}
\ No newline at end of file diff --git a/third_party/libwebrtc/build/config/fuchsia/test/font_capabilities.test-cmx b/third_party/libwebrtc/build/config/fuchsia/test/font_capabilities.test-cmx new file mode 100644 index 0000000000..4c8661bb80 --- /dev/null +++ b/third_party/libwebrtc/build/config/fuchsia/test/font_capabilities.test-cmx @@ -0,0 +1,14 @@ +{ + "facets": { + "fuchsia.test": { + "injected-services": { + "fuchsia.fonts.Provider": "fuchsia-pkg://fuchsia.com/fonts#meta/fonts.cmx", + } + } + }, + "sandbox": { + "services": [ + "fuchsia.fonts.Provider" + ] + } +}
\ No newline at end of file diff --git a/third_party/libwebrtc/build/config/fuchsia/test/jit_capabilities.test-cmx b/third_party/libwebrtc/build/config/fuchsia/test/jit_capabilities.test-cmx new file mode 100644 index 0000000000..ff70e256be --- /dev/null +++ b/third_party/libwebrtc/build/config/fuchsia/test/jit_capabilities.test-cmx @@ -0,0 +1,7 @@ +{ + "sandbox": { + "features": [ + "deprecated-ambient-replace-as-executable" + ] + } +} diff --git a/third_party/libwebrtc/build/config/fuchsia/test/minimum_capabilities.test-cmx b/third_party/libwebrtc/build/config/fuchsia/test/minimum_capabilities.test-cmx new file mode 100644 index 0000000000..5b9f7bf705 --- /dev/null +++ b/third_party/libwebrtc/build/config/fuchsia/test/minimum_capabilities.test-cmx @@ -0,0 +1,30 @@ +{ + "facets": { + "fuchsia.test": { + "injected-services": { + "fuchsia.intl.PropertyProvider": "fuchsia-pkg://fuchsia.com/intl_property_manager#meta/intl_property_manager.cmx" + }, + "system-services": [ + "fuchsia.boot.ReadOnlyLog" + ] + } + }, + "sandbox": { + "dev": [ + "null", + "zero" + ], + "features": [ + "isolated-persistent-storage", + "isolated-temp" + ], + "services": [ + "fuchsia.intl.PropertyProvider", + "fuchsia.logger.LogSink", + "fuchsia.media.ProfileProvider", + "fuchsia.process.Launcher", + "fuchsia.sys.Launcher", + "fuchsia.sys.Loader" + ] + } +} diff --git a/third_party/libwebrtc/build/config/fuchsia/test/network_capabilities.test-cmx b/third_party/libwebrtc/build/config/fuchsia/test/network_capabilities.test-cmx new file mode 100644 index 0000000000..7218c3f875 --- /dev/null +++ b/third_party/libwebrtc/build/config/fuchsia/test/network_capabilities.test-cmx @@ -0,0 +1,25 @@ +{ + "facets": { + "fuchsia.test": { + "injected-services": { + "fuchsia.net.interfaces.State": "fuchsia-pkg://fuchsia.com/netstack#meta/netstack.cmx", + "fuchsia.net.name.Lookup": "fuchsia-pkg://fuchsia.com/dns-resolver#meta/dns-resolver.cmx", + "fuchsia.posix.socket.Provider": "fuchsia-pkg://fuchsia.com/netstack#meta/netstack.cmx" + }, + "system-services": [ + "fuchsia.device.NameProvider" + ] + } + }, + "sandbox": { + "features": [ + "root-ssl-certificates" + ], + "services": [ + "fuchsia.device.NameProvider", + "fuchsia.net.name.Lookup", + "fuchsia.net.interfaces.State", + "fuchsia.posix.socket.Provider" + ] + } +} diff --git a/third_party/libwebrtc/build/config/fuchsia/test/present_view_capabilities.test-cmx b/third_party/libwebrtc/build/config/fuchsia/test/present_view_capabilities.test-cmx new file mode 100644 index 0000000000..201c8b2212 --- /dev/null +++ b/third_party/libwebrtc/build/config/fuchsia/test/present_view_capabilities.test-cmx @@ -0,0 +1,24 @@ +{ + "facets": { + "fuchsia.test": { + "injected-services": { + "fuchsia.accessibility.semantics.SemanticsManager": "fuchsia-pkg://fuchsia.com/a11y-manager#meta/a11y-manager.cmx", + "fuchsia.ui.input3.Keyboard": "fuchsia-pkg://fuchsia.com/ime_service#meta/ime_service.cmx", + }, + "system-services": [ + "fuchsia.sysmem.Allocator", + "fuchsia.ui.policy.Presenter", + "fuchsia.ui.scenic.Scenic" + ] + } + }, + "sandbox": { + "services": [ + "fuchsia.accessibility.semantics.SemanticsManager", + "fuchsia.sysmem.Allocator", + "fuchsia.ui.input3.Keyboard", + "fuchsia.ui.policy.Presenter", + "fuchsia.ui.scenic.Scenic" + ] + } +} diff --git a/third_party/libwebrtc/build/config/fuchsia/test/read_debug_data.test-cmx b/third_party/libwebrtc/build/config/fuchsia/test/read_debug_data.test-cmx new file mode 100644 index 0000000000..b0c95b0883 --- /dev/null +++ b/third_party/libwebrtc/build/config/fuchsia/test/read_debug_data.test-cmx @@ -0,0 +1,7 @@ +{ + "sandbox": { + "features": [ + "hub" + ] + } +}
\ No newline at end of file diff --git a/third_party/libwebrtc/build/config/fuchsia/test/test_logger_capabilities.test-cmx b/third_party/libwebrtc/build/config/fuchsia/test/test_logger_capabilities.test-cmx new file mode 100644 index 0000000000..68b2a67012 --- /dev/null +++ b/third_party/libwebrtc/build/config/fuchsia/test/test_logger_capabilities.test-cmx @@ -0,0 +1,7 @@ +{ + "sandbox": { + "services": [ + "fuchsia.logger.Log" + ] + } +}
\ No newline at end of file diff --git a/third_party/libwebrtc/build/config/fuchsia/test/vulkan_capabilities.test-cmx b/third_party/libwebrtc/build/config/fuchsia/test/vulkan_capabilities.test-cmx new file mode 100644 index 0000000000..0436ffd5e3 --- /dev/null +++ b/third_party/libwebrtc/build/config/fuchsia/test/vulkan_capabilities.test-cmx @@ -0,0 +1,19 @@ +{ + "facets": { + "fuchsia.test": { + "system-services": [ + "fuchsia.sysmem.Allocator", + "fuchsia.vulkan.loader.Loader" + ] + } + }, + "sandbox": { + "features": [ + "vulkan" + ], + "services": [ + "fuchsia.sysmem.Allocator", + "fuchsia.vulkan.loader.Loader" + ] + } +}
\ No newline at end of file diff --git a/third_party/libwebrtc/build/config/fuchsia/test/web_engine_required_capabilities.test-cmx b/third_party/libwebrtc/build/config/fuchsia/test/web_engine_required_capabilities.test-cmx new file mode 100644 index 0000000000..4cb61fe7f1 --- /dev/null +++ b/third_party/libwebrtc/build/config/fuchsia/test/web_engine_required_capabilities.test-cmx @@ -0,0 +1,25 @@ +{ + "facets": { + "fuchsia.test": { + "injected-services": { + "fuchsia.fonts.Provider": "fuchsia-pkg://fuchsia.com/fonts#meta/fonts.cmx", + "fuchsia.memorypressure.Provider": "fuchsia-pkg://fuchsia.com/memory_monitor#meta/memory_monitor.cmx", + "fuchsia.web.ContextProvider": "fuchsia-pkg://fuchsia.com/web_engine#meta/context_provider.cmx", + }, + "system-services": [ + "fuchsia.device.NameProvider", + "fuchsia.scheduler.ProfileProvider", + "fuchsia.sysmem.Allocator" + ] + } + }, + "sandbox": { + "services": [ + "fuchsia.device.NameProvider", + "fuchsia.fonts.Provider", + "fuchsia.memorypressure.Provider", + "fuchsia.sysmem.Allocator", + "fuchsia.web.ContextProvider" + ] + } +}
\ No newline at end of file diff --git a/third_party/libwebrtc/build/config/fuchsia/test/web_instance_host_capabilities.test-cmx b/third_party/libwebrtc/build/config/fuchsia/test/web_instance_host_capabilities.test-cmx new file mode 100644 index 0000000000..762916ba9f --- /dev/null +++ b/third_party/libwebrtc/build/config/fuchsia/test/web_instance_host_capabilities.test-cmx @@ -0,0 +1,8 @@ +{ + "sandbox": { + "services": [ + "fuchsia.sys.Environment", + "fuchsia.sys.Loader" + ] + } +}
\ No newline at end of file |