1# Copyright 2023 The Pigweed Authors 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); you may not 4# use this file except in compliance with the License. You may obtain a copy of 5# the License at 6# 7# https://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12# License for the specific language governing permissions and limitations under 13# the License. 14 15import("//build_overrides/pigweed.gni") 16import("$dir_pw_fuzzer/fuzzer.gni") 17import("$dir_pw_unit_test/test.gni") 18 19config("public_include_path") { 20 include_dirs = [ "public" ] 21} 22 23pw_source_set("definitions") { 24 sources = [ "gap.cc" ] 25 public = [ "public/pw_bluetooth_sapphire/internal/host/gap/gap.h" ] 26 public_configs = [ ":public_include_path" ] 27 public_deps = [ 28 "$dir_pw_bluetooth_sapphire/host/common", 29 "$dir_pw_bluetooth_sapphire/host/sm:definitions", 30 "$dir_pw_third_party/fuchsia:fit", 31 ] 32} 33 34pw_source_set("peer") { 35 public = [ 36 "public/pw_bluetooth_sapphire/internal/host/gap/peer.h", 37 "public/pw_bluetooth_sapphire/internal/host/gap/peer_metrics.h", 38 ] 39 sources = [ 40 "peer.cc", 41 "peer_metrics.cc", 42 ] 43 public_configs = [ ":public_include_path" ] 44 public_deps = [ 45 ":definitions", 46 "$dir_pw_bluetooth_sapphire/host/common", 47 "$dir_pw_bluetooth_sapphire/host/gatt:persisted_data", 48 "$dir_pw_bluetooth_sapphire/host/hci-spec", 49 "$dir_pw_bluetooth_sapphire/host/sm:definitions", 50 ] 51 deps = [ 52 "$dir_pw_bluetooth_sapphire/lib/cpp-string", 53 "$dir_pw_string:utf_codecs", 54 dir_pw_bytes, 55 ] 56} 57 58pw_source_set("gap") { 59 sources = [ 60 "adapter.cc", 61 "android_vendor_capabilities.cc", 62 "bredr_connection.cc", 63 "bredr_connection_manager.cc", 64 "bredr_connection_request.cc", 65 "bredr_discovery_manager.cc", 66 "bredr_interrogator.cc", 67 "generic_access_client.cc", 68 "identity_resolving_list.cc", 69 "legacy_pairing_state.cc", 70 "low_energy_address_manager.cc", 71 "low_energy_advertising_manager.cc", 72 "low_energy_connection.cc", 73 "low_energy_connection_handle.cc", 74 "low_energy_connection_manager.cc", 75 "low_energy_connection_request.cc", 76 "low_energy_connector.cc", 77 "low_energy_discovery_manager.cc", 78 "low_energy_interrogator.cc", 79 "pairing_state_manager.cc", 80 "peer_cache.cc", 81 "secure_simple_pairing_state.cc", 82 "types.cc", 83 ] 84 public = [ 85 "public/pw_bluetooth_sapphire/internal/host/gap/adapter.h", 86 "public/pw_bluetooth_sapphire/internal/host/gap/adapter_state.h", 87 "public/pw_bluetooth_sapphire/internal/host/gap/android_vendor_capabilities.h", 88 "public/pw_bluetooth_sapphire/internal/host/gap/bonding_data.h", 89 "public/pw_bluetooth_sapphire/internal/host/gap/bredr_connection.h", 90 "public/pw_bluetooth_sapphire/internal/host/gap/bredr_connection_manager.h", 91 "public/pw_bluetooth_sapphire/internal/host/gap/bredr_connection_request.h", 92 "public/pw_bluetooth_sapphire/internal/host/gap/bredr_discovery_manager.h", 93 "public/pw_bluetooth_sapphire/internal/host/gap/bredr_interrogator.h", 94 "public/pw_bluetooth_sapphire/internal/host/gap/event_masks.h", 95 "public/pw_bluetooth_sapphire/internal/host/gap/generic_access_client.h", 96 "public/pw_bluetooth_sapphire/internal/host/gap/identity_resolving_list.h", 97 "public/pw_bluetooth_sapphire/internal/host/gap/legacy_pairing_state.h", 98 "public/pw_bluetooth_sapphire/internal/host/gap/low_energy_address_manager.h", 99 "public/pw_bluetooth_sapphire/internal/host/gap/low_energy_advertising_manager.h", 100 "public/pw_bluetooth_sapphire/internal/host/gap/low_energy_connection.h", 101 "public/pw_bluetooth_sapphire/internal/host/gap/low_energy_connection_handle.h", 102 "public/pw_bluetooth_sapphire/internal/host/gap/low_energy_connection_manager.h", 103 "public/pw_bluetooth_sapphire/internal/host/gap/low_energy_connection_request.h", 104 "public/pw_bluetooth_sapphire/internal/host/gap/low_energy_connector.h", 105 "public/pw_bluetooth_sapphire/internal/host/gap/low_energy_discovery_manager.h", 106 "public/pw_bluetooth_sapphire/internal/host/gap/low_energy_interrogator.h", 107 "public/pw_bluetooth_sapphire/internal/host/gap/low_energy_state.h", 108 "public/pw_bluetooth_sapphire/internal/host/gap/pairing_delegate.h", 109 "public/pw_bluetooth_sapphire/internal/host/gap/pairing_state_manager.h", 110 "public/pw_bluetooth_sapphire/internal/host/gap/peer_cache.h", 111 "public/pw_bluetooth_sapphire/internal/host/gap/secure_simple_pairing_state.h", 112 "public/pw_bluetooth_sapphire/internal/host/gap/types.h", 113 ] 114 public_configs = [ ":public_include_path" ] 115 public_deps = [ 116 ":definitions", 117 ":peer", 118 "$dir_pw_async:heap_dispatcher", 119 "$dir_pw_bluetooth", 120 "$dir_pw_bluetooth_sapphire/host/common", 121 "$dir_pw_bluetooth_sapphire/host/gatt", 122 "$dir_pw_bluetooth_sapphire/host/hci", 123 "$dir_pw_bluetooth_sapphire/host/iso", 124 "$dir_pw_bluetooth_sapphire/host/l2cap", 125 "$dir_pw_bluetooth_sapphire/host/sco", 126 "$dir_pw_bluetooth_sapphire/host/sdp", 127 "$dir_pw_bluetooth_sapphire/host/sm", 128 "$dir_pw_bluetooth_sapphire/host/sm:definitions", 129 "$dir_pw_string:utf_codecs", 130 "$dir_pw_third_party/fuchsia:fit", 131 ] 132 deps = [ 133 "$dir_pw_bluetooth_sapphire/host/sm", 134 "$dir_pw_preprocessor", 135 ] 136} 137 138pw_source_set("testing") { 139 testonly = pw_unit_test_TESTONLY 140 public = [ 141 "public/pw_bluetooth_sapphire/internal/host/gap/fake_adapter.h", 142 "public/pw_bluetooth_sapphire/internal/host/gap/fake_pairing_delegate.h", 143 ] 144 sources = [ 145 "fake_adapter.cc", 146 "fake_pairing_delegate.cc", 147 ] 148 public_deps = [ 149 ":gap", 150 "$dir_pw_bluetooth_sapphire/host/hci:testing", 151 "$dir_pw_bluetooth_sapphire/host/l2cap:testing", 152 dir_pw_unit_test, 153 ] 154 public_configs = [ ":public_include_path" ] 155} 156 157pw_test("gap_test") { 158 enable_if = pw_unit_test_BACKEND == "$dir_pw_unit_test:googletest" 159 sources = [ 160 "adapter_test.cc", 161 "android_vendor_capabilities_test.cc", 162 "bredr_connection_manager_test.cc", 163 "bredr_connection_request_test.cc", 164 "bredr_discovery_manager_test.cc", 165 "bredr_interrogator_test.cc", 166 "fake_pairing_delegate_test.cc", 167 "identity_resolving_list_test.cc", 168 "legacy_pairing_state_test.cc", 169 "low_energy_address_manager_test.cc", 170 "low_energy_advertising_manager_test.cc", 171 "low_energy_connection_manager_test.cc", 172 "low_energy_discovery_manager_test.cc", 173 "low_energy_interrogator_test.cc", 174 "peer_cache_test.cc", 175 "peer_test.cc", 176 "secure_simple_pairing_state_test.cc", 177 "types_test.cc", 178 ] 179 deps = [ 180 ":gap", 181 ":testing", 182 "$dir_pw_bluetooth_sapphire/host/common", 183 "$dir_pw_bluetooth_sapphire/host/gatt:testing", 184 "$dir_pw_bluetooth_sapphire/host/hci:testing", 185 "$dir_pw_bluetooth_sapphire/host/l2cap:testing", 186 "$dir_pw_bluetooth_sapphire/host/sm", 187 "$dir_pw_bluetooth_sapphire/host/sm:testing", 188 "$dir_pw_bluetooth_sapphire/host/testing", 189 "$dir_pw_bluetooth_sapphire/host/testing:fake_controller", 190 "$dir_pw_bluetooth_sapphire/host/testing:mock_controller", 191 "$dir_pw_bluetooth_sapphire/host/testing:test_helpers", 192 "$dir_pw_bluetooth_sapphire/host/transport:testing", 193 ] 194 test_main = "$dir_pw_bluetooth_sapphire/host/testing:gtest_main" 195} 196 197pw_fuzzer("peer_cache_fuzzer") { 198 sources = [ "peer_cache_fuzztest.cc" ] 199 deps = [ 200 ":gap", 201 "$dir_pw_async:fake_dispatcher", 202 "$dir_pw_bluetooth_sapphire/host/testing:fuzzing", 203 "$dir_pw_random:fuzzer_generator", 204 ] 205} 206 207pw_test_group("tests") { 208 tests = [ 209 ":gap_test", 210 ":peer_cache_fuzzer_test", 211 ] 212} 213