| # Copyright 2017 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/bazel/bazel_fuchsia_test_package.gni") |
| import("//build_overrides/pigweed.gni") |
| import("$dir_pw_unit_test/test.gni") |
| |
| dir_public_testing = "../public/pw_bluetooth_sapphire/internal/host/testing" |
| |
| pw_source_set("testing") { |
| testonly = true |
| |
| testonly = pw_unit_test_TESTONLY |
| |
| public = [ |
| "$dir_public_testing/controller_test.h", |
| "$dir_public_testing/inspect.h", |
| "$dir_public_testing/inspect_util.h", |
| "$dir_public_testing/parse_args.h", |
| "$dir_public_testing/test_packets.h", |
| ] |
| |
| sources = [ |
| "inspect_util.cc", |
| "parse_args.cc", |
| "test_packets.cc", |
| ] |
| |
| deps = [ "$dir_pw_unit_test" ] |
| |
| public_deps = [ |
| ":fake_controller", |
| ":mock_controller", |
| ":test_helpers", |
| "//src/connectivity/bluetooth/core/bt-host/transport", |
| "//src/connectivity/bluetooth/core/bt-host/transport:testing", |
| ] |
| |
| if (current_os == "fuchsia") { |
| public_deps += [ "//sdk/lib/inspect/testing/cpp" ] |
| } |
| } |
| |
| # test_helpers is separate from :testing to fix dependency cycles. |
| pw_source_set("test_helpers") { |
| testonly = true |
| |
| testonly = pw_unit_test_TESTONLY |
| |
| public = [ "$dir_public_testing/test_helpers.h" ] |
| |
| deps = [ "//src/connectivity/bluetooth/lib/cpp-string" ] |
| |
| public_deps = [ |
| "$dir_pw_unit_test", |
| "//src/connectivity/bluetooth/core/bt-host/common", |
| ] |
| } |
| |
| pw_test("tests") { |
| sources = [ |
| "fake_controller_test.cc", |
| "fake_dynamic_channel_test.cc", |
| "fake_l2cap_test.cc", |
| "fake_sdp_server_test.cc", |
| "fake_signaling_server_test.cc", |
| "inspect_util_test.cc", |
| "parse_args_test.cc", |
| ] |
| |
| deps = [ |
| ":testing", |
| "//src/connectivity/bluetooth/core/bt-host/l2cap:testing", |
| ] |
| |
| test_main = "//src/connectivity/bluetooth/core/bt-host/testing:gtest_main" |
| } |
| |
| pw_source_set("controller_test_double_base") { |
| testonly = true |
| |
| testonly = pw_unit_test_TESTONLY |
| |
| public = [ "$dir_public_testing/controller_test_double_base.h" ] |
| |
| sources = [ "controller_test_double_base.cc" ] |
| |
| public_deps = [ |
| "$dir_pw_async:heap_dispatcher", |
| "$dir_pw_bluetooth", |
| "$dir_pw_third_party/fuchsia:fit", |
| "//src/connectivity/bluetooth/core/bt-host/common", |
| "//src/connectivity/bluetooth/core/bt-host/hci", |
| ] |
| } |
| |
| pw_source_set("mock_controller") { |
| testonly = true |
| |
| testonly = pw_unit_test_TESTONLY |
| |
| public = [ "$dir_public_testing/mock_controller.h" ] |
| |
| sources = [ "mock_controller.cc" ] |
| |
| public_deps = [ |
| ":controller_test_double_base", |
| ":test_helpers", |
| "$dir_pw_async:heap_dispatcher", |
| "$dir_pw_unit_test", |
| "//src/connectivity/bluetooth/core/bt-host/transport", |
| "//src/connectivity/bluetooth/core/bt-host/transport:testing", |
| ] |
| } |
| |
| # Target that includes Fake HCI emulation support. This should NOT depend on |
| # gtest. |
| pw_source_set("fake_controller") { |
| testonly = true |
| |
| testonly = pw_unit_test_TESTONLY |
| |
| public = [ |
| "$dir_public_testing/fake_controller.h", |
| "$dir_public_testing/fake_dynamic_channel.h", |
| "$dir_public_testing/fake_gatt_server.h", |
| "$dir_public_testing/fake_l2cap.h", |
| "$dir_public_testing/fake_peer.h", |
| "$dir_public_testing/fake_sdp_server.h", |
| "$dir_public_testing/fake_signaling_server.h", |
| ] |
| |
| sources = [ |
| "fake_controller.cc", |
| "fake_dynamic_channel.cc", |
| "fake_gatt_server.cc", |
| "fake_l2cap.cc", |
| "fake_peer.cc", |
| "fake_sdp_server.cc", |
| "fake_signaling_server.cc", |
| ] |
| |
| public_deps = [ |
| ":controller_test_double_base", |
| ":test_helpers", |
| "$dir_pw_bluetooth:emboss_hci_group", |
| "$dir_pw_third_party/fuchsia:fit", |
| "//src/connectivity/bluetooth/core/bt-host/att:definitions", |
| "//src/connectivity/bluetooth/core/bt-host/common", |
| "//src/connectivity/bluetooth/core/bt-host/gap", |
| "//src/connectivity/bluetooth/core/bt-host/gatt:definitions", |
| "//src/connectivity/bluetooth/core/bt-host/hci", |
| "//src/connectivity/bluetooth/core/bt-host/l2cap:definitions", |
| "//src/connectivity/bluetooth/core/bt-host/l2cap:testing", |
| "//src/connectivity/bluetooth/core/bt-host/sdp", |
| ] |
| } |
| |
| # Main entry point for host library unittests. |
| pw_source_set("gtest_main") { |
| testonly = true |
| |
| testonly = pw_unit_test_TESTONLY |
| |
| sources = [ "run_all_unittests.cc" ] |
| |
| deps = [ |
| ":testing", |
| "//src/connectivity/bluetooth/core/bt-host/common", |
| ] |
| |
| public_deps = [ "$dir_pw_unit_test" ] |
| } |
| |
| pw_source_set("fuzzing") { |
| public = [ "$dir_public_testing/peer_fuzzer.h" ] |
| deps = [ "//src/connectivity/bluetooth/core/bt-host/gap" ] |
| } |
| |
| source_set("fuzztest_driver") { |
| sources = [ "fuzztest_driver.cc" ] |
| deps = [ |
| "//src/connectivity/bluetooth/core/bt-host/common", |
| "//third_party/pigweed/backends/pw_log:printf", |
| ] |
| } |
| |
| # TODO(https://fxbug.dev/324105856): Delete after socket and fidl libraries are migrated to Bazel. |
| source_set("loop_fixture") { |
| testonly = true |
| public = [ "$dir_public_testing/loop_fixture.h" ] |
| public_deps = [ |
| "$dir_pw_unit_test", |
| "//zircon/system/ulib/async-testing", |
| ] |
| } |
| |
| bazel_fuchsia_test_package("test_pkg") { |
| test_package_name = "testing_tests" |
| test_component_names = [ "testing_test_autogen_cml" ] |
| } |