1# Copyright 2020 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( 16 "//pw_build:pigweed.bzl", 17 "pw_cc_test", 18) 19 20package(default_visibility = ["//visibility:public"]) 21 22licenses(["notice"]) 23 24cc_library( 25 name = "server_api", 26 srcs = [ 27 "method.cc", 28 ], 29 hdrs = [ 30 "public/pw_rpc/raw/internal/method.h", 31 "public/pw_rpc/raw/internal/method_union.h", 32 "public/pw_rpc/raw/server_reader_writer.h", 33 ], 34 includes = ["public"], 35 deps = [ 36 "//pw_bytes", 37 "//pw_rpc", 38 "//pw_rpc:internal_packet_cc.pwpb", 39 "//pw_status", 40 ], 41) 42 43cc_library( 44 name = "client_api", 45 hdrs = ["public/pw_rpc/raw/client_reader_writer.h"], 46 includes = ["public"], 47 deps = [ 48 "//pw_bytes", 49 "//pw_rpc", 50 "//pw_rpc:internal_packet_cc.pwpb", 51 ], 52) 53 54cc_library( 55 name = "fake_channel_output", 56 hdrs = ["public/pw_rpc/raw/fake_channel_output.h"], 57 includes = ["public"], 58 deps = [ 59 ":server_api", 60 "//pw_assert", 61 "//pw_containers", 62 ], 63) 64 65cc_library( 66 name = "test_method_context", 67 hdrs = ["public/pw_rpc/raw/test_method_context.h"], 68 includes = ["public"], 69 deps = [ 70 ":fake_channel_output", 71 ":server_api", 72 "//pw_assert", 73 "//pw_containers:vector", 74 "//pw_preprocessor", 75 "//pw_rpc", 76 "//pw_rpc:internal_test_utils", 77 ], 78) 79 80cc_library( 81 name = "client_testing", 82 srcs = ["client_testing.cc"], 83 hdrs = ["public/pw_rpc/raw/client_testing.h"], 84 deps = [ 85 ":test_method_context", 86 "//pw_assert", 87 "//pw_bytes", 88 "//pw_log", 89 "//pw_rpc", 90 ], 91) 92 93pw_cc_test( 94 name = "client_test", 95 srcs = [ 96 "client_test.cc", 97 ], 98 deps = [ 99 ":client_api", 100 ":client_testing", 101 "//pw_rpc:internal_test_utils", 102 ], 103) 104 105pw_cc_test( 106 name = "client_reader_writer_test", 107 srcs = ["client_reader_writer_test.cc"], 108 deps = [ 109 ":client_api", 110 ":client_testing", 111 "//pw_rpc:pw_rpc_test_cc.raw_rpc", 112 ], 113) 114 115pw_cc_test( 116 name = "codegen_test", 117 srcs = [ 118 "codegen_test.cc", 119 ], 120 deps = [ 121 ":client_api", 122 ":client_testing", 123 ":server_api", 124 ":test_method_context", 125 "//pw_protobuf", 126 "//pw_rpc:internal_test_utils", 127 "//pw_rpc:pw_rpc_test_cc.pwpb", 128 "//pw_rpc:pw_rpc_test_cc.raw_rpc", 129 ], 130) 131 132pw_cc_test( 133 name = "method_test", 134 srcs = [ 135 "method_test.cc", 136 ], 137 deps = [ 138 ":server_api", 139 "//pw_containers", 140 "//pw_protobuf", 141 "//pw_rpc:internal_test_utils", 142 "//pw_rpc:pw_rpc_test_cc.pwpb", 143 ], 144) 145 146pw_cc_test( 147 name = "method_info_test", 148 srcs = [ 149 "method_info_test.cc", 150 ], 151 deps = [ 152 "//pw_rpc:internal_test_utils", 153 "//pw_rpc:pw_rpc_test_cc.raw_rpc", 154 ], 155) 156 157pw_cc_test( 158 name = "method_union_test", 159 srcs = [ 160 "method_union_test.cc", 161 ], 162 deps = [ 163 ":server_api", 164 "//pw_protobuf", 165 "//pw_rpc:internal_test_utils", 166 "//pw_rpc:pw_rpc_test_cc.pwpb", 167 ], 168) 169 170pw_cc_test( 171 name = "server_reader_writer_test", 172 srcs = ["server_reader_writer_test.cc"], 173 deps = [ 174 ":test_method_context", 175 "//pw_rpc:internal_test_utils", 176 "//pw_rpc:pw_rpc_test_cc.pwpb", 177 "//pw_rpc:pw_rpc_test_cc.raw_rpc", 178 ], 179) 180 181# Negative compilation testing is not supported by Bazel. Build this as a 182# regular unit for now test. 183pw_cc_test( 184 name = "service_nc_test", 185 srcs = ["service_nc_test.cc"], 186 deps = ["//pw_rpc:pw_rpc_test_cc.raw_rpc"], 187) 188 189pw_cc_test( 190 name = "stub_generation_test", 191 srcs = ["stub_generation_test.cc"], 192 deps = [ 193 "//pw_rpc:pw_rpc_test_cc.pwpb", 194 "//pw_rpc:pw_rpc_test_cc.raw_rpc", 195 ], 196) 197 198pw_cc_test( 199 name = "synchronous_call_test", 200 srcs = ["synchronous_call_test.cc"], 201 deps = [ 202 ":test_method_context", 203 "//pw_rpc:pw_rpc_test_cc.raw_rpc", 204 "//pw_rpc:synchronous_client_api", 205 "//pw_work_queue", 206 "//pw_work_queue:stl_test_thread", 207 "//pw_work_queue:test_thread_header", 208 ], 209) 210