| # 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/test.gni") |
| import("//src/sys/build/fuchsia_unittest_package.gni") |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":fbl($host_toolchain)", |
| ":fbl-gmock-test($host_toolchain)", |
| ":fbl-test-pkg", |
| ] |
| } |
| |
| test("fbl") { |
| output_name = "fbl-test" |
| if (is_fuchsia) { |
| configs += [ "//build/unification/config:zircon-migrated" ] |
| } |
| include_dirs = [ "include" ] |
| sources = [ |
| "algorithm_tests.cc", |
| "array_tests.cc", |
| "atomic_ref_tests.cc", |
| "bit_tests.cc", |
| "conditional_select_nospec_tests.cc", |
| "confine_array_index_tests.cc", |
| "enum_bits.cc", |
| "forward_tests.cc", |
| "function_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", |
| "span_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", |
| "unique_fd_tests.cc", |
| "vector_tests.cc", |
| ] |
| |
| deps = [ |
| "//zircon/public/lib/fbl", |
| "//zircon/public/lib/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(fxbug.dev/30996) |
| 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/public/lib/zx", |
| ] |
| } |
| } |
| |
| # Generic main entry point target for GTest executables. |
| source_set("gtest_main") { |
| testonly = true |
| sources = [ "run_all_unittests.cc" ] |
| public_deps = [ "//third_party/googletest:gtest" ] |
| } |
| |
| # 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 = [ |
| ":gtest_main", |
| "//third_party/googletest:gmock", |
| "//third_party/googletest:gtest", |
| "//zircon/public/lib/fbl", |
| ] |
| } |
| |
| fuchsia_unittest_package("fbl-test-pkg") { |
| package_name = "fbl-test" |
| deps = [ ":fbl" ] |
| } |