blob: 0ee9bd97c92b43e9d31e086c607161272ff9202d [file] [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 = {
chromium = "/core/testing/chromium-tests"
component_framework = "/core/testing/component-framework-tests"
ctf = "/core/testing/ctf-tests"
device = "/core/testing/devices-tests"
drm = "/core/testing/drm-tests"
starnix = "/core/testing/starnix-tests"
storage = "/core/testing/storage-tests"
system = "/core/testing/system-tests"
system_validation = "/core/testing/system-validation-tests"
test_arch = "/core/testing/test-arch-tests"
vfs_compliance = "/core/testing/vfs-compliance-tests"
vulkan = "/core/testing/vulkan-tests"
bootstrap_driver_system = "/bootstrap/testing/driver-system-tests"
driver_system = "/core/testing/driver-system-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
# Refer to
# https://fuchsia.dev/fuchsia-src/development/testing/components/test_runner_framework?hl=en#non-hermetic_tests
# for valid types
template("fuchsia_test_component") {
fuchsia_component(target_name) {
forward_variables_from(invoker,
"*",
[
"manifest",
"testonly",
"metadata",
"test_type",
# don't override target name from invoker as it is
# used below and in `fuchsia_component` template
"target_name",
])
forward_variables_from(invoker, [ "manifest" ])
testonly = true
metadata = {
if (defined(invoker.metadata)) {
forward_variables_from(invoker.metadata, "*")
}
if (defined(invoker.test_type)) {
test_components = [
{
test_component = {
label = get_label_info(":$target_name", "label_with_toolchain")
moniker = type_moniker_map[invoker.test_type]
}
},
]
}
}
}
}