Skip to content

Commit

Permalink
C++ Windows test builds
Browse files Browse the repository at this point in the history
  • Loading branch information
billfeng327 committed Mar 6, 2019
1 parent 1e4b706 commit ab06853
Show file tree
Hide file tree
Showing 16 changed files with 74 additions and 13 deletions.
16 changes: 13 additions & 3 deletions bazel/grpc_build_system.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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", "poll-cv"]

def is_msvc():
return select({
"//:windows_msvc": True,
"//conditions:default": False,
})

def if_not_windows(a):
return select({
"//:windows": [],
Expand Down Expand Up @@ -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"])
Expand Down Expand Up @@ -116,6 +123,7 @@ def grpc_cc_library(
],
alwayslink = alwayslink,
data = data,
tags = tags,
)

def grpc_proto_plugin(name, srcs = [], deps = []):
Expand Down Expand Up @@ -158,8 +166,9 @@ 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:
if uses_polling and not is_msvc():
native.cc_test(testonly = True, tags = ["manual"], **args)
for poller in POLLERS:
native.sh_test(
Expand All @@ -180,7 +189,7 @@ def grpc_cc_test(name, srcs = [], deps = [], external_deps = [], args = [], data
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"]
Expand All @@ -194,6 +203,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():
Expand Down
10 changes: 5 additions & 5 deletions bazel/grpc_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,16 @@ def grpc_deps():
if "com_github_gflags_gflags" not in native.existing_rules():
http_archive(
name = "com_github_gflags_gflags",
strip_prefix = "gflags-30dbc81fb5ffdc98ea9b14b1918bfe4e8779b26e",
url = "https://github.com/gflags/gflags/archive/30dbc81fb5ffdc98ea9b14b1918bfe4e8779b26e.tar.gz",
strip_prefix = "gflags-28f50e0fed19872e0fd50dd23ce2ee8cd759338e",
url = "https://github.com/gflags/gflags/archive/28f50e0fed19872e0fd50dd23ce2ee8cd759338e.tar.gz",
)

if "com_github_google_benchmark" not in native.existing_rules():
http_archive(
name = "com_github_google_benchmark",
build_file = "@com_github_grpc_grpc//third_party:benchmark.BUILD",
strip_prefix = "benchmark-9913418d323e64a0111ca0da81388260c2bbe1e9",
url = "https://github.com/google/benchmark/archive/9913418d323e64a0111ca0da81388260c2bbe1e9.tar.gz",
#build_file = "@com_github_grpc_grpc//third_party:benchmark.BUILD",
strip_prefix = "benchmark-e776aa0275e293707b6a0901e0e8d8a8a3679508",
url = "https://github.com/google/benchmark/archive/e776aa0275e293707b6a0901e0e8d8a8a3679508.tar.gz",
)

if "com_github_cares_cares" not in native.existing_rules():
Expand Down
1 change: 1 addition & 0 deletions test/core/bad_connection/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ grpc_cc_binary(
"//:grpc",
"//test/core/util:grpc_test_util",
],
tags = ["exclude_windows"],
)
1 change: 1 addition & 0 deletions test/core/client_channel/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ grpc_cc_test(
"//:grpc",
"//test/core/util:grpc_test_util",
],
tags = ["exclude_windows"],
)

grpc_cc_test(
Expand Down
15 changes: 11 additions & 4 deletions test/core/end2end/generate_tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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", "poll-cv"]

Expand All @@ -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,
Expand All @@ -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,
)

Expand Down Expand Up @@ -119,10 +121,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),
Expand Down Expand Up @@ -151,6 +154,7 @@ END2END_NOSEC_FIXTURES = {
dns_resolver = False,
_platforms = ["linux", "mac", "posix"],
secure = False,
supports_msvc = False,
),
}

Expand Down Expand Up @@ -328,6 +332,9 @@ END2END_TESTS = {
}

def _compatible(fopt, topt):
if is_msvc:
if not fopt.supports_msvc:
return False
if topt.needs_fullstack:
if not fopt.fullstack:
return False
Expand Down
10 changes: 10 additions & 0 deletions test/core/iomgr/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ grpc_cc_test(
"//:grpc",
"//test/core/util:grpc_test_util",
],
tags = ["exclude_windows"],
)

grpc_cc_test(
Expand All @@ -92,6 +93,7 @@ grpc_cc_test(
"//:grpc",
"//test/core/util:grpc_test_util",
],
tags = ["exclude_windows"],
)

grpc_cc_test(
Expand All @@ -103,6 +105,7 @@ grpc_cc_test(
"//:grpc",
"//test/core/util:grpc_test_util",
],
tags = ["exclude_windows"],
)

grpc_cc_test(
Expand Down Expand Up @@ -139,6 +142,7 @@ grpc_cc_test(
"//:grpc",
"//test/core/util:grpc_test_util",
],
tags = ["exclude_windows"],
)

grpc_cc_test(
Expand All @@ -153,6 +157,7 @@ grpc_cc_test(
"//:grpc",
"//test/core/util:grpc_test_util",
],
tags = ["exclude_windows"],
)

grpc_cc_test(
Expand Down Expand Up @@ -214,6 +219,7 @@ grpc_cc_test(
"//:grpc",
"//test/core/util:grpc_test_util",
],
tags = ["exclude_windows"],
)

grpc_cc_test(
Expand All @@ -225,6 +231,7 @@ grpc_cc_test(
"//:grpc",
"//test/core/util:grpc_test_util",
],
tags = ["exclude_windows"],
)

grpc_cc_test(
Expand All @@ -237,6 +244,7 @@ grpc_cc_test(
"//:grpc",
"//test/core/util:grpc_test_util",
],
tags = ["exclude_windows"],
)

grpc_cc_test(
Expand All @@ -259,6 +267,7 @@ grpc_cc_test(
"//:grpc",
"//test/core/util:grpc_test_util",
],
tags = ["exclude_windows"],
)

grpc_cc_test(
Expand Down Expand Up @@ -303,6 +312,7 @@ grpc_cc_test(
"//:grpc",
"//test/core/util:grpc_test_util",
],
tags = ["exclude_windows"],
)

grpc_cc_test(
Expand Down
1 change: 1 addition & 0 deletions test/cpp/common/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ grpc_cc_test(
"//:grpc++_unsecure",
"//test/core/util:grpc_test_util_unsecure",
],
tags = ["exclude_windows"],
)

grpc_cc_test(
Expand Down
2 changes: 2 additions & 0 deletions test/cpp/end2end/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ grpc_cc_test(
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
tags = ["exclude_windows"],
)

grpc_cc_test(
Expand Down Expand Up @@ -607,6 +608,7 @@ grpc_cc_test(
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
tags = ["exclude_windows"],
)

grpc_cc_test(
Expand Down
1 change: 1 addition & 0 deletions test/cpp/interop/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,5 @@ grpc_cc_test(
"//test/cpp/util:test_config",
"//test/cpp/util:test_util",
],
tags = ["exclude_windows"],
)
17 changes: 17 additions & 0 deletions test/cpp/microbenchmarks/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,23 @@ grpc_cc_library(
"//test/core/util:grpc_test_util_unsecure",
"//test/cpp/util:test_config",
],
tags = ["exclude_windows"],
)

grpc_cc_binary(
name = "bm_closure",
testonly = 1,
srcs = ["bm_closure.cc"],
deps = [":helpers"],
tags = ["exclude_windows"],
)

grpc_cc_binary(
name = "bm_alarm",
testonly = 1,
srcs = ["bm_alarm.cc"],
deps = [":helpers"],
tags = ["exclude_windows"],
)

grpc_cc_binary(
Expand All @@ -73,41 +76,47 @@ grpc_cc_binary(
testonly = 1,
srcs = ["bm_byte_buffer.cc"],
deps = [":helpers"],
tags = ["exclude_windows"],
)

grpc_cc_binary(
name = "bm_channel",
testonly = 1,
srcs = ["bm_channel.cc"],
deps = [":helpers"],
tags = ["exclude_windows"],
)

grpc_cc_binary(
name = "bm_call_create",
testonly = 1,
srcs = ["bm_call_create.cc"],
deps = [":helpers"],
tags = ["exclude_windows"],
)

grpc_cc_binary(
name = "bm_cq",
testonly = 1,
srcs = ["bm_cq.cc"],
deps = [":helpers"],
tags = ["exclude_windows"],
)

grpc_cc_binary(
name = "bm_cq_multiple_threads",
testonly = 1,
srcs = ["bm_cq_multiple_threads.cc"],
deps = [":helpers"],
tags = ["exclude_windows"],
)

grpc_cc_binary(
name = "bm_error",
testonly = 1,
srcs = ["bm_error.cc"],
deps = [":helpers"],
tags = ["exclude_windows"],
)

grpc_cc_library(
Expand All @@ -117,6 +126,7 @@ grpc_cc_library(
"fullstack_streaming_ping_pong.h",
],
deps = [":helpers"],
tags = ["exclude_windows"],
)

grpc_cc_binary(
Expand All @@ -126,6 +136,7 @@ grpc_cc_binary(
"bm_fullstack_streaming_ping_pong.cc",
],
deps = [":fullstack_streaming_ping_pong_h"],
tags = ["exclude_windows"],
)

grpc_cc_library(
Expand All @@ -144,13 +155,15 @@ grpc_cc_binary(
"bm_fullstack_streaming_pump.cc",
],
deps = [":fullstack_streaming_pump_h"],
tags = ["exclude_windows"],
)

grpc_cc_binary(
name = "bm_fullstack_trickle",
testonly = 1,
srcs = ["bm_fullstack_trickle.cc"],
deps = [":helpers"],
tags = ["exclude_windows"],
)

grpc_cc_library(
Expand All @@ -169,20 +182,23 @@ grpc_cc_binary(
"bm_fullstack_unary_ping_pong.cc",
],
deps = [":fullstack_unary_ping_pong_h"],
tags = ["exclude_windows"],
)

grpc_cc_binary(
name = "bm_metadata",
testonly = 1,
srcs = ["bm_metadata.cc"],
deps = [":helpers"],
tags = ["exclude_windows"],
)

grpc_cc_binary(
name = "bm_chttp2_hpack",
testonly = 1,
srcs = ["bm_chttp2_hpack.cc"],
deps = [":helpers"],
tags = ["exclude_windows"],
)

grpc_cc_binary(
Expand All @@ -202,4 +218,5 @@ grpc_cc_binary(
testonly = 1,
srcs = ["bm_timer.cc"],
deps = [":helpers"],
tags = ["exclude_windows"],
)
Loading

0 comments on commit ab06853

Please sign in to comment.