blob: 21987e2f73de7271d28004bc6c8406f9abaf4d6b [file] [log] [blame]
# Copyright 2019 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/packages/prebuilt_test_package.gni")
# Defines prebuilt package tests based on the contents in a prebuilt test manifest.
#
# Vendors are required to upload a "test_manifest.json" file in the same CIPD
# package as their prebuilt FAR tests. We use this manifest for determining
# which test packages to enable and how each test package is run.
#
# Parameters
#
# archive_dir (required)
# [string] Path to directory containing prebuilt archives and test_manifest.json
#
# environments (optional, default: [ { dimensions = { device_type = "QEMU" } } ])
# [list of scopes] Device environments in which the test should run.
#
# Environment scope is defined in //build/testing/test_spec.gni
#
# disabled_tests (optional)
# [list of scopes] List of scopes containing "package" and "component_name"
# entries to disable.
#
template("prebuilt_test_manifest") {
assert(defined(invoker.archive_dir), "archive_dir must be defined.")
manifest_path = "${invoker.archive_dir}/test_manifest.json"
manifest = read_file(manifest_path, "json")
test_targets = []
foreach(test, manifest) {
test_package = test.package
component_name = test.component_name
test_disabled = false
if (defined(invoker.disabled_tests)) {
foreach(disabled_test, invoker.disabled_tests) {
if (test_package == disabled_test.package &&
component_name == disabled_test.component_name) {
test_disabled = true
}
}
}
if (!test_disabled) {
prebuilt_test_package(test_package) {
archive = "${invoker.archive_dir}/${test_package}.far"
component_name = component_name
forward_variables_from(invoker,
[
"environments",
"log_settings",
])
}
test_targets += [ ":${test_package}" ]
}
}
group(target_name) {
testonly = true
forward_variables_from(invoker, [ "visibility" ])
public_deps = test_targets
}
}