Merge branch 'master' of github.com:grpc/grpc into authority_header

reviewable/pr14615/r13
David Garcia Quintas 7 years ago
commit 2cbdd85132
  1. 6
      bazel/cc_grpc_library.bzl
  2. 6
      bazel/generate_cc.bzl
  3. 4
      bazel/grpc_build_system.bzl
  4. 4
      doc/unit_testing.md
  5. 4
      src/proto/grpc/testing/BUILD
  6. 7
      test/core/gprpp/inlined_vector_test.cc
  7. 12
      test/cpp/end2end/async_end2end_test.cc
  8. 40
      test/cpp/qps/gen_build_yaml.py
  9. 3088
      tools/run_tests/generated/tests.json

@ -2,7 +2,7 @@
load("//:bazel/generate_cc.bzl", "generate_cc")
def cc_grpc_library(name, srcs, deps, proto_only, well_known_protos, generate_mock, use_external = False, **kwargs):
def cc_grpc_library(name, srcs, deps, proto_only, well_known_protos, generate_mocks = False, use_external = False, **kwargs):
"""Generates C++ grpc classes from a .proto file.
Assumes the generated classes will be used in cc_api_version = 2.
@ -16,7 +16,7 @@ def cc_grpc_library(name, srcs, deps, proto_only, well_known_protos, generate_mo
protos
use_external: When True the grpc deps are prefixed with //external. This
allows grpc to be used as a dependency in other bazel projects.
generate_mock: When true GMOCk code for client stub is generated.
generate_mocks: When True, Google Mock code for client stub is generated.
**kwargs: rest of arguments, e.g., compatible_with and visibility.
"""
if len(srcs) > 1:
@ -54,7 +54,7 @@ def cc_grpc_library(name, srcs, deps, proto_only, well_known_protos, generate_mo
srcs = [proto_target],
plugin = plugin,
well_known_protos = well_known_protos,
generate_mock = generate_mock,
generate_mocks = generate_mocks,
**kwargs
)

@ -14,7 +14,7 @@ def generate_cc_impl(ctx):
if ctx.executable.plugin:
outs += [proto.path[label_len:-len(".proto")] + ".grpc.pb.h" for proto in protos]
outs += [proto.path[label_len:-len(".proto")] + ".grpc.pb.cc" for proto in protos]
if ctx.attr.generate_mock:
if ctx.attr.generate_mocks:
outs += [proto.path[label_len:-len(".proto")] + "_mock.grpc.pb.h" for proto in protos]
else:
outs += [proto.path[label_len:-len(".proto")] + ".pb.h" for proto in protos]
@ -26,7 +26,7 @@ def generate_cc_impl(ctx):
if ctx.executable.plugin:
arguments += ["--plugin=protoc-gen-PLUGIN=" + ctx.executable.plugin.path]
flags = list(ctx.attr.flags)
if ctx.attr.generate_mock:
if ctx.attr.generate_mocks:
flags.append("generate_mock_code=true")
arguments += ["--PLUGIN_out=" + ",".join(flags) + ":" + dir_out]
additional_input = [ctx.executable.plugin]
@ -76,7 +76,7 @@ _generate_cc = rule(
"well_known_protos" : attr.label(
mandatory = False,
),
"generate_mock" : attr.bool(
"generate_mocks" : attr.bool(
default = False,
mandatory = False,
),

@ -97,7 +97,7 @@ def grpc_proto_plugin(name, srcs = [], deps = []):
load("//:bazel/cc_grpc_library.bzl", "cc_grpc_library")
def grpc_proto_library(name, srcs = [], deps = [], well_known_protos = False,
has_services = True, use_external = False, generate_mock = False):
has_services = True, use_external = False, generate_mocks = False):
cc_grpc_library(
name = name,
srcs = srcs,
@ -105,7 +105,7 @@ def grpc_proto_library(name, srcs = [], deps = [], well_known_protos = False,
well_known_protos = well_known_protos,
proto_only = not has_services,
use_external = use_external,
generate_mock = generate_mock,
generate_mocks = generate_mocks,
)
def grpc_cc_test(name, srcs = [], deps = [], external_deps = [], args = [], data = [], uses_polling = True, language = "C++"):

@ -56,7 +56,7 @@ Such a mock can be auto-generated by:
1. Setting flag(generate_mock_code=true) on grpc plugin for protoc, or
1. Setting an attribute(generate_mock) in your bazel rule.
1. Setting an attribute(generate_mocks) in your bazel rule.
Protoc plugin flag:
@ -70,7 +70,7 @@ Bazel rule:
grpc_proto_library(
name = "echo_proto",
srcs = ["echo.proto"],
generate_mock = True,
generate_mocks = True,
)
```

@ -26,7 +26,7 @@ exports_files([
grpc_proto_library(
name = "compiler_test_proto",
srcs = ["compiler_test.proto"],
generate_mock = True,
generate_mocks = True,
)
grpc_proto_library(
@ -49,7 +49,7 @@ grpc_proto_library(
name = "echo_proto",
srcs = ["echo.proto"],
deps = ["echo_messages_proto"],
generate_mock = True,
generate_mocks = True,
)
grpc_proto_library(

@ -87,14 +87,17 @@ TEST(InlinedVectorTest, ClearAndRepopulate) {
}
TEST(InlinedVectorTest, ConstIndexOperator) {
const int kNumElements = 10;
constexpr int kNumElements = 10;
InlinedVector<int, 5> v;
EXPECT_EQ(0UL, v.size());
for (int i = 0; i < kNumElements; ++i) {
v.push_back(i);
EXPECT_EQ(i + 1UL, v.size());
}
auto const_func = [kNumElements](const InlinedVector<int, 5>& v) {
// The following lambda function is exceptionally allowed to use an anonymous
// capture due to the erroneous behavior of the MSVC compiler, that refuses to
// capture the kNumElements constexpr, something allowed by the standard.
auto const_func = [&](const InlinedVector<int, 5>& v) {
for (int i = 0; i < kNumElements; ++i) {
EXPECT_EQ(i, v[i]);
}

@ -485,7 +485,7 @@ TEST_P(AsyncEnd2endTest, DoThenAsyncNextRpc) {
EXPECT_EQ(send_request.message(), recv_request.message());
send_response.set_message(recv_request.message());
auto lambda_3 = [&, this, resp_writer_ptr, send_response]() {
auto lambda_3 = [resp_writer_ptr, send_response]() {
resp_writer_ptr->Finish(send_response, Status::OK, tag(3));
};
Verifier().Expect(3, true).Expect(4, true).Verify(
@ -1216,8 +1216,7 @@ class AsyncEnd2endServerTryCancelTest : public AsyncEnd2endTest {
srv_ctx.AsyncNotifyWhenDone(tag(11));
service_->RequestRequestStream(&srv_ctx, &srv_stream, cq_.get(), cq_.get(),
tag(2));
std::thread t1(
[this, &cli_cq] { Verifier().Expect(1, true).Verify(&cli_cq); });
std::thread t1([&cli_cq] { Verifier().Expect(1, true).Verify(&cli_cq); });
Verifier().Expect(2, true).Verify(cq_.get());
t1.join();
@ -1241,7 +1240,7 @@ class AsyncEnd2endServerTryCancelTest : public AsyncEnd2endTest {
(server_try_cancel == CANCEL_BEFORE_PROCESSING);
std::thread cli_thread([&cli_cq, &cli_stream, &expected_client_cq_result,
&ignore_client_cq_result, this] {
&ignore_client_cq_result] {
EchoRequest send_request;
// Client sends 3 messages (tags 3, 4 and 5)
for (int tag_idx = 3; tag_idx <= 5; tag_idx++) {
@ -1372,8 +1371,7 @@ class AsyncEnd2endServerTryCancelTest : public AsyncEnd2endTest {
service_->RequestResponseStream(&srv_ctx, &recv_request, &srv_stream,
cq_.get(), cq_.get(), tag(2));
std::thread t1(
[this, &cli_cq] { Verifier().Expect(1, true).Verify(&cli_cq); });
std::thread t1([&cli_cq] { Verifier().Expect(1, true).Verify(&cli_cq); });
Verifier().Expect(2, true).Verify(cq_.get());
t1.join();
@ -1398,7 +1396,7 @@ class AsyncEnd2endServerTryCancelTest : public AsyncEnd2endTest {
}
std::thread cli_thread([&cli_cq, &cli_stream, &expected_client_cq_result,
&ignore_client_cq_result, this] {
&ignore_client_cq_result] {
// Client attempts to read the three messages from the server
for (int tag_idx = 6; tag_idx <= 8; tag_idx++) {
EchoResponse recv_response;

@ -101,26 +101,24 @@ print yaml.dump({
}
for scenario_json in scenario_config.CXXLanguage().scenarios()
if 'inproc' in scenario_json.get('CATEGORIES', [])
] + [
{
'name': 'json_run_localhost',
'shortname': 'json_run_localhost:%s_low_thread_count' % scenario_json['name'],
'args': ['--scenarios_json', _scenario_json_string(scenario_json, True)],
'ci_platforms': ['linux'],
'platforms': ['linux'],
'flaky': False,
'language': 'c++',
'boringssl': True,
'defaults': 'boringssl',
'cpu_cost': guess_cpu(scenario_json, True),
'exclude_configs': sorted(c for c in configs_from_yaml if c not in ('tsan', 'asan')),
'timeout_seconds': 10*60,
'excluded_poll_engines': scenario_json.get('EXCLUDED_POLL_ENGINES', []),
'auto_timeout_scaling': False
}
for scenario_json in scenario_config.CXXLanguage().scenarios()
if 'scalable' in scenario_json.get('CATEGORIES', [])
]
# Disabled until https://github.com/grpc/grpc/issues/13122 is resolved.
# + [
# {
# 'name': 'json_run_localhost',
# 'shortname': 'json_run_localhost:%s_low_thread_count' % scenario_json['name'],
# 'args': ['--scenarios_json', _scenario_json_string(scenario_json, True)],
# 'ci_platforms': ['linux'],
# 'platforms': ['linux'],
# 'flaky': False,
# 'language': 'c++',
# 'boringssl': True,
# 'defaults': 'boringssl',
# 'cpu_cost': guess_cpu(scenario_json, True),
# 'exclude_configs': sorted(c for c in configs_from_yaml if c not in ('tsan', 'asan')),
# 'timeout_seconds': 10*60,
# 'excluded_poll_engines': scenario_json.get('EXCLUDED_POLL_ENGINES', []),
# 'auto_timeout_scaling': False
# }
# for scenario_json in scenario_config.CXXLanguage().scenarios()
# if 'scalable' in scenario_json.get('CATEGORIES', [])
# ]
})

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save