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 19dir_public_gap = "../../public/pw_bluetooth_sapphire/internal/host/gap" 20 21pw_source_set("definitions") { 22 public = [ "$dir_public_gap/gap.h" ] 23 sources = [ "gap.cc" ] 24 deps = [ "$dir_pw_bluetooth_sapphire/host/common" ] 25} 26 27pw_source_set("gap") { 28 public = [ 29 "$dir_public_gap/adapter.h", 30 "$dir_public_gap/adapter_state.h", 31 "$dir_public_gap/android_vendor_capabilities.h", 32 "$dir_public_gap/bonding_data.h", 33 "$dir_public_gap/bredr_connection.h", 34 "$dir_public_gap/bredr_connection_manager.h", 35 "$dir_public_gap/bredr_connection_request.h", 36 "$dir_public_gap/bredr_discovery_manager.h", 37 "$dir_public_gap/bredr_interrogator.h", 38 "$dir_public_gap/discovery_filter.h", 39 "$dir_public_gap/event_masks.h", 40 "$dir_public_gap/generic_access_client.h", 41 "$dir_public_gap/identity_resolving_list.h", 42 "$dir_public_gap/legacy_pairing_state.h", 43 "$dir_public_gap/low_energy_address_manager.h", 44 "$dir_public_gap/low_energy_advertising_manager.h", 45 "$dir_public_gap/low_energy_connection.h", 46 "$dir_public_gap/low_energy_connection_handle.h", 47 "$dir_public_gap/low_energy_connection_manager.h", 48 "$dir_public_gap/low_energy_connection_request.h", 49 "$dir_public_gap/low_energy_connector.h", 50 "$dir_public_gap/low_energy_discovery_manager.h", 51 "$dir_public_gap/low_energy_interrogator.h", 52 "$dir_public_gap/low_energy_state.h", 53 "$dir_public_gap/pairing_delegate.h", 54 "$dir_public_gap/pairing_state_manager.h", 55 "$dir_public_gap/peer.h", 56 "$dir_public_gap/peer_cache.h", 57 "$dir_public_gap/peer_metrics.h", 58 "$dir_public_gap/secure_simple_pairing_state.h", 59 "$dir_public_gap/types.h", 60 ] 61 62 sources = [ 63 "adapter.cc", 64 "android_vendor_capabilities.cc", 65 "bredr_connection.cc", 66 "bredr_connection_manager.cc", 67 "bredr_connection_request.cc", 68 "bredr_discovery_manager.cc", 69 "bredr_interrogator.cc", 70 "discovery_filter.cc", 71 "generic_access_client.cc", 72 "identity_resolving_list.cc", 73 "legacy_pairing_state.cc", 74 "low_energy_address_manager.cc", 75 "low_energy_advertising_manager.cc", 76 "low_energy_connection.cc", 77 "low_energy_connection_handle.cc", 78 "low_energy_connection_manager.cc", 79 "low_energy_connection_request.cc", 80 "low_energy_connector.cc", 81 "low_energy_discovery_manager.cc", 82 "low_energy_interrogator.cc", 83 "pairing_state_manager.cc", 84 "peer.cc", 85 "peer_cache.cc", 86 "peer_metrics.cc", 87 "secure_simple_pairing_state.cc", 88 "types.cc", 89 ] 90 91 deps = [ 92 "$dir_pw_bluetooth_sapphire/host/sm", 93 "$dir_pw_preprocessor", 94 ] 95 96 public_deps = [ 97 ":definitions", 98 "$dir_pw_async:heap_dispatcher", 99 "$dir_pw_bluetooth", 100 "$dir_pw_bluetooth_sapphire/host/common", 101 "$dir_pw_bluetooth_sapphire/host/gatt", 102 "$dir_pw_bluetooth_sapphire/host/hci", 103 "$dir_pw_bluetooth_sapphire/host/iso", 104 "$dir_pw_bluetooth_sapphire/host/l2cap", 105 "$dir_pw_bluetooth_sapphire/host/sco", 106 "$dir_pw_bluetooth_sapphire/host/sdp", 107 "$dir_pw_bluetooth_sapphire/host/sm:definitions", 108 "$dir_pw_string:utf_codecs", 109 "$dir_pw_third_party/fuchsia:fit", 110 ] 111 112 public_configs = [ "$dir_pw_bluetooth_sapphire:public_include_path" ] 113} 114 115pw_source_set("testing") { 116 testonly = pw_unit_test_TESTONLY 117 118 public = [ 119 "$dir_public_gap/fake_adapter.h", 120 "$dir_public_gap/fake_pairing_delegate.h", 121 ] 122 123 sources = [ 124 "fake_adapter.cc", 125 "fake_pairing_delegate.cc", 126 ] 127 128 public_deps = [ 129 ":gap", 130 "$dir_pw_bluetooth_sapphire/host/hci:testing", 131 "$dir_pw_bluetooth_sapphire/host/l2cap:testing", 132 "$dir_pw_unit_test", 133 ] 134} 135 136pw_test("gap_tests") { 137 sources = [ 138 "adapter_test.cc", 139 "android_vendor_capabilities_test.cc", 140 "bredr_connection_manager_test.cc", 141 "bredr_connection_request_test.cc", 142 "bredr_discovery_manager_test.cc", 143 "bredr_interrogator_test.cc", 144 "discovery_filter_test.cc", 145 "fake_pairing_delegate_test.cc", 146 "identity_resolving_list_test.cc", 147 "legacy_pairing_state_test.cc", 148 "low_energy_address_manager_test.cc", 149 "low_energy_advertising_manager_test.cc", 150 "low_energy_connection_manager_test.cc", 151 "low_energy_discovery_manager_test.cc", 152 "low_energy_interrogator_test.cc", 153 "peer_cache_test.cc", 154 "peer_test.cc", 155 "secure_simple_pairing_state_test.cc", 156 "types_test.cc", 157 ] 158 159 deps = [ 160 ":gap", 161 ":testing", 162 "$dir_pw_bluetooth_sapphire/host/common", 163 "$dir_pw_bluetooth_sapphire/host/gatt:testing", 164 "$dir_pw_bluetooth_sapphire/host/hci:testing", 165 "$dir_pw_bluetooth_sapphire/host/l2cap:testing", 166 "$dir_pw_bluetooth_sapphire/host/sm", 167 "$dir_pw_bluetooth_sapphire/host/sm:testing", 168 "$dir_pw_bluetooth_sapphire/host/testing", 169 ] 170 171 test_main = "$dir_pw_bluetooth_sapphire/host/testing:gtest_main" 172} 173 174pw_fuzzer("peer_cache_fuzzer") { 175 sources = [ "peer_cache_fuzztest.cc" ] 176 deps = [ 177 ":gap", 178 "$dir_pw_async:fake_dispatcher", 179 "$dir_pw_bluetooth_sapphire/host/testing:fuzzing", 180 "$dir_pw_random:fuzzer_generator", 181 ] 182} 183 184pw_test_group("tests") { 185 tests = [ 186 ":gap_tests", 187 ":peer_cache_fuzzer_test", 188 ] 189} 190