Home | History | Annotate | Download | only in util
      1 # Copyright 2017 gRPC authors.
      2 #
      3 # Licensed under the Apache License, Version 2.0 (the "License");
      4 # you may not use this file except in compliance with the License.
      5 # You may obtain a copy of the License at
      6 #
      7 #     http://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,
     11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     12 # See the License for the specific language governing permissions and
     13 # limitations under the License.
     14 
     15 licenses(["notice"])  # Apache v2
     16 
     17 load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_binary", "grpc_cc_test", "grpc_package")
     18 
     19 grpc_package(
     20     name = "test/cpp/util",
     21     visibility = "public",
     22 )
     23 
     24 grpc_cc_library(
     25     name = "test_config",
     26     srcs = [
     27         "test_config_cc.cc",
     28     ],
     29     hdrs = [
     30         "test_config.h",
     31     ],
     32     external_deps = [
     33         "gflags",
     34     ],
     35     deps = [
     36         "//:gpr",
     37     ],
     38 )
     39 
     40 grpc_cc_library(
     41     name = "grpc++_proto_reflection_desc_db",
     42     srcs = [
     43         "proto_reflection_descriptor_database.cc",
     44     ],
     45     hdrs = [
     46         "proto_reflection_descriptor_database.h",
     47     ],
     48     deps = [
     49         "//:grpc++",
     50         "//:grpc++_config_proto",
     51         "//src/proto/grpc/reflection/v1alpha:reflection_proto",
     52     ],
     53 )
     54 
     55 GRPCXX_TESTUTIL_SRCS = [
     56     "byte_buffer_proto_helper.cc",
     57     "string_ref_helper.cc",
     58     "subprocess.cc",
     59 ]
     60 
     61 GRPCXX_TESTUTIL_HDRS = [
     62     "byte_buffer_proto_helper.h",
     63     "string_ref_helper.h",
     64     "subprocess.h",
     65 ]
     66 
     67 grpc_cc_library(
     68     name = "test_util",
     69     srcs = GRPCXX_TESTUTIL_SRCS + [
     70         "create_test_channel.cc",
     71         "test_credentials_provider.cc",
     72     ],
     73     hdrs = GRPCXX_TESTUTIL_HDRS + [
     74         "create_test_channel.h",
     75         "test_credentials_provider.h",
     76     ],
     77     external_deps = [
     78         "protobuf",
     79     ],
     80     deps = [
     81         "//:grpc++",
     82         "//test/core/end2end:ssl_test_data",
     83         "//test/core/util:grpc_test_util",
     84     ],
     85 )
     86 
     87 grpc_cc_library(
     88     name = "channel_trace_proto_helper",
     89     testonly = 1,
     90     srcs = [
     91         "channel_trace_proto_helper.cc",
     92     ],
     93     hdrs = [
     94         "channel_trace_proto_helper.h",
     95     ],
     96     deps = [
     97         "//:grpc++",
     98         "//src/proto/grpc/channelz:channelz_proto",
     99     ],
    100     external_deps = [
    101         "gtest",
    102         "protobuf",
    103     ],
    104 )
    105 
    106 grpc_cc_library(
    107     name = "test_util_unsecure",
    108     srcs = GRPCXX_TESTUTIL_SRCS,
    109     hdrs = GRPCXX_TESTUTIL_HDRS,
    110     external_deps = [
    111         "protobuf",
    112     ],
    113     deps = [
    114         "//:grpc++_unsecure",
    115         "//test/core/util:grpc_test_util_unsecure",
    116     ],
    117 )
    118 
    119 grpc_cc_library(
    120     name = "grpc_cli_libs",
    121     srcs = [
    122         "cli_call.cc",
    123         "cli_credentials.cc",
    124         "grpc_tool.cc",
    125         "proto_file_parser.cc",
    126         "service_describer.cc",
    127     ],
    128     hdrs = [
    129         "cli_call.h",
    130         "cli_credentials.h",
    131         "config_grpc_cli.h",
    132         "grpc_tool.h",
    133         "proto_file_parser.h",
    134         "service_describer.h",
    135     ],
    136     external_deps = [
    137         "gflags",
    138         "protobuf",
    139         "protobuf_clib",
    140     ],
    141     deps = [
    142         ":grpc++_proto_reflection_desc_db",
    143         "//:grpc++",
    144         "//src/proto/grpc/reflection/v1alpha:reflection_proto",
    145     ],
    146 )
    147 
    148 grpc_cc_library(
    149     name = "metrics_server_lib",
    150     srcs = [
    151         "metrics_server.cc",
    152     ],
    153     hdrs = [
    154         "metrics_server.h",
    155     ],
    156     deps = [
    157         "//:grpc++",
    158         "//src/proto/grpc/testing:metrics_proto",
    159     ],
    160 )
    161 
    162 grpc_cc_test(
    163     name = "grpc_tool_test",
    164     srcs = [
    165         "grpc_tool_test.cc",
    166     ],
    167     data = [
    168         "//src/proto/grpc/testing:echo.proto",
    169         "//src/proto/grpc/testing:echo_messages.proto",
    170     ],
    171     external_deps = [
    172         "gtest",
    173     ],
    174     deps = [
    175         ":grpc_cli_libs",
    176         ":test_util",
    177         "//:grpc++_reflection",
    178         "//src/proto/grpc/testing:echo_messages_proto",
    179         "//src/proto/grpc/testing:echo_proto",
    180         "//test/core/end2end:ssl_test_data",
    181         "//test/core/util:grpc_test_util",
    182     ],
    183 )
    184 
    185 grpc_cc_test(
    186     name = "byte_buffer_test",
    187     srcs = [
    188         "byte_buffer_test.cc",
    189     ],
    190     external_deps = [
    191         "gtest",
    192     ],
    193     deps = [
    194         ":test_util",
    195     ],
    196 )
    197 
    198 grpc_cc_test(
    199     name = "slice_test",
    200     srcs = [
    201         "slice_test.cc",
    202     ],
    203     external_deps = [
    204         "gtest",
    205     ],
    206     deps = [
    207         ":test_util",
    208     ],
    209 )
    210 
    211 grpc_cc_test(
    212     name = "string_ref_test",
    213     srcs = [
    214         "string_ref_test.cc",
    215     ],
    216     external_deps = [
    217         "gtest",
    218     ],
    219     deps = [
    220         "//:grpc++",
    221         "//test/core/util:gpr_test_util",
    222     ],
    223 )
    224 
    225 grpc_cc_test(
    226     name = "time_test",
    227     srcs = [
    228         "time_test.cc",
    229     ],
    230     external_deps = [
    231         "gtest",
    232     ],
    233     deps = [
    234         ":test_util",
    235     ],
    236 )
    237 
    238 grpc_cc_test(
    239     name = "cli_call_test",
    240     srcs = [
    241         "cli_call_test.cc",
    242     ],
    243     external_deps = [
    244         "gtest",
    245     ],
    246     deps = [
    247         ":grpc_cli_libs",
    248         ":test_util",
    249         "//src/proto/grpc/testing:echo_proto",
    250         "//test/core/util:grpc_test_util",
    251     ],
    252 )
    253 
    254 grpc_cc_test(
    255     name = "error_details_test",
    256     srcs = [
    257         "error_details_test.cc",
    258     ],
    259     external_deps = [
    260         "gtest",
    261     ],
    262     deps = [
    263         "//:grpc++_error_details",
    264         "//src/proto/grpc/testing:echo_messages_proto",
    265         "//test/core/util:gpr_test_util",
    266     ],
    267 )
    268 
    269 grpc_cc_binary(
    270     name = "grpc_cli",
    271     srcs = [
    272         "grpc_cli.cc",
    273     ],
    274     external_deps = [
    275         "gflags",
    276     ],
    277     deps = [
    278         ":grpc_cli_libs",
    279         ":grpc++_proto_reflection_desc_db",
    280         ":test_config",
    281         "//:grpc++",
    282         "//src/proto/grpc/reflection/v1alpha:reflection_proto",
    283     ],
    284 )
    285