| # 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/python/python_host_test.gni") |
| import("//build/testing/host_test.gni") |
| import("//src/sys/core/build/core.gni") |
| import("//src/tests/assembly/assemble_image/test_assembly_config.gni") |
| |
| if (is_fuchsia) { |
| # Create a minimal system image that specifies a compiled package containing |
| # a component composed of shards. |
| core_realm_definition("core_realm") { |
| # TODO try to remove once assembly fully handles SWD |
| deps = [] |
| } |
| } |
| |
| # The test_assembly_config() template needs to do some things on the |
| # host toolchain, but only uses the core_realm_definition on the fuchsia |
| # toolchain |
| test_assembly_config("compiled_package") { |
| platform = { |
| feature_set_level = "utility" |
| build_type = "user" |
| example_config = { |
| include_example_aib = true |
| } |
| storage = { |
| configure_fshost = true |
| filesystems = { |
| image_name = "assemble_test" |
| volume = { |
| fvm = { |
| data = { |
| } |
| blob = { |
| } |
| } |
| } |
| } |
| } |
| } |
| core_realm_definition = ":core_realm" |
| additional_args = [ |
| "--config", |
| "assembly_example_enabled=true", |
| ] |
| } |
| |
| if (is_host) { |
| host_test_data("image_assembly_config") { |
| sources = [ |
| get_label_info(":${target_name}($default_toolchain)", "target_out_dir") + |
| "/outdir/image_assembly.json", |
| get_label_info(":${target_name}($default_toolchain)", "target_out_dir") + |
| "/outdir/for-test/bar/bar.cm", |
| get_label_info(":${target_name}($default_toolchain)", "target_out_dir") + |
| "/outdir/for-test/baz/baz.cm", |
| get_label_info(":${target_name}($default_toolchain)", "target_out_dir") + |
| "/outdir/for-test2/qux/qux.cm", |
| ] |
| deps = [ ":compiled_package" ] |
| } |
| |
| python_host_test("compiled_package_test") { |
| main_source = "compiled_package_test.py" |
| extra_args = |
| [ rebase_path(get_label_info(":${target_name}($default_toolchain)", |
| "target_out_dir"), |
| root_build_dir) ] |
| deps = [ ":image_assembly_config" ] |
| } |
| } |