| # 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("//build/testing/golden_files.gni") |
| import("//sdk/ctf/build/ctf.gni") |
| import("//sdk/ctf/build/verify_sdk_compatibility.gni") |
| |
| # Generates a manifest of CTF release artifacts to upload to remote storage. |
| build_api_module("ctf_artifacts") { |
| testonly = true |
| data_keys = [ "ctf_artifacts" ] |
| walk_keys = [ "ctf_barrier" ] |
| deps = [ ":ctf" ] |
| } |
| |
| group("ctf") { |
| testonly = true |
| deps = [ |
| ":check_test_templates", |
| ":golden_files", |
| ":host_test_manifest", |
| ":package_archive_manifest", |
| ":test_manifest", |
| ":tests", |
| ":verify_idk_deps", |
| ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| "build/scripts:tests", |
| "tests", |
| "tests:e2e_tests", |
| ] |
| } |
| |
| generated_file("package_archive_manifest") { |
| testonly = true |
| outputs = [ "$root_out_dir/cts/package_archives.json" ] |
| output_conversion = "json" |
| data_keys = [ "package_archives" ] |
| walk_keys = [ "ctf_barrier" ] |
| deps = [ "tests" ] |
| metadata = { |
| ctf_artifacts = rebase_path(outputs, root_build_dir) |
| } |
| } |
| |
| # TODO(123593): Delete this and use :package_archive_manifest instead. |
| generated_file("test_manifest") { |
| testonly = true |
| outputs = [ "$root_out_dir/cts/test_manifest.json" ] |
| output_conversion = "json" |
| data_keys = [ "test_manifest" ] |
| walk_keys = [ "ctf_barrier" ] |
| deps = [ "tests" ] |
| |
| metadata = { |
| ctf_artifacts = [ "cts/test_manifest.json" ] |
| } |
| } |
| |
| generated_file("host_test_manifest") { |
| testonly = true |
| outputs = [ "$root_out_dir/cts/host_test_manifest.json" ] |
| output_conversion = "json" |
| data_keys = [ "host_test_manifest" ] |
| deps = [ "tests/examples/host_tool:tests($host_toolchain)" ] |
| |
| metadata = { |
| ctf_artifacts = [ "cts/host_test_manifest.json" ] |
| } |
| } |
| |
| # TODO(125231): Add the same check for API levels 12+ after the next bump. |
| # |
| # Ensures test authors add new test templates in generate_ctf_tests.gni when adding tests, |
| # and that those templates actually build. |
| generate_ctf_tests("check_test_templates") { |
| api_level = "test" |
| manifest = "//sdk/ctf/goldens/package_archives.json" |
| use_prebuilts_from_current_build = true |
| } |
| |
| golden_files("golden_files") { |
| testonly = true |
| deps = [ ":package_archive_manifest($target_toolchain)" ] |
| |
| comparisons = [] |
| foreach(dep, deps) { |
| _outputs = [] |
| _outputs = get_target_outputs(dep) |
| _candidate = _outputs[0] |
| comparisons += [ |
| { |
| golden = "//sdk/ctf/goldens/" + get_path_info(_candidate, "file") |
| candidate = _candidate |
| }, |
| ] |
| } |
| } |
| |
| _idks = [ |
| "core", |
| "e2e_testing", |
| ] |
| _verify_idk_deps = [] |
| foreach(idk, _idks) { |
| golden_file_target = "${idk}_sdk_layout" |
| generate_sdk_layout_golden_file(golden_file_target) { |
| testonly = true |
| sdk_archive = "$root_out_dir/sdk/archive/${idk}.tar.gz" |
| deps = [ "//sdk:${idk}_archive" ] |
| } |
| |
| # TODO(fxb/112091): Re-enable when bug is fixed. |
| #verify_compatibility_target = "verify_${idk}_sdk_compatibility" |
| # |
| # verify_sdk_compatibility(verify_compatibility_target) { |
| # testonly = true |
| # sdk_archive = "$root_out_dir/sdk/archive/${idk}.tar.gz" |
| # golden_file = "//sdk/manifests/layouts/${target_cpu}/sdk_directory_${idk}.golden_layout" |
| # deps = [ "//sdk:${idk}_archive" ] |
| # } |
| |
| _verify_idk_deps += [ |
| ":$golden_file_target", |
| # ":$verify_compatibility_target", |
| ] |
| } |
| |
| group("verify_idk_deps") { |
| testonly = true |
| deps = _verify_idk_deps |
| } |
| |
| # Tests that we want to run in an FYI builder. |
| # We do not want failures from these tests to break the tree. |
| group("fyi") { |
| testonly = true |
| deps = [ ":verify_idk_deps" ] |
| } |