1# Copyright 2022 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 15load("//pw_build:compatibility.bzl", "incompatible_with_mcu") 16load("//pw_unit_test:pw_cc_test.bzl", "pw_cc_test") 17 18package(default_visibility = ["//visibility:public"]) 19 20licenses(["notice"]) 21 22cc_library( 23 name = "server_api", 24 srcs = [ 25 "server_reader_writer.cc", 26 ], 27 hdrs = [ 28 "public/pw_rpc/pwpb/internal/method.h", 29 "public/pw_rpc/pwpb/internal/method_union.h", 30 "public/pw_rpc/pwpb/server_reader_writer.h", 31 ], 32 strip_include_prefix = "public", 33 deps = [ 34 ":common", 35 "//pw_rpc/raw:server_api", 36 ], 37) 38 39cc_library( 40 name = "client_api", 41 hdrs = [ 42 "public/pw_rpc/pwpb/client_reader_writer.h", 43 ], 44 strip_include_prefix = "public", 45 deps = [ 46 ":common", 47 ], 48) 49 50cc_library( 51 name = "common", 52 hdrs = [ 53 "public/pw_rpc/pwpb/internal/common.h", 54 "public/pw_rpc/pwpb/serde.h", 55 "public/pw_rpc/pwpb/server_reader_writer.h", 56 ], 57 strip_include_prefix = "public", 58 deps = [ 59 "//pw_rpc", 60 ], 61) 62 63cc_library( 64 name = "test_method_context", 65 hdrs = [ 66 "public/pw_rpc/pwpb/fake_channel_output.h", 67 "public/pw_rpc/pwpb/test_method_context.h", 68 ], 69 strip_include_prefix = "public", 70 deps = [ 71 ":common", 72 ":server_api", 73 "//pw_assert", 74 "//pw_containers", 75 "//pw_rpc:internal_test_utils", 76 "//pw_span", 77 ], 78) 79 80cc_library( 81 name = "client_testing", 82 hdrs = [ 83 "public/pw_rpc/pwpb/client_testing.h", 84 ], 85 strip_include_prefix = "public", 86 deps = [ 87 ":test_method_context", 88 "//pw_rpc", 89 "//pw_rpc/raw:client_testing", 90 ], 91) 92 93cc_library( 94 name = "client_server_testing", 95 hdrs = [ 96 "public/pw_rpc/pwpb/client_server_testing.h", 97 ], 98 strip_include_prefix = "public", 99 deps = [ 100 ":test_method_context", 101 "//pw_assert", 102 "//pw_rpc:client_server_testing", 103 ], 104) 105 106cc_library( 107 name = "client_server_testing_threaded", 108 hdrs = [ 109 "public/pw_rpc/pwpb/client_server_testing_threaded.h", 110 ], 111 strip_include_prefix = "public", 112 deps = [ 113 ":test_method_context", 114 "//pw_rpc:client_server_testing_threaded", 115 ], 116) 117 118cc_library( 119 name = "internal_test_utils", 120 hdrs = ["pw_rpc_pwpb_private/internal_test_utils.h"], 121 deps = ["//pw_rpc:internal_test_utils"], 122) 123 124cc_library( 125 name = "echo_service", 126 hdrs = ["public/pw_rpc/echo_service_pwpb.h"], 127 strip_include_prefix = "public", 128 deps = [ 129 "//pw_rpc:echo_pwpb_rpc", 130 ], 131) 132 133# TODO: b/242059613 - Enable this library when logging_event_handler can be used. 134filegroup( 135 name = "client_integration_test", 136 srcs = [ 137 "client_integration_test.cc", 138 ], 139 #deps = [ 140 # "//pw_rpc:integration_testing", 141 # "//pw_sync:binary_semaphore", 142 # "//pw_rpc:benchmark_pwpb_rpc", 143 #] 144) 145 146pw_cc_test( 147 name = "client_call_test", 148 srcs = [ 149 "client_call_test.cc", 150 ], 151 deps = [ 152 ":client_api", 153 ":internal_test_utils", 154 "//pw_rpc", 155 "//pw_rpc:pw_rpc_test_pwpb", 156 ], 157) 158 159pw_cc_test( 160 name = "client_reader_writer_test", 161 srcs = [ 162 "client_reader_writer_test.cc", 163 ], 164 deps = [ 165 ":client_api", 166 ":client_testing", 167 "//pw_rpc:pw_rpc_test_pwpb_rpc", 168 ], 169) 170 171pw_cc_test( 172 name = "client_server_context_test", 173 srcs = [ 174 "client_server_context_test.cc", 175 ], 176 deps = [ 177 ":client_api", 178 ":client_server_testing", 179 "//pw_rpc:pw_rpc_test_pwpb_rpc", 180 "//pw_sync:mutex", 181 ], 182) 183 184pw_cc_test( 185 name = "client_server_context_threaded_test", 186 srcs = [ 187 "client_server_context_threaded_test.cc", 188 ], 189 target_compatible_with = incompatible_with_mcu(), 190 deps = [ 191 ":client_api", 192 ":client_server_testing_threaded", 193 "//pw_rpc:pw_rpc_test_pwpb_rpc", 194 "//pw_sync:binary_semaphore", 195 "//pw_sync:mutex", 196 "//pw_thread:non_portable_test_thread_options", 197 "//pw_thread_stl:non_portable_test_thread_options", 198 ], 199) 200 201pw_cc_test( 202 name = "codegen_test", 203 srcs = [ 204 "codegen_test.cc", 205 ], 206 deps = [ 207 ":internal_test_utils", 208 ":test_method_context", 209 "//pw_preprocessor", 210 "//pw_rpc:internal_test_utils", 211 "//pw_rpc:pw_rpc_test_pwpb_rpc", 212 ], 213) 214 215pw_cc_test( 216 name = "fake_channel_output_test", 217 srcs = ["fake_channel_output_test.cc"], 218 deps = [ 219 ":common", 220 ":server_api", 221 ":test_method_context", 222 "//pw_rpc:internal_test_utils", 223 "//pw_rpc:pw_rpc_test_pwpb_rpc", 224 ], 225) 226 227pw_cc_test( 228 name = "method_test", 229 srcs = ["method_test.cc"], 230 deps = [ 231 ":internal_test_utils", 232 ":server_api", 233 "//pw_containers", 234 "//pw_rpc", 235 "//pw_rpc:internal_test_utils", 236 "//pw_rpc:pw_rpc_test_pwpb_rpc", 237 ], 238) 239 240pw_cc_test( 241 name = "method_info_test", 242 srcs = ["method_info_test.cc"], 243 deps = [ 244 "//pw_rpc", 245 "//pw_rpc:internal_test_utils", 246 "//pw_rpc:pw_rpc_test_pwpb_rpc", 247 ], 248) 249 250pw_cc_test( 251 name = "method_lookup_test", 252 srcs = ["method_lookup_test.cc"], 253 deps = [ 254 ":test_method_context", 255 "//pw_rpc:pw_rpc_test_pwpb_rpc", 256 "//pw_rpc/raw:test_method_context", 257 ], 258) 259 260pw_cc_test( 261 name = "method_union_test", 262 srcs = ["method_union_test.cc"], 263 deps = [ 264 ":internal_test_utils", 265 ":server_api", 266 "//pw_rpc:internal_test_utils", 267 "//pw_rpc:pw_rpc_test_pwpb", 268 ], 269) 270 271pw_cc_test( 272 name = "echo_service_test", 273 srcs = ["echo_service_test.cc"], 274 deps = [ 275 ":echo_service", 276 ":test_method_context", 277 ], 278) 279 280pw_cc_test( 281 name = "server_reader_writer_test", 282 srcs = ["server_reader_writer_test.cc"], 283 deps = [ 284 ":server_api", 285 ":test_method_context", 286 "//pw_rpc", 287 "//pw_rpc:pw_rpc_test_pwpb_rpc", 288 ], 289) 290 291pw_cc_test( 292 name = "serde_test", 293 srcs = ["serde_test.cc"], 294 deps = [ 295 ":common", 296 "//pw_rpc:pw_rpc_test_pwpb", 297 ], 298) 299 300pw_cc_test( 301 name = "server_callback_test", 302 srcs = ["server_callback_test.cc"], 303 deps = [ 304 ":test_method_context", 305 "//pw_rpc", 306 "//pw_rpc:pw_rpc_test_pwpb_rpc", 307 ], 308) 309 310pw_cc_test( 311 name = "stub_generation_test", 312 srcs = ["stub_generation_test.cc"], 313 deps = [ 314 "//pw_rpc:pw_rpc_test_pwpb_rpc", 315 ], 316) 317 318pw_cc_test( 319 name = "synchronous_call_test", 320 srcs = ["synchronous_call_test.cc"], 321 deps = [ 322 ":test_method_context", 323 "//pw_rpc:pw_rpc_test_pwpb_rpc", 324 "//pw_rpc:synchronous_client_api", 325 "//pw_rpc_transport:test_loopback_service_registry", 326 "//pw_work_queue", 327 "//pw_work_queue:stl_test_thread", 328 "//pw_work_queue:test_thread_header", 329 ], 330) 331