blob: 0e8ee2407c04f0e9adf90dab749d3895602aa912 [file] [log] [blame]
# Copyright 2022 The Fuchsia 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/assembly/assembled_system.gni")
import("//build/assembly/board_configuration.gni")
import("//build/assembly/product_assembly_configuration.gni")
import("//build/component/config.gni")
import("//build/components/fuchsia_package.gni")
import("//build/testing/host_test_data.gni")
import("//build/zircon/tools.gni")
rustc_test("resolve_bootfs_package") {
name = "resolve-bootfs-package"
edition = "2018"
source_root = "src/resolve_bootfs_package.rs"
deps = [
"//sdk/fidl/fuchsia.component:fuchsia.component_rust",
"//sdk/fidl/fuchsia.io:fuchsia.io_rust",
"//sdk/fidl/fuchsia.process:fuchsia.process_rust",
"//sdk/fidl/fuchsia.sys2:fuchsia.sys2_rust",
"//src/lib/fidl/rust/fidl",
"//src/lib/fuchsia",
"//src/lib/fuchsia-component-test",
"//src/lib/fuchsia-fs",
"//src/lib/fuchsia-runtime",
"//src/lib/zircon/rust:fuchsia-zircon",
"//src/storage/lib/vfs/rust:vfs",
]
sources = [ "src/resolve_bootfs_package.rs" ]
}
if (current_toolchain == default_toolchain) {
board_configuration("board_config") {
name = "test"
}
product_assembly_configuration("product_config") {
platform = {
build_type = "eng"
feature_set_level = "bootstrap"
storage = {
configure_fshost = true
filesystems = {
image_name = "test_zbi"
image_mode = "no_image"
volume = {
fvm = {
data = {
}
blob = {
}
}
}
}
}
}
product = {
}
}
# `assembled_system` builds a zbi for consumption by the test.
assembled_system("test_zbi") {
testonly = true
product_assembly_config_label = ":product_config"
board_config_label = ":board_config"
use_bringup_platform_bundles_only = true
bootfs_labels = [ ":config" ]
bootfs_package_labels = [ "//src/security/tests/pkg_test/assemblies/hello_world_v1:hello_world-package" ]
base_packages = []
}
output_file = "$target_out_dir/uncompressed_bootfs"
action("test_assembly") {
testonly = true
script = "//src/sys/component_manager/tests/fuchsia_boot_resolver/scripts/extract_bootfs_from_zbi.py"
deps = [
":test_zbi",
zbi_tool_target,
]
inputs = [
target_out_dir + "/test_zbi/test_zbi.zbi",
zbi_tool_path,
]
outputs = [ output_file ]
args = [
"--zbi",
rebase_path(zbi_tool_path, root_build_dir),
"--zbi-image",
rebase_path(target_out_dir + "/test_zbi/test_zbi.zbi", root_build_dir),
"--output",
rebase_path(outputs[0], root_build_dir),
]
}
resource("bootfs_resource") {
testonly = true
sources = [ output_file ]
outputs = [ "data/tests/uncompressed_bootfs" ]
deps = [ ":test_assembly" ]
}
fuchsia_test_component("resolve_bootfs_package-component") {
component_name = "resolve_bootfs_package"
manifest = "meta/resolve_bootfs_package.cml"
deps = [
":bootfs_resource",
":resolve_bootfs_package",
]
test_type = "system"
}
# This module tests the property that the FuchsiaBootResolver successfully
# resolves components that are encoded in a meta.far. This test is fully
# hermetic, despite using assembled_system, as it only uses that template
# to generate a wellformed hermetic bootfs.
fuchsia_test_package("fuchsia-boot-resolver-integration-tests") {
test_components = [ ":resolve_bootfs_package-component" ]
deps = [
":bootfs_resource",
":component-manager-cmp",
]
}
component_config("config") {
testonly = true
sources = [ "config.json5" ]
dest = "data/component_manager_config"
}
fuchsia_component("component-manager-cmp") {
testonly = true
component_name = "component_manager"
manifest = "meta/component_manager.cml"
deps = [ "//src/sys/component_manager:bin" ]
}
group("tests") {
testonly = true
deps = [ ":fuchsia-boot-resolver-integration-tests" ]
}
}