Enabled Windows Bazel build for cpp tests

pull/18479/head
Bill Feng 6 years ago
parent 4e046a0956
commit d93959853f
  1. 13
      bazel/BUILD
  2. 31
      bazel/grpc_build_system.bzl
  3. 1
      test/core/bad_connection/BUILD
  4. 1
      test/core/client_channel/BUILD
  5. 23
      test/core/end2end/generate_tests.bzl
  6. 10
      test/core/iomgr/BUILD
  7. 1
      test/cpp/common/BUILD
  8. 2
      test/cpp/end2end/BUILD
  9. 1
      test/cpp/interop/BUILD
  10. 18
      test/cpp/microbenchmarks/BUILD
  11. 5
      test/cpp/naming/generate_resolver_component_tests.bzl
  12. 1
      test/cpp/performance/BUILD
  13. 1
      test/cpp/qps/qps_benchmark_script.bzl
  14. 3
      test/cpp/server/BUILD
  15. 1
      test/cpp/server/load_reporter/BUILD
  16. 3
      test/cpp/thread_manager/thread_manager_test.cc
  17. 6
      tools/remote_build/README.md
  18. 3
      tools/remote_build/windows.bazelrc

@ -29,3 +29,16 @@ cc_grpc_library(
proto_only = True,
deps = [],
)
environment(name = "windows_msvc")
environment(name = "non_windows_msvc")
environment_group(
name = "os",
defaults = [":non_windows_msvc"],
environments = [
":non_windows_msvc",
":windows_msvc",
],
)

@ -28,6 +28,12 @@ load("//bazel:cc_grpc_library.bzl", "cc_grpc_library")
# The set of pollers to test against if a test exercises polling
POLLERS = ["epollex", "epoll1", "poll"]
def is_msvc():
return select({
"//:windows_msvc": True,
"//conditions:default": False,
})
def if_not_windows(a):
return select({
"//:windows": [],
@ -80,7 +86,8 @@ def grpc_cc_library(
visibility = None,
alwayslink = 0,
data = [],
use_cfstream = False):
use_cfstream = False,
tags = []):
copts = []
if use_cfstream:
copts = if_mac(["-DGRPC_CFSTREAM"])
@ -117,6 +124,7 @@ def grpc_cc_library(
],
alwayslink = alwayslink,
data = data,
tags = tags,
)
def grpc_proto_plugin(name, srcs = [], deps = []):
@ -159,9 +167,23 @@ def grpc_cc_test(name, srcs = [], deps = [], external_deps = [], args = [], data
"size": size,
"timeout": timeout,
"exec_compatible_with": exec_compatible_with,
"tags": tags,
}
if uses_polling:
native.cc_test(testonly = True, tags = ["manual"], **args)
native.cc_test(
testonly = True,
tags = (["manual"] if not is_msvc() else tags),
name = name,
srcs = srcs,
args = args["args"],
data = data,
deps = deps + _get_external_deps(external_deps),
copts = copts,
linkopts = if_not_windows(["-pthread"]),
size = size,
timeout = timeout,
exec_compatible_with = exec_compatible_with,
)
for poller in POLLERS:
native.sh_test(
name = name + "@poller=" + poller,
@ -175,13 +197,13 @@ def grpc_cc_test(name, srcs = [], deps = [], external_deps = [], args = [], data
poller,
"$(location %s)" % name,
] + args["args"],
tags = tags,
tags = tags if is_msvc() else tags + ["no_windows"],
exec_compatible_with = exec_compatible_with,
)
else:
native.cc_test(**args)
def grpc_cc_binary(name, srcs = [], deps = [], external_deps = [], args = [], data = [], language = "C++", testonly = False, linkshared = False, linkopts = []):
def grpc_cc_binary(name, srcs = [], deps = [], external_deps = [], args = [], data = [], language = "C++", testonly = False, linkshared = False, linkopts = [], tags = []):
copts = []
if language.upper() == "C":
copts = ["-std=c99"]
@ -195,6 +217,7 @@ def grpc_cc_binary(name, srcs = [], deps = [], external_deps = [], args = [], da
deps = deps + _get_external_deps(external_deps),
copts = copts,
linkopts = if_not_windows(["-pthread"]) + linkopts,
tags = tags,
)
def grpc_generate_one_off_targets():

@ -29,4 +29,5 @@ grpc_cc_binary(
"//:grpc",
"//test/core/util:grpc_test_util",
],
tags = ["no_windows"],
)

@ -52,6 +52,7 @@ grpc_cc_test(
"//:grpc",
"//test/core/util:grpc_test_util",
],
tags = ["no_windows"],
)
grpc_cc_test(

@ -15,7 +15,7 @@
"""Generates the appropriate build.json data for all the end2end tests."""
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library")
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "is_msvc")
POLLERS = ["epollex", "epoll1", "poll"]
@ -31,7 +31,8 @@ def _fixture_options(
is_http2 = True,
supports_proxy_auth = False,
supports_write_buffering = True,
client_channel = True):
client_channel = True,
supports_msvc = True):
return struct(
fullstack = fullstack,
includes_proxy = includes_proxy,
@ -44,6 +45,7 @@ def _fixture_options(
supports_proxy_auth = supports_proxy_auth,
supports_write_buffering = supports_write_buffering,
client_channel = client_channel,
supports_msvc = supports_msvc,
#_platforms=_platforms,
)
@ -120,10 +122,11 @@ END2END_NOSEC_FIXTURES = {
client_channel = False,
secure = False,
_platforms = ["linux", "mac", "posix"],
supports_msvc = False,
),
"h2_full": _fixture_options(secure = False),
"h2_full+pipe": _fixture_options(secure = False, _platforms = ["linux"]),
"h2_full+trace": _fixture_options(secure = False, tracing = True),
"h2_full+pipe": _fixture_options(secure = False, _platforms = ["linux"], supports_msvc = False),
"h2_full+trace": _fixture_options(secure = False, tracing = True, supports_msvc = False),
"h2_full+workarounds": _fixture_options(secure = False),
"h2_http_proxy": _fixture_options(secure = False, supports_proxy_auth = True),
"h2_proxy": _fixture_options(secure = False, includes_proxy = True),
@ -152,6 +155,7 @@ END2END_NOSEC_FIXTURES = {
dns_resolver = False,
_platforms = ["linux", "mac", "posix"],
secure = False,
supports_msvc = False,
),
}
@ -453,6 +457,16 @@ def grpc_end2end_nosec_tests():
continue
if topt.secure:
continue
native.sh_test(
name = "%s_nosec_test@%s" % (f, t),
data = [":%s_nosec_test" % f],
srcs = ["end2end_test.sh"],
args = [
"$(location %s_nosec_test)" % f,
t,
],
tags = ["no_windows"],
)
for poller in POLLERS:
native.sh_test(
name = "%s_nosec_test@%s@poller=%s" % (f, t, poller),
@ -463,4 +477,5 @@ def grpc_end2end_nosec_tests():
t,
poller,
],
tags = ["no_windows"],
)

@ -81,6 +81,7 @@ grpc_cc_test(
"//:grpc",
"//test/core/util:grpc_test_util",
],
tags = ["no_windows"],
)
grpc_cc_test(
@ -92,6 +93,7 @@ grpc_cc_test(
"//:grpc",
"//test/core/util:grpc_test_util",
],
tags = ["no_windows"],
)
grpc_cc_test(
@ -103,6 +105,7 @@ grpc_cc_test(
"//:grpc",
"//test/core/util:grpc_test_util",
],
tags = ["no_windows"],
)
grpc_cc_test(
@ -139,6 +142,7 @@ grpc_cc_test(
"//:grpc",
"//test/core/util:grpc_test_util",
],
tags = ["no_windows"],
)
grpc_cc_test(
@ -153,6 +157,7 @@ grpc_cc_test(
"//:grpc",
"//test/core/util:grpc_test_util",
],
tags = ["no_windows"],
)
grpc_cc_test(
@ -214,6 +219,7 @@ grpc_cc_test(
"//:grpc",
"//test/core/util:grpc_test_util",
],
tags = ["no_windows"],
)
grpc_cc_test(
@ -225,6 +231,7 @@ grpc_cc_test(
"//:grpc",
"//test/core/util:grpc_test_util",
],
tags = ["no_windows"],
)
grpc_cc_test(
@ -237,6 +244,7 @@ grpc_cc_test(
"//:grpc",
"//test/core/util:grpc_test_util",
],
tags = ["no_windows"],
)
grpc_cc_test(
@ -259,6 +267,7 @@ grpc_cc_test(
"//:grpc",
"//test/core/util:grpc_test_util",
],
tags = ["no_windows"],
)
grpc_cc_test(
@ -303,4 +312,5 @@ grpc_cc_test(
"//:grpc",
"//test/core/util:grpc_test_util",
],
tags = ["no_windows"],
)

@ -28,6 +28,7 @@ grpc_cc_test(
"//:grpc++_unsecure",
"//test/core/util:grpc_test_util_unsecure",
],
tags = ["no_windows"],
)
grpc_cc_test(

@ -99,6 +99,7 @@ grpc_cc_test(
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
tags = ["no_windows"],
)
grpc_cc_test(
@ -633,6 +634,7 @@ grpc_cc_test(
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
tags = ["no_windows"],
)
grpc_cc_test(

@ -161,4 +161,5 @@ grpc_cc_test(
"//test/cpp/util:test_config",
"//test/cpp/util:test_util",
],
tags = ["no_windows"],
)

@ -45,6 +45,7 @@ grpc_cc_library(
"//test/core/util:grpc_test_util_unsecure",
"//test/cpp/util:test_config",
],
tags = ["no_windows"],
)
grpc_cc_binary(
@ -52,6 +53,7 @@ grpc_cc_binary(
testonly = 1,
srcs = ["bm_closure.cc"],
deps = [":helpers"],
tags = ["no_windows"],
)
grpc_cc_binary(
@ -59,6 +61,7 @@ grpc_cc_binary(
testonly = 1,
srcs = ["bm_alarm.cc"],
deps = [":helpers"],
tags = ["no_windows"],
)
grpc_cc_binary(
@ -66,6 +69,7 @@ grpc_cc_binary(
testonly = 1,
srcs = ["bm_arena.cc"],
deps = [":helpers"],
tags = ["no_windows"],
)
grpc_cc_binary(
@ -73,6 +77,7 @@ grpc_cc_binary(
testonly = 1,
srcs = ["bm_byte_buffer.cc"],
deps = [":helpers"],
tags = ["no_windows"],
)
grpc_cc_binary(
@ -80,6 +85,7 @@ grpc_cc_binary(
testonly = 1,
srcs = ["bm_channel.cc"],
deps = [":helpers"],
tags = ["no_windows"],
)
grpc_cc_binary(
@ -87,6 +93,7 @@ grpc_cc_binary(
testonly = 1,
srcs = ["bm_call_create.cc"],
deps = [":helpers"],
tags = ["no_windows"],
)
grpc_cc_binary(
@ -94,6 +101,7 @@ grpc_cc_binary(
testonly = 1,
srcs = ["bm_cq.cc"],
deps = [":helpers"],
tags = ["no_windows"],
)
grpc_cc_binary(
@ -101,6 +109,7 @@ grpc_cc_binary(
testonly = 1,
srcs = ["bm_cq_multiple_threads.cc"],
deps = [":helpers"],
tags = ["no_windows"],
)
grpc_cc_binary(
@ -108,6 +117,7 @@ grpc_cc_binary(
testonly = 1,
srcs = ["bm_error.cc"],
deps = [":helpers"],
tags = ["no_windows"],
)
grpc_cc_library(
@ -117,6 +127,7 @@ grpc_cc_library(
"fullstack_streaming_ping_pong.h",
],
deps = [":helpers"],
tags = ["no_windows"],
)
grpc_cc_binary(
@ -126,6 +137,7 @@ grpc_cc_binary(
"bm_fullstack_streaming_ping_pong.cc",
],
deps = [":fullstack_streaming_ping_pong_h"],
tags = ["no_windows"],
)
grpc_cc_library(
@ -144,6 +156,7 @@ grpc_cc_binary(
"bm_fullstack_streaming_pump.cc",
],
deps = [":fullstack_streaming_pump_h"],
tags = ["no_windows"],
)
grpc_cc_binary(
@ -151,6 +164,7 @@ grpc_cc_binary(
testonly = 1,
srcs = ["bm_fullstack_trickle.cc"],
deps = [":helpers"],
tags = ["no_windows"],
)
grpc_cc_library(
@ -169,6 +183,7 @@ grpc_cc_binary(
"bm_fullstack_unary_ping_pong.cc",
],
deps = [":fullstack_unary_ping_pong_h"],
tags = ["no_windows"],
)
grpc_cc_binary(
@ -176,6 +191,7 @@ grpc_cc_binary(
testonly = 1,
srcs = ["bm_metadata.cc"],
deps = [":helpers"],
tags = ["no_windows"],
)
grpc_cc_binary(
@ -183,6 +199,7 @@ grpc_cc_binary(
testonly = 1,
srcs = ["bm_chttp2_hpack.cc"],
deps = [":helpers"],
tags = ["no_windows"],
)
grpc_cc_binary(
@ -202,4 +219,5 @@ grpc_cc_binary(
testonly = 1,
srcs = ["bm_timer.cc"],
deps = [":helpers"],
tags = ["no_windows"],
)

@ -33,6 +33,7 @@ def generate_resolver_component_tests():
"//:gpr",
"//test/cpp/util:test_config",
],
tags = ["no_windows"],
)
# meant to be invoked only through the top-level shell script driver
grpc_cc_binary(
@ -52,6 +53,7 @@ def generate_resolver_component_tests():
"//:gpr",
"//test/cpp/util:test_config",
],
tags = ["no_windows"],
)
grpc_cc_test(
name = "resolver_component_tests_runner_invoker%s" % unsecure_build_config_suffix,
@ -77,5 +79,6 @@ def generate_resolver_component_tests():
args = [
"--test_bin_name=resolver_component_test%s" % unsecure_build_config_suffix,
"--running_under_bazel=true",
]
],
tags = ["no_windows"],
)

@ -31,4 +31,5 @@ grpc_cc_test(
"//src/proto/grpc/testing:echo_proto",
"//test/core/util:grpc_test_util_base",
],
tags = ["no_windows"],
)

@ -75,5 +75,6 @@ def json_run_localhost_batch():
],
tags = [
"json_run_localhost",
"no_windows",
],
)

@ -29,6 +29,7 @@ grpc_cc_test(
"//src/proto/grpc/testing:echo_proto",
"//test/core/util:grpc_test_util_unsecure",
],
tags = ["no_windows"],
)
grpc_cc_test(
@ -42,6 +43,7 @@ grpc_cc_test(
"//src/proto/grpc/testing:echo_proto",
"//test/core/util:grpc_test_util_unsecure",
],
tags = ["no_windows"],
)
grpc_cc_test(
@ -55,4 +57,5 @@ grpc_cc_test(
"//src/proto/grpc/testing:echo_proto",
"//test/core/util:grpc_test_util_unsecure",
],
tags = ["no_windows"],
)

@ -45,6 +45,7 @@ grpc_cc_test(
"//:lb_server_load_reporting_filter",
"//test/core/util:grpc_test_util",
],
tags = ["no_windows"],
)
grpc_cc_test(

@ -21,13 +21,12 @@
#include <memory>
#include <string>
#include <gflags/gflags.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
#include <grpcpp/grpcpp.h>
#include "src/cpp/thread_manager/thread_manager.h"
#include "test/cpp/util/test_config.h"
#include "src/cpp/thread_manager/thread_manager.h"
namespace grpc {

@ -29,5 +29,11 @@ Sanitizer runs (asan, msan, tsan, ubsan):
bazel --bazelrc=tools/remote_build/manual.bazelrc test --config=asan //test/...
```
Run on Windows MSVC:
```
# local manual run only for C++ targets (RBE to be supported)
bazel --bazelrc=tools/remote_build/windows.bazelrc test //test/cpp/...
```
Available command line options can be found in
[Bazel command line reference](https://docs.bazel.build/versions/master/command-line-reference.html)

@ -0,0 +1,3 @@
# TODO(yfen): Merge with rbe_common.bazelrc and enable Windows RBE
build --test_tag_filters=-no_windows
build --build_tag_filters=-no_windows
Loading…
Cancel
Save