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