| # Copyright 2020 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("//src/sys/build/fuchsia_unittest_package.gni") |
| |
| # Defines a package that contains a component that launches a test written in |
| # Go. |
| # See: https://fuchsia.dev/fuchsia-src/development/components/build |
| # |
| # This template is a thin wrapper over fuchsia_unittest_package which |
| # adds arguments that are specific to the go testing library. |
| # |
| # Example: |
| # ``` |
| # go_test("my-go-test") { |
| # gopackages = [ "my-go" ] |
| # deps = [ ":my-go" ] |
| # } |
| # |
| # go_fuchsia_unittest_package("my-test") { |
| # executable_path = "test/my-go-test" |
| # deps = [ ":my-go-test" ] |
| # } |
| # ``` |
| # |
| # The above will generate a manifest and create a test with the launch URL: |
| # fuchsia-pkg://fuchsia.com/my-test#meta/my-test.cmx |
| # |
| # Parameters |
| # |
| # Note: Most interesting parameters are actually defined by fuchsia_unittest_package.gni |
| # and thus are not documented here. |
| # |
| # args |
| # Optional: additional arguments needed when invoking the test. |
| # Type: list of strings. |
| template("go_fuchsia_unittest_package") { |
| fuchsia_unittest_package(target_name) { |
| forward_variables_from(invoker, "*", [ "args" ]) |
| executable_args = [ "-test.v" ] # Emit detaield test case information. |
| if (defined(invoker.args)) { |
| executable_args += invoker.args |
| } |
| } |
| } |