| # 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/generated_image_assembly_config.gni") |
| import("//build/assembly/legacy_assembly_input_bundle.gni") |
| import("//build/python/python_action.gni") |
| import("//build/python/python_binary.gni") |
| import("//build/testing/host_test.gni") |
| |
| python_binary("bin") { |
| testonly = true |
| main_source = "test_assembled_config.py" |
| sources = [] |
| deps = [ "//src/tests/assembly/lib/run_assembly" ] |
| } |
| |
| generated_file("config") { |
| testonly = true |
| outputs = [ "$target_gen_dir/config.json" ] |
| output_conversion = "json" |
| contents = { |
| platform = { |
| build_type = "eng" |
| } |
| product = { |
| } |
| } |
| } |
| config_path = get_label_info(":config", "target_gen_dir") + "/config.json" |
| |
| config_output = "$target_out_dir/config.json" |
| host_test_data("test_config") { |
| testonly = true |
| sources = [ config_path ] |
| outputs = [ config_output ] |
| deps = [ ":config" ] |
| } |
| |
| ffx_label = "//src/developer/ffx:host" |
| ffx_path = "$root_build_dir/host-tools/ffx" |
| ffx_output = "$target_out_dir/ffx" |
| host_test_data("test_ffx") { |
| testonly = true |
| sources = [ ffx_path ] |
| outputs = [ ffx_output ] |
| deps = [ ffx_label ] |
| } |
| |
| # NOTE: target named this way for legacy_assembly_input_bundle's label inference |
| outdir = "$target_out_dir/outdir" |
| generated_image_assembly_config("image.image_assembly_config") { |
| testonly = true |
| |
| # NOTE: legacy_assembly_input_bundle assumes this file path |
| output_path = "$target_out_dir/image.image_assembly_config.json" |
| kernel_image = "//zircon/kernel" |
| base_packages = [ "//examples/assembly/structured_config/configured_by_assembly($default_toolchain)" ] |
| } |
| |
| legacy_assembly_input_bundle("input_bundle") { |
| testonly = true |
| |
| # NOTE: this internally generates the above target name and path |
| image_assembly_label = ":image" |
| bundles_dir = outdir |
| include_config_data = false |
| } |
| |
| # This is an action rather than a host test because enumerating all the inputs to assembly |
| # for the host_test_data() template is very difficult right now. |
| # TODO(https://fxbug.dev/96877) archive the AIB into a tgz for host_test_data() |
| stamp = "$target_out_dir/test_assembled_config.stamp" |
| platform_bundles_target = "//build/assembly($default_toolchain)" |
| platform_bundles_dir = get_label_info(platform_bundles_target, "target_out_dir") |
| python_action("assembled_config") { |
| testonly = true |
| |
| # TODO(fxbug.dev/77290) - Add depfile support and then remove the following |
| hermetic_deps = false |
| binary_label = ":bin" |
| args = [ |
| "--ffx-bin", |
| rebase_path(ffx_output, root_build_dir), |
| "--product-assembly-config", |
| rebase_path(config_output, root_build_dir), |
| "--legacy-bundle-dir", |
| rebase_path(outdir, root_build_dir), |
| "--input-bundles-dir", |
| rebase_path(platform_bundles_dir, root_build_dir), |
| "--outdir", |
| rebase_path(outdir, root_build_dir), |
| "--stamp", |
| rebase_path(stamp, root_build_dir), |
| ] |
| deps = [ |
| ":bin", |
| ":input_bundle", |
| ":test_config", |
| ":test_ffx", |
| "//build/python:interpreter", |
| platform_bundles_target, |
| ] |
| outputs = [ stamp ] |
| } |