| # Copyright 2018 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/package.gni") |
| import("//build/test/test_package.gni") |
| |
| # A variant of package() that only contains test executables. The test |
| # executables are specified as the build products of the deps. A tests_package() |
| # is always testonly = true. The deps are expected to be executable()s. |
| template("tests_package") { |
| computed_tests = [] |
| foreach(dep, invoker.deps) { |
| computed_tests += [ |
| { |
| name = get_label_info(dep, "name") |
| }, |
| ] |
| } |
| |
| package(target_name) { |
| testonly = true |
| |
| forward_variables_from(invoker, |
| [ |
| "deps", |
| "meta", |
| "resources", |
| ]) |
| tests = computed_tests |
| } |
| } |
| |
| # A variant of test_package() that only contains test executables. It computes |
| # the value of the 'tests' paremeter from 'deps'. |
| # |
| # This variant, as described in |
| # https://fuchsia.git.corp.google.com/docs/+/master/development/tests/test_component.md, |
| # requires a .cmx file for each test. |
| template("hermetic_tests_package") { |
| computed_tests = [] |
| foreach(dep, invoker.deps) { |
| computed_tests += [ |
| { |
| name = get_label_info(dep, "name") |
| }, |
| ] |
| } |
| |
| test_package(target_name) { |
| forward_variables_from(invoker, |
| [ |
| "deps", |
| "meta", |
| "resources", |
| ]) |
| tests = computed_tests |
| } |
| } |