| # 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("//sdk/cts/build/cts_element.gni") |
| import("//sdk/cts/build/write_cts_file.gni") |
| import("//src/sys/build/components.gni") |
| |
| # Defines a Compatibility Test Suite unittest component. |
| # |
| # An equivalent to fuchsia_unittest_component, but ensures dependencies are |
| # allowed in CTS. |
| # |
| # Example: |
| # ``` |
| # cts_fuchsia_unittest_component("my-tests") { |
| # executable_path = "bin/my_tests" |
| # deps = [ ":my-tests" ] |
| # } |
| # ``` |
| template("cts_fuchsia_unittest_component") { |
| # Ensure that deps and test_components are CTS targets. |
| if (defined(invoker.deps) && invoker.deps != []) { |
| cts_element("${target_name}_verify_deps") { |
| deps = invoker.deps |
| invoker_label = get_label_info(invoker.target_name, "label_no_toolchain") |
| } |
| } |
| |
| fuchsia_unittest_component(target_name) { |
| forward_variables_from(invoker, "*") |
| if (defined(deps) && deps != []) { |
| deps += [ ":${target_name}_verify_deps" ] |
| } |
| } |
| |
| write_cts_file(target_name) { |
| } |
| } |