| # Copyright 2023 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/components.gni") |
| |
| # Please do not use this template outside of CTF. |
| # |
| # This is similar to fuchsia_test_package, but it takes a component_name (string) |
| # rather than a list of test_component labels. The latter requires that each |
| # test component be defined in the same BUILD.gn file as this target, which is |
| # not possible for CTF tests. |
| template("fuchsia_package_with_test") { |
| main_target_name = target_name |
| package_name = main_target_name |
| component_name = invoker.test_component_name |
| |
| fuchsia_package("${target_name}_package") { |
| testonly = true |
| package_name = package_name |
| subpackages = invoker.subpackages |
| deps = invoker.deps |
| } |
| |
| test_spec("${target_name}_test") { |
| target = get_label_info(":$target_name", "label_with_toolchain") |
| package_label = get_label_info(":$package_name", "label_with_toolchain") |
| package_url = "fuchsia-pkg://fuchsia.com/$package_name#meta/$component_name" |
| } |
| |
| group(target_name) { |
| testonly = true |
| deps = [ |
| ":${main_target_name}_package", |
| ":${main_target_name}_test", |
| ] |
| } |
| } |