| # Copyright 2020 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/generated_partitions_config.gni") |
| import("//build/assembly/product_assembly_configuration.gni") |
| import("//build/config.gni") |
| import("//build/host.gni") |
| import("//build/images/args.gni") |
| import("//build/rust/rustc_library.gni") |
| import("//build/sdk/product_bundle.gni") |
| import("//build/testing/host_test_data.gni") |
| import("//zircon/kernel/phys/qemu.gni") |
| |
| if (is_fuchsia) { |
| files = { |
| partitions = "$target_out_dir/partitions.json" |
| board_config = "$target_out_dir/board_config.json" |
| |
| assembly_outdir = "$target_out_dir/assembly" |
| assembly_manifest = "$assembly_outdir/images.json" |
| zbi = "$assembly_outdir/assembly.zbi" |
| qemu_kernel = qemu_boot_shim.path |
| |
| version = "$target_out_dir/version" |
| } |
| |
| generated_partitions_config("partitions") { |
| testonly = true |
| hw_revision = "board" |
| output_path = files.partitions |
| } |
| |
| generated_file("version") { |
| testonly = true |
| contents = "0.0.0.1" |
| outputs = [ files.version ] |
| } |
| |
| resource("bootfs") { |
| sources = [ files.version ] |
| outputs = [ "path/to/version" ] |
| } |
| |
| board_configuration("board_config") { |
| name = "test" |
| filesystems = { |
| fvm = { |
| sparse_output = { |
| } |
| } |
| } |
| } |
| |
| product_assembly_configuration("assembly_config") { |
| platform = { |
| feature_set_level = "empty" |
| build_type = "eng" |
| storage = { |
| configure_fshost = true |
| filesystems = { |
| image_name = "assembly" |
| image_mode = "no_image" |
| } |
| } |
| } |
| } |
| |
| assembled_system("assembly") { |
| allow_eng_platform_bundle_use = true |
| testonly = true |
| bootfs_labels = [ ":bootfs" ] |
| base_packages = [] |
| cmdline = [ |
| "abc", |
| "def", |
| ] |
| |
| product_assembly_config_label = ":assembly_config" |
| board_config_label = ":board_config" |
| } |
| |
| product_bundle("product_bundle") { |
| testonly = true |
| name = "scrutiny" |
| deps = [ |
| ":assembly", |
| ":partitions", |
| ":version", |
| ] |
| partitions = files.partitions |
| system_a = files.assembly_manifest |
| system_a_contents = [ |
| files.qemu_kernel, |
| files.zbi, |
| ] |
| update = { |
| version_file = files.version |
| epoch = "1" |
| } |
| } |
| } |
| |
| if (is_host) { |
| files = { |
| outdir = |
| get_label_info(":product_bundle($target_toolchain)", "target_out_dir") |
| product_bundle = "$outdir/product_bundle" |
| } |
| |
| if (has_board) { |
| host_test_data("testdata") { |
| deps = [ ":product_bundle($target_toolchain)" ] |
| sources = [ files.product_bundle ] |
| } |
| } |
| |
| config("test_config") { |
| rustenv = [ "PRODUCT_BUNDLE_PATH=" + |
| rebase_path(files.product_bundle, root_build_dir) ] |
| } |
| |
| rustc_library("plugins") { |
| name = "scrutiny_plugins" |
| |
| # The unit-tests binary include some tests that are really integration |
| # tests that use an assembled product bundle as test input. |
| with_unit_tests = has_board |
| |
| edition = "2021" |
| visibility = [ |
| "//src/security/lib/scrutiny/*", |
| |
| # TODO(https://fxbug.dev/42175368): Shared types should be exposed on a public |
| # interface instead of making this visibility exception. |
| "//src/developer/ffx/plugins/scrutiny/extract/*", |
| "//src/developer/ffx/plugins/scrutiny/verify/*", |
| ] |
| |
| configs += [ ":test_config" ] |
| |
| deps = [ |
| "//sdk/fidl/fuchsia.component.decl:fuchsia.component.decl_rust", |
| "//sdk/fidl/fuchsia.component.internal:fuchsia.component.internal_rust", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-url", |
| "//src/security/lib/scrutiny/framework", |
| "//src/security/lib/scrutiny/utils", |
| "//src/sys/lib/cm_config", |
| "//src/sys/lib/cm_fidl_validator", |
| "//src/sys/lib/cm_rust", |
| "//src/sys/lib/cm_types", |
| "//src/sys/lib/component_id_index", |
| "//src/sys/lib/config_encoder", |
| "//src/sys/lib/moniker", |
| "//src/sys/lib/routing", |
| "//src/sys/pkg/lib/far/rust:fuchsia-archive", |
| "//src/sys/pkg/lib/fuchsia-hash", |
| "//src/sys/pkg/lib/fuchsia-merkle", |
| "//src/sys/pkg/lib/update-package", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:base64", |
| "//third_party/rust_crates:maplit", |
| "//third_party/rust_crates:once_cell", |
| "//third_party/rust_crates:regex", |
| "//third_party/rust_crates:serde", |
| "//third_party/rust_crates:serde_json", |
| "//third_party/rust_crates:serde_json5", |
| "//third_party/rust_crates:thiserror", |
| "//third_party/rust_crates:tracing", |
| "//third_party/rust_crates:url", |
| "//tools/lib/cm_fidl_analyzer", |
| "//tools/lib/config_value_file", |
| ] |
| |
| non_rust_deps = [ "//src/lib/chunked-compression" ] |
| |
| if (with_unit_tests) { |
| test_deps = [ |
| ":testdata", |
| "//sdk/fidl/fuchsia.io:fuchsia.io_rust", |
| "//src/lib/fuchsia", |
| "//src/security/lib/scrutiny/config", |
| "//src/security/lib/scrutiny/testing", |
| "//third_party/rust_crates:assert_matches", |
| "//third_party/rust_crates:tempfile", |
| "//third_party/rust_crates:uuid", |
| "//tools/lib/cml", |
| ] |
| } |
| |
| sources = [ |
| "src/additional_boot_args/collection.rs", |
| "src/additional_boot_args/collector.rs", |
| "src/additional_boot_args/controller.rs", |
| "src/additional_boot_args/mod.rs", |
| "src/core/collection.rs", |
| "src/core/controller/blob.rs", |
| "src/core/controller/component.rs", |
| "src/core/controller/mod.rs", |
| "src/core/controller/package.rs", |
| "src/core/controller/package_extract.rs", |
| "src/core/controller/utils.rs", |
| "src/core/mod.rs", |
| "src/core/package/collector.rs", |
| "src/core/package/mod.rs", |
| "src/core/package/reader.rs", |
| "src/core/package/test_utils.rs", |
| "src/core/util/jsons.rs", |
| "src/core/util/mod.rs", |
| "src/core/util/types.rs", |
| "src/engine/controller/collector.rs", |
| "src/engine/controller/controller.rs", |
| "src/engine/controller/health.rs", |
| "src/engine/controller/mod.rs", |
| "src/engine/controller/model.rs", |
| "src/engine/controller/plugin.rs", |
| "src/engine/mod.rs", |
| "src/lib.rs", |
| "src/search/controller/components.rs", |
| "src/search/controller/mod.rs", |
| "src/search/controller/package_list.rs", |
| "src/search/controller/packages.rs", |
| "src/search/mod.rs", |
| "src/static_pkgs/collection.rs", |
| "src/static_pkgs/collector.rs", |
| "src/static_pkgs/controller.rs", |
| "src/static_pkgs/mod.rs", |
| "src/toolkit/controller/blobfs.rs", |
| "src/toolkit/controller/far.rs", |
| "src/toolkit/controller/fvm.rs", |
| "src/toolkit/controller/mod.rs", |
| "src/toolkit/controller/zbi.rs", |
| "src/toolkit/controller/zbi_bootfs.rs", |
| "src/toolkit/controller/zbi_cmdline.rs", |
| "src/toolkit/mod.rs", |
| "src/verify/collection.rs", |
| "src/verify/collector/component_model.rs", |
| "src/verify/collector/mod.rs", |
| "src/verify/controller/build.rs", |
| "src/verify/controller/capability_routing.rs", |
| "src/verify/controller/component_resolvers.rs", |
| "src/verify/controller/mod.rs", |
| "src/verify/controller/pre_signing.rs", |
| "src/verify/controller/route_sources.rs", |
| "src/verify/controller/structured_config.rs", |
| "src/verify/mod.rs", |
| "src/zbi/collection.rs", |
| "src/zbi/collector.rs", |
| "src/zbi/controller.rs", |
| "src/zbi/mod.rs", |
| ] |
| } |
| } |
| |
| group("tests") { |
| testonly = true |
| if (has_board) { |
| public_deps = [ ":plugins_test($host_toolchain)" ] |
| } |
| } |