blob: 4ca685a6d55de911914093e605d675476ace9e4b [file] [log] [blame]
# 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/components.gni")
import("//sdk/cts/build/cts_element.gni")
import("//sdk/cts/build/cts_version.gni")
import("//sdk/cts/build/write_cts_file.gni")
# Defines a Compatibility Test Suite package.
#
# An equivalent to fuchsia_test_package, but ensures dependencies and
# test_components are allowed in CTS.
#
# Example:
# ```
# cts_fuchsia_test_package("my-test-package") {
# package_name = "my-test-package"
# test_components = [ ":my-test-component" ]
# }
# ```
template("cts_fuchsia_test_package") {
assert(defined(invoker.package_name), "package_name must be defined.")
if (cts_version != "") {
invoker.package_name += "_$cts_version"
}
# Ensure that deps and test_components are CTS targets.
invoker_deps = []
if (defined(invoker.deps)) {
invoker_deps += invoker.deps
}
if (defined(invoker.test_components)) {
invoker_deps += invoker.test_components
}
if (invoker_deps != [] && cts_version == "") {
verify_target = target_name + "_verify_deps"
}
write_file_target = target_name + "_cts_file"
if (defined(verify_target)) {
cts_element(verify_target) {
deps = invoker_deps
invoker_label = get_label_info(invoker.target_name, "label_no_toolchain")
}
}
write_cts_file(write_file_target) {
}
fuchsia_test_package(target_name) {
forward_variables_from(invoker, "*")
if (!defined(deps)) {
deps = []
}
if (defined(verify_target)) {
deps += [ ":$verify_target" ]
}
deps += [ ":$write_file_target" ]
}
}