blob: 7d292ccbdb0a567b36392680b5d43f2c3b2899c1 [file] [log] [blame]
# Copyright 2019 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/packages/prebuilt_package.gni")
import("//build/testing/test_spec.gni")
# Describes a prebuilt package of tests.
#
# Parameters
#
# archive (required)
# [string] Path to archive containing a package.
#
# package (optional)
# [string] Name of the package.
#
# component_name (required)
# [string] Component name to test.
#
# runner (required)
# [string] The runner used to execute the test(run).
#
# deps (optional)
# [list of labels]: List of labels that the test depends on.
#
# environments (optional, default: [ { dimensions = { device_type = "QEMU" } } ])
# [list of scopes] Device environments in which the test should run.
#
# Environment scope is defined in //build/testing/test_spec.gni
#
# log_settings (optional)
# [scope] passed through to test_spec. See //build/testing/test_spec.gni.
#
template("prebuilt_test_package") {
assert(defined(invoker.archive), "archive must be defined.")
assert(defined(invoker.component_name), "component_name must be defined.")
package_name = target_name
if (defined(invoker.package)) {
package_name = invoker.package
}
spec_target_name = "${target_name}_${invoker.component_name}_spec"
test_spec(spec_target_name) {
target = get_label_info(":${invoker.target_name}", "label_with_toolchain")
build_rule = "prebuilt_test_package"
package_label = target
package_manifests = rebase_path(
[ "${target_out_dir}/${invoker.target_name}/package_manifest.json" ],
root_build_dir)
package_url = "fuchsia-pkg://fuchsia.com/${package_name}#meta/${invoker.component_name}"
assert(
get_path_info(invoker.component_name, "extension") == "cm",
"Unknown manifest format for \"${invoker.component_name}\", must be \".cm\"")
forward_variables_from(invoker,
[
"deps",
"environments",
"log_settings",
])
}
prebuilt_package(target_name) {
package_name = package_name
testonly = true
archive = invoker.archive
deps = [ ":$spec_target_name" ]
}
}