blob: f2474df7fccb891fa00a579f7cf4b895ce9442fa [file] [log] [blame] [edit]
# Copyright 2021 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("fuchsia_component.gni")
_type_moniker_map = {
system = "/core/testing:system-tests"
test_arch = "/core/testing:test-arch-tests"
}
# Defines a Fuchsia component that is testonly.
# See: https://fuchsia.dev/fuchsia-src/development/components/build
# Other Parameters
# test_type (optional)
# Maps to the moniker to run the test component in.
# Type: string
# TODO(https://fxbug.dev/127535: Document various types)
template("fuchsia_test_component") {
fuchsia_component(target_name) {
forward_variables_from(invoker,
"*",
[
"testonly",
"metadata",
])
if (defined(invoker.manifest) && !defined(manifest)) {
manifest = invoker.manifest
}
testonly = true
metadata = {
if (defined(invoker.metadata)) {
forward_variables_from(invoker.metadata, "*")
}
if (defined(test_type)) {
test_components = [
{
test_component = {
label = get_label_info(":$target_name", "label_with_toolchain")
moniker = _type_moniker_map[test_type]
}
},
]
}
}
}
}