| # Copyright 2024 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/components.gni") |
| |
| # Template to generate a component that contains the WLAN integration test suite binary. |
| # Because all WLAN integration tests use the Test Realm Factory pattern and have an identical |
| # package and component structure, this template reduces the amount of boilerplate for new |
| # integration test suites. |
| # |
| # In particular, this generates the manifest for the test component. The generated manifest |
| # includes the shard defined at //src/connectivity/wlan/tests/helpers/build/meta/test-suite.shard.cml, |
| # which contains the minimum set of capabilities needed to run the WLAN test realm factory and should |
| # not generally need to be changed. |
| # |
| # If you need to expose or use any capabilities for a particular WLAN integration test, you should |
| # most likely route them in `//src/connectivity/wlan/tests/helpers/realm-factory` so they are |
| # accessible through the test realm proxy. |
| # |
| # Note that this template forwards all parameters to the fuchsia_component template except: |
| # |
| # - manifest, which is generated internally by this component |
| # - testonly, which is always set to true |
| # |
| # This template defines one new parameter on top of those defined for fuchsia_component: |
| # |
| # test_suite_binary (required) |
| # The name of the test suite binary, to be added to the program section of the generated CML file. |
| # |
| template("wlan_integration_test_component") { |
| assert(defined(invoker.test_suite_binary)) |
| |
| manifest_target = "${target_name}-manifest-target" |
| manifest_file = "${target_gen_dir}/${target_name}-generated-manifest.cml" |
| |
| # Generate the manifest for the test suite component. |
| # This is the same for all WLAN integration tests. |
| generated_file(manifest_target) { |
| testonly = true |
| contents = { |
| include = [ |
| "//src/connectivity/wlan/tests/helpers/build/meta/test-suite.shard.cml", |
| ] |
| program = { |
| binary = "bin/${invoker.test_suite_binary}" |
| } |
| } |
| outputs = [ manifest_file ] |
| output_conversion = "json" |
| visibility = [ ":*" ] |
| } |
| |
| fuchsia_component(target_name) { |
| forward_variables_from(invoker, |
| "*", |
| [ |
| "manifest", |
| "test_suite_binary", |
| "testonly", |
| ]) |
| testonly = true |
| manifest = manifest_file |
| |
| if (!defined(deps)) { |
| deps = [] |
| } |
| deps += [ ":${manifest_target}" ] |
| } |
| } |