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