aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar ncteisen <ncteisen@gmail.com>2018-03-15 13:46:28 -1000
committerGravatar ncteisen <ncteisen@gmail.com>2018-03-15 13:46:28 -1000
commitb93a006d64f071ad0804b00f9b1064411a430092 (patch)
treed5971592bf7675ab5279723d46ab96f8e5827b5f /test
parent0c6024b94dc2a8aa9d851d8bc5d3a96e97802a55 (diff)
parent941dbaf9f0adb99f3fac4317c703084409a7a33d (diff)
Merge branch 'master' of https://github.com/grpc/grpc into channel-tracing
Diffstat (limited to 'test')
-rw-r--r--test/core/client_channel/parse_address_test.cc27
-rw-r--r--test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc5
-rw-r--r--test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc33
-rw-r--r--test/core/compression/algorithm_test.cc1
-rw-r--r--test/core/debug/stats_test.cc12
-rw-r--r--test/core/end2end/connection_refused_test.cc1
-rw-r--r--test/core/end2end/cq_verifier.cc1
-rw-r--r--test/core/end2end/fixtures/http_proxy_fixture.cc6
-rw-r--r--test/core/end2end/fuzzers/api_fuzzer.cc15
-rw-r--r--test/core/end2end/goaway_server_test.cc46
-rw-r--r--test/core/end2end/tests/bad_ping.cc9
-rw-r--r--test/core/end2end/tests/cancel_after_accept.cc1
-rw-r--r--test/core/end2end/tests/cancel_after_invoke.cc1
-rw-r--r--test/core/end2end/tests/cancel_after_round_trip.cc1
-rw-r--r--test/core/end2end/tests/cancel_before_invoke.cc1
-rw-r--r--test/core/end2end/tests/cancel_with_status.cc1
-rw-r--r--test/core/end2end/tests/max_message_length.cc1
-rw-r--r--test/core/end2end/tests/negative_deadline.cc1
-rw-r--r--test/core/end2end/tests/request_with_flags.cc8
-rw-r--r--test/core/end2end/tests/shutdown_finishes_calls.cc7
-rw-r--r--test/core/gpr/mpscq_test.cc1
-rw-r--r--test/core/gpr/time_test.cc1
-rw-r--r--test/core/http/httpcli_test.cc1
-rw-r--r--test/core/http/httpscli_test.cc1
-rw-r--r--test/core/iomgr/resource_quota_test.cc1
-rw-r--r--test/core/iomgr/sockaddr_utils_test.cc46
-rw-r--r--test/core/iomgr/timer_heap_test.cc9
-rw-r--r--test/core/iomgr/timer_list_test.cc11
-rw-r--r--test/core/iomgr/udp_server_test.cc107
-rw-r--r--test/core/iomgr/wakeup_fd_cv_test.cc2
-rw-r--r--test/core/security/BUILD13
-rw-r--r--test/core/slice/slice_hash_table_test.cc1
-rw-r--r--test/core/slice/slice_test.cc3
-rw-r--r--test/core/slice/slice_weak_hash_table_test.cc1
-rw-r--r--test/core/surface/concurrent_connectivity_test.cc5
-rw-r--r--test/core/transport/BUILD3
-rw-r--r--test/core/transport/byte_stream_test.cc195
-rw-r--r--test/core/transport/chttp2/bin_decoder_test.cc1
-rw-r--r--test/core/transport/chttp2/hpack_parser_fuzzer_test.cc1
-rw-r--r--test/core/transport/chttp2/hpack_parser_test.cc2
-rw-r--r--test/core/transport/chttp2/hpack_table_test.cc1
-rw-r--r--test/core/transport/connectivity_state_test.cc1
-rw-r--r--test/core/transport/metadata_test.cc1
-rw-r--r--test/core/tsi/alts/crypt/BUILD22
-rw-r--r--test/core/tsi/alts/crypt/gsec_test_util.cc10
-rw-r--r--test/core/tsi/alts/crypt/gsec_test_util.h2
-rw-r--r--test/core/tsi/alts/frame_protector/BUILD11
-rw-r--r--test/core/tsi/alts/handshaker/BUILD8
-rw-r--r--test/core/tsi/alts/zero_copy_frame_protector/BUILD8
-rw-r--r--test/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_test.cc1
-rw-r--r--test/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector_test.cc1
-rw-r--r--test/core/util/test_config.cc1
-rw-r--r--test/core/util/test_tcp_server.cc9
-rw-r--r--test/cpp/client/client_channel_stress_test.cc10
-rw-r--r--test/cpp/client/credentials_test.cc2
-rw-r--r--test/cpp/cocoapods/generic/generic.mm18
-rw-r--r--test/cpp/cocoapods/test/server_context_test_spouse_test.mm4
-rw-r--r--test/cpp/codegen/BUILD18
-rw-r--r--test/cpp/codegen/codegen_test_full.cc2
-rw-r--r--test/cpp/codegen/proto_utils_test.cc6
-rwxr-xr-xtest/cpp/codegen/run_golden_file_test.sh6
-rw-r--r--test/cpp/common/alarm_test.cc4
-rw-r--r--test/cpp/common/auth_property_iterator_test.cc2
-rw-r--r--test/cpp/common/channel_arguments_test.cc4
-rw-r--r--test/cpp/common/secure_auth_context_test.cc2
-rw-r--r--test/cpp/end2end/async_end2end_test.cc14
-rw-r--r--test/cpp/end2end/client_crash_test.cc12
-rw-r--r--test/cpp/end2end/client_crash_test_server.cc6
-rw-r--r--test/cpp/end2end/client_lb_end2end_test.cc29
-rw-r--r--test/cpp/end2end/end2end_test.cc20
-rw-r--r--test/cpp/end2end/exception_test.cc34
-rw-r--r--test/cpp/end2end/filter_end2end_test.cc22
-rw-r--r--test/cpp/end2end/generic_end2end_test.cc20
-rw-r--r--test/cpp/end2end/grpclb_end2end_test.cc36
-rw-r--r--test/cpp/end2end/health_service_end2end_test.cc16
-rw-r--r--test/cpp/end2end/hybrid_end2end_test.cc14
-rw-r--r--test/cpp/end2end/mock_test.cc14
-rw-r--r--test/cpp/end2end/nonblocking_test.cc12
-rw-r--r--test/cpp/end2end/proto_server_reflection_test.cc18
-rw-r--r--test/cpp/end2end/round_robin_end2end_test.cc10
-rw-r--r--test/cpp/end2end/server_builder_plugin_test.cc22
-rw-r--r--test/cpp/end2end/server_crash_test.cc12
-rw-r--r--test/cpp/end2end/server_crash_test_client.cc6
-rw-r--r--test/cpp/end2end/server_early_return_test.cc16
-rw-r--r--test/cpp/end2end/shutdown_test.cc12
-rw-r--r--test/cpp/end2end/streaming_throughput_test.cc16
-rw-r--r--test/cpp/end2end/test_service_impl.cc4
-rw-r--r--test/cpp/end2end/test_service_impl.h2
-rw-r--r--test/cpp/end2end/thread_stress_test.cc12
-rw-r--r--test/cpp/grpclb/grpclb_api_test.cc2
-rw-r--r--test/cpp/interop/client.cc4
-rw-r--r--test/cpp/interop/client_helper.cc6
-rw-r--r--test/cpp/interop/client_helper.h2
-rw-r--r--test/cpp/interop/http2_client.cc4
-rw-r--r--test/cpp/interop/http2_client.h2
-rw-r--r--test/cpp/interop/interop_client.cc6
-rw-r--r--test/cpp/interop/interop_client.h2
-rw-r--r--test/cpp/interop/interop_server.cc8
-rw-r--r--test/cpp/interop/metrics_client.cc2
-rw-r--r--test/cpp/interop/reconnect_interop_client.cc6
-rw-r--r--test/cpp/interop/reconnect_interop_server.cc6
-rw-r--r--test/cpp/interop/server_helper.cc2
-rw-r--r--test/cpp/interop/server_helper.h4
-rw-r--r--test/cpp/interop/stress_interop_client.cc2
-rw-r--r--test/cpp/interop/stress_interop_client.h2
-rw-r--r--test/cpp/interop/stress_test.cc4
-rw-r--r--test/cpp/microbenchmarks/BUILD7
-rw-r--r--test/cpp/microbenchmarks/bm_call_create.cc4
-rw-r--r--test/cpp/microbenchmarks/bm_chttp2_hpack.cc28
-rw-r--r--test/cpp/microbenchmarks/bm_chttp2_transport.cc41
-rw-r--r--test/cpp/microbenchmarks/bm_cq.cc4
-rw-r--r--test/cpp/microbenchmarks/fullstack_context_mutators.h14
-rw-r--r--test/cpp/microbenchmarks/fullstack_fixtures.h12
-rw-r--r--test/cpp/microbenchmarks/helpers.h2
-rw-r--r--test/cpp/naming/BUILD13
-rwxr-xr-xtest/cpp/naming/generate_resolver_component_tests.bzl4
-rwxr-xr-xtest/cpp/naming/resolver_component_tests_runner.sh48
-rw-r--r--test/cpp/naming/resolver_component_tests_runner_invoker.cc31
-rw-r--r--test/cpp/naming/utils/BUILD50
-rwxr-xr-xtest/cpp/naming/utils/dns_resolver.py48
-rwxr-xr-xtest/cpp/naming/utils/dns_server.py (renamed from test/cpp/naming/test_dns_server.py)0
-rwxr-xr-xtest/cpp/naming/utils/tcp_connect.py35
-rw-r--r--test/cpp/performance/writes_per_rpc_test.cc14
-rw-r--r--test/cpp/qps/benchmark_config.cc4
-rw-r--r--test/cpp/qps/client.h8
-rw-r--r--test/cpp/qps/client_async.cc8
-rw-r--r--test/cpp/qps/client_sync.cc8
-rw-r--r--test/cpp/qps/driver.cc6
-rw-r--r--test/cpp/qps/interarrival.h2
-rw-r--r--test/cpp/qps/parse_json.h4
-rw-r--r--test/cpp/qps/qps_json_driver.cc2
-rw-r--r--test/cpp/qps/qps_worker.cc8
-rw-r--r--test/cpp/qps/qps_worker.h6
-rw-r--r--test/cpp/qps/report.cc2
-rw-r--r--test/cpp/qps/report.h4
-rw-r--r--test/cpp/qps/server.h6
-rw-r--r--test/cpp/qps/server_async.cc14
-rw-r--r--test/cpp/qps/server_sync.cc6
-rw-r--r--test/cpp/server/server_builder_test.cc6
-rw-r--r--test/cpp/server/server_request_call_test.cc10
-rw-r--r--test/cpp/test/server_context_test_spouse_test.cc4
-rw-r--r--test/cpp/thread_manager/thread_manager_test.cc3
-rw-r--r--test/cpp/util/byte_buffer_proto_helper.h4
-rw-r--r--test/cpp/util/byte_buffer_test.cc4
-rw-r--r--test/cpp/util/cli_call.cc6
-rw-r--r--test/cpp/util/cli_call.h10
-rw-r--r--test/cpp/util/cli_call_test.cc12
-rw-r--r--test/cpp/util/cli_credentials.h4
-rw-r--r--test/cpp/util/config_grpc_cli.h2
-rw-r--r--test/cpp/util/create_test_channel.cc4
-rw-r--r--test/cpp/util/create_test_channel.h2
-rw-r--r--test/cpp/util/error_details_test.cc2
-rw-r--r--test/cpp/util/grpc_cli.cc2
-rw-r--r--test/cpp/util/grpc_tool.cc10
-rw-r--r--test/cpp/util/grpc_tool.h2
-rw-r--r--test/cpp/util/grpc_tool_test.cc14
-rw-r--r--test/cpp/util/metrics_server.cc4
-rw-r--r--test/cpp/util/proto_file_parser.cc2
-rw-r--r--test/cpp/util/proto_file_parser.h2
-rw-r--r--test/cpp/util/proto_reflection_descriptor_database.h4
-rw-r--r--test/cpp/util/service_describer.h2
-rw-r--r--test/cpp/util/slice_test.cc2
-rw-r--r--test/cpp/util/status_test.cc2
-rw-r--r--test/cpp/util/string_ref_helper.h2
-rw-r--r--test/cpp/util/string_ref_test.cc2
-rw-r--r--test/cpp/util/test_credentials_provider.h6
-rw-r--r--test/cpp/util/time_test.cc2
-rwxr-xr-xtest/distrib/csharp/run_distrib_test.sh5
-rwxr-xr-xtest/distrib/php/run_distrib_test.sh2
169 files changed, 1031 insertions, 730 deletions
diff --git a/test/core/client_channel/parse_address_test.cc b/test/core/client_channel/parse_address_test.cc
index 373ed76cbe..ae157fbb8b 100644
--- a/test/core/client_channel/parse_address_test.cc
+++ b/test/core/client_channel/parse_address_test.cc
@@ -18,6 +18,7 @@
#include "src/core/ext/filters/client_channel/parse_address.h"
#include "src/core/lib/iomgr/sockaddr.h"
+#include "src/core/lib/iomgr/socket_utils.h"
#include <string.h>
#ifdef GRPC_HAVE_UNIX_SOCKET
@@ -58,16 +59,15 @@ static void test_grpc_parse_ipv4(const char* uri_text, const char* host,
grpc_core::ExecCtx exec_ctx;
grpc_uri* uri = grpc_uri_parse(uri_text, 0);
grpc_resolved_address addr;
- char ntop_buf[INET_ADDRSTRLEN];
+ char ntop_buf[GRPC_INET_ADDRSTRLEN];
GPR_ASSERT(1 == grpc_parse_ipv4(uri, &addr));
- struct sockaddr_in* addr_in =
- reinterpret_cast<struct sockaddr_in*>(addr.addr);
- GPR_ASSERT(AF_INET == addr_in->sin_family);
- GPR_ASSERT(nullptr != grpc_inet_ntop(AF_INET, &addr_in->sin_addr, ntop_buf,
- sizeof(ntop_buf)));
+ grpc_sockaddr_in* addr_in = reinterpret_cast<grpc_sockaddr_in*>(addr.addr);
+ GPR_ASSERT(GRPC_AF_INET == addr_in->sin_family);
+ GPR_ASSERT(nullptr != grpc_inet_ntop(GRPC_AF_INET, &addr_in->sin_addr,
+ ntop_buf, sizeof(ntop_buf)));
GPR_ASSERT(0 == strcmp(ntop_buf, host));
- GPR_ASSERT(ntohs(addr_in->sin_port) == port);
+ GPR_ASSERT(grpc_ntohs(addr_in->sin_port) == port);
grpc_uri_destroy(uri);
}
@@ -77,16 +77,15 @@ static void test_grpc_parse_ipv6(const char* uri_text, const char* host,
grpc_core::ExecCtx exec_ctx;
grpc_uri* uri = grpc_uri_parse(uri_text, 0);
grpc_resolved_address addr;
- char ntop_buf[INET6_ADDRSTRLEN];
+ char ntop_buf[GRPC_INET6_ADDRSTRLEN];
GPR_ASSERT(1 == grpc_parse_ipv6(uri, &addr));
- struct sockaddr_in6* addr_in6 =
- reinterpret_cast<struct sockaddr_in6*>(addr.addr);
- GPR_ASSERT(AF_INET6 == addr_in6->sin6_family);
- GPR_ASSERT(nullptr != grpc_inet_ntop(AF_INET6, &addr_in6->sin6_addr, ntop_buf,
- sizeof(ntop_buf)));
+ grpc_sockaddr_in6* addr_in6 = reinterpret_cast<grpc_sockaddr_in6*>(addr.addr);
+ GPR_ASSERT(GRPC_AF_INET6 == addr_in6->sin6_family);
+ GPR_ASSERT(nullptr != grpc_inet_ntop(GRPC_AF_INET6, &addr_in6->sin6_addr,
+ ntop_buf, sizeof(ntop_buf)));
GPR_ASSERT(0 == strcmp(ntop_buf, host));
- GPR_ASSERT(ntohs(addr_in6->sin6_port) == port);
+ GPR_ASSERT(grpc_ntohs(addr_in6->sin6_port) == port);
GPR_ASSERT(addr_in6->sin6_scope_id == scope_id);
grpc_uri_destroy(uri);
diff --git a/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc b/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc
index 966fb1d14b..e34aa2e676 100644
--- a/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc
+++ b/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc
@@ -57,6 +57,9 @@ static void my_resolve_address(const char* addr, const char* default_port,
GRPC_CLOSURE_SCHED(on_done, error);
}
+static grpc_address_resolver_vtable test_resolver = {my_resolve_address,
+ nullptr};
+
static grpc_ares_request* my_dns_lookup_ares(
const char* dns_server, const char* addr, const char* default_port,
grpc_pollset_set* interested_parties, grpc_closure* on_done,
@@ -143,7 +146,7 @@ int main(int argc, char** argv) {
grpc_init();
gpr_mu_init(&g_mu);
g_combiner = grpc_combiner_create();
- grpc_resolve_address = my_resolve_address;
+ grpc_set_resolver_impl(&test_resolver);
grpc_dns_lookup_ares = my_dns_lookup_ares;
grpc_channel_args* result = (grpc_channel_args*)1;
diff --git a/test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc b/test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc
index 9402a605b3..01c61a9f18 100644
--- a/test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc
+++ b/test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc
@@ -28,12 +28,10 @@
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "test/core/util/test_config.h"
-static grpc_combiner* g_combiner;
+extern grpc_address_resolver_vtable* grpc_resolve_address_impl;
+static grpc_address_resolver_vtable* default_resolve_address;
-static void (*g_default_grpc_resolve_address)(
- const char* name, const char* default_port,
- grpc_pollset_set* interested_parties, grpc_closure* on_done,
- grpc_resolved_addresses** addrs);
+static grpc_combiner* g_combiner;
grpc_ares_request* (*g_default_dns_lookup_ares)(
const char* dns_server, const char* name, const char* default_port,
@@ -52,18 +50,28 @@ struct iomgr_args {
grpc_pollset_set* pollset_set;
} g_iomgr_args;
-// Wrapper around g_default_grpc_resolve_address in order to count the number of
+// Wrapper around default resolve_address in order to count the number of
// times we incur in a system-level name resolution.
static void test_resolve_address_impl(const char* name,
const char* default_port,
grpc_pollset_set* interested_parties,
grpc_closure* on_done,
grpc_resolved_addresses** addrs) {
- g_default_grpc_resolve_address(name, default_port, g_iomgr_args.pollset_set,
- on_done, addrs);
+ default_resolve_address->resolve_address(
+ name, default_port, g_iomgr_args.pollset_set, on_done, addrs);
++g_resolution_count;
}
+static grpc_error* test_blocking_resolve_address_impl(
+ const char* name, const char* default_port,
+ grpc_resolved_addresses** addresses) {
+ return default_resolve_address->blocking_resolve_address(name, default_port,
+ addresses);
+}
+
+static grpc_address_resolver_vtable test_resolver = {
+ test_resolve_address_impl, test_blocking_resolve_address_impl};
+
grpc_ares_request* test_dns_lookup_ares(
const char* dns_server, const char* name, const char* default_port,
grpc_pollset_set* interested_parties, grpc_closure* on_done,
@@ -285,11 +293,14 @@ int main(int argc, char** argv) {
g_combiner = grpc_combiner_create();
- const bool using_cares = (grpc_resolve_address == grpc_resolve_address_ares);
- g_default_grpc_resolve_address = grpc_resolve_address;
+ bool using_cares = false;
+#if GRPC_ARES == 1
+ using_cares = true;
+#endif
g_default_dns_lookup_ares = grpc_dns_lookup_ares;
grpc_dns_lookup_ares = test_dns_lookup_ares;
- grpc_resolve_address = test_resolve_address_impl;
+ default_resolve_address = grpc_resolve_address_impl;
+ grpc_set_resolver_impl(&test_resolver);
test_cooldown(using_cares);
diff --git a/test/core/compression/algorithm_test.cc b/test/core/compression/algorithm_test.cc
index 3dcddf3e67..8989a41989 100644
--- a/test/core/compression/algorithm_test.cc
+++ b/test/core/compression/algorithm_test.cc
@@ -24,6 +24,7 @@
#include <grpc/grpc.h>
#include <grpc/support/log.h>
+#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/transport/static_metadata.h"
#include "test/core/util/test_config.h"
diff --git a/test/core/debug/stats_test.cc b/test/core/debug/stats_test.cc
index e60e54b2fd..949a88f8f0 100644
--- a/test/core/debug/stats_test.cc
+++ b/test/core/debug/stats_test.cc
@@ -47,22 +47,22 @@ class Snapshot {
TEST(StatsTest, IncCounters) {
for (int i = 0; i < GRPC_STATS_COUNTER_COUNT; i++) {
- Snapshot snapshot;
+ std::unique_ptr<Snapshot> snapshot(new Snapshot);
grpc_core::ExecCtx exec_ctx;
GRPC_STATS_INC_COUNTER((grpc_stats_counters)i);
- EXPECT_EQ(snapshot.delta().counters[i], 1);
+ EXPECT_EQ(snapshot->delta().counters[i], 1);
}
}
TEST(StatsTest, IncSpecificCounter) {
- Snapshot snapshot;
+ std::unique_ptr<Snapshot> snapshot(new Snapshot);
grpc_core::ExecCtx exec_ctx;
GRPC_STATS_INC_SYSCALL_POLL();
- EXPECT_EQ(snapshot.delta().counters[GRPC_STATS_COUNTER_SYSCALL_POLL], 1);
+ EXPECT_EQ(snapshot->delta().counters[GRPC_STATS_COUNTER_SYSCALL_POLL], 1);
}
static int FindExpectedBucket(int i, int j) {
@@ -90,12 +90,12 @@ TEST_P(HistogramTest, IncHistogram) {
gpr_log(GPR_DEBUG, "expected_bucket:%d nvalues=%" PRIdPTR, expected_bucket,
test_values.size());
for (auto j : test_values) {
- Snapshot snapshot;
+ std::unique_ptr<Snapshot> snapshot(new Snapshot);
grpc_core::ExecCtx exec_ctx;
grpc_stats_inc_histogram[kHistogram](j);
- auto delta = snapshot.delta();
+ auto delta = snapshot->delta();
EXPECT_EQ(
delta
diff --git a/test/core/end2end/connection_refused_test.cc b/test/core/end2end/connection_refused_test.cc
index ff830b47cd..33812ec8e5 100644
--- a/test/core/end2end/connection_refused_test.cc
+++ b/test/core/end2end/connection_refused_test.cc
@@ -25,6 +25,7 @@
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/host_port.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/transport/metadata.h"
#include "src/core/lib/transport/service_config.h"
diff --git a/test/core/end2end/cq_verifier.cc b/test/core/end2end/cq_verifier.cc
index c3a3f43fe1..f7e64effcd 100644
--- a/test/core/end2end/cq_verifier.cc
+++ b/test/core/end2end/cq_verifier.cc
@@ -18,6 +18,7 @@
#include "test/core/end2end/cq_verifier.h"
+#include <inttypes.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
diff --git a/test/core/end2end/fixtures/http_proxy_fixture.cc b/test/core/end2end/fixtures/http_proxy_fixture.cc
index 58353376f3..f02fa9d998 100644
--- a/test/core/end2end/fixtures/http_proxy_fixture.cc
+++ b/test/core/end2end/fixtures/http_proxy_fixture.cc
@@ -535,10 +535,10 @@ grpc_end2end_http_proxy* grpc_end2end_http_proxy_create(
GPR_ASSERT(error == GRPC_ERROR_NONE);
// Bind to port.
grpc_resolved_address resolved_addr;
- struct sockaddr_in* addr =
- reinterpret_cast<struct sockaddr_in*>(resolved_addr.addr);
+ grpc_sockaddr_in* addr =
+ reinterpret_cast<grpc_sockaddr_in*>(resolved_addr.addr);
memset(&resolved_addr, 0, sizeof(resolved_addr));
- addr->sin_family = AF_INET;
+ addr->sin_family = GRPC_AF_INET;
grpc_sockaddr_set_port(&resolved_addr, proxy_port);
int port;
error = grpc_tcp_server_add_port(proxy->server, &resolved_addr, &port);
diff --git a/test/core/end2end/fuzzers/api_fuzzer.cc b/test/core/end2end/fuzzers/api_fuzzer.cc
index b6347fb1db..9ace7d04aa 100644
--- a/test/core/end2end/fuzzers/api_fuzzer.cc
+++ b/test/core/end2end/fuzzers/api_fuzzer.cc
@@ -426,6 +426,9 @@ void my_resolve_address(const char* addr, const char* default_port,
GRPC_CLOSURE_CREATE(finish_resolve, r, grpc_schedule_on_exec_ctx));
}
+static grpc_address_resolver_vtable fuzzer_resolver = {my_resolve_address,
+ nullptr};
+
grpc_ares_request* my_dns_lookup_ares(const char* dns_server, const char* addr,
const char* default_port,
grpc_pollset_set* interested_parties,
@@ -447,12 +450,6 @@ grpc_ares_request* my_dns_lookup_ares(const char* dns_server, const char* addr,
////////////////////////////////////////////////////////////////////////////////
// client connection
-// defined in tcp_client_posix.c
-extern void (*grpc_tcp_client_connect_impl)(
- grpc_closure* closure, grpc_endpoint** ep,
- grpc_pollset_set* interested_parties, const grpc_channel_args* channel_args,
- const grpc_resolved_address* addr, grpc_millis deadline);
-
static void sched_connect(grpc_closure* closure, grpc_endpoint** ep,
gpr_timespec deadline);
@@ -513,6 +510,8 @@ static void my_tcp_client_connect(grpc_closure* closure, grpc_endpoint** ep,
grpc_millis_to_timespec(deadline, GPR_CLOCK_MONOTONIC));
}
+grpc_tcp_client_vtable fuzz_tcp_client_vtable = {my_tcp_client_connect};
+
////////////////////////////////////////////////////////////////////////////////
// test driver
@@ -753,7 +752,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
if (squelch && grpc_trace_fuzzer == nullptr) gpr_set_log_function(dont_log);
gpr_free(grpc_trace_fuzzer);
input_stream inp = {data, data + size};
- grpc_tcp_client_connect_impl = my_tcp_client_connect;
+ grpc_set_tcp_client_impl(&fuzz_tcp_client_vtable);
gpr_now_impl = now_impl;
grpc_init();
grpc_timer_manager_set_threading(false);
@@ -761,7 +760,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
grpc_core::ExecCtx exec_ctx;
grpc_executor_set_threading(false);
}
- grpc_resolve_address = my_resolve_address;
+ grpc_set_resolver_impl(&fuzzer_resolver);
grpc_dns_lookup_ares = my_dns_lookup_ares;
GPR_ASSERT(g_channel == nullptr);
diff --git a/test/core/end2end/goaway_server_test.cc b/test/core/end2end/goaway_server_test.cc
index 09f0301c44..8ff14e2b85 100644
--- a/test/core/end2end/goaway_server_test.cc
+++ b/test/core/end2end/goaway_server_test.cc
@@ -21,6 +21,7 @@
including windows.h on Windows, uv.h must be included before other system
headers. Therefore, sockaddr.h must always be included first */
#include "src/core/lib/iomgr/sockaddr.h"
+#include "src/core/lib/iomgr/socket_utils.h"
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
@@ -35,14 +36,13 @@
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
+extern grpc_address_resolver_vtable* grpc_resolve_address_impl;
+static grpc_address_resolver_vtable* default_resolver;
+
static void* tag(intptr_t i) { return (void*)i; }
static gpr_mu g_mu;
static int g_resolve_port = -1;
-static void (*iomgr_resolve_address)(const char* addr, const char* default_port,
- grpc_pollset_set* interested_parties,
- grpc_closure* on_done,
- grpc_resolved_addresses** addresses);
static grpc_ares_request* (*iomgr_dns_lookup_ares)(
const char* dns_server, const char* addr, const char* default_port,
@@ -61,8 +61,8 @@ static void my_resolve_address(const char* addr, const char* default_port,
grpc_closure* on_done,
grpc_resolved_addresses** addrs) {
if (0 != strcmp(addr, "test")) {
- iomgr_resolve_address(addr, default_port, interested_parties, on_done,
- addrs);
+ default_resolver->resolve_address(addr, default_port, interested_parties,
+ on_done, addrs);
return;
}
@@ -77,17 +77,27 @@ static void my_resolve_address(const char* addr, const char* default_port,
(*addrs)->addrs = static_cast<grpc_resolved_address*>(
gpr_malloc(sizeof(*(*addrs)->addrs)));
memset((*addrs)->addrs, 0, sizeof(*(*addrs)->addrs));
- struct sockaddr_in* sa =
- reinterpret_cast<struct sockaddr_in*>((*addrs)->addrs[0].addr);
- sa->sin_family = AF_INET;
- sa->sin_addr.s_addr = htonl(0x7f000001);
- sa->sin_port = htons(static_cast<uint16_t>(g_resolve_port));
+ grpc_sockaddr_in* sa =
+ reinterpret_cast<grpc_sockaddr_in*>((*addrs)->addrs[0].addr);
+ sa->sin_family = GRPC_AF_INET;
+ sa->sin_addr.s_addr = 0x100007f;
+ sa->sin_port = grpc_htons(static_cast<uint16_t>(g_resolve_port));
(*addrs)->addrs[0].len = sizeof(*sa);
gpr_mu_unlock(&g_mu);
}
GRPC_CLOSURE_SCHED(on_done, error);
}
+static grpc_error* my_blocking_resolve_address(
+ const char* name, const char* default_port,
+ grpc_resolved_addresses** addresses) {
+ return default_resolver->blocking_resolve_address(name, default_port,
+ addresses);
+}
+
+static grpc_address_resolver_vtable test_resolver = {
+ my_resolve_address, my_blocking_resolve_address};
+
static grpc_ares_request* my_dns_lookup_ares(
const char* dns_server, const char* addr, const char* default_port,
grpc_pollset_set* interested_parties, grpc_closure* on_done,
@@ -106,11 +116,11 @@ static grpc_ares_request* my_dns_lookup_ares(
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Forced Failure");
} else {
*lb_addrs = grpc_lb_addresses_create(1, nullptr);
- struct sockaddr_in* sa = static_cast<struct sockaddr_in*>(
- gpr_zalloc(sizeof(struct sockaddr_in)));
- sa->sin_family = AF_INET;
- sa->sin_addr.s_addr = htonl(0x7f000001);
- sa->sin_port = htons(static_cast<uint16_t>(g_resolve_port));
+ grpc_sockaddr_in* sa =
+ static_cast<grpc_sockaddr_in*>(gpr_zalloc(sizeof(grpc_sockaddr_in)));
+ sa->sin_family = GRPC_AF_INET;
+ sa->sin_addr.s_addr = 0x100007f;
+ sa->sin_port = grpc_htons(static_cast<uint16_t>(g_resolve_port));
grpc_lb_addresses_set_address(*lb_addrs, 0, sa, sizeof(*sa), false, nullptr,
nullptr);
gpr_free(sa);
@@ -130,9 +140,9 @@ int main(int argc, char** argv) {
gpr_mu_init(&g_mu);
grpc_init();
- iomgr_resolve_address = grpc_resolve_address;
+ default_resolver = grpc_resolve_address_impl;
+ grpc_set_resolver_impl(&test_resolver);
iomgr_dns_lookup_ares = grpc_dns_lookup_ares;
- grpc_resolve_address = my_resolve_address;
grpc_dns_lookup_ares = my_dns_lookup_ares;
int was_cancelled1;
diff --git a/test/core/end2end/tests/bad_ping.cc b/test/core/end2end/tests/bad_ping.cc
index f305ea5703..95f72ca4c8 100644
--- a/test/core/end2end/tests/bad_ping.cc
+++ b/test/core/end2end/tests/bad_ping.cc
@@ -155,14 +155,15 @@ static void test_bad_ping(grpc_end2end_test_config config) {
cq_verify(cqv);
// Send too many pings to the server to trigger the punishment:
- // Each ping will trigger a ping strike, and we need at least MAX_PING_STRIKES
- // strikes to trigger the punishment. So (MAX_PING_STRIKES + 1) pings are
+ // The first ping will let server mark its last_recv time. Afterwards, each
+ // ping will trigger a ping strike, and we need at least MAX_PING_STRIKES
+ // strikes to trigger the punishment. So (MAX_PING_STRIKES + 2) pings are
// needed here.
int i;
- for (i = 1; i <= MAX_PING_STRIKES + 1; i++) {
+ for (i = 1; i <= MAX_PING_STRIKES + 2; i++) {
grpc_channel_ping(f.client, f.cq, tag(200 + i), nullptr);
CQ_EXPECT_COMPLETION(cqv, tag(200 + i), 1);
- if (i == MAX_PING_STRIKES + 1) {
+ if (i == MAX_PING_STRIKES + 2) {
CQ_EXPECT_COMPLETION(cqv, tag(1), 1);
}
cq_verify(cqv);
diff --git a/test/core/end2end/tests/cancel_after_accept.cc b/test/core/end2end/tests/cancel_after_accept.cc
index ee1a0bbccc..e94ea51a75 100644
--- a/test/core/end2end/tests/cancel_after_accept.cc
+++ b/test/core/end2end/tests/cancel_after_accept.cc
@@ -27,6 +27,7 @@
#include <grpc/support/time.h>
#include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/transport/metadata.h"
#include "src/core/lib/transport/service_config.h"
diff --git a/test/core/end2end/tests/cancel_after_invoke.cc b/test/core/end2end/tests/cancel_after_invoke.cc
index a3e36e0e3f..72f724281e 100644
--- a/test/core/end2end/tests/cancel_after_invoke.cc
+++ b/test/core/end2end/tests/cancel_after_invoke.cc
@@ -18,6 +18,7 @@
#include "test/core/end2end/end2end_tests.h"
+#include <inttypes.h>
#include <stdio.h>
#include <string.h>
diff --git a/test/core/end2end/tests/cancel_after_round_trip.cc b/test/core/end2end/tests/cancel_after_round_trip.cc
index bf3be1c8b7..4890b3013f 100644
--- a/test/core/end2end/tests/cancel_after_round_trip.cc
+++ b/test/core/end2end/tests/cancel_after_round_trip.cc
@@ -27,6 +27,7 @@
#include <grpc/support/time.h>
#include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/transport/metadata.h"
#include "src/core/lib/transport/service_config.h"
diff --git a/test/core/end2end/tests/cancel_before_invoke.cc b/test/core/end2end/tests/cancel_before_invoke.cc
index e9fa0466fb..c7d3ed5a4f 100644
--- a/test/core/end2end/tests/cancel_before_invoke.cc
+++ b/test/core/end2end/tests/cancel_before_invoke.cc
@@ -18,6 +18,7 @@
#include "test/core/end2end/end2end_tests.h"
+#include <inttypes.h>
#include <stdio.h>
#include <string.h>
diff --git a/test/core/end2end/tests/cancel_with_status.cc b/test/core/end2end/tests/cancel_with_status.cc
index 6820ba5a2f..887da85939 100644
--- a/test/core/end2end/tests/cancel_with_status.cc
+++ b/test/core/end2end/tests/cancel_with_status.cc
@@ -18,6 +18,7 @@
#include "test/core/end2end/end2end_tests.h"
+#include <inttypes.h>
#include <stdio.h>
#include <string.h>
diff --git a/test/core/end2end/tests/max_message_length.cc b/test/core/end2end/tests/max_message_length.cc
index 3dd1737793..fa5b3b6e9b 100644
--- a/test/core/end2end/tests/max_message_length.cc
+++ b/test/core/end2end/tests/max_message_length.cc
@@ -27,6 +27,7 @@
#include <grpc/support/time.h>
#include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/transport/metadata.h"
#include "src/core/lib/transport/service_config.h"
diff --git a/test/core/end2end/tests/negative_deadline.cc b/test/core/end2end/tests/negative_deadline.cc
index b28bee0fb2..dce3a02d25 100644
--- a/test/core/end2end/tests/negative_deadline.cc
+++ b/test/core/end2end/tests/negative_deadline.cc
@@ -18,6 +18,7 @@
#include "test/core/end2end/end2end_tests.h"
+#include <inttypes.h>
#include <stdio.h>
#include <string.h>
diff --git a/test/core/end2end/tests/request_with_flags.cc b/test/core/end2end/tests/request_with_flags.cc
index 4a54318d0f..c52482470e 100644
--- a/test/core/end2end/tests/request_with_flags.cc
+++ b/test/core/end2end/tests/request_with_flags.cc
@@ -48,14 +48,12 @@ static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
-static gpr_timespec five_seconds_from_now(void) {
- return n_seconds_from_now(5);
-}
+static gpr_timespec one_second_from_now(void) { return n_seconds_from_now(1); }
static void drain_cq(grpc_completion_queue* cq) {
grpc_event ev;
do {
- ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr);
+ ev = grpc_completion_queue_next(cq, one_second_from_now(), nullptr);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@@ -109,7 +107,7 @@ static void test_invoke_request_with_flags(
grpc_slice details;
grpc_call_error expectation;
- gpr_timespec deadline = five_seconds_from_now();
+ gpr_timespec deadline = one_second_from_now();
c = grpc_channel_create_call(
f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),
diff --git a/test/core/end2end/tests/shutdown_finishes_calls.cc b/test/core/end2end/tests/shutdown_finishes_calls.cc
index 34c4ebbf0a..28728ef46c 100644
--- a/test/core/end2end/tests/shutdown_finishes_calls.cc
+++ b/test/core/end2end/tests/shutdown_finishes_calls.cc
@@ -150,6 +150,13 @@ static void test_early_server_shutdown_finishes_inflight_calls(
nullptr);
GPR_ASSERT(GRPC_CALL_OK == error);
+ /* Make sure we don't shutdown the server while HTTP/2 PING frames are still
+ * being exchanged on the newly established connection. It can lead to
+ * failures when testing with HTTP proxy. See
+ * https://github.com/grpc/grpc/issues/14471
+ */
+ gpr_sleep_until(n_seconds_from_now(1));
+
/* shutdown and destroy the server */
grpc_server_shutdown_and_notify(f.server, f.cq, tag(1000));
grpc_server_cancel_all_calls(f.server);
diff --git a/test/core/gpr/mpscq_test.cc b/test/core/gpr/mpscq_test.cc
index 8c0873941f..f51bdf8c50 100644
--- a/test/core/gpr/mpscq_test.cc
+++ b/test/core/gpr/mpscq_test.cc
@@ -18,6 +18,7 @@
#include "src/core/lib/gpr/mpscq.h"
+#include <inttypes.h>
#include <stdlib.h>
#include <grpc/support/alloc.h>
diff --git a/test/core/gpr/time_test.cc b/test/core/gpr/time_test.cc
index c80aac649d..6f070f58df 100644
--- a/test/core/gpr/time_test.cc
+++ b/test/core/gpr/time_test.cc
@@ -21,6 +21,7 @@
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include <grpc/support/time.h>
+#include <inttypes.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/test/core/http/httpcli_test.cc b/test/core/http/httpcli_test.cc
index 346568fcf2..16448d9e14 100644
--- a/test/core/http/httpcli_test.cc
+++ b/test/core/http/httpcli_test.cc
@@ -47,6 +47,7 @@ static void on_finish(void* arg, grpc_error* error) {
"<body><p>This is a test</p></body></html>";
grpc_http_response* response = static_cast<grpc_http_response*>(arg);
GPR_ASSERT(response);
+ gpr_log(GPR_INFO, "response status %d", response->status);
GPR_ASSERT(response->status == 200);
GPR_ASSERT(response->body_length == strlen(expect));
GPR_ASSERT(0 == memcmp(expect, response->body, response->body_length));
diff --git a/test/core/http/httpscli_test.cc b/test/core/http/httpscli_test.cc
index a38f306ef3..b8f2e438a4 100644
--- a/test/core/http/httpscli_test.cc
+++ b/test/core/http/httpscli_test.cc
@@ -49,6 +49,7 @@ static void on_finish(void* arg, grpc_error* error) {
"<body><p>This is a test</p></body></html>";
grpc_http_response* response = static_cast<grpc_http_response*>(arg);
GPR_ASSERT(response);
+ gpr_log(GPR_INFO, "response status %d", response->status);
GPR_ASSERT(response->status == 200);
GPR_ASSERT(response->body_length == strlen(expect));
GPR_ASSERT(0 == memcmp(expect, response->body, response->body_length));
diff --git a/test/core/iomgr/resource_quota_test.cc b/test/core/iomgr/resource_quota_test.cc
index 921a24ebf2..059ff7b5f8 100644
--- a/test/core/iomgr/resource_quota_test.cc
+++ b/test/core/iomgr/resource_quota_test.cc
@@ -21,6 +21,7 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
+#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/slice/slice_internal.h"
#include "test/core/util/test_config.h"
diff --git a/test/core/iomgr/sockaddr_utils_test.cc b/test/core/iomgr/sockaddr_utils_test.cc
index 32d2a384bd..aa9ece3081 100644
--- a/test/core/iomgr/sockaddr_utils_test.cc
+++ b/test/core/iomgr/sockaddr_utils_test.cc
@@ -22,6 +22,7 @@
headers. Therefore, sockaddr.h must always be included first */
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/iomgr/sockaddr.h"
+#include "src/core/lib/iomgr/socket_utils.h"
#include <errno.h>
#include <string.h>
@@ -33,34 +34,33 @@
static grpc_resolved_address make_addr4(const uint8_t* data, size_t data_len) {
grpc_resolved_address resolved_addr4;
- struct sockaddr_in* addr4 =
- reinterpret_cast<struct sockaddr_in*>(resolved_addr4.addr);
+ grpc_sockaddr_in* addr4 =
+ reinterpret_cast<grpc_sockaddr_in*>(resolved_addr4.addr);
memset(&resolved_addr4, 0, sizeof(resolved_addr4));
- addr4->sin_family = AF_INET;
+ addr4->sin_family = GRPC_AF_INET;
GPR_ASSERT(data_len == sizeof(addr4->sin_addr.s_addr));
memcpy(&addr4->sin_addr.s_addr, data, data_len);
- addr4->sin_port = htons(12345);
- resolved_addr4.len = sizeof(struct sockaddr_in);
+ addr4->sin_port = grpc_htons(12345);
+ resolved_addr4.len = sizeof(grpc_sockaddr_in);
return resolved_addr4;
}
static grpc_resolved_address make_addr6(const uint8_t* data, size_t data_len) {
grpc_resolved_address resolved_addr6;
- struct sockaddr_in6* addr6 =
- reinterpret_cast<struct sockaddr_in6*>(resolved_addr6.addr);
+ grpc_sockaddr_in6* addr6 =
+ reinterpret_cast<grpc_sockaddr_in6*>(resolved_addr6.addr);
memset(&resolved_addr6, 0, sizeof(resolved_addr6));
- addr6->sin6_family = AF_INET6;
+ addr6->sin6_family = GRPC_AF_INET6;
GPR_ASSERT(data_len == sizeof(addr6->sin6_addr.s6_addr));
memcpy(&addr6->sin6_addr.s6_addr, data, data_len);
- addr6->sin6_port = htons(12345);
- resolved_addr6.len = sizeof(struct sockaddr_in6);
+ addr6->sin6_port = grpc_htons(12345);
+ resolved_addr6.len = sizeof(grpc_sockaddr_in6);
return resolved_addr6;
}
static void set_addr6_scope_id(grpc_resolved_address* addr, uint32_t scope_id) {
- struct sockaddr_in6* addr6 =
- reinterpret_cast<struct sockaddr_in6*>(addr->addr);
- GPR_ASSERT(addr6->sin6_family == AF_INET6);
+ grpc_sockaddr_in6* addr6 = reinterpret_cast<grpc_sockaddr_in6*>(addr->addr);
+ GPR_ASSERT(addr6->sin6_family == GRPC_AF_INET6);
addr6->sin6_scope_id = scope_id;
}
@@ -131,9 +131,9 @@ static void test_sockaddr_is_wildcard(void) {
grpc_resolved_address wild6;
grpc_resolved_address wild_mapped;
grpc_resolved_address dummy;
- struct sockaddr_in* wild4_addr;
- struct sockaddr_in6* wild6_addr;
- struct sockaddr_in6* wild_mapped_addr;
+ grpc_sockaddr_in* wild4_addr;
+ grpc_sockaddr_in6* wild6_addr;
+ grpc_sockaddr_in6* wild_mapped_addr;
int port;
gpr_log(GPR_INFO, "%s", "test_sockaddr_is_wildcard");
@@ -146,7 +146,7 @@ static void test_sockaddr_is_wildcard(void) {
port = -1;
GPR_ASSERT(grpc_sockaddr_is_wildcard(&wild4, &port));
GPR_ASSERT(port == 555);
- wild4_addr = reinterpret_cast<struct sockaddr_in*>(&wild4.addr);
+ wild4_addr = reinterpret_cast<grpc_sockaddr_in*>(&wild4.addr);
memset(&wild4_addr->sin_addr.s_addr, 0xbd, 1);
GPR_ASSERT(!grpc_sockaddr_is_wildcard(&wild4, &port));
@@ -154,7 +154,7 @@ static void test_sockaddr_is_wildcard(void) {
port = -1;
GPR_ASSERT(grpc_sockaddr_is_wildcard(&wild6, &port));
GPR_ASSERT(port == 555);
- wild6_addr = reinterpret_cast<struct sockaddr_in6*>(&wild6.addr);
+ wild6_addr = reinterpret_cast<grpc_sockaddr_in6*>(&wild6.addr);
memset(&wild6_addr->sin6_addr.s6_addr, 0xbd, 1);
GPR_ASSERT(!grpc_sockaddr_is_wildcard(&wild6, &port));
@@ -162,7 +162,7 @@ static void test_sockaddr_is_wildcard(void) {
port = -1;
GPR_ASSERT(grpc_sockaddr_is_wildcard(&wild_mapped, &port));
GPR_ASSERT(port == 555);
- wild_mapped_addr = reinterpret_cast<struct sockaddr_in6*>(&wild_mapped.addr);
+ wild_mapped_addr = reinterpret_cast<grpc_sockaddr_in6*>(&wild_mapped.addr);
memset(&wild_mapped_addr->sin6_addr.s6_addr, 0xbd, 1);
GPR_ASSERT(!grpc_sockaddr_is_wildcard(&wild_mapped, &port));
@@ -200,7 +200,7 @@ static void test_sockaddr_to_string(void) {
grpc_resolved_address input4;
grpc_resolved_address input6;
grpc_resolved_address dummy;
- struct sockaddr* dummy_addr;
+ grpc_sockaddr* dummy_addr;
gpr_log(GPR_INFO, "%s", "test_sockaddr_to_string");
@@ -237,7 +237,7 @@ static void test_sockaddr_to_string(void) {
expect_sockaddr_uri("ipv6:[::fffe:c000:263]:12345", &input6);
memset(&dummy, 0, sizeof(dummy));
- dummy_addr = reinterpret_cast<struct sockaddr*>(dummy.addr);
+ dummy_addr = reinterpret_cast<grpc_sockaddr*>(dummy.addr);
dummy_addr->sa_family = 123;
expect_sockaddr_str("(sockaddr family=123)", &dummy, 0);
expect_sockaddr_str("(sockaddr family=123)", &dummy, 1);
@@ -248,7 +248,7 @@ static void test_sockaddr_set_get_port(void) {
grpc_resolved_address input4;
grpc_resolved_address input6;
grpc_resolved_address dummy;
- struct sockaddr* dummy_addr;
+ grpc_sockaddr* dummy_addr;
gpr_log(GPR_DEBUG, "test_sockaddr_set_get_port");
@@ -263,7 +263,7 @@ static void test_sockaddr_set_get_port(void) {
GPR_ASSERT(grpc_sockaddr_get_port(&input6) == 54321);
memset(&dummy, 0, sizeof(dummy));
- dummy_addr = reinterpret_cast<struct sockaddr*>(dummy.addr);
+ dummy_addr = reinterpret_cast<grpc_sockaddr*>(dummy.addr);
dummy_addr->sa_family = 123;
GPR_ASSERT(grpc_sockaddr_get_port(&dummy) == 0);
GPR_ASSERT(grpc_sockaddr_set_port(&dummy, 1234) == 0);
diff --git a/test/core/iomgr/timer_heap_test.cc b/test/core/iomgr/timer_heap_test.cc
index 08f5d632e3..ebe5e32f3a 100644
--- a/test/core/iomgr/timer_heap_test.cc
+++ b/test/core/iomgr/timer_heap_test.cc
@@ -18,9 +18,6 @@
#include "src/core/lib/iomgr/port.h"
-// This test only works with the generic timer implementation
-#ifdef GRPC_TIMER_USE_GENERIC
-
#include "src/core/lib/iomgr/timer_heap.h"
#include <stdlib.h>
@@ -299,9 +296,3 @@ int main(int argc, char** argv) {
return 0;
}
-
-#else /* GRPC_TIMER_USE_GENERIC */
-
-int main(int argc, char** argv) { return 1; }
-
-#endif /* GRPC_TIMER_USE_GENERIC */
diff --git a/test/core/iomgr/timer_list_test.cc b/test/core/iomgr/timer_list_test.cc
index deb8c4d87e..b1d919b292 100644
--- a/test/core/iomgr/timer_list_test.cc
+++ b/test/core/iomgr/timer_list_test.cc
@@ -19,8 +19,9 @@
#include "src/core/lib/iomgr/port.h"
// This test only works with the generic timer implementation
-#ifdef GRPC_TIMER_USE_GENERIC
+#ifndef GRPC_CUSTOM_SOCKET
+#include "src/core/lib/iomgr/iomgr_internal.h"
#include "src/core/lib/iomgr/timer.h"
#include <string.h>
@@ -153,15 +154,19 @@ void destruction_test(void) {
int main(int argc, char** argv) {
grpc_test_init(argc, argv);
grpc_core::ExecCtx::GlobalInit();
+ grpc_core::ExecCtx exec_ctx;
+ grpc_determine_iomgr_platform();
+ grpc_iomgr_platform_init();
gpr_set_log_verbosity(GPR_LOG_SEVERITY_DEBUG);
add_test();
destruction_test();
+ grpc_iomgr_platform_shutdown();
grpc_core::ExecCtx::GlobalShutdown();
return 0;
}
-#else /* GRPC_TIMER_USE_GENERIC */
+#else /* GRPC_CUSTOM_SOCKET */
int main(int argc, char** argv) { return 1; }
-#endif /* GRPC_TIMER_USE_GENERIC */
+#endif /* GRPC_CUSTOM_SOCKET */
diff --git a/test/core/iomgr/udp_server_test.cc b/test/core/iomgr/udp_server_test.cc
index 13cbf2f6df..60f293972e 100644
--- a/test/core/iomgr/udp_server_test.cc
+++ b/test/core/iomgr/udp_server_test.cc
@@ -36,6 +36,7 @@
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/useful.h"
+#include "src/core/lib/gprpp/memory.h"
#include "src/core/lib/iomgr/ev_posix.h"
#include "src/core/lib/iomgr/iomgr.h"
#include "src/core/lib/iomgr/socket_factory_posix.h"
@@ -54,42 +55,70 @@ static int g_number_of_starts = 0;
int rcv_buf_size = 1024;
int snd_buf_size = 1024;
-static void on_start(grpc_fd* emfd, void* user_data) { g_number_of_starts++; }
+class TestGrpcUdpHandler : public GrpcUdpHandler {
+ public:
+ TestGrpcUdpHandler(grpc_fd* emfd, void* user_data)
+ : GrpcUdpHandler(emfd, user_data), emfd_(emfd) {
+ g_number_of_starts++;
+ }
+ ~TestGrpcUdpHandler() override {}
-static bool on_read(grpc_fd* emfd) {
- char read_buffer[512];
- ssize_t byte_count;
+ protected:
+ bool Read() override {
+ char read_buffer[512];
+ ssize_t byte_count;
- gpr_mu_lock(g_mu);
- byte_count =
- recv(grpc_fd_wrapped_fd(emfd), read_buffer, sizeof(read_buffer), 0);
+ gpr_mu_lock(g_mu);
+ byte_count =
+ recv(grpc_fd_wrapped_fd(emfd()), read_buffer, sizeof(read_buffer), 0);
- g_number_of_reads++;
- g_number_of_bytes_read += static_cast<int>(byte_count);
+ g_number_of_reads++;
+ g_number_of_bytes_read += static_cast<int>(byte_count);
- GPR_ASSERT(
- GRPC_LOG_IF_ERROR("pollset_kick", grpc_pollset_kick(g_pollset, nullptr)));
- gpr_mu_unlock(g_mu);
- return false;
-}
+ GPR_ASSERT(GRPC_LOG_IF_ERROR("pollset_kick",
+ grpc_pollset_kick(g_pollset, nullptr)));
+ gpr_mu_unlock(g_mu);
+ return false;
+ }
-static void on_write(grpc_fd* emfd, void* user_data,
- grpc_closure* notify_on_write_closure) {
- gpr_mu_lock(g_mu);
- g_number_of_writes++;
+ void OnCanWrite(void* user_data,
+ grpc_closure* notify_on_write_closure) override {
+ gpr_mu_lock(g_mu);
+ g_number_of_writes++;
- GPR_ASSERT(
- GRPC_LOG_IF_ERROR("pollset_kick", grpc_pollset_kick(g_pollset, nullptr)));
- gpr_mu_unlock(g_mu);
-}
+ GPR_ASSERT(GRPC_LOG_IF_ERROR("pollset_kick",
+ grpc_pollset_kick(g_pollset, nullptr)));
+ gpr_mu_unlock(g_mu);
+ }
-static void on_fd_orphaned(grpc_fd* emfd, grpc_closure* closure,
- void* user_data) {
- gpr_log(GPR_INFO, "gRPC FD about to be orphaned: %d",
- grpc_fd_wrapped_fd(emfd));
- GRPC_CLOSURE_SCHED(closure, GRPC_ERROR_NONE);
- g_number_of_orphan_calls++;
-}
+ void OnFdAboutToOrphan(grpc_closure* orphan_fd_closure,
+ void* user_data) override {
+ gpr_log(GPR_INFO, "gRPC FD about to be orphaned: %d",
+ grpc_fd_wrapped_fd(emfd()));
+ GRPC_CLOSURE_SCHED(orphan_fd_closure, GRPC_ERROR_NONE);
+ g_number_of_orphan_calls++;
+ }
+
+ grpc_fd* emfd() { return emfd_; }
+
+ private:
+ grpc_fd* emfd_;
+};
+
+class TestGrpcUdpHandlerFactory : public GrpcUdpHandlerFactory {
+ public:
+ GrpcUdpHandler* CreateUdpHandler(grpc_fd* emfd, void* user_data) override {
+ gpr_log(GPR_INFO, "create udp handler for fd %d", grpc_fd_wrapped_fd(emfd));
+ return grpc_core::New<TestGrpcUdpHandler>(emfd, user_data);
+ }
+
+ void DestroyUdpHandler(GrpcUdpHandler* handler) override {
+ gpr_log(GPR_INFO, "Destroy handler");
+ grpc_core::Delete(reinterpret_cast<TestGrpcUdpHandler*>(handler));
+ }
+};
+
+TestGrpcUdpHandlerFactory handler_factory;
struct test_socket_factory {
grpc_socket_factory base;
@@ -184,13 +213,12 @@ static void test_no_op_with_port(void) {
resolved_addr.len = sizeof(struct sockaddr_in);
addr->sin_family = AF_INET;
GPR_ASSERT(grpc_udp_server_add_port(s, &resolved_addr, rcv_buf_size,
- snd_buf_size, on_start, on_read, on_write,
- on_fd_orphaned));
+ snd_buf_size, &handler_factory));
grpc_udp_server_destroy(s, nullptr);
- /* The server had a single FD, which should have been orphaned. */
- GPR_ASSERT(g_number_of_orphan_calls == 1);
+ /* The server haven't start listening, so no udp handler to be notified. */
+ GPR_ASSERT(g_number_of_orphan_calls == 0);
shutdown_and_destroy_pollset();
}
@@ -216,8 +244,7 @@ static void test_no_op_with_port_and_socket_factory(void) {
resolved_addr.len = sizeof(struct sockaddr_in);
addr->sin_family = AF_INET;
GPR_ASSERT(grpc_udp_server_add_port(s, &resolved_addr, rcv_buf_size,
- snd_buf_size, on_start, on_read, on_write,
- on_fd_orphaned));
+ snd_buf_size, &handler_factory));
GPR_ASSERT(socket_factory->number_of_socket_calls == 1);
GPR_ASSERT(socket_factory->number_of_bind_calls == 1);
@@ -225,8 +252,8 @@ static void test_no_op_with_port_and_socket_factory(void) {
grpc_socket_factory_unref(&socket_factory->base);
- /* The server had a single FD, which should have been orphaned. */
- GPR_ASSERT(g_number_of_orphan_calls == 1);
+ /* The server haven't start listening, so no udp handler to be notified. */
+ GPR_ASSERT(g_number_of_orphan_calls == 0);
shutdown_and_destroy_pollset();
}
@@ -244,8 +271,7 @@ static void test_no_op_with_port_and_start(void) {
resolved_addr.len = sizeof(struct sockaddr_in);
addr->sin_family = AF_INET;
GPR_ASSERT(grpc_udp_server_add_port(s, &resolved_addr, rcv_buf_size,
- snd_buf_size, on_start, on_read, on_write,
- on_fd_orphaned));
+ snd_buf_size, &handler_factory));
grpc_udp_server_start(s, nullptr, 0, nullptr);
GPR_ASSERT(g_number_of_starts == 1);
@@ -278,8 +304,7 @@ static void test_receive(int number_of_clients) {
resolved_addr.len = sizeof(struct sockaddr_storage);
addr->ss_family = AF_INET;
GPR_ASSERT(grpc_udp_server_add_port(s, &resolved_addr, rcv_buf_size,
- snd_buf_size, on_start, on_read, on_write,
- on_fd_orphaned));
+ snd_buf_size, &handler_factory));
svrfd = grpc_udp_server_get_fd(s, 0);
GPR_ASSERT(svrfd >= 0);
diff --git a/test/core/iomgr/wakeup_fd_cv_test.cc b/test/core/iomgr/wakeup_fd_cv_test.cc
index 9bd7c6e47e..f297a569d2 100644
--- a/test/core/iomgr/wakeup_fd_cv_test.cc
+++ b/test/core/iomgr/wakeup_fd_cv_test.cc
@@ -225,7 +225,7 @@ int main(int argc, char** argv) {
grpc_poll_function = &mock_poll;
gpr_mu_init(&poll_mu);
gpr_cv_init(&poll_cv);
-
+ grpc_determine_iomgr_platform();
grpc_iomgr_platform_init();
test_many_fds();
grpc_iomgr_platform_shutdown();
diff --git a/test/core/security/BUILD b/test/core/security/BUILD
index 68de2d169f..9db73b9123 100644
--- a/test/core/security/BUILD
+++ b/test/core/security/BUILD
@@ -167,6 +167,9 @@ grpc_cc_test(
srcs = ["check_gcp_environment_linux_test.cc"],
language = "C++",
deps = [
+ "//:alts_util",
+ "//:gpr",
+ "//:gpr_base",
"//:grpc",
],
)
@@ -176,6 +179,9 @@ grpc_cc_test(
srcs = ["check_gcp_environment_windows_test.cc"],
language = "C++",
deps = [
+ "//:alts_util",
+ "//:gpr",
+ "//:gpr_base",
"//:grpc",
],
)
@@ -185,6 +191,8 @@ grpc_cc_test(
srcs = ["grpc_alts_credentials_options_test.cc"],
language = "C++",
deps = [
+ "//:alts_util",
+ "//:gpr",
"//:grpc",
],
)
@@ -194,6 +202,11 @@ grpc_cc_test(
srcs = ["alts_security_connector_test.cc"],
language = "C++",
deps = [
+ "//:gpr",
"//:grpc",
+ "//:grpc_base_c",
+ "//:grpc_secure",
+ "//:tsi",
+ "//:tsi_interface",
],
)
diff --git a/test/core/slice/slice_hash_table_test.cc b/test/core/slice/slice_hash_table_test.cc
index 279b543098..43ddfe9bf2 100644
--- a/test/core/slice/slice_hash_table_test.cc
+++ b/test/core/slice/slice_hash_table_test.cc
@@ -28,6 +28,7 @@
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
+#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/slice/slice_internal.h"
#include "test/core/util/test_config.h"
diff --git a/test/core/slice/slice_test.cc b/test/core/slice/slice_test.cc
index 5a49793a9e..e683c41f31 100644
--- a/test/core/slice/slice_test.cc
+++ b/test/core/slice/slice_test.cc
@@ -16,8 +16,11 @@
*
*/
+#include <grpc/support/port_platform.h>
+
#include <grpc/slice.h>
+#include <inttypes.h>
#include <string.h>
#include <grpc/grpc.h>
diff --git a/test/core/slice/slice_weak_hash_table_test.cc b/test/core/slice/slice_weak_hash_table_test.cc
index 4711d2fd26..b0a243d572 100644
--- a/test/core/slice/slice_weak_hash_table_test.cc
+++ b/test/core/slice/slice_weak_hash_table_test.cc
@@ -28,6 +28,7 @@
#include <grpc/support/string_util.h>
#include "src/core/lib/gpr/useful.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/slice/slice_internal.h"
#include "test/core/util/test_config.h"
diff --git a/test/core/surface/concurrent_connectivity_test.cc b/test/core/surface/concurrent_connectivity_test.cc
index c1298b6636..fbc5ec4c54 100644
--- a/test/core/surface/concurrent_connectivity_test.cc
+++ b/test/core/surface/concurrent_connectivity_test.cc
@@ -124,14 +124,13 @@ void bad_server_thread(void* vargs) {
grpc_core::ExecCtx exec_ctx;
grpc_resolved_address resolved_addr;
- struct sockaddr_storage* addr =
- reinterpret_cast<struct sockaddr_storage*>(resolved_addr.addr);
+ grpc_sockaddr* addr = reinterpret_cast<grpc_sockaddr*>(resolved_addr.addr);
int port;
grpc_tcp_server* s;
grpc_error* error = grpc_tcp_server_create(nullptr, nullptr, &s);
GPR_ASSERT(error == GRPC_ERROR_NONE);
memset(&resolved_addr, 0, sizeof(resolved_addr));
- addr->ss_family = AF_INET;
+ addr->sa_family = GRPC_AF_INET;
error = grpc_tcp_server_add_port(s, &resolved_addr, &port);
GPR_ASSERT(GRPC_LOG_IF_ERROR("grpc_tcp_server_add_port", error));
GPR_ASSERT(port > 0);
diff --git a/test/core/transport/BUILD b/test/core/transport/BUILD
index 2c2d05b9ae..84fb3a1421 100644
--- a/test/core/transport/BUILD
+++ b/test/core/transport/BUILD
@@ -43,6 +43,9 @@ grpc_cc_test(
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
+ external_deps = [
+ "gtest",
+ ],
)
grpc_cc_test(
diff --git a/test/core/transport/byte_stream_test.cc b/test/core/transport/byte_stream_test.cc
index 6947d50976..df09637249 100644
--- a/test/core/transport/byte_stream_test.cc
+++ b/test/core/transport/byte_stream_test.cc
@@ -23,20 +23,23 @@
#include <grpc/support/log.h>
#include "src/core/lib/gpr/useful.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/slice/slice_internal.h"
#include "test/core/util/test_config.h"
+#include <gtest/gtest.h>
+
+namespace grpc_core {
+namespace {
+
//
-// grpc_slice_buffer_stream tests
+// SliceBufferByteStream tests
//
-static void not_called_closure(void* arg, grpc_error* error) {
- GPR_ASSERT(false);
-}
+void NotCalledClosure(void* arg, grpc_error* error) { GPR_ASSERT(false); }
-static void test_slice_buffer_stream_basic(void) {
- gpr_log(GPR_DEBUG, "test_slice_buffer_stream_basic");
+TEST(SliceBufferByteStream, Basic) {
grpc_core::ExecCtx exec_ctx;
// Create and populate slice buffer.
grpc_slice_buffer buffer;
@@ -49,28 +52,26 @@ static void test_slice_buffer_stream_basic(void) {
grpc_slice_buffer_add(&buffer, input[i]);
}
// Create byte stream.
- grpc_slice_buffer_stream stream;
- grpc_slice_buffer_stream_init(&stream, &buffer, 0);
- GPR_ASSERT(stream.base.length == 6);
+ SliceBufferByteStream stream(&buffer, 0);
+ grpc_slice_buffer_destroy_internal(&buffer);
+ EXPECT_EQ(6U, stream.length());
grpc_closure closure;
- GRPC_CLOSURE_INIT(&closure, not_called_closure, nullptr,
+ GRPC_CLOSURE_INIT(&closure, NotCalledClosure, nullptr,
grpc_schedule_on_exec_ctx);
- // Read each slice. Note that next() always returns synchronously.
+ // Read each slice. Note that Next() always returns synchronously.
for (size_t i = 0; i < GPR_ARRAY_SIZE(input); ++i) {
- GPR_ASSERT(grpc_byte_stream_next(&stream.base, ~(size_t)0, &closure));
+ ASSERT_TRUE(stream.Next(~(size_t)0, &closure));
grpc_slice output;
- grpc_error* error = grpc_byte_stream_pull(&stream.base, &output);
- GPR_ASSERT(error == GRPC_ERROR_NONE);
- GPR_ASSERT(grpc_slice_eq(input[i], output));
+ grpc_error* error = stream.Pull(&output);
+ EXPECT_TRUE(error == GRPC_ERROR_NONE);
+ EXPECT_TRUE(grpc_slice_eq(input[i], output));
grpc_slice_unref_internal(output);
}
// Clean up.
- grpc_byte_stream_destroy(&stream.base);
- grpc_slice_buffer_destroy_internal(&buffer);
+ stream.Orphan();
}
-static void test_slice_buffer_stream_shutdown(void) {
- gpr_log(GPR_DEBUG, "test_slice_buffer_stream_shutdown");
+TEST(SliceBufferByteStream, Shutdown) {
grpc_core::ExecCtx exec_ctx;
// Create and populate slice buffer.
grpc_slice_buffer buffer;
@@ -83,40 +84,38 @@ static void test_slice_buffer_stream_shutdown(void) {
grpc_slice_buffer_add(&buffer, input[i]);
}
// Create byte stream.
- grpc_slice_buffer_stream stream;
- grpc_slice_buffer_stream_init(&stream, &buffer, 0);
- GPR_ASSERT(stream.base.length == 6);
+ SliceBufferByteStream stream(&buffer, 0);
+ grpc_slice_buffer_destroy_internal(&buffer);
+ EXPECT_EQ(6U, stream.length());
grpc_closure closure;
- GRPC_CLOSURE_INIT(&closure, not_called_closure, nullptr,
+ GRPC_CLOSURE_INIT(&closure, NotCalledClosure, nullptr,
grpc_schedule_on_exec_ctx);
// Read the first slice.
- GPR_ASSERT(grpc_byte_stream_next(&stream.base, ~(size_t)0, &closure));
+ ASSERT_TRUE(stream.Next(~(size_t)0, &closure));
grpc_slice output;
- grpc_error* error = grpc_byte_stream_pull(&stream.base, &output);
- GPR_ASSERT(error == GRPC_ERROR_NONE);
- GPR_ASSERT(grpc_slice_eq(input[0], output));
+ grpc_error* error = stream.Pull(&output);
+ EXPECT_TRUE(error == GRPC_ERROR_NONE);
+ EXPECT_TRUE(grpc_slice_eq(input[0], output));
grpc_slice_unref_internal(output);
// Now shutdown.
grpc_error* shutdown_error =
GRPC_ERROR_CREATE_FROM_STATIC_STRING("shutdown error");
- grpc_byte_stream_shutdown(&stream.base, GRPC_ERROR_REF(shutdown_error));
+ stream.Shutdown(GRPC_ERROR_REF(shutdown_error));
// After shutdown, the next pull() should return the error.
- GPR_ASSERT(grpc_byte_stream_next(&stream.base, ~(size_t)0, &closure));
- error = grpc_byte_stream_pull(&stream.base, &output);
- GPR_ASSERT(error == shutdown_error);
+ ASSERT_TRUE(stream.Next(~(size_t)0, &closure));
+ error = stream.Pull(&output);
+ EXPECT_TRUE(error == shutdown_error);
GRPC_ERROR_UNREF(error);
GRPC_ERROR_UNREF(shutdown_error);
// Clean up.
- grpc_byte_stream_destroy(&stream.base);
- grpc_slice_buffer_destroy_internal(&buffer);
+ stream.Orphan();
}
//
-// grpc_caching_byte_stream tests
+// CachingByteStream tests
//
-static void test_caching_byte_stream_basic(void) {
- gpr_log(GPR_DEBUG, "test_caching_byte_stream_basic");
+TEST(CachingByteStream, Basic) {
grpc_core::ExecCtx exec_ctx;
// Create and populate slice buffer byte stream.
grpc_slice_buffer buffer;
@@ -128,34 +127,30 @@ static void test_caching_byte_stream_basic(void) {
for (size_t i = 0; i < GPR_ARRAY_SIZE(input); ++i) {
grpc_slice_buffer_add(&buffer, input[i]);
}
- grpc_slice_buffer_stream underlying_stream;
- grpc_slice_buffer_stream_init(&underlying_stream, &buffer, 0);
+ SliceBufferByteStream underlying_stream(&buffer, 0);
+ grpc_slice_buffer_destroy_internal(&buffer);
// Create cache and caching stream.
- grpc_byte_stream_cache cache;
- grpc_byte_stream_cache_init(&cache, &underlying_stream.base);
- grpc_caching_byte_stream stream;
- grpc_caching_byte_stream_init(&stream, &cache);
+ ByteStreamCache cache((OrphanablePtr<ByteStream>(&underlying_stream)));
+ ByteStreamCache::CachingByteStream stream(&cache);
grpc_closure closure;
- GRPC_CLOSURE_INIT(&closure, not_called_closure, nullptr,
+ GRPC_CLOSURE_INIT(&closure, NotCalledClosure, nullptr,
grpc_schedule_on_exec_ctx);
// Read each slice. Note that next() always returns synchronously,
// because the underlying byte stream always does.
for (size_t i = 0; i < GPR_ARRAY_SIZE(input); ++i) {
- GPR_ASSERT(grpc_byte_stream_next(&stream.base, ~(size_t)0, &closure));
+ ASSERT_TRUE(stream.Next(~(size_t)0, &closure));
grpc_slice output;
- grpc_error* error = grpc_byte_stream_pull(&stream.base, &output);
- GPR_ASSERT(error == GRPC_ERROR_NONE);
- GPR_ASSERT(grpc_slice_eq(input[i], output));
+ grpc_error* error = stream.Pull(&output);
+ EXPECT_TRUE(error == GRPC_ERROR_NONE);
+ EXPECT_TRUE(grpc_slice_eq(input[i], output));
grpc_slice_unref_internal(output);
}
// Clean up.
- grpc_byte_stream_destroy(&stream.base);
- grpc_byte_stream_cache_destroy(&cache);
- grpc_slice_buffer_destroy_internal(&buffer);
+ stream.Orphan();
+ cache.Destroy();
}
-static void test_caching_byte_stream_reset(void) {
- gpr_log(GPR_DEBUG, "test_caching_byte_stream_reset");
+TEST(CachingByteStream, Reset) {
grpc_core::ExecCtx exec_ctx;
// Create and populate slice buffer byte stream.
grpc_slice_buffer buffer;
@@ -167,41 +162,37 @@ static void test_caching_byte_stream_reset(void) {
for (size_t i = 0; i < GPR_ARRAY_SIZE(input); ++i) {
grpc_slice_buffer_add(&buffer, input[i]);
}
- grpc_slice_buffer_stream underlying_stream;
- grpc_slice_buffer_stream_init(&underlying_stream, &buffer, 0);
+ SliceBufferByteStream underlying_stream(&buffer, 0);
+ grpc_slice_buffer_destroy_internal(&buffer);
// Create cache and caching stream.
- grpc_byte_stream_cache cache;
- grpc_byte_stream_cache_init(&cache, &underlying_stream.base);
- grpc_caching_byte_stream stream;
- grpc_caching_byte_stream_init(&stream, &cache);
+ ByteStreamCache cache((OrphanablePtr<ByteStream>(&underlying_stream)));
+ ByteStreamCache::CachingByteStream stream(&cache);
grpc_closure closure;
- GRPC_CLOSURE_INIT(&closure, not_called_closure, nullptr,
+ GRPC_CLOSURE_INIT(&closure, NotCalledClosure, nullptr,
grpc_schedule_on_exec_ctx);
// Read one slice.
- GPR_ASSERT(grpc_byte_stream_next(&stream.base, ~(size_t)0, &closure));
+ ASSERT_TRUE(stream.Next(~(size_t)0, &closure));
grpc_slice output;
- grpc_error* error = grpc_byte_stream_pull(&stream.base, &output);
- GPR_ASSERT(error == GRPC_ERROR_NONE);
- GPR_ASSERT(grpc_slice_eq(input[0], output));
+ grpc_error* error = stream.Pull(&output);
+ EXPECT_TRUE(error == GRPC_ERROR_NONE);
+ EXPECT_TRUE(grpc_slice_eq(input[0], output));
grpc_slice_unref_internal(output);
// Reset the caching stream. The reads should start over from the
// first slice.
- grpc_caching_byte_stream_reset(&stream);
+ stream.Reset();
for (size_t i = 0; i < GPR_ARRAY_SIZE(input); ++i) {
- GPR_ASSERT(grpc_byte_stream_next(&stream.base, ~(size_t)0, &closure));
- error = grpc_byte_stream_pull(&stream.base, &output);
- GPR_ASSERT(error == GRPC_ERROR_NONE);
- GPR_ASSERT(grpc_slice_eq(input[i], output));
+ ASSERT_TRUE(stream.Next(~(size_t)0, &closure));
+ error = stream.Pull(&output);
+ EXPECT_TRUE(error == GRPC_ERROR_NONE);
+ EXPECT_TRUE(grpc_slice_eq(input[i], output));
grpc_slice_unref_internal(output);
}
// Clean up.
- grpc_byte_stream_destroy(&stream.base);
- grpc_byte_stream_cache_destroy(&cache);
- grpc_slice_buffer_destroy_internal(&buffer);
+ stream.Orphan();
+ cache.Destroy();
}
-static void test_caching_byte_stream_shared_cache(void) {
- gpr_log(GPR_DEBUG, "test_caching_byte_stream_shared_cache");
+TEST(CachingByteStream, SharedCache) {
grpc_core::ExecCtx exec_ctx;
// Create and populate slice buffer byte stream.
grpc_slice_buffer buffer;
@@ -213,54 +204,50 @@ static void test_caching_byte_stream_shared_cache(void) {
for (size_t i = 0; i < GPR_ARRAY_SIZE(input); ++i) {
grpc_slice_buffer_add(&buffer, input[i]);
}
- grpc_slice_buffer_stream underlying_stream;
- grpc_slice_buffer_stream_init(&underlying_stream, &buffer, 0);
+ SliceBufferByteStream underlying_stream(&buffer, 0);
+ grpc_slice_buffer_destroy_internal(&buffer);
// Create cache and two caching streams.
- grpc_byte_stream_cache cache;
- grpc_byte_stream_cache_init(&cache, &underlying_stream.base);
- grpc_caching_byte_stream stream1;
- grpc_caching_byte_stream_init(&stream1, &cache);
- grpc_caching_byte_stream stream2;
- grpc_caching_byte_stream_init(&stream2, &cache);
+ ByteStreamCache cache((OrphanablePtr<ByteStream>(&underlying_stream)));
+ ByteStreamCache::CachingByteStream stream1(&cache);
+ ByteStreamCache::CachingByteStream stream2(&cache);
grpc_closure closure;
- GRPC_CLOSURE_INIT(&closure, not_called_closure, nullptr,
+ GRPC_CLOSURE_INIT(&closure, NotCalledClosure, nullptr,
grpc_schedule_on_exec_ctx);
// Read one slice from stream1.
- GPR_ASSERT(grpc_byte_stream_next(&stream1.base, ~(size_t)0, &closure));
+ EXPECT_TRUE(stream1.Next(~(size_t)0, &closure));
grpc_slice output;
- grpc_error* error = grpc_byte_stream_pull(&stream1.base, &output);
- GPR_ASSERT(error == GRPC_ERROR_NONE);
- GPR_ASSERT(grpc_slice_eq(input[0], output));
+ grpc_error* error = stream1.Pull(&output);
+ EXPECT_TRUE(error == GRPC_ERROR_NONE);
+ EXPECT_TRUE(grpc_slice_eq(input[0], output));
grpc_slice_unref_internal(output);
// Read all slices from stream2.
for (size_t i = 0; i < GPR_ARRAY_SIZE(input); ++i) {
- GPR_ASSERT(grpc_byte_stream_next(&stream2.base, ~(size_t)0, &closure));
- error = grpc_byte_stream_pull(&stream2.base, &output);
- GPR_ASSERT(error == GRPC_ERROR_NONE);
- GPR_ASSERT(grpc_slice_eq(input[i], output));
+ EXPECT_TRUE(stream2.Next(~(size_t)0, &closure));
+ error = stream2.Pull(&output);
+ EXPECT_TRUE(error == GRPC_ERROR_NONE);
+ EXPECT_TRUE(grpc_slice_eq(input[i], output));
grpc_slice_unref_internal(output);
}
// Now read the second slice from stream1.
- GPR_ASSERT(grpc_byte_stream_next(&stream1.base, ~(size_t)0, &closure));
- error = grpc_byte_stream_pull(&stream1.base, &output);
- GPR_ASSERT(error == GRPC_ERROR_NONE);
- GPR_ASSERT(grpc_slice_eq(input[1], output));
+ EXPECT_TRUE(stream1.Next(~(size_t)0, &closure));
+ error = stream1.Pull(&output);
+ EXPECT_TRUE(error == GRPC_ERROR_NONE);
+ EXPECT_TRUE(grpc_slice_eq(input[1], output));
grpc_slice_unref_internal(output);
// Clean up.
- grpc_byte_stream_destroy(&stream1.base);
- grpc_byte_stream_destroy(&stream2.base);
- grpc_byte_stream_cache_destroy(&cache);
- grpc_slice_buffer_destroy_internal(&buffer);
+ stream1.Orphan();
+ stream2.Orphan();
+ cache.Destroy();
}
+} // namespace
+} // namespace grpc_core
+
int main(int argc, char** argv) {
grpc_init();
grpc_test_init(argc, argv);
- test_slice_buffer_stream_basic();
- test_slice_buffer_stream_shutdown();
- test_caching_byte_stream_basic();
- test_caching_byte_stream_reset();
- test_caching_byte_stream_shared_cache();
+ ::testing::InitGoogleTest(&argc, argv);
+ int retval = RUN_ALL_TESTS();
grpc_shutdown();
- return 0;
+ return retval;
}
diff --git a/test/core/transport/chttp2/bin_decoder_test.cc b/test/core/transport/chttp2/bin_decoder_test.cc
index 751dd90c8c..b4b07986a3 100644
--- a/test/core/transport/chttp2/bin_decoder_test.cc
+++ b/test/core/transport/chttp2/bin_decoder_test.cc
@@ -25,6 +25,7 @@
#include <grpc/support/log.h>
#include "src/core/ext/transport/chttp2/transport/bin_encoder.h"
#include "src/core/lib/gpr/string.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/slice/slice_string_helpers.h"
diff --git a/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc b/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc
index 9a195daee0..a8eec1eefd 100644
--- a/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc
+++ b/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc
@@ -24,6 +24,7 @@
#include <grpc/support/log.h>
#include "src/core/ext/transport/chttp2/transport/hpack_parser.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/slice/slice_internal.h"
bool squelch = true;
diff --git a/test/core/transport/chttp2/hpack_parser_test.cc b/test/core/transport/chttp2/hpack_parser_test.cc
index 9d3456a873..43b6c79e8a 100644
--- a/test/core/transport/chttp2/hpack_parser_test.cc
+++ b/test/core/transport/chttp2/hpack_parser_test.cc
@@ -24,6 +24,8 @@
#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
+
+#include "src/core/lib/iomgr/exec_ctx.h"
#include "test/core/util/parse_hexstring.h"
#include "test/core/util/slice_splitter.h"
#include "test/core/util/test_config.h"
diff --git a/test/core/transport/chttp2/hpack_table_test.cc b/test/core/transport/chttp2/hpack_table_test.cc
index e316cf63a0..3ab463b631 100644
--- a/test/core/transport/chttp2/hpack_table_test.cc
+++ b/test/core/transport/chttp2/hpack_table_test.cc
@@ -27,6 +27,7 @@
#include <grpc/support/string_util.h>
#include "src/core/lib/gpr/string.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
#include "test/core/util/test_config.h"
#define LOG_TEST(x) gpr_log(GPR_INFO, "%s", x)
diff --git a/test/core/transport/connectivity_state_test.cc b/test/core/transport/connectivity_state_test.cc
index f5894599e5..cbd6318f52 100644
--- a/test/core/transport/connectivity_state_test.cc
+++ b/test/core/transport/connectivity_state_test.cc
@@ -22,6 +22,7 @@
#include <grpc/support/log.h>
+#include "src/core/lib/iomgr/exec_ctx.h"
#include "test/core/util/test_config.h"
#include "test/core/util/tracer_util.h"
diff --git a/test/core/transport/metadata_test.cc b/test/core/transport/metadata_test.cc
index 786df97285..4be34f72d9 100644
--- a/test/core/transport/metadata_test.cc
+++ b/test/core/transport/metadata_test.cc
@@ -28,6 +28,7 @@
#include "src/core/ext/transport/chttp2/transport/bin_encoder.h"
#include "src/core/lib/gpr/string.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/transport/static_metadata.h"
#include "test/core/util/test_config.h"
diff --git a/test/core/tsi/alts/crypt/BUILD b/test/core/tsi/alts/crypt/BUILD
index 0057d7f6e6..b2fcb65adb 100644
--- a/test/core/tsi/alts/crypt/BUILD
+++ b/test/core/tsi/alts/crypt/BUILD
@@ -18,21 +18,25 @@ licenses(["notice"]) # Apache v2
grpc_package(name = "crypt", visibility = "public")
-grpc_cc_library(
- name = "alts_crypt_test_util",
- srcs = ["gsec_test_util.cc"],
- hdrs = ["gsec_test_util.h"],
- deps = [
- "//:grpc",
- ],
-)
-
grpc_cc_test(
name = "alts_crypt_test",
srcs = ["aes_gcm_test.cc"],
language = "C++",
deps = [
":alts_crypt_test_util",
+ "//:alts_frame_protector",
+ "//:gpr",
"//:grpc",
],
)
+
+grpc_cc_library(
+ name = "alts_crypt_test_util",
+ srcs = ["gsec_test_util.cc"],
+ hdrs = ["gsec_test_util.h"],
+ deps = [
+ "//:gpr",
+ "//:grpc",
+ ],
+)
+
diff --git a/test/core/tsi/alts/crypt/gsec_test_util.cc b/test/core/tsi/alts/crypt/gsec_test_util.cc
index 992c91e6bc..c682fb8e4d 100644
--- a/test/core/tsi/alts/crypt/gsec_test_util.cc
+++ b/test/core/tsi/alts/crypt/gsec_test_util.cc
@@ -18,13 +18,15 @@
#include "test/core/tsi/alts/crypt/gsec_test_util.h"
+#include <time.h>
+
#include <grpc/support/alloc.h>
void gsec_test_random_bytes(uint8_t* bytes, size_t length) {
- if (!RAND_bytes(bytes, static_cast<int>(length))) {
- fprintf(stderr,
- "Random bytes generation failed in gsec_test_random_bytes().");
- abort();
+ srand(time(nullptr));
+ size_t ind;
+ for (ind = 0; ind < length; ind++) {
+ bytes[ind] = static_cast<uint8_t>(rand() % 255 + 1);
}
}
diff --git a/test/core/tsi/alts/crypt/gsec_test_util.h b/test/core/tsi/alts/crypt/gsec_test_util.h
index 206ae2fda8..1bd780000f 100644
--- a/test/core/tsi/alts/crypt/gsec_test_util.h
+++ b/test/core/tsi/alts/crypt/gsec_test_util.h
@@ -24,8 +24,6 @@
#include <stdlib.h>
#include <string.h>
-#include <openssl/rand.h>
-
#include <grpc/grpc.h>
/**
diff --git a/test/core/tsi/alts/frame_protector/BUILD b/test/core/tsi/alts/frame_protector/BUILD
index 8bbc8c6e5e..94c2ab3747 100644
--- a/test/core/tsi/alts/frame_protector/BUILD
+++ b/test/core/tsi/alts/frame_protector/BUILD
@@ -23,6 +23,8 @@ grpc_cc_test(
srcs = ["alts_counter_test.cc"],
language = "C++",
deps = [
+ "//:alts_frame_protector",
+ "//:gpr",
"//:grpc",
"//test/core/tsi/alts/crypt:alts_crypt_test_util",
],
@@ -33,6 +35,8 @@ grpc_cc_test(
srcs = ["alts_crypter_test.cc"],
language = "C++",
deps = [
+ "//:alts_frame_protector",
+ "//:gpr",
"//:grpc",
"//test/core/tsi/alts/crypt:alts_crypt_test_util",
],
@@ -43,7 +47,11 @@ grpc_cc_test(
srcs = ["alts_frame_protector_test.cc"],
language = "C++",
deps = [
+ "//:alts_frame_protector",
+ "//:gpr",
"//:grpc",
+ "//:tsi",
+ "//:tsi_interface",
"//test/core/tsi/alts/crypt:alts_crypt_test_util",
"//test/core/tsi:transport_security_test_lib",
],
@@ -54,6 +62,9 @@ grpc_cc_test(
srcs = ["frame_handler_test.cc"],
language = "C++",
deps = [
+ "//:alts_frame_protector",
+ "//:gpr",
+ "//:gpr_base",
"//:grpc",
"//test/core/tsi/alts/crypt:alts_crypt_test_util",
],
diff --git a/test/core/tsi/alts/handshaker/BUILD b/test/core/tsi/alts/handshaker/BUILD
index db39732c43..fc2c395bdf 100644
--- a/test/core/tsi/alts/handshaker/BUILD
+++ b/test/core/tsi/alts/handshaker/BUILD
@@ -23,6 +23,7 @@ grpc_cc_library(
srcs = ["alts_handshaker_service_api_test_lib.cc"],
hdrs = ["alts_handshaker_service_api_test_lib.h"],
deps = [
+ "//:alts_util",
"//:grpc",
],
)
@@ -33,6 +34,8 @@ grpc_cc_test(
language = "C++",
deps = [
":alts_handshaker_service_api_test_lib",
+ "//:tsi",
+ "//:tsi_interface",
"//:grpc",
],
)
@@ -53,7 +56,10 @@ grpc_cc_test(
language = "C++",
deps = [
":alts_handshaker_service_api_test_lib",
+ "//:gpr",
+ "//:gpr_base",
"//:grpc",
+ "//:tsi",
],
)
@@ -64,6 +70,7 @@ grpc_cc_test(
deps = [
":alts_handshaker_service_api_test_lib",
"//:grpc",
+ "//:tsi",
],
)
@@ -72,6 +79,7 @@ grpc_cc_test(
srcs = ["transport_security_common_api_test.cc"],
language = "C++",
deps = [
+ "//:alts_util",
"//:grpc",
],
)
diff --git a/test/core/tsi/alts/zero_copy_frame_protector/BUILD b/test/core/tsi/alts/zero_copy_frame_protector/BUILD
index 80f4572d94..4c6fb91a76 100644
--- a/test/core/tsi/alts/zero_copy_frame_protector/BUILD
+++ b/test/core/tsi/alts/zero_copy_frame_protector/BUILD
@@ -23,7 +23,10 @@ grpc_cc_test(
srcs = ["alts_grpc_record_protocol_test.cc"],
language = "C++",
deps = [
+ "//:alts_frame_protector",
+ "//:gpr",
"//:grpc",
+ "//:grpc_base_c",
"//test/core/tsi/alts/crypt:alts_crypt_test_util",
],
)
@@ -33,6 +36,8 @@ grpc_cc_test(
srcs = ["alts_iovec_record_protocol_test.cc"],
language = "C++",
deps = [
+ "//:alts_frame_protector",
+ "//:gpr",
"//:grpc",
"//test/core/tsi/alts/crypt:alts_crypt_test_util",
],
@@ -43,7 +48,10 @@ grpc_cc_test(
srcs = ["alts_zero_copy_grpc_protector_test.cc"],
language = "C++",
deps = [
+ "//:alts_frame_protector",
+ "//:gpr",
"//:grpc",
+ "//:grpc_base_c",
"//test/core/tsi/alts/crypt:alts_crypt_test_util",
],
)
diff --git a/test/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_test.cc b/test/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_test.cc
index fbbea71cb7..b763f19d50 100644
--- a/test/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_test.cc
+++ b/test/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_test.cc
@@ -19,6 +19,7 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
+#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.h"
#include "src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_privacy_integrity_record_protocol.h"
diff --git a/test/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector_test.cc b/test/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector_test.cc
index 2388be95cd..32159e22f2 100644
--- a/test/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector_test.cc
+++ b/test/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector_test.cc
@@ -20,6 +20,7 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
+#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/tsi/alts/crypt/gsec.h"
#include "src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.h"
diff --git a/test/core/util/test_config.cc b/test/core/util/test_config.cc
index 53a6297d6e..6a0d444a73 100644
--- a/test/core/util/test_config.cc
+++ b/test/core/util/test_config.cc
@@ -18,6 +18,7 @@
#include "test/core/util/test_config.h"
+#include <inttypes.h>
#include <signal.h>
#include <stdbool.h>
#include <stdio.h>
diff --git a/test/core/util/test_tcp_server.cc b/test/core/util/test_tcp_server.cc
index cb2bc701fa..610a9918ce 100644
--- a/test/core/util/test_tcp_server.cc
+++ b/test/core/util/test_tcp_server.cc
@@ -17,6 +17,7 @@
*/
#include "src/core/lib/iomgr/sockaddr.h"
+#include "src/core/lib/iomgr/socket_utils.h"
#include "test/core/util/test_tcp_server.h"
@@ -54,13 +55,13 @@ void test_tcp_server_init(test_tcp_server* server,
void test_tcp_server_start(test_tcp_server* server, int port) {
grpc_resolved_address resolved_addr;
- struct sockaddr_in* addr =
- reinterpret_cast<struct sockaddr_in*>(resolved_addr.addr);
+ grpc_sockaddr_in* addr =
+ reinterpret_cast<grpc_sockaddr_in*>(resolved_addr.addr);
int port_added;
grpc_core::ExecCtx exec_ctx;
- addr->sin_family = AF_INET;
- addr->sin_port = htons(static_cast<uint16_t>(port));
+ addr->sin_family = GRPC_AF_INET;
+ addr->sin_port = grpc_htons(static_cast<uint16_t>(port));
memset(&addr->sin_addr, 0, sizeof(addr->sin_addr));
grpc_error* error = grpc_tcp_server_create(&server->shutdown_complete,
diff --git a/test/cpp/client/client_channel_stress_test.cc b/test/cpp/client/client_channel_stress_test.cc
index ee6958dfcf..826907ae4e 100644
--- a/test/cpp/client/client_channel_stress_test.cc
+++ b/test/cpp/client/client_channel_stress_test.cc
@@ -23,16 +23,16 @@
#include <sstream>
#include <thread>
-#include <grpc++/channel.h>
-#include <grpc++/client_context.h>
-#include <grpc++/create_channel.h>
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/time.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/client_context.h>
+#include <grpcpp/create_channel.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
#include "src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
diff --git a/test/cpp/client/credentials_test.cc b/test/cpp/client/credentials_test.cc
index 52efce18b3..e64e260a46 100644
--- a/test/cpp/client/credentials_test.cc
+++ b/test/cpp/client/credentials_test.cc
@@ -16,7 +16,7 @@
*
*/
-#include <grpc++/security/credentials.h>
+#include <grpcpp/security/credentials.h>
#include <memory>
diff --git a/test/cpp/cocoapods/generic/generic.mm b/test/cpp/cocoapods/generic/generic.mm
index 26f09b0af0..6e65176dd9 100644
--- a/test/cpp/cocoapods/generic/generic.mm
+++ b/test/cpp/cocoapods/generic/generic.mm
@@ -20,15 +20,15 @@
#include <sstream>
-#include <grpc++/channel.h>
-#include <grpc++/client_context.h>
-#include <grpc++/create_channel.h>
-#include <grpc++/generic/async_generic_service.h>
-#include <grpc++/generic/generic_stub.h>
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
-#include <grpc++/server_context.h>
-#include <grpc++/support/slice.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/client_context.h>
+#include <grpcpp/create_channel.h>
+#include <grpcpp/generic/async_generic_service.h>
+#include <grpcpp/generic/generic_stub.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
+#include <grpcpp/server_context.h>
+#include <grpcpp/support/slice.h>
#include <grpc/grpc.h>
#include <grpc/support/time.h>
diff --git a/test/cpp/cocoapods/test/server_context_test_spouse_test.mm b/test/cpp/cocoapods/test/server_context_test_spouse_test.mm
index fd6878efbf..7cb1b36bf4 100644
--- a/test/cpp/cocoapods/test/server_context_test_spouse_test.mm
+++ b/test/cpp/cocoapods/test/server_context_test_spouse_test.mm
@@ -24,12 +24,12 @@
#import <XCTest/XCTest.h>
-#include <grpc++/test/server_context_test_spouse.h>
+#include <grpcpp/test/server_context_test_spouse.h>
#include <cstring>
#include <vector>
-#include <grpc++/impl/grpc_library.h>
+#include <grpcpp/impl/grpc_library.h>
static grpc::internal::GrpcLibraryInitializer g_initializer;
diff --git a/test/cpp/codegen/BUILD b/test/cpp/codegen/BUILD
index 1388dbc650..12712a3e6c 100644
--- a/test/cpp/codegen/BUILD
+++ b/test/cpp/codegen/BUILD
@@ -61,7 +61,6 @@ grpc_cc_binary(
srcs = ["golden_file_test.cc"],
deps = [
"//:grpc++",
- "//src/proto/grpc/testing:compiler_test_proto",
"//test/core/util:gpr_test_util",
],
external_deps = [
@@ -70,6 +69,20 @@ grpc_cc_binary(
],
)
+genrule(
+ name = "copy_compiler_test_grpc_pb_h",
+ srcs = ["//src/proto/grpc/testing:_compiler_test_proto_grpc_codegen"],
+ cmd = "cat $(GENDIR)/src/proto/grpc/testing/compiler_test.grpc.pb.h > $@",
+ outs = ["compiler_test.grpc.pb.h"],
+)
+
+genrule(
+ name = "copy_compiler_test_mock_grpc_pb_h",
+ srcs = ["//src/proto/grpc/testing:_compiler_test_proto_grpc_codegen"],
+ cmd = "cat $(GENDIR)/src/proto/grpc/testing/compiler_test_mock.grpc.pb.h > $@",
+ outs = ["compiler_test_mock.grpc.pb.h"],
+)
+
grpc_sh_test(
name = "run_golden_file_test",
srcs = ["run_golden_file_test.sh"],
@@ -77,6 +90,7 @@ grpc_sh_test(
":golden_file_test",
":compiler_test_golden",
":compiler_test_mock_golden",
- "//src/proto/grpc/testing:_compiler_test_proto_grpc_codegen",
+ ":compiler_test.grpc.pb.h",
+ ":compiler_test_mock.grpc.pb.h",
],
)
diff --git a/test/cpp/codegen/codegen_test_full.cc b/test/cpp/codegen/codegen_test_full.cc
index 98792bde04..ccd310fc22 100644
--- a/test/cpp/codegen/codegen_test_full.cc
+++ b/test/cpp/codegen/codegen_test_full.cc
@@ -16,8 +16,8 @@
*
*/
-#include <grpc++/completion_queue.h>
#include <grpc/support/time.h>
+#include <grpcpp/completion_queue.h>
#include <gtest/gtest.h>
namespace grpc {
diff --git a/test/cpp/codegen/proto_utils_test.cc b/test/cpp/codegen/proto_utils_test.cc
index b64f9a0d17..836d3d8076 100644
--- a/test/cpp/codegen/proto_utils_test.cc
+++ b/test/cpp/codegen/proto_utils_test.cc
@@ -16,11 +16,11 @@
*
*/
-#include <grpc++/impl/codegen/grpc_library.h>
-#include <grpc++/impl/codegen/proto_utils.h>
-#include <grpc++/impl/grpc_library.h>
#include <grpc/impl/codegen/byte_buffer.h>
#include <grpc/slice.h>
+#include <grpcpp/impl/codegen/grpc_library.h>
+#include <grpcpp/impl/codegen/proto_utils.h>
+#include <grpcpp/impl/grpc_library.h>
#include <gtest/gtest.h>
namespace grpc {
diff --git a/test/cpp/codegen/run_golden_file_test.sh b/test/cpp/codegen/run_golden_file_test.sh
index cdfaa96a1c..8fe801c876 100755
--- a/test/cpp/codegen/run_golden_file_test.sh
+++ b/test/cpp/codegen/run_golden_file_test.sh
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-set -ex
+set -eux
-GENERATED_FILES_PATH="$TEST_SRCDIR/../../../../../genfiles/src/proto/grpc/testing/"
-test/cpp/codegen/golden_file_test --generated_file_path="$GENERATED_FILES_PATH"
+GENERATED_PB_H_DIR="${TEST_SRCDIR}/com_github_grpc_grpc/test/cpp/codegen/"
+test/cpp/codegen/golden_file_test --generated_file_path="$GENERATED_PB_H_DIR"
diff --git a/test/cpp/common/alarm_test.cc b/test/cpp/common/alarm_test.cc
index 376aa3e32e..fb5f6713d1 100644
--- a/test/cpp/common/alarm_test.cc
+++ b/test/cpp/common/alarm_test.cc
@@ -16,8 +16,8 @@
*
*/
-#include <grpc++/alarm.h>
-#include <grpc++/completion_queue.h>
+#include <grpcpp/alarm.h>
+#include <grpcpp/completion_queue.h>
#include <thread>
#include <gtest/gtest.h>
diff --git a/test/cpp/common/auth_property_iterator_test.cc b/test/cpp/common/auth_property_iterator_test.cc
index fce409aa2f..9634555e4b 100644
--- a/test/cpp/common/auth_property_iterator_test.cc
+++ b/test/cpp/common/auth_property_iterator_test.cc
@@ -16,8 +16,8 @@
*
*/
-#include <grpc++/security/auth_context.h>
#include <grpc/grpc_security.h>
+#include <grpcpp/security/auth_context.h>
#include <gtest/gtest.h>
#include "src/cpp/common/secure_auth_context.h"
#include "test/cpp/util/string_ref_helper.h"
diff --git a/test/cpp/common/channel_arguments_test.cc b/test/cpp/common/channel_arguments_test.cc
index 29e225d924..183d2afa78 100644
--- a/test/cpp/common/channel_arguments_test.cc
+++ b/test/cpp/common/channel_arguments_test.cc
@@ -16,10 +16,10 @@
*
*/
-#include <grpc++/support/channel_arguments.h>
+#include <grpcpp/support/channel_arguments.h>
-#include <grpc++/grpc++.h>
#include <grpc/grpc.h>
+#include <grpcpp/grpcpp.h>
#include <gtest/gtest.h>
#include "src/core/lib/gpr/useful.h"
diff --git a/test/cpp/common/secure_auth_context_test.cc b/test/cpp/common/secure_auth_context_test.cc
index 7a0530c20a..6461f49743 100644
--- a/test/cpp/common/secure_auth_context_test.cc
+++ b/test/cpp/common/secure_auth_context_test.cc
@@ -17,8 +17,8 @@
*/
#include "src/cpp/common/secure_auth_context.h"
-#include <grpc++/security/auth_context.h>
#include <grpc/grpc_security.h>
+#include <grpcpp/security/auth_context.h>
#include <gtest/gtest.h>
#include "test/cpp/util/string_ref_helper.h"
diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc
index d3620584a9..dd777d10c2 100644
--- a/test/cpp/end2end/async_end2end_test.cc
+++ b/test/cpp/end2end/async_end2end_test.cc
@@ -20,17 +20,17 @@
#include <memory>
#include <thread>
-#include <grpc++/channel.h>
-#include <grpc++/client_context.h>
-#include <grpc++/create_channel.h>
-#include <grpc++/ext/health_check_service_server_builder_option.h>
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
-#include <grpc++/server_context.h>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/client_context.h>
+#include <grpcpp/create_channel.h>
+#include <grpcpp/ext/health_check_service_server_builder_option.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
+#include <grpcpp/server_context.h>
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/gpr/tls.h"
diff --git a/test/cpp/end2end/client_crash_test.cc b/test/cpp/end2end/client_crash_test.cc
index 6bde6641b7..2a06f44c60 100644
--- a/test/cpp/end2end/client_crash_test.cc
+++ b/test/cpp/end2end/client_crash_test.cc
@@ -16,15 +16,15 @@
*
*/
-#include <grpc++/channel.h>
-#include <grpc++/client_context.h>
-#include <grpc++/create_channel.h>
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
-#include <grpc++/server_context.h>
#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/client_context.h>
+#include <grpcpp/create_channel.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
+#include <grpcpp/server_context.h>
#include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h"
#include "src/proto/grpc/testing/echo.grpc.pb.h"
diff --git a/test/cpp/end2end/client_crash_test_server.cc b/test/cpp/end2end/client_crash_test_server.cc
index 887504d308..cb4afd7167 100644
--- a/test/cpp/end2end/client_crash_test_server.cc
+++ b/test/cpp/end2end/client_crash_test_server.cc
@@ -21,10 +21,10 @@
#include <memory>
#include <string>
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
-#include <grpc++/server_context.h>
#include <grpc/support/log.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
+#include <grpcpp/server_context.h>
#include "src/proto/grpc/testing/echo.grpc.pb.h"
diff --git a/test/cpp/end2end/client_lb_end2end_test.cc b/test/cpp/end2end/client_lb_end2end_test.cc
index 96a855c30e..a39e443cf0 100644
--- a/test/cpp/end2end/client_lb_end2end_test.cc
+++ b/test/cpp/end2end/client_lb_end2end_test.cc
@@ -22,17 +22,17 @@
#include <random>
#include <thread>
-#include <grpc++/channel.h>
-#include <grpc++/client_context.h>
-#include <grpc++/create_channel.h>
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/atm.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/time.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/client_context.h>
+#include <grpcpp/create_channel.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
#include "src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h"
#include "src/core/ext/filters/client_channel/subchannel_index.h"
@@ -40,6 +40,7 @@
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
+#include "src/core/lib/iomgr/tcp_client.h"
#include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "test/core/util/port.h"
@@ -52,13 +53,10 @@ using grpc::testing::EchoRequest;
using grpc::testing::EchoResponse;
using std::chrono::system_clock;
-// defined in tcp_client_posix.c
-extern void (*grpc_tcp_client_connect_impl)(
- grpc_closure* closure, grpc_endpoint** ep,
- grpc_pollset_set* interested_parties, const grpc_channel_args* channel_args,
- const grpc_resolved_address* addr, grpc_millis deadline);
+// defined in tcp_client.cc
+extern grpc_tcp_client_vtable* grpc_tcp_client_impl;
-const auto original_tcp_connect_fn = grpc_tcp_client_connect_impl;
+static grpc_tcp_client_vtable* default_client_impl;
namespace grpc {
namespace testing {
@@ -75,10 +73,12 @@ void tcp_client_connect_with_delay(grpc_closure* closure, grpc_endpoint** ep,
if (delay_ms > 0) {
gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(delay_ms));
}
- original_tcp_connect_fn(closure, ep, interested_parties, channel_args, addr,
- deadline + delay_ms);
+ default_client_impl->connect(closure, ep, interested_parties, channel_args,
+ addr, deadline + delay_ms);
}
+grpc_tcp_client_vtable delayed_connect = {tcp_client_connect_with_delay};
+
// Subclass of TestServiceImpl that increments a request counter for
// every call to the Echo RPC.
class MyTestServiceImpl : public TestServiceImpl {
@@ -384,7 +384,8 @@ TEST_F(ClientLbEnd2endTest, PickFirstBackOffMinReconnect) {
// Make connection delay a 10% longer than it's willing to in order to make
// sure we are hitting the codepath that waits for the min reconnect backoff.
gpr_atm_rel_store(&g_connection_delay_ms, kMinReconnectBackOffMs * 1.10);
- grpc_tcp_client_connect_impl = tcp_client_connect_with_delay;
+ default_client_impl = grpc_tcp_client_impl;
+ grpc_set_tcp_client_impl(&delayed_connect);
const gpr_timespec t0 = gpr_now(GPR_CLOCK_MONOTONIC);
channel->WaitForConnected(
grpc_timeout_milliseconds_to_deadline(kMinReconnectBackOffMs * 2));
diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc
index 1e2cdb8b62..60238e930d 100644
--- a/test/cpp/end2end/end2end_test.cc
+++ b/test/cpp/end2end/end2end_test.cc
@@ -19,20 +19,20 @@
#include <mutex>
#include <thread>
-#include <grpc++/channel.h>
-#include <grpc++/client_context.h>
-#include <grpc++/create_channel.h>
-#include <grpc++/resource_quota.h>
-#include <grpc++/security/auth_metadata_processor.h>
-#include <grpc++/security/credentials.h>
-#include <grpc++/security/server_credentials.h>
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
-#include <grpc++/server_context.h>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/client_context.h>
+#include <grpcpp/create_channel.h>
+#include <grpcpp/resource_quota.h>
+#include <grpcpp/security/auth_metadata_processor.h>
+#include <grpcpp/security/credentials.h>
+#include <grpcpp/security/server_credentials.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
+#include <grpcpp/server_context.h>
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/security/credentials/credentials.h"
diff --git a/test/cpp/end2end/exception_test.cc b/test/cpp/end2end/exception_test.cc
index 76272ad08a..5343997663 100644
--- a/test/cpp/end2end/exception_test.cc
+++ b/test/cpp/end2end/exception_test.cc
@@ -19,12 +19,12 @@
#include <exception>
#include <memory>
-#include <grpc++/channel.h>
-#include <grpc++/client_context.h>
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
-#include <grpc++/server_context.h>
#include <grpc/impl/codegen/port_platform.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/client_context.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
+#include <grpcpp/server_context.h>
#include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "test/core/util/test_config.h"
@@ -87,24 +87,28 @@ TEST_F(ExceptionTest, Unary) {
EchoRequest request;
EchoResponse response;
request.set_message("test");
- ClientContext context;
- Status s = stub_->Echo(&context, request, &response);
- EXPECT_FALSE(s.ok());
- EXPECT_EQ(s.error_code(), StatusCode::UNKNOWN);
+ for (int i = 0; i < 10; i++) {
+ ClientContext context;
+ Status s = stub_->Echo(&context, request, &response);
+ EXPECT_FALSE(s.ok());
+ EXPECT_EQ(s.error_code(), StatusCode::UNKNOWN);
+ }
}
TEST_F(ExceptionTest, RequestStream) {
ResetStub();
EchoResponse response;
- ClientContext context;
- auto stream = stub_->RequestStream(&context, &response);
- stream->WritesDone();
- Status s = stream->Finish();
+ for (int i = 0; i < 10; i++) {
+ ClientContext context;
+ auto stream = stub_->RequestStream(&context, &response);
+ stream->WritesDone();
+ Status s = stream->Finish();
- EXPECT_FALSE(s.ok());
- EXPECT_EQ(s.error_code(), StatusCode::UNKNOWN);
+ EXPECT_FALSE(s.ok());
+ EXPECT_EQ(s.error_code(), StatusCode::UNKNOWN);
+ }
}
#endif // GRPC_ALLOW_EXCEPTIONS
diff --git a/test/cpp/end2end/filter_end2end_test.cc b/test/cpp/end2end/filter_end2end_test.cc
index 20804bc19e..88f8f380c3 100644
--- a/test/cpp/end2end/filter_end2end_test.cc
+++ b/test/cpp/end2end/filter_end2end_test.cc
@@ -19,19 +19,19 @@
#include <memory>
#include <mutex>
-#include <grpc++/channel.h>
-#include <grpc++/client_context.h>
-#include <grpc++/create_channel.h>
-#include <grpc++/generic/async_generic_service.h>
-#include <grpc++/generic/generic_stub.h>
-#include <grpc++/impl/codegen/proto_utils.h>
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
-#include <grpc++/server_context.h>
-#include <grpc++/support/config.h>
-#include <grpc++/support/slice.h>
#include <grpc/grpc.h>
#include <grpc/support/time.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/client_context.h>
+#include <grpcpp/create_channel.h>
+#include <grpcpp/generic/async_generic_service.h>
+#include <grpcpp/generic/generic_stub.h>
+#include <grpcpp/impl/codegen/proto_utils.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
+#include <grpcpp/server_context.h>
+#include <grpcpp/support/config.h>
+#include <grpcpp/support/slice.h>
#include "src/cpp/common/channel_filter.h"
#include "src/proto/grpc/testing/echo.grpc.pb.h"
diff --git a/test/cpp/end2end/generic_end2end_test.cc b/test/cpp/end2end/generic_end2end_test.cc
index 42b15a06e9..88a1227ca2 100644
--- a/test/cpp/end2end/generic_end2end_test.cc
+++ b/test/cpp/end2end/generic_end2end_test.cc
@@ -18,18 +18,18 @@
#include <memory>
-#include <grpc++/channel.h>
-#include <grpc++/client_context.h>
-#include <grpc++/create_channel.h>
-#include <grpc++/generic/async_generic_service.h>
-#include <grpc++/generic/generic_stub.h>
-#include <grpc++/impl/codegen/proto_utils.h>
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
-#include <grpc++/server_context.h>
-#include <grpc++/support/slice.h>
#include <grpc/grpc.h>
#include <grpc/support/time.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/client_context.h>
+#include <grpcpp/create_channel.h>
+#include <grpcpp/generic/async_generic_service.h>
+#include <grpcpp/generic/generic_stub.h>
+#include <grpcpp/impl/codegen/proto_utils.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
+#include <grpcpp/server_context.h>
+#include <grpcpp/support/slice.h>
#include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "test/core/util/port.h"
diff --git a/test/cpp/end2end/grpclb_end2end_test.cc b/test/cpp/end2end/grpclb_end2end_test.cc
index 33f485be93..557845618e 100644
--- a/test/cpp/end2end/grpclb_end2end_test.cc
+++ b/test/cpp/end2end/grpclb_end2end_test.cc
@@ -21,16 +21,16 @@
#include <sstream>
#include <thread>
-#include <grpc++/channel.h>
-#include <grpc++/client_context.h>
-#include <grpc++/create_channel.h>
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/time.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/client_context.h>
+#include <grpcpp/create_channel.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
#include "src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h"
#include "src/core/lib/gpr/env.h"
@@ -61,8 +61,6 @@
// - Test handling of creation of faulty RR instance by having the LB return a
// serverlist with non-existent backends after having initially returned a
// valid one.
-// - test using secure credentials and make sure we don't send call
-// credentials to the balancer
//
// Findings from end to end testing to be covered here:
// - Handling of LB servers restart, including reconnection after backing-off
@@ -126,12 +124,22 @@ class CountedService : public ServiceType {
using BackendService = CountedService<TestServiceImpl>;
using BalancerService = CountedService<LoadBalancer::Service>;
+const char g_kCallCredsMdKey[] = "Balancer should not ...";
+const char g_kCallCredsMdValue[] = "... receive me";
+
class BackendServiceImpl : public BackendService {
public:
BackendServiceImpl() {}
Status Echo(ServerContext* context, const EchoRequest* request,
EchoResponse* response) override {
+ // Backend should receive the call credentials metadata.
+ auto call_credentials_entry =
+ context->client_metadata().find(g_kCallCredsMdKey);
+ EXPECT_NE(call_credentials_entry, context->client_metadata().end());
+ if (call_credentials_entry != context->client_metadata().end()) {
+ EXPECT_EQ(call_credentials_entry->second, g_kCallCredsMdValue);
+ }
IncreaseRequestCount();
const auto status = TestServiceImpl::Echo(context, request, response);
IncreaseResponseCount();
@@ -190,6 +198,9 @@ class BalancerServiceImpl : public BalancerService {
shutdown_(false) {}
Status BalanceLoad(ServerContext* context, Stream* stream) override {
+ // Balancer shouldn't receive the call credentials metadata.
+ EXPECT_EQ(context->client_metadata().find(g_kCallCredsMdKey),
+ context->client_metadata().end());
gpr_log(GPR_INFO, "LB[%p]: BalanceLoad", this);
LoadBalanceRequest request;
std::vector<ResponseDelayPair> responses_and_delays;
@@ -394,8 +405,15 @@ class GrpclbEnd2endTest : public ::testing::Test {
uri << "fake:///" << kApplicationTargetName_;
// TODO(dgq): templatize tests to run everything using both secure and
// insecure channel credentials.
- std::shared_ptr<ChannelCredentials> creds(new SecureChannelCredentials(
- grpc_fake_transport_security_credentials_create()));
+ grpc_channel_credentials* channel_creds =
+ grpc_fake_transport_security_credentials_create();
+ grpc_call_credentials* call_creds = grpc_md_only_test_credentials_create(
+ g_kCallCredsMdKey, g_kCallCredsMdValue, false);
+ std::shared_ptr<ChannelCredentials> creds(
+ new SecureChannelCredentials(grpc_composite_channel_credentials_create(
+ channel_creds, call_creds, nullptr)));
+ grpc_call_credentials_unref(call_creds);
+ grpc_channel_credentials_unref(channel_creds);
channel_ = CreateCustomChannel(uri.str(), creds, args);
stub_ = grpc::testing::EchoTestService::NewStub(channel_);
}
diff --git a/test/cpp/end2end/health_service_end2end_test.cc b/test/cpp/end2end/health_service_end2end_test.cc
index de732e0154..1c48b9d151 100644
--- a/test/cpp/end2end/health_service_end2end_test.cc
+++ b/test/cpp/end2end/health_service_end2end_test.cc
@@ -21,16 +21,16 @@
#include <thread>
#include <vector>
-#include <grpc++/channel.h>
-#include <grpc++/client_context.h>
-#include <grpc++/create_channel.h>
-#include <grpc++/ext/health_check_service_server_builder_option.h>
-#include <grpc++/health_check_service_interface.h>
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
-#include <grpc++/server_context.h>
#include <grpc/grpc.h>
#include <grpc/support/log.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/client_context.h>
+#include <grpcpp/create_channel.h>
+#include <grpcpp/ext/health_check_service_server_builder_option.h>
+#include <grpcpp/health_check_service_interface.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
+#include <grpcpp/server_context.h>
#include "src/proto/grpc/health/v1/health.grpc.pb.h"
#include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h"
diff --git a/test/cpp/end2end/hybrid_end2end_test.cc b/test/cpp/end2end/hybrid_end2end_test.cc
index 38d6bfa83b..10e16429e6 100644
--- a/test/cpp/end2end/hybrid_end2end_test.cc
+++ b/test/cpp/end2end/hybrid_end2end_test.cc
@@ -19,14 +19,14 @@
#include <memory>
#include <thread>
-#include <grpc++/channel.h>
-#include <grpc++/client_context.h>
-#include <grpc++/create_channel.h>
-#include <grpc++/generic/async_generic_service.h>
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
-#include <grpc++/server_context.h>
#include <grpc/grpc.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/client_context.h>
+#include <grpcpp/create_channel.h>
+#include <grpcpp/generic/async_generic_service.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
+#include <grpcpp/server_context.h>
#include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h"
#include "src/proto/grpc/testing/echo.grpc.pb.h"
diff --git a/test/cpp/end2end/mock_test.cc b/test/cpp/end2end/mock_test.cc
index e3976a4838..ff49902fea 100644
--- a/test/cpp/end2end/mock_test.cc
+++ b/test/cpp/end2end/mock_test.cc
@@ -19,15 +19,15 @@
#include <climits>
#include <thread>
-#include <grpc++/channel.h>
-#include <grpc++/client_context.h>
-#include <grpc++/create_channel.h>
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
-#include <grpc++/server_context.h>
#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/client_context.h>
+#include <grpcpp/create_channel.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
+#include <grpcpp/server_context.h>
#include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h"
#include "src/proto/grpc/testing/echo.grpc.pb.h"
@@ -35,7 +35,7 @@
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
-#include <grpc++/test/mock_stream.h>
+#include <grpcpp/test/mock_stream.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
diff --git a/test/cpp/end2end/nonblocking_test.cc b/test/cpp/end2end/nonblocking_test.cc
index 509c5de0b6..cb75848337 100644
--- a/test/cpp/end2end/nonblocking_test.cc
+++ b/test/cpp/end2end/nonblocking_test.cc
@@ -18,12 +18,12 @@
#include <memory>
-#include <grpc++/channel.h>
-#include <grpc++/client_context.h>
-#include <grpc++/create_channel.h>
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
-#include <grpc++/server_context.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/client_context.h>
+#include <grpcpp/create_channel.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
+#include <grpcpp/server_context.h>
#include "src/core/lib/gpr/tls.h"
#include "src/core/lib/iomgr/port.h"
diff --git a/test/cpp/end2end/proto_server_reflection_test.cc b/test/cpp/end2end/proto_server_reflection_test.cc
index b645d90c63..21a275ef62 100644
--- a/test/cpp/end2end/proto_server_reflection_test.cc
+++ b/test/cpp/end2end/proto_server_reflection_test.cc
@@ -16,16 +16,16 @@
*
*/
-#include <grpc++/channel.h>
-#include <grpc++/client_context.h>
-#include <grpc++/create_channel.h>
-#include <grpc++/ext/proto_server_reflection_plugin.h>
-#include <grpc++/security/credentials.h>
-#include <grpc++/security/server_credentials.h>
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
-#include <grpc++/server_context.h>
#include <grpc/grpc.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/client_context.h>
+#include <grpcpp/create_channel.h>
+#include <grpcpp/ext/proto_server_reflection_plugin.h>
+#include <grpcpp/security/credentials.h>
+#include <grpcpp/security/server_credentials.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
+#include <grpcpp/server_context.h>
#include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "test/core/util/port.h"
diff --git a/test/cpp/end2end/round_robin_end2end_test.cc b/test/cpp/end2end/round_robin_end2end_test.cc
index eee32ce85d..846347e110 100644
--- a/test/cpp/end2end/round_robin_end2end_test.cc
+++ b/test/cpp/end2end/round_robin_end2end_test.cc
@@ -20,14 +20,14 @@
#include <mutex>
#include <thread>
-#include <grpc++/channel.h>
-#include <grpc++/client_context.h>
-#include <grpc++/create_channel.h>
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/client_context.h>
+#include <grpcpp/create_channel.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
#include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "test/core/util/port.h"
diff --git a/test/cpp/end2end/server_builder_plugin_test.cc b/test/cpp/end2end/server_builder_plugin_test.cc
index 2951a2ebcf..d54523fcbb 100644
--- a/test/cpp/end2end/server_builder_plugin_test.cc
+++ b/test/cpp/end2end/server_builder_plugin_test.cc
@@ -18,18 +18,18 @@
#include <thread>
-#include <grpc++/channel.h>
-#include <grpc++/client_context.h>
-#include <grpc++/create_channel.h>
-#include <grpc++/impl/server_builder_option.h>
-#include <grpc++/impl/server_builder_plugin.h>
-#include <grpc++/impl/server_initializer.h>
-#include <grpc++/security/credentials.h>
-#include <grpc++/security/server_credentials.h>
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
-#include <grpc++/server_context.h>
#include <grpc/grpc.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/client_context.h>
+#include <grpcpp/create_channel.h>
+#include <grpcpp/impl/server_builder_option.h>
+#include <grpcpp/impl/server_builder_plugin.h>
+#include <grpcpp/impl/server_initializer.h>
+#include <grpcpp/security/credentials.h>
+#include <grpcpp/security/server_credentials.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
+#include <grpcpp/server_context.h>
#include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "test/core/util/port.h"
diff --git a/test/cpp/end2end/server_crash_test.cc b/test/cpp/end2end/server_crash_test.cc
index 108dcd29e7..93257b2705 100644
--- a/test/cpp/end2end/server_crash_test.cc
+++ b/test/cpp/end2end/server_crash_test.cc
@@ -16,15 +16,15 @@
*
*/
-#include <grpc++/channel.h>
-#include <grpc++/client_context.h>
-#include <grpc++/create_channel.h>
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
-#include <grpc++/server_context.h>
#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/client_context.h>
+#include <grpcpp/create_channel.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
+#include <grpcpp/server_context.h>
#include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h"
#include "src/proto/grpc/testing/echo.grpc.pb.h"
diff --git a/test/cpp/end2end/server_crash_test_client.cc b/test/cpp/end2end/server_crash_test_client.cc
index 45995769fa..c05fcfdb81 100644
--- a/test/cpp/end2end/server_crash_test_client.cc
+++ b/test/cpp/end2end/server_crash_test_client.cc
@@ -22,10 +22,10 @@
#include <sstream>
#include <string>
-#include <grpc++/channel.h>
-#include <grpc++/client_context.h>
-#include <grpc++/create_channel.h>
#include <grpc/support/log.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/client_context.h>
+#include <grpcpp/create_channel.h>
#include "src/proto/grpc/testing/echo.grpc.pb.h"
diff --git a/test/cpp/end2end/server_early_return_test.cc b/test/cpp/end2end/server_early_return_test.cc
index a0349fdc4c..8948e5b854 100644
--- a/test/cpp/end2end/server_early_return_test.cc
+++ b/test/cpp/end2end/server_early_return_test.cc
@@ -16,18 +16,18 @@
*
*/
-#include <grpc++/channel.h>
-#include <grpc++/client_context.h>
-#include <grpc++/create_channel.h>
-#include <grpc++/security/credentials.h>
-#include <grpc++/security/server_credentials.h>
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
-#include <grpc++/server_context.h>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/client_context.h>
+#include <grpcpp/create_channel.h>
+#include <grpcpp/security/credentials.h>
+#include <grpcpp/security/server_credentials.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
+#include <grpcpp/server_context.h>
#include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "test/core/util/port.h"
diff --git a/test/cpp/end2end/shutdown_test.cc b/test/cpp/end2end/shutdown_test.cc
index 9119102f7a..a53de691bc 100644
--- a/test/cpp/end2end/shutdown_test.cc
+++ b/test/cpp/end2end/shutdown_test.cc
@@ -18,15 +18,15 @@
#include <thread>
-#include <grpc++/channel.h>
-#include <grpc++/client_context.h>
-#include <grpc++/create_channel.h>
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
-#include <grpc++/server_context.h>
#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/client_context.h>
+#include <grpcpp/create_channel.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
+#include <grpcpp/server_context.h>
#include "src/core/lib/gpr/env.h"
#include "src/proto/grpc/testing/echo.grpc.pb.h"
diff --git a/test/cpp/end2end/streaming_throughput_test.cc b/test/cpp/end2end/streaming_throughput_test.cc
index 4dc1d1f1d9..898d1ec118 100644
--- a/test/cpp/end2end/streaming_throughput_test.cc
+++ b/test/cpp/end2end/streaming_throughput_test.cc
@@ -20,18 +20,18 @@
#include <mutex>
#include <thread>
-#include <grpc++/channel.h>
-#include <grpc++/client_context.h>
-#include <grpc++/create_channel.h>
-#include <grpc++/security/credentials.h>
-#include <grpc++/security/server_credentials.h>
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
-#include <grpc++/server_context.h>
#include <grpc/grpc.h>
#include <grpc/support/atm.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/client_context.h>
+#include <grpcpp/create_channel.h>
+#include <grpcpp/security/credentials.h>
+#include <grpcpp/security/server_credentials.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
+#include <grpcpp/server_context.h>
#include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h"
#include "src/proto/grpc/testing/echo.grpc.pb.h"
diff --git a/test/cpp/end2end/test_service_impl.cc b/test/cpp/end2end/test_service_impl.cc
index 875a27b5f5..3c3a5d9cd4 100644
--- a/test/cpp/end2end/test_service_impl.cc
+++ b/test/cpp/end2end/test_service_impl.cc
@@ -21,9 +21,9 @@
#include <string>
#include <thread>
-#include <grpc++/security/credentials.h>
-#include <grpc++/server_context.h>
#include <grpc/support/log.h>
+#include <grpcpp/security/credentials.h>
+#include <grpcpp/server_context.h>
#include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "test/cpp/util/string_ref_helper.h"
diff --git a/test/cpp/end2end/test_service_impl.h b/test/cpp/end2end/test_service_impl.h
index 070f357139..052543a03e 100644
--- a/test/cpp/end2end/test_service_impl.h
+++ b/test/cpp/end2end/test_service_impl.h
@@ -21,8 +21,8 @@
#include <memory>
#include <mutex>
-#include <grpc++/server_context.h>
#include <grpc/grpc.h>
+#include <grpcpp/server_context.h>
#include "src/proto/grpc/testing/echo.grpc.pb.h"
diff --git a/test/cpp/end2end/thread_stress_test.cc b/test/cpp/end2end/thread_stress_test.cc
index 828beefea3..e709a25356 100644
--- a/test/cpp/end2end/thread_stress_test.cc
+++ b/test/cpp/end2end/thread_stress_test.cc
@@ -19,14 +19,14 @@
#include <mutex>
#include <thread>
-#include <grpc++/channel.h>
-#include <grpc++/client_context.h>
-#include <grpc++/create_channel.h>
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
-#include <grpc++/server_context.h>
#include <grpc/grpc.h>
#include <grpc/support/time.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/client_context.h>
+#include <grpcpp/create_channel.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
+#include <grpcpp/server_context.h>
#include "src/core/lib/surface/api_trace.h"
#include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h"
diff --git a/test/cpp/grpclb/grpclb_api_test.cc b/test/cpp/grpclb/grpclb_api_test.cc
index 1f2ef0c2de..ecba9f9ca3 100644
--- a/test/cpp/grpclb/grpclb_api_test.cc
+++ b/test/cpp/grpclb/grpclb_api_test.cc
@@ -16,8 +16,8 @@
*
*/
-#include <grpc++/impl/codegen/config.h>
#include <grpc/grpc.h>
+#include <grpcpp/impl/codegen/config.h>
#include <gtest/gtest.h>
#include "src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h"
diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc
index 4da9639d25..ca8ee3de06 100644
--- a/test/cpp/interop/client.cc
+++ b/test/cpp/interop/client.cc
@@ -20,11 +20,11 @@
#include <unordered_map>
#include <gflags/gflags.h>
-#include <grpc++/channel.h>
-#include <grpc++/client_context.h>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/client_context.h>
#include "src/core/lib/gpr/string.h"
#include "test/cpp/interop/client_helper.h"
diff --git a/test/cpp/interop/client_helper.cc b/test/cpp/interop/client_helper.cc
index fee34c52c3..4041f95abc 100644
--- a/test/cpp/interop/client_helper.cc
+++ b/test/cpp/interop/client_helper.cc
@@ -23,12 +23,12 @@
#include <sstream>
#include <gflags/gflags.h>
-#include <grpc++/channel.h>
-#include <grpc++/create_channel.h>
-#include <grpc++/security/credentials.h>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/create_channel.h>
+#include <grpcpp/security/credentials.h>
#include "src/cpp/client/secure_credentials.h"
#include "test/core/security/oauth2_utils.h"
diff --git a/test/cpp/interop/client_helper.h b/test/cpp/interop/client_helper.h
index f6e5bc9a51..eada2f671f 100644
--- a/test/cpp/interop/client_helper.h
+++ b/test/cpp/interop/client_helper.h
@@ -22,7 +22,7 @@
#include <memory>
#include <unordered_map>
-#include <grpc++/channel.h>
+#include <grpcpp/channel.h>
#include "src/core/lib/surface/call_test_only.h"
diff --git a/test/cpp/interop/http2_client.cc b/test/cpp/interop/http2_client.cc
index 411812d583..821815c6e8 100644
--- a/test/cpp/interop/http2_client.cc
+++ b/test/cpp/interop/http2_client.cc
@@ -19,10 +19,10 @@
#include <thread>
#include <gflags/gflags.h>
-#include <grpc++/channel.h>
-#include <grpc++/client_context.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/client_context.h>
#include "src/core/lib/transport/byte_stream.h"
#include "src/proto/grpc/testing/messages.pb.h"
diff --git a/test/cpp/interop/http2_client.h b/test/cpp/interop/http2_client.h
index f64041a803..2bcfdd69db 100644
--- a/test/cpp/interop/http2_client.h
+++ b/test/cpp/interop/http2_client.h
@@ -21,8 +21,8 @@
#include <memory>
-#include <grpc++/channel.h>
#include <grpc/grpc.h>
+#include <grpcpp/channel.h>
#include "src/proto/grpc/testing/messages.pb.h"
#include "src/proto/grpc/testing/test.grpc.pb.h"
diff --git a/test/cpp/interop/interop_client.cc b/test/cpp/interop/interop_client.cc
index 865b5c407f..68bf1e6dc7 100644
--- a/test/cpp/interop/interop_client.cc
+++ b/test/cpp/interop/interop_client.cc
@@ -20,14 +20,14 @@
#include <fstream>
#include <memory>
-#include <grpc++/channel.h>
-#include <grpc++/client_context.h>
-#include <grpc++/security/credentials.h>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/time.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/client_context.h>
+#include <grpcpp/security/credentials.h>
#include "src/core/lib/transport/byte_stream.h"
#include "src/proto/grpc/testing/empty.pb.h"
diff --git a/test/cpp/interop/interop_client.h b/test/cpp/interop/interop_client.h
index b8bb134c20..79ff24fc47 100644
--- a/test/cpp/interop/interop_client.h
+++ b/test/cpp/interop/interop_client.h
@@ -21,8 +21,8 @@
#include <memory>
-#include <grpc++/channel.h>
#include <grpc/grpc.h>
+#include <grpcpp/channel.h>
#include "src/proto/grpc/testing/messages.pb.h"
#include "src/proto/grpc/testing/test.grpc.pb.h"
diff --git a/test/cpp/interop/interop_server.cc b/test/cpp/interop/interop_server.cc
index f78a1f1d8a..5fa1a336da 100644
--- a/test/cpp/interop/interop_server.cc
+++ b/test/cpp/interop/interop_server.cc
@@ -22,13 +22,13 @@
#include <thread>
#include <gflags/gflags.h>
-#include <grpc++/security/server_credentials.h>
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
-#include <grpc++/server_context.h>
#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
+#include <grpcpp/security/server_credentials.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
+#include <grpcpp/server_context.h>
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/transport/byte_stream.h"
diff --git a/test/cpp/interop/metrics_client.cc b/test/cpp/interop/metrics_client.cc
index 1c6237879d..02cd564335 100644
--- a/test/cpp/interop/metrics_client.cc
+++ b/test/cpp/interop/metrics_client.cc
@@ -20,8 +20,8 @@
#include <string>
#include <gflags/gflags.h>
-#include <grpc++/grpc++.h>
#include <grpc/support/log.h>
+#include <grpcpp/grpcpp.h>
#include "src/proto/grpc/testing/metrics.grpc.pb.h"
#include "src/proto/grpc/testing/metrics.pb.h"
diff --git a/test/cpp/interop/reconnect_interop_client.cc b/test/cpp/interop/reconnect_interop_client.cc
index 2d9397a2b8..9a451fa3f2 100644
--- a/test/cpp/interop/reconnect_interop_client.cc
+++ b/test/cpp/interop/reconnect_interop_client.cc
@@ -20,11 +20,11 @@
#include <sstream>
#include <gflags/gflags.h>
-#include <grpc++/channel.h>
-#include <grpc++/client_context.h>
-#include <grpc++/support/channel_arguments.h>
#include <grpc/grpc.h>
#include <grpc/support/log.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/client_context.h>
+#include <grpcpp/support/channel_arguments.h>
#include "src/proto/grpc/testing/empty.pb.h"
#include "src/proto/grpc/testing/messages.pb.h"
#include "src/proto/grpc/testing/test.grpc.pb.h"
diff --git a/test/cpp/interop/reconnect_interop_server.cc b/test/cpp/interop/reconnect_interop_server.cc
index 5e257e1b38..e690c8fb00 100644
--- a/test/cpp/interop/reconnect_interop_server.cc
+++ b/test/cpp/interop/reconnect_interop_server.cc
@@ -26,11 +26,11 @@
#include <sstream>
#include <gflags/gflags.h>
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
-#include <grpc++/server_context.h>
#include <grpc/grpc.h>
#include <grpc/support/log.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
+#include <grpcpp/server_context.h>
#include "src/proto/grpc/testing/empty.pb.h"
#include "src/proto/grpc/testing/messages.pb.h"
diff --git a/test/cpp/interop/server_helper.cc b/test/cpp/interop/server_helper.cc
index be449a9262..93ffd52560 100644
--- a/test/cpp/interop/server_helper.cc
+++ b/test/cpp/interop/server_helper.cc
@@ -21,7 +21,7 @@
#include <memory>
#include <gflags/gflags.h>
-#include <grpc++/security/server_credentials.h>
+#include <grpcpp/security/server_credentials.h>
#include "src/core/lib/surface/call_test_only.h"
#include "test/cpp/util/test_credentials_provider.h"
diff --git a/test/cpp/interop/server_helper.h b/test/cpp/interop/server_helper.h
index 1bf7db1e14..3004e7ff81 100644
--- a/test/cpp/interop/server_helper.h
+++ b/test/cpp/interop/server_helper.h
@@ -25,8 +25,8 @@
#include <grpc/compression.h>
#include <grpc/impl/codegen/atm.h>
-#include <grpc++/security/server_credentials.h>
-#include <grpc++/server_context.h>
+#include <grpcpp/security/server_credentials.h>
+#include <grpcpp/server_context.h>
namespace grpc {
namespace testing {
diff --git a/test/cpp/interop/stress_interop_client.cc b/test/cpp/interop/stress_interop_client.cc
index 7afddbb26b..30a8351cfe 100644
--- a/test/cpp/interop/stress_interop_client.cc
+++ b/test/cpp/interop/stress_interop_client.cc
@@ -22,8 +22,8 @@
#include <string>
#include <vector>
-#include <grpc++/create_channel.h>
#include <grpc/support/log.h>
+#include <grpcpp/create_channel.h>
#include "test/cpp/interop/interop_client.h"
#include "test/cpp/util/metrics_server.h"
diff --git a/test/cpp/interop/stress_interop_client.h b/test/cpp/interop/stress_interop_client.h
index ee15be0f08..a306dc3565 100644
--- a/test/cpp/interop/stress_interop_client.h
+++ b/test/cpp/interop/stress_interop_client.h
@@ -23,7 +23,7 @@
#include <string>
#include <vector>
-#include <grpc++/create_channel.h>
+#include <grpcpp/create_channel.h>
#include "test/cpp/interop/interop_client.h"
#include "test/cpp/util/metrics_server.h"
diff --git a/test/cpp/interop/stress_test.cc b/test/cpp/interop/stress_test.cc
index 4b39dc3211..6e8134a83b 100644
--- a/test/cpp/interop/stress_test.cc
+++ b/test/cpp/interop/stress_test.cc
@@ -23,10 +23,10 @@
#include <vector>
#include <gflags/gflags.h>
-#include <grpc++/create_channel.h>
-#include <grpc++/grpc++.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
+#include <grpcpp/create_channel.h>
+#include <grpcpp/grpcpp.h>
#include "src/proto/grpc/testing/metrics.grpc.pb.h"
#include "src/proto/grpc/testing/metrics.pb.h"
diff --git a/test/cpp/microbenchmarks/BUILD b/test/cpp/microbenchmarks/BUILD
index 0b69e9ba9a..67f7e440b0 100644
--- a/test/cpp/microbenchmarks/BUILD
+++ b/test/cpp/microbenchmarks/BUILD
@@ -143,3 +143,10 @@ grpc_cc_binary(
srcs = ["bm_metadata.cc"],
deps = [":helpers"],
)
+
+grpc_cc_binary(
+ name = "bm_chttp2_hpack",
+ testonly = 1,
+ srcs = ["bm_chttp2_hpack.cc"],
+ deps = [":helpers"],
+)
diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc
index 5c2c38c27d..85a9f5e137 100644
--- a/test/cpp/microbenchmarks/bm_call_create.cc
+++ b/test/cpp/microbenchmarks/bm_call_create.cc
@@ -23,11 +23,11 @@
#include <string.h>
#include <sstream>
-#include <grpc++/channel.h>
-#include <grpc++/support/channel_arguments.h>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/string_util.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/support/channel_arguments.h>
#include "src/core/ext/filters/client_channel/client_channel.h"
#include "src/core/ext/filters/deadline/deadline_filter.h"
diff --git a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc
index 07bb3c92ae..d0f3ec8e8b 100644
--- a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc
+++ b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc
@@ -18,9 +18,11 @@
/* Microbenchmarks around CHTTP2 HPACK operations */
+#include <benchmark/benchmark.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <string.h>
+#include <memory>
#include <sstream>
#include "src/core/ext/transport/chttp2/transport/hpack_encoder.h"
@@ -31,7 +33,6 @@
#include "src/core/lib/transport/timeout_encoding.h"
#include "test/cpp/microbenchmarks/helpers.h"
-#include "third_party/benchmark/include/benchmark/benchmark.h"
auto& force_library_initialization = Library::get();
@@ -51,10 +52,11 @@ static grpc_slice MakeSlice(std::vector<uint8_t> bytes) {
static void BM_HpackEncoderInitDestroy(benchmark::State& state) {
TrackCounters track_counters;
grpc_core::ExecCtx exec_ctx;
- grpc_chttp2_hpack_compressor c;
+ std::unique_ptr<grpc_chttp2_hpack_compressor> c(
+ new grpc_chttp2_hpack_compressor);
while (state.KeepRunning()) {
- grpc_chttp2_hpack_compressor_init(&c);
- grpc_chttp2_hpack_compressor_destroy(&c);
+ grpc_chttp2_hpack_compressor_init(c.get());
+ grpc_chttp2_hpack_compressor_destroy(c.get());
grpc_core::ExecCtx::Get()->Flush();
}
@@ -71,8 +73,9 @@ static void BM_HpackEncoderEncodeDeadline(benchmark::State& state) {
grpc_metadata_batch_init(&b);
b.deadline = saved_now + 30 * 1000;
- grpc_chttp2_hpack_compressor c;
- grpc_chttp2_hpack_compressor_init(&c);
+ std::unique_ptr<grpc_chttp2_hpack_compressor> c(
+ new grpc_chttp2_hpack_compressor);
+ grpc_chttp2_hpack_compressor_init(c.get());
grpc_transport_one_way_stats stats;
memset(&stats, 0, sizeof(stats));
grpc_slice_buffer outbuf;
@@ -85,12 +88,12 @@ static void BM_HpackEncoderEncodeDeadline(benchmark::State& state) {
static_cast<size_t>(1024),
&stats,
};
- grpc_chttp2_encode_header(&c, nullptr, 0, &b, &hopt, &outbuf);
+ grpc_chttp2_encode_header(c.get(), nullptr, 0, &b, &hopt, &outbuf);
grpc_slice_buffer_reset_and_unref_internal(&outbuf);
grpc_core::ExecCtx::Get()->Flush();
}
grpc_metadata_batch_destroy(&b);
- grpc_chttp2_hpack_compressor_destroy(&c);
+ grpc_chttp2_hpack_compressor_destroy(c.get());
grpc_slice_buffer_destroy_internal(&outbuf);
std::ostringstream label;
@@ -120,8 +123,9 @@ static void BM_HpackEncoderEncodeHeader(benchmark::State& state) {
"addmd", grpc_metadata_batch_add_tail(&b, &storage[i], elems[i])));
}
- grpc_chttp2_hpack_compressor c;
- grpc_chttp2_hpack_compressor_init(&c);
+ std::unique_ptr<grpc_chttp2_hpack_compressor> c(
+ new grpc_chttp2_hpack_compressor);
+ grpc_chttp2_hpack_compressor_init(c.get());
grpc_transport_one_way_stats stats;
memset(&stats, 0, sizeof(stats));
grpc_slice_buffer outbuf;
@@ -134,7 +138,7 @@ static void BM_HpackEncoderEncodeHeader(benchmark::State& state) {
static_cast<size_t>(state.range(1)),
&stats,
};
- grpc_chttp2_encode_header(&c, nullptr, 0, &b, &hopt, &outbuf);
+ grpc_chttp2_encode_header(c.get(), nullptr, 0, &b, &hopt, &outbuf);
if (!logged_representative_output && state.iterations() > 3) {
logged_representative_output = true;
for (size_t i = 0; i < outbuf.count; i++) {
@@ -147,7 +151,7 @@ static void BM_HpackEncoderEncodeHeader(benchmark::State& state) {
grpc_core::ExecCtx::Get()->Flush();
}
grpc_metadata_batch_destroy(&b);
- grpc_chttp2_hpack_compressor_destroy(&c);
+ grpc_chttp2_hpack_compressor_destroy(c.get());
grpc_slice_buffer_destroy_internal(&outbuf);
std::ostringstream label;
diff --git a/test/cpp/microbenchmarks/bm_chttp2_transport.cc b/test/cpp/microbenchmarks/bm_chttp2_transport.cc
index fcb1677d09..d00c79b610 100644
--- a/test/cpp/microbenchmarks/bm_chttp2_transport.cc
+++ b/test/cpp/microbenchmarks/bm_chttp2_transport.cc
@@ -18,10 +18,10 @@
/* Microbenchmarks around CHTTP2 transport operations */
-#include <grpc++/support/channel_arguments.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
+#include <grpcpp/support/channel_arguments.h>
#include <string.h>
#include <memory>
#include <queue>
@@ -398,13 +398,13 @@ static void BM_TransportStreamSend(benchmark::State& state) {
memset(&op, 0, sizeof(op));
op.payload = &op_payload;
};
- grpc_slice_buffer_stream send_stream;
- grpc_slice_buffer send_buffer;
- grpc_slice_buffer_init(&send_buffer);
- grpc_slice_buffer_add(&send_buffer, gpr_slice_malloc(state.range(0)));
- memset(GRPC_SLICE_START_PTR(send_buffer.slices[0]), 0,
- GRPC_SLICE_LENGTH(send_buffer.slices[0]));
-
+ // Create the send_message payload slice.
+ // Note: We use grpc_slice_malloc_large() instead of grpc_slice_malloc()
+ // to force the slice to be refcounted, so that it remains alive when it
+ // is unreffed after each send_message op.
+ grpc_slice send_slice = grpc_slice_malloc_large(state.range(0));
+ memset(GRPC_SLICE_START_PTR(send_slice), 0, GRPC_SLICE_LENGTH(send_slice));
+ grpc_core::ManualConstructor<grpc_core::SliceBufferByteStream> send_stream;
grpc_metadata_batch b;
grpc_metadata_batch_init(&b);
b.deadline = GRPC_MILLIS_INF_FUTURE;
@@ -424,14 +424,18 @@ static void BM_TransportStreamSend(benchmark::State& state) {
gpr_event_set(bm_done, (void*)1);
return;
}
+ grpc_slice_buffer send_buffer;
+ grpc_slice_buffer_init(&send_buffer);
+ grpc_slice_buffer_add(&send_buffer, grpc_slice_ref(send_slice));
+ send_stream.Init(&send_buffer, 0);
+ grpc_slice_buffer_destroy(&send_buffer);
// force outgoing window to be yuge
s->chttp2_stream()->flow_control->TestOnlyForceHugeWindow();
f.chttp2_transport()->flow_control->TestOnlyForceHugeWindow();
- grpc_slice_buffer_stream_init(&send_stream, &send_buffer, 0);
reset_op();
op.on_complete = c.get();
op.send_message = true;
- op.payload->send_message.send_message = &send_stream.base;
+ op.payload->send_message.send_message.reset(send_stream.get());
s->Op(&op);
});
@@ -454,7 +458,7 @@ static void BM_TransportStreamSend(benchmark::State& state) {
s.reset();
track_counters.Finish(state);
grpc_metadata_batch_destroy(&b);
- grpc_slice_buffer_destroy(&send_buffer);
+ grpc_slice_unref(send_slice);
}
BENCHMARK(BM_TransportStreamSend)->Range(0, 128 * 1024 * 1024);
@@ -524,7 +528,7 @@ static void BM_TransportStreamRecv(benchmark::State& state) {
grpc_transport_stream_op_batch_payload op_payload;
memset(&op_payload, 0, sizeof(op_payload));
grpc_transport_stream_op_batch op;
- grpc_byte_stream* recv_stream;
+ grpc_core::OrphanablePtr<grpc_core::ByteStream> recv_stream;
grpc_slice incoming_data = CreateIncomingDataSlice(state.range(0), 16384);
auto reset_op = [&]() {
@@ -579,21 +583,20 @@ static void BM_TransportStreamRecv(benchmark::State& state) {
drain = MakeClosure([&](grpc_error* error) {
do {
- if (received == recv_stream->length) {
- grpc_byte_stream_destroy(recv_stream);
+ if (received == recv_stream->length()) {
+ recv_stream.reset();
GRPC_CLOSURE_SCHED(c.get(), GRPC_ERROR_NONE);
return;
}
- } while (grpc_byte_stream_next(recv_stream, recv_stream->length - received,
- drain_continue.get()) &&
- GRPC_ERROR_NONE ==
- grpc_byte_stream_pull(recv_stream, &recv_slice) &&
+ } while (recv_stream->Next(recv_stream->length() - received,
+ drain_continue.get()) &&
+ GRPC_ERROR_NONE == recv_stream->Pull(&recv_slice) &&
(received += GRPC_SLICE_LENGTH(recv_slice),
grpc_slice_unref_internal(recv_slice), true));
});
drain_continue = MakeClosure([&](grpc_error* error) {
- grpc_byte_stream_pull(recv_stream, &recv_slice);
+ recv_stream->Pull(&recv_slice);
received += GRPC_SLICE_LENGTH(recv_slice);
grpc_slice_unref_internal(recv_slice);
GRPC_CLOSURE_RUN(drain.get(), GRPC_ERROR_NONE);
diff --git a/test/cpp/microbenchmarks/bm_cq.cc b/test/cpp/microbenchmarks/bm_cq.cc
index 97242598f1..342a95ed10 100644
--- a/test/cpp/microbenchmarks/bm_cq.cc
+++ b/test/cpp/microbenchmarks/bm_cq.cc
@@ -20,10 +20,10 @@
* working */
#include <benchmark/benchmark.h>
-#include <grpc++/completion_queue.h>
-#include <grpc++/impl/grpc_library.h>
#include <grpc/grpc.h>
#include <grpc/support/log.h>
+#include <grpcpp/completion_queue.h>
+#include <grpcpp/impl/grpc_library.h>
#include "test/cpp/microbenchmarks/helpers.h"
#include "src/core/lib/surface/completion_queue.h"
diff --git a/test/cpp/microbenchmarks/fullstack_context_mutators.h b/test/cpp/microbenchmarks/fullstack_context_mutators.h
index 3584280c48..6e7fd57540 100644
--- a/test/cpp/microbenchmarks/fullstack_context_mutators.h
+++ b/test/cpp/microbenchmarks/fullstack_context_mutators.h
@@ -19,14 +19,14 @@
#ifndef TEST_CPP_MICROBENCHMARKS_FULLSTACK_CONTEXT_MUTATORS_H
#define TEST_CPP_MICROBENCHMARKS_FULLSTACK_CONTEXT_MUTATORS_H
-#include <grpc++/channel.h>
-#include <grpc++/create_channel.h>
-#include <grpc++/security/credentials.h>
-#include <grpc++/security/server_credentials.h>
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
-#include <grpc++/server_context.h>
#include <grpc/support/log.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/create_channel.h>
+#include <grpcpp/security/credentials.h>
+#include <grpcpp/security/server_credentials.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
+#include <grpcpp/server_context.h>
#include "test/cpp/microbenchmarks/helpers.h"
diff --git a/test/cpp/microbenchmarks/fullstack_fixtures.h b/test/cpp/microbenchmarks/fullstack_fixtures.h
index ab6c194830..9d70277fbc 100644
--- a/test/cpp/microbenchmarks/fullstack_fixtures.h
+++ b/test/cpp/microbenchmarks/fullstack_fixtures.h
@@ -19,14 +19,14 @@
#ifndef TEST_CPP_MICROBENCHMARKS_FULLSTACK_FIXTURES_H
#define TEST_CPP_MICROBENCHMARKS_FULLSTACK_FIXTURES_H
-#include <grpc++/channel.h>
-#include <grpc++/create_channel.h>
-#include <grpc++/security/credentials.h>
-#include <grpc++/security/server_credentials.h>
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
#include <grpc/support/atm.h>
#include <grpc/support/log.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/create_channel.h>
+#include <grpcpp/security/credentials.h>
+#include <grpcpp/security/server_credentials.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
#include "src/core/lib/channel/channel_args.h"
diff --git a/test/cpp/microbenchmarks/helpers.h b/test/cpp/microbenchmarks/helpers.h
index afa3e0f3ca..4aabd4094a 100644
--- a/test/cpp/microbenchmarks/helpers.h
+++ b/test/cpp/microbenchmarks/helpers.h
@@ -27,7 +27,7 @@
#include "test/core/util/memory_counters.h"
#include <benchmark/benchmark.h>
-#include <grpc++/impl/grpc_library.h>
+#include <grpcpp/impl/grpc_library.h>
class Library {
public:
diff --git a/test/cpp/naming/BUILD b/test/cpp/naming/BUILD
index a8fa0a078a..54b53d2792 100644
--- a/test/cpp/naming/BUILD
+++ b/test/cpp/naming/BUILD
@@ -34,17 +34,4 @@ grpc_sh_binary(
],
)
-grpc_py_binary(
- name = "test_dns_server",
- srcs = ["test_dns_server.py"],
- testonly = True,
- data = [
- "resolver_test_record_groups.yaml",
- ],
- external_deps = [
- "twisted",
- "yaml",
- ]
-)
-
generate_resolver_component_tests()
diff --git a/test/cpp/naming/generate_resolver_component_tests.bzl b/test/cpp/naming/generate_resolver_component_tests.bzl
index 118d9452d9..d0fb51439f 100755
--- a/test/cpp/naming/generate_resolver_component_tests.bzl
+++ b/test/cpp/naming/generate_resolver_component_tests.bzl
@@ -54,7 +54,9 @@ def generate_resolver_component_tests():
data = [
":resolver_component_tests_runner",
":resolver_component_test%s" % unsecure_build_config_suffix,
- ":test_dns_server",
+ "//test/cpp/naming/utils:dns_server",
+ "//test/cpp/naming/utils:dns_resolver",
+ "//test/cpp/naming/utils:tcp_connect",
"resolver_test_record_groups.yaml", # include the transitive dependency so that the dns sever py binary can locate this
],
args = [
diff --git a/test/cpp/naming/resolver_component_tests_runner.sh b/test/cpp/naming/resolver_component_tests_runner.sh
index 618a173dc0..18b56ab69b 100755
--- a/test/cpp/naming/resolver_component_tests_runner.sh
+++ b/test/cpp/naming/resolver_component_tests_runner.sh
@@ -18,12 +18,14 @@
set -ex
# all command args required in this set order
-FLAGS_test_bin_path=$(echo "$1" | grep '\--test_bin_path=' | cut -d "=" -f 2)
-FLAGS_dns_server_bin_path=$(echo "$2" | grep '\--dns_server_bin_path=' | cut -d "=" -f 2)
-FLAGS_records_config_path=$(echo "$3" | grep '\--records_config_path=' | cut -d "=" -f 2)
-FLAGS_test_dns_server_port=$(echo "$4" | grep '\--test_dns_server_port=' | cut -d "=" -f 2)
-
-for cmd_arg in "$FLAGS_test_bin_path" "$FLAGS_dns_server_bin_path" "$FLAGS_records_config_path" "$FLAGS_test_dns_server_port"; do
+FLAGS_test_bin_path=$(echo "$1" | grep '\--test_bin_path=' | sed 's/^--test_bin_path=//')
+FLAGS_dns_server_bin_path=$(echo "$2" | grep '\--dns_server_bin_path=' | sed 's/^--dns_server_bin_path=//')
+FLAGS_records_config_path=$(echo "$3" | grep '\--records_config_path=' | sed 's/^--records_config_path=//')
+FLAGS_dns_server_port=$(echo "$4" | grep '\--dns_server_port=' | sed 's/^--dns_server_port=//')
+FLAGS_dns_resolver_bin_path=$(echo "$5" | grep '\--dns_resolver_bin_path=' | sed 's/^--dns_resolver_bin_path=//')
+FLAGS_tcp_connect_bin_path=$(echo "$6" | grep '\--tcp_connect_bin_path=' | sed 's/^--tcp_connect_bin_path=//')
+
+for cmd_arg in "$FLAGS_test_bin_path" "$FLAGS_dns_server_bin_path" "$FLAGS_records_config_path" "$FLAGS_dns_server_port" "$FLAGS_dns_resolver_bin_path" "$FLAGS_tcp_connect_bin_path"; do
if [[ "$cmd_arg" == "" ]]; then
echo "Missing a CMD arg" && exit 1
fi
@@ -34,17 +36,17 @@ if [[ "$GRPC_DNS_RESOLVER" != "" && "$GRPC_DNS_RESOLVER" != ares ]]; then
fi
export GRPC_DNS_RESOLVER=ares
-"$FLAGS_dns_server_bin_path" --records_config_path="$FLAGS_records_config_path" --port="$FLAGS_test_dns_server_port" > /dev/null 2>&1 &
+"$FLAGS_dns_server_bin_path" --records_config_path="$FLAGS_records_config_path" --port="$FLAGS_dns_server_port" > /dev/null 2>&1 &
DNS_SERVER_PID=$!
echo "Local DNS server started. PID: $DNS_SERVER_PID"
# Health check local DNS server TCP and UDP ports
for ((i=0;i<30;i++));
do
- echo "Retry health-check DNS query to local DNS server over tcp and udp"
+ echo "Retry health-check local DNS server by attempting a DNS query and TCP handshake"
RETRY=0
- dig A health-check-local-dns-server-is-alive.resolver-tests.grpctestingexp. @localhost -p "$FLAGS_test_dns_server_port" +tries=1 +timeout=1 | grep '123.123.123.123' || RETRY=1
- dig A health-check-local-dns-server-is-alive.resolver-tests.grpctestingexp. @localhost -p "$FLAGS_test_dns_server_port" +tries=1 +timeout=1 +tcp | grep '123.123.123.123' || RETRY=1
+ $FLAGS_dns_resolver_bin_path -s 127.0.0.1 -p "$FLAGS_dns_server_port" -n health-check-local-dns-server-is-alive.resolver-tests.grpctestingexp. -t 1 | grep '123.123.123.123' || RETRY=1
+ $FLAGS_tcp_connect_bin_path -s 127.0.0.1 -p "$FLAGS_dns_server_port" -t 1 || RETRY=1
if [[ "$RETRY" == 0 ]]; then
break
fi;
@@ -77,7 +79,7 @@ $FLAGS_test_bin_path \
--expected_addrs='1.2.3.4:1234,True' \
--expected_chosen_service_config='' \
--expected_lb_policy='' \
- --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" &
+ --local_dns_server_address="127.0.0.1:$FLAGS_dns_server_port" &
wait "$!" || EXIT_CODE=1
$FLAGS_test_bin_path \
@@ -85,7 +87,7 @@ $FLAGS_test_bin_path \
--expected_addrs='1.2.3.5:1234,True;1.2.3.6:1234,True;1.2.3.7:1234,True' \
--expected_chosen_service_config='' \
--expected_lb_policy='' \
- --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" &
+ --local_dns_server_address="127.0.0.1:$FLAGS_dns_server_port" &
wait "$!" || EXIT_CODE=1
$FLAGS_test_bin_path \
@@ -93,7 +95,7 @@ $FLAGS_test_bin_path \
--expected_addrs='[2607:f8b0:400a:801::1001]:1234,True' \
--expected_chosen_service_config='' \
--expected_lb_policy='' \
- --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" &
+ --local_dns_server_address="127.0.0.1:$FLAGS_dns_server_port" &
wait "$!" || EXIT_CODE=1
$FLAGS_test_bin_path \
@@ -101,7 +103,7 @@ $FLAGS_test_bin_path \
--expected_addrs='[2607:f8b0:400a:801::1002]:1234,True;[2607:f8b0:400a:801::1003]:1234,True;[2607:f8b0:400a:801::1004]:1234,True' \
--expected_chosen_service_config='' \
--expected_lb_policy='' \
- --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" &
+ --local_dns_server_address="127.0.0.1:$FLAGS_dns_server_port" &
wait "$!" || EXIT_CODE=1
$FLAGS_test_bin_path \
@@ -109,7 +111,7 @@ $FLAGS_test_bin_path \
--expected_addrs='1.2.3.4:1234,True' \
--expected_chosen_service_config='{"loadBalancingPolicy":"round_robin","methodConfig":[{"name":[{"method":"Foo","service":"SimpleService","waitForReady":true}]}]}' \
--expected_lb_policy='round_robin' \
- --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" &
+ --local_dns_server_address="127.0.0.1:$FLAGS_dns_server_port" &
wait "$!" || EXIT_CODE=1
$FLAGS_test_bin_path \
@@ -117,7 +119,7 @@ $FLAGS_test_bin_path \
--expected_addrs='1.2.3.4:443,False' \
--expected_chosen_service_config='{"loadBalancingPolicy":"round_robin","methodConfig":[{"name":[{"method":"Foo","service":"NoSrvSimpleService","waitForReady":true}]}]}' \
--expected_lb_policy='round_robin' \
- --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" &
+ --local_dns_server_address="127.0.0.1:$FLAGS_dns_server_port" &
wait "$!" || EXIT_CODE=1
$FLAGS_test_bin_path \
@@ -125,7 +127,7 @@ $FLAGS_test_bin_path \
--expected_addrs='1.2.3.4:443,False' \
--expected_chosen_service_config='' \
--expected_lb_policy='' \
- --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" &
+ --local_dns_server_address="127.0.0.1:$FLAGS_dns_server_port" &
wait "$!" || EXIT_CODE=1
$FLAGS_test_bin_path \
@@ -133,7 +135,7 @@ $FLAGS_test_bin_path \
--expected_addrs='1.2.3.4:443,False' \
--expected_chosen_service_config='' \
--expected_lb_policy='' \
- --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" &
+ --local_dns_server_address="127.0.0.1:$FLAGS_dns_server_port" &
wait "$!" || EXIT_CODE=1
$FLAGS_test_bin_path \
@@ -141,7 +143,7 @@ $FLAGS_test_bin_path \
--expected_addrs='1.2.3.4:443,False' \
--expected_chosen_service_config='{"loadBalancingPolicy":"round_robin","methodConfig":[{"name":[{"method":"Foo","service":"CppService","waitForReady":true}]}]}' \
--expected_lb_policy='round_robin' \
- --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" &
+ --local_dns_server_address="127.0.0.1:$FLAGS_dns_server_port" &
wait "$!" || EXIT_CODE=1
$FLAGS_test_bin_path \
@@ -149,7 +151,7 @@ $FLAGS_test_bin_path \
--expected_addrs='1.2.3.4:443,False' \
--expected_chosen_service_config='{"loadBalancingPolicy":"round_robin","methodConfig":[{"name":[{"method":"Foo","service":"AlwaysPickedService","waitForReady":true}]}]}' \
--expected_lb_policy='round_robin' \
- --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" &
+ --local_dns_server_address="127.0.0.1:$FLAGS_dns_server_port" &
wait "$!" || EXIT_CODE=1
$FLAGS_test_bin_path \
@@ -157,7 +159,7 @@ $FLAGS_test_bin_path \
--expected_addrs='1.2.3.4:1234,True;1.2.3.4:443,False' \
--expected_chosen_service_config='' \
--expected_lb_policy='' \
- --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" &
+ --local_dns_server_address="127.0.0.1:$FLAGS_dns_server_port" &
wait "$!" || EXIT_CODE=1
$FLAGS_test_bin_path \
@@ -165,7 +167,7 @@ $FLAGS_test_bin_path \
--expected_addrs='[2607:f8b0:400a:801::1002]:1234,True;[2607:f8b0:400a:801::1002]:443,False' \
--expected_chosen_service_config='' \
--expected_lb_policy='' \
- --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" &
+ --local_dns_server_address="127.0.0.1:$FLAGS_dns_server_port" &
wait "$!" || EXIT_CODE=1
$FLAGS_test_bin_path \
@@ -173,7 +175,7 @@ $FLAGS_test_bin_path \
--expected_addrs='1.2.3.4:443,False' \
--expected_chosen_service_config='{"loadBalancingPolicy":"round_robin","methodConfig":[{"name":[{"method":"Foo","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooTwo","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooThree","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooFour","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooFive","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooSix","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooSeven","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooEight","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooNine","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooTen","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooEleven","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooTwelve","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooTwelve","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooTwelve","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooTwelve","service":"SimpleService","waitForReady":true}]}]}' \
--expected_lb_policy='' \
- --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" &
+ --local_dns_server_address="127.0.0.1:$FLAGS_dns_server_port" &
wait "$!" || EXIT_CODE=1
kill -SIGTERM "$DNS_SERVER_PID" || true
diff --git a/test/cpp/naming/resolver_component_tests_runner_invoker.cc b/test/cpp/naming/resolver_component_tests_runner_invoker.cc
index 306c322780..b2a7890549 100644
--- a/test/cpp/naming/resolver_component_tests_runner_invoker.cc
+++ b/test/cpp/naming/resolver_component_tests_runner_invoker.cc
@@ -102,14 +102,18 @@ namespace testing {
void InvokeResolverComponentTestsRunner(std::string test_runner_bin_path,
std::string test_bin_path,
std::string dns_server_bin_path,
- std::string records_config_path) {
- int test_dns_server_port = grpc_pick_unused_port_or_die();
-
- SubProcess* test_driver = new SubProcess(
- {test_runner_bin_path, "--test_bin_path=" + test_bin_path,
- "--dns_server_bin_path=" + dns_server_bin_path,
- "--records_config_path=" + records_config_path,
- "--test_dns_server_port=" + std::to_string(test_dns_server_port)});
+ std::string records_config_path,
+ std::string dns_resolver_bin_path,
+ std::string tcp_connect_bin_path) {
+ int dns_server_port = grpc_pick_unused_port_or_die();
+
+ SubProcess* test_driver =
+ new SubProcess({test_runner_bin_path, "--test_bin_path=" + test_bin_path,
+ "--dns_server_bin_path=" + dns_server_bin_path,
+ "--records_config_path=" + records_config_path,
+ "--dns_server_port=" + std::to_string(dns_server_port),
+ "--dns_resolver_bin_path=" + dns_resolver_bin_path,
+ "--tcp_connect_bin_path=" + tcp_connect_bin_path});
gpr_mu test_driver_mu;
gpr_mu_init(&test_driver_mu);
gpr_cv test_driver_cv;
@@ -170,8 +174,9 @@ int main(int argc, char** argv) {
// sure that we're using bazel's test environment.
grpc::testing::InvokeResolverComponentTestsRunner(
bin_dir + "/resolver_component_tests_runner",
- bin_dir + "/" + FLAGS_test_bin_name, bin_dir + "/test_dns_server",
- bin_dir + "/resolver_test_record_groups.yaml");
+ bin_dir + "/" + FLAGS_test_bin_name, bin_dir + "/utils/dns_server",
+ bin_dir + "/resolver_test_record_groups.yaml",
+ bin_dir + "/utils/dns_resolver", bin_dir + "/utils/tcp_connect");
} else {
// Get the current binary's directory relative to repo root to invoke the
// correct build config (asan/tsan/dbg, etc.).
@@ -180,8 +185,10 @@ int main(int argc, char** argv) {
grpc::testing::InvokeResolverComponentTestsRunner(
"test/cpp/naming/resolver_component_tests_runner.sh",
bin_dir + "/" + FLAGS_test_bin_name,
- "test/cpp/naming/test_dns_server.py",
- "test/cpp/naming/resolver_test_record_groups.yaml");
+ "test/cpp/naming/utils/dns_server.py",
+ "test/cpp/naming/resolver_test_record_groups.yaml",
+ "test/cpp/naming/utils/dns_resolver.py",
+ "test/cpp/naming/utils/tcp_connect.py");
}
grpc_shutdown();
return 0;
diff --git a/test/cpp/naming/utils/BUILD b/test/cpp/naming/utils/BUILD
new file mode 100644
index 0000000000..e7b6bc5fe7
--- /dev/null
+++ b/test/cpp/naming/utils/BUILD
@@ -0,0 +1,50 @@
+# Copyright 2017 gRPC authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+package(
+ default_visibility = ["//visibility:public"],
+ features = [
+ "-layering_check",
+ "-parse_headers",
+ ],
+)
+
+licenses(["notice"]) # Apache v2
+
+load("//bazel:grpc_build_system.bzl", "grpc_py_binary")
+
+grpc_py_binary(
+ name = "dns_server",
+ srcs = ["dns_server.py"],
+ testonly = True,
+ external_deps = [
+ "twisted",
+ "yaml",
+ ]
+)
+
+grpc_py_binary(
+ name = "dns_resolver",
+ srcs = ["dns_resolver.py"],
+ testonly = True,
+ external_deps = [
+ "twisted",
+ ]
+)
+
+grpc_py_binary(
+ name = "tcp_connect",
+ srcs = ["tcp_connect.py"],
+ testonly = True,
+)
diff --git a/test/cpp/naming/utils/dns_resolver.py b/test/cpp/naming/utils/dns_resolver.py
new file mode 100755
index 0000000000..6b272444e7
--- /dev/null
+++ b/test/cpp/naming/utils/dns_resolver.py
@@ -0,0 +1,48 @@
+#!/usr/bin/env python2.7
+# Copyright 2015 gRPC authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""Makes DNS queries for A records to specified servers"""
+
+import argparse
+import signal
+import twisted.internet.task as task
+import twisted.names.client as client
+
+def main():
+ argp = argparse.ArgumentParser(description='Make DNS queries for A records')
+ argp.add_argument('-s', '--server_host', default='127.0.0.1', type=str,
+ help='Host for DNS server to listen on for TCP and UDP.')
+ argp.add_argument('-p', '--server_port', default=53, type=int,
+ help='Port that the DNS server is listening on.')
+ argp.add_argument('-n', '--qname', default=None, type=str,
+ help=('Name of the record to query for. '))
+ argp.add_argument('-t', '--timeout', default=1, type=int,
+ help=('Force process exit after this number of seconds.'))
+ args = argp.parse_args()
+ signal.alarm(args.timeout)
+ def OnResolverResultAvailable(result):
+ answers, authority, additional = result
+ for a in answers:
+ print(a.payload)
+ def BeginQuery(reactor, qname):
+ servers = [(args.server_host, args.server_port)]
+ resolver = client.Resolver(servers=servers)
+ deferred_result = resolver.lookupAddress(args.qname)
+ deferred_result.addCallback(OnResolverResultAvailable)
+ return deferred_result
+ task.react(BeginQuery, [args.qname])
+
+if __name__ == '__main__':
+ main()
diff --git a/test/cpp/naming/test_dns_server.py b/test/cpp/naming/utils/dns_server.py
index 9f42f65ee6..9f42f65ee6 100755
--- a/test/cpp/naming/test_dns_server.py
+++ b/test/cpp/naming/utils/dns_server.py
diff --git a/test/cpp/naming/utils/tcp_connect.py b/test/cpp/naming/utils/tcp_connect.py
new file mode 100755
index 0000000000..bf7455e3c2
--- /dev/null
+++ b/test/cpp/naming/utils/tcp_connect.py
@@ -0,0 +1,35 @@
+#!/usr/bin/env python2.7
+# Copyright 2015 gRPC authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""Opens a TCP connection to a specified server and then exits."""
+
+import argparse
+import signal
+import socket
+
+def main():
+ argp = argparse.ArgumentParser(description='Open a TCP handshake to a server')
+ argp.add_argument('-s', '--server_host', default=None, type=str,
+ help='Server host name or IP.')
+ argp.add_argument('-p', '--server_port', default=0, type=int,
+ help='Port that the server is listening on.')
+ argp.add_argument('-t', '--timeout', default=1, type=int,
+ help='Force process exit after this number of seconds.')
+ args = argp.parse_args()
+ signal.alarm(args.timeout)
+ socket.create_connection([args.server_host, args.server_port])
+
+if __name__ == '__main__':
+ main()
diff --git a/test/cpp/performance/writes_per_rpc_test.cc b/test/cpp/performance/writes_per_rpc_test.cc
index d0190de172..5faa7ba757 100644
--- a/test/cpp/performance/writes_per_rpc_test.cc
+++ b/test/cpp/performance/writes_per_rpc_test.cc
@@ -16,14 +16,14 @@
*
*/
-#include <grpc++/channel.h>
-#include <grpc++/create_channel.h>
-#include <grpc++/impl/grpc_library.h>
-#include <grpc++/security/credentials.h>
-#include <grpc++/security/server_credentials.h>
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
#include <grpc/support/log.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/create_channel.h>
+#include <grpcpp/impl/grpc_library.h>
+#include <grpcpp/security/credentials.h>
+#include <grpcpp/security/server_credentials.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
#include <gtest/gtest.h>
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
diff --git a/test/cpp/qps/benchmark_config.cc b/test/cpp/qps/benchmark_config.cc
index fb1e0608c5..a4fd9de820 100644
--- a/test/cpp/qps/benchmark_config.cc
+++ b/test/cpp/qps/benchmark_config.cc
@@ -18,9 +18,9 @@
#include "test/cpp/qps/benchmark_config.h"
#include <gflags/gflags.h>
-#include <grpc++/create_channel.h>
-#include <grpc++/security/credentials.h>
#include <grpc/support/log.h>
+#include <grpcpp/create_channel.h>
+#include <grpcpp/security/credentials.h>
DEFINE_bool(enable_log_reporter, true,
"Enable reporting of benchmark results through GprLog");
diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h
index 82c6361abd..77743a1dee 100644
--- a/test/cpp/qps/client.h
+++ b/test/cpp/qps/client.h
@@ -24,12 +24,12 @@
#include <unordered_map>
#include <vector>
-#include <grpc++/channel.h>
-#include <grpc++/support/byte_buffer.h>
-#include <grpc++/support/channel_arguments.h>
-#include <grpc++/support/slice.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/support/byte_buffer.h>
+#include <grpcpp/support/channel_arguments.h>
+#include <grpcpp/support/slice.h>
#include "src/proto/grpc/testing/payloads.pb.h"
#include "src/proto/grpc/testing/services.grpc.pb.h"
diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc
index 8215ecbf55..f9bef91da0 100644
--- a/test/cpp/qps/client_async.cc
+++ b/test/cpp/qps/client_async.cc
@@ -26,13 +26,13 @@
#include <thread>
#include <vector>
-#include <grpc++/alarm.h>
-#include <grpc++/channel.h>
-#include <grpc++/client_context.h>
-#include <grpc++/generic/generic_stub.h>
#include <grpc/grpc.h>
#include <grpc/support/cpu.h>
#include <grpc/support/log.h>
+#include <grpcpp/alarm.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/client_context.h>
+#include <grpcpp/generic/generic_stub.h>
#include "src/core/lib/surface/completion_queue.h"
#include "src/proto/grpc/testing/services.grpc.pb.h"
diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc
index 8c1d9417fa..5185eef710 100644
--- a/test/cpp/qps/client_sync.cc
+++ b/test/cpp/qps/client_sync.cc
@@ -24,14 +24,14 @@
#include <thread>
#include <vector>
-#include <grpc++/channel.h>
-#include <grpc++/client_context.h>
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/client_context.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/profiling/timers.h"
diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc
index 4e0d266d77..361ee4346f 100644
--- a/test/cpp/qps/driver.cc
+++ b/test/cpp/qps/driver.cc
@@ -23,12 +23,12 @@
#include <unordered_map>
#include <vector>
-#include <grpc++/channel.h>
-#include <grpc++/client_context.h>
-#include <grpc++/create_channel.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/client_context.h>
+#include <grpcpp/create_channel.h>
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/gpr/host_port.h"
diff --git a/test/cpp/qps/interarrival.h b/test/cpp/qps/interarrival.h
index 9c48066c9c..ce4bf3d30c 100644
--- a/test/cpp/qps/interarrival.h
+++ b/test/cpp/qps/interarrival.h
@@ -24,7 +24,7 @@
#include <random>
#include <vector>
-#include <grpc++/support/config.h>
+#include <grpcpp/support/config.h>
namespace grpc {
namespace testing {
diff --git a/test/cpp/qps/parse_json.h b/test/cpp/qps/parse_json.h
index f2fffb52d4..089d9989ba 100644
--- a/test/cpp/qps/parse_json.h
+++ b/test/cpp/qps/parse_json.h
@@ -19,8 +19,8 @@
#ifndef TEST_QPS_PARSE_JSON_H
#define TEST_QPS_PARSE_JSON_H
-#include <grpc++/impl/codegen/config_protobuf.h>
-#include <grpc++/support/config.h>
+#include <grpcpp/impl/codegen/config_protobuf.h>
+#include <grpcpp/support/config.h>
namespace grpc {
namespace testing {
diff --git a/test/cpp/qps/qps_json_driver.cc b/test/cpp/qps/qps_json_driver.cc
index b2449da69c..0ff692255c 100644
--- a/test/cpp/qps/qps_json_driver.cc
+++ b/test/cpp/qps/qps_json_driver.cc
@@ -21,7 +21,7 @@
#include <memory>
#include <set>
-#include <grpc++/impl/codegen/config_protobuf.h>
+#include <grpcpp/impl/codegen/config_protobuf.h>
#include <gflags/gflags.h>
#include <grpc/support/log.h>
diff --git a/test/cpp/qps/qps_worker.cc b/test/cpp/qps/qps_worker.cc
index 215a7bfbc9..aaffb1d93e 100644
--- a/test/cpp/qps/qps_worker.cc
+++ b/test/cpp/qps/qps_worker.cc
@@ -25,14 +25,14 @@
#include <thread>
#include <vector>
-#include <grpc++/client_context.h>
-#include <grpc++/security/server_credentials.h>
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/cpu.h>
#include <grpc/support/log.h>
+#include <grpcpp/client_context.h>
+#include <grpcpp/security/server_credentials.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
#include "src/core/lib/gpr/host_port.h"
#include "src/proto/grpc/testing/services.pb.h"
diff --git a/test/cpp/qps/qps_worker.h b/test/cpp/qps/qps_worker.h
index a5167426d0..3a8796ee5a 100644
--- a/test/cpp/qps/qps_worker.h
+++ b/test/cpp/qps/qps_worker.h
@@ -21,10 +21,10 @@
#include <memory>
-#include <grpc++/server.h>
-#include <grpc++/support/channel_arguments.h>
-#include <grpc++/support/config.h>
#include <grpc/support/atm.h>
+#include <grpcpp/server.h>
+#include <grpcpp/support/channel_arguments.h>
+#include <grpcpp/support/config.h>
#include "test/cpp/qps/server.h"
diff --git a/test/cpp/qps/report.cc b/test/cpp/qps/report.cc
index c5e90bd9a4..0a2565d463 100644
--- a/test/cpp/qps/report.cc
+++ b/test/cpp/qps/report.cc
@@ -25,7 +25,7 @@
#include "test/cpp/qps/parse_json.h"
#include "test/cpp/qps/stats.h"
-#include <grpc++/client_context.h>
+#include <grpcpp/client_context.h>
#include "src/cpp/util/core_stats.h"
#include "src/proto/grpc/testing/services.grpc.pb.h"
diff --git a/test/cpp/qps/report.h b/test/cpp/qps/report.h
index 1d7b2b54e7..c5dd138353 100644
--- a/test/cpp/qps/report.h
+++ b/test/cpp/qps/report.h
@@ -23,11 +23,11 @@
#include <set>
#include <vector>
-#include <grpc++/support/config.h>
+#include <grpcpp/support/config.h>
#include "test/cpp/qps/driver.h"
-#include <grpc++/channel.h>
+#include <grpcpp/channel.h>
#include "src/proto/grpc/testing/services.grpc.pb.h"
namespace grpc {
diff --git a/test/cpp/qps/server.h b/test/cpp/qps/server.h
index d772e709de..6b1ef93617 100644
--- a/test/cpp/qps/server.h
+++ b/test/cpp/qps/server.h
@@ -19,11 +19,11 @@
#ifndef TEST_QPS_SERVER_H
#define TEST_QPS_SERVER_H
-#include <grpc++/resource_quota.h>
-#include <grpc++/security/server_credentials.h>
-#include <grpc++/server_builder.h>
#include <grpc/support/cpu.h>
#include <grpc/support/log.h>
+#include <grpcpp/resource_quota.h>
+#include <grpcpp/security/server_credentials.h>
+#include <grpcpp/server_builder.h>
#include <vector>
#include "src/cpp/util/core_stats.h"
diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc
index f1dfea24d8..9cb05cd1d1 100644
--- a/test/cpp/qps/server_async.cc
+++ b/test/cpp/qps/server_async.cc
@@ -23,16 +23,16 @@
#include <mutex>
#include <thread>
-#include <grpc++/generic/async_generic_service.h>
-#include <grpc++/resource_quota.h>
-#include <grpc++/security/server_credentials.h>
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
-#include <grpc++/server_context.h>
-#include <grpc++/support/config.h>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
+#include <grpcpp/generic/async_generic_service.h>
+#include <grpcpp/resource_quota.h>
+#include <grpcpp/security/server_credentials.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
+#include <grpcpp/server_context.h>
+#include <grpcpp/support/config.h>
#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/surface/completion_queue.h"
diff --git a/test/cpp/qps/server_sync.cc b/test/cpp/qps/server_sync.cc
index 19cbb53445..9dfd362055 100644
--- a/test/cpp/qps/server_sync.cc
+++ b/test/cpp/qps/server_sync.cc
@@ -19,11 +19,11 @@
#include <atomic>
#include <thread>
-#include <grpc++/security/server_credentials.h>
-#include <grpc++/server.h>
-#include <grpc++/server_context.h>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
+#include <grpcpp/security/server_credentials.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_context.h>
#include "src/core/lib/gpr/host_port.h"
#include "src/proto/grpc/testing/services.grpc.pb.h"
diff --git a/test/cpp/server/server_builder_test.cc b/test/cpp/server/server_builder_test.cc
index 694ce549c0..2752b5838c 100644
--- a/test/cpp/server/server_builder_test.cc
+++ b/test/cpp/server/server_builder_test.cc
@@ -16,11 +16,11 @@
*
*/
-#include <grpc++/impl/codegen/config.h>
+#include <grpcpp/impl/codegen/config.h>
#include <gtest/gtest.h>
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
#include <grpc/grpc.h>
diff --git a/test/cpp/server/server_request_call_test.cc b/test/cpp/server/server_request_call_test.cc
index b0a2fa444c..9831c06176 100644
--- a/test/cpp/server/server_request_call_test.cc
+++ b/test/cpp/server/server_request_call_test.cc
@@ -18,13 +18,13 @@
#include <thread>
-#include <grpc++/impl/codegen/config.h>
+#include <grpcpp/impl/codegen/config.h>
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
-#include <grpc++/create_channel.h>
-#include <grpc++/security/credentials.h>
+#include <grpcpp/create_channel.h>
+#include <grpcpp/security/credentials.h>
#include <grpc/support/log.h>
diff --git a/test/cpp/test/server_context_test_spouse_test.cc b/test/cpp/test/server_context_test_spouse_test.cc
index d1dc9d7cac..e199a0fe3d 100644
--- a/test/cpp/test/server_context_test_spouse_test.cc
+++ b/test/cpp/test/server_context_test_spouse_test.cc
@@ -16,12 +16,12 @@
*
*/
-#include <grpc++/test/server_context_test_spouse.h>
+#include <grpcpp/test/server_context_test_spouse.h>
#include <cstring>
#include <vector>
-#include <grpc++/impl/grpc_library.h>
+#include <grpcpp/impl/grpc_library.h>
#include <gtest/gtest.h>
namespace grpc {
diff --git a/test/cpp/thread_manager/thread_manager_test.cc b/test/cpp/thread_manager/thread_manager_test.cc
index 8282d46694..7a95a9f17d 100644
--- a/test/cpp/thread_manager/thread_manager_test.cc
+++ b/test/cpp/thread_manager/thread_manager_test.cc
@@ -16,14 +16,15 @@
*is % allowed in string
*/
+#include <inttypes.h>
#include <ctime>
#include <memory>
#include <string>
#include <gflags/gflags.h>
-#include <grpc++/grpc++.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"
diff --git a/test/cpp/util/byte_buffer_proto_helper.h b/test/cpp/util/byte_buffer_proto_helper.h
index 1a9955e38c..94603db110 100644
--- a/test/cpp/util/byte_buffer_proto_helper.h
+++ b/test/cpp/util/byte_buffer_proto_helper.h
@@ -21,8 +21,8 @@
#include <memory>
-#include <grpc++/impl/codegen/config_protobuf.h>
-#include <grpc++/support/byte_buffer.h>
+#include <grpcpp/impl/codegen/config_protobuf.h>
+#include <grpcpp/support/byte_buffer.h>
namespace grpc {
namespace testing {
diff --git a/test/cpp/util/byte_buffer_test.cc b/test/cpp/util/byte_buffer_test.cc
index d603b289c8..605ef15123 100644
--- a/test/cpp/util/byte_buffer_test.cc
+++ b/test/cpp/util/byte_buffer_test.cc
@@ -16,14 +16,14 @@
*
*/
-#include <grpc++/support/byte_buffer.h>
+#include <grpcpp/support/byte_buffer.h>
#include <cstring>
#include <vector>
-#include <grpc++/support/slice.h>
#include <grpc/grpc.h>
#include <grpc/slice.h>
+#include <grpcpp/support/slice.h>
#include <gtest/gtest.h>
namespace grpc {
diff --git a/test/cpp/util/cli_call.cc b/test/cpp/util/cli_call.cc
index 6fc22f35ca..a3992ab278 100644
--- a/test/cpp/util/cli_call.cc
+++ b/test/cpp/util/cli_call.cc
@@ -20,12 +20,12 @@
#include <iostream>
-#include <grpc++/channel.h>
-#include <grpc++/client_context.h>
-#include <grpc++/support/byte_buffer.h>
#include <grpc/grpc.h>
#include <grpc/slice.h>
#include <grpc/support/log.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/client_context.h>
+#include <grpcpp/support/byte_buffer.h>
namespace grpc {
namespace testing {
diff --git a/test/cpp/util/cli_call.h b/test/cpp/util/cli_call.h
index eff18ee318..51ffafd29f 100644
--- a/test/cpp/util/cli_call.h
+++ b/test/cpp/util/cli_call.h
@@ -21,11 +21,11 @@
#include <map>
-#include <grpc++/channel.h>
-#include <grpc++/completion_queue.h>
-#include <grpc++/generic/generic_stub.h>
-#include <grpc++/support/status.h>
-#include <grpc++/support/string_ref.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/completion_queue.h>
+#include <grpcpp/generic/generic_stub.h>
+#include <grpcpp/support/status.h>
+#include <grpcpp/support/string_ref.h>
namespace grpc {
diff --git a/test/cpp/util/cli_call_test.cc b/test/cpp/util/cli_call_test.cc
index e54cc8528f..516f3fa53d 100644
--- a/test/cpp/util/cli_call_test.cc
+++ b/test/cpp/util/cli_call_test.cc
@@ -18,13 +18,13 @@
#include "test/cpp/util/cli_call.h"
-#include <grpc++/channel.h>
-#include <grpc++/client_context.h>
-#include <grpc++/create_channel.h>
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
-#include <grpc++/server_context.h>
#include <grpc/grpc.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/client_context.h>
+#include <grpcpp/create_channel.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
+#include <grpcpp/server_context.h>
#include <gtest/gtest.h>
#include "src/proto/grpc/testing/echo.grpc.pb.h"
diff --git a/test/cpp/util/cli_credentials.h b/test/cpp/util/cli_credentials.h
index 469e8c54e6..b1358e77d8 100644
--- a/test/cpp/util/cli_credentials.h
+++ b/test/cpp/util/cli_credentials.h
@@ -19,8 +19,8 @@
#ifndef GRPC_TEST_CPP_UTIL_CLI_CREDENTIALS_H
#define GRPC_TEST_CPP_UTIL_CLI_CREDENTIALS_H
-#include <grpc++/security/credentials.h>
-#include <grpc++/support/config.h>
+#include <grpcpp/security/credentials.h>
+#include <grpcpp/support/config.h>
namespace grpc {
namespace testing {
diff --git a/test/cpp/util/config_grpc_cli.h b/test/cpp/util/config_grpc_cli.h
index c157aab25a..358884196d 100644
--- a/test/cpp/util/config_grpc_cli.h
+++ b/test/cpp/util/config_grpc_cli.h
@@ -19,7 +19,7 @@
#ifndef GRPC_TEST_CPP_UTIL_CONFIG_GRPC_CLI_H
#define GRPC_TEST_CPP_UTIL_CONFIG_GRPC_CLI_H
-#include <grpc++/impl/codegen/config_protobuf.h>
+#include <grpcpp/impl/codegen/config_protobuf.h>
#ifndef GRPC_CUSTOM_DYNAMICMESSAGEFACTORY
#include <google/protobuf/dynamic_message.h>
diff --git a/test/cpp/util/create_test_channel.cc b/test/cpp/util/create_test_channel.cc
index 4d047473b9..1047d44627 100644
--- a/test/cpp/util/create_test_channel.cc
+++ b/test/cpp/util/create_test_channel.cc
@@ -18,9 +18,9 @@
#include "test/cpp/util/create_test_channel.h"
-#include <grpc++/create_channel.h>
-#include <grpc++/security/credentials.h>
#include <grpc/support/log.h>
+#include <grpcpp/create_channel.h>
+#include <grpcpp/security/credentials.h>
#include "test/cpp/util/test_credentials_provider.h"
diff --git a/test/cpp/util/create_test_channel.h b/test/cpp/util/create_test_channel.h
index e2ca8f99b4..ddaa99f43e 100644
--- a/test/cpp/util/create_test_channel.h
+++ b/test/cpp/util/create_test_channel.h
@@ -21,7 +21,7 @@
#include <memory>
-#include <grpc++/security/credentials.h>
+#include <grpcpp/security/credentials.h>
namespace grpc {
class Channel;
diff --git a/test/cpp/util/error_details_test.cc b/test/cpp/util/error_details_test.cc
index 16a00fb201..f71dfc0df9 100644
--- a/test/cpp/util/error_details_test.cc
+++ b/test/cpp/util/error_details_test.cc
@@ -16,7 +16,7 @@
*
*/
-#include <grpc++/support/error_details.h>
+#include <grpcpp/support/error_details.h>
#include <gtest/gtest.h>
#include "src/proto/grpc/status/status.pb.h"
diff --git a/test/cpp/util/grpc_cli.cc b/test/cpp/util/grpc_cli.cc
index 67359434a2..10e13d929b 100644
--- a/test/cpp/util/grpc_cli.cc
+++ b/test/cpp/util/grpc_cli.cc
@@ -58,7 +58,7 @@
#include <iostream>
#include <gflags/gflags.h>
-#include <grpc++/support/config.h>
+#include <grpcpp/support/config.h>
#include "test/cpp/util/cli_credentials.h"
#include "test/cpp/util/grpc_tool.h"
#include "test/cpp/util/test_config.h"
diff --git a/test/cpp/util/grpc_tool.cc b/test/cpp/util/grpc_tool.cc
index e9dd7512c4..195b6bd304 100644
--- a/test/cpp/util/grpc_tool.cc
+++ b/test/cpp/util/grpc_tool.cc
@@ -27,13 +27,13 @@
#include <thread>
#include <gflags/gflags.h>
-#include <grpc++/channel.h>
-#include <grpc++/create_channel.h>
-#include <grpc++/grpc++.h>
-#include <grpc++/security/credentials.h>
-#include <grpc++/support/string_ref.h>
#include <grpc/grpc.h>
#include <grpc/support/port_platform.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/create_channel.h>
+#include <grpcpp/grpcpp.h>
+#include <grpcpp/security/credentials.h>
+#include <grpcpp/support/string_ref.h>
#include "test/cpp/util/cli_call.h"
#include "test/cpp/util/proto_file_parser.h"
diff --git a/test/cpp/util/grpc_tool.h b/test/cpp/util/grpc_tool.h
index a10422f882..fb53af77c8 100644
--- a/test/cpp/util/grpc_tool.h
+++ b/test/cpp/util/grpc_tool.h
@@ -21,7 +21,7 @@
#include <functional>
-#include <grpc++/support/config.h>
+#include <grpcpp/support/config.h>
#include "test/cpp/util/cli_credentials.h"
diff --git a/test/cpp/util/grpc_tool_test.cc b/test/cpp/util/grpc_tool_test.cc
index 135cfdc1f3..9f7fec5e93 100644
--- a/test/cpp/util/grpc_tool_test.cc
+++ b/test/cpp/util/grpc_tool_test.cc
@@ -21,14 +21,14 @@
#include <sstream>
#include <gflags/gflags.h>
-#include <grpc++/channel.h>
-#include <grpc++/client_context.h>
-#include <grpc++/create_channel.h>
-#include <grpc++/ext/proto_server_reflection_plugin.h>
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
-#include <grpc++/server_context.h>
#include <grpc/grpc.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/client_context.h>
+#include <grpcpp/create_channel.h>
+#include <grpcpp/ext/proto_server_reflection_plugin.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
+#include <grpcpp/server_context.h>
#include <gtest/gtest.h>
#include "src/core/lib/gpr/env.h"
diff --git a/test/cpp/util/metrics_server.cc b/test/cpp/util/metrics_server.cc
index 5982815dd7..a058206506 100644
--- a/test/cpp/util/metrics_server.cc
+++ b/test/cpp/util/metrics_server.cc
@@ -18,9 +18,9 @@
#include "test/cpp/util/metrics_server.h"
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
#include <grpc/support/log.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
#include "src/proto/grpc/testing/metrics.grpc.pb.h"
#include "src/proto/grpc/testing/metrics.pb.h"
diff --git a/test/cpp/util/proto_file_parser.cc b/test/cpp/util/proto_file_parser.cc
index e2c8b05220..3fc96f38ae 100644
--- a/test/cpp/util/proto_file_parser.cc
+++ b/test/cpp/util/proto_file_parser.cc
@@ -23,7 +23,7 @@
#include <sstream>
#include <unordered_set>
-#include <grpc++/support/config.h>
+#include <grpcpp/support/config.h>
namespace grpc {
namespace testing {
diff --git a/test/cpp/util/proto_file_parser.h b/test/cpp/util/proto_file_parser.h
index 35f3782f14..2236b59451 100644
--- a/test/cpp/util/proto_file_parser.h
+++ b/test/cpp/util/proto_file_parser.h
@@ -21,7 +21,7 @@
#include <memory>
-#include <grpc++/channel.h>
+#include <grpcpp/channel.h>
#include "test/cpp/util/config_grpc_cli.h"
#include "test/cpp/util/proto_reflection_descriptor_database.h"
diff --git a/test/cpp/util/proto_reflection_descriptor_database.h b/test/cpp/util/proto_reflection_descriptor_database.h
index a6776c2a86..e4cf2f207e 100644
--- a/test/cpp/util/proto_reflection_descriptor_database.h
+++ b/test/cpp/util/proto_reflection_descriptor_database.h
@@ -23,8 +23,8 @@
#include <unordered_set>
#include <vector>
-#include <grpc++/grpc++.h>
-#include <grpc++/impl/codegen/config_protobuf.h>
+#include <grpcpp/grpcpp.h>
+#include <grpcpp/impl/codegen/config_protobuf.h>
#include "src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.h"
namespace grpc {
diff --git a/test/cpp/util/service_describer.h b/test/cpp/util/service_describer.h
index b7ab7578b4..f7ef50c7bb 100644
--- a/test/cpp/util/service_describer.h
+++ b/test/cpp/util/service_describer.h
@@ -19,7 +19,7 @@
#ifndef GRPC_TEST_CPP_UTIL_SERVICE_DESCRIBER_H
#define GRPC_TEST_CPP_UTIL_SERVICE_DESCRIBER_H
-#include <grpc++/support/config.h>
+#include <grpcpp/support/config.h>
#include "test/cpp/util/config_grpc_cli.h"
namespace grpc {
diff --git a/test/cpp/util/slice_test.cc b/test/cpp/util/slice_test.cc
index 5f0b9c17cc..8e06062360 100644
--- a/test/cpp/util/slice_test.cc
+++ b/test/cpp/util/slice_test.cc
@@ -16,7 +16,7 @@
*
*/
-#include <grpc++/support/slice.h>
+#include <grpcpp/support/slice.h>
#include <grpc/grpc.h>
#include <grpc/slice.h>
diff --git a/test/cpp/util/status_test.cc b/test/cpp/util/status_test.cc
index 1047cdb50e..2188723db8 100644
--- a/test/cpp/util/status_test.cc
+++ b/test/cpp/util/status_test.cc
@@ -16,7 +16,7 @@
*
*/
-#include <grpc++/support/status.h>
+#include <grpcpp/support/status.h>
#include <grpc/status.h>
#include <grpc/support/log.h>
diff --git a/test/cpp/util/string_ref_helper.h b/test/cpp/util/string_ref_helper.h
index e4cb71ad05..707767de07 100644
--- a/test/cpp/util/string_ref_helper.h
+++ b/test/cpp/util/string_ref_helper.h
@@ -19,7 +19,7 @@
#ifndef GRPC_TEST_CPP_UTIL_STRING_REF_HELPER_H
#define GRPC_TEST_CPP_UTIL_STRING_REF_HELPER_H
-#include <grpc++/support/string_ref.h>
+#include <grpcpp/support/string_ref.h>
namespace grpc {
namespace testing {
diff --git a/test/cpp/util/string_ref_test.cc b/test/cpp/util/string_ref_test.cc
index 3f62760f76..8f7986e64e 100644
--- a/test/cpp/util/string_ref_test.cc
+++ b/test/cpp/util/string_ref_test.cc
@@ -16,7 +16,7 @@
*
*/
-#include <grpc++/support/string_ref.h>
+#include <grpcpp/support/string_ref.h>
#include <string.h>
diff --git a/test/cpp/util/test_credentials_provider.h b/test/cpp/util/test_credentials_provider.h
index 6f8f768d6b..f489a2c563 100644
--- a/test/cpp/util/test_credentials_provider.h
+++ b/test/cpp/util/test_credentials_provider.h
@@ -21,9 +21,9 @@
#include <memory>
-#include <grpc++/security/credentials.h>
-#include <grpc++/security/server_credentials.h>
-#include <grpc++/support/channel_arguments.h>
+#include <grpcpp/security/credentials.h>
+#include <grpcpp/security/server_credentials.h>
+#include <grpcpp/support/channel_arguments.h>
namespace grpc {
namespace testing {
diff --git a/test/cpp/util/time_test.cc b/test/cpp/util/time_test.cc
index 73ec44c2a5..a8851a583d 100644
--- a/test/cpp/util/time_test.cc
+++ b/test/cpp/util/time_test.cc
@@ -16,8 +16,8 @@
*
*/
-#include <grpc++/support/time.h>
#include <grpc/support/time.h>
+#include <grpcpp/support/time.h>
#include <gtest/gtest.h>
using std::chrono::duration_cast;
diff --git a/test/distrib/csharp/run_distrib_test.sh b/test/distrib/csharp/run_distrib_test.sh
index eee24d0e57..b96872725e 100755
--- a/test/distrib/csharp/run_distrib_test.sh
+++ b/test/distrib/csharp/run_distrib_test.sh
@@ -21,6 +21,11 @@ unzip -o "$EXTERNAL_GIT_ROOT/input_artifacts/csharp_nugets_windows_dotnetcli.zip
./update_version.sh auto
+# With a recent-enough version of mono, the "nuget restore" command would
+# restore packages based on project.json files, but we want to restore packages
+# based on the net45 legacy "packages.config" file instead.
+rm DistribTest/*project.json
+
nuget restore
xbuild DistribTest.sln
diff --git a/test/distrib/php/run_distrib_test.sh b/test/distrib/php/run_distrib_test.sh
index f781815840..a6102f6075 100755
--- a/test/distrib/php/run_distrib_test.sh
+++ b/test/distrib/php/run_distrib_test.sh
@@ -19,7 +19,7 @@ cd "$(dirname "$0")"
cp -r "$EXTERNAL_GIT_ROOT"/input_artifacts/grpc-*.tgz .
-find . -regextype sed -regex ".*/grpc-[0-9].*.tgz" | cut -b3- | \
+find . -regex ".*/grpc-[0-9].*.tgz" | cut -b3- | \
xargs pecl install
php -d extension=grpc.so -d max_execution_time=300 distribtest.php