| # 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 (required) |
| # [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). |
| # |
| # 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 |
| # |
| # deps (optional) |
| # [list of labels]: List of labels that the test depends on. |
| # |
| template("prebuilt_test_package") { |
| assert(defined(invoker.archive), "archive must be defined.") |
| assert(defined(invoker.package), "package must be defined.") |
| assert(defined(invoker.component_name), "component_name must be defined.") |
| assert(defined(invoker.runner), "runner must be defined.") |
| |
| _spec_name = "${target_name}_${invoker.component_name}_spec" |
| test_spec(_spec_name) { |
| name = "${target_name}" |
| |
| # "location" is intentionally empty since it's not used for running prebuilt package tests |
| location = "" |
| command = [ |
| "${invoker.runner}", |
| "fuchsia-pkg://fuchsia.com/${invoker.package}#meta/${invoker.component_name}.cmx", |
| ] |
| |
| forward_variables_from(invoker, [ "deps" ]) |
| forward_variables_from(invoker, [ "environments" ]) |
| } |
| prebuilt_package(invoker.package) { |
| archive = invoker.archive |
| deps = [ |
| ":${_spec_name}", |
| ] |
| } |
| } |