| # Copyright 2021 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("//sdk/ctf/build/internal/ctf.gni") |
| |
| # Generates test targets from a CTF archive. |
| # |
| # Users can build ABI, API, and host tool tests using the following target names: |
| # - ABI tests: {target_name}_abi |
| # - API tests: {target_name}_api |
| # - Host tool tests: {target_name}_host |
| # - All: target_name |
| # |
| # Parameters: |
| # |
| # path (required) |
| # The path to the extracted CTF archive contents as a target label. |
| # Example: "//prebuilt/cts/canary/$host_platform/cts" |
| # |
| # disabled_tests |
| # A list of FAR archive names containing tests to skip. |
| # The archive names can be found in //prebult/cts/<version>/<platform>/cts. |
| template("compatibility_test_suite") { |
| assert(defined(invoker.api_level), "api_level is required") |
| assert(defined(invoker.path), |
| "The path to the extracted CTF archive is required.") |
| |
| # On-device ABI tests. |
| on_device_tests = "${target_name}_ctf${invoker.api_level}" |
| generate_ctf_tests(on_device_tests) { |
| forward_variables_from(invoker, [ "api_level" ]) |
| manifest = "${invoker.path}/package_archives.json" |
| } |
| |
| # Host Tool Tests |
| host_tests = "${target_name}_host${invoker.api_level}" |
| if (is_host) { |
| prebuilt_host_test_manifest(host_tests) { |
| suffix = invoker.api_level |
| forward_variables_from(invoker, [ "disabled_tests" ]) |
| archive_dir = rebase_path(invoker.path) |
| } |
| } |
| |
| group(target_name) { |
| testonly = true |
| deps = [ |
| ":$host_tests($host_toolchain)", |
| ":$on_device_tests", |
| ] |
| } |
| } |