blob: 7455f9427f2cec7c73558d2f6a48d1715b9ba2b5 [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("//build/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 = [
"//build/unification/lib/sysroot",
"//sdk:zircon_sysroot_export",
"//sdk/lib/fdio:fdio_sdk",
"//src/lib/vulkan",
]
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" ]
}
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",
"//build/unification/lib/sysroot:sysroot",
"//sdk/lib/fdio",
"//src/zircon/lib/zircon",
"//zircon/public/sysroot:cpp_binary_deps",
"//zircon/public/sysroot:crt1_deps",
]
resource("vulkan-cts-executable") {
deps = [ ":strip" ]
data_deps = [ "//src/lib/vulkan" ] + cpp_binary_deps
sources = [ "$root_build_dir/vulkan-cts" ]
outputs = [ "test/vulkan-cts" ]
}
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-unified",
":vulkan-cts-zircon",
]
}
}
# To run on device: run fuchsia-pkg://fuchsia.com/vulkan-cts#meta/vulkan-cts.cmx
# The following command line args are provided by the cmx:
# --deqp-caselist-file=/pkg/data/vk-default-1.1.3.txt --deqp-log-images=disable --deqp-log-shader-sources=disable --deqp-log-filename=/data/TestResults.qpa
fuchsia_component("vulkan-cts-component") {
component_name = "vulkan-cts"
testonly = true
manifest = "meta/vulkan-cts.cmx"
deps = [ ":cts-deps" ]
}
fuchsia_component("vulkan-cts-zircon-component") {
testonly = true
component_name = "vulkan-cts-zircon"
manifest = "meta/vulkan-cts-zircon.cmx"
deps = [ ":cts-deps" ]
}
fuchsia_component("vulkan-cts-no-args") {
testonly = true
manifest = "meta/vulkan-cts-no-args.cmx"
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-zircon") {
test_components = [ ":vulkan-cts-zircon-component" ]
test_specs = {
environments = labeled_hardware_envs
}
}
group("fuchsia") {
testonly = true
public_deps = [
":vulkan-cts",
"//src/graphics/bundles:vulkan",
]
}