aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/core/channel/channel_args_test.c141
-rw-r--r--test/core/end2end/dualstack_socket_test.c36
-rw-r--r--test/core/end2end/fixtures/chttp2_fake_security.c2
-rw-r--r--test/core/end2end/fixtures/chttp2_simple_ssl_fullstack.c2
-rw-r--r--test/core/end2end/fixtures/chttp2_simple_ssl_fullstack_with_poll.c2
-rw-r--r--test/core/end2end/fixtures/chttp2_simple_ssl_fullstack_with_proxy.c2
-rw-r--r--test/core/end2end/fixtures/chttp2_simple_ssl_with_oauth2_fullstack.c4
-rw-r--r--test/core/httpcli/httpcli_test.c6
-rw-r--r--test/core/iomgr/endpoint_tests.c9
-rw-r--r--test/core/iomgr/fd_posix_test.c12
-rw-r--r--test/core/iomgr/tcp_client_posix_test.c9
-rw-r--r--test/core/iomgr/tcp_posix_test.c15
-rw-r--r--test/core/iomgr/tcp_server_posix_test.c3
-rw-r--r--test/core/iomgr/udp_server_test.c3
-rw-r--r--test/core/security/oauth2_utils.c2
-rw-r--r--test/core/security/print_google_default_creds_token.c4
-rw-r--r--test/core/security/verify_jwt.c2
-rw-r--r--test/core/util/port_posix.c2
-rw-r--r--test/core/util/reconnect_server.c3
-rw-r--r--test/cpp/client/channel_arguments_test.cc2
-rw-r--r--test/cpp/common/auth_property_iterator_test.cc2
-rw-r--r--test/cpp/common/secure_auth_context_test.cc2
-rw-r--r--test/cpp/end2end/async_end2end_test.cc260
-rw-r--r--test/cpp/end2end/client_crash_test.cc21
-rw-r--r--test/cpp/end2end/client_crash_test_server.cc1
-rw-r--r--test/cpp/end2end/end2end_test.cc36
-rw-r--r--test/cpp/end2end/generic_end2end_test.cc28
-rw-r--r--test/cpp/end2end/mock_test.cc27
-rw-r--r--test/cpp/end2end/server_crash_test.cc21
-rw-r--r--test/cpp/end2end/server_crash_test_client.cc4
-rw-r--r--test/cpp/end2end/shutdown_test.cc20
-rw-r--r--test/cpp/end2end/thread_stress_test.cc27
-rw-r--r--test/cpp/end2end/zookeeper_test.cc15
-rw-r--r--test/cpp/interop/client.cc5
-rw-r--r--test/cpp/interop/client_helper.cc13
-rw-r--r--test/cpp/interop/client_helper.h5
-rw-r--r--test/cpp/interop/interop_client.cc12
-rw-r--r--test/cpp/interop/interop_client.h10
-rw-r--r--test/cpp/interop/interop_test.cc11
-rw-r--r--test/cpp/interop/reconnect_interop_client.cc7
-rw-r--r--test/cpp/interop/reconnect_interop_server.cc9
-rw-r--r--test/cpp/interop/server.cc14
-rw-r--r--test/cpp/interop/server_helper.cc1
-rw-r--r--test/cpp/qps/client.h12
-rw-r--r--test/cpp/qps/client_async.cc6
-rw-r--r--test/cpp/qps/client_sync.cc9
-rw-r--r--test/cpp/qps/driver.cc22
-rw-r--r--test/cpp/qps/interarrival.h2
-rw-r--r--test/cpp/qps/perf_db_client.h7
-rw-r--r--test/cpp/qps/qps_interarrival_test.cc4
-rw-r--r--test/cpp/qps/qps_openloop_test.cc4
-rw-r--r--test/cpp/qps/qps_test.cc4
-rw-r--r--test/cpp/qps/qps_test_with_poll.cc4
-rw-r--r--test/cpp/qps/qps_worker.cc5
-rw-r--r--test/cpp/qps/report.h3
-rw-r--r--test/cpp/qps/server_async.cc10
-rw-r--r--test/cpp/qps/server_sync.cc23
-rw-r--r--test/cpp/qps/stats.h3
-rw-r--r--test/cpp/qps/sync_streaming_ping_pong_test.cc4
-rw-r--r--test/cpp/qps/sync_unary_ping_pong_test.cc4
-rw-r--r--test/cpp/qps/timer.cc1
-rw-r--r--test/cpp/qps/worker.cc2
-rw-r--r--test/cpp/server/dynamic_thread_pool_test.cc77
-rw-r--r--test/cpp/server/fixed_size_thread_pool_test.cc77
-rw-r--r--test/cpp/util/byte_buffer_test.cc4
-rw-r--r--test/cpp/util/cli_call.cc13
-rw-r--r--test/cpp/util/cli_call.h7
-rw-r--r--test/cpp/util/cli_call_test.cc20
-rw-r--r--test/cpp/util/create_test_channel.cc12
-rw-r--r--test/cpp/util/create_test_channel.h11
-rw-r--r--test/cpp/util/grpc_cli.cc11
-rw-r--r--test/cpp/util/slice_test.cc2
-rw-r--r--test/cpp/util/status_test.cc3
-rw-r--r--test/cpp/util/string_ref_test.cc215
-rw-r--r--test/cpp/util/time_test.cc2
75 files changed, 814 insertions, 581 deletions
diff --git a/test/core/channel/channel_args_test.c b/test/core/channel/channel_args_test.c
new file mode 100644
index 0000000000..87f006acde
--- /dev/null
+++ b/test/core/channel/channel_args_test.c
@@ -0,0 +1,141 @@
+/*
+ *
+ * Copyright 2015, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include <string.h>
+
+#include <grpc/support/log.h>
+#include <grpc/support/useful.h>
+
+#include "src/core/channel/channel_args.h"
+
+#include "test/core/util/test_config.h"
+
+static void test_create(void) {
+ grpc_arg arg_int;
+ grpc_arg arg_string;
+ grpc_arg to_add[2];
+ grpc_channel_args *ch_args;
+
+ arg_int.key = "int_arg";
+ arg_int.type = GRPC_ARG_INTEGER;
+ arg_int.value.integer = 123;
+
+ arg_string.key = "str key";
+ arg_string.type = GRPC_ARG_STRING;
+ arg_string.value.string = "str value";
+
+ to_add[0] = arg_int;
+ to_add[1] = arg_string;
+ ch_args = grpc_channel_args_copy_and_add(NULL, to_add, 2);
+
+ GPR_ASSERT(ch_args->num_args == 2);
+ GPR_ASSERT(strcmp(ch_args->args[0].key, arg_int.key) == 0);
+ GPR_ASSERT(ch_args->args[0].type == arg_int.type);
+ GPR_ASSERT(ch_args->args[0].value.integer == arg_int.value.integer);
+
+ GPR_ASSERT(strcmp(ch_args->args[1].key, arg_string.key) == 0);
+ GPR_ASSERT(ch_args->args[1].type == arg_string.type);
+ GPR_ASSERT(strcmp(ch_args->args[1].value.string, arg_string.value.string) ==
+ 0);
+
+ grpc_channel_args_destroy(ch_args);
+}
+
+static void test_set_compression_algorithm(void) {
+ grpc_channel_args *ch_args;
+
+ ch_args =
+ grpc_channel_args_set_compression_algorithm(NULL, GRPC_COMPRESS_GZIP);
+ GPR_ASSERT(ch_args->num_args == 1);
+ GPR_ASSERT(strcmp(ch_args->args[0].key, GRPC_COMPRESSION_ALGORITHM_ARG) == 0);
+ GPR_ASSERT(ch_args->args[0].type == GRPC_ARG_INTEGER);
+
+ grpc_channel_args_destroy(ch_args);
+}
+
+static void test_compression_algorithm_states(void) {
+ grpc_channel_args *ch_args, *ch_args_wo_gzip, *ch_args_wo_gzip_deflate;
+ int states_bitset;
+ size_t i;
+
+ ch_args = grpc_channel_args_copy_and_add(NULL, NULL, 0);
+ /* by default, all enabled */
+ states_bitset = grpc_channel_args_compression_algorithm_get_states(ch_args);
+
+ for (i = 0; i < GRPC_COMPRESS_ALGORITHMS_COUNT; i++) {
+ GPR_ASSERT(GPR_BITGET(states_bitset, i));
+ }
+
+ /* disable gzip and deflate */
+ ch_args_wo_gzip = grpc_channel_args_compression_algorithm_set_state(
+ &ch_args, GRPC_COMPRESS_GZIP, 0);
+ GPR_ASSERT(ch_args == ch_args_wo_gzip);
+ ch_args_wo_gzip_deflate = grpc_channel_args_compression_algorithm_set_state(
+ &ch_args_wo_gzip, GRPC_COMPRESS_DEFLATE, 0);
+ GPR_ASSERT(ch_args_wo_gzip == ch_args_wo_gzip_deflate);
+
+ states_bitset = grpc_channel_args_compression_algorithm_get_states(
+ ch_args_wo_gzip_deflate);
+ for (i = 0; i < GRPC_COMPRESS_ALGORITHMS_COUNT; i++) {
+ if (i == GRPC_COMPRESS_GZIP || i == GRPC_COMPRESS_DEFLATE) {
+ GPR_ASSERT(GPR_BITGET(states_bitset, i) == 0);
+ } else {
+ GPR_ASSERT(GPR_BITGET(states_bitset, i) != 0);
+ }
+ }
+
+ /* re-enabled gzip only */
+ ch_args_wo_gzip = grpc_channel_args_compression_algorithm_set_state(
+ &ch_args_wo_gzip_deflate, GRPC_COMPRESS_GZIP, 1);
+ GPR_ASSERT(ch_args_wo_gzip == ch_args_wo_gzip_deflate);
+
+ states_bitset =
+ grpc_channel_args_compression_algorithm_get_states(ch_args_wo_gzip);
+ for (i = 0; i < GRPC_COMPRESS_ALGORITHMS_COUNT; i++) {
+ if (i == GRPC_COMPRESS_DEFLATE) {
+ GPR_ASSERT(GPR_BITGET(states_bitset, i) == 0);
+ } else {
+ GPR_ASSERT(GPR_BITGET(states_bitset, i) != 0);
+ }
+ }
+
+ grpc_channel_args_destroy(ch_args);
+}
+
+int main(int argc, char **argv) {
+ grpc_test_init(argc, argv);
+ test_create();
+ test_set_compression_algorithm();
+ test_compression_algorithm_states();
+ return 0;
+}
diff --git a/test/core/end2end/dualstack_socket_test.c b/test/core/end2end/dualstack_socket_test.c
index 1f64062bf7..fcc12952bf 100644
--- a/test/core/end2end/dualstack_socket_test.c
+++ b/test/core/end2end/dualstack_socket_test.c
@@ -32,12 +32,16 @@
*/
#include <string.h>
-#include "src/core/iomgr/socket_utils_posix.h"
+
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
+
+#include "src/core/support/string.h"
+#include "src/core/iomgr/socket_utils_posix.h"
+
#include "test/core/end2end/cq_verifier.h"
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
@@ -57,6 +61,7 @@ static void drain_cq(grpc_completion_queue *cq) {
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
+static void do_nothing(void *ignored) {}
void test_connect(const char *server_host, const char *client_host, int port,
int expect_ok) {
char *client_hostport;
@@ -109,8 +114,30 @@ void test_connect(const char *server_host, const char *client_host, int port,
/* Create client. */
if (client_host[0] == 'i') {
- /* for ipv4:/ipv6: addresses, just concatenate the port */
- gpr_asprintf(&client_hostport, "%s:%d", client_host, port);
+ /* for ipv4:/ipv6: addresses, concatenate the port to each of the parts */
+ size_t i;
+ gpr_slice uri_slice;
+ gpr_slice_buffer uri_parts;
+ char **hosts_with_port;
+
+ uri_slice =
+ gpr_slice_new((char *)client_host, strlen(client_host), do_nothing);
+ gpr_slice_buffer_init(&uri_parts);
+ gpr_slice_split(uri_slice, ",", &uri_parts);
+ hosts_with_port = gpr_malloc(sizeof(char*) * uri_parts.count);
+ for (i = 0; i < uri_parts.count; i++) {
+ char *uri_part_str = gpr_dump_slice(uri_parts.slices[i], GPR_DUMP_ASCII);
+ gpr_asprintf(&hosts_with_port[i], "%s:%d", uri_part_str, port);
+ gpr_free(uri_part_str);
+ }
+ client_hostport = gpr_strjoin_sep((const char **)hosts_with_port,
+ uri_parts.count, ",", NULL);
+ for (i = 0; i < uri_parts.count; i++) {
+ gpr_free(hosts_with_port[i]);
+ }
+ gpr_free(hosts_with_port);
+ gpr_slice_buffer_destroy(&uri_parts);
+ gpr_slice_unref(uri_slice);
} else {
gpr_join_host_port(&client_hostport, client_host, port);
}
@@ -260,7 +287,8 @@ int main(int argc, char **argv) {
test_connect("0.0.0.0", "127.0.0.1", 0, 1);
test_connect("0.0.0.0", "::ffff:127.0.0.1", 0, 1);
test_connect("0.0.0.0", "ipv4:127.0.0.1", 0, 1);
- test_connect("0.0.0.0", "ipv6:[::ffff:127.0.0.1]", 0, 1);
+ test_connect("0.0.0.0", "ipv4:127.0.0.1,127.0.0.2,127.0.0.3", 0, 1);
+ test_connect("0.0.0.0", "ipv6:[::ffff:127.0.0.1],[::ffff:127.0.0.2]", 0, 1);
test_connect("0.0.0.0", "localhost", 0, 1);
if (do_ipv6) {
test_connect("::", "::1", 0, 1);
diff --git a/test/core/end2end/fixtures/chttp2_fake_security.c b/test/core/end2end/fixtures/chttp2_fake_security.c
index 27531ecbc3..a0a67939a2 100644
--- a/test/core/end2end/fixtures/chttp2_fake_security.c
+++ b/test/core/end2end/fixtures/chttp2_fake_security.c
@@ -70,7 +70,7 @@ static void process_auth_failure(void *state, grpc_auth_context *ctx,
grpc_process_auth_metadata_done_cb cb,
void *user_data) {
GPR_ASSERT(state == NULL);
- cb(user_data, NULL, 0, 0);
+ cb(user_data, NULL, 0, NULL, 0, GRPC_STATUS_UNAUTHENTICATED, NULL);
}
static void chttp2_init_client_secure_fullstack(grpc_end2end_test_fixture *f,
diff --git a/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack.c b/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack.c
index 491a293764..beae24136c 100644
--- a/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack.c
+++ b/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack.c
@@ -73,7 +73,7 @@ static void process_auth_failure(void *state, grpc_auth_context *ctx,
grpc_process_auth_metadata_done_cb cb,
void *user_data) {
GPR_ASSERT(state == NULL);
- cb(user_data, NULL, 0, 0);
+ cb(user_data, NULL, 0, NULL, 0, GRPC_STATUS_UNAUTHENTICATED, NULL);
}
static void chttp2_init_client_secure_fullstack(grpc_end2end_test_fixture *f,
diff --git a/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack_with_poll.c b/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack_with_poll.c
index f2736cc92f..c8971be596 100644
--- a/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack_with_poll.c
+++ b/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack_with_poll.c
@@ -73,7 +73,7 @@ static void process_auth_failure(void *state, grpc_auth_context *ctx,
grpc_process_auth_metadata_done_cb cb,
void *user_data) {
GPR_ASSERT(state == NULL);
- cb(user_data, NULL, 0, 0);
+ cb(user_data, NULL, 0, NULL, 0, GRPC_STATUS_UNAUTHENTICATED, NULL);
}
static void chttp2_init_client_secure_fullstack(grpc_end2end_test_fixture *f,
diff --git a/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack_with_proxy.c b/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack_with_proxy.c
index cc0b9dbbdd..a518a7da15 100644
--- a/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack_with_proxy.c
+++ b/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack_with_proxy.c
@@ -101,7 +101,7 @@ static void process_auth_failure(void *state, grpc_auth_context *ctx,
grpc_process_auth_metadata_done_cb cb,
void *user_data) {
GPR_ASSERT(state == NULL);
- cb(user_data, NULL, 0, 0);
+ cb(user_data, NULL, 0, NULL, 0, GRPC_STATUS_UNAUTHENTICATED, NULL);
}
static void chttp2_init_client_secure_fullstack(grpc_end2end_test_fixture *f,
diff --git a/test/core/end2end/fixtures/chttp2_simple_ssl_with_oauth2_fullstack.c b/test/core/end2end/fixtures/chttp2_simple_ssl_with_oauth2_fullstack.c
index d82e623f22..7f11028cb5 100644
--- a/test/core/end2end/fixtures/chttp2_simple_ssl_with_oauth2_fullstack.c
+++ b/test/core/end2end/fixtures/chttp2_simple_ssl_with_oauth2_fullstack.c
@@ -79,7 +79,7 @@ static void process_oauth2_success(void *state, grpc_auth_context *ctx,
client_identity);
GPR_ASSERT(grpc_auth_context_set_peer_identity_property_name(
ctx, client_identity_property_name) == 1);
- cb(user_data, oauth2, 1, 1);
+ cb(user_data, oauth2, 1, NULL, 0, GRPC_STATUS_OK, NULL);
}
static void process_oauth2_failure(void *state, grpc_auth_context *ctx,
@@ -90,7 +90,7 @@ static void process_oauth2_failure(void *state, grpc_auth_context *ctx,
find_metadata(md, md_count, "Authorization", oauth2_md);
GPR_ASSERT(state == NULL);
GPR_ASSERT(oauth2 != NULL);
- cb(user_data, oauth2, 1, 0);
+ cb(user_data, oauth2, 1, NULL, 0, GRPC_STATUS_UNAUTHENTICATED, NULL);
}
static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack(
diff --git a/test/core/httpcli/httpcli_test.c b/test/core/httpcli/httpcli_test.c
index 8dddfbee98..42b2661c0a 100644
--- a/test/core/httpcli/httpcli_test.c
+++ b/test/core/httpcli/httpcli_test.c
@@ -88,7 +88,8 @@ static void test_get(int use_ssl, int port) {
gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset));
while (!g_done) {
grpc_pollset_worker worker;
- grpc_pollset_work(&g_pollset, &worker, n_seconds_time(20));
+ grpc_pollset_work(&g_pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC),
+ n_seconds_time(20));
}
gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset));
gpr_free(host);
@@ -114,7 +115,8 @@ static void test_post(int use_ssl, int port) {
gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset));
while (!g_done) {
grpc_pollset_worker worker;
- grpc_pollset_work(&g_pollset, &worker, n_seconds_time(20));
+ grpc_pollset_work(&g_pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC),
+ n_seconds_time(20));
}
gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset));
gpr_free(host);
diff --git a/test/core/iomgr/endpoint_tests.c b/test/core/iomgr/endpoint_tests.c
index 8186c96da1..6ef8e9ca3b 100644
--- a/test/core/iomgr/endpoint_tests.c
+++ b/test/core/iomgr/endpoint_tests.c
@@ -256,7 +256,8 @@ static void read_and_write_test(grpc_endpoint_test_config config,
while (!state.read_done || !state.write_done) {
grpc_pollset_worker worker;
GPR_ASSERT(gpr_time_cmp(gpr_now(GPR_CLOCK_MONOTONIC), deadline) < 0);
- grpc_pollset_work(g_pollset, &worker, deadline);
+ grpc_pollset_work(g_pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC),
+ deadline);
}
gpr_mu_unlock(GRPC_POLLSET_MU(g_pollset));
@@ -353,7 +354,8 @@ static void shutdown_during_write_test(grpc_endpoint_test_config config,
while (!write_st.done) {
grpc_pollset_worker worker;
GPR_ASSERT(gpr_time_cmp(gpr_now(deadline.clock_type), deadline) < 0);
- grpc_pollset_work(g_pollset, &worker, deadline);
+ grpc_pollset_work(g_pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC),
+ deadline);
}
gpr_mu_unlock(GRPC_POLLSET_MU(g_pollset));
grpc_endpoint_destroy(write_st.ep);
@@ -361,7 +363,8 @@ static void shutdown_during_write_test(grpc_endpoint_test_config config,
while (!read_st.done) {
grpc_pollset_worker worker;
GPR_ASSERT(gpr_time_cmp(gpr_now(deadline.clock_type), deadline) < 0);
- grpc_pollset_work(g_pollset, &worker, deadline);
+ grpc_pollset_work(g_pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC),
+ deadline);
}
gpr_mu_unlock(GRPC_POLLSET_MU(g_pollset));
gpr_free(slices);
diff --git a/test/core/iomgr/fd_posix_test.c b/test/core/iomgr/fd_posix_test.c
index adcbcafdbb..8bba87d61f 100644
--- a/test/core/iomgr/fd_posix_test.c
+++ b/test/core/iomgr/fd_posix_test.c
@@ -250,7 +250,8 @@ static void server_wait_and_shutdown(server *sv) {
gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset));
while (!sv->done) {
grpc_pollset_worker worker;
- grpc_pollset_work(&g_pollset, &worker, gpr_inf_future(GPR_CLOCK_MONOTONIC));
+ grpc_pollset_work(&g_pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC),
+ gpr_inf_future(GPR_CLOCK_MONOTONIC));
}
gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset));
}
@@ -358,7 +359,8 @@ static void client_wait_and_shutdown(client *cl) {
gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset));
while (!cl->done) {
grpc_pollset_worker worker;
- grpc_pollset_work(&g_pollset, &worker, gpr_inf_future(GPR_CLOCK_MONOTONIC));
+ grpc_pollset_work(&g_pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC),
+ gpr_inf_future(GPR_CLOCK_MONOTONIC));
}
gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset));
}
@@ -448,7 +450,8 @@ static void test_grpc_fd_change(void) {
gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset));
while (a.cb_that_ran == NULL) {
grpc_pollset_worker worker;
- grpc_pollset_work(&g_pollset, &worker, gpr_inf_future(GPR_CLOCK_MONOTONIC));
+ grpc_pollset_work(&g_pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC),
+ gpr_inf_future(GPR_CLOCK_MONOTONIC));
}
GPR_ASSERT(a.cb_that_ran == first_read_callback);
gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset));
@@ -467,7 +470,8 @@ static void test_grpc_fd_change(void) {
gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset));
while (b.cb_that_ran == NULL) {
grpc_pollset_worker worker;
- grpc_pollset_work(&g_pollset, &worker, gpr_inf_future(GPR_CLOCK_MONOTONIC));
+ grpc_pollset_work(&g_pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC),
+ gpr_inf_future(GPR_CLOCK_MONOTONIC));
}
/* Except now we verify that second_read_callback ran instead */
GPR_ASSERT(b.cb_that_ran == second_read_callback);
diff --git a/test/core/iomgr/tcp_client_posix_test.c b/test/core/iomgr/tcp_client_posix_test.c
index 07bbe1f402..dea0b33b8e 100644
--- a/test/core/iomgr/tcp_client_posix_test.c
+++ b/test/core/iomgr/tcp_client_posix_test.c
@@ -112,7 +112,8 @@ void test_succeeds(void) {
while (g_connections_complete == connections_complete_before) {
grpc_pollset_worker worker;
- grpc_pollset_work(&g_pollset, &worker, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5));
+ grpc_pollset_work(&g_pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC),
+ GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5));
}
gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset));
@@ -142,7 +143,8 @@ void test_fails(void) {
/* wait for the connection callback to finish */
while (g_connections_complete == connections_complete_before) {
grpc_pollset_worker worker;
- grpc_pollset_work(&g_pollset, &worker, test_deadline());
+ grpc_pollset_work(&g_pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC),
+ test_deadline());
}
gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset));
@@ -211,7 +213,8 @@ void test_times_out(void) {
GPR_ASSERT(g_connections_complete ==
connections_complete_before + is_after_deadline);
}
- grpc_pollset_work(&g_pollset, &worker, GRPC_TIMEOUT_MILLIS_TO_DEADLINE(10));
+ grpc_pollset_work(&g_pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC),
+ GRPC_TIMEOUT_MILLIS_TO_DEADLINE(10));
}
gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset));
diff --git a/test/core/iomgr/tcp_posix_test.c b/test/core/iomgr/tcp_posix_test.c
index 17a85ceaec..6ad832231f 100644
--- a/test/core/iomgr/tcp_posix_test.c
+++ b/test/core/iomgr/tcp_posix_test.c
@@ -187,7 +187,8 @@ static void read_test(ssize_t num_bytes, ssize_t slice_size) {
gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset));
while (state.read_bytes < state.target_read_bytes) {
grpc_pollset_worker worker;
- grpc_pollset_work(&g_pollset, &worker, deadline);
+ grpc_pollset_work(&g_pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC),
+ deadline);
}
GPR_ASSERT(state.read_bytes == state.target_read_bytes);
gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset));
@@ -224,7 +225,8 @@ static void large_read_test(ssize_t slice_size) {
gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset));
while (state.read_bytes < state.target_read_bytes) {
grpc_pollset_worker worker;
- grpc_pollset_work(&g_pollset, &worker, deadline);
+ grpc_pollset_work(&g_pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC),
+ deadline);
}
GPR_ASSERT(state.read_bytes == state.target_read_bytes);
gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset));
@@ -285,7 +287,8 @@ void drain_socket_blocking(int fd, size_t num_bytes, size_t read_size) {
for (;;) {
grpc_pollset_worker worker;
gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset));
- grpc_pollset_work(&g_pollset, &worker, GRPC_TIMEOUT_MILLIS_TO_DEADLINE(10));
+ grpc_pollset_work(&g_pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC),
+ GRPC_TIMEOUT_MILLIS_TO_DEADLINE(10));
gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset));
do {
bytes_read =
@@ -365,7 +368,8 @@ static void write_test(ssize_t num_bytes, ssize_t slice_size) {
if (state.write_done) {
break;
}
- grpc_pollset_work(&g_pollset, &worker, deadline);
+ grpc_pollset_work(&g_pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC),
+ deadline);
}
gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset));
}
@@ -422,7 +426,8 @@ static void write_error_test(ssize_t num_bytes, ssize_t slice_size) {
if (state.write_done) {
break;
}
- grpc_pollset_work(&g_pollset, &worker, deadline);
+ grpc_pollset_work(&g_pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC),
+ deadline);
}
gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset));
break;
diff --git a/test/core/iomgr/tcp_server_posix_test.c b/test/core/iomgr/tcp_server_posix_test.c
index b82d7c08b1..29a20cba8e 100644
--- a/test/core/iomgr/tcp_server_posix_test.c
+++ b/test/core/iomgr/tcp_server_posix_test.c
@@ -137,7 +137,8 @@ static void test_connect(int n) {
while (g_nconnects == nconnects_before &&
gpr_time_cmp(deadline, gpr_now(deadline.clock_type)) > 0) {
grpc_pollset_worker worker;
- grpc_pollset_work(&g_pollset, &worker, deadline);
+ grpc_pollset_work(&g_pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC),
+ deadline);
}
gpr_log(GPR_DEBUG, "wait done");
diff --git a/test/core/iomgr/udp_server_test.c b/test/core/iomgr/udp_server_test.c
index 5a5f99fb94..471d5b50c7 100644
--- a/test/core/iomgr/udp_server_test.c
+++ b/test/core/iomgr/udp_server_test.c
@@ -146,7 +146,8 @@ static void test_receive(int number_of_clients) {
while (g_number_of_reads == number_of_reads_before &&
gpr_time_cmp(deadline, gpr_now(deadline.clock_type)) > 0) {
grpc_pollset_worker worker;
- grpc_pollset_work(&g_pollset, &worker, deadline);
+ grpc_pollset_work(&g_pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC),
+ deadline);
}
GPR_ASSERT(g_number_of_reads == number_of_reads_before + 1);
close(clifd);
diff --git a/test/core/security/oauth2_utils.c b/test/core/security/oauth2_utils.c
index 990855ac6a..7df6fade6b 100644
--- a/test/core/security/oauth2_utils.c
+++ b/test/core/security/oauth2_utils.c
@@ -85,7 +85,7 @@ char *grpc_test_fetch_oauth2_token_with_credentials(grpc_credentials *creds) {
gpr_mu_lock(GRPC_POLLSET_MU(&request.pollset));
while (!request.is_done) {
grpc_pollset_worker worker;
- grpc_pollset_work(&request.pollset, &worker,
+ grpc_pollset_work(&request.pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC),
gpr_inf_future(GPR_CLOCK_MONOTONIC));
}
gpr_mu_unlock(GRPC_POLLSET_MU(&request.pollset));
diff --git a/test/core/security/print_google_default_creds_token.c b/test/core/security/print_google_default_creds_token.c
index b4323ab200..753221cada 100644
--- a/test/core/security/print_google_default_creds_token.c
+++ b/test/core/security/print_google_default_creds_token.c
@@ -96,8 +96,8 @@ int main(int argc, char **argv) {
gpr_mu_lock(GRPC_POLLSET_MU(&sync.pollset));
while (!sync.is_done) {
grpc_pollset_worker worker;
- grpc_pollset_work(&sync.pollset, &worker,
- gpr_inf_future(GPR_CLOCK_REALTIME));
+ grpc_pollset_work(&sync.pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC),
+ gpr_inf_future(GPR_CLOCK_MONOTONIC));
}
gpr_mu_unlock(GRPC_POLLSET_MU(&sync.pollset));
diff --git a/test/core/security/verify_jwt.c b/test/core/security/verify_jwt.c
index 5ebde5fbb4..f4432667ee 100644
--- a/test/core/security/verify_jwt.c
+++ b/test/core/security/verify_jwt.c
@@ -111,7 +111,7 @@ int main(int argc, char **argv) {
gpr_mu_lock(GRPC_POLLSET_MU(&sync.pollset));
while (!sync.is_done) {
grpc_pollset_worker worker;
- grpc_pollset_work(&sync.pollset, &worker,
+ grpc_pollset_work(&sync.pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC),
gpr_inf_future(GPR_CLOCK_MONOTONIC));
}
gpr_mu_unlock(GRPC_POLLSET_MU(&sync.pollset));
diff --git a/test/core/util/port_posix.c b/test/core/util/port_posix.c
index cec0eebd33..836e62a541 100644
--- a/test/core/util/port_posix.c
+++ b/test/core/util/port_posix.c
@@ -178,7 +178,7 @@ static int pick_port_using_server(char *server) {
gpr_mu_lock(GRPC_POLLSET_MU(&pr.pollset));
while (pr.port == -1) {
grpc_pollset_worker worker;
- grpc_pollset_work(&pr.pollset, &worker,
+ grpc_pollset_work(&pr.pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC),
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1));
}
gpr_mu_unlock(GRPC_POLLSET_MU(&pr.pollset));
diff --git a/test/core/util/reconnect_server.c b/test/core/util/reconnect_server.c
index 2a2113338b..a06cb50b3a 100644
--- a/test/core/util/reconnect_server.c
+++ b/test/core/util/reconnect_server.c
@@ -134,7 +134,8 @@ void reconnect_server_poll(reconnect_server *server, int seconds) {
gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC),
gpr_time_from_seconds(seconds, GPR_TIMESPAN));
gpr_mu_lock(GRPC_POLLSET_MU(&server->pollset));
- grpc_pollset_work(&server->pollset, &worker, deadline);
+ grpc_pollset_work(&server->pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC),
+ deadline);
gpr_mu_unlock(GRPC_POLLSET_MU(&server->pollset));
}
diff --git a/test/cpp/client/channel_arguments_test.cc b/test/cpp/client/channel_arguments_test.cc
index 01c56cb795..3d75e7b0e6 100644
--- a/test/cpp/client/channel_arguments_test.cc
+++ b/test/cpp/client/channel_arguments_test.cc
@@ -31,7 +31,7 @@
*
*/
-#include <grpc++/channel_arguments.h>
+#include <grpc++/support/channel_arguments.h>
#include <grpc/grpc.h>
#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 bf17842a84..630c38c7f6 100644
--- a/test/cpp/common/auth_property_iterator_test.cc
+++ b/test/cpp/common/auth_property_iterator_test.cc
@@ -32,7 +32,7 @@
*/
#include <grpc/grpc_security.h>
-#include <grpc++/auth_context.h>
+#include <grpc++/support/auth_context.h>
#include <gtest/gtest.h>
#include "src/cpp/common/secure_auth_context.h"
diff --git a/test/cpp/common/secure_auth_context_test.cc b/test/cpp/common/secure_auth_context_test.cc
index e0376c9cc7..c71ef58023 100644
--- a/test/cpp/common/secure_auth_context_test.cc
+++ b/test/cpp/common/secure_auth_context_test.cc
@@ -32,7 +32,7 @@
*/
#include <grpc/grpc_security.h>
-#include <grpc++/auth_context.h>
+#include <grpc++/support/auth_context.h>
#include <gtest/gtest.h>
#include "src/cpp/common/secure_auth_context.h"
diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc
index a30c841216..6343810ee9 100644
--- a/test/cpp/end2end/async_end2end_test.cc
+++ b/test/cpp/end2end/async_end2end_test.cc
@@ -33,13 +33,10 @@
#include <memory>
-#include "test/core/util/port.h"
-#include "test/core/util/test_config.h"
-#include "test/cpp/util/echo_duplicate.grpc.pb.h"
-#include "test/cpp/util/echo.grpc.pb.h"
-#include <grpc++/async_unary_call.h>
-#include <grpc++/channel_arguments.h>
-#include <grpc++/channel_interface.h>
+#include <grpc/grpc.h>
+#include <grpc/support/thd.h>
+#include <grpc/support/time.h>
+#include <grpc++/channel.h>
#include <grpc++/client_context.h>
#include <grpc++/create_channel.h>
#include <grpc++/credentials.h>
@@ -47,14 +44,16 @@
#include <grpc++/server_builder.h>
#include <grpc++/server_context.h>
#include <grpc++/server_credentials.h>
-#include <grpc++/status.h>
-#include <grpc++/stream.h>
-#include <grpc++/time.h>
#include <gtest/gtest.h>
-#include <grpc/grpc.h>
-#include <grpc/support/thd.h>
-#include <grpc/support/time.h>
+#include "test/core/util/port.h"
+#include "test/core/util/test_config.h"
+#include "test/cpp/util/echo_duplicate.grpc.pb.h"
+#include "test/cpp/util/echo.grpc.pb.h"
+
+#ifdef GPR_POSIX_SOCKET
+#include "src/core/iomgr/pollset_posix.h"
+#endif
using grpc::cpp::test::util::EchoRequest;
using grpc::cpp::test::util::EchoResponse;
@@ -67,8 +66,41 @@ namespace {
void* tag(int i) { return (void*)(gpr_intptr)i; }
-class Verifier {
+#ifdef GPR_POSIX_SOCKET
+static int assert_non_blocking_poll(struct pollfd* pfds, nfds_t nfds,
+ int timeout) {
+ GPR_ASSERT(timeout == 0);
+ return poll(pfds, nfds, timeout);
+}
+
+class PollOverride {
public:
+ PollOverride(grpc_poll_function_type f) {
+ prev_ = grpc_poll_function;
+ grpc_poll_function = f;
+ }
+
+ ~PollOverride() { grpc_poll_function = prev_; }
+
+ private:
+ grpc_poll_function_type prev_;
+};
+
+class PollingCheckRegion : public PollOverride {
+ public:
+ explicit PollingCheckRegion(bool allow_blocking)
+ : PollOverride(allow_blocking ? poll : assert_non_blocking_poll) {}
+};
+#else
+class PollingCheckRegion {
+ public:
+ explicit PollingCheckRegion(bool allow_blocking) {}
+};
+#endif
+
+class Verifier : public PollingCheckRegion {
+ public:
+ explicit Verifier(bool spin) : PollingCheckRegion(!spin), spin_(spin) {}
Verifier& Expect(int i, bool expect_ok) {
expectations_[tag(i)] = expect_ok;
return *this;
@@ -78,7 +110,17 @@ class Verifier {
while (!expectations_.empty()) {
bool ok;
void* got_tag;
- EXPECT_TRUE(cq->Next(&got_tag, &ok));
+ if (spin_) {
+ for (;;) {
+ auto r = cq->AsyncNext(&got_tag, &ok, gpr_time_0(GPR_CLOCK_REALTIME));
+ if (r == CompletionQueue::TIMEOUT) continue;
+ if (r == CompletionQueue::GOT_EVENT) break;
+ gpr_log(GPR_ERROR, "unexpected result from AsyncNext");
+ abort();
+ }
+ } else {
+ EXPECT_TRUE(cq->Next(&got_tag, &ok));
+ }
auto it = expectations_.find(got_tag);
EXPECT_TRUE(it != expectations_.end());
EXPECT_EQ(it->second, ok);
@@ -90,14 +132,34 @@ class Verifier {
if (expectations_.empty()) {
bool ok;
void* got_tag;
- EXPECT_EQ(cq->AsyncNext(&got_tag, &ok, deadline),
- CompletionQueue::TIMEOUT);
+ if (spin_) {
+ while (std::chrono::system_clock::now() < deadline) {
+ EXPECT_EQ(
+ cq->AsyncNext(&got_tag, &ok, gpr_time_0(GPR_CLOCK_REALTIME)),
+ CompletionQueue::TIMEOUT);
+ }
+ } else {
+ EXPECT_EQ(cq->AsyncNext(&got_tag, &ok, deadline),
+ CompletionQueue::TIMEOUT);
+ }
} else {
while (!expectations_.empty()) {
bool ok;
void* got_tag;
- EXPECT_EQ(cq->AsyncNext(&got_tag, &ok, deadline),
- CompletionQueue::GOT_EVENT);
+ if (spin_) {
+ for (;;) {
+ GPR_ASSERT(std::chrono::system_clock::now() < deadline);
+ auto r =
+ cq->AsyncNext(&got_tag, &ok, gpr_time_0(GPR_CLOCK_REALTIME));
+ if (r == CompletionQueue::TIMEOUT) continue;
+ if (r == CompletionQueue::GOT_EVENT) break;
+ gpr_log(GPR_ERROR, "unexpected result from AsyncNext");
+ abort();
+ }
+ } else {
+ EXPECT_EQ(cq->AsyncNext(&got_tag, &ok, deadline),
+ CompletionQueue::GOT_EVENT);
+ }
auto it = expectations_.find(got_tag);
EXPECT_TRUE(it != expectations_.end());
EXPECT_EQ(it->second, ok);
@@ -108,9 +170,10 @@ class Verifier {
private:
std::map<void*, bool> expectations_;
+ bool spin_;
};
-class AsyncEnd2endTest : public ::testing::Test {
+class AsyncEnd2endTest : public ::testing::TestWithParam<bool> {
protected:
AsyncEnd2endTest() {}
@@ -136,7 +199,7 @@ class AsyncEnd2endTest : public ::testing::Test {
}
void ResetStub() {
- std::shared_ptr<ChannelInterface> channel = CreateChannel(
+ std::shared_ptr<Channel> channel = CreateChannel(
server_address_.str(), InsecureCredentials(), ChannelArguments());
stub_ = std::move(grpc::cpp::test::util::TestService::NewStub(channel));
}
@@ -160,15 +223,15 @@ class AsyncEnd2endTest : public ::testing::Test {
service_.RequestEcho(&srv_ctx, &recv_request, &response_writer, cq_.get(),
cq_.get(), tag(2));
- Verifier().Expect(2, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(2, true).Verify(cq_.get());
EXPECT_EQ(send_request.message(), recv_request.message());
send_response.set_message(recv_request.message());
response_writer.Finish(send_response, Status::OK, tag(3));
- Verifier().Expect(3, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(3, true).Verify(cq_.get());
response_reader->Finish(&recv_response, &recv_status, tag(4));
- Verifier().Expect(4, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(4, true).Verify(cq_.get());
EXPECT_EQ(send_response.message(), recv_response.message());
EXPECT_TRUE(recv_status.ok());
@@ -182,18 +245,18 @@ class AsyncEnd2endTest : public ::testing::Test {
std::ostringstream server_address_;
};
-TEST_F(AsyncEnd2endTest, SimpleRpc) {
+TEST_P(AsyncEnd2endTest, SimpleRpc) {
ResetStub();
SendRpc(1);
}
-TEST_F(AsyncEnd2endTest, SequentialRpcs) {
+TEST_P(AsyncEnd2endTest, SequentialRpcs) {
ResetStub();
SendRpc(10);
}
// Test a simple RPC using the async version of Next
-TEST_F(AsyncEnd2endTest, AsyncNextRpc) {
+TEST_P(AsyncEnd2endTest, AsyncNextRpc) {
ResetStub();
EchoRequest send_request;
@@ -214,30 +277,32 @@ TEST_F(AsyncEnd2endTest, AsyncNextRpc) {
std::chrono::system_clock::now());
std::chrono::system_clock::time_point time_limit(
std::chrono::system_clock::now() + std::chrono::seconds(10));
- Verifier().Verify(cq_.get(), time_now);
- Verifier().Verify(cq_.get(), time_now);
+ Verifier(GetParam()).Verify(cq_.get(), time_now);
+ Verifier(GetParam()).Verify(cq_.get(), time_now);
service_.RequestEcho(&srv_ctx, &recv_request, &response_writer, cq_.get(),
cq_.get(), tag(2));
- Verifier().Expect(2, true).Verify(cq_.get(), time_limit);
+ Verifier(GetParam()).Expect(2, true).Verify(cq_.get(), time_limit);
EXPECT_EQ(send_request.message(), recv_request.message());
send_response.set_message(recv_request.message());
response_writer.Finish(send_response, Status::OK, tag(3));
- Verifier().Expect(3, true).Verify(
- cq_.get(), std::chrono::system_clock::time_point::max());
+ Verifier(GetParam())
+ .Expect(3, true)
+ .Verify(cq_.get(), std::chrono::system_clock::time_point::max());
response_reader->Finish(&recv_response, &recv_status, tag(4));
- Verifier().Expect(4, true).Verify(
- cq_.get(), std::chrono::system_clock::time_point::max());
+ Verifier(GetParam())
+ .Expect(4, true)
+ .Verify(cq_.get(), std::chrono::system_clock::time_point::max());
EXPECT_EQ(send_response.message(), recv_response.message());
EXPECT_TRUE(recv_status.ok());
}
// Two pings and a final pong.
-TEST_F(AsyncEnd2endTest, SimpleClientStreaming) {
+TEST_P(AsyncEnd2endTest, SimpleClientStreaming) {
ResetStub();
EchoRequest send_request;
@@ -256,41 +321,41 @@ TEST_F(AsyncEnd2endTest, SimpleClientStreaming) {
service_.RequestRequestStream(&srv_ctx, &srv_stream, cq_.get(), cq_.get(),
tag(2));
- Verifier().Expect(2, true).Expect(1, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(2, true).Expect(1, true).Verify(cq_.get());
cli_stream->Write(send_request, tag(3));
- Verifier().Expect(3, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(3, true).Verify(cq_.get());
srv_stream.Read(&recv_request, tag(4));
- Verifier().Expect(4, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(4, true).Verify(cq_.get());
EXPECT_EQ(send_request.message(), recv_request.message());
cli_stream->Write(send_request, tag(5));
- Verifier().Expect(5, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(5, true).Verify(cq_.get());
srv_stream.Read(&recv_request, tag(6));
- Verifier().Expect(6, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(6, true).Verify(cq_.get());
EXPECT_EQ(send_request.message(), recv_request.message());
cli_stream->WritesDone(tag(7));
- Verifier().Expect(7, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(7, true).Verify(cq_.get());
srv_stream.Read(&recv_request, tag(8));
- Verifier().Expect(8, false).Verify(cq_.get());
+ Verifier(GetParam()).Expect(8, false).Verify(cq_.get());
send_response.set_message(recv_request.message());
srv_stream.Finish(send_response, Status::OK, tag(9));
- Verifier().Expect(9, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(9, true).Verify(cq_.get());
cli_stream->Finish(&recv_status, tag(10));
- Verifier().Expect(10, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(10, true).Verify(cq_.get());
EXPECT_EQ(send_response.message(), recv_response.message());
EXPECT_TRUE(recv_status.ok());
}
// One ping, two pongs.
-TEST_F(AsyncEnd2endTest, SimpleServerStreaming) {
+TEST_P(AsyncEnd2endTest, SimpleServerStreaming) {
ResetStub();
EchoRequest send_request;
@@ -309,38 +374,38 @@ TEST_F(AsyncEnd2endTest, SimpleServerStreaming) {
service_.RequestResponseStream(&srv_ctx, &recv_request, &srv_stream,
cq_.get(), cq_.get(), tag(2));
- Verifier().Expect(1, true).Expect(2, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(1, true).Expect(2, true).Verify(cq_.get());
EXPECT_EQ(send_request.message(), recv_request.message());
send_response.set_message(recv_request.message());
srv_stream.Write(send_response, tag(3));
- Verifier().Expect(3, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(3, true).Verify(cq_.get());
cli_stream->Read(&recv_response, tag(4));
- Verifier().Expect(4, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(4, true).Verify(cq_.get());
EXPECT_EQ(send_response.message(), recv_response.message());
srv_stream.Write(send_response, tag(5));
- Verifier().Expect(5, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(5, true).Verify(cq_.get());
cli_stream->Read(&recv_response, tag(6));
- Verifier().Expect(6, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(6, true).Verify(cq_.get());
EXPECT_EQ(send_response.message(), recv_response.message());
srv_stream.Finish(Status::OK, tag(7));
- Verifier().Expect(7, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(7, true).Verify(cq_.get());
cli_stream->Read(&recv_response, tag(8));
- Verifier().Expect(8, false).Verify(cq_.get());
+ Verifier(GetParam()).Expect(8, false).Verify(cq_.get());
cli_stream->Finish(&recv_status, tag(9));
- Verifier().Expect(9, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(9, true).Verify(cq_.get());
EXPECT_TRUE(recv_status.ok());
}
// One ping, one pong.
-TEST_F(AsyncEnd2endTest, SimpleBidiStreaming) {
+TEST_P(AsyncEnd2endTest, SimpleBidiStreaming) {
ResetStub();
EchoRequest send_request;
@@ -359,40 +424,40 @@ TEST_F(AsyncEnd2endTest, SimpleBidiStreaming) {
service_.RequestBidiStream(&srv_ctx, &srv_stream, cq_.get(), cq_.get(),
tag(2));
- Verifier().Expect(1, true).Expect(2, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(1, true).Expect(2, true).Verify(cq_.get());
cli_stream->Write(send_request, tag(3));
- Verifier().Expect(3, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(3, true).Verify(cq_.get());
srv_stream.Read(&recv_request, tag(4));
- Verifier().Expect(4, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(4, true).Verify(cq_.get());
EXPECT_EQ(send_request.message(), recv_request.message());
send_response.set_message(recv_request.message());
srv_stream.Write(send_response, tag(5));
- Verifier().Expect(5, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(5, true).Verify(cq_.get());
cli_stream->Read(&recv_response, tag(6));
- Verifier().Expect(6, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(6, true).Verify(cq_.get());
EXPECT_EQ(send_response.message(), recv_response.message());
cli_stream->WritesDone(tag(7));
- Verifier().Expect(7, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(7, true).Verify(cq_.get());
srv_stream.Read(&recv_request, tag(8));
- Verifier().Expect(8, false).Verify(cq_.get());
+ Verifier(GetParam()).Expect(8, false).Verify(cq_.get());
srv_stream.Finish(Status::OK, tag(9));
- Verifier().Expect(9, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(9, true).Verify(cq_.get());
cli_stream->Finish(&recv_status, tag(10));
- Verifier().Expect(10, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(10, true).Verify(cq_.get());
EXPECT_TRUE(recv_status.ok());
}
// Metadata tests
-TEST_F(AsyncEnd2endTest, ClientInitialMetadataRpc) {
+TEST_P(AsyncEnd2endTest, ClientInitialMetadataRpc) {
ResetStub();
EchoRequest send_request;
@@ -416,7 +481,7 @@ TEST_F(AsyncEnd2endTest, ClientInitialMetadataRpc) {
service_.RequestEcho(&srv_ctx, &recv_request, &response_writer, cq_.get(),
cq_.get(), tag(2));
- Verifier().Expect(2, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(2, true).Verify(cq_.get());
EXPECT_EQ(send_request.message(), recv_request.message());
auto client_initial_metadata = srv_ctx.client_metadata();
EXPECT_EQ(meta1.second, client_initial_metadata.find(meta1.first)->second);
@@ -426,16 +491,16 @@ TEST_F(AsyncEnd2endTest, ClientInitialMetadataRpc) {
send_response.set_message(recv_request.message());
response_writer.Finish(send_response, Status::OK, tag(3));
- Verifier().Expect(3, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(3, true).Verify(cq_.get());
response_reader->Finish(&recv_response, &recv_status, tag(4));
- Verifier().Expect(4, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(4, true).Verify(cq_.get());
EXPECT_EQ(send_response.message(), recv_response.message());
EXPECT_TRUE(recv_status.ok());
}
-TEST_F(AsyncEnd2endTest, ServerInitialMetadataRpc) {
+TEST_P(AsyncEnd2endTest, ServerInitialMetadataRpc) {
ResetStub();
EchoRequest send_request;
@@ -457,15 +522,15 @@ TEST_F(AsyncEnd2endTest, ServerInitialMetadataRpc) {
service_.RequestEcho(&srv_ctx, &recv_request, &response_writer, cq_.get(),
cq_.get(), tag(2));
- Verifier().Expect(2, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(2, true).Verify(cq_.get());
EXPECT_EQ(send_request.message(), recv_request.message());
srv_ctx.AddInitialMetadata(meta1.first, meta1.second);
srv_ctx.AddInitialMetadata(meta2.first, meta2.second);
response_writer.SendInitialMetadata(tag(3));
- Verifier().Expect(3, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(3, true).Verify(cq_.get());
response_reader->ReadInitialMetadata(tag(4));
- Verifier().Expect(4, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(4, true).Verify(cq_.get());
auto server_initial_metadata = cli_ctx.GetServerInitialMetadata();
EXPECT_EQ(meta1.second, server_initial_metadata.find(meta1.first)->second);
EXPECT_EQ(meta2.second, server_initial_metadata.find(meta2.first)->second);
@@ -473,16 +538,16 @@ TEST_F(AsyncEnd2endTest, ServerInitialMetadataRpc) {
send_response.set_message(recv_request.message());
response_writer.Finish(send_response, Status::OK, tag(5));
- Verifier().Expect(5, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(5, true).Verify(cq_.get());
response_reader->Finish(&recv_response, &recv_status, tag(6));
- Verifier().Expect(6, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(6, true).Verify(cq_.get());
EXPECT_EQ(send_response.message(), recv_response.message());
EXPECT_TRUE(recv_status.ok());
}
-TEST_F(AsyncEnd2endTest, ServerTrailingMetadataRpc) {
+TEST_P(AsyncEnd2endTest, ServerTrailingMetadataRpc) {
ResetStub();
EchoRequest send_request;
@@ -504,20 +569,20 @@ TEST_F(AsyncEnd2endTest, ServerTrailingMetadataRpc) {
service_.RequestEcho(&srv_ctx, &recv_request, &response_writer, cq_.get(),
cq_.get(), tag(2));
- Verifier().Expect(2, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(2, true).Verify(cq_.get());
EXPECT_EQ(send_request.message(), recv_request.message());
response_writer.SendInitialMetadata(tag(3));
- Verifier().Expect(3, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(3, true).Verify(cq_.get());
send_response.set_message(recv_request.message());
srv_ctx.AddTrailingMetadata(meta1.first, meta1.second);
srv_ctx.AddTrailingMetadata(meta2.first, meta2.second);
response_writer.Finish(send_response, Status::OK, tag(4));
- Verifier().Expect(4, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(4, true).Verify(cq_.get());
response_reader->Finish(&recv_response, &recv_status, tag(5));
- Verifier().Expect(5, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(5, true).Verify(cq_.get());
EXPECT_EQ(send_response.message(), recv_response.message());
EXPECT_TRUE(recv_status.ok());
auto server_trailing_metadata = cli_ctx.GetServerTrailingMetadata();
@@ -526,7 +591,7 @@ TEST_F(AsyncEnd2endTest, ServerTrailingMetadataRpc) {
EXPECT_EQ(static_cast<size_t>(2), server_trailing_metadata.size());
}
-TEST_F(AsyncEnd2endTest, MetadataRpc) {
+TEST_P(AsyncEnd2endTest, MetadataRpc) {
ResetStub();
EchoRequest send_request;
@@ -563,7 +628,7 @@ TEST_F(AsyncEnd2endTest, MetadataRpc) {
service_.RequestEcho(&srv_ctx, &recv_request, &response_writer, cq_.get(),
cq_.get(), tag(2));
- Verifier().Expect(2, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(2, true).Verify(cq_.get());
EXPECT_EQ(send_request.message(), recv_request.message());
auto client_initial_metadata = srv_ctx.client_metadata();
EXPECT_EQ(meta1.second, client_initial_metadata.find(meta1.first)->second);
@@ -573,9 +638,9 @@ TEST_F(AsyncEnd2endTest, MetadataRpc) {
srv_ctx.AddInitialMetadata(meta3.first, meta3.second);
srv_ctx.AddInitialMetadata(meta4.first, meta4.second);
response_writer.SendInitialMetadata(tag(3));
- Verifier().Expect(3, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(3, true).Verify(cq_.get());
response_reader->ReadInitialMetadata(tag(4));
- Verifier().Expect(4, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(4, true).Verify(cq_.get());
auto server_initial_metadata = cli_ctx.GetServerInitialMetadata();
EXPECT_EQ(meta3.second, server_initial_metadata.find(meta3.first)->second);
EXPECT_EQ(meta4.second, server_initial_metadata.find(meta4.first)->second);
@@ -586,10 +651,10 @@ TEST_F(AsyncEnd2endTest, MetadataRpc) {
srv_ctx.AddTrailingMetadata(meta6.first, meta6.second);
response_writer.Finish(send_response, Status::OK, tag(5));
- Verifier().Expect(5, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(5, true).Verify(cq_.get());
response_reader->Finish(&recv_response, &recv_status, tag(6));
- Verifier().Expect(6, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(6, true).Verify(cq_.get());
EXPECT_EQ(send_response.message(), recv_response.message());
EXPECT_TRUE(recv_status.ok());
auto server_trailing_metadata = cli_ctx.GetServerTrailingMetadata();
@@ -599,7 +664,7 @@ TEST_F(AsyncEnd2endTest, MetadataRpc) {
}
// Server uses AsyncNotifyWhenDone API to check for cancellation
-TEST_F(AsyncEnd2endTest, ServerCheckCancellation) {
+TEST_P(AsyncEnd2endTest, ServerCheckCancellation) {
ResetStub();
EchoRequest send_request;
@@ -620,21 +685,21 @@ TEST_F(AsyncEnd2endTest, ServerCheckCancellation) {
service_.RequestEcho(&srv_ctx, &recv_request, &response_writer, cq_.get(),
cq_.get(), tag(2));
- Verifier().Expect(2, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(2, true).Verify(cq_.get());
EXPECT_EQ(send_request.message(), recv_request.message());
cli_ctx.TryCancel();
- Verifier().Expect(5, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(5, true).Verify(cq_.get());
EXPECT_TRUE(srv_ctx.IsCancelled());
response_reader->Finish(&recv_response, &recv_status, tag(4));
- Verifier().Expect(4, false).Verify(cq_.get());
+ Verifier(GetParam()).Expect(4, false).Verify(cq_.get());
EXPECT_EQ(StatusCode::CANCELLED, recv_status.error_code());
}
// Server uses AsyncNotifyWhenDone API to check for normal finish
-TEST_F(AsyncEnd2endTest, ServerCheckDone) {
+TEST_P(AsyncEnd2endTest, ServerCheckDone) {
ResetStub();
EchoRequest send_request;
@@ -655,24 +720,24 @@ TEST_F(AsyncEnd2endTest, ServerCheckDone) {
service_.RequestEcho(&srv_ctx, &recv_request, &response_writer, cq_.get(),
cq_.get(), tag(2));
- Verifier().Expect(2, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(2, true).Verify(cq_.get());
EXPECT_EQ(send_request.message(), recv_request.message());
send_response.set_message(recv_request.message());
response_writer.Finish(send_response, Status::OK, tag(3));
- Verifier().Expect(3, true).Verify(cq_.get());
- Verifier().Expect(5, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(3, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(5, true).Verify(cq_.get());
EXPECT_FALSE(srv_ctx.IsCancelled());
response_reader->Finish(&recv_response, &recv_status, tag(4));
- Verifier().Expect(4, true).Verify(cq_.get());
+ Verifier(GetParam()).Expect(4, true).Verify(cq_.get());
EXPECT_EQ(send_response.message(), recv_response.message());
EXPECT_TRUE(recv_status.ok());
}
-TEST_F(AsyncEnd2endTest, UnimplementedRpc) {
- std::shared_ptr<ChannelInterface> channel = CreateChannel(
+TEST_P(AsyncEnd2endTest, UnimplementedRpc) {
+ std::shared_ptr<Channel> channel = CreateChannel(
server_address_.str(), InsecureCredentials(), ChannelArguments());
std::unique_ptr<grpc::cpp::test::util::UnimplementedService::Stub> stub;
stub =
@@ -687,12 +752,15 @@ TEST_F(AsyncEnd2endTest, UnimplementedRpc) {
stub->AsyncUnimplemented(&cli_ctx, send_request, cq_.get()));
response_reader->Finish(&recv_response, &recv_status, tag(4));
- Verifier().Expect(4, false).Verify(cq_.get());
+ Verifier(GetParam()).Expect(4, false).Verify(cq_.get());
EXPECT_EQ(StatusCode::UNIMPLEMENTED, recv_status.error_code());
EXPECT_EQ("", recv_status.error_message());
}
+INSTANTIATE_TEST_CASE_P(AsyncEnd2end, AsyncEnd2endTest,
+ ::testing::Values(false, true));
+
} // namespace
} // namespace testing
} // namespace grpc
diff --git a/test/cpp/end2end/client_crash_test.cc b/test/cpp/end2end/client_crash_test.cc
index 1c2a5c3a36..3359080cec 100644
--- a/test/cpp/end2end/client_crash_test.cc
+++ b/test/cpp/end2end/client_crash_test.cc
@@ -31,12 +31,10 @@
*
*/
-#include "test/core/util/port.h"
-#include "test/core/util/test_config.h"
-#include "test/cpp/util/echo_duplicate.grpc.pb.h"
-#include "test/cpp/util/echo.grpc.pb.h"
-#include <grpc++/channel_arguments.h>
-#include <grpc++/channel_interface.h>
+#include <grpc/grpc.h>
+#include <grpc/support/thd.h>
+#include <grpc/support/time.h>
+#include <grpc++/channel.h>
#include <grpc++/client_context.h>
#include <grpc++/create_channel.h>
#include <grpc++/credentials.h>
@@ -44,15 +42,12 @@
#include <grpc++/server_builder.h>
#include <grpc++/server_context.h>
#include <grpc++/server_credentials.h>
-#include <grpc++/status.h>
-#include <grpc++/stream.h>
-#include <grpc++/time.h>
#include <gtest/gtest.h>
-#include <grpc/grpc.h>
-#include <grpc/support/thd.h>
-#include <grpc/support/time.h>
-
+#include "test/core/util/port.h"
+#include "test/core/util/test_config.h"
+#include "test/cpp/util/echo_duplicate.grpc.pb.h"
+#include "test/cpp/util/echo.grpc.pb.h"
#include "test/cpp/util/subprocess.h"
using grpc::cpp::test::util::EchoRequest;
diff --git a/test/cpp/end2end/client_crash_test_server.cc b/test/cpp/end2end/client_crash_test_server.cc
index 3fd8c2c2f9..79a7832874 100644
--- a/test/cpp/end2end/client_crash_test_server.cc
+++ b/test/cpp/end2end/client_crash_test_server.cc
@@ -40,7 +40,6 @@
#include <grpc++/server_builder.h>
#include <grpc++/server_context.h>
#include <grpc++/server_credentials.h>
-#include <grpc++/status.h>
#include "test/cpp/util/echo.grpc.pb.h"
DEFINE_string(address, "", "Address to bind to");
diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc
index 350b10726f..2728dce07e 100644
--- a/test/cpp/end2end/end2end_test.cc
+++ b/test/cpp/end2end/end2end_test.cc
@@ -34,30 +34,25 @@
#include <mutex>
#include <thread>
-#include "src/core/security/credentials.h"
-#include "test/core/end2end/data/ssl_test_data.h"
-#include "test/core/util/port.h"
-#include "test/core/util/test_config.h"
-#include "test/cpp/util/echo_duplicate.grpc.pb.h"
-#include "test/cpp/util/echo.grpc.pb.h"
-#include <grpc++/channel_arguments.h>
-#include <grpc++/channel_interface.h>
+#include <grpc/grpc.h>
+#include <grpc/support/thd.h>
+#include <grpc/support/time.h>
+#include <grpc++/channel.h>
#include <grpc++/client_context.h>
#include <grpc++/create_channel.h>
#include <grpc++/credentials.h>
-#include <grpc++/dynamic_thread_pool.h>
#include <grpc++/server.h>
#include <grpc++/server_builder.h>
#include <grpc++/server_context.h>
#include <grpc++/server_credentials.h>
-#include <grpc++/status.h>
-#include <grpc++/stream.h>
-#include <grpc++/time.h>
#include <gtest/gtest.h>
-#include <grpc/grpc.h>
-#include <grpc/support/thd.h>
-#include <grpc/support/time.h>
+#include "src/core/security/credentials.h"
+#include "test/core/end2end/data/ssl_test_data.h"
+#include "test/core/util/port.h"
+#include "test/core/util/test_config.h"
+#include "test/cpp/util/echo_duplicate.grpc.pb.h"
+#include "test/cpp/util/echo.grpc.pb.h"
using grpc::cpp::test::util::EchoRequest;
using grpc::cpp::test::util::EchoResponse;
@@ -106,7 +101,7 @@ bool CheckIsLocalhost(const grpc::string& addr) {
class Proxy : public ::grpc::cpp::test::util::TestService::Service {
public:
- Proxy(std::shared_ptr<ChannelInterface> channel)
+ Proxy(std::shared_ptr<Channel> channel)
: stub_(grpc::cpp::test::util::TestService::NewStub(channel)) {}
Status Echo(ServerContext* server_context, const EchoRequest* request,
@@ -262,7 +257,7 @@ class TestServiceImplDupPkg
class End2endTest : public ::testing::TestWithParam<bool> {
protected:
End2endTest()
- : kMaxMessageSize_(8192), special_service_("special"), thread_pool_(2) {}
+ : kMaxMessageSize_(8192), special_service_("special") {}
void SetUp() GRPC_OVERRIDE {
int port = grpc_pick_unused_port_or_die();
@@ -281,7 +276,6 @@ class End2endTest : public ::testing::TestWithParam<bool> {
builder.SetMaxMessageSize(
kMaxMessageSize_); // For testing max message size.
builder.RegisterService(&dup_pkg_service_);
- builder.SetThreadPool(&thread_pool_);
server_ = builder.BuildAndStart();
}
@@ -309,7 +303,6 @@ class End2endTest : public ::testing::TestWithParam<bool> {
ServerBuilder builder;
builder.AddListeningPort(proxyaddr.str(), InsecureServerCredentials());
builder.RegisterService(proxy_service_.get());
- builder.SetThreadPool(&thread_pool_);
proxy_server_ = builder.BuildAndStart();
channel_ = CreateChannel(proxyaddr.str(), InsecureCredentials(),
@@ -319,7 +312,7 @@ class End2endTest : public ::testing::TestWithParam<bool> {
stub_ = std::move(grpc::cpp::test::util::TestService::NewStub(channel_));
}
- std::shared_ptr<ChannelInterface> channel_;
+ std::shared_ptr<Channel> channel_;
std::unique_ptr<grpc::cpp::test::util::TestService::Stub> stub_;
std::unique_ptr<Server> server_;
std::unique_ptr<Server> proxy_server_;
@@ -329,7 +322,6 @@ class End2endTest : public ::testing::TestWithParam<bool> {
TestServiceImpl service_;
TestServiceImpl special_service_;
TestServiceImplDupPkg dup_pkg_service_;
- DynamicThreadPool thread_pool_;
};
static void SendRpc(grpc::cpp::test::util::TestService::Stub* stub,
@@ -571,7 +563,7 @@ TEST_F(End2endTest, DiffPackageServices) {
TEST_F(End2endTest, BadCredentials) {
std::shared_ptr<Credentials> bad_creds = ServiceAccountCredentials("", "", 1);
EXPECT_EQ(static_cast<Credentials*>(nullptr), bad_creds.get());
- std::shared_ptr<ChannelInterface> channel =
+ std::shared_ptr<Channel> channel =
CreateChannel(server_address_.str(), bad_creds, ChannelArguments());
std::unique_ptr<grpc::cpp::test::util::TestService::Stub> stub(
grpc::cpp::test::util::TestService::NewStub(channel));
diff --git a/test/cpp/end2end/generic_end2end_test.cc b/test/cpp/end2end/generic_end2end_test.cc
index 3120cec938..de7eab8dc2 100644
--- a/test/cpp/end2end/generic_end2end_test.cc
+++ b/test/cpp/end2end/generic_end2end_test.cc
@@ -33,32 +33,26 @@
#include <memory>
-#include "test/core/util/port.h"
-#include "test/core/util/test_config.h"
-#include "test/cpp/util/echo.grpc.pb.h"
+#include <grpc/grpc.h>
+#include <grpc/support/thd.h>
+#include <grpc/support/time.h>
#include <grpc++/impl/proto_utils.h>
-#include <grpc++/async_generic_service.h>
-#include <grpc++/async_unary_call.h>
-#include <grpc++/byte_buffer.h>
-#include <grpc++/channel_arguments.h>
-#include <grpc++/channel_interface.h>
+#include <grpc++/channel.h>
#include <grpc++/client_context.h>
#include <grpc++/create_channel.h>
#include <grpc++/credentials.h>
-#include <grpc++/generic_stub.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++/server_credentials.h>
-#include <grpc++/slice.h>
-#include <grpc++/status.h>
-#include <grpc++/stream.h>
-#include <grpc++/time.h>
+#include <grpc++/support/slice.h>
#include <gtest/gtest.h>
-#include <grpc/grpc.h>
-#include <grpc/support/thd.h>
-#include <grpc/support/time.h>
+#include "test/core/util/port.h"
+#include "test/core/util/test_config.h"
+#include "test/cpp/util/echo.grpc.pb.h"
using grpc::cpp::test::util::EchoRequest;
using grpc::cpp::test::util::EchoResponse;
@@ -127,7 +121,7 @@ class GenericEnd2endTest : public ::testing::Test {
}
void ResetStub() {
- std::shared_ptr<ChannelInterface> channel = CreateChannel(
+ std::shared_ptr<Channel> channel = CreateChannel(
server_address_.str(), InsecureCredentials(), ChannelArguments());
generic_stub_.reset(new GenericStub(channel));
}
diff --git a/test/cpp/end2end/mock_test.cc b/test/cpp/end2end/mock_test.cc
index 32130e24e9..b2c6dc39a8 100644
--- a/test/cpp/end2end/mock_test.cc
+++ b/test/cpp/end2end/mock_test.cc
@@ -33,28 +33,23 @@
#include <thread>
-#include "test/core/util/port.h"
-#include "test/core/util/test_config.h"
-#include "test/cpp/util/echo_duplicate.grpc.pb.h"
-#include "test/cpp/util/echo.grpc.pb.h"
-#include <grpc++/channel_arguments.h>
-#include <grpc++/channel_interface.h>
+#include <grpc/grpc.h>
+#include <grpc/support/thd.h>
+#include <grpc/support/time.h>
+#include <grpc++/channel.h>
#include <grpc++/client_context.h>
#include <grpc++/create_channel.h>
#include <grpc++/credentials.h>
-#include <grpc++/dynamic_thread_pool.h>
#include <grpc++/server.h>
#include <grpc++/server_builder.h>
#include <grpc++/server_context.h>
#include <grpc++/server_credentials.h>
-#include <grpc++/status.h>
-#include <grpc++/stream.h>
-#include <grpc++/time.h>
#include <gtest/gtest.h>
-#include <grpc/grpc.h>
-#include <grpc/support/thd.h>
-#include <grpc/support/time.h>
+#include "test/core/util/port.h"
+#include "test/core/util/test_config.h"
+#include "test/cpp/util/echo_duplicate.grpc.pb.h"
+#include "test/cpp/util/echo.grpc.pb.h"
using grpc::cpp::test::util::EchoRequest;
using grpc::cpp::test::util::EchoResponse;
@@ -234,7 +229,7 @@ class TestServiceImpl : public TestService::Service {
class MockTest : public ::testing::Test {
protected:
- MockTest() : thread_pool_(2) {}
+ MockTest() {}
void SetUp() GRPC_OVERRIDE {
int port = grpc_pick_unused_port_or_die();
@@ -244,14 +239,13 @@ class MockTest : public ::testing::Test {
builder.AddListeningPort(server_address_.str(),
InsecureServerCredentials());
builder.RegisterService(&service_);
- builder.SetThreadPool(&thread_pool_);
server_ = builder.BuildAndStart();
}
void TearDown() GRPC_OVERRIDE { server_->Shutdown(); }
void ResetStub() {
- std::shared_ptr<ChannelInterface> channel = CreateChannel(
+ std::shared_ptr<Channel> channel = CreateChannel(
server_address_.str(), InsecureCredentials(), ChannelArguments());
stub_ = std::move(grpc::cpp::test::util::TestService::NewStub(channel));
}
@@ -260,7 +254,6 @@ class MockTest : public ::testing::Test {
std::unique_ptr<Server> server_;
std::ostringstream server_address_;
TestServiceImpl service_;
- DynamicThreadPool thread_pool_;
};
// Do one real rpc and one mocked one
diff --git a/test/cpp/end2end/server_crash_test.cc b/test/cpp/end2end/server_crash_test.cc
index 5c7bb4e653..1a0f04e22b 100644
--- a/test/cpp/end2end/server_crash_test.cc
+++ b/test/cpp/end2end/server_crash_test.cc
@@ -31,12 +31,10 @@
*
*/
-#include "test/core/util/port.h"
-#include "test/core/util/test_config.h"
-#include "test/cpp/util/echo_duplicate.grpc.pb.h"
-#include "test/cpp/util/echo.grpc.pb.h"
-#include <grpc++/channel_arguments.h>
-#include <grpc++/channel_interface.h>
+#include <grpc/grpc.h>
+#include <grpc/support/thd.h>
+#include <grpc/support/time.h>
+#include <grpc++/channel.h>
#include <grpc++/client_context.h>
#include <grpc++/create_channel.h>
#include <grpc++/credentials.h>
@@ -44,15 +42,12 @@
#include <grpc++/server_builder.h>
#include <grpc++/server_context.h>
#include <grpc++/server_credentials.h>
-#include <grpc++/status.h>
-#include <grpc++/stream.h>
-#include <grpc++/time.h>
#include <gtest/gtest.h>
-#include <grpc/grpc.h>
-#include <grpc/support/thd.h>
-#include <grpc/support/time.h>
-
+#include "test/core/util/port.h"
+#include "test/core/util/test_config.h"
+#include "test/cpp/util/echo.grpc.pb.h"
+#include "test/cpp/util/echo_duplicate.grpc.pb.h"
#include "test/cpp/util/subprocess.h"
using grpc::cpp::test::util::EchoRequest;
diff --git a/test/cpp/end2end/server_crash_test_client.cc b/test/cpp/end2end/server_crash_test_client.cc
index 1da4f05c8d..7ca43a0c5b 100644
--- a/test/cpp/end2end/server_crash_test_client.cc
+++ b/test/cpp/end2end/server_crash_test_client.cc
@@ -37,12 +37,10 @@
#include <string>
#include <gflags/gflags.h>
-#include <grpc++/channel_arguments.h>
-#include <grpc++/channel_interface.h>
+#include <grpc++/channel.h>
#include <grpc++/client_context.h>
#include <grpc++/create_channel.h>
#include <grpc++/credentials.h>
-#include <grpc++/status.h>
#include "test/cpp/util/echo.grpc.pb.h"
DEFINE_string(address, "", "Address to connect to");
diff --git a/test/cpp/end2end/shutdown_test.cc b/test/cpp/end2end/shutdown_test.cc
index fccbb13030..e83f86f7ec 100644
--- a/test/cpp/end2end/shutdown_test.cc
+++ b/test/cpp/end2end/shutdown_test.cc
@@ -31,15 +31,11 @@
*
*/
-#include "test/core/util/test_config.h"
-
#include <thread>
-#include "test/core/util/port.h"
-#include "test/cpp/util/echo.grpc.pb.h"
-#include "src/core/support/env.h"
-#include <grpc++/channel_arguments.h>
-#include <grpc++/channel_interface.h>
+#include <grpc/grpc.h>
+#include <grpc/support/sync.h>
+#include <grpc++/channel.h>
#include <grpc++/client_context.h>
#include <grpc++/create_channel.h>
#include <grpc++/credentials.h>
@@ -47,10 +43,12 @@
#include <grpc++/server_builder.h>
#include <grpc++/server_context.h>
#include <grpc++/server_credentials.h>
-#include <grpc++/status.h>
#include <gtest/gtest.h>
-#include <grpc/grpc.h>
-#include <grpc/support/sync.h>
+
+#include "src/core/support/env.h"
+#include "test/core/util/test_config.h"
+#include "test/core/util/port.h"
+#include "test/cpp/util/echo.grpc.pb.h"
using grpc::cpp::test::util::EchoRequest;
using grpc::cpp::test::util::EchoResponse;
@@ -118,7 +116,7 @@ class ShutdownTest : public ::testing::Test {
}
protected:
- std::shared_ptr<ChannelInterface> channel_;
+ std::shared_ptr<Channel> channel_;
std::unique_ptr<grpc::cpp::test::util::TestService::Stub> stub_;
std::unique_ptr<Server> server_;
bool shutdown_;
diff --git a/test/cpp/end2end/thread_stress_test.cc b/test/cpp/end2end/thread_stress_test.cc
index ff9c945c7c..8304f04d56 100644
--- a/test/cpp/end2end/thread_stress_test.cc
+++ b/test/cpp/end2end/thread_stress_test.cc
@@ -34,28 +34,23 @@
#include <mutex>
#include <thread>
-#include "test/core/util/port.h"
-#include "test/core/util/test_config.h"
-#include "test/cpp/util/echo_duplicate.grpc.pb.h"
-#include "test/cpp/util/echo.grpc.pb.h"
-#include <grpc++/channel_arguments.h>
-#include <grpc++/channel_interface.h>
+#include <grpc/grpc.h>
+#include <grpc/support/thd.h>
+#include <grpc/support/time.h>
+#include <grpc++/channel.h>
#include <grpc++/client_context.h>
#include <grpc++/create_channel.h>
#include <grpc++/credentials.h>
-#include <grpc++/dynamic_thread_pool.h>
#include <grpc++/server.h>
#include <grpc++/server_builder.h>
#include <grpc++/server_context.h>
#include <grpc++/server_credentials.h>
-#include <grpc++/status.h>
-#include <grpc++/stream.h>
-#include <grpc++/time.h>
#include <gtest/gtest.h>
-#include <grpc/grpc.h>
-#include <grpc/support/thd.h>
-#include <grpc/support/time.h>
+#include "test/core/util/port.h"
+#include "test/core/util/test_config.h"
+#include "test/cpp/util/echo_duplicate.grpc.pb.h"
+#include "test/cpp/util/echo.grpc.pb.h"
using grpc::cpp::test::util::EchoRequest;
using grpc::cpp::test::util::EchoResponse;
@@ -177,7 +172,7 @@ class TestServiceImplDupPkg
class End2endTest : public ::testing::Test {
protected:
- End2endTest() : kMaxMessageSize_(8192), thread_pool_(2) {}
+ End2endTest() : kMaxMessageSize_(8192) {}
void SetUp() GRPC_OVERRIDE {
int port = grpc_pick_unused_port_or_die();
@@ -190,14 +185,13 @@ class End2endTest : public ::testing::Test {
builder.SetMaxMessageSize(
kMaxMessageSize_); // For testing max message size.
builder.RegisterService(&dup_pkg_service_);
- builder.SetThreadPool(&thread_pool_);
server_ = builder.BuildAndStart();
}
void TearDown() GRPC_OVERRIDE { server_->Shutdown(); }
void ResetStub() {
- std::shared_ptr<ChannelInterface> channel = CreateChannel(
+ std::shared_ptr<Channel> channel = CreateChannel(
server_address_.str(), InsecureCredentials(), ChannelArguments());
stub_ = std::move(grpc::cpp::test::util::TestService::NewStub(channel));
}
@@ -208,7 +202,6 @@ class End2endTest : public ::testing::Test {
const int kMaxMessageSize_;
TestServiceImpl service_;
TestServiceImplDupPkg dup_pkg_service_;
- DynamicThreadPool thread_pool_;
};
static void SendRpc(grpc::cpp::test::util::TestService::Stub* stub,
diff --git a/test/cpp/end2end/zookeeper_test.cc b/test/cpp/end2end/zookeeper_test.cc
index f5eba66cb2..e7d95b1c46 100644
--- a/test/cpp/end2end/zookeeper_test.cc
+++ b/test/cpp/end2end/zookeeper_test.cc
@@ -31,12 +31,7 @@
*
*/
-#include "test/core/util/test_config.h"
-#include "test/core/util/port.h"
-#include "test/cpp/util/echo.grpc.pb.h"
-#include "src/core/support/env.h"
-#include <grpc++/channel_arguments.h>
-#include <grpc++/channel_interface.h>
+#include <grpc++/channel.h>
#include <grpc++/client_context.h>
#include <grpc++/create_channel.h>
#include <grpc++/credentials.h>
@@ -44,12 +39,16 @@
#include <grpc++/server_builder.h>
#include <grpc++/server_context.h>
#include <grpc++/server_credentials.h>
-#include <grpc++/status.h>
#include <gtest/gtest.h>
#include <grpc/grpc.h>
#include <grpc/grpc_zookeeper.h>
#include <zookeeper/zookeeper.h>
+#include "test/core/util/test_config.h"
+#include "test/core/util/port.h"
+#include "test/cpp/util/echo.grpc.pb.h"
+#include "src/core/support/env.h"
+
using grpc::cpp::test::util::EchoRequest;
using grpc::cpp::test::util::EchoResponse;
@@ -170,7 +169,7 @@ class ZookeeperTest : public ::testing::Test {
return strs.str();
}
- std::shared_ptr<ChannelInterface> channel_;
+ std::shared_ptr<Channel> channel_;
std::unique_ptr<grpc::cpp::test::util::TestService::Stub> stub_;
std::unique_ptr<Server> server1_;
std::unique_ptr<Server> server2_;
diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc
index 48143b2e53..cb5232153b 100644
--- a/test/cpp/interop/client.cc
+++ b/test/cpp/interop/client.cc
@@ -38,10 +38,9 @@
#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include <gflags/gflags.h>
-#include <grpc++/channel_interface.h>
+#include <grpc++/channel.h>
#include <grpc++/client_context.h>
-#include <grpc++/status.h>
-#include <grpc++/stream.h>
+
#include "test/cpp/interop/client_helper.h"
#include "test/cpp/interop/interop_client.h"
#include "test/cpp/util/test_config.h"
diff --git a/test/cpp/interop/client_helper.cc b/test/cpp/interop/client_helper.cc
index da5627de95..abc14aeb98 100644
--- a/test/cpp/interop/client_helper.cc
+++ b/test/cpp/interop/client_helper.cc
@@ -33,27 +33,24 @@
#include "test/cpp/interop/client_helper.h"
+#include <unistd.h>
+
#include <fstream>
#include <memory>
#include <sstream>
-#include <unistd.h>
-
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <gflags/gflags.h>
-#include <grpc++/channel_arguments.h>
-#include <grpc++/channel_interface.h>
+#include <grpc++/channel.h>
#include <grpc++/create_channel.h>
#include <grpc++/credentials.h>
-#include <grpc++/stream.h>
+#include "src/cpp/client/secure_credentials.h"
#include "test/core/security/oauth2_utils.h"
#include "test/cpp/util/create_test_channel.h"
-#include "src/cpp/client/secure_credentials.h"
-
DECLARE_bool(enable_ssl);
DECLARE_bool(use_prod_roots);
DECLARE_int32(server_port);
@@ -102,7 +99,7 @@ grpc::string GetOauth2AccessToken() {
return access_token;
}
-std::shared_ptr<ChannelInterface> CreateChannelForTestCase(
+std::shared_ptr<Channel> CreateChannelForTestCase(
const grpc::string& test_case) {
GPR_ASSERT(FLAGS_server_port);
const int host_port_buf_size = 1024;
diff --git a/test/cpp/interop/client_helper.h b/test/cpp/interop/client_helper.h
index edc69e90ac..92d5078f48 100644
--- a/test/cpp/interop/client_helper.h
+++ b/test/cpp/interop/client_helper.h
@@ -36,8 +36,7 @@
#include <memory>
-#include <grpc++/config.h>
-#include <grpc++/channel_interface.h>
+#include <grpc++/channel.h>
#include "src/core/surface/call.h"
@@ -48,7 +47,7 @@ grpc::string GetServiceAccountJsonKey();
grpc::string GetOauth2AccessToken();
-std::shared_ptr<ChannelInterface> CreateChannelForTestCase(
+std::shared_ptr<Channel> CreateChannelForTestCase(
const grpc::string& test_case);
class InteropClientContextInspector {
diff --git a/test/cpp/interop/interop_client.cc b/test/cpp/interop/interop_client.cc
index 5ed14d556a..fa358585d4 100644
--- a/test/cpp/interop/interop_client.cc
+++ b/test/cpp/interop/interop_client.cc
@@ -33,26 +33,24 @@
#include "test/cpp/interop/interop_client.h"
+#include <unistd.h>
+
#include <fstream>
#include <memory>
-#include <unistd.h>
-
#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
-#include <grpc++/channel_interface.h>
+#include <grpc++/channel.h>
#include <grpc++/client_context.h>
#include <grpc++/credentials.h>
-#include <grpc++/status.h>
-#include <grpc++/stream.h>
+#include "src/core/transport/stream_op.h"
#include "test/cpp/interop/client_helper.h"
#include "test/proto/test.grpc.pb.h"
#include "test/proto/empty.grpc.pb.h"
#include "test/proto/messages.grpc.pb.h"
-#include "src/core/transport/stream_op.h"
namespace grpc {
namespace testing {
@@ -84,7 +82,7 @@ CompressionType GetInteropCompressionTypeFromCompressionAlgorithm(
}
} // namespace
-InteropClient::InteropClient(std::shared_ptr<ChannelInterface> channel)
+InteropClient::InteropClient(std::shared_ptr<Channel> channel)
: channel_(channel) {}
void InteropClient::AssertOkOrPrintErrorStatus(const Status& s) {
diff --git a/test/cpp/interop/interop_client.h b/test/cpp/interop/interop_client.h
index d6fb9bff39..5e26cc82e6 100644
--- a/test/cpp/interop/interop_client.h
+++ b/test/cpp/interop/interop_client.h
@@ -33,11 +33,11 @@
#ifndef GRPC_TEST_CPP_INTEROP_INTEROP_CLIENT_H
#define GRPC_TEST_CPP_INTEROP_INTEROP_CLIENT_H
+
#include <memory>
#include <grpc/grpc.h>
-#include <grpc++/channel_interface.h>
-#include <grpc++/status.h>
+#include <grpc++/channel.h>
#include "test/proto/messages.grpc.pb.h"
namespace grpc {
@@ -45,10 +45,10 @@ namespace testing {
class InteropClient {
public:
- explicit InteropClient(std::shared_ptr<ChannelInterface> channel);
+ explicit InteropClient(std::shared_ptr<Channel> channel);
~InteropClient() {}
- void Reset(std::shared_ptr<ChannelInterface> channel) { channel_ = channel; }
+ void Reset(std::shared_ptr<Channel> channel) { channel_ = channel; }
void DoEmpty();
void DoLargeUnary();
@@ -82,7 +82,7 @@ class InteropClient {
void PerformLargeUnary(SimpleRequest* request, SimpleResponse* response);
void AssertOkOrPrintErrorStatus(const Status& s);
- std::shared_ptr<ChannelInterface> channel_;
+ std::shared_ptr<Channel> channel_;
};
} // namespace testing
diff --git a/test/cpp/interop/interop_test.cc b/test/cpp/interop/interop_test.cc
index aac6e56b89..f01b032e95 100644
--- a/test/cpp/interop/interop_test.cc
+++ b/test/cpp/interop/interop_test.cc
@@ -44,17 +44,18 @@
#include <sys/types.h>
#include <sys/wait.h>
-extern "C" {
-#include "src/core/iomgr/socket_utils_posix.h"
-#include "src/core/support/string.h"
-}
-
#include <grpc/support/alloc.h>
#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include "test/core/util/port.h"
+extern "C" {
+#include "src/core/iomgr/socket_utils_posix.h"
+#include "src/core/support/string.h"
+}
+
+
int test_client(const char* root, const char* host, int port) {
int status;
pid_t cli;
diff --git a/test/cpp/interop/reconnect_interop_client.cc b/test/cpp/interop/reconnect_interop_client.cc
index 65f098050e..d332dcad84 100644
--- a/test/cpp/interop/reconnect_interop_client.cc
+++ b/test/cpp/interop/reconnect_interop_client.cc
@@ -37,9 +37,8 @@
#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include <gflags/gflags.h>
-#include <grpc++/channel_interface.h>
+#include <grpc++/channel.h>
#include <grpc++/client_context.h>
-#include <grpc++/status.h>
#include "test/cpp/util/create_test_channel.h"
#include "test/cpp/util/test_config.h"
#include "test/proto/test.grpc.pb.h"
@@ -50,7 +49,7 @@ DEFINE_int32(server_control_port, 0, "Server port for control rpcs.");
DEFINE_int32(server_retry_port, 0, "Server port for testing reconnection.");
DEFINE_string(server_host, "127.0.0.1", "Server host to connect to");
-using grpc::ChannelInterface;
+using grpc::Channel;
using grpc::ClientContext;
using grpc::CreateTestChannel;
using grpc::Status;
@@ -78,7 +77,7 @@ int main(int argc, char** argv) {
gpr_log(GPR_INFO, "Starting connections with retries.");
server_address.str("");
server_address << FLAGS_server_host << ':' << FLAGS_server_retry_port;
- std::shared_ptr<ChannelInterface> retry_channel =
+ std::shared_ptr<Channel> retry_channel =
CreateTestChannel(server_address.str(), true);
// About 13 retries.
const int kDeadlineSeconds = 540;
diff --git a/test/cpp/interop/reconnect_interop_server.cc b/test/cpp/interop/reconnect_interop_server.cc
index 8bc51aa52e..d4f171b1d0 100644
--- a/test/cpp/interop/reconnect_interop_server.cc
+++ b/test/cpp/interop/reconnect_interop_server.cc
@@ -31,23 +31,22 @@
*
*/
+#include <signal.h>
+#include <unistd.h>
+
#include <condition_variable>
#include <memory>
#include <mutex>
#include <sstream>
-#include <signal.h>
-#include <unistd.h>
-
#include <gflags/gflags.h>
#include <grpc/grpc.h>
#include <grpc/support/log.h>
-#include <grpc++/config.h>
#include <grpc++/server.h>
#include <grpc++/server_builder.h>
#include <grpc++/server_context.h>
#include <grpc++/server_credentials.h>
-#include <grpc++/status.h>
+
#include "test/core/util/reconnect_server.h"
#include "test/cpp/util/test_config.h"
#include "test/proto/test.grpc.pb.h"
diff --git a/test/cpp/interop/server.cc b/test/cpp/interop/server.cc
index 760bb18f73..35ec890aa0 100644
--- a/test/cpp/interop/server.cc
+++ b/test/cpp/interop/server.cc
@@ -31,32 +31,28 @@
*
*/
+#include <signal.h>
+#include <unistd.h>
+
#include <fstream>
#include <memory>
#include <sstream>
#include <thread>
-#include <signal.h>
-#include <unistd.h>
-
#include <gflags/gflags.h>
#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include <grpc/support/useful.h>
-
-#include <grpc++/config.h>
#include <grpc++/server.h>
#include <grpc++/server_builder.h>
#include <grpc++/server_context.h>
#include <grpc++/server_credentials.h>
-#include <grpc++/status.h>
-#include <grpc++/stream.h>
+#include "test/cpp/interop/server_helper.h"
+#include "test/cpp/util/test_config.h"
#include "test/proto/test.grpc.pb.h"
#include "test/proto/empty.grpc.pb.h"
#include "test/proto/messages.grpc.pb.h"
-#include "test/cpp/interop/server_helper.h"
-#include "test/cpp/util/test_config.h"
DEFINE_bool(enable_ssl, false, "Whether to use ssl/tls.");
DEFINE_int32(port, 0, "Server port.");
diff --git a/test/cpp/interop/server_helper.cc b/test/cpp/interop/server_helper.cc
index 3721d79635..e897f4ebf0 100644
--- a/test/cpp/interop/server_helper.cc
+++ b/test/cpp/interop/server_helper.cc
@@ -36,7 +36,6 @@
#include <memory>
#include <gflags/gflags.h>
-#include <grpc++/config.h>
#include <grpc++/server_credentials.h>
#include "src/core/surface/call.h"
diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h
index 1c4f46328f..0f95cfea38 100644
--- a/test/cpp/qps/client.h
+++ b/test/cpp/qps/client.h
@@ -34,14 +34,14 @@
#ifndef TEST_QPS_CLIENT_H
#define TEST_QPS_CLIENT_H
+#include <condition_variable>
+#include <mutex>
+
#include "test/cpp/qps/histogram.h"
#include "test/cpp/qps/interarrival.h"
#include "test/cpp/qps/timer.h"
#include "test/cpp/qps/qpstest.grpc.pb.h"
-
-#include <condition_variable>
-#include <mutex>
-#include <grpc++/config.h>
+#include "test/cpp/util/create_test_channel.h"
namespace grpc {
@@ -125,11 +125,11 @@ class Client {
channel_ = CreateTestChannel(target, config.enable_ssl());
stub_ = TestService::NewStub(channel_);
}
- ChannelInterface* get_channel() { return channel_.get(); }
+ Channel* get_channel() { return channel_.get(); }
TestService::Stub* get_stub() { return stub_.get(); }
private:
- std::shared_ptr<ChannelInterface> channel_;
+ std::shared_ptr<Channel> channel_;
std::unique_ptr<TestService::Stub> stub_;
};
std::vector<ClientChannelInfo> channels_;
diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc
index a337610cbf..f779e4a577 100644
--- a/test/cpp/qps/client_async.cc
+++ b/test/cpp/qps/client_async.cc
@@ -46,14 +46,12 @@
#include <grpc/support/histogram.h>
#include <grpc/support/log.h>
#include <gflags/gflags.h>
-#include <grpc++/async_unary_call.h>
#include <grpc++/client_context.h>
-#include <grpc++/status.h>
-#include <grpc++/stream.h>
-#include "test/cpp/util/create_test_channel.h"
+
#include "test/cpp/qps/qpstest.grpc.pb.h"
#include "test/cpp/qps/timer.h"
#include "test/cpp/qps/client.h"
+#include "test/cpp/util/create_test_channel.h"
namespace grpc {
namespace testing {
diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc
index db5416a707..123dca6600 100644
--- a/test/cpp/qps/client_sync.cc
+++ b/test/cpp/qps/client_sync.cc
@@ -31,6 +31,8 @@
*
*/
+#include <sys/signal.h>
+
#include <cassert>
#include <chrono>
#include <memory>
@@ -40,21 +42,18 @@
#include <vector>
#include <sstream>
-#include <sys/signal.h>
-
+#include <gflags/gflags.h>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/histogram.h>
#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
-#include <gflags/gflags.h>
#include <grpc++/client_context.h>
#include <grpc++/server.h>
#include <grpc++/server_builder.h>
-#include <grpc++/status.h>
-#include <grpc++/stream.h>
#include <gtest/gtest.h>
+
#include "test/cpp/util/create_test_channel.h"
#include "test/cpp/qps/client.h"
#include "test/cpp/qps/qpstest.grpc.pb.h"
diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc
index 78e3720938..3bd61ea4e8 100644
--- a/test/cpp/qps/driver.cc
+++ b/test/cpp/qps/driver.cc
@@ -31,24 +31,24 @@
*
*/
-#include "test/cpp/qps/driver.h"
-#include "src/core/support/env.h"
+#include <unistd.h>
+#include <list>
+#include <thread>
+#include <deque>
+#include <vector>
+
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/host_port.h>
-#include <grpc++/channel_arguments.h>
#include <grpc++/client_context.h>
#include <grpc++/create_channel.h>
-#include <grpc++/stream.h>
-#include <list>
-#include <thread>
-#include <deque>
-#include <vector>
-#include <unistd.h>
-#include "test/cpp/qps/histogram.h"
-#include "test/cpp/qps/qps_worker.h"
+
+#include "src/core/support/env.h"
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
+#include "test/cpp/qps/driver.h"
+#include "test/cpp/qps/histogram.h"
+#include "test/cpp/qps/qps_worker.h"
using std::list;
using std::thread;
diff --git a/test/cpp/qps/interarrival.h b/test/cpp/qps/interarrival.h
index 04d14f689f..841619e3ff 100644
--- a/test/cpp/qps/interarrival.h
+++ b/test/cpp/qps/interarrival.h
@@ -39,7 +39,7 @@
#include <cstdlib>
#include <vector>
-#include <grpc++/config.h>
+#include <grpc++/support/config.h>
namespace grpc {
namespace testing {
diff --git a/test/cpp/qps/perf_db_client.h b/test/cpp/qps/perf_db_client.h
index 7a9d86d3a6..ae5d17074b 100644
--- a/test/cpp/qps/perf_db_client.h
+++ b/test/cpp/qps/perf_db_client.h
@@ -37,12 +37,11 @@
#include <cfloat>
#include <grpc/grpc.h>
-#include <grpc++/channel_arguments.h>
-#include <grpc++/channel_interface.h>
+#include <grpc++/support/channel_arguments.h>
+#include <grpc++/channel.h>
#include <grpc++/client_context.h>
#include <grpc++/create_channel.h>
#include <grpc++/credentials.h>
-#include <grpc++/status.h>
#include "test/cpp/qps/perf_db.grpc.pb.h"
namespace grpc {
@@ -65,7 +64,7 @@ class PerfDbClient {
client_user_time_ = DBL_MIN;
}
- void init(std::shared_ptr<ChannelInterface> channel) {
+ void init(std::shared_ptr<Channel> channel) {
stub_ = PerfDbTransfer::NewStub(channel);
}
diff --git a/test/cpp/qps/qps_interarrival_test.cc b/test/cpp/qps/qps_interarrival_test.cc
index 1eed956a1c..a7979e6187 100644
--- a/test/cpp/qps/qps_interarrival_test.cc
+++ b/test/cpp/qps/qps_interarrival_test.cc
@@ -31,13 +31,13 @@
*
*/
-#include "test/cpp/qps/interarrival.h"
#include <chrono>
#include <iostream>
// Use the C histogram rather than C++ to avoid depending on proto
#include <grpc/support/histogram.h>
-#include <grpc++/config.h>
+
+#include "test/cpp/qps/interarrival.h"
using grpc::testing::RandomDist;
using grpc::testing::InterarrivalTimer;
diff --git a/test/cpp/qps/qps_openloop_test.cc b/test/cpp/qps/qps_openloop_test.cc
index 9a7313f6e8..5a6a9249a9 100644
--- a/test/cpp/qps/qps_openloop_test.cc
+++ b/test/cpp/qps/qps_openloop_test.cc
@@ -31,12 +31,12 @@
*
*/
+#include <signal.h>
+
#include <set>
#include <grpc/support/log.h>
-#include <signal.h>
-
#include "test/cpp/qps/driver.h"
#include "test/cpp/qps/report.h"
#include "test/cpp/util/benchmark_config.h"
diff --git a/test/cpp/qps/qps_test.cc b/test/cpp/qps/qps_test.cc
index ba980a6664..d0c4a79cd9 100644
--- a/test/cpp/qps/qps_test.cc
+++ b/test/cpp/qps/qps_test.cc
@@ -31,12 +31,12 @@
*
*/
+#include <signal.h>
+
#include <set>
#include <grpc/support/log.h>
-#include <signal.h>
-
#include "test/cpp/qps/driver.h"
#include "test/cpp/qps/report.h"
#include "test/cpp/util/benchmark_config.h"
diff --git a/test/cpp/qps/qps_test_with_poll.cc b/test/cpp/qps/qps_test_with_poll.cc
index 90a8da8d11..31d2c1bf7b 100644
--- a/test/cpp/qps/qps_test_with_poll.cc
+++ b/test/cpp/qps/qps_test_with_poll.cc
@@ -31,12 +31,12 @@
*
*/
+#include <signal.h>
+
#include <set>
#include <grpc/support/log.h>
-#include <signal.h>
-
#include "test/cpp/qps/driver.h"
#include "test/cpp/qps/report.h"
#include "test/cpp/util/benchmark_config.h"
diff --git a/test/cpp/qps/qps_worker.cc b/test/cpp/qps/qps_worker.cc
index f1cea5ee66..51e955a80a 100644
--- a/test/cpp/qps/qps_worker.cc
+++ b/test/cpp/qps/qps_worker.cc
@@ -47,16 +47,15 @@
#include <grpc/support/log.h>
#include <grpc/support/host_port.h>
#include <grpc++/client_context.h>
-#include <grpc++/status.h>
#include <grpc++/server.h>
#include <grpc++/server_builder.h>
#include <grpc++/server_credentials.h>
-#include <grpc++/stream.h>
+
#include "test/core/util/grpc_profiler.h"
-#include "test/cpp/util/create_test_channel.h"
#include "test/cpp/qps/qpstest.pb.h"
#include "test/cpp/qps/client.h"
#include "test/cpp/qps/server.h"
+#include "test/cpp/util/create_test_channel.h"
namespace grpc {
namespace testing {
diff --git a/test/cpp/qps/report.h b/test/cpp/qps/report.h
index aec3cbe80a..620abade39 100644
--- a/test/cpp/qps/report.h
+++ b/test/cpp/qps/report.h
@@ -37,7 +37,8 @@
#include <memory>
#include <set>
#include <vector>
-#include <grpc++/config.h>
+
+#include <grpc++/support/config.h>
#include "test/cpp/qps/driver.h"
#include "test/cpp/qps/qpstest.grpc.pb.h"
diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc
index b4fc49c31c..77415f42ce 100644
--- a/test/cpp/qps/server_async.cc
+++ b/test/cpp/qps/server_async.cc
@@ -41,22 +41,20 @@
#include <thread>
#include <gflags/gflags.h>
+#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/host_port.h>
-#include <grpc++/async_unary_call.h>
-#include <grpc++/config.h>
+#include <grpc/support/log.h>
+#include <grpc++/support/config.h>
#include <grpc++/server.h>
#include <grpc++/server_builder.h>
#include <grpc++/server_context.h>
#include <grpc++/server_credentials.h>
-#include <grpc++/status.h>
-#include <grpc++/stream.h>
#include <gtest/gtest.h>
+
#include "test/cpp/qps/qpstest.grpc.pb.h"
#include "test/cpp/qps/server.h"
-#include <grpc/grpc.h>
-#include <grpc/support/log.h>
namespace grpc {
namespace testing {
diff --git a/test/cpp/qps/server_sync.cc b/test/cpp/qps/server_sync.cc
index 4c3c9cb497..29ec19cd4b 100644
--- a/test/cpp/qps/server_sync.cc
+++ b/test/cpp/qps/server_sync.cc
@@ -32,28 +32,23 @@
*/
#include <sys/signal.h>
-#include <thread>
-
#include <unistd.h>
+#include <thread>
#include <gflags/gflags.h>
+#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/host_port.h>
-#include <grpc++/config.h>
-#include <grpc++/dynamic_thread_pool.h>
-#include <grpc++/fixed_size_thread_pool.h>
+#include <grpc/support/log.h>
#include <grpc++/server.h>
#include <grpc++/server_builder.h>
#include <grpc++/server_context.h>
#include <grpc++/server_credentials.h>
-#include <grpc++/status.h>
-#include <grpc++/stream.h>
+
#include "test/cpp/qps/qpstest.grpc.pb.h"
#include "test/cpp/qps/server.h"
#include "test/cpp/qps/timer.h"
-#include <grpc/grpc.h>
-#include <grpc/support/log.h>
namespace grpc {
namespace testing {
@@ -93,12 +88,7 @@ class TestServiceImpl GRPC_FINAL : public TestService::Service {
class SynchronousServer GRPC_FINAL : public grpc::testing::Server {
public:
SynchronousServer(const ServerConfig& config, int port)
- : thread_pool_(), impl_(MakeImpl(port)) {
- if (config.threads() > 0) {
- thread_pool_.reset(new FixedSizeThreadPool(config.threads()));
- } else {
- thread_pool_.reset(new DynamicThreadPool(-config.threads()));
- }
+ : impl_(MakeImpl(port)) {
}
private:
@@ -112,13 +102,10 @@ class SynchronousServer GRPC_FINAL : public grpc::testing::Server {
builder.RegisterService(&service_);
- builder.SetThreadPool(thread_pool_.get());
-
return builder.BuildAndStart();
}
TestServiceImpl service_;
- std::unique_ptr<ThreadPoolInterface> thread_pool_;
std::unique_ptr<grpc::Server> impl_;
};
diff --git a/test/cpp/qps/stats.h b/test/cpp/qps/stats.h
index 82dc03e3da..93875017ca 100644
--- a/test/cpp/qps/stats.h
+++ b/test/cpp/qps/stats.h
@@ -34,9 +34,10 @@
#ifndef TEST_QPS_STATS_UTILS_H
#define TEST_QPS_STATS_UTILS_H
-#include "test/cpp/qps/histogram.h"
#include <string>
+#include "test/cpp/qps/histogram.h"
+
namespace grpc {
namespace testing {
diff --git a/test/cpp/qps/sync_streaming_ping_pong_test.cc b/test/cpp/qps/sync_streaming_ping_pong_test.cc
index d53905a779..52e43939a8 100644
--- a/test/cpp/qps/sync_streaming_ping_pong_test.cc
+++ b/test/cpp/qps/sync_streaming_ping_pong_test.cc
@@ -31,12 +31,12 @@
*
*/
+#include <signal.h>
+
#include <set>
#include <grpc/support/log.h>
-#include <signal.h>
-
#include "test/cpp/qps/driver.h"
#include "test/cpp/qps/report.h"
#include "test/cpp/util/benchmark_config.h"
diff --git a/test/cpp/qps/sync_unary_ping_pong_test.cc b/test/cpp/qps/sync_unary_ping_pong_test.cc
index d276d13a43..fbd21357aa 100644
--- a/test/cpp/qps/sync_unary_ping_pong_test.cc
+++ b/test/cpp/qps/sync_unary_ping_pong_test.cc
@@ -31,12 +31,12 @@
*
*/
+#include <signal.h>
+
#include <set>
#include <grpc/support/log.h>
-#include <signal.h>
-
#include "test/cpp/qps/driver.h"
#include "test/cpp/qps/report.h"
#include "test/cpp/util/benchmark_config.h"
diff --git a/test/cpp/qps/timer.cc b/test/cpp/qps/timer.cc
index c1ba23decd..8edb838da3 100644
--- a/test/cpp/qps/timer.cc
+++ b/test/cpp/qps/timer.cc
@@ -36,7 +36,6 @@
#include <sys/time.h>
#include <sys/resource.h>
#include <grpc/support/time.h>
-#include <grpc++/config.h>
Timer::Timer() : start_(Sample()) {}
diff --git a/test/cpp/qps/worker.cc b/test/cpp/qps/worker.cc
index 7cf4903148..935e4853a6 100644
--- a/test/cpp/qps/worker.cc
+++ b/test/cpp/qps/worker.cc
@@ -36,9 +36,9 @@
#include <chrono>
#include <thread>
+#include <gflags/gflags.h>
#include <grpc/grpc.h>
#include <grpc/support/time.h>
-#include <gflags/gflags.h>
#include "test/cpp/qps/qps_worker.h"
#include "test/cpp/util/test_config.h"
diff --git a/test/cpp/server/dynamic_thread_pool_test.cc b/test/cpp/server/dynamic_thread_pool_test.cc
deleted file mode 100644
index 63b603b8f7..0000000000
--- a/test/cpp/server/dynamic_thread_pool_test.cc
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- *
- * Copyright 2015, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include <condition_variable>
-#include <functional>
-#include <mutex>
-
-#include <grpc++/dynamic_thread_pool.h>
-#include <gtest/gtest.h>
-
-namespace grpc {
-
-class DynamicThreadPoolTest : public ::testing::Test {
- public:
- DynamicThreadPoolTest() : thread_pool_(0) {}
-
- protected:
- DynamicThreadPool thread_pool_;
-};
-
-void Callback(std::mutex* mu, std::condition_variable* cv, bool* done) {
- std::unique_lock<std::mutex> lock(*mu);
- *done = true;
- cv->notify_all();
-}
-
-TEST_F(DynamicThreadPoolTest, Add) {
- std::mutex mu;
- std::condition_variable cv;
- bool done = false;
- std::function<void()> callback = std::bind(Callback, &mu, &cv, &done);
- thread_pool_.Add(callback);
-
- // Wait for the callback to finish.
- std::unique_lock<std::mutex> lock(mu);
- while (!done) {
- cv.wait(lock);
- }
-}
-
-} // namespace grpc
-
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- int result = RUN_ALL_TESTS();
- return result;
-}
diff --git a/test/cpp/server/fixed_size_thread_pool_test.cc b/test/cpp/server/fixed_size_thread_pool_test.cc
deleted file mode 100644
index 442e974fc1..0000000000
--- a/test/cpp/server/fixed_size_thread_pool_test.cc
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- *
- * Copyright 2015, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include <condition_variable>
-#include <functional>
-#include <mutex>
-
-#include <grpc++/fixed_size_thread_pool.h>
-#include <gtest/gtest.h>
-
-namespace grpc {
-
-class FixedSizeThreadPoolTest : public ::testing::Test {
- public:
- FixedSizeThreadPoolTest() : thread_pool_(4) {}
-
- protected:
- FixedSizeThreadPool thread_pool_;
-};
-
-void Callback(std::mutex* mu, std::condition_variable* cv, bool* done) {
- std::unique_lock<std::mutex> lock(*mu);
- *done = true;
- cv->notify_all();
-}
-
-TEST_F(FixedSizeThreadPoolTest, Add) {
- std::mutex mu;
- std::condition_variable cv;
- bool done = false;
- std::function<void()> callback = std::bind(Callback, &mu, &cv, &done);
- thread_pool_.Add(callback);
-
- // Wait for the callback to finish.
- std::unique_lock<std::mutex> lock(mu);
- while (!done) {
- cv.wait(lock);
- }
-}
-
-} // namespace grpc
-
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- int result = RUN_ALL_TESTS();
- return result;
-}
diff --git a/test/cpp/util/byte_buffer_test.cc b/test/cpp/util/byte_buffer_test.cc
index 5195575f99..f36c32cac5 100644
--- a/test/cpp/util/byte_buffer_test.cc
+++ b/test/cpp/util/byte_buffer_test.cc
@@ -31,13 +31,13 @@
*
*/
-#include <grpc++/byte_buffer.h>
+#include <grpc++/support/byte_buffer.h>
#include <cstring>
#include <vector>
#include <grpc/support/slice.h>
-#include <grpc++/slice.h>
+#include <grpc++/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 ac88910a01..d60cee9c02 100644
--- a/test/cpp/util/cli_call.cc
+++ b/test/cpp/util/cli_call.cc
@@ -35,16 +35,13 @@
#include <iostream>
-#include <grpc++/byte_buffer.h>
-#include <grpc++/channel_interface.h>
-#include <grpc++/client_context.h>
-#include <grpc++/generic_stub.h>
-#include <grpc++/status.h>
-#include <grpc++/stream.h>
-
#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include <grpc/support/slice.h>
+#include <grpc++/support/byte_buffer.h>
+#include <grpc++/channel.h>
+#include <grpc++/client_context.h>
+#include <grpc++/generic/generic_stub.h>
namespace grpc {
namespace testing {
@@ -52,7 +49,7 @@ namespace {
void* tag(int i) { return (void*)(gpr_intptr)i; }
} // namespace
-Status CliCall::Call(std::shared_ptr<grpc::ChannelInterface> channel,
+Status CliCall::Call(std::shared_ptr<grpc::Channel> channel,
const grpc::string& method, const grpc::string& request,
grpc::string* response, const MetadataContainer& metadata,
MetadataContainer* server_initial_metadata,
diff --git a/test/cpp/util/cli_call.h b/test/cpp/util/cli_call.h
index 8d114c9cb5..7a3dcf2e9f 100644
--- a/test/cpp/util/cli_call.h
+++ b/test/cpp/util/cli_call.h
@@ -36,9 +36,8 @@
#include <map>
-#include <grpc++/channel_interface.h>
-#include <grpc++/config.h>
-#include <grpc++/status.h>
+#include <grpc++/channel.h>
+#include <grpc++/support/status.h>
namespace grpc {
namespace testing {
@@ -46,7 +45,7 @@ namespace testing {
class CliCall GRPC_FINAL {
public:
typedef std::multimap<grpc::string, grpc::string> MetadataContainer;
- static Status Call(std::shared_ptr<grpc::ChannelInterface> channel,
+ static Status Call(std::shared_ptr<grpc::Channel> channel,
const grpc::string& method, const grpc::string& request,
grpc::string* response, const MetadataContainer& metadata,
MetadataContainer* server_initial_metadata,
diff --git a/test/cpp/util/cli_call_test.cc b/test/cpp/util/cli_call_test.cc
index 848a3aee57..35bfad202f 100644
--- a/test/cpp/util/cli_call_test.cc
+++ b/test/cpp/util/cli_call_test.cc
@@ -31,24 +31,22 @@
*
*/
-#include "test/core/util/test_config.h"
#include "test/cpp/util/cli_call.h"
-#include "test/cpp/util/echo.grpc.pb.h"
-#include <grpc++/channel_arguments.h>
-#include <grpc++/channel_interface.h>
+
+#include <grpc/grpc.h>
+#include <grpc++/channel.h>
#include <grpc++/client_context.h>
#include <grpc++/create_channel.h>
#include <grpc++/credentials.h>
-#include <grpc++/dynamic_thread_pool.h>
#include <grpc++/server.h>
#include <grpc++/server_builder.h>
#include <grpc++/server_context.h>
#include <grpc++/server_credentials.h>
-#include <grpc++/status.h>
-#include "test/core/util/port.h"
#include <gtest/gtest.h>
-#include <grpc/grpc.h>
+#include "test/core/util/port.h"
+#include "test/core/util/test_config.h"
+#include "test/cpp/util/echo.grpc.pb.h"
using grpc::cpp::test::util::EchoRequest;
using grpc::cpp::test::util::EchoResponse;
@@ -75,7 +73,7 @@ class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service {
class CliCallTest : public ::testing::Test {
protected:
- CliCallTest() : thread_pool_(2) {}
+ CliCallTest() {}
void SetUp() GRPC_OVERRIDE {
int port = grpc_pick_unused_port_or_die();
@@ -85,7 +83,6 @@ class CliCallTest : public ::testing::Test {
builder.AddListeningPort(server_address_.str(),
InsecureServerCredentials());
builder.RegisterService(&service_);
- builder.SetThreadPool(&thread_pool_);
server_ = builder.BuildAndStart();
}
@@ -97,12 +94,11 @@ class CliCallTest : public ::testing::Test {
stub_ = std::move(grpc::cpp::test::util::TestService::NewStub(channel_));
}
- std::shared_ptr<ChannelInterface> channel_;
+ std::shared_ptr<Channel> channel_;
std::unique_ptr<grpc::cpp::test::util::TestService::Stub> stub_;
std::unique_ptr<Server> server_;
std::ostringstream server_address_;
TestServiceImpl service_;
- DynamicThreadPool thread_pool_;
};
// Send a rpc with a normal stub and then a CliCall. Verify they match.
diff --git a/test/cpp/util/create_test_channel.cc b/test/cpp/util/create_test_channel.cc
index dc48fa2d87..161b4bdc1d 100644
--- a/test/cpp/util/create_test_channel.cc
+++ b/test/cpp/util/create_test_channel.cc
@@ -33,11 +33,11 @@
#include "test/cpp/util/create_test_channel.h"
-#include "test/core/end2end/data/ssl_test_data.h"
-#include <grpc++/channel_arguments.h>
#include <grpc++/create_channel.h>
#include <grpc++/credentials.h>
+#include "test/core/end2end/data/ssl_test_data.h"
+
namespace grpc {
// When ssl is enabled, if server is empty, override_hostname is used to
@@ -55,7 +55,7 @@ namespace grpc {
// CreateTestChannel("test.google.com:443", "", true, true, creds);
// same as above
// CreateTestChannel("", "test.google.com:443", true, true, creds);
-std::shared_ptr<ChannelInterface> CreateTestChannel(
+std::shared_ptr<Channel> CreateTestChannel(
const grpc::string& server, const grpc::string& override_hostname,
bool enable_ssl, bool use_prod_roots,
const std::shared_ptr<Credentials>& creds) {
@@ -80,7 +80,7 @@ std::shared_ptr<ChannelInterface> CreateTestChannel(
}
}
-std::shared_ptr<ChannelInterface> CreateTestChannel(
+std::shared_ptr<Channel> CreateTestChannel(
const grpc::string& server, const grpc::string& override_hostname,
bool enable_ssl, bool use_prod_roots) {
return CreateTestChannel(server, override_hostname, enable_ssl,
@@ -88,8 +88,8 @@ std::shared_ptr<ChannelInterface> CreateTestChannel(
}
// Shortcut for end2end and interop tests.
-std::shared_ptr<ChannelInterface> CreateTestChannel(const grpc::string& server,
- bool enable_ssl) {
+std::shared_ptr<Channel> CreateTestChannel(const grpc::string& server,
+ bool enable_ssl) {
return CreateTestChannel(server, "foo.test.google.fr", enable_ssl, false);
}
diff --git a/test/cpp/util/create_test_channel.h b/test/cpp/util/create_test_channel.h
index 5f2609ddd8..1263d4ed68 100644
--- a/test/cpp/util/create_test_channel.h
+++ b/test/cpp/util/create_test_channel.h
@@ -36,20 +36,19 @@
#include <memory>
-#include <grpc++/config.h>
#include <grpc++/credentials.h>
namespace grpc {
-class ChannelInterface;
+class Channel;
-std::shared_ptr<ChannelInterface> CreateTestChannel(const grpc::string& server,
- bool enable_ssl);
+std::shared_ptr<Channel> CreateTestChannel(const grpc::string& server,
+ bool enable_ssl);
-std::shared_ptr<ChannelInterface> CreateTestChannel(
+std::shared_ptr<Channel> CreateTestChannel(
const grpc::string& server, const grpc::string& override_hostname,
bool enable_ssl, bool use_prod_roots);
-std::shared_ptr<ChannelInterface> CreateTestChannel(
+std::shared_ptr<Channel> CreateTestChannel(
const grpc::string& server, const grpc::string& override_hostname,
bool enable_ssl, bool use_prod_roots,
const std::shared_ptr<Credentials>& creds);
diff --git a/test/cpp/util/grpc_cli.cc b/test/cpp/util/grpc_cli.cc
index 3c3baeb769..746d67deeb 100644
--- a/test/cpp/util/grpc_cli.cc
+++ b/test/cpp/util/grpc_cli.cc
@@ -64,14 +64,13 @@
#include <sstream>
#include <gflags/gflags.h>
-#include "test/cpp/util/cli_call.h"
-#include "test/cpp/util/test_config.h"
-#include <grpc++/channel_arguments.h>
-#include <grpc++/channel_interface.h>
+#include <grpc/grpc.h>
+#include <grpc++/channel.h>
#include <grpc++/create_channel.h>
#include <grpc++/credentials.h>
-#include <grpc/grpc.h>
+#include "test/cpp/util/cli_call.h"
+#include "test/cpp/util/test_config.h"
DEFINE_bool(enable_ssl, true, "Whether to use ssl/tls.");
DEFINE_bool(use_auth, false, "Whether to create default google credentials.");
@@ -154,7 +153,7 @@ int main(int argc, char** argv) {
creds = grpc::SslCredentials(grpc::SslCredentialsOptions());
}
}
- std::shared_ptr<grpc::ChannelInterface> channel =
+ std::shared_ptr<grpc::Channel> channel =
grpc::CreateChannel(server_address, creds, grpc::ChannelArguments());
grpc::string response;
diff --git a/test/cpp/util/slice_test.cc b/test/cpp/util/slice_test.cc
index eb328490e1..de7ff031ab 100644
--- a/test/cpp/util/slice_test.cc
+++ b/test/cpp/util/slice_test.cc
@@ -31,7 +31,7 @@
*
*/
-#include <grpc++/slice.h>
+#include <grpc++/support/slice.h>
#include <grpc/support/slice.h>
#include <gtest/gtest.h>
diff --git a/test/cpp/util/status_test.cc b/test/cpp/util/status_test.cc
index 17b92ab06a..837a6bab02 100644
--- a/test/cpp/util/status_test.cc
+++ b/test/cpp/util/status_test.cc
@@ -31,7 +31,8 @@
*
*/
-#include <grpc++/status.h>
+#include <grpc++/support/status.h>
+
#include <grpc/status.h>
#include <grpc/support/log.h>
diff --git a/test/cpp/util/string_ref_test.cc b/test/cpp/util/string_ref_test.cc
new file mode 100644
index 0000000000..c4ca4fce84
--- /dev/null
+++ b/test/cpp/util/string_ref_test.cc
@@ -0,0 +1,215 @@
+/*
+ *
+ * Copyright 2015, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include <grpc++/support/string_ref.h>
+
+#include <string.h>
+
+#include <gtest/gtest.h>
+
+namespace grpc {
+namespace {
+
+const char kTestString[] = "blah";
+const char kTestStringWithEmbeddedNull[] = "blah\0foo";
+const size_t kTestStringWithEmbeddedNullLength = 8;
+const char kTestUnrelatedString[] = "foo";
+
+class StringRefTest : public ::testing::Test {
+};
+
+TEST_F(StringRefTest, Empty) {
+ string_ref s;
+ EXPECT_EQ(0U, s.length());
+ EXPECT_EQ(nullptr, s.data());
+}
+
+TEST_F(StringRefTest, FromCString) {
+ string_ref s(kTestString);
+ EXPECT_EQ(strlen(kTestString), s.length());
+ EXPECT_EQ(kTestString, s.data());
+}
+
+TEST_F(StringRefTest, FromCStringWithLength) {
+ string_ref s(kTestString, 2);
+ EXPECT_EQ(2U, s.length());
+ EXPECT_EQ(kTestString, s.data());
+}
+
+TEST_F(StringRefTest, FromString) {
+ string copy(kTestString);
+ string_ref s(copy);
+ EXPECT_EQ(copy.data(), s.data());
+ EXPECT_EQ(copy.length(), s.length());
+}
+
+TEST_F(StringRefTest, CopyConstructor) {
+ string_ref s1(kTestString);;
+ string_ref s2(s1);
+ EXPECT_EQ(s1.length(), s2.length());
+ EXPECT_EQ(s1.data(), s2.data());
+}
+
+TEST_F(StringRefTest, FromStringWithEmbeddedNull) {
+ string copy(kTestStringWithEmbeddedNull, kTestStringWithEmbeddedNullLength);
+ string_ref s(copy);
+ EXPECT_EQ(copy.data(), s.data());
+ EXPECT_EQ(copy.length(), s.length());
+ EXPECT_EQ(kTestStringWithEmbeddedNullLength, s.length());
+}
+
+TEST_F(StringRefTest, Assignment) {
+ string_ref s1(kTestString);;
+ string_ref s2;
+ EXPECT_EQ(nullptr, s2.data());
+ s2 = s1;
+ EXPECT_EQ(s1.length(), s2.length());
+ EXPECT_EQ(s1.data(), s2.data());
+}
+
+TEST_F(StringRefTest, Iterator) {
+ string_ref s(kTestString);
+ size_t i = 0;
+ for (char c : s) {
+ EXPECT_EQ(kTestString[i++], c);
+ }
+ EXPECT_EQ(strlen(kTestString), i);
+}
+
+TEST_F(StringRefTest, ReverseIterator) {
+ string_ref s(kTestString);
+ size_t i = strlen(kTestString);
+ for (auto rit = s.crbegin(); rit != s.crend(); ++rit) {
+ EXPECT_EQ(kTestString[--i], *rit);
+ }
+ EXPECT_EQ(0U, i);
+}
+
+TEST_F(StringRefTest, Capacity) {
+ string_ref empty;
+ EXPECT_EQ(0U, empty.length());
+ EXPECT_EQ(0U, empty.size());
+ EXPECT_EQ(0U, empty.max_size());
+ EXPECT_TRUE(empty.empty());
+
+ string_ref s(kTestString);
+ EXPECT_EQ(strlen(kTestString), s.length());
+ EXPECT_EQ(s.length(), s.size());
+ EXPECT_EQ(s.max_size(), s.length());
+ EXPECT_FALSE(s.empty());
+}
+
+TEST_F(StringRefTest, Compare) {
+ string_ref s1(kTestString);
+ string s1_copy(kTestString);
+ string_ref s2(kTestUnrelatedString);
+ string_ref s3(kTestStringWithEmbeddedNull, kTestStringWithEmbeddedNullLength);
+ EXPECT_EQ(0, s1.compare(s1_copy));
+ EXPECT_NE(0, s1.compare(s2));
+ EXPECT_NE(0, s1.compare(s3));
+}
+
+TEST_F(StringRefTest, StartsWith) {
+ string_ref s1(kTestString);
+ string_ref s2(kTestUnrelatedString);
+ string_ref s3(kTestStringWithEmbeddedNull, kTestStringWithEmbeddedNullLength);
+ EXPECT_TRUE(s1.starts_with(s1));
+ EXPECT_FALSE(s1.starts_with(s2));
+ EXPECT_FALSE(s2.starts_with(s1));
+ EXPECT_FALSE(s1.starts_with(s3));
+ EXPECT_TRUE(s3.starts_with(s1));
+}
+
+TEST_F(StringRefTest, Endswith) {
+ string_ref s1(kTestString);
+ string_ref s2(kTestUnrelatedString);
+ string_ref s3(kTestStringWithEmbeddedNull, kTestStringWithEmbeddedNullLength);
+ EXPECT_TRUE(s1.ends_with(s1));
+ EXPECT_FALSE(s1.ends_with(s2));
+ EXPECT_FALSE(s2.ends_with(s1));
+ EXPECT_FALSE(s2.ends_with(s3));
+ EXPECT_TRUE(s3.ends_with(s2));
+}
+
+TEST_F(StringRefTest, Find) {
+ string_ref s1(kTestString);
+ string_ref s2(kTestUnrelatedString);
+ string_ref s3(kTestStringWithEmbeddedNull, kTestStringWithEmbeddedNullLength);
+ EXPECT_EQ(0U, s1.find(s1));
+ EXPECT_EQ(0U, s2.find(s2));
+ EXPECT_EQ(0U, s3.find(s3));
+ EXPECT_EQ(string_ref::npos,s1.find(s2) );
+ EXPECT_EQ(string_ref::npos,s2.find(s1));
+ EXPECT_EQ(string_ref::npos,s1.find(s3));
+ EXPECT_EQ(0U, s3.find(s1));
+ EXPECT_EQ(5U, s3.find(s2));
+ EXPECT_EQ(string_ref::npos, s1.find('z'));
+ EXPECT_EQ(1U, s2.find('o'));
+}
+
+TEST_F(StringRefTest, SubString) {
+ string_ref s(kTestStringWithEmbeddedNull, kTestStringWithEmbeddedNullLength);
+ string_ref sub1 = s.substr(0, 4);
+ EXPECT_EQ(string_ref(kTestString), sub1);
+ string_ref sub2 = s.substr(5);
+ EXPECT_EQ(string_ref(kTestUnrelatedString), sub2);
+}
+
+TEST_F(StringRefTest, ComparisonOperators) {
+ string_ref s1(kTestString);
+ string_ref s2(kTestUnrelatedString);
+ string_ref s3(kTestStringWithEmbeddedNull, kTestStringWithEmbeddedNullLength);
+ EXPECT_EQ(s1, s1);
+ EXPECT_EQ(s2, s2);
+ EXPECT_EQ(s3, s3);
+ EXPECT_GE(s1, s1);
+ EXPECT_GE(s2, s2);
+ EXPECT_GE(s3, s3);
+ EXPECT_LE(s1, s1);
+ EXPECT_LE(s2, s2);
+ EXPECT_LE(s3, s3);
+ EXPECT_NE(s1, s2);
+ EXPECT_NE(s1, s3);
+ EXPECT_NE(s2, s3);
+ EXPECT_GT(s3, s1);
+ EXPECT_LT(s1, s3);
+}
+
+} // namespace
+} // namespace grpc
+
+int main(int argc, char** argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
+}
+
diff --git a/test/cpp/util/time_test.cc b/test/cpp/util/time_test.cc
index 4cb6ec4b4e..1e501dfd28 100644
--- a/test/cpp/util/time_test.cc
+++ b/test/cpp/util/time_test.cc
@@ -32,7 +32,7 @@
*/
#include <grpc/support/time.h>
-#include <grpc++/time.h>
+#include <grpc++/support/time.h>
#include <gtest/gtest.h>
using std::chrono::duration_cast;