| # 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("//build/config/fuchsia/platform_version.gni") |
| import("//sdk/ctf/build/compatibility_test_suite.gni") |
| import("//sdk/ctf/build/ctf.gni") |
| import("//sdk/ctf/build/internal/ctf_releases.gni") |
| |
| # Store accumulated test targets. |
| all_test_targets = [] |
| |
| # CTF release F{N} (nominally) contains tests that target API level N. So, by |
| # default, we should only run tests from releases corresponding to API levels |
| # that are frozen and still supported. |
| # |
| # This logic is _mostly_ redundant with logic from |
| # `//integration/fuchsia/ctf/ctf_generate_manifest.py`, except for an edge case: |
| # that script uses a copy of `version_history.json` from the `integration` repo, |
| # which lags behind the copy in `fuchsia.git`. Therefore, when support for an |
| # API level is dropped from `fuchsia.git`, `ctf_generate_manifest.py` still |
| # thinks it is supported, and will attempt to run tests that will no longer |
| # work. |
| supported_releases = [] |
| foreach(level, platform_version.frozen_api_levels) { |
| supported_releases += [ "f${level}" ] |
| } |
| |
| # Expand each CTF release into a compatibility_test_suite target. |
| # Each release name is assumed to match the pattern /f[0-9]+/, where |
| # the number denotes the release version. |
| foreach(release, ctf_releases) { |
| target_name = "ctf_$release" |
| level = string_replace("##${release}", "##f", "") |
| assert(level != "##${release}", |
| "Unexpected release name (does not begin with 'f'): ${release}") |
| compatibility_test_suite(target_name) { |
| api_level = level |
| path = "//prebuilt/ctf/$release/$host_platform/cts" |
| } |
| |
| # Declare the target regardless of whether it is supported or not, but only |
| # link it into the build graph (by default) if it corresponds to a supported |
| # release. |
| if (supported_releases + [ release ] - [ release ] != supported_releases) { |
| all_test_targets += [ ":$target_name" ] |
| } |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = all_test_targets |
| } |