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_sdp = "../../public/pw_bluetooth_sapphire/internal/host/sdp" 20 21# Basic target with protocol definitions and no logic, suitable for test 22# emulation. 23pw_source_set("definitions") { 24 public = [ 25 "$dir_public_sdp/data_element.h", 26 "$dir_public_sdp/error.h", 27 "$dir_public_sdp/sdp.h", 28 "$dir_public_sdp/service_record.h", 29 ] 30 31 sources = [ 32 "data_element.cc", 33 "error.cc", 34 "service_record.cc", 35 ] 36 37 public_deps = [ "$dir_pw_bluetooth_sapphire/host/common" ] 38} 39 40pw_source_set("sdp") { 41 public = [ 42 "$dir_public_sdp/client.h", 43 "$dir_public_sdp/pdu.h", 44 "$dir_public_sdp/server.h", 45 "$dir_public_sdp/service_discoverer.h", 46 ] 47 48 sources = [ 49 "client.cc", 50 "pdu.cc", 51 "server.cc", 52 "service_discoverer.cc", 53 ] 54 55 public_deps = [ 56 ":definitions", 57 "$dir_pw_bluetooth_sapphire/host/l2cap", 58 "$dir_pw_third_party/fuchsia:stdcompat", 59 ] 60 61 public_configs = [ "$dir_pw_bluetooth_sapphire:public_include_path" ] 62} 63 64pw_test("sdp_tests") { 65 sources = [ 66 "client_test.cc", 67 "data_element_test.cc", 68 "pdu_test.cc", 69 "server_test.cc", 70 "service_discoverer_test.cc", 71 "service_record_test.cc", 72 ] 73 74 deps = [ 75 ":sdp", 76 "$dir_pw_bluetooth_sapphire/host/common", 77 "$dir_pw_bluetooth_sapphire/host/l2cap:testing", 78 "$dir_pw_bluetooth_sapphire/host/testing", 79 ] 80 81 test_main = "$dir_pw_bluetooth_sapphire/host/testing:gtest_main" 82} 83 84pw_fuzzer("data_element_fuzzer") { 85 sources = [ "data_element_fuzztest.cc" ] 86 deps = [ ":definitions" ] 87} 88 89pw_fuzzer("pdu_fuzzer") { 90 sources = [ "pdu_fuzztest.cc" ] 91 deps = [ ":sdp" ] 92} 93 94pw_test_group("tests") { 95 tests = [ 96 ":sdp_tests", 97 ":data_element_fuzzer_test", 98 ":pdu_fuzzer_test", 99 ] 100} 101