blob: b9522f2b4e9835cfd2c1422cfdd8cd6a95b5e8fc [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|run_test_component).
#
# 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")
package_url = "fuchsia-pkg://fuchsia.com/${package_name}#meta/${invoker.component_name}"
if (get_path_info(invoker.component_name, "extension") == "") {
package_url = "${package_url}.cmx"
}
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" ]
}
}