Imported Upstream version 1.21.0
[platform/upstream/grpc.git] / test / cpp / naming / generate_resolver_component_tests.bzl
1 #!/usr/bin/env python2.7
2 # Copyright 2015 gRPC authors.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_cc_binary")
17
18 def generate_resolver_component_tests():
19   for unsecure_build_config_suffix in ['_unsecure', '']:
20     grpc_cc_test(
21         name = "address_sorting_test%s" % unsecure_build_config_suffix,
22         srcs = [
23             "address_sorting_test.cc",
24         ],
25         external_deps = [
26             "gmock",
27         ],
28         deps = [
29             "//test/cpp/util:test_util%s" % unsecure_build_config_suffix,
30             "//test/core/util:grpc_test_util%s" % unsecure_build_config_suffix,
31             "//:grpc++%s" % unsecure_build_config_suffix,
32             "//:grpc%s" % unsecure_build_config_suffix,
33             "//:gpr",
34             "//test/cpp/util:test_config",
35         ],
36         tags = ["no_windows"],
37     )
38     # meant to be invoked only through the top-level shell script driver
39     grpc_cc_binary(
40         name = "resolver_component_test%s" % unsecure_build_config_suffix,
41         testonly = 1,
42         srcs = [
43             "resolver_component_test.cc",
44         ],
45         external_deps = [
46             "gmock",
47         ],
48         deps = [
49             ":dns_test_util",
50             "//test/cpp/util:test_util%s" % unsecure_build_config_suffix,
51             "//test/core/util:grpc_test_util%s" % unsecure_build_config_suffix,
52             "//:grpc++%s" % unsecure_build_config_suffix,
53             "//:grpc%s" % unsecure_build_config_suffix,
54             "//:gpr",
55             "//test/cpp/util:test_config",
56         ],
57         tags = ["no_windows"],
58     )
59     grpc_cc_test(
60         name = "resolver_component_tests_runner_invoker%s" % unsecure_build_config_suffix,
61         srcs = [
62             "resolver_component_tests_runner_invoker.cc",
63         ],
64         deps = [
65             "//test/cpp/util:test_util",
66             "//test/core/util:grpc_test_util",
67             "//:grpc++",
68             "//:grpc",
69             "//:gpr",
70             "//test/cpp/util:test_config",
71         ],
72         data = [
73             ":resolver_component_tests_runner",
74             ":resolver_component_test%s" % unsecure_build_config_suffix,
75             "//test/cpp/naming/utils:dns_server",
76             "//test/cpp/naming/utils:dns_resolver",
77             "//test/cpp/naming/utils:tcp_connect",
78             "resolver_test_record_groups.yaml", # include the transitive dependency so that the dns sever py binary can locate this
79         ],
80         args = [
81             "--test_bin_name=resolver_component_test%s" % unsecure_build_config_suffix,
82             "--running_under_bazel=true",
83         ],
84         tags = ["no_windows"],
85     )