blob: b321cf781994db43802c825b8b07ffae41978260 [file] [log] [blame]
# Copyright 2016 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/test.gni")
import("//src/lib/vulkan/build/vulkan_targets.gni")
import("//src/ui/lib/escher/build_args.gni")
if (is_host && !has_prebuilt_vulkan_runtime) {
# Escher cannot run without prebuilt Vulkan runtime on host for now.
# Since we may include Escher host tests in the default build,
# we substitute in a dummy executable in the case of a mac build.
source_set("no_op_mac_unittest") {
testonly = true
sources = [ "no_op_mac_unittest.cc" ]
deps = [ "//third_party/googletest:gtest" ]
}
test("escher_unittests") {
deps = [
":no_op_mac_unittest",
"//src/lib/fxl/test:gtest_main",
]
}
test("escher_renderer_tests") {
deps = [
":no_op_mac_unittest",
"//src/lib/fxl/test:gtest_main",
]
}
} else {
# TODO: Consider breaking this out into two binaries, one that uses
# glslang and one that does not. This would ensure we always hav a
# compile target for both on the bots, and also exercise any places
# where those diverge.
vulkan_test("escher_unittests") {
sources = [
"flatland/rectangle_compositor_unittest.cc",
"fs/hack_filesystem_unittest.cc",
"geometry/bounding_box_unittest.cc",
"geometry/indexed_triangle_mesh_clip_unittest.cc",
"geometry/intersection_unittest.cc",
"geometry/interval_unittest.cc",
"geometry/plane_unittest.cc",
"geometry/transform_unittest.cc",
"hmd/pose_buffer_latching_test.cc",
"impl/image_cache_unittest.cc",
"math/rotations_unittest.cc",
"paper/paper_draw_call_factory_unittest.cc",
"paper/paper_render_config_unittest.cc",
"paper/paper_shape_cache_unittest.cc",
"paper/paper_tester.h",
"paper/paper_transform_stack_unittest.cc",
"renderer/batch_gpu_downloader_unittest.cc",
"renderer/batch_gpu_uploader_unittest.cc",
"renderer/buffer_cache_unittest.cc",
"renderer/frame_unittest.cc",
"renderer/protected_memory_unittest.cc",
"renderer/render_queue_unittest.cc",
"renderer/sampler_cache_unittest.cc",
"run_all_unittests.cc",
"scene/directional_light_unittest.cc",
"scene/object_unittest.cc",
"shape/mesh_spec_unittest.cc",
"shape/rounded_rect_unittest.cc",
"util/align_unittest.cc",
"util/bit_ops_unittest.cc",
"util/bitmap_unittest.cc",
"util/block_allocator_unittest.cc",
"util/enum_flags_unittest.cc",
"util/enum_utils_unittest.cc",
"util/epsilon_compare_unittest.cc",
"util/hash_cache_unittest.cc",
"util/hash_unittest.cc",
"util/hashable_unittest.cc",
"util/hashmap_unittest.cc",
"util/image_util_unittest.cc",
"util/intrusive_list_unittest.cc",
"util/object_pool_unittest.cc",
"util/stack_allocator_unittest.cc",
"vk/buffer_unittest.cc",
"vk/chained_semaphore_generator_unittest.cc",
"vk/command_buffer_unittest.cc",
"vk/descriptor_set_allocator_cache_unittest.cc",
"vk/descriptor_set_allocator_unittest.cc",
"vk/descriptor_set_layout_unittest.cc",
"vk/fake_gpu_allocator.cc",
"vk/framebuffer_allocator_unittest.cc",
"vk/gpu_allocator_unittest.cc",
"vk/gpu_mem_unittest.cc",
"vk/image_layout_updater_unittest.cc",
"vk/image_view_allocator_unittest.cc",
"vk/naive_image_unittest.cc",
"vk/push_constant_range_unittest.cc",
"vk/render_pass_cache_unittest.cc",
"vk/render_pass_info_unittest.cc",
"vk/shader_program_unittest.cc",
"vk/validation_layer_test.cc",
"vk/vulkan_tester.h",
"vk/vulkan_utils_unittest.cc",
]
if (escher_use_runtime_glsl) {
sources += [ "vk/shader_module_template_unittest.cc" ]
}
deps = [
":force_examples_to_build_on_host",
":force_paper_shader_compiler_to_build_on_host",
"base:base_unittests",
"//src/lib/fxl",
"//src/ui/lib/escher/test/common:gtest_escher",
"//src/ui/lib/escher/test/common:readback_fixtures",
"//third_party/googletest:gmock",
]
if (escher_use_runtime_glsl) {
deps += [
"//third_party/glslang:glslang_sources",
"//third_party/shaderc:libshaderc",
]
}
if (is_host) {
deps += [ "//src/ui/lib/escher/shaders:host_shader_data" ]
# TODO(fxbug.dev/59140): Fix the leaks and remove this.
deps += [ "//build/config/sanitizers:suppress-lsan.DO-NOT-USE-THIS" ]
}
if (is_fuchsia) {
sources += [
"flib/fence_listener_unittest.cc",
"flib/fence_queue_unittest.cc",
"flib/fence_set_listener_unittest.cc",
"flib/frame_unittest.cc",
"flib/util.cc",
"flib/util.h",
"profiling/timestamp_profiler_unittest.cc",
]
deps += [
"//garnet/public/lib/gtest",
"//zircon/system/ulib/async:async-cpp",
"//zircon/system/ulib/async-default",
"//zircon/system/ulib/async-loop:async-loop-cpp",
"//zircon/system/ulib/async-loop:async-loop-default",
]
}
# TODO(fxbug.dev/58615): Fix the leaks and remove this.
deps += [ "//build/config/sanitizers:suppress-lsan.DO-NOT-USE-THIS" ]
libs = [ "pthread" ]
include_dirs = [
"//lib",
"//src/ui/lib/escher",
"//third_party/glm",
]
}
vulkan_test("escher_renderer_tests") {
sources = [
"integration/debug_font_unittest.cc",
"integration/debug_shape_unittest.cc",
"integration/gamma_correction_unittest.cc",
"integration/lazy_memory_unittest.cc",
"integration/opacity_unittest.cc",
"run_all_unittests.cc",
]
deps = [
"//src/ui/lib/escher/test/common:gtest_escher",
"//src/ui/lib/escher/test/common:readback_fixtures",
]
if (is_host) {
deps += [ "//src/ui/lib/escher/shaders:host_shader_data" ]
# TODO(fxbug.dev/59140): Fix the leaks and remove this.
deps += [ "//build/config/sanitizers:suppress-lsan.DO-NOT-USE-THIS" ]
}
# TODO(fxbug.dev/58615): Fix the leaks and remove this.
deps += [ "//build/config/sanitizers:suppress-lsan.DO-NOT-USE-THIS" ]
}
}
# Guarantees that buildbots at least build the Escher examples on Linux,
# even if they are not run.
group("force_examples_to_build_on_host") {
if (is_host) {
deps = [
"//src/ui/examples/escher/rainfall($host_toolchain)",
"//src/ui/examples/escher/waterfall($host_toolchain)",
]
}
}
# Guarantees that buildbots at least build the paper shader compiler on Linux,
# even if they are not run.
group("force_paper_shader_compiler_to_build_on_host") {
if (is_host && is_linux) {
deps = [ "//src/ui/tools/paper_shader_compiler($host_toolchain)" ]
}
}