blob: 3c9485f8b722a296e427bc96bdf235a683cdcca8 [file] [log] [blame]
# 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("//build/config/build_api_module.gni")
import("//sdk/cts/build/cts.gni")
build_api_module("cts_artifacts") {
# The list of filepaths to include in the CTS archive.
#
# Paths should be given without a '//' prefix.
#
# Type: list(string)
testonly = true
data_keys = [ "cts_artifacts" ]
deps = [
":cts_data_files",
"//sdk/cts/tests:prebuilts",
]
}
action("update_test_manifest") {
# When trying to build CTS at ToT and a previous version of CTS, the build fails because both CTS
# versions generate packages with identical names. This target appends the CTS version to the
# previous CTS version's package names in the test manifest. The previous version's package names
# are updated in the in the build via //sdk/cts/build/script/transform_build_gn.py.
script = "//sdk/cts/build/scripts/update_test_manifest.py"
inputs = [ "data/test_manifest.json" ]
outputs = [ "$target_gen_dir/test_manifest.json" ]
args = [
"--manifest",
rebase_path("data/test_manifest.json"),
"--out",
rebase_path(outputs[0]),
]
if (cts_version != "") {
args += [
"--cts_version",
cts_version,
]
}
}
cts_artifacts("cts_data_files") {
data = [
# TODO(fxb/80700): Combine the ABI and API targets, and add these LICENSE files in //sdk:cts.
"../../LICENSE",
"../../AUTHORS",
"../../PATENTS",
] + get_target_outputs(":update_test_manifest")
deps = [ ":update_test_manifest" ]
}
group("cts_no_e2e") {
testonly = true
assert_no_deps = e2e_test_libs
deps = [ "tests:tests_no_e2e" ]
# Prevents us from adding example tests and build scripts to the archive.
path = get_label_info(":${target_name}", "dir")
is_cts_tot = string_replace(path, "//sdk/cts", "") != path
if (is_cts_tot) {
deps += [
"build/scripts:tests",
"examples:tests",
]
}
}
group("cts") {
testonly = true
deps = [
":cts_artifacts",
":cts_no_e2e",
"tests",
]
# Prevents us from adding example tests and build scripts to the archive.
# TODO(jcecil): add tools back once we're able to execute them OOT.
path = get_label_info(":${target_name}", "dir")
is_cts_tot = string_replace(path, "//sdk/cts", "") != path
if (is_cts_tot) {
deps += [ "tools" ]
}
}
cts_copy_to_sdk("build") {
sources = [ "BUILD.gn" ]
testonly = true
}
sdk_molecule("cts_tests") {
category = "cts"
deps = [
":build_sdk",
":cts_deps",
"tests:test_sdks",
"//sdk/testing/fidl:test_sdks",
]
# Prevents us from adding example tests to the archive.
path = get_label_info(":${target_name}", "dir")
is_cts_tot = string_replace(path, "//sdk/cts", "") != path
if (is_cts_tot) {
deps += [ "examples:test_sdks" ]
}
testonly = true
}
sdk_molecule("cts_deps") {
category = "cts"
deps = [ "//zircon/public/sysroot/sdk:sysroot_sdk" ]
testonly = true
}