blob: 32dc3c52260ee10d936eda3ee663ad9add357bcb [file] [log] [blame]
# Copyright 2018 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/build_id.gni")
import("//build/components/fuchsia_test_package.gni")
import("//src/graphics/lib/magma/gnbuild/magma.gni")
import("resources.gni")
# Only have a copy of the action in one toolchain to ensure we don't do build multiple times for no reason.
if (current_toolchain == target_toolchain) {
action("build") {
script = "build.sh"
args = [
rebase_path(root_out_dir),
current_cpu,
host_cpu,
host_os,
]
# This action writes to many files in the build-vulkancts directory. In addition, CMake reads
# from a ton of files everywhere on the system.
# TODO(fxbug.dev/71971): Fix.
hermetic_deps = false
deps = [
"//sdk:zircon_sysroot_export",
"//sdk/lib/fdio:fdio_sdk",
"//src/lib/vulkan",
"//zircon/public/sysroot:system_libc_deps",
]
# Use absolute paths to avoid having to track relative paths through CMake.
no_output_dir_leaks = false
depfile = "$root_out_dir/build-vulkancts/vulkan-cts.d"
outputs = [
"$root_out_dir/build-vulkancts/external/vulkancts/modules/vulkan/deqp-vk",
"$root_out_dir/build-vulkancts/executor/executor",
"$root_out_dir/build-vulkancts/execserver/execserver",
]
}
copy("copy") {
sources = [
"$root_out_dir/build-vulkancts/external/vulkancts/modules/vulkan/deqp-vk",
]
outputs = [ "$root_build_dir/exe.unstripped/vulkan-cts" ]
deps = [ ":build" ]
}
action("strip") {
script = "//prebuilt/third_party/clang/${host_platform}/bin/llvm-objcopy"
args = [
"--strip-sections",
"build-vulkancts/external/vulkancts/modules/vulkan/deqp-vk",
"vulkan-cts",
]
outputs = [ "$root_build_dir/vulkan-cts" ]
sources = [
"$root_out_dir/build-vulkancts/external/vulkancts/modules/vulkan/deqp-vk",
]
deps = [ ":build" ]
# output path is built into executable.
no_output_dir_leaks = false
}
build_id_entry("vulkan_cts_build_id") {
deps = [
":copy",
":strip",
]
debug = "$root_build_dir/exe.unstripped/vulkan-cts"
stripped = "$root_build_dir/vulkan-cts"
}
}
build_id_entry("executor_build_id") {
deps = [ ":build" ]
debug = "$root_out_dir/build-vulkancts/executor/executor"
}
build_id_entry("execserver_build_id") {
deps = [ ":build" ]
debug = "$root_out_dir/build-vulkancts/execserver/execserver"
}
# Add a label of "vulkan-cts" for each environment given in the list
# of general hardware environments for magma tests. The label ensures
# that the Vulkan CTS will not be run in the general test pipeline;
# the label will be keyed on so that the suite may be run in a special
# builder.
hardware_envs = magma_hardware_envs + [ aemu_env ]
labeled_hardware_envs = []
foreach(env, hardware_envs) {
labeled_env = {
} # Clear from previous iteration.
labeled_env = {
forward_variables_from(env, "*")
if (defined(tags)) {
tags += [ "vulkan-cts" ]
} else {
tags = [ "vulkan-cts" ]
}
}
labeled_hardware_envs += [ labeled_env ]
}
# C++ binaries implicitly use a set of shared libraries like ld.so.1. Adding them as deps to the
# resource allows the fuchsia_package to discover and package them. This list is mainly assembled
# from the variant_target template in //build/config/BUILDCONFIG.gn.
cpp_binary_deps = [
"//build/toolchain/runtime:shared-libc++-deps",
"//sdk/lib/fdio",
"//src/zircon/lib/zircon",
"//zircon/public/sysroot:cpp_binary_deps",
"//zircon/public/sysroot:crt1_deps",
"//zircon/public/sysroot:system_libc_deps",
]
resource("vulkan-cts-executable") {
deps = [
":strip",
":vulkan_cts_build_id",
]
data_deps = [ "//src/lib/vulkan" ] + cpp_binary_deps
sources = [ "$root_build_dir/vulkan-cts" ]
outputs = [ "test/vulkan-cts" ]
allow_binary_output_dir = true
}
resource_group("cts-resources") {
files = cts_resources
}
group("cts-deps") {
deps = [
":cts-resources",
":vulkan-cts-executable",
]
}
group("vulkan-cts") {
testonly = true
if (target_cpu == "arm64") {
# This takes a while to build, so only try building it on ARM64, where it's necessary.
deps = [
":vulkan-cts-zircon",
"split-cts:vulkan-cts-split",
]
} else {
deps = [
":vulkan-cts-zircon",
"upstream-split-cts:vulkan-cts-upstream-split",
]
}
deps += [ ":base_bundle" ]
}
# To run on device:
#
# fx test -o vulkan-cts.cm
#
# Command line args are specified in the component manifest.
#
fuchsia_component("vulkan-cts-component") {
component_name = "vulkan-cts"
testonly = true
manifest = "meta/vulkan-cts.cml"
deps = [ ":cts-deps" ]
}
# To run on device:
#
# fx test -o vulkan-cts-zircon
#
fuchsia_component("vulkan-cts-zircon-component") {
testonly = true
component_name = "vulkan-cts-zircon"
manifest = "meta/vulkan-cts-zircon.cml"
deps = [ ":cts-deps" ]
}
# To run on device:
#
# fx test -o vulkan-cts-no-args -- --deqp-log-images=disable --deqp-log-shader-sources=disable --deqp-log-filename=/artifacts/TestResults.qpa --deqp-archive-dir=/pkg/data --deqp-case=dEQP-VK.*
#
fuchsia_component("vulkan-cts-no-args-component") {
testonly = true
component_name = "vulkan-cts-no-args"
manifest = "meta/vulkan-cts-no-args.cml"
deps = [ ":cts-deps" ]
}
fuchsia_test_package("vulkan-cts-unified") {
test_components = [ ":vulkan-cts-component" ]
deps = [ ":vulkan-cts-no-args" ]
test_specs = {
environments = labeled_hardware_envs
}
}
fuchsia_test_package("vulkan-cts-no-args") {
test_components = [ ":vulkan-cts-no-args-component" ]
test_specs = {
environments = [
{
forward_variables_from(aemu_env, "*")
# This test should only be run manually (it needs command-line arguments to work), so use a
# tag that's never enabled on infra.
tags = [ "disabled-vulkan-cts" ]
},
]
}
}
fuchsia_test_package("vulkan-cts-zircon") {
test_components = [ ":vulkan-cts-zircon-component" ]
test_specs = {
environments = labeled_hardware_envs
}
}
group("fuchsia") {
testonly = true
public_deps = [
":vulkan-cts",
":vulkan-cts-no-args",
"//src/graphics/bundles:vulkan",
]
}
group("base_bundle") {
testonly = true
deps = [
# Must be included in base for fuchsia.media.ProfileProvider to be available for changing thread
# priorities.
"//src/media/audio/bundles:services",
]
}