blob: 1132fe0da8fa00126308f809739440be344e33ce [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/components.gni")
import("//build/test.gni")
group("tests") {
testonly = true
deps = [
":fbl($host_toolchain)",
":fbl-gmock-test($host_toolchain)",
":fbl-test-pkg",
]
}
test("fbl") {
output_name = "fbl-test"
include_dirs = [ "include" ]
sources = [
"algorithm_tests.cc",
"array_tests.cc",
"bit_tests.cc",
"conditional_select_nospec_tests.cc",
"confine_array_index_tests.cc",
"enum_bits.cc",
"forward_tests.cc",
"hard_int_tests.cc",
"inline_array_tests.cc",
"intrusive_container_node_tests.cc",
"intrusive_container_tests.cc",
"intrusive_doubly_linked_list_tests.cc",
"intrusive_hash_table_dll_tests.cc",
"intrusive_hash_table_sll_tests.cc",
"intrusive_singly_linked_list_tests.cc",
"intrusive_sized_doubly_linked_list_tests.cc",
"intrusive_sized_singly_linked_list_tests.cc",
"intrusive_wavl_tree_tests.cc",
"macro_tests.cc",
"no_destructor_tests.cc",
"recycler_tests.cc",
"ref_ptr_tests.cc",
"static_vector_tests.cc",
"string_buffer_tests.cc",
"string_printf_tests.cc",
"string_tests.cc",
"string_traits_tests.cc",
"strong_int_tests.cc",
"type_info_tests.cc",
"unaligned_tests.cc",
"unique_fd_tests.cc",
"vector_tests.cc",
"wavl_tree_best_node_observer_tests.cc",
]
deps = [
"//sdk/lib/stdcompat",
"//zircon/system/ulib/fbl",
"//zircon/system/ulib/zxtest",
]
if (!is_fuchsia) {
defines = [ "FBL_TEST_ENABLE_WAVL_TREE_BALANCE_TEST=1" ]
}
if (is_fuchsia) {
# These tests won't run on the host. There are two primary reasons for this.
#
# First, Some of these tests (ref_counted_upgradeable and
# slab_allocator) need fbl::Mutex which currently isn't supported on
# the host.
#
# Second, some of these tests make use of the ASSERT_DEATH macro to
# ensure that certain actions result in program termination. Again,
# this is not currently supported in the host test environment.
#
# See: TODO(https://fxbug.dev/42105920)
sources += [
"alloc_checker_tests.cc",
"condition_variable_tests.cc",
"ref_counted_tests.cc",
"ref_counted_upgradeable_tests.cc",
"ring_buffer_tests.cc",
"slab_allocator_tests.cc",
]
deps += [
"//sdk/lib/fdio",
"//zircon/system/ulib/zx",
]
}
_is_lto = select_variant + [ "lto" ] - [ "lto" ] != select_variant
if (_is_lto || is_coverage) {
# LTO OOMs on RBE workers
# coverage mode timeout on RBE
configs += [ "//build/config:no_remote_link" ]
}
}
# These tests test compatibility with GMock. As such, they must use the GTest
# runner instead of zxtest.
test("fbl-gmock-test") {
output_name = "fbl-gmock-test"
include_dirs = [ "include" ]
sources = [ "ref_ptr_gmock_tests.cc" ]
deps = [
"//src/lib/fxl/test:gtest_main",
"//third_party/googletest:gmock",
"//third_party/googletest:gtest",
"//zircon/system/ulib/fbl",
]
}
fuchsia_unittest_package("fbl-test-pkg") {
package_name = "fbl-test"
manifest = "meta/fbl-test.cml"
deps = [ ":fbl" ]
}