blob: ddaf9c3cef1aeb1a1b03de8961f3b1ecd0b1a511 [file] [log] [blame]
# Copyright 2023 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
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 = 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",
"$dir_pw_bluetooth_sapphire/host/transport",
"$dir_pw_bluetooth_sapphire/host/transport:testing",
]
if (current_os == "fuchsia") {
public_deps += [ "//sdk/lib/inspect/testing/cpp" ]
}
public_configs = [ "$dir_pw_bluetooth_sapphire:public_include_path" ]
}
# test_helpers is separate from :testing to fix dependency cycles.
pw_source_set("test_helpers") {
testonly = pw_unit_test_TESTONLY
public = [ "$dir_public_testing/test_helpers.h" ]
deps = [ "$dir_pw_bluetooth_sapphire/lib/cpp-string" ]
public_deps = [
"$dir_pw_bluetooth_sapphire/host/common",
"$dir_pw_unit_test",
]
public_configs = [ "$dir_pw_bluetooth_sapphire:public_include_path" ]
}
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",
"$dir_pw_bluetooth_sapphire/host/l2cap:testing",
]
test_main = "$dir_pw_bluetooth_sapphire/host/testing:gtest_main"
}
pw_source_set("controller_test_double_base") {
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_bluetooth_sapphire/host/common",
"$dir_pw_bluetooth_sapphire/host/hci",
"$dir_pw_third_party/fuchsia:fit",
]
}
pw_source_set("mock_controller") {
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_bluetooth_sapphire/host/transport",
"$dir_pw_bluetooth_sapphire/host/transport:testing",
"$dir_pw_unit_test",
]
}
# Target that includes Fake HCI emulation support. This should NOT depend on
# gtest.
pw_source_set("fake_controller") {
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_bluetooth_sapphire/host/att:definitions",
"$dir_pw_bluetooth_sapphire/host/common",
"$dir_pw_bluetooth_sapphire/host/gap",
"$dir_pw_bluetooth_sapphire/host/gatt:definitions",
"$dir_pw_bluetooth_sapphire/host/hci",
"$dir_pw_bluetooth_sapphire/host/l2cap:definitions",
"$dir_pw_bluetooth_sapphire/host/l2cap:testing",
"$dir_pw_bluetooth_sapphire/host/sdp",
"$dir_pw_third_party/fuchsia:fit",
]
}
# Main entry point for host library unittests.
pw_source_set("gtest_main") {
testonly = pw_unit_test_TESTONLY
sources = [ "run_all_unittests.cc" ]
deps = [
":testing",
"$dir_pw_bluetooth_sapphire/host/common",
]
public_deps = [ "$dir_pw_unit_test" ]
}
pw_source_set("fuzzing") {
public = [ "$dir_public_testing/peer_fuzzer.h" ]
deps = [ "$dir_pw_bluetooth_sapphire/host/gap" ]
}
source_set("fuzztest_driver") {
sources = [ "fuzztest_driver.cc" ]
deps = [
"$dir_pw_bluetooth_sapphire/host/common",
"//third_party/pigweed/backends/pw_log:printf",
]
}