aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Alistair Veitch <aveitch@google.com>2015-08-25 15:36:20 -0700
committerGravatar Alistair Veitch <aveitch@google.com>2015-08-25 15:36:20 -0700
commita4e884721d4333eef8b208b26ff35f1dde25b6c1 (patch)
treea82dabdddbe7d00190be04b299a378aed4041f24 /test
parentf886985d2c775d480079ea979323ae22efc0afc6 (diff)
parent3cfb4795ceaaebff3b33f2ef7612ffcff72b53ab (diff)
merge to head
Diffstat (limited to 'test')
-rw-r--r--test/build/protobuf.cc4
-rw-r--r--test/build/zookeeper.c (renamed from test/cpp/server/dynamic_thread_pool_test.cc)48
-rw-r--r--test/core/bad_client/bad_client.c8
-rw-r--r--test/core/bad_client/tests/connection_prefix.c6
-rw-r--r--test/core/bad_client/tests/initial_settings_frame.c6
-rw-r--r--test/core/channel/channel_args_test.c141
-rw-r--r--test/core/client_config/uri_parser_test.c3
-rw-r--r--test/core/compression/compression_test.c (renamed from test/cpp/server/fixed_size_thread_pool_test.cc)66
-rw-r--r--test/core/compression/message_compress_test.c3
-rw-r--r--test/core/end2end/cq_verifier.c6
-rw-r--r--test/core/end2end/cq_verifier.h5
-rw-r--r--test/core/end2end/data/ssl_test_data.h2
-rw-r--r--test/core/end2end/dualstack_socket_test.c70
-rw-r--r--test/core/end2end/fixtures/chttp2_fake_security.c8
-rw-r--r--test/core/end2end/fixtures/chttp2_fullstack.c8
-rw-r--r--test/core/end2end/fixtures/chttp2_fullstack_compression.c8
-rw-r--r--test/core/end2end/fixtures/chttp2_fullstack_uds_posix.c8
-rw-r--r--test/core/end2end/fixtures/chttp2_fullstack_uds_posix_with_poll.c8
-rw-r--r--test/core/end2end/fixtures/chttp2_fullstack_with_poll.c8
-rw-r--r--test/core/end2end/fixtures/chttp2_fullstack_with_proxy.c12
-rw-r--r--test/core/end2end/fixtures/chttp2_simple_ssl_fullstack.c8
-rw-r--r--test/core/end2end/fixtures/chttp2_simple_ssl_fullstack_with_poll.c8
-rw-r--r--test/core/end2end/fixtures/chttp2_simple_ssl_fullstack_with_proxy.c10
-rw-r--r--test/core/end2end/fixtures/chttp2_simple_ssl_with_oauth2_fullstack.c13
-rw-r--r--test/core/end2end/fixtures/chttp2_socket_pair.c4
-rw-r--r--test/core/end2end/fixtures/chttp2_socket_pair_one_byte_at_a_time.c4
-rw-r--r--test/core/end2end/fixtures/chttp2_socket_pair_with_grpc_trace.c4
-rw-r--r--test/core/end2end/fixtures/proxy.c52
-rw-r--r--test/core/end2end/multiple_server_queues_test.c18
-rw-r--r--test/core/end2end/no_server_test.c15
-rw-r--r--test/core/end2end/tests/bad_hostname.c16
-rw-r--r--test/core/end2end/tests/cancel_after_accept.c32
-rw-r--r--test/core/end2end/tests/cancel_after_accept_and_writes_closed.c33
-rw-r--r--test/core/end2end/tests/cancel_after_invoke.c20
-rw-r--r--test/core/end2end/tests/cancel_before_invoke.c20
-rw-r--r--test/core/end2end/tests/cancel_in_a_vacuum.c10
-rw-r--r--test/core/end2end/tests/cancel_test_helpers.h5
-rw-r--r--test/core/end2end/tests/census_simple_request.c30
-rw-r--r--test/core/end2end/tests/channel_connectivity.c40
-rw-r--r--test/core/end2end/tests/default_host.c35
-rw-r--r--test/core/end2end/tests/disappearing_server.c27
-rw-r--r--test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls.c23
-rw-r--r--test/core/end2end/tests/early_server_shutdown_finishes_tags.c2
-rw-r--r--test/core/end2end/tests/empty_batch.c12
-rw-r--r--test/core/end2end/tests/graceful_server_shutdown.c25
-rw-r--r--test/core/end2end/tests/invoke_large_request.c36
-rw-r--r--test/core/end2end/tests/max_concurrent_streams.c78
-rw-r--r--test/core/end2end/tests/max_message_length.c28
-rw-r--r--test/core/end2end/tests/no_op.c6
-rw-r--r--test/core/end2end/tests/ping_pong_streaming.c51
-rw-r--r--test/core/end2end/tests/registered_call.c37
-rw-r--r--test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c48
-rw-r--r--test/core/end2end/tests/request_response_with_metadata_and_payload.c46
-rw-r--r--test/core/end2end/tests/request_response_with_payload.c36
-rw-r--r--test/core/end2end/tests/request_response_with_payload_and_call_creds.c52
-rw-r--r--test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c51
-rw-r--r--test/core/end2end/tests/request_with_compressed_payload.c56
-rw-r--r--test/core/end2end/tests/request_with_flags.c17
-rw-r--r--test/core/end2end/tests/request_with_large_metadata.c34
-rw-r--r--test/core/end2end/tests/request_with_payload.c27
-rw-r--r--test/core/end2end/tests/server_finishes_request.c29
-rw-r--r--test/core/end2end/tests/simple_delayed_request.c30
-rw-r--r--test/core/end2end/tests/simple_request.c30
-rw-r--r--test/core/end2end/tests/simple_request_with_high_initial_sequence_number.c30
-rw-r--r--test/core/fling/client.c34
-rw-r--r--test/core/fling/fling_test.c10
-rw-r--r--test/core/fling/server.c47
-rw-r--r--test/core/httpcli/format_request_test.c3
-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.c179
-rw-r--r--test/core/json/json_test.c2
-rw-r--r--test/core/security/auth_context_test.c1
-rw-r--r--test/core/security/json_token_test.c12
-rw-r--r--test/core/security/jwt_verifier_test.c38
-rw-r--r--test/core/security/oauth2_utils.c2
-rw-r--r--test/core/security/print_google_default_creds_token.c7
-rw-r--r--test/core/security/security_connector_test.c9
-rw-r--r--test/core/security/verify_jwt.c3
-rw-r--r--test/core/statistics/census_log_tests.h2
-rw-r--r--test/core/statistics/hash_table_test.c14
-rw-r--r--test/core/support/cancellable_test.c172
-rw-r--r--test/core/support/cmdline_test.c5
-rw-r--r--test/core/support/string_test.c4
-rw-r--r--test/core/support/thd_test.c2
-rw-r--r--test/core/surface/completion_queue_test.c41
-rw-r--r--test/core/surface/lame_client_test.c14
-rw-r--r--test/core/transport/chttp2/stream_map_test.c6
-rw-r--r--test/core/util/grpc_profiler.h2
-rw-r--r--test/core/util/parse_hexstring.h2
-rw-r--r--test/core/util/port.h2
-rw-r--r--test/core/util/port_posix.c12
-rw-r--r--test/core/util/port_windows.c13
-rw-r--r--test/core/util/reconnect_server.c3
-rw-r--r--test/core/util/slice_splitter.h2
-rw-r--r--test/core/util/test_config.c6
-rw-r--r--test/cpp/client/channel_arguments_test.cc2
-rw-r--r--test/cpp/common/auth_property_iterator_test.cc9
-rw-r--r--test/cpp/common/secure_auth_context_test.cc4
-rw-r--r--test/cpp/end2end/async_end2end_test.cc307
-rw-r--r--test/cpp/end2end/client_crash_test.cc28
-rw-r--r--test/cpp/end2end/client_crash_test_server.cc4
-rw-r--r--test/cpp/end2end/end2end_test.cc79
-rw-r--r--test/cpp/end2end/generic_end2end_test.cc33
-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.cc8
-rw-r--r--test/cpp/end2end/shutdown_test.cc157
-rw-r--r--test/cpp/end2end/thread_stress_test.cc27
-rw-r--r--test/cpp/end2end/zookeeper_test.cc221
-rw-r--r--test/cpp/interop/client.cc25
-rw-r--r--test/cpp/interop/client_helper.cc11
-rw-r--r--test/cpp/interop/client_helper.h25
-rw-r--r--test/cpp/interop/interop_client.cc182
-rw-r--r--test/cpp/interop/interop_client.h12
-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/rnd.datbin0 -> 524288 bytes
-rw-r--r--test/cpp/interop/server.cc85
-rw-r--r--test/cpp/interop/server_helper.cc22
-rw-r--r--test/cpp/interop/server_helper.h7
-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.cc13
-rw-r--r--test/cpp/qps/perf_db_client.h12
-rw-r--r--test/cpp/qps/qps_interarrival_test.cc6
-rw-r--r--test/cpp/qps/qps_openloop_test.cc8
-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/util/benchmark_config.cc14
-rw-r--r--test/cpp/util/byte_buffer_test.cc7
-rw-r--r--test/cpp/util/cli_call.cc15
-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/echo.proto6
-rw-r--r--test/cpp/util/echo_duplicate.proto2
-rw-r--r--test/cpp/util/grpc_cli.cc11
-rw-r--r--test/cpp/util/messages.proto30
-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
-rw-r--r--test/proto/empty.proto2
-rw-r--r--test/proto/messages.proto52
-rw-r--r--test/proto/test.proto2
164 files changed, 2837 insertions, 1371 deletions
diff --git a/test/build/protobuf.cc b/test/build/protobuf.cc
index bac33ad727..49cd8e8365 100644
--- a/test/build/protobuf.cc
+++ b/test/build/protobuf.cc
@@ -38,6 +38,4 @@ bool protobuf_test(const google::protobuf::MethodDescriptor *method) {
return method->client_streaming() || method->server_streaming();
}
-int main() {
- return 0;
-}
+int main() { return 0; }
diff --git a/test/cpp/server/dynamic_thread_pool_test.cc b/test/build/zookeeper.c
index 63b603b8f7..7cd3d0da9e 100644
--- a/test/cpp/server/dynamic_thread_pool_test.cc
+++ b/test/build/zookeeper.c
@@ -31,47 +31,13 @@
*
*/
-#include <condition_variable>
-#include <functional>
-#include <mutex>
+/* This is just a compilation test, to see if we have Zookeeper C client
+ library installed. */
-#include <grpc++/dynamic_thread_pool.h>
-#include <gtest/gtest.h>
+#include <stdlib.h>
+#include <zookeeper/zookeeper.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;
+int main() {
+ zookeeper_init(NULL, NULL, 0, 0, 0, 0);
+ return 0;
}
diff --git a/test/core/bad_client/bad_client.c b/test/core/bad_client/bad_client.c
index b050227b61..24bf5d3625 100644
--- a/test/core/bad_client/bad_client.c
+++ b/test/core/bad_client/bad_client.c
@@ -102,11 +102,11 @@ void grpc_run_bad_client_test(grpc_bad_client_server_side_validator validator,
/* Create server, completion events */
a.server = grpc_server_create_from_filters(NULL, 0, NULL);
- a.cq = grpc_completion_queue_create();
+ a.cq = grpc_completion_queue_create(NULL);
gpr_event_init(&a.done_thd);
gpr_event_init(&a.done_write);
a.validator = validator;
- grpc_server_register_completion_queue(a.server, a.cq);
+ grpc_server_register_completion_queue(a.server, a.cq, NULL);
grpc_server_start(a.server);
transport = grpc_create_chttp2_transport(NULL, sfd.server, mdctx, 0);
server_setup_transport(&a, transport, mdctx);
@@ -150,8 +150,8 @@ void grpc_run_bad_client_test(grpc_bad_client_server_side_validator validator,
grpc_endpoint_destroy(sfd.client);
}
grpc_server_shutdown_and_notify(a.server, a.cq, NULL);
- GPR_ASSERT(grpc_completion_queue_pluck(a.cq, NULL,
- GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1))
+ GPR_ASSERT(grpc_completion_queue_pluck(
+ a.cq, NULL, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1), NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(a.server);
grpc_completion_queue_destroy(a.cq);
diff --git a/test/core/bad_client/tests/connection_prefix.c b/test/core/bad_client/tests/connection_prefix.c
index 0bd86ecf55..ec85211605 100644
--- a/test/core/bad_client/tests/connection_prefix.c
+++ b/test/core/bad_client/tests/connection_prefix.c
@@ -36,9 +36,9 @@
static void verifier(grpc_server *server, grpc_completion_queue *cq) {
while (grpc_server_has_open_connections(server)) {
- GPR_ASSERT(
- grpc_completion_queue_next(cq, GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20))
- .type == GRPC_QUEUE_TIMEOUT);
+ GPR_ASSERT(grpc_completion_queue_next(
+ cq, GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20), NULL)
+ .type == GRPC_QUEUE_TIMEOUT);
}
}
diff --git a/test/core/bad_client/tests/initial_settings_frame.c b/test/core/bad_client/tests/initial_settings_frame.c
index 2075602e27..261fecdaf2 100644
--- a/test/core/bad_client/tests/initial_settings_frame.c
+++ b/test/core/bad_client/tests/initial_settings_frame.c
@@ -38,9 +38,9 @@
static void verifier(grpc_server *server, grpc_completion_queue *cq) {
while (grpc_server_has_open_connections(server)) {
- GPR_ASSERT(
- grpc_completion_queue_next(cq, GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20))
- .type == GRPC_QUEUE_TIMEOUT);
+ GPR_ASSERT(grpc_completion_queue_next(
+ cq, GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20), NULL)
+ .type == GRPC_QUEUE_TIMEOUT);
}
}
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/client_config/uri_parser_test.c b/test/core/client_config/uri_parser_test.c
index 3451ca1e8c..d324029c7e 100644
--- a/test/core/client_config/uri_parser_test.c
+++ b/test/core/client_config/uri_parser_test.c
@@ -60,7 +60,8 @@ int main(int argc, char **argv) {
test_succeeds("http://www.google.com:90", "http", "www.google.com:90", "");
test_succeeds("a192.4-df:foo.coom", "a192.4-df", "", "foo.coom");
test_succeeds("a+b:foo.coom", "a+b", "", "foo.coom");
- test_succeeds("zookeeper://127.0.0.1:2181/foo/bar", "zookeeper", "127.0.0.1:2181", "/foo/bar");
+ test_succeeds("zookeeper://127.0.0.1:2181/foo/bar", "zookeeper",
+ "127.0.0.1:2181", "/foo/bar");
test_fails("xyz");
test_fails("http://www.google.com?why-are-you-using-queries");
test_fails("dns:foo.com#fragments-arent-supported-here");
diff --git a/test/cpp/server/fixed_size_thread_pool_test.cc b/test/core/compression/compression_test.c
index 442e974fc1..4df0acae37 100644
--- a/test/cpp/server/fixed_size_thread_pool_test.cc
+++ b/test/core/compression/compression_test.c
@@ -31,47 +31,47 @@
*
*/
-#include <condition_variable>
-#include <functional>
-#include <mutex>
+#include <stdlib.h>
+#include <string.h>
-#include <grpc++/fixed_size_thread_pool.h>
-#include <gtest/gtest.h>
+#include <grpc/compression.h>
+#include <grpc/support/log.h>
+#include <grpc/support/useful.h>
-namespace grpc {
+#include "test/core/util/test_config.h"
-class FixedSizeThreadPoolTest : public ::testing::Test {
- public:
- FixedSizeThreadPoolTest() : thread_pool_(4) {}
+static void test_compression_algorithm_parse(void) {
+ size_t i;
+ const char* valid_names[] = {"identity", "gzip", "deflate"};
+ const grpc_compression_algorithm valid_algorithms[] = {
+ GRPC_COMPRESS_NONE, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_DEFLATE};
+ const char* invalid_names[] = {"gzip2", "foo", "", "2gzip"};
- protected:
- FixedSizeThreadPool thread_pool_;
-};
+ gpr_log(GPR_DEBUG, "test_compression_algorithm_parse");
-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);
+ for (i = 0; i < GPR_ARRAY_SIZE(valid_names); i++) {
+ const char* valid_name = valid_names[i];
+ grpc_compression_algorithm algorithm;
+ int success;
+ success = grpc_compression_algorithm_parse(valid_name, strlen(valid_name),
+ &algorithm);
+ GPR_ASSERT(success != 0);
+ GPR_ASSERT(algorithm == valid_algorithms[i]);
+ }
- // Wait for the callback to finish.
- std::unique_lock<std::mutex> lock(mu);
- while (!done) {
- cv.wait(lock);
+ for (i = 0; i < GPR_ARRAY_SIZE(invalid_names); i++) {
+ const char* invalid_name = invalid_names[i];
+ grpc_compression_algorithm algorithm;
+ int success;
+ success = grpc_compression_algorithm_parse(
+ invalid_name, strlen(invalid_name), &algorithm);
+ GPR_ASSERT(success == 0);
+ /* the value of "algorithm" is undefined upon failure */
}
}
-} // namespace grpc
-
int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- int result = RUN_ALL_TESTS();
- return result;
+ test_compression_algorithm_parse();
+
+ return 0;
}
diff --git a/test/core/compression/message_compress_test.c b/test/core/compression/message_compress_test.c
index f5f21cff25..495841c79f 100644
--- a/test/core/compression/message_compress_test.c
+++ b/test/core/compression/message_compress_test.c
@@ -69,8 +69,7 @@ static void assert_passthrough(gpr_slice value,
"algorithm='%s' uncompressed_split='%s' compressed_split='%s'",
GPR_SLICE_LENGTH(value), gpr_murmur_hash3(GPR_SLICE_START_PTR(value),
GPR_SLICE_LENGTH(value), 0),
- algorithm_name,
- grpc_slice_split_mode_name(uncompressed_split_mode),
+ algorithm_name, grpc_slice_split_mode_name(uncompressed_split_mode),
grpc_slice_split_mode_name(compressed_split_mode));
gpr_slice_buffer_init(&input);
diff --git a/test/core/end2end/cq_verifier.c b/test/core/end2end/cq_verifier.c
index c28932c52b..922de268f4 100644
--- a/test/core/end2end/cq_verifier.c
+++ b/test/core/end2end/cq_verifier.c
@@ -146,7 +146,7 @@ static int byte_buffer_eq_slice(grpc_byte_buffer *bb, gpr_slice b) {
int byte_buffer_eq_string(grpc_byte_buffer *bb, const char *str) {
grpc_byte_buffer_reader reader;
- grpc_byte_buffer* rbb;
+ grpc_byte_buffer *rbb;
int res;
grpc_byte_buffer_reader_init(&reader, bb);
@@ -226,7 +226,7 @@ void cq_verify(cq_verifier *v) {
gpr_strvec_init(&have_tags);
while (v->expect.next != &v->expect) {
- ev = grpc_completion_queue_next(v->cq, deadline);
+ ev = grpc_completion_queue_next(v->cq, deadline, NULL);
if (ev.type == GRPC_QUEUE_TIMEOUT) {
fail_no_event_received(v);
break;
@@ -265,7 +265,7 @@ void cq_verify_empty(cq_verifier *v) {
GPR_ASSERT(v->expect.next == &v->expect && "expectation queue must be empty");
- ev = grpc_completion_queue_next(v->cq, deadline);
+ ev = grpc_completion_queue_next(v->cq, deadline, NULL);
if (ev.type != GRPC_QUEUE_TIMEOUT) {
char *s = grpc_event_string(&ev);
gpr_log(GPR_ERROR, "unexpected event (expected nothing): %s", s);
diff --git a/test/core/end2end/cq_verifier.h b/test/core/end2end/cq_verifier.h
index 1ecd4db5da..b3e07c45a5 100644
--- a/test/core/end2end/cq_verifier.h
+++ b/test/core/end2end/cq_verifier.h
@@ -60,6 +60,7 @@ void cq_verify_empty(cq_verifier *v);
void cq_expect_completion(cq_verifier *v, void *tag, int success);
int byte_buffer_eq_string(grpc_byte_buffer *byte_buffer, const char *string);
-int contains_metadata(grpc_metadata_array *array, const char *key, const char *value);
+int contains_metadata(grpc_metadata_array *array, const char *key,
+ const char *value);
-#endif /* GRPC_TEST_CORE_END2END_CQ_VERIFIER_H */
+#endif /* GRPC_TEST_CORE_END2END_CQ_VERIFIER_H */
diff --git a/test/core/end2end/data/ssl_test_data.h b/test/core/end2end/data/ssl_test_data.h
index 4f4b30ef21..675249dbd5 100644
--- a/test/core/end2end/data/ssl_test_data.h
+++ b/test/core/end2end/data/ssl_test_data.h
@@ -38,4 +38,4 @@ extern const char test_root_cert[];
extern const char test_server1_cert[];
extern const char test_server1_key[];
-#endif /* GRPC_TEST_CORE_END2END_DATA_SSL_TEST_DATA_H */
+#endif /* GRPC_TEST_CORE_END2END_DATA_SSL_TEST_DATA_H */
diff --git a/test/core/end2end/dualstack_socket_test.c b/test/core/end2end/dualstack_socket_test.c
index 48a88be525..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"
@@ -53,10 +57,11 @@ static gpr_timespec ms_from_now(int ms) {
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
- ev = grpc_completion_queue_next(cq, ms_from_now(5000));
+ ev = grpc_completion_queue_next(cq, ms_from_now(5000), NULL);
} 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;
@@ -75,6 +80,7 @@ void test_connect(const char *server_host, const char *client_host, int port,
grpc_metadata_array trailing_metadata_recv;
grpc_metadata_array request_metadata_recv;
grpc_status_code status;
+ grpc_call_error error;
char *details = NULL;
size_t details_capacity = 0;
int was_cancelled = 2;
@@ -93,9 +99,9 @@ void test_connect(const char *server_host, const char *client_host, int port,
grpc_call_details_init(&call_details);
/* Create server. */
- cq = grpc_completion_queue_create();
- server = grpc_server_create(NULL);
- grpc_server_register_completion_queue(server, cq);
+ cq = grpc_completion_queue_create(NULL);
+ server = grpc_server_create(NULL, NULL);
+ grpc_server_register_completion_queue(server, cq, NULL);
GPR_ASSERT((got_port = grpc_server_add_insecure_http2_port(
server, server_hostport)) > 0);
if (port == 0) {
@@ -108,12 +114,34 @@ 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);
}
- client = grpc_insecure_channel_create(client_hostport, NULL);
+ client = grpc_insecure_channel_create(client_hostport, NULL, NULL);
gpr_log(GPR_INFO, "Testing with server=%s client=%s (expecting %s)",
server_hostport, client_hostport, expect_ok ? "success" : "failure");
@@ -132,20 +160,23 @@ void test_connect(const char *server_host, const char *client_host, int port,
/* Send a trivial request. */
c = grpc_channel_create_call(client, NULL, GRPC_PROPAGATE_DEFAULTS, cq,
- "/foo", "foo.test.google.fr", deadline);
+ "/foo", "foo.test.google.fr", deadline, NULL);
GPR_ASSERT(c);
op = ops;
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
@@ -153,14 +184,16 @@ void test_connect(const char *server_host, const char *client_host, int port,
op->data.recv_status_on_client.status_details = &details;
op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1)));
+ error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
if (expect_ok) {
/* Check for a successful request. */
- GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(
- server, &s, &call_details,
- &request_metadata_recv, cq, cq, tag(101)));
+ error = grpc_server_request_call(server, &s, &call_details,
+ &request_metadata_recv, cq, cq, tag(101));
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv);
@@ -179,8 +212,8 @@ void test_connect(const char *server_host, const char *client_host, int port,
op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0;
op++;
- GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_batch(s, ops, op - ops, tag(102)));
+ error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1);
cq_expect_completion(cqv, tag(1), 1);
@@ -214,8 +247,8 @@ void test_connect(const char *server_host, const char *client_host, int port,
/* Destroy server. */
grpc_server_shutdown_and_notify(server, cq, tag(1000));
- GPR_ASSERT(grpc_completion_queue_pluck(cq, tag(1000),
- GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5))
+ GPR_ASSERT(grpc_completion_queue_pluck(
+ cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(server);
grpc_completion_queue_shutdown(cq);
@@ -254,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 78b692a45d..a0a67939a2 100644
--- a/test/core/end2end/fixtures/chttp2_fake_security.c
+++ b/test/core/end2end/fixtures/chttp2_fake_security.c
@@ -60,7 +60,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack(
gpr_join_host_port(&ffd->localaddr, "localhost", port);
f.fixture_data = ffd;
- f.cq = grpc_completion_queue_create();
+ f.cq = grpc_completion_queue_create(NULL);
return f;
}
@@ -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,
@@ -89,8 +89,8 @@ static void chttp2_init_server_secure_fullstack(
if (f->server) {
grpc_server_destroy(f->server);
}
- f->server = grpc_server_create(server_args);
- grpc_server_register_completion_queue(f->server, f->cq);
+ f->server = grpc_server_create(server_args, NULL);
+ grpc_server_register_completion_queue(f->server, f->cq, NULL);
GPR_ASSERT(grpc_server_add_secure_http2_port(f->server, ffd->localaddr,
server_creds));
grpc_server_credentials_release(server_creds);
diff --git a/test/core/end2end/fixtures/chttp2_fullstack.c b/test/core/end2end/fixtures/chttp2_fullstack.c
index 53a6f0d7a5..0170dcf0e5 100644
--- a/test/core/end2end/fixtures/chttp2_fullstack.c
+++ b/test/core/end2end/fixtures/chttp2_fullstack.c
@@ -64,7 +64,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
gpr_join_host_port(&ffd->localaddr, "localhost", port);
f.fixture_data = ffd;
- f.cq = grpc_completion_queue_create();
+ f.cq = grpc_completion_queue_create(NULL);
return f;
}
@@ -72,7 +72,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f,
grpc_channel_args *client_args) {
fullstack_fixture_data *ffd = f->fixture_data;
- f->client = grpc_insecure_channel_create(ffd->localaddr, client_args);
+ f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, NULL);
GPR_ASSERT(f->client);
}
@@ -82,8 +82,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f,
if (f->server) {
grpc_server_destroy(f->server);
}
- f->server = grpc_server_create(server_args);
- grpc_server_register_completion_queue(f->server, f->cq);
+ f->server = grpc_server_create(server_args, NULL);
+ grpc_server_register_completion_queue(f->server, f->cq, NULL);
GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->localaddr));
grpc_server_start(f->server);
}
diff --git a/test/core/end2end/fixtures/chttp2_fullstack_compression.c b/test/core/end2end/fixtures/chttp2_fullstack_compression.c
index a75075d1d4..6e7a1faf55 100644
--- a/test/core/end2end/fixtures/chttp2_fullstack_compression.c
+++ b/test/core/end2end/fixtures/chttp2_fullstack_compression.c
@@ -69,7 +69,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack_compression(
memset(&f, 0, sizeof(f));
f.fixture_data = ffd;
- f.cq = grpc_completion_queue_create();
+ f.cq = grpc_completion_queue_create(NULL);
return f;
}
@@ -83,7 +83,7 @@ void chttp2_init_client_fullstack_compression(grpc_end2end_test_fixture *f,
ffd->client_args_compression = grpc_channel_args_set_compression_algorithm(
client_args, GRPC_COMPRESS_GZIP);
f->client = grpc_insecure_channel_create(ffd->localaddr,
- ffd->client_args_compression);
+ ffd->client_args_compression, NULL);
}
void chttp2_init_server_fullstack_compression(grpc_end2end_test_fixture *f,
@@ -97,8 +97,8 @@ void chttp2_init_server_fullstack_compression(grpc_end2end_test_fixture *f,
if (f->server) {
grpc_server_destroy(f->server);
}
- f->server = grpc_server_create(ffd->server_args_compression);
- grpc_server_register_completion_queue(f->server, f->cq);
+ f->server = grpc_server_create(ffd->server_args_compression, NULL);
+ grpc_server_register_completion_queue(f->server, f->cq, NULL);
GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->localaddr));
grpc_server_start(f->server);
}
diff --git a/test/core/end2end/fixtures/chttp2_fullstack_uds_posix.c b/test/core/end2end/fixtures/chttp2_fullstack_uds_posix.c
index 20afdb868e..59d39bbb0f 100644
--- a/test/core/end2end/fixtures/chttp2_fullstack_uds_posix.c
+++ b/test/core/end2end/fixtures/chttp2_fullstack_uds_posix.c
@@ -70,7 +70,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
unique++);
f.fixture_data = ffd;
- f.cq = grpc_completion_queue_create();
+ f.cq = grpc_completion_queue_create(NULL);
return f;
}
@@ -78,7 +78,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f,
grpc_channel_args *client_args) {
fullstack_fixture_data *ffd = f->fixture_data;
- f->client = grpc_insecure_channel_create(ffd->localaddr, client_args);
+ f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, NULL);
}
void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f,
@@ -87,8 +87,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f,
if (f->server) {
grpc_server_destroy(f->server);
}
- f->server = grpc_server_create(server_args);
- grpc_server_register_completion_queue(f->server, f->cq);
+ f->server = grpc_server_create(server_args, NULL);
+ grpc_server_register_completion_queue(f->server, f->cq, NULL);
GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->localaddr));
grpc_server_start(f->server);
}
diff --git a/test/core/end2end/fixtures/chttp2_fullstack_uds_posix_with_poll.c b/test/core/end2end/fixtures/chttp2_fullstack_uds_posix_with_poll.c
index 8491ea6970..05b9ea0949 100644
--- a/test/core/end2end/fixtures/chttp2_fullstack_uds_posix_with_poll.c
+++ b/test/core/end2end/fixtures/chttp2_fullstack_uds_posix_with_poll.c
@@ -70,7 +70,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
unique++);
f.fixture_data = ffd;
- f.cq = grpc_completion_queue_create();
+ f.cq = grpc_completion_queue_create(NULL);
return f;
}
@@ -78,7 +78,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f,
grpc_channel_args *client_args) {
fullstack_fixture_data *ffd = f->fixture_data;
- f->client = grpc_insecure_channel_create(ffd->localaddr, client_args);
+ f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, NULL);
}
void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f,
@@ -87,8 +87,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f,
if (f->server) {
grpc_server_destroy(f->server);
}
- f->server = grpc_server_create(server_args);
- grpc_server_register_completion_queue(f->server, f->cq);
+ f->server = grpc_server_create(server_args, NULL);
+ grpc_server_register_completion_queue(f->server, f->cq, NULL);
GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->localaddr));
grpc_server_start(f->server);
}
diff --git a/test/core/end2end/fixtures/chttp2_fullstack_with_poll.c b/test/core/end2end/fixtures/chttp2_fullstack_with_poll.c
index 2a4835add1..48feefc931 100644
--- a/test/core/end2end/fixtures/chttp2_fullstack_with_poll.c
+++ b/test/core/end2end/fixtures/chttp2_fullstack_with_poll.c
@@ -64,7 +64,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
gpr_join_host_port(&ffd->localaddr, "localhost", port);
f.fixture_data = ffd;
- f.cq = grpc_completion_queue_create();
+ f.cq = grpc_completion_queue_create(NULL);
return f;
}
@@ -72,7 +72,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f,
grpc_channel_args *client_args) {
fullstack_fixture_data *ffd = f->fixture_data;
- f->client = grpc_insecure_channel_create(ffd->localaddr, client_args);
+ f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, NULL);
}
void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f,
@@ -81,8 +81,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f,
if (f->server) {
grpc_server_destroy(f->server);
}
- f->server = grpc_server_create(server_args);
- grpc_server_register_completion_queue(f->server, f->cq);
+ f->server = grpc_server_create(server_args, NULL);
+ grpc_server_register_completion_queue(f->server, f->cq, NULL);
GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->localaddr));
grpc_server_start(f->server);
}
diff --git a/test/core/end2end/fixtures/chttp2_fullstack_with_proxy.c b/test/core/end2end/fixtures/chttp2_fullstack_with_proxy.c
index 248cc7d6e7..44083e2676 100644
--- a/test/core/end2end/fixtures/chttp2_fullstack_with_proxy.c
+++ b/test/core/end2end/fixtures/chttp2_fullstack_with_proxy.c
@@ -56,13 +56,13 @@ typedef struct fullstack_fixture_data {
} fullstack_fixture_data;
static grpc_server *create_proxy_server(const char *port) {
- grpc_server *s = grpc_server_create(NULL);
+ grpc_server *s = grpc_server_create(NULL, NULL);
GPR_ASSERT(grpc_server_add_insecure_http2_port(s, port));
return s;
}
static grpc_channel *create_proxy_client(const char *target) {
- return grpc_insecure_channel_create(target, NULL);
+ return grpc_insecure_channel_create(target, NULL, NULL);
}
static const grpc_end2end_proxy_def proxy_def = {create_proxy_server,
@@ -77,7 +77,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
ffd->proxy = grpc_end2end_proxy_create(&proxy_def);
f.fixture_data = ffd;
- f.cq = grpc_completion_queue_create();
+ f.cq = grpc_completion_queue_create(NULL);
return f;
}
@@ -86,7 +86,7 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f,
grpc_channel_args *client_args) {
fullstack_fixture_data *ffd = f->fixture_data;
f->client = grpc_insecure_channel_create(
- grpc_end2end_proxy_get_client_target(ffd->proxy), client_args);
+ grpc_end2end_proxy_get_client_target(ffd->proxy), client_args, NULL);
GPR_ASSERT(f->client);
}
@@ -96,8 +96,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f,
if (f->server) {
grpc_server_destroy(f->server);
}
- f->server = grpc_server_create(server_args);
- grpc_server_register_completion_queue(f->server, f->cq);
+ f->server = grpc_server_create(server_args, NULL);
+ grpc_server_register_completion_queue(f->server, f->cq, NULL);
GPR_ASSERT(grpc_server_add_insecure_http2_port(
f->server, grpc_end2end_proxy_get_server_port(ffd->proxy)));
grpc_server_start(f->server);
diff --git a/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack.c b/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack.c
index 9850aac69b..beae24136c 100644
--- a/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack.c
+++ b/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack.c
@@ -63,7 +63,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack(
gpr_join_host_port(&ffd->localaddr, "localhost", port);
f.fixture_data = ffd;
- f.cq = grpc_completion_queue_create();
+ f.cq = grpc_completion_queue_create(NULL);
return f;
}
@@ -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,
@@ -92,8 +92,8 @@ static void chttp2_init_server_secure_fullstack(
if (f->server) {
grpc_server_destroy(f->server);
}
- f->server = grpc_server_create(server_args);
- grpc_server_register_completion_queue(f->server, f->cq);
+ f->server = grpc_server_create(server_args, NULL);
+ grpc_server_register_completion_queue(f->server, f->cq, NULL);
GPR_ASSERT(grpc_server_add_secure_http2_port(f->server, ffd->localaddr,
server_creds));
grpc_server_credentials_release(server_creds);
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 3df2acd296..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
@@ -63,7 +63,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack(
gpr_join_host_port(&ffd->localaddr, "localhost", port);
f.fixture_data = ffd;
- f.cq = grpc_completion_queue_create();
+ f.cq = grpc_completion_queue_create(NULL);
return f;
}
@@ -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,
@@ -92,8 +92,8 @@ static void chttp2_init_server_secure_fullstack(
if (f->server) {
grpc_server_destroy(f->server);
}
- f->server = grpc_server_create(server_args);
- grpc_server_register_completion_queue(f->server, f->cq);
+ f->server = grpc_server_create(server_args, NULL);
+ grpc_server_register_completion_queue(f->server, f->cq, NULL);
GPR_ASSERT(grpc_server_add_secure_http2_port(f->server, ffd->localaddr,
server_creds));
grpc_server_credentials_release(server_creds);
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 4d77039cac..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
@@ -54,7 +54,7 @@ typedef struct fullstack_secure_fixture_data {
} fullstack_secure_fixture_data;
static grpc_server *create_proxy_server(const char *port) {
- grpc_server *s = grpc_server_create(NULL);
+ grpc_server *s = grpc_server_create(NULL, NULL);
grpc_ssl_pem_key_cert_pair pem_cert_key_pair = {test_server1_key,
test_server1_cert};
grpc_server_credentials *ssl_creds =
@@ -91,7 +91,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack(
ffd->proxy = grpc_end2end_proxy_create(&proxy_def);
f.fixture_data = ffd;
- f.cq = grpc_completion_queue_create();
+ f.cq = grpc_completion_queue_create(NULL);
return f;
}
@@ -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,
@@ -121,8 +121,8 @@ static void chttp2_init_server_secure_fullstack(
if (f->server) {
grpc_server_destroy(f->server);
}
- f->server = grpc_server_create(server_args);
- grpc_server_register_completion_queue(f->server, f->cq);
+ f->server = grpc_server_create(server_args, NULL);
+ grpc_server_register_completion_queue(f->server, f->cq, NULL);
GPR_ASSERT(grpc_server_add_secure_http2_port(
f->server, grpc_end2end_proxy_get_server_port(ffd->proxy), server_creds));
grpc_server_credentials_release(server_creds);
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 284d5f07ae..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
@@ -55,8 +55,7 @@ typedef struct fullstack_secure_fixture_data {
} fullstack_secure_fixture_data;
static const grpc_metadata *find_metadata(const grpc_metadata *md,
- size_t md_count,
- const char *key,
+ size_t md_count, const char *key,
const char *value) {
size_t i;
for (i = 0; i < md_count; i++) {
@@ -80,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,
@@ -91,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(
@@ -105,7 +104,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack(
gpr_join_host_port(&ffd->localaddr, "localhost", port);
f.fixture_data = ffd;
- f.cq = grpc_completion_queue_create();
+ f.cq = grpc_completion_queue_create(NULL);
return f;
}
@@ -126,8 +125,8 @@ static void chttp2_init_server_secure_fullstack(
if (f->server) {
grpc_server_destroy(f->server);
}
- f->server = grpc_server_create(server_args);
- grpc_server_register_completion_queue(f->server, f->cq);
+ f->server = grpc_server_create(server_args, NULL);
+ grpc_server_register_completion_queue(f->server, f->cq, NULL);
GPR_ASSERT(grpc_server_add_secure_http2_port(f->server, ffd->localaddr,
server_creds));
grpc_server_credentials_release(server_creds);
diff --git a/test/core/end2end/fixtures/chttp2_socket_pair.c b/test/core/end2end/fixtures/chttp2_socket_pair.c
index 807fc8e7bc..16a04fbebf 100644
--- a/test/core/end2end/fixtures/chttp2_socket_pair.c
+++ b/test/core/end2end/fixtures/chttp2_socket_pair.c
@@ -95,7 +95,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
grpc_end2end_test_fixture f;
memset(&f, 0, sizeof(f));
f.fixture_data = sfd;
- f.cq = grpc_completion_queue_create();
+ f.cq = grpc_completion_queue_create(NULL);
*sfd = grpc_iomgr_create_endpoint_pair("fixture", 65536);
@@ -123,7 +123,7 @@ static void chttp2_init_server_socketpair(grpc_end2end_test_fixture *f,
grpc_transport *transport;
GPR_ASSERT(!f->server);
f->server = grpc_server_create_from_filters(NULL, 0, server_args);
- grpc_server_register_completion_queue(f->server, f->cq);
+ grpc_server_register_completion_queue(f->server, f->cq, NULL);
grpc_server_start(f->server);
transport = grpc_create_chttp2_transport(server_args, sfd->server, mdctx, 0);
server_setup_transport(f, transport, mdctx);
diff --git a/test/core/end2end/fixtures/chttp2_socket_pair_one_byte_at_a_time.c b/test/core/end2end/fixtures/chttp2_socket_pair_one_byte_at_a_time.c
index 21d4404237..94fc36f5ec 100644
--- a/test/core/end2end/fixtures/chttp2_socket_pair_one_byte_at_a_time.c
+++ b/test/core/end2end/fixtures/chttp2_socket_pair_one_byte_at_a_time.c
@@ -95,7 +95,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
grpc_end2end_test_fixture f;
memset(&f, 0, sizeof(f));
f.fixture_data = sfd;
- f.cq = grpc_completion_queue_create();
+ f.cq = grpc_completion_queue_create(NULL);
*sfd = grpc_iomgr_create_endpoint_pair("fixture", 1);
@@ -123,7 +123,7 @@ static void chttp2_init_server_socketpair(grpc_end2end_test_fixture *f,
grpc_transport *transport;
GPR_ASSERT(!f->server);
f->server = grpc_server_create_from_filters(NULL, 0, server_args);
- grpc_server_register_completion_queue(f->server, f->cq);
+ grpc_server_register_completion_queue(f->server, f->cq, NULL);
grpc_server_start(f->server);
transport = grpc_create_chttp2_transport(server_args, sfd->server, mdctx, 0);
server_setup_transport(f, transport, mdctx);
diff --git a/test/core/end2end/fixtures/chttp2_socket_pair_with_grpc_trace.c b/test/core/end2end/fixtures/chttp2_socket_pair_with_grpc_trace.c
index 9d798ad1d2..588c4b23e1 100644
--- a/test/core/end2end/fixtures/chttp2_socket_pair_with_grpc_trace.c
+++ b/test/core/end2end/fixtures/chttp2_socket_pair_with_grpc_trace.c
@@ -96,7 +96,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
grpc_end2end_test_fixture f;
memset(&f, 0, sizeof(f));
f.fixture_data = sfd;
- f.cq = grpc_completion_queue_create();
+ f.cq = grpc_completion_queue_create(NULL);
*sfd = grpc_iomgr_create_endpoint_pair("fixture", 65536);
@@ -124,7 +124,7 @@ static void chttp2_init_server_socketpair(grpc_end2end_test_fixture *f,
grpc_transport *transport;
GPR_ASSERT(!f->server);
f->server = grpc_server_create_from_filters(NULL, 0, server_args);
- grpc_server_register_completion_queue(f->server, f->cq);
+ grpc_server_register_completion_queue(f->server, f->cq, NULL);
grpc_server_start(f->server);
transport = grpc_create_chttp2_transport(server_args, sfd->server, mdctx, 0);
server_setup_transport(f, transport, mdctx);
diff --git a/test/core/end2end/fixtures/proxy.c b/test/core/end2end/fixtures/proxy.c
index e4f6263334..0090cf42f2 100644
--- a/test/core/end2end/fixtures/proxy.c
+++ b/test/core/end2end/fixtures/proxy.c
@@ -100,11 +100,11 @@ grpc_end2end_proxy *grpc_end2end_proxy_create(
gpr_join_host_port(&proxy->proxy_port, "localhost", proxy_port);
gpr_join_host_port(&proxy->server_port, "localhost", server_port);
- proxy->cq = grpc_completion_queue_create();
+ proxy->cq = grpc_completion_queue_create(NULL);
proxy->server = def->create_server(proxy->proxy_port);
proxy->client = def->create_client(proxy->server_port);
- grpc_server_register_completion_queue(proxy->server, proxy->cq);
+ grpc_server_register_completion_queue(proxy->server, proxy->cq, NULL);
grpc_server_start(proxy->server);
gpr_thd_options_set_joinable(&opt);
@@ -174,11 +174,12 @@ static void on_p2s_recv_initial_metadata(void *arg, int success) {
if (!pc->proxy->shutdown) {
op.op = GRPC_OP_SEND_INITIAL_METADATA;
op.flags = 0;
+ op.reserved = NULL;
op.data.send_initial_metadata.count = pc->p2s_initial_metadata.count;
op.data.send_initial_metadata.metadata = pc->p2s_initial_metadata.metadata;
refpc(pc, "on_c2p_sent_initial_metadata");
- err = grpc_call_start_batch(pc->c2p, &op, 1,
- new_closure(on_c2p_sent_initial_metadata, pc));
+ err = grpc_call_start_batch(
+ pc->c2p, &op, 1, new_closure(on_c2p_sent_initial_metadata, pc), NULL);
GPR_ASSERT(err == GRPC_CALL_OK);
}
@@ -201,10 +202,11 @@ static void on_p2s_sent_message(void *arg, int success) {
if (!pc->proxy->shutdown && success) {
op.op = GRPC_OP_RECV_MESSAGE;
op.flags = 0;
+ op.reserved = NULL;
op.data.recv_message = &pc->c2p_msg;
refpc(pc, "on_c2p_recv_msg");
err = grpc_call_start_batch(pc->c2p, &op, 1,
- new_closure(on_c2p_recv_msg, pc));
+ new_closure(on_c2p_recv_msg, pc), NULL);
GPR_ASSERT(err == GRPC_CALL_OK);
}
@@ -225,17 +227,19 @@ static void on_c2p_recv_msg(void *arg, int success) {
if (pc->c2p_msg != NULL) {
op.op = GRPC_OP_SEND_MESSAGE;
op.flags = 0;
+ op.reserved = NULL;
op.data.send_message = pc->c2p_msg;
refpc(pc, "on_p2s_sent_message");
err = grpc_call_start_batch(pc->p2s, &op, 1,
- new_closure(on_p2s_sent_message, pc));
+ new_closure(on_p2s_sent_message, pc), NULL);
GPR_ASSERT(err == GRPC_CALL_OK);
} else {
op.op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op.flags = 0;
+ op.reserved = NULL;
refpc(pc, "on_p2s_sent_close");
err = grpc_call_start_batch(pc->p2s, &op, 1,
- new_closure(on_p2s_sent_close, pc));
+ new_closure(on_p2s_sent_close, pc), NULL);
GPR_ASSERT(err == GRPC_CALL_OK);
}
}
@@ -254,10 +258,11 @@ static void on_c2p_sent_message(void *arg, int success) {
if (!pc->proxy->shutdown && success) {
op.op = GRPC_OP_RECV_MESSAGE;
op.flags = 0;
+ op.reserved = NULL;
op.data.recv_message = &pc->p2s_msg;
refpc(pc, "on_p2s_recv_msg");
err = grpc_call_start_batch(pc->p2s, &op, 1,
- new_closure(on_p2s_recv_msg, pc));
+ new_closure(on_p2s_recv_msg, pc), NULL);
GPR_ASSERT(err == GRPC_CALL_OK);
}
@@ -272,10 +277,11 @@ static void on_p2s_recv_msg(void *arg, int success) {
if (!pc->proxy->shutdown && success && pc->p2s_msg) {
op.op = GRPC_OP_SEND_MESSAGE;
op.flags = 0;
+ op.reserved = NULL;
op.data.send_message = pc->p2s_msg;
refpc(pc, "on_c2p_sent_message");
err = grpc_call_start_batch(pc->c2p, &op, 1,
- new_closure(on_c2p_sent_message, pc));
+ new_closure(on_c2p_sent_message, pc), NULL);
GPR_ASSERT(err == GRPC_CALL_OK);
}
unrefpc(pc, "on_p2s_recv_msg");
@@ -295,6 +301,7 @@ static void on_p2s_status(void *arg, int success) {
GPR_ASSERT(success);
op.op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op.flags = 0;
+ op.reserved = NULL;
op.data.send_status_from_server.trailing_metadata_count =
pc->p2s_trailing_metadata.count;
op.data.send_status_from_server.trailing_metadata =
@@ -303,7 +310,7 @@ static void on_p2s_status(void *arg, int success) {
op.data.send_status_from_server.status_details = pc->p2s_status_details;
refpc(pc, "on_c2p_sent_status");
err = grpc_call_start_batch(pc->c2p, &op, 1,
- new_closure(on_c2p_sent_status, pc));
+ new_closure(on_c2p_sent_status, pc), NULL);
GPR_ASSERT(err == GRPC_CALL_OK);
}
@@ -330,38 +337,39 @@ static void on_new_call(void *arg, int success) {
pc->p2s = grpc_channel_create_call(
proxy->client, pc->c2p, GRPC_PROPAGATE_DEFAULTS, proxy->cq,
proxy->new_call_details.method, proxy->new_call_details.host,
- proxy->new_call_details.deadline);
+ proxy->new_call_details.deadline, NULL);
gpr_ref_init(&pc->refs, 1);
op.flags = 0;
+ op.reserved = NULL;
op.op = GRPC_OP_RECV_INITIAL_METADATA;
op.data.recv_initial_metadata = &pc->p2s_initial_metadata;
refpc(pc, "on_p2s_recv_initial_metadata");
- err = grpc_call_start_batch(pc->p2s, &op, 1,
- new_closure(on_p2s_recv_initial_metadata, pc));
+ err = grpc_call_start_batch(
+ pc->p2s, &op, 1, new_closure(on_p2s_recv_initial_metadata, pc), NULL);
GPR_ASSERT(err == GRPC_CALL_OK);
op.op = GRPC_OP_SEND_INITIAL_METADATA;
op.data.send_initial_metadata.count = pc->c2p_initial_metadata.count;
op.data.send_initial_metadata.metadata = pc->c2p_initial_metadata.metadata;
refpc(pc, "on_p2s_sent_initial_metadata");
- err = grpc_call_start_batch(pc->p2s, &op, 1,
- new_closure(on_p2s_sent_initial_metadata, pc));
+ err = grpc_call_start_batch(
+ pc->p2s, &op, 1, new_closure(on_p2s_sent_initial_metadata, pc), NULL);
GPR_ASSERT(err == GRPC_CALL_OK);
op.op = GRPC_OP_RECV_MESSAGE;
op.data.recv_message = &pc->c2p_msg;
refpc(pc, "on_c2p_recv_msg");
err = grpc_call_start_batch(pc->c2p, &op, 1,
- new_closure(on_c2p_recv_msg, pc));
+ new_closure(on_c2p_recv_msg, pc), NULL);
GPR_ASSERT(err == GRPC_CALL_OK);
op.op = GRPC_OP_RECV_MESSAGE;
op.data.recv_message = &pc->p2s_msg;
refpc(pc, "on_p2s_recv_msg");
err = grpc_call_start_batch(pc->p2s, &op, 1,
- new_closure(on_p2s_recv_msg, pc));
+ new_closure(on_p2s_recv_msg, pc), NULL);
GPR_ASSERT(err == GRPC_CALL_OK);
op.op = GRPC_OP_RECV_STATUS_ON_CLIENT;
@@ -372,15 +380,15 @@ static void on_new_call(void *arg, int success) {
op.data.recv_status_on_client.status_details_capacity =
&pc->p2s_status_details_capacity;
refpc(pc, "on_p2s_status");
- err =
- grpc_call_start_batch(pc->p2s, &op, 1, new_closure(on_p2s_status, pc));
+ err = grpc_call_start_batch(pc->p2s, &op, 1, new_closure(on_p2s_status, pc),
+ NULL);
GPR_ASSERT(err == GRPC_CALL_OK);
op.op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op.data.recv_close_on_server.cancelled = &pc->c2p_server_cancelled;
refpc(pc, "on_c2p_closed");
- err =
- grpc_call_start_batch(pc->c2p, &op, 1, new_closure(on_c2p_closed, pc));
+ err = grpc_call_start_batch(pc->c2p, &op, 1, new_closure(on_c2p_closed, pc),
+ NULL);
GPR_ASSERT(err == GRPC_CALL_OK);
request_call(proxy);
@@ -405,7 +413,7 @@ static void thread_main(void *arg) {
closure *cl;
for (;;) {
grpc_event ev = grpc_completion_queue_next(
- proxy->cq, gpr_inf_future(GPR_CLOCK_MONOTONIC));
+ proxy->cq, gpr_inf_future(GPR_CLOCK_MONOTONIC), NULL);
switch (ev.type) {
case GRPC_QUEUE_TIMEOUT:
gpr_log(GPR_ERROR, "Should never reach here");
diff --git a/test/core/end2end/multiple_server_queues_test.c b/test/core/end2end/multiple_server_queues_test.c
index 7772d14ba5..5e2eaf4ae9 100644
--- a/test/core/end2end/multiple_server_queues_test.c
+++ b/test/core/end2end/multiple_server_queues_test.c
@@ -41,20 +41,20 @@ int main(int argc, char **argv) {
grpc_test_init(argc, argv);
grpc_init();
- cq1 = grpc_completion_queue_create();
- cq2 = grpc_completion_queue_create();
- server = grpc_server_create(NULL);
- grpc_server_register_completion_queue(server, cq1);
+ cq1 = grpc_completion_queue_create(NULL);
+ cq2 = grpc_completion_queue_create(NULL);
+ server = grpc_server_create(NULL, NULL);
+ grpc_server_register_completion_queue(server, cq1, NULL);
grpc_server_add_insecure_http2_port(server, "[::]:0");
- grpc_server_register_completion_queue(server, cq2);
+ grpc_server_register_completion_queue(server, cq2, NULL);
grpc_server_start(server);
grpc_server_shutdown_and_notify(server, cq2, NULL);
- grpc_completion_queue_next(
- cq2, gpr_inf_future(GPR_CLOCK_REALTIME)); /* cue queue hang */
+ grpc_completion_queue_next(cq2, gpr_inf_future(GPR_CLOCK_REALTIME),
+ NULL); /* cue queue hang */
grpc_completion_queue_shutdown(cq1);
grpc_completion_queue_shutdown(cq2);
- grpc_completion_queue_next(cq1, gpr_inf_future(GPR_CLOCK_REALTIME));
- grpc_completion_queue_next(cq2, gpr_inf_future(GPR_CLOCK_REALTIME));
+ grpc_completion_queue_next(cq1, gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
+ grpc_completion_queue_next(cq2, gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
grpc_server_destroy(server);
grpc_completion_queue_destroy(cq1);
grpc_completion_queue_destroy(cq2);
diff --git a/test/core/end2end/no_server_test.c b/test/core/end2end/no_server_test.c
index 6a5e12325d..619627ddd2 100644
--- a/test/core/end2end/no_server_test.c
+++ b/test/core/end2end/no_server_test.c
@@ -57,18 +57,19 @@ int main(int argc, char **argv) {
grpc_metadata_array_init(&trailing_metadata_recv);
- cq = grpc_completion_queue_create();
+ cq = grpc_completion_queue_create(NULL);
cqv = cq_verifier_create(cq);
/* create a call, channel to a non existant server */
- chan = grpc_insecure_channel_create("nonexistant:54321", NULL);
+ chan = grpc_insecure_channel_create("nonexistant:54321", NULL, NULL);
call = grpc_channel_create_call(chan, NULL, GRPC_PROPAGATE_DEFAULTS, cq,
- "/Foo", "nonexistant", deadline);
+ "/Foo", "nonexistant", deadline, NULL);
op = ops;
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
@@ -76,9 +77,10 @@ int main(int argc, char **argv) {
op->data.recv_status_on_client.status_details = &details;
op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0;
+ op->reserved = NULL;
op++;
GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_batch(call, ops, op - ops, tag(1)));
+ grpc_call_start_batch(call, ops, op - ops, tag(1), NULL));
/* verify that all tags get completed */
cq_expect_completion(cqv, tag(1), 1);
cq_verify(cqv);
@@ -86,8 +88,9 @@ int main(int argc, char **argv) {
GPR_ASSERT(status == GRPC_STATUS_DEADLINE_EXCEEDED);
grpc_completion_queue_shutdown(cq);
- while (grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME))
- .type != GRPC_QUEUE_SHUTDOWN)
+ while (
+ grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL)
+ .type != GRPC_QUEUE_SHUTDOWN)
;
grpc_completion_queue_destroy(cq);
grpc_call_destroy(call);
diff --git a/test/core/end2end/tests/bad_hostname.c b/test/core/end2end/tests/bad_hostname.c
index 501db89b7b..8f28fa1e63 100644
--- a/test/core/end2end/tests/bad_hostname.c
+++ b/test/core/end2end/tests/bad_hostname.c
@@ -70,15 +70,15 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
- ev = grpc_completion_queue_next(cq, five_seconds_time());
+ ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
- GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
- GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5))
+ GPR_ASSERT(grpc_completion_queue_pluck(
+ f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -110,11 +110,12 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
grpc_metadata_array request_metadata_recv;
grpc_call_details call_details;
grpc_status_code status;
+ grpc_call_error error;
char *details = NULL;
size_t details_capacity = 0;
c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
- "/foo", "slartibartfast.local", deadline);
+ "/foo", "slartibartfast.local", deadline, NULL);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -126,13 +127,16 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
@@ -140,8 +144,10 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
op->data.recv_status_on_client.status_details = &details;
op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1)));
+ error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(1), 1);
cq_verify(cqv);
diff --git a/test/core/end2end/tests/cancel_after_accept.c b/test/core/end2end/tests/cancel_after_accept.c
index 2e166b8412..313e0b05bd 100644
--- a/test/core/end2end/tests/cancel_after_accept.c
+++ b/test/core/end2end/tests/cancel_after_accept.c
@@ -69,15 +69,15 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
- ev = grpc_completion_queue_next(cq, five_seconds_time());
+ ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
- GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
- GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5))
+ GPR_ASSERT(grpc_completion_queue_pluck(
+ f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -114,6 +114,7 @@ static void test_cancel_after_accept(grpc_end2end_test_config config,
grpc_metadata_array request_metadata_recv;
grpc_call_details call_details;
grpc_status_code status;
+ grpc_call_error error;
char *details = NULL;
size_t details_capacity = 0;
grpc_byte_buffer *request_payload_recv = NULL;
@@ -127,7 +128,7 @@ static void test_cancel_after_accept(grpc_end2end_test_config config,
int was_cancelled = 2;
c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
- "/foo", "foo.test.google.fr", deadline);
+ "/foo", "foo.test.google.fr", deadline, NULL);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -142,28 +143,34 @@ static void test_cancel_after_accept(grpc_end2end_test_config config,
op->data.recv_status_on_client.status_details = &details;
op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message = request_payload;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message = &response_payload_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1)));
+ error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
- GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(
- f.server, &s, &call_details,
- &request_metadata_recv, f.cq, f.cq, tag(2)));
+ error = grpc_server_request_call(f.server, &s, &call_details,
+ &request_metadata_recv, f.cq, f.cq, tag(2));
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(2), 1);
cq_verify(cqv);
@@ -171,22 +178,27 @@ static void test_cancel_after_accept(grpc_end2end_test_config config,
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message = &request_payload_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message = response_payload;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(3)));
+ error = grpc_call_start_batch(s, ops, op - ops, tag(3), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
- GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c));
+ GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c, NULL));
cq_expect_completion(cqv, tag(3), 1);
cq_expect_completion(cqv, tag(1), 1);
diff --git a/test/core/end2end/tests/cancel_after_accept_and_writes_closed.c b/test/core/end2end/tests/cancel_after_accept_and_writes_closed.c
index 171c1874cc..2430a6d218 100644
--- a/test/core/end2end/tests/cancel_after_accept_and_writes_closed.c
+++ b/test/core/end2end/tests/cancel_after_accept_and_writes_closed.c
@@ -69,15 +69,15 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
- ev = grpc_completion_queue_next(cq, five_seconds_time());
+ ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
- GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
- GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5))
+ GPR_ASSERT(grpc_completion_queue_pluck(
+ f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -114,6 +114,7 @@ static void test_cancel_after_accept_and_writes_closed(
grpc_metadata_array request_metadata_recv;
grpc_call_details call_details;
grpc_status_code status;
+ grpc_call_error error;
char *details = NULL;
size_t details_capacity = 0;
grpc_byte_buffer *request_payload_recv = NULL;
@@ -127,7 +128,7 @@ static void test_cancel_after_accept_and_writes_closed(
int was_cancelled = 2;
c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
- "/foo", "foo.test.google.fr", deadline);
+ "/foo", "foo.test.google.fr", deadline, NULL);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -142,31 +143,38 @@ static void test_cancel_after_accept_and_writes_closed(
op->data.recv_status_on_client.status_details = &details;
op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message = request_payload;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message = &response_payload_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1)));
+ error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
- GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(
- f.server, &s, &call_details,
- &request_metadata_recv, f.cq, f.cq, tag(2)));
+ error = grpc_server_request_call(f.server, &s, &call_details,
+ &request_metadata_recv, f.cq, f.cq, tag(2));
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(2), 1);
cq_verify(cqv);
@@ -174,22 +182,27 @@ static void test_cancel_after_accept_and_writes_closed(
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message = &request_payload_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message = response_payload;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(3)));
+ error = grpc_call_start_batch(s, ops, op - ops, tag(3), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
- GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c));
+ GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c, NULL));
cq_expect_completion(cqv, tag(3), 1);
cq_expect_completion(cqv, tag(1), 1);
diff --git a/test/core/end2end/tests/cancel_after_invoke.c b/test/core/end2end/tests/cancel_after_invoke.c
index 186cd44a43..9991ee02f0 100644
--- a/test/core/end2end/tests/cancel_after_invoke.c
+++ b/test/core/end2end/tests/cancel_after_invoke.c
@@ -70,15 +70,15 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
- ev = grpc_completion_queue_next(cq, five_seconds_time());
+ ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
- GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
- GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5))
+ GPR_ASSERT(grpc_completion_queue_pluck(
+ f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -114,6 +114,7 @@ static void test_cancel_after_invoke(grpc_end2end_test_config config,
grpc_metadata_array request_metadata_recv;
grpc_call_details call_details;
grpc_status_code status;
+ grpc_call_error error;
char *details = NULL;
size_t details_capacity = 0;
grpc_byte_buffer *response_payload_recv = NULL;
@@ -122,7 +123,7 @@ static void test_cancel_after_invoke(grpc_end2end_test_config config,
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
- "/foo", "foo.test.google.fr", deadline);
+ "/foo", "foo.test.google.fr", deadline, NULL);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -137,29 +138,36 @@ static void test_cancel_after_invoke(grpc_end2end_test_config config,
op->data.recv_status_on_client.status_details = &details;
op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message = request_payload;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message = &response_payload_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, test_ops, tag(1)));
+ error = grpc_call_start_batch(c, ops, test_ops, tag(1), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
- GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c));
+ GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c, NULL));
cq_expect_completion(cqv, tag(1), 1);
cq_verify(cqv);
diff --git a/test/core/end2end/tests/cancel_before_invoke.c b/test/core/end2end/tests/cancel_before_invoke.c
index b511908b4f..8b582e0c42 100644
--- a/test/core/end2end/tests/cancel_before_invoke.c
+++ b/test/core/end2end/tests/cancel_before_invoke.c
@@ -68,15 +68,15 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
- ev = grpc_completion_queue_next(cq, five_seconds_time());
+ ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
- GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
- GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5))
+ GPR_ASSERT(grpc_completion_queue_pluck(
+ f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -112,6 +112,7 @@ static void test_cancel_before_invoke(grpc_end2end_test_config config,
grpc_metadata_array request_metadata_recv;
grpc_call_details call_details;
grpc_status_code status;
+ grpc_call_error error;
char *details = NULL;
size_t details_capacity = 0;
grpc_byte_buffer *response_payload_recv = NULL;
@@ -120,10 +121,10 @@ static void test_cancel_before_invoke(grpc_end2end_test_config config,
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
- "/foo", "foo.test.google.fr", deadline);
+ "/foo", "foo.test.google.fr", deadline, NULL);
GPR_ASSERT(c);
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_cancel(c));
+ GPR_ASSERT(GRPC_CALL_OK == grpc_call_cancel(c, NULL));
grpc_metadata_array_init(&initial_metadata_recv);
grpc_metadata_array_init(&trailing_metadata_recv);
@@ -137,27 +138,34 @@ static void test_cancel_before_invoke(grpc_end2end_test_config config,
op->data.recv_status_on_client.status_details = &details;
op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message = request_payload;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message = &response_payload_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, test_ops, tag(1)));
+ error = grpc_call_start_batch(c, ops, test_ops, tag(1), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(1), 1);
cq_verify(cqv);
diff --git a/test/core/end2end/tests/cancel_in_a_vacuum.c b/test/core/end2end/tests/cancel_in_a_vacuum.c
index 7645410184..6c63d7c0ad 100644
--- a/test/core/end2end/tests/cancel_in_a_vacuum.c
+++ b/test/core/end2end/tests/cancel_in_a_vacuum.c
@@ -69,15 +69,15 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
- ev = grpc_completion_queue_next(cq, five_seconds_time());
+ ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
- GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
- GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5))
+ GPR_ASSERT(grpc_completion_queue_pluck(
+ f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -108,10 +108,10 @@ static void test_cancel_in_a_vacuum(grpc_end2end_test_config config,
cq_verifier *v_client = cq_verifier_create(f.cq);
c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
- "/foo", "foo.test.google.fr", deadline);
+ "/foo", "foo.test.google.fr", deadline, NULL);
GPR_ASSERT(c);
- GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c));
+ GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c, NULL));
grpc_call_destroy(c);
diff --git a/test/core/end2end/tests/cancel_test_helpers.h b/test/core/end2end/tests/cancel_test_helpers.h
index 8345c07904..f8fafae597 100644
--- a/test/core/end2end/tests/cancel_test_helpers.h
+++ b/test/core/end2end/tests/cancel_test_helpers.h
@@ -36,12 +36,13 @@
typedef struct {
const char *name;
- grpc_call_error (*initiate_cancel)(grpc_call *call);
+ grpc_call_error (*initiate_cancel)(grpc_call *call, void *reserved);
grpc_status_code expect_status;
const char *expect_details;
} cancellation_mode;
-static grpc_call_error wait_for_deadline(grpc_call *call) {
+static grpc_call_error wait_for_deadline(grpc_call *call, void *reserved) {
+ (void)reserved;
return GRPC_CALL_OK;
}
diff --git a/test/core/end2end/tests/census_simple_request.c b/test/core/end2end/tests/census_simple_request.c
index 2142dde921..36b9e92884 100644
--- a/test/core/end2end/tests/census_simple_request.c
+++ b/test/core/end2end/tests/census_simple_request.c
@@ -66,8 +66,8 @@ static void *tag(gpr_intptr t) { return (void *)t; }
static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
- GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
- GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5))
+ GPR_ASSERT(grpc_completion_queue_pluck(
+ f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -82,7 +82,7 @@ static void shutdown_client(grpc_end2end_test_fixture *f) {
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
- ev = grpc_completion_queue_next(cq, n_seconds_time(5));
+ ev = grpc_completion_queue_next(cq, n_seconds_time(5), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@@ -107,12 +107,14 @@ static void test_body(grpc_end2end_test_fixture f) {
grpc_metadata_array request_metadata_recv;
grpc_call_details call_details;
grpc_status_code status;
+ grpc_call_error error;
char *details = NULL;
size_t details_capacity = 0;
int was_cancelled = 2;
c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
- "/foo", "foo.test.google.fr:1234", deadline);
+ "/foo", "foo.test.google.fr:1234", deadline,
+ NULL);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -124,13 +126,16 @@ static void test_body(grpc_end2end_test_fixture f) {
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
@@ -138,12 +143,15 @@ static void test_body(grpc_end2end_test_fixture f) {
op->data.recv_status_on_client.status_details = &details;
op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1)));
+ error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
- GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(
- f.server, &s, &call_details,
- &request_metadata_recv, f.cq, f.cq, tag(101)));
+ error =
+ grpc_server_request_call(f.server, &s, &call_details,
+ &request_metadata_recv, f.cq, f.cq, tag(101));
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv);
@@ -151,18 +159,22 @@ static void test_body(grpc_end2end_test_fixture f) {
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 0;
op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED;
op->data.send_status_from_server.status_details = "xyz";
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102)));
+ error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1);
cq_expect_completion(cqv, tag(1), 1);
diff --git a/test/core/end2end/tests/channel_connectivity.c b/test/core/end2end/tests/channel_connectivity.c
index ec0417abda..0b7a8a664b 100644
--- a/test/core/end2end/tests/channel_connectivity.c
+++ b/test/core/end2end/tests/channel_connectivity.c
@@ -48,33 +48,38 @@ static void test_connectivity(grpc_end2end_test_config config) {
config.init_client(&f, NULL);
/* channels should start life in IDLE, and stay there */
- GPR_ASSERT(grpc_channel_check_connectivity_state(f.client, 0) == GRPC_CHANNEL_IDLE);
+ GPR_ASSERT(grpc_channel_check_connectivity_state(f.client, 0) ==
+ GRPC_CHANNEL_IDLE);
gpr_sleep_until(GRPC_TIMEOUT_MILLIS_TO_DEADLINE(100));
- GPR_ASSERT(grpc_channel_check_connectivity_state(f.client, 0) == GRPC_CHANNEL_IDLE);
+ GPR_ASSERT(grpc_channel_check_connectivity_state(f.client, 0) ==
+ GRPC_CHANNEL_IDLE);
/* start watching for a change */
- grpc_channel_watch_connectivity_state(
- f.client, GRPC_CHANNEL_IDLE, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(3), f.cq, tag(1));
+ grpc_channel_watch_connectivity_state(f.client, GRPC_CHANNEL_IDLE,
+ GRPC_TIMEOUT_SECONDS_TO_DEADLINE(3),
+ f.cq, tag(1));
/* nothing should happen */
cq_verify_empty(cqv);
/* check that we're still in idle, and start connecting */
- GPR_ASSERT(grpc_channel_check_connectivity_state(f.client, 1) == GRPC_CHANNEL_IDLE);
+ GPR_ASSERT(grpc_channel_check_connectivity_state(f.client, 1) ==
+ GRPC_CHANNEL_IDLE);
/* and now the watch should trigger */
cq_expect_completion(cqv, tag(1), 1);
cq_verify(cqv);
state = grpc_channel_check_connectivity_state(f.client, 0);
- GPR_ASSERT(state == GRPC_CHANNEL_TRANSIENT_FAILURE ||
+ GPR_ASSERT(state == GRPC_CHANNEL_TRANSIENT_FAILURE ||
state == GRPC_CHANNEL_CONNECTING);
/* quickly followed by a transition to TRANSIENT_FAILURE */
- grpc_channel_watch_connectivity_state(
- f.client, GRPC_CHANNEL_CONNECTING, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(3), f.cq, tag(2));
+ grpc_channel_watch_connectivity_state(f.client, GRPC_CHANNEL_CONNECTING,
+ GRPC_TIMEOUT_SECONDS_TO_DEADLINE(3),
+ f.cq, tag(2));
cq_expect_completion(cqv, tag(2), 1);
cq_verify(cqv);
state = grpc_channel_check_connectivity_state(f.client, 0);
- GPR_ASSERT(state == GRPC_CHANNEL_TRANSIENT_FAILURE ||
+ GPR_ASSERT(state == GRPC_CHANNEL_TRANSIENT_FAILURE ||
state == GRPC_CHANNEL_CONNECTING);
gpr_log(GPR_DEBUG, "*** STARTING SERVER ***");
@@ -87,13 +92,13 @@ static void test_connectivity(grpc_end2end_test_config config) {
/* we'll go through some set of transitions (some might be missed), until
READY is reached */
while (state != GRPC_CHANNEL_READY) {
- grpc_channel_watch_connectivity_state(
- f.client, state, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(3), f.cq, tag(3));
- cq_expect_completion(cqv, tag(3), 1);
+ grpc_channel_watch_connectivity_state(
+ f.client, state, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(3), f.cq, tag(3));
+ cq_expect_completion(cqv, tag(3), 1);
cq_verify(cqv);
state = grpc_channel_check_connectivity_state(f.client, 0);
- GPR_ASSERT(state == GRPC_CHANNEL_READY ||
- state == GRPC_CHANNEL_CONNECTING ||
+ GPR_ASSERT(state == GRPC_CHANNEL_READY ||
+ state == GRPC_CHANNEL_CONNECTING ||
state == GRPC_CHANNEL_TRANSIENT_FAILURE);
}
@@ -101,8 +106,9 @@ static void test_connectivity(grpc_end2end_test_config config) {
/* we should go immediately to TRANSIENT_FAILURE */
gpr_log(GPR_DEBUG, "*** SHUTTING DOWN SERVER ***");
- grpc_channel_watch_connectivity_state(
- f.client, GRPC_CHANNEL_READY, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(3), f.cq, tag(4));
+ grpc_channel_watch_connectivity_state(f.client, GRPC_CHANNEL_READY,
+ GRPC_TIMEOUT_SECONDS_TO_DEADLINE(3),
+ f.cq, tag(4));
grpc_server_shutdown_and_notify(f.server, f.cq, tag(0xdead));
@@ -110,7 +116,7 @@ static void test_connectivity(grpc_end2end_test_config config) {
cq_expect_completion(cqv, tag(0xdead), 1);
cq_verify(cqv);
state = grpc_channel_check_connectivity_state(f.client, 0);
- GPR_ASSERT(state == GRPC_CHANNEL_TRANSIENT_FAILURE ||
+ GPR_ASSERT(state == GRPC_CHANNEL_TRANSIENT_FAILURE ||
state == GRPC_CHANNEL_CONNECTING);
/* cleanup server */
diff --git a/test/core/end2end/tests/default_host.c b/test/core/end2end/tests/default_host.c
index 920449f4fa..97c19db331 100644
--- a/test/core/end2end/tests/default_host.c
+++ b/test/core/end2end/tests/default_host.c
@@ -70,15 +70,15 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
- ev = grpc_completion_queue_next(cq, five_seconds_time());
+ ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
- GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
- GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5))
+ GPR_ASSERT(grpc_completion_queue_pluck(
+ f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -111,13 +111,14 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
grpc_metadata_array request_metadata_recv;
grpc_call_details call_details;
grpc_status_code status;
+ grpc_call_error error;
char *details = NULL;
size_t details_capacity = 0;
int was_cancelled = 2;
char *peer;
c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
- "/foo", NULL, deadline);
+ "/foo", NULL, deadline, NULL);
GPR_ASSERT(c);
peer = grpc_call_get_peer(c);
@@ -134,13 +135,16 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
@@ -148,12 +152,15 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
op->data.recv_status_on_client.status_details = &details;
op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1)));
+ error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+ GPR_ASSERT(error == GRPC_CALL_OK);
- GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(
- f.server, &s, &call_details,
- &request_metadata_recv, f.cq, f.cq, tag(101)));
+ error =
+ grpc_server_request_call(f.server, &s, &call_details,
+ &request_metadata_recv, f.cq, f.cq, tag(101));
+ GPR_ASSERT(error == GRPC_CALL_OK);
cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv);
@@ -170,18 +177,22 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 0;
op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED;
op->data.send_status_from_server.status_details = "xyz";
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102)));
+ error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+ GPR_ASSERT(error == GRPC_CALL_OK);
cq_expect_completion(cqv, tag(102), 1);
cq_expect_completion(cqv, tag(1), 1);
@@ -215,7 +226,9 @@ static void test_invoke_simple_request(grpc_end2end_test_config config) {
}
void grpc_end2end_tests(grpc_end2end_test_config config) {
- if ((config.feature_mask & FEATURE_MASK_SUPPORTS_HOSTNAME_VERIFICATION) != 0) return;
- if ((config.feature_mask & FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION) == 0) return;
+ if ((config.feature_mask & FEATURE_MASK_SUPPORTS_HOSTNAME_VERIFICATION) != 0)
+ return;
+ if ((config.feature_mask & FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION) == 0)
+ return;
test_invoke_simple_request(config);
}
diff --git a/test/core/end2end/tests/disappearing_server.c b/test/core/end2end/tests/disappearing_server.c
index 94bed336e8..09762705e3 100644
--- a/test/core/end2end/tests/disappearing_server.c
+++ b/test/core/end2end/tests/disappearing_server.c
@@ -56,7 +56,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
- ev = grpc_completion_queue_next(cq, five_seconds_time());
+ ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@@ -93,12 +93,14 @@ static void do_request_and_shutdown_server(grpc_end2end_test_fixture *f,
grpc_metadata_array request_metadata_recv;
grpc_call_details call_details;
grpc_status_code status;
+ grpc_call_error error;
char *details = NULL;
size_t details_capacity = 0;
int was_cancelled = 2;
c = grpc_channel_create_call(f->client, NULL, GRPC_PROPAGATE_DEFAULTS, f->cq,
- "/foo", "foo.test.google.fr:1234", deadline);
+ "/foo", "foo.test.google.fr:1234", deadline,
+ NULL);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -110,13 +112,16 @@ static void do_request_and_shutdown_server(grpc_end2end_test_fixture *f,
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
@@ -124,13 +129,15 @@ static void do_request_and_shutdown_server(grpc_end2end_test_fixture *f,
op->data.recv_status_on_client.status_details = &details;
op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1)));
+ error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
- GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(f->server, &s,
- &call_details,
- &request_metadata_recv,
- f->cq, f->cq, tag(101)));
+ error =
+ grpc_server_request_call(f->server, &s, &call_details,
+ &request_metadata_recv, f->cq, f->cq, tag(101));
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv);
@@ -142,18 +149,22 @@ static void do_request_and_shutdown_server(grpc_end2end_test_fixture *f,
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 0;
op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED;
op->data.send_status_from_server.status_details = "xyz";
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102)));
+ error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1);
cq_expect_completion(cqv, tag(1), 1);
diff --git a/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls.c b/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls.c
index 36cbe8067b..233bc9bee2 100644
--- a/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls.c
+++ b/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls.c
@@ -68,7 +68,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
- ev = grpc_completion_queue_next(cq, five_seconds_time());
+ ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@@ -101,12 +101,13 @@ static void test_early_server_shutdown_finishes_inflight_calls(
grpc_metadata_array request_metadata_recv;
grpc_call_details call_details;
grpc_status_code status;
+ grpc_call_error error;
char *details = NULL;
size_t details_capacity = 0;
int was_cancelled = 2;
c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
- "/foo", "foo.test.google.fr", deadline);
+ "/foo", "foo.test.google.fr", deadline, NULL);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -119,13 +120,16 @@ static void test_early_server_shutdown_finishes_inflight_calls(
op->data.send_initial_metadata.count = 0;
op->data.send_initial_metadata.metadata = NULL;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
@@ -133,12 +137,15 @@ static void test_early_server_shutdown_finishes_inflight_calls(
op->data.recv_status_on_client.status_details = &details;
op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1)));
+ error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
- GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(
- f.server, &s, &call_details,
- &request_metadata_recv, f.cq, f.cq, tag(101)));
+ error =
+ grpc_server_request_call(f.server, &s, &call_details,
+ &request_metadata_recv, f.cq, f.cq, tag(101));
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv);
@@ -146,8 +153,10 @@ static void test_early_server_shutdown_finishes_inflight_calls(
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102)));
+ error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
/* shutdown and destroy the server */
grpc_server_shutdown_and_notify(f.server, f.cq, tag(1000));
diff --git a/test/core/end2end/tests/early_server_shutdown_finishes_tags.c b/test/core/end2end/tests/early_server_shutdown_finishes_tags.c
index fc03cb01a8..9b678a1754 100644
--- a/test/core/end2end/tests/early_server_shutdown_finishes_tags.c
+++ b/test/core/end2end/tests/early_server_shutdown_finishes_tags.c
@@ -68,7 +68,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
- ev = grpc_completion_queue_next(cq, five_seconds_time());
+ ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
diff --git a/test/core/end2end/tests/empty_batch.c b/test/core/end2end/tests/empty_batch.c
index 138c6b07c5..c93d236a6a 100644
--- a/test/core/end2end/tests/empty_batch.c
+++ b/test/core/end2end/tests/empty_batch.c
@@ -70,15 +70,15 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
- ev = grpc_completion_queue_next(cq, five_seconds_time());
+ ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
- GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
- GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5))
+ GPR_ASSERT(grpc_completion_queue_pluck(
+ f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -103,13 +103,15 @@ static void empty_batch_body(grpc_end2end_test_fixture f) {
grpc_call *c;
gpr_timespec deadline = five_seconds_time();
cq_verifier *cqv = cq_verifier_create(f.cq);
+ grpc_call_error error;
grpc_op *op = NULL;
c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
- "/foo", "foo.test.google.fr", deadline);
+ "/foo", "foo.test.google.fr", deadline, NULL);
GPR_ASSERT(c);
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, op, 0, tag(1)));
+ error = grpc_call_start_batch(c, op, 0, tag(1), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(1), 1);
cq_verify(cqv);
diff --git a/test/core/end2end/tests/graceful_server_shutdown.c b/test/core/end2end/tests/graceful_server_shutdown.c
index 23efa0304f..d4e7a1ac6d 100644
--- a/test/core/end2end/tests/graceful_server_shutdown.c
+++ b/test/core/end2end/tests/graceful_server_shutdown.c
@@ -68,7 +68,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
- ev = grpc_completion_queue_next(cq, five_seconds_time());
+ ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@@ -108,12 +108,13 @@ static void test_early_server_shutdown_finishes_inflight_calls(
grpc_metadata_array request_metadata_recv;
grpc_call_details call_details;
grpc_status_code status;
+ grpc_call_error error;
char *details = NULL;
size_t details_capacity = 0;
int was_cancelled = 2;
c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
- "/foo", "foo.test.google.fr", deadline);
+ "/foo", "foo.test.google.fr", deadline, NULL);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -126,13 +127,16 @@ static void test_early_server_shutdown_finishes_inflight_calls(
op->data.send_initial_metadata.count = 0;
op->data.send_initial_metadata.metadata = NULL;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
@@ -140,12 +144,15 @@ static void test_early_server_shutdown_finishes_inflight_calls(
op->data.recv_status_on_client.status_details = &details;
op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1)));
+ error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
- GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(
- f.server, &s, &call_details,
- &request_metadata_recv, f.cq, f.cq, tag(101)));
+ error =
+ grpc_server_request_call(f.server, &s, &call_details,
+ &request_metadata_recv, f.cq, f.cq, tag(101));
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv);
@@ -157,18 +164,22 @@ static void test_early_server_shutdown_finishes_inflight_calls(
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 0;
op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED;
op->data.send_status_from_server.status_details = "xyz";
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102)));
+ error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1);
cq_expect_completion(cqv, tag(0xdead), 1);
diff --git a/test/core/end2end/tests/invoke_large_request.c b/test/core/end2end/tests/invoke_large_request.c
index e32645e2ba..7677084511 100644
--- a/test/core/end2end/tests/invoke_large_request.c
+++ b/test/core/end2end/tests/invoke_large_request.c
@@ -66,15 +66,15 @@ static gpr_timespec n_seconds_time(int n) {
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
- ev = grpc_completion_queue_next(cq, n_seconds_time(5));
+ ev = grpc_completion_queue_next(cq, n_seconds_time(5), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
- GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
- GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5))
+ GPR_ASSERT(grpc_completion_queue_pluck(
+ f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -124,12 +124,13 @@ static void test_invoke_large_request(grpc_end2end_test_config config) {
grpc_byte_buffer *response_payload_recv = NULL;
grpc_call_details call_details;
grpc_status_code status;
+ grpc_call_error error;
char *details = NULL;
size_t details_capacity = 0;
int was_cancelled = 2;
c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
- "/foo", "foo.test.google.fr", deadline);
+ "/foo", "foo.test.google.fr", deadline, NULL);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -141,21 +142,26 @@ static void test_invoke_large_request(grpc_end2end_test_config config) {
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message = request_payload;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message = &response_payload_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
@@ -163,12 +169,15 @@ static void test_invoke_large_request(grpc_end2end_test_config config) {
op->data.recv_status_on_client.status_details = &details;
op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1)));
+ error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
- GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(
- f.server, &s, &call_details,
- &request_metadata_recv, f.cq, f.cq, tag(101)));
+ error =
+ grpc_server_request_call(f.server, &s, &call_details,
+ &request_metadata_recv, f.cq, f.cq, tag(101));
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv);
@@ -176,12 +185,15 @@ static void test_invoke_large_request(grpc_end2end_test_config config) {
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message = &request_payload_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102)));
+ error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1);
cq_verify(cqv);
@@ -190,18 +202,22 @@ static void test_invoke_large_request(grpc_end2end_test_config config) {
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message = response_payload;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 0;
op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED;
op->data.send_status_from_server.status_details = "xyz";
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(103)));
+ error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(103), 1);
cq_expect_completion(cqv, tag(1), 1);
diff --git a/test/core/end2end/tests/max_concurrent_streams.c b/test/core/end2end/tests/max_concurrent_streams.c
index 049c028835..0ba620b851 100644
--- a/test/core/end2end/tests/max_concurrent_streams.c
+++ b/test/core/end2end/tests/max_concurrent_streams.c
@@ -68,15 +68,15 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
- ev = grpc_completion_queue_next(cq, five_seconds_time());
+ ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
- GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
- GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5))
+ GPR_ASSERT(grpc_completion_queue_pluck(
+ f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -109,12 +109,14 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
grpc_metadata_array request_metadata_recv;
grpc_call_details call_details;
grpc_status_code status;
+ grpc_call_error error;
char *details = NULL;
size_t details_capacity = 0;
int was_cancelled = 2;
c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
- "/foo", "foo.test.google.fr:1234", deadline);
+ "/foo", "foo.test.google.fr:1234", deadline,
+ NULL);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -126,13 +128,16 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
@@ -140,12 +145,15 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
op->data.recv_status_on_client.status_details = &details;
op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1)));
+ error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
- GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(
- f.server, &s, &call_details,
- &request_metadata_recv, f.cq, f.cq, tag(101)));
+ error =
+ grpc_server_request_call(f.server, &s, &call_details,
+ &request_metadata_recv, f.cq, f.cq, tag(101));
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv);
@@ -153,18 +161,22 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 0;
op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED;
op->data.send_status_from_server.status_details = "xyz";
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102)));
+ error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1);
cq_expect_completion(cqv, tag(1), 1);
@@ -207,6 +219,7 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) {
grpc_metadata_array initial_metadata_recv2;
grpc_metadata_array trailing_metadata_recv2;
grpc_status_code status1;
+ grpc_call_error error;
char *details1 = NULL;
size_t details_capacity1 = 0;
grpc_status_code status2;
@@ -245,10 +258,12 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) {
the first completes */
deadline = n_seconds_time(1000);
c1 = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
- "/alpha", "foo.test.google.fr:1234", deadline);
+ "/alpha", "foo.test.google.fr:1234", deadline,
+ NULL);
GPR_ASSERT(c1);
c2 = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
- "/beta", "foo.test.google.fr:1234", deadline);
+ "/beta", "foo.test.google.fr:1234", deadline,
+ NULL);
GPR_ASSERT(c2);
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(
@@ -259,12 +274,14 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) {
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_batch(c1, ops, op - ops, tag(301)));
+ error = grpc_call_start_batch(c1, ops, op - ops, tag(301), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
op = ops;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
@@ -273,24 +290,28 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) {
op->data.recv_status_on_client.status_details = &details1;
op->data.recv_status_on_client.status_details_capacity = &details_capacity1;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata = &initial_metadata_recv1;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_batch(c1, ops, op - ops, tag(302)));
+ error = grpc_call_start_batch(c1, ops, op - ops, tag(302), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
op = ops;
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_batch(c2, ops, op - ops, tag(401)));
+ error = grpc_call_start_batch(c2, ops, op - ops, tag(401), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
op = ops;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
@@ -299,19 +320,22 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) {
op->data.recv_status_on_client.status_details = &details2;
op->data.recv_status_on_client.status_details_capacity = &details_capacity2;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata = &initial_metadata_recv1;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_batch(c2, ops, op - ops, tag(402)));
+ error = grpc_call_start_batch(c2, ops, op - ops, tag(402), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
got_client_start = 0;
got_server_start = 0;
live_call = -1;
while (!got_client_start || !got_server_start) {
- ev = grpc_completion_queue_next(f.cq, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(3));
+ ev = grpc_completion_queue_next(f.cq, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(3),
+ NULL);
GPR_ASSERT(ev.type == GRPC_OP_COMPLETE);
GPR_ASSERT(ev.success);
if (ev.tag == tag(101)) {
@@ -334,19 +358,22 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) {
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 0;
op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED;
op->data.send_status_from_server.status_details = "xyz";
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_batch(s1, ops, op - ops, tag(102)));
+ error = grpc_call_start_batch(s1, ops, op - ops, tag(102), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1);
cq_expect_completion(cqv, tag(live_call + 2), 1);
@@ -365,19 +392,22 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) {
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 0;
op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED;
op->data.send_status_from_server.status_details = "xyz";
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_batch(s2, ops, op - ops, tag(202)));
+ error = grpc_call_start_batch(s2, ops, op - ops, tag(202), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(live_call + 2), 1);
cq_expect_completion(cqv, tag(202), 1);
diff --git a/test/core/end2end/tests/max_message_length.c b/test/core/end2end/tests/max_message_length.c
index feea49c68f..2b9560716f 100644
--- a/test/core/end2end/tests/max_message_length.c
+++ b/test/core/end2end/tests/max_message_length.c
@@ -68,15 +68,15 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
- ev = grpc_completion_queue_next(cq, five_seconds_time());
+ ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
- GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
- GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5))
+ GPR_ASSERT(grpc_completion_queue_pluck(
+ f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -114,6 +114,7 @@ static void test_max_message_length(grpc_end2end_test_config config) {
grpc_metadata_array request_metadata_recv;
grpc_call_details call_details;
grpc_status_code status;
+ grpc_call_error error;
char *details = NULL;
size_t details_capacity = 0;
int was_cancelled = 2;
@@ -130,7 +131,7 @@ static void test_max_message_length(grpc_end2end_test_config config) {
c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
"/foo", "foo.test.google.fr:1234",
- gpr_inf_future(GPR_CLOCK_REALTIME));
+ gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -142,17 +143,21 @@ static void test_max_message_length(grpc_end2end_test_config config) {
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message = request_payload;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
@@ -160,12 +165,15 @@ static void test_max_message_length(grpc_end2end_test_config config) {
op->data.recv_status_on_client.status_details = &details;
op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1)));
+ error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
- GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(
- f.server, &s, &call_details,
- &request_metadata_recv, f.cq, f.cq, tag(101)));
+ error =
+ grpc_server_request_call(f.server, &s, &call_details,
+ &request_metadata_recv, f.cq, f.cq, tag(101));
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv);
@@ -173,8 +181,10 @@ static void test_max_message_length(grpc_end2end_test_config config) {
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102)));
+ error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1);
cq_expect_completion(cqv, tag(1), 1);
diff --git a/test/core/end2end/tests/no_op.c b/test/core/end2end/tests/no_op.c
index 8ead664758..157d0d5349 100644
--- a/test/core/end2end/tests/no_op.c
+++ b/test/core/end2end/tests/no_op.c
@@ -68,15 +68,15 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
- ev = grpc_completion_queue_next(cq, five_seconds_time());
+ ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
- GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
- GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5))
+ GPR_ASSERT(grpc_completion_queue_pluck(
+ f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
diff --git a/test/core/end2end/tests/ping_pong_streaming.c b/test/core/end2end/tests/ping_pong_streaming.c
index 0ae611b518..43abda4d7f 100644
--- a/test/core/end2end/tests/ping_pong_streaming.c
+++ b/test/core/end2end/tests/ping_pong_streaming.c
@@ -68,15 +68,15 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
- ev = grpc_completion_queue_next(cq, five_seconds_time());
+ ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
- GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
- GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5))
+ GPR_ASSERT(grpc_completion_queue_pluck(
+ f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -113,6 +113,7 @@ static void test_pingpong_streaming(grpc_end2end_test_config config,
grpc_metadata_array request_metadata_recv;
grpc_call_details call_details;
grpc_status_code status;
+ grpc_call_error error;
char *details = NULL;
size_t details_capacity = 0;
int was_cancelled = 2;
@@ -125,7 +126,8 @@ static void test_pingpong_streaming(grpc_end2end_test_config config,
gpr_slice response_payload_slice = gpr_slice_from_copied_string("hello you");
c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
- "/foo", "foo.test.google.fr:1234", deadline);
+ "/foo", "foo.test.google.fr:1234", deadline,
+ NULL);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -137,10 +139,12 @@ static void test_pingpong_streaming(grpc_end2end_test_config config,
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
@@ -148,12 +152,15 @@ static void test_pingpong_streaming(grpc_end2end_test_config config,
op->data.recv_status_on_client.status_details = &details;
op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1)));
+ error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
- GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(
- f.server, &s, &call_details,
- &request_metadata_recv, f.cq, f.cq, tag(100)));
+ error =
+ grpc_server_request_call(f.server, &s, &call_details,
+ &request_metadata_recv, f.cq, f.cq, tag(100));
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(100), 1);
cq_verify(cqv);
@@ -161,12 +168,15 @@ static void test_pingpong_streaming(grpc_end2end_test_config config,
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(101)));
+ error = grpc_call_start_batch(s, ops, op - ops, tag(101), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
for (i = 0; i < messages; i++) {
request_payload = grpc_raw_byte_buffer_create(&request_payload_slice, 1);
@@ -176,20 +186,24 @@ static void test_pingpong_streaming(grpc_end2end_test_config config,
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message = request_payload;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message = &response_payload_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(2)));
+ error = grpc_call_start_batch(c, ops, op - ops, tag(2), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
op = ops;
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message = &request_payload_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_batch(s, ops, op - ops, tag(102)));
+ error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1);
cq_verify(cqv);
@@ -197,9 +211,10 @@ static void test_pingpong_streaming(grpc_end2end_test_config config,
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message = response_payload;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_batch(s, ops, op - ops, tag(103)));
+ error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(103), 1);
cq_expect_completion(cqv, tag(2), 1);
cq_verify(cqv);
@@ -216,8 +231,10 @@ static void test_pingpong_streaming(grpc_end2end_test_config config,
op = ops;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(3)));
+ error = grpc_call_start_batch(c, ops, op - ops, tag(3), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
op = ops;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
@@ -225,8 +242,10 @@ static void test_pingpong_streaming(grpc_end2end_test_config config,
op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED;
op->data.send_status_from_server.status_details = "xyz";
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(104)));
+ error = grpc_call_start_batch(s, ops, op - ops, tag(104), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(1), 1);
cq_expect_completion(cqv, tag(3), 1);
diff --git a/test/core/end2end/tests/registered_call.c b/test/core/end2end/tests/registered_call.c
index ffc4cd40a0..eddce6ded4 100644
--- a/test/core/end2end/tests/registered_call.c
+++ b/test/core/end2end/tests/registered_call.c
@@ -70,15 +70,15 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
- ev = grpc_completion_queue_next(cq, five_seconds_time());
+ ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
- GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
- GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5))
+ GPR_ASSERT(grpc_completion_queue_pluck(
+ f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -111,12 +111,13 @@ static void simple_request_body(grpc_end2end_test_fixture f, void *rc) {
grpc_metadata_array request_metadata_recv;
grpc_call_details call_details;
grpc_status_code status;
+ grpc_call_error error;
char *details = NULL;
size_t details_capacity = 0;
int was_cancelled = 2;
c = grpc_channel_create_registered_call(
- f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, rc, deadline);
+ f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, rc, deadline, NULL);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -128,13 +129,16 @@ static void simple_request_body(grpc_end2end_test_fixture f, void *rc) {
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
@@ -142,12 +146,15 @@ static void simple_request_body(grpc_end2end_test_fixture f, void *rc) {
op->data.recv_status_on_client.status_details = &details;
op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1)));
+ error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
- GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(
- f.server, &s, &call_details,
- &request_metadata_recv, f.cq, f.cq, tag(101)));
+ error =
+ grpc_server_request_call(f.server, &s, &call_details,
+ &request_metadata_recv, f.cq, f.cq, tag(101));
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv);
@@ -155,18 +162,22 @@ static void simple_request_body(grpc_end2end_test_fixture f, void *rc) {
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 0;
op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED;
op->data.send_status_from_server.status_details = "xyz";
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102)));
+ error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1);
cq_expect_completion(cqv, tag(1), 1);
@@ -193,8 +204,8 @@ static void simple_request_body(grpc_end2end_test_fixture f, void *rc) {
static void test_invoke_simple_request(grpc_end2end_test_config config) {
grpc_end2end_test_fixture f =
begin_test(config, "test_invoke_simple_request", NULL, NULL);
- void *rc =
- grpc_channel_register_call(f.client, "/foo", "foo.test.google.fr:1234");
+ void *rc = grpc_channel_register_call(f.client, "/foo",
+ "foo.test.google.fr:1234", NULL);
simple_request_body(f, rc);
end_test(&f);
@@ -205,8 +216,8 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config) {
int i;
grpc_end2end_test_fixture f =
begin_test(config, "test_invoke_10_simple_requests", NULL, NULL);
- void *rc =
- grpc_channel_register_call(f.client, "/foo", "foo.test.google.fr:1234");
+ void *rc = grpc_channel_register_call(f.client, "/foo",
+ "foo.test.google.fr:1234", NULL);
for (i = 0; i < 10; i++) {
simple_request_body(f, rc);
diff --git a/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c b/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c
index 600642e6a7..2345f94044 100644
--- a/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c
+++ b/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c
@@ -68,15 +68,15 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
- ev = grpc_completion_queue_next(cq, five_seconds_time());
+ ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
- GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
- GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5))
+ GPR_ASSERT(grpc_completion_queue_pluck(
+ f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -113,20 +113,24 @@ static void test_request_response_with_metadata_and_payload(
{"key1-bin",
"\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc",
13,
- {{NULL, NULL, NULL}}},
+ 0,
+ {{NULL, NULL, NULL, NULL}}},
{"key2-bin",
"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d",
14,
- {{NULL, NULL, NULL}}}};
+ 0,
+ {{NULL, NULL, NULL, NULL}}}};
grpc_metadata meta_s[2] = {
{"key3-bin",
"\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee",
15,
- {{NULL, NULL, NULL}}},
+ 0,
+ {{NULL, NULL, NULL, NULL}}},
{"key4-bin",
"\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
16,
- {{NULL, NULL, NULL}}}};
+ 0,
+ {{NULL, NULL, NULL, NULL}}}};
grpc_end2end_test_fixture f = begin_test(
config, "test_request_response_with_metadata_and_payload", NULL, NULL);
cq_verifier *cqv = cq_verifier_create(f.cq);
@@ -139,12 +143,13 @@ static void test_request_response_with_metadata_and_payload(
grpc_byte_buffer *response_payload_recv = NULL;
grpc_call_details call_details;
grpc_status_code status;
+ grpc_call_error error;
char *details = NULL;
size_t details_capacity = 0;
int was_cancelled = 2;
c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
- "/foo", "foo.test.google.fr", deadline);
+ "/foo", "foo.test.google.fr", deadline, NULL);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -157,21 +162,26 @@ static void test_request_response_with_metadata_and_payload(
op->data.send_initial_metadata.count = 2;
op->data.send_initial_metadata.metadata = meta_c;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message = request_payload;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message = &response_payload_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
@@ -179,12 +189,15 @@ static void test_request_response_with_metadata_and_payload(
op->data.recv_status_on_client.status_details = &details;
op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1)));
+ error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
- GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(
- f.server, &s, &call_details,
- &request_metadata_recv, f.cq, f.cq, tag(101)));
+ error =
+ grpc_server_request_call(f.server, &s, &call_details,
+ &request_metadata_recv, f.cq, f.cq, tag(101));
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv);
@@ -193,12 +206,15 @@ static void test_request_response_with_metadata_and_payload(
op->data.send_initial_metadata.count = 2;
op->data.send_initial_metadata.metadata = meta_s;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message = &request_payload_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102)));
+ error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1);
cq_verify(cqv);
@@ -207,18 +223,22 @@ static void test_request_response_with_metadata_and_payload(
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message = response_payload;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 0;
op->data.send_status_from_server.status = GRPC_STATUS_OK;
op->data.send_status_from_server.status_details = "xyz";
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(103)));
+ error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(103), 1);
cq_expect_completion(cqv, tag(1), 1);
diff --git a/test/core/end2end/tests/request_response_with_metadata_and_payload.c b/test/core/end2end/tests/request_response_with_metadata_and_payload.c
index 7e8cce10f4..a4cc27896c 100644
--- a/test/core/end2end/tests/request_response_with_metadata_and_payload.c
+++ b/test/core/end2end/tests/request_response_with_metadata_and_payload.c
@@ -68,15 +68,15 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
- ev = grpc_completion_queue_next(cq, five_seconds_time());
+ ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
- GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
- GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5))
+ GPR_ASSERT(grpc_completion_queue_pluck(
+ f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -109,10 +109,12 @@ static void test_request_response_with_metadata_and_payload(
grpc_byte_buffer *response_payload =
grpc_raw_byte_buffer_create(&response_payload_slice, 1);
gpr_timespec deadline = five_seconds_time();
- grpc_metadata meta_c[2] = {{"key1", "val1", 4, {{NULL, NULL, NULL}}},
- {"key2", "val2", 4, {{NULL, NULL, NULL}}}};
- grpc_metadata meta_s[2] = {{"KeY3", "val3", 4, {{NULL, NULL, NULL}}},
- {"KeY4", "val4", 4, {{NULL, NULL, NULL}}}};
+ grpc_metadata meta_c[2] = {
+ {"key1", "val1", 4, 0, {{NULL, NULL, NULL, NULL}}},
+ {"key2", "val2", 4, 0, {{NULL, NULL, NULL, NULL}}}};
+ grpc_metadata meta_s[2] = {
+ {"KeY3", "val3", 4, 0, {{NULL, NULL, NULL, NULL}}},
+ {"KeY4", "val4", 4, 0, {{NULL, NULL, NULL, NULL}}}};
grpc_end2end_test_fixture f = begin_test(
config, "test_request_response_with_metadata_and_payload", NULL, NULL);
cq_verifier *cqv = cq_verifier_create(f.cq);
@@ -125,12 +127,13 @@ static void test_request_response_with_metadata_and_payload(
grpc_byte_buffer *response_payload_recv = NULL;
grpc_call_details call_details;
grpc_status_code status;
+ grpc_call_error error;
char *details = NULL;
size_t details_capacity = 0;
int was_cancelled = 2;
c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
- "/foo", "foo.test.google.fr", deadline);
+ "/foo", "foo.test.google.fr", deadline, NULL);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -143,21 +146,26 @@ static void test_request_response_with_metadata_and_payload(
op->data.send_initial_metadata.count = 2;
op->data.send_initial_metadata.metadata = meta_c;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message = request_payload;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message = &response_payload_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
@@ -165,12 +173,15 @@ static void test_request_response_with_metadata_and_payload(
op->data.recv_status_on_client.status_details = &details;
op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1)));
+ error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
- GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(
- f.server, &s, &call_details,
- &request_metadata_recv, f.cq, f.cq, tag(101)));
+ error =
+ grpc_server_request_call(f.server, &s, &call_details,
+ &request_metadata_recv, f.cq, f.cq, tag(101));
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv);
@@ -179,12 +190,15 @@ static void test_request_response_with_metadata_and_payload(
op->data.send_initial_metadata.count = 2;
op->data.send_initial_metadata.metadata = meta_s;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message = &request_payload_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102)));
+ error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1);
cq_verify(cqv);
@@ -193,18 +207,22 @@ static void test_request_response_with_metadata_and_payload(
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message = response_payload;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 0;
op->data.send_status_from_server.status = GRPC_STATUS_OK;
op->data.send_status_from_server.status_details = "xyz";
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(103)));
+ error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(103), 1);
cq_expect_completion(cqv, tag(1), 1);
diff --git a/test/core/end2end/tests/request_response_with_payload.c b/test/core/end2end/tests/request_response_with_payload.c
index 55323895fb..ff00ae6d9d 100644
--- a/test/core/end2end/tests/request_response_with_payload.c
+++ b/test/core/end2end/tests/request_response_with_payload.c
@@ -68,15 +68,15 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
- ev = grpc_completion_queue_next(cq, five_seconds_time());
+ ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
- GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
- GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5))
+ GPR_ASSERT(grpc_completion_queue_pluck(
+ f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -117,12 +117,13 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) {
grpc_byte_buffer *response_payload_recv = NULL;
grpc_call_details call_details;
grpc_status_code status;
+ grpc_call_error error;
char *details = NULL;
size_t details_capacity = 0;
int was_cancelled = 2;
c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
- "/foo", "foo.test.google.fr", deadline);
+ "/foo", "foo.test.google.fr", deadline, NULL);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -134,21 +135,26 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) {
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message = request_payload;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message = &response_payload_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
@@ -156,12 +162,15 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) {
op->data.recv_status_on_client.status_details = &details;
op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1)));
+ error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
- GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(
- f.server, &s, &call_details,
- &request_metadata_recv, f.cq, f.cq, tag(101)));
+ error =
+ grpc_server_request_call(f.server, &s, &call_details,
+ &request_metadata_recv, f.cq, f.cq, tag(101));
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv);
@@ -169,12 +178,15 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) {
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message = &request_payload_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102)));
+ error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1);
cq_verify(cqv);
@@ -183,18 +195,22 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) {
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message = response_payload;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 0;
op->data.send_status_from_server.status = GRPC_STATUS_OK;
op->data.send_status_from_server.status_details = "xyz";
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(103)));
+ error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(103), 1);
cq_expect_completion(cqv, tag(1), 1);
diff --git a/test/core/end2end/tests/request_response_with_payload_and_call_creds.c b/test/core/end2end/tests/request_response_with_payload_and_call_creds.c
index 342dfa03f6..d862274fe3 100644
--- a/test/core/end2end/tests/request_response_with_payload_and_call_creds.c
+++ b/test/core/end2end/tests/request_response_with_payload_and_call_creds.c
@@ -68,7 +68,7 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
grpc_arg fail_auth_arg = {
GRPC_ARG_STRING, FAIL_AUTH_CHECK_SERVER_ARG_NAME, {NULL}};
grpc_channel_args args;
- args.num_args= 1;
+ args.num_args = 1;
args.args = &fail_auth_arg;
config.init_server(&f, &args);
} else {
@@ -86,15 +86,15 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
- ev = grpc_completion_queue_next(cq, five_seconds_time());
+ ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
- GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
- GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5))
+ GPR_ASSERT(grpc_completion_queue_pluck(
+ f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -139,7 +139,7 @@ static void test_call_creds_failure(grpc_end2end_test_config config) {
begin_test(config, "test_call_creds_failure", 0);
gpr_timespec deadline = five_seconds_time();
c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
- "/foo", "foo.test.google.fr", deadline);
+ "/foo", "foo.test.google.fr", deadline, NULL);
GPR_ASSERT(c);
/* Try with credentials unfit to be set on a call (channel creds). */
@@ -176,6 +176,7 @@ static void request_response_with_payload_and_call_creds(
grpc_byte_buffer *response_payload_recv = NULL;
grpc_call_details call_details;
grpc_status_code status;
+ grpc_call_error error;
char *details = NULL;
size_t details_capacity = 0;
int was_cancelled = 2;
@@ -187,7 +188,7 @@ static void request_response_with_payload_and_call_creds(
cqv = cq_verifier_create(f.cq);
c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
- "/foo", "foo.test.google.fr", deadline);
+ "/foo", "foo.test.google.fr", deadline, NULL);
GPR_ASSERT(c);
creds = grpc_iam_credentials_create(iam_token, iam_selector);
GPR_ASSERT(creds != NULL);
@@ -217,21 +218,26 @@ static void request_response_with_payload_and_call_creds(
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message = request_payload;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message = &response_payload_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
@@ -239,12 +245,15 @@ static void request_response_with_payload_and_call_creds(
op->data.recv_status_on_client.status_details = &details;
op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1)));
+ error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
- GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(
- f.server, &s, &call_details,
- &request_metadata_recv, f.cq, f.cq, tag(101)));
+ error =
+ grpc_server_request_call(f.server, &s, &call_details,
+ &request_metadata_recv, f.cq, f.cq, tag(101));
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv);
s_auth_context = grpc_call_auth_context(s);
@@ -264,12 +273,15 @@ static void request_response_with_payload_and_call_creds(
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message = &request_payload_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102)));
+ error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1);
cq_verify(cqv);
@@ -278,18 +290,22 @@ static void request_response_with_payload_and_call_creds(
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message = response_payload;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 0;
op->data.send_status_from_server.status = GRPC_STATUS_OK;
op->data.send_status_from_server.status_details = "xyz";
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(103)));
+ error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(103), 1);
cq_expect_completion(cqv, tag(1), 1);
@@ -389,6 +405,7 @@ static void test_request_with_server_rejecting_client_creds(
grpc_metadata_array request_metadata_recv;
grpc_call_details call_details;
grpc_status_code status;
+ grpc_call_error error;
char *details = NULL;
size_t details_capacity = 0;
grpc_byte_buffer *response_payload_recv = NULL;
@@ -401,7 +418,7 @@ static void test_request_with_server_rejecting_client_creds(
cqv = cq_verifier_create(f.cq);
c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
- "/foo", "foo.test.google.fr", deadline);
+ "/foo", "foo.test.google.fr", deadline, NULL);
GPR_ASSERT(c);
creds = grpc_iam_credentials_create(iam_token, iam_selector);
@@ -421,27 +438,34 @@ static void test_request_with_server_rejecting_client_creds(
op->data.recv_status_on_client.status_details = &details;
op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message = request_payload;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message = &response_payload_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1)));
+ error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+ GPR_ASSERT(error == GRPC_CALL_OK);
cq_expect_completion(cqv, tag(1), 1);
cq_verify(cqv);
diff --git a/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c b/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c
index 26be4ef643..8b764751f6 100644
--- a/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c
+++ b/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c
@@ -68,15 +68,15 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
- ev = grpc_completion_queue_next(cq, five_seconds_time());
+ ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
- GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
- GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5))
+ GPR_ASSERT(grpc_completion_queue_pluck(
+ f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -109,12 +109,15 @@ static void test_request_response_with_metadata_and_payload(
grpc_byte_buffer *response_payload =
grpc_raw_byte_buffer_create(&response_payload_slice, 1);
gpr_timespec deadline = five_seconds_time();
- grpc_metadata meta_c[2] = {{"key1", "val1", 4, {{NULL, NULL, NULL}}},
- {"key2", "val2", 4, {{NULL, NULL, NULL}}}};
- grpc_metadata meta_s[2] = {{"key3", "val3", 4, {{NULL, NULL, NULL}}},
- {"key4", "val4", 4, {{NULL, NULL, NULL}}}};
- grpc_metadata meta_t[2] = {{"key5", "val5", 4, {{NULL, NULL, NULL}}},
- {"key6", "val6", 4, {{NULL, NULL, NULL}}}};
+ grpc_metadata meta_c[2] = {
+ {"key1", "val1", 4, 0, {{NULL, NULL, NULL, NULL}}},
+ {"key2", "val2", 4, 0, {{NULL, NULL, NULL, NULL}}}};
+ grpc_metadata meta_s[2] = {
+ {"key3", "val3", 4, 0, {{NULL, NULL, NULL, NULL}}},
+ {"key4", "val4", 4, 0, {{NULL, NULL, NULL, NULL}}}};
+ grpc_metadata meta_t[2] = {
+ {"key5", "val5", 4, 0, {{NULL, NULL, NULL, NULL}}},
+ {"key6", "val6", 4, 0, {{NULL, NULL, NULL, NULL}}}};
grpc_end2end_test_fixture f = begin_test(
config, "test_request_response_with_metadata_and_payload", NULL, NULL);
cq_verifier *cqv = cq_verifier_create(f.cq);
@@ -127,12 +130,13 @@ static void test_request_response_with_metadata_and_payload(
grpc_byte_buffer *response_payload_recv = NULL;
grpc_call_details call_details;
grpc_status_code status;
+ grpc_call_error error;
char *details = NULL;
size_t details_capacity = 0;
int was_cancelled = 2;
c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
- "/foo", "foo.test.google.fr", deadline);
+ "/foo", "foo.test.google.fr", deadline, NULL);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -145,21 +149,26 @@ static void test_request_response_with_metadata_and_payload(
op->data.send_initial_metadata.count = 2;
op->data.send_initial_metadata.metadata = meta_c;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message = request_payload;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message = &response_payload_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
@@ -167,12 +176,15 @@ static void test_request_response_with_metadata_and_payload(
op->data.recv_status_on_client.status_details = &details;
op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1)));
+ error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
- GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(
- f.server, &s, &call_details,
- &request_metadata_recv, f.cq, f.cq, tag(101)));
+ error =
+ grpc_server_request_call(f.server, &s, &call_details,
+ &request_metadata_recv, f.cq, f.cq, tag(101));
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv);
@@ -181,12 +193,15 @@ static void test_request_response_with_metadata_and_payload(
op->data.send_initial_metadata.count = 2;
op->data.send_initial_metadata.metadata = meta_s;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message = &request_payload_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102)));
+ error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1);
cq_verify(cqv);
@@ -195,10 +210,12 @@ static void test_request_response_with_metadata_and_payload(
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message = response_payload;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 2;
@@ -206,8 +223,10 @@ static void test_request_response_with_metadata_and_payload(
op->data.send_status_from_server.status = GRPC_STATUS_OK;
op->data.send_status_from_server.status_details = "xyz";
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(103)));
+ error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(103), 1);
cq_expect_completion(cqv, tag(1), 1);
diff --git a/test/core/end2end/tests/request_with_compressed_payload.c b/test/core/end2end/tests/request_with_compressed_payload.c
index 5f7d83cb06..299943c548 100644
--- a/test/core/end2end/tests/request_with_compressed_payload.c
+++ b/test/core/end2end/tests/request_with_compressed_payload.c
@@ -46,6 +46,7 @@
#include "test/core/end2end/cq_verifier.h"
#include "src/core/channel/channel_args.h"
#include "src/core/channel/compress_filter.h"
+#include "src/core/surface/call.h"
enum { TIMEOUT = 200000 };
@@ -72,15 +73,15 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
- ev = grpc_completion_queue_next(cq, five_seconds_time());
+ ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
- GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
- GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5))
+ GPR_ASSERT(grpc_completion_queue_pluck(
+ f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -123,13 +124,15 @@ static void request_with_payload_template(
grpc_byte_buffer *request_payload_recv = NULL;
grpc_call_details call_details;
grpc_status_code status;
+ grpc_call_error error;
char *details = NULL;
size_t details_capacity = 0;
int was_cancelled = 2;
cq_verifier *cqv;
char str[1024];
- memset(str, 'x', 1023); str[1023] = '\0';
+ memset(str, 'x', 1023);
+ str[1023] = '\0';
request_payload_slice = gpr_slice_from_copied_string(str);
request_payload = grpc_raw_byte_buffer_create(&request_payload_slice, 1);
@@ -142,7 +145,7 @@ static void request_with_payload_template(
cqv = cq_verifier_create(f.cq);
c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
- "/foo", "foo.test.google.fr", deadline);
+ "/foo", "foo.test.google.fr", deadline, NULL);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -159,17 +162,21 @@ static void request_with_payload_template(
op->data.send_initial_metadata.count = 0;
}
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message = request_payload;
op->flags = send_flags_bitmask;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
@@ -177,26 +184,39 @@ static void request_with_payload_template(
op->data.recv_status_on_client.status_details = &details;
op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1)));
+ error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
- GPR_ASSERT(GRPC_CALL_OK ==
- grpc_server_request_call(f.server, &s, &call_details,
- &request_metadata_recv, f.cq,
- f.cq, tag(101)));
+ error =
+ grpc_server_request_call(f.server, &s, &call_details,
+ &request_metadata_recv, f.cq, f.cq, tag(101));
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv);
+ GPR_ASSERT(GPR_BITCOUNT(grpc_call_get_encodings_accepted_by_peer(s)) == 3);
+ GPR_ASSERT(GPR_BITGET(grpc_call_get_encodings_accepted_by_peer(s),
+ GRPC_COMPRESS_NONE) != 0);
+ GPR_ASSERT(GPR_BITGET(grpc_call_get_encodings_accepted_by_peer(s),
+ GRPC_COMPRESS_DEFLATE) != 0);
+ GPR_ASSERT(GPR_BITGET(grpc_call_get_encodings_accepted_by_peer(s),
+ GRPC_COMPRESS_GZIP) != 0);
+
op = ops;
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message = &request_payload_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102)));
+ error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1);
cq_verify(cqv);
@@ -205,14 +225,17 @@ static void request_with_payload_template(
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 0;
op->data.send_status_from_server.status = GRPC_STATUS_OK;
op->data.send_status_from_server.status_details = "xyz";
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(103)));
+ error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(103), 1);
cq_expect_completion(cqv, tag(1), 1);
@@ -256,8 +279,7 @@ static void test_invoke_request_with_exceptionally_uncompressed_payload(
grpc_end2end_test_config config) {
request_with_payload_template(
config, "test_invoke_request_with_exceptionally_uncompressed_payload",
- GRPC_WRITE_NO_COMPRESS, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_NONE,
- NULL);
+ GRPC_WRITE_NO_COMPRESS, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_NONE, NULL);
}
static void test_invoke_request_with_uncompressed_payload(
@@ -286,12 +308,12 @@ static void test_invoke_request_with_compressed_payload_md_override(
sizeof(gzip_compression_override.internal_data));
none_compression_override.key = GRPC_COMPRESS_REQUEST_ALGORITHM_KEY;
- none_compression_override.value = "none";
+ none_compression_override.value = "identity";
none_compression_override.value_length = 4;
memset(&none_compression_override.internal_data, 0,
sizeof(none_compression_override.internal_data));
- /* Channel default NONE, call override to GZIP */
+ /* Channel default NONE (aka IDENTITY), call override to GZIP */
request_with_payload_template(
config, "test_invoke_request_with_compressed_payload_md_override_1", 0,
GRPC_COMPRESS_NONE, GRPC_COMPRESS_GZIP, &gzip_compression_override);
@@ -301,7 +323,7 @@ static void test_invoke_request_with_compressed_payload_md_override(
config, "test_invoke_request_with_compressed_payload_md_override_2", 0,
GRPC_COMPRESS_DEFLATE, GRPC_COMPRESS_GZIP, &gzip_compression_override);
- /* Channel default DEFLATE, call override to NONE */
+ /* Channel default DEFLATE, call override to NONE (aka IDENTITY) */
request_with_payload_template(
config, "test_invoke_request_with_compressed_payload_md_override_3", 0,
GRPC_COMPRESS_DEFLATE, GRPC_COMPRESS_NONE, &none_compression_override);
diff --git a/test/core/end2end/tests/request_with_flags.c b/test/core/end2end/tests/request_with_flags.c
index 37c4825c8b..eb2e5dc7e8 100644
--- a/test/core/end2end/tests/request_with_flags.c
+++ b/test/core/end2end/tests/request_with_flags.c
@@ -69,15 +69,15 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
- ev = grpc_completion_queue_next(cq, five_seconds_time());
+ ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
- GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
- GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5))
+ GPR_ASSERT(grpc_completion_queue_pluck(
+ f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -117,12 +117,13 @@ static void test_invoke_request_with_flags(
grpc_byte_buffer *request_payload_recv = NULL;
grpc_call_details call_details;
grpc_status_code status;
+ grpc_call_error error;
char *details = NULL;
size_t details_capacity = 0;
grpc_call_error expectation;
c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
- "/foo", "foo.test.google.fr", deadline);
+ "/foo", "foo.test.google.fr", deadline, NULL);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -134,17 +135,21 @@ static void test_invoke_request_with_flags(
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = flags_for_op[op->op];
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message = request_payload;
op->flags = flags_for_op[op->op];
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = flags_for_op[op->op];
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata = &initial_metadata_recv;
op->flags = flags_for_op[op->op];
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
@@ -152,9 +157,11 @@ static void test_invoke_request_with_flags(
op->data.recv_status_on_client.status_details = &details;
op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = flags_for_op[op->op];
+ op->reserved = NULL;
op++;
expectation = call_start_batch_expected_result;
- GPR_ASSERT(expectation == grpc_call_start_batch(c, ops, op - ops, tag(1)));
+ error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+ GPR_ASSERT(expectation == error);
if (expectation == GRPC_CALL_OK) {
cq_expect_completion(cqv, tag(1), 1);
diff --git a/test/core/end2end/tests/request_with_large_metadata.c b/test/core/end2end/tests/request_with_large_metadata.c
index 9ea8273ab0..98e47aaf98 100644
--- a/test/core/end2end/tests/request_with_large_metadata.c
+++ b/test/core/end2end/tests/request_with_large_metadata.c
@@ -68,15 +68,15 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
- ev = grpc_completion_queue_next(cq, five_seconds_time());
+ ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
- GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
- GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5))
+ GPR_ASSERT(grpc_completion_queue_pluck(
+ f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -117,13 +117,14 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) {
grpc_byte_buffer *request_payload_recv = NULL;
grpc_call_details call_details;
grpc_status_code status;
+ grpc_call_error error;
char *details = NULL;
size_t details_capacity = 0;
int was_cancelled = 2;
const int large_size = 64 * 1024;
c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
- "/foo", "foo.test.google.fr", deadline);
+ "/foo", "foo.test.google.fr", deadline, NULL);
GPR_ASSERT(c);
meta.key = "key";
@@ -142,17 +143,21 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) {
op->data.send_initial_metadata.count = 1;
op->data.send_initial_metadata.metadata = &meta;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message = request_payload;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
@@ -160,12 +165,15 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) {
op->data.recv_status_on_client.status_details = &details;
op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1)));
+ error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
- GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(
- f.server, &s, &call_details,
- &request_metadata_recv, f.cq, f.cq, tag(101)));
+ error =
+ grpc_server_request_call(f.server, &s, &call_details,
+ &request_metadata_recv, f.cq, f.cq, tag(101));
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv);
@@ -173,12 +181,15 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) {
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message = &request_payload_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102)));
+ error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1);
cq_verify(cqv);
@@ -187,14 +198,17 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) {
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 0;
op->data.send_status_from_server.status = GRPC_STATUS_OK;
op->data.send_status_from_server.status_details = "xyz";
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(103)));
+ error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(103), 1);
cq_expect_completion(cqv, tag(1), 1);
diff --git a/test/core/end2end/tests/request_with_payload.c b/test/core/end2end/tests/request_with_payload.c
index 6b5f173f01..149dbaeb00 100644
--- a/test/core/end2end/tests/request_with_payload.c
+++ b/test/core/end2end/tests/request_with_payload.c
@@ -68,15 +68,15 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
- ev = grpc_completion_queue_next(cq, five_seconds_time());
+ ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
- GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
- GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5))
+ GPR_ASSERT(grpc_completion_queue_pluck(
+ f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -116,12 +116,13 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) {
grpc_byte_buffer *request_payload_recv = NULL;
grpc_call_details call_details;
grpc_status_code status;
+ grpc_call_error error;
char *details = NULL;
size_t details_capacity = 0;
int was_cancelled = 2;
c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
- "/foo", "foo.test.google.fr", deadline);
+ "/foo", "foo.test.google.fr", deadline, NULL);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -133,17 +134,21 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) {
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message = request_payload;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
@@ -151,8 +156,10 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) {
op->data.recv_status_on_client.status_details = &details;
op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1)));
+ error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(
f.server, &s, &call_details,
@@ -164,12 +171,15 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) {
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message = &request_payload_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102)));
+ error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1);
cq_verify(cqv);
@@ -178,14 +188,17 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) {
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 0;
op->data.send_status_from_server.status = GRPC_STATUS_OK;
op->data.send_status_from_server.status_details = "xyz";
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(103)));
+ error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(103), 1);
cq_expect_completion(cqv, tag(1), 1);
diff --git a/test/core/end2end/tests/server_finishes_request.c b/test/core/end2end/tests/server_finishes_request.c
index 661c099d93..8bacc6c730 100644
--- a/test/core/end2end/tests/server_finishes_request.c
+++ b/test/core/end2end/tests/server_finishes_request.c
@@ -70,15 +70,15 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
- ev = grpc_completion_queue_next(cq, five_seconds_time());
+ ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
- GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
- GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5))
+ GPR_ASSERT(grpc_completion_queue_pluck(
+ f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -111,12 +111,14 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
grpc_metadata_array request_metadata_recv;
grpc_call_details call_details;
grpc_status_code status;
+ grpc_call_error error;
char *details = NULL;
size_t details_capacity = 0;
int was_cancelled = 2;
c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
- "/foo", "foo.test.google.fr:1234", deadline);
+ "/foo", "foo.test.google.fr:1234", deadline,
+ NULL);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -128,10 +130,12 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
@@ -139,12 +143,15 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
op->data.recv_status_on_client.status_details = &details;
op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1)));
+ error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
- GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(
- f.server, &s, &call_details,
- &request_metadata_recv, f.cq, f.cq, tag(101)));
+ error =
+ grpc_server_request_call(f.server, &s, &call_details,
+ &request_metadata_recv, f.cq, f.cq, tag(101));
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv);
@@ -152,18 +159,22 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 0;
op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED;
op->data.send_status_from_server.status_details = "xyz";
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102)));
+ error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1);
cq_expect_completion(cqv, tag(1), 1);
diff --git a/test/core/end2end/tests/simple_delayed_request.c b/test/core/end2end/tests/simple_delayed_request.c
index 82d2bf9657..9133aacc35 100644
--- a/test/core/end2end/tests/simple_delayed_request.c
+++ b/test/core/end2end/tests/simple_delayed_request.c
@@ -56,15 +56,15 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
- ev = grpc_completion_queue_next(cq, five_seconds_time());
+ ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
- GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
- GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5))
+ GPR_ASSERT(grpc_completion_queue_pluck(
+ f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -101,6 +101,7 @@ static void simple_delayed_request_body(grpc_end2end_test_config config,
grpc_metadata_array request_metadata_recv;
grpc_call_details call_details;
grpc_status_code status;
+ grpc_call_error error;
char *details = NULL;
size_t details_capacity = 0;
int was_cancelled = 2;
@@ -108,7 +109,7 @@ static void simple_delayed_request_body(grpc_end2end_test_config config,
config.init_client(f, client_args);
c = grpc_channel_create_call(f->client, NULL, GRPC_PROPAGATE_DEFAULTS, f->cq,
- "/foo", "foo.test.google.fr", deadline);
+ "/foo", "foo.test.google.fr", deadline, NULL);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -120,13 +121,16 @@ static void simple_delayed_request_body(grpc_end2end_test_config config,
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
@@ -134,15 +138,17 @@ static void simple_delayed_request_body(grpc_end2end_test_config config,
op->data.recv_status_on_client.status_details = &details;
op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1)));
+ error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
config.init_server(f, server_args);
- GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(f->server, &s,
- &call_details,
- &request_metadata_recv,
- f->cq, f->cq, tag(101)));
+ error =
+ grpc_server_request_call(f->server, &s, &call_details,
+ &request_metadata_recv, f->cq, f->cq, tag(101));
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv);
@@ -150,18 +156,22 @@ static void simple_delayed_request_body(grpc_end2end_test_config config,
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 0;
op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED;
op->data.send_status_from_server.status_details = "xyz";
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102)));
+ error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1);
cq_expect_completion(cqv, tag(1), 1);
diff --git a/test/core/end2end/tests/simple_request.c b/test/core/end2end/tests/simple_request.c
index d60a63e682..0f62d958ae 100644
--- a/test/core/end2end/tests/simple_request.c
+++ b/test/core/end2end/tests/simple_request.c
@@ -70,15 +70,15 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
- ev = grpc_completion_queue_next(cq, five_seconds_time());
+ ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
- GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
- GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5))
+ GPR_ASSERT(grpc_completion_queue_pluck(
+ f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -111,13 +111,15 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
grpc_metadata_array request_metadata_recv;
grpc_call_details call_details;
grpc_status_code status;
+ grpc_call_error error;
char *details = NULL;
size_t details_capacity = 0;
int was_cancelled = 2;
char *peer;
c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
- "/foo", "foo.test.google.fr:1234", deadline);
+ "/foo", "foo.test.google.fr:1234", deadline,
+ NULL);
GPR_ASSERT(c);
peer = grpc_call_get_peer(c);
@@ -134,13 +136,16 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
@@ -148,12 +153,15 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
op->data.recv_status_on_client.status_details = &details;
op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1)));
+ error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
- GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(
- f.server, &s, &call_details,
- &request_metadata_recv, f.cq, f.cq, tag(101)));
+ error =
+ grpc_server_request_call(f.server, &s, &call_details,
+ &request_metadata_recv, f.cq, f.cq, tag(101));
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv);
@@ -170,18 +178,22 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 0;
op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED;
op->data.send_status_from_server.status_details = "xyz";
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102)));
+ error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1);
cq_expect_completion(cqv, tag(1), 1);
diff --git a/test/core/end2end/tests/simple_request_with_high_initial_sequence_number.c b/test/core/end2end/tests/simple_request_with_high_initial_sequence_number.c
index 2244e22416..0067bb4bef 100644
--- a/test/core/end2end/tests/simple_request_with_high_initial_sequence_number.c
+++ b/test/core/end2end/tests/simple_request_with_high_initial_sequence_number.c
@@ -70,15 +70,15 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
- ev = grpc_completion_queue_next(cq, five_seconds_time());
+ ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
- GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
- GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5))
+ GPR_ASSERT(grpc_completion_queue_pluck(
+ f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -111,12 +111,14 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
grpc_metadata_array request_metadata_recv;
grpc_call_details call_details;
grpc_status_code status;
+ grpc_call_error error;
char *details = NULL;
size_t details_capacity = 0;
int was_cancelled = 2;
c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
- "/foo", "foo.test.google.fr:1234", deadline);
+ "/foo", "foo.test.google.fr:1234", deadline,
+ NULL);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -128,13 +130,16 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
@@ -142,12 +147,15 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
op->data.recv_status_on_client.status_details = &details;
op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1)));
+ error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
- GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(
- f.server, &s, &call_details,
- &request_metadata_recv, f.cq, f.cq, tag(101)));
+ error =
+ grpc_server_request_call(f.server, &s, &call_details,
+ &request_metadata_recv, f.cq, f.cq, tag(101));
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv);
@@ -155,18 +163,22 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 0;
op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED;
op->data.send_status_from_server.status_details = "xyz";
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102)));
+ error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1);
cq_expect_completion(cqv, tag(1), 1);
diff --git a/test/core/fling/client.c b/test/core/fling/client.c
index 17b737c9dd..54c9274510 100644
--- a/test/core/fling/client.c
+++ b/test/core/fling/client.c
@@ -91,24 +91,25 @@ static void init_ping_pong_request(void) {
static void step_ping_pong_request(void) {
call = grpc_channel_create_call(channel, NULL, GRPC_PROPAGATE_DEFAULTS, cq,
"/Reflector/reflectUnary", "localhost",
- gpr_inf_future(GPR_CLOCK_REALTIME));
+ gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_batch(call, ops, op - ops, (void *)1));
- grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME));
+ grpc_call_start_batch(call, ops, op - ops, (void *)1, NULL));
+ grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
grpc_call_destroy(call);
grpc_byte_buffer_destroy(response_payload_recv);
call = NULL;
}
static void init_ping_pong_stream(void) {
+ grpc_call_error error;
call = grpc_channel_create_call(channel, NULL, GRPC_PROPAGATE_DEFAULTS, cq,
"/Reflector/reflectStream", "localhost",
- gpr_inf_future(GPR_CLOCK_REALTIME));
+ gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
stream_init_op.op = GRPC_OP_SEND_INITIAL_METADATA;
stream_init_op.data.send_initial_metadata.count = 0;
- GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_batch(call, &stream_init_op, 1, (void *)1));
- grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME));
+ error = grpc_call_start_batch(call, &stream_init_op, 1, (void *)1, NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
+ grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -119,9 +120,10 @@ static void init_ping_pong_stream(void) {
}
static void step_ping_pong_stream(void) {
- GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_batch(call, stream_step_ops, 2, (void *)1));
- grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME));
+ grpc_call_error error;
+ error = grpc_call_start_batch(call, stream_step_ops, 2, (void *)1, NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
+ grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
grpc_byte_buffer_destroy(response_payload_recv);
}
@@ -152,6 +154,7 @@ int main(int argc, char **argv) {
int secure = 0;
char *target = "localhost:443";
gpr_cmdline *cl;
+ grpc_event event;
char *scenario_name = "ping-pong-request";
scenario sc = {NULL, NULL, NULL};
@@ -183,8 +186,8 @@ int main(int argc, char **argv) {
return 1;
}
- channel = grpc_insecure_channel_create(target, NULL);
- cq = grpc_completion_queue_create();
+ channel = grpc_insecure_channel_create(target, NULL, NULL);
+ cq = grpc_completion_queue_create(NULL);
the_buffer = grpc_raw_byte_buffer_create(&slice, payload_size);
histogram = gpr_histogram_create(0.01, 60e9);
@@ -210,9 +213,10 @@ int main(int argc, char **argv) {
grpc_channel_destroy(channel);
grpc_completion_queue_shutdown(cq);
- while (grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME))
- .type != GRPC_QUEUE_SHUTDOWN)
- ;
+ do {
+ event = grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME),
+ NULL);
+ } while (event.type != GRPC_QUEUE_SHUTDOWN);
grpc_completion_queue_destroy(cq);
grpc_byte_buffer_destroy(the_buffer);
gpr_slice_unref(slice);
diff --git a/test/core/fling/fling_test.c b/test/core/fling/fling_test.c
index f9ba461d24..29d9050704 100644
--- a/test/core/fling/fling_test.c
+++ b/test/core/fling/fling_test.c
@@ -57,22 +57,24 @@ int main(int argc, char **argv) {
strcpy(root, ".");
}
/* start the server */
- gpr_asprintf(&args[0], "%s/fling_server%s", root, gpr_subprocess_binary_extension());
+ gpr_asprintf(&args[0], "%s/fling_server%s", root,
+ gpr_subprocess_binary_extension());
args[1] = "--bind";
gpr_join_host_port(&args[2], "::", port);
args[3] = "--no-secure";
- svr = gpr_subprocess_create(4, (const char**)args);
+ svr = gpr_subprocess_create(4, (const char **)args);
gpr_free(args[0]);
gpr_free(args[2]);
/* start the client */
- gpr_asprintf(&args[0], "%s/fling_client%s", root, gpr_subprocess_binary_extension());
+ gpr_asprintf(&args[0], "%s/fling_client%s", root,
+ gpr_subprocess_binary_extension());
args[1] = "--target";
gpr_join_host_port(&args[2], "127.0.0.1", port);
args[3] = "--scenario=ping-pong-request";
args[4] = "--no-secure";
args[5] = 0;
- cli = gpr_subprocess_create(6, (const char**)args);
+ cli = gpr_subprocess_create(6, (const char **)args);
gpr_free(args[0]);
gpr_free(args[2]);
diff --git a/test/core/fling/server.c b/test/core/fling/server.c
index f445c68178..010217939d 100644
--- a/test/core/fling/server.c
+++ b/test/core/fling/server.c
@@ -97,6 +97,7 @@ static void request_call(void) {
static void handle_unary_method(void) {
grpc_op *op;
+ grpc_call_error error;
grpc_metadata_array_init(&initial_metadata_send);
@@ -122,41 +123,47 @@ static void handle_unary_method(void) {
op->data.recv_close_on_server.cancelled = &was_cancelled;
op++;
- GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_batch(call, unary_ops, op - unary_ops,
- tag(FLING_SERVER_BATCH_OPS_FOR_UNARY)));
+ error = grpc_call_start_batch(call, unary_ops, op - unary_ops,
+ tag(FLING_SERVER_BATCH_OPS_FOR_UNARY), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
}
static void send_initial_metadata(void) {
+ grpc_call_error error;
+ void *tagarg = tag(FLING_SERVER_SEND_INIT_METADATA_FOR_STREAMING);
grpc_metadata_array_init(&initial_metadata_send);
metadata_send_op.op = GRPC_OP_SEND_INITIAL_METADATA;
metadata_send_op.data.send_initial_metadata.count = 0;
- GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_batch(
- call, &metadata_send_op, 1,
- tag(FLING_SERVER_SEND_INIT_METADATA_FOR_STREAMING)));
+ error = grpc_call_start_batch(call, &metadata_send_op, 1, tagarg, NULL);
+
+ GPR_ASSERT(GRPC_CALL_OK == error);
}
static void start_read_op(int t) {
+ grpc_call_error error;
/* Starting read at server */
read_op.op = GRPC_OP_RECV_MESSAGE;
read_op.data.recv_message = &payload_buffer;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call, &read_op, 1, tag(t)));
+ error = grpc_call_start_batch(call, &read_op, 1, tag(t), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
}
static void start_write_op(void) {
+ grpc_call_error error;
+ void *tagarg = tag(FLING_SERVER_WRITE_FOR_STREAMING);
/* Starting write at server */
write_op.op = GRPC_OP_SEND_MESSAGE;
if (payload_buffer == NULL) {
gpr_log(GPR_INFO, "NULL payload buffer !!!");
}
write_op.data.send_message = payload_buffer;
- GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_batch(call, &write_op, 1,
- tag(FLING_SERVER_WRITE_FOR_STREAMING)));
+ error = grpc_call_start_batch(call, &write_op, 1, tagarg, NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
}
static void start_send_status(void) {
+ grpc_call_error error;
+ void *tagarg = tag(FLING_SERVER_SEND_STATUS_FOR_STREAMING);
status_op[0].op = GRPC_OP_SEND_STATUS_FROM_SERVER;
status_op[0].data.send_status_from_server.status = GRPC_STATUS_OK;
status_op[0].data.send_status_from_server.trailing_metadata_count = 0;
@@ -164,9 +171,8 @@ static void start_send_status(void) {
status_op[1].op = GRPC_OP_RECV_CLOSE_ON_SERVER;
status_op[1].data.recv_close_on_server.cancelled = &was_cancelled;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(
- call, status_op, 2,
- tag(FLING_SERVER_SEND_STATUS_FOR_STREAMING)));
+ error = grpc_call_start_batch(call, status_op, 2, tagarg, NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
}
/* We have some sort of deadlock, so let's not exit gracefully for now.
@@ -205,20 +211,20 @@ int main(int argc, char **argv) {
}
gpr_log(GPR_INFO, "creating server on: %s", addr);
- cq = grpc_completion_queue_create();
+ cq = grpc_completion_queue_create(NULL);
if (secure) {
grpc_ssl_pem_key_cert_pair pem_key_cert_pair = {test_server1_key,
test_server1_cert};
grpc_server_credentials *ssl_creds =
grpc_ssl_server_credentials_create(NULL, &pem_key_cert_pair, 1, 0);
- server = grpc_server_create(NULL);
+ server = grpc_server_create(NULL, NULL);
GPR_ASSERT(grpc_server_add_secure_http2_port(server, addr, ssl_creds));
grpc_server_credentials_release(ssl_creds);
} else {
- server = grpc_server_create(NULL);
+ server = grpc_server_create(NULL, NULL);
GPR_ASSERT(grpc_server_add_insecure_http2_port(server, addr));
}
- grpc_server_register_completion_queue(server, cq);
+ grpc_server_register_completion_queue(server, cq, NULL);
grpc_server_start(server);
gpr_free(addr_buf);
@@ -235,14 +241,15 @@ int main(int argc, char **argv) {
gpr_log(GPR_INFO, "Shutting down due to SIGINT");
grpc_server_shutdown_and_notify(server, cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck(
- cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5))
+ cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL)
.type == GRPC_OP_COMPLETE);
grpc_completion_queue_shutdown(cq);
shutdown_started = 1;
}
ev = grpc_completion_queue_next(
cq, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME),
- gpr_time_from_micros(1000000, GPR_TIMESPAN)));
+ gpr_time_from_micros(1000000, GPR_TIMESPAN)),
+ NULL);
s = ev.tag;
switch (ev.type) {
case GRPC_OP_COMPLETE:
diff --git a/test/core/httpcli/format_request_test.c b/test/core/httpcli/format_request_test.c
index da850049e2..82b2ccb122 100644
--- a/test/core/httpcli/format_request_test.c
+++ b/test/core/httpcli/format_request_test.c
@@ -142,8 +142,7 @@ static void test_format_post_request_content_type_override(void) {
"POST /index.html HTTP/1.0\r\n"
"Host: example.com\r\n"
"Connection: close\r\n"
- "User-Agent: " GRPC_HTTPCLI_USER_AGENT
- "\r\n"
+ "User-Agent: " GRPC_HTTPCLI_USER_AGENT "\r\n"
"x-yz: abc\r\n"
"Content-Type: application/x-www-form-urlencoded\r\n"
"Content-Length: 11\r\n"
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
new file mode 100644
index 0000000000..471d5b50c7
--- /dev/null
+++ b/test/core/iomgr/udp_server_test.c
@@ -0,0 +1,179 @@
+/*
+ *
+ * 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 "src/core/iomgr/udp_server.h"
+#include "src/core/iomgr/iomgr.h"
+#include <grpc/support/log.h>
+#include <grpc/support/sync.h>
+#include <grpc/support/time.h>
+#include "test/core/util/test_config.h"
+
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <string.h>
+#include <unistd.h>
+
+#define LOG_TEST(x) gpr_log(GPR_INFO, "%s", #x)
+
+static grpc_pollset g_pollset;
+static int g_number_of_reads = 0;
+static int g_number_of_bytes_read = 0;
+
+static void on_connect(void *arg, grpc_endpoint *udp) {}
+
+static void on_read(int fd, grpc_udp_server_cb new_transport_cb, void *cb_arg) {
+ char read_buffer[512];
+ int byte_count;
+
+ gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset));
+ byte_count = recv(fd, read_buffer, sizeof(read_buffer), 0);
+
+ g_number_of_reads++;
+ g_number_of_bytes_read += byte_count;
+
+ grpc_pollset_kick(&g_pollset, NULL);
+ gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset));
+}
+
+static void test_no_op(void) {
+ grpc_udp_server *s = grpc_udp_server_create();
+ grpc_udp_server_destroy(s, NULL, NULL);
+}
+
+static void test_no_op_with_start(void) {
+ grpc_udp_server *s = grpc_udp_server_create();
+ LOG_TEST("test_no_op_with_start");
+ grpc_udp_server_start(s, NULL, 0, on_connect, NULL);
+ grpc_udp_server_destroy(s, NULL, NULL);
+}
+
+static void test_no_op_with_port(void) {
+ struct sockaddr_in addr;
+ grpc_udp_server *s = grpc_udp_server_create();
+ LOG_TEST("test_no_op_with_port");
+
+ memset(&addr, 0, sizeof(addr));
+ addr.sin_family = AF_INET;
+ GPR_ASSERT(grpc_udp_server_add_port(s, (struct sockaddr *)&addr, sizeof(addr),
+ on_read));
+
+ grpc_udp_server_destroy(s, NULL, NULL);
+}
+
+static void test_no_op_with_port_and_start(void) {
+ struct sockaddr_in addr;
+ grpc_udp_server *s = grpc_udp_server_create();
+ LOG_TEST("test_no_op_with_port_and_start");
+
+ memset(&addr, 0, sizeof(addr));
+ addr.sin_family = AF_INET;
+ GPR_ASSERT(grpc_udp_server_add_port(s, (struct sockaddr *)&addr, sizeof(addr),
+ on_read));
+
+ grpc_udp_server_start(s, NULL, 0, on_connect, NULL);
+
+ grpc_udp_server_destroy(s, NULL, NULL);
+}
+
+static void test_receive(int number_of_clients) {
+ struct sockaddr_storage addr;
+ socklen_t addr_len = sizeof(addr);
+ int clifd, svrfd;
+ grpc_udp_server *s = grpc_udp_server_create();
+ int i;
+ int number_of_reads_before;
+ gpr_timespec deadline;
+ grpc_pollset *pollsets[1];
+ LOG_TEST("test_receive");
+ gpr_log(GPR_INFO, "clients=%d", number_of_clients);
+
+ g_number_of_bytes_read = 0;
+
+ memset(&addr, 0, sizeof(addr));
+ addr.ss_family = AF_INET;
+ GPR_ASSERT(
+ grpc_udp_server_add_port(s, (struct sockaddr *)&addr, addr_len, on_read));
+
+ svrfd = grpc_udp_server_get_fd(s, 0);
+ GPR_ASSERT(svrfd >= 0);
+ GPR_ASSERT(getsockname(svrfd, (struct sockaddr *)&addr, &addr_len) == 0);
+ GPR_ASSERT(addr_len <= sizeof(addr));
+
+ pollsets[0] = &g_pollset;
+ grpc_udp_server_start(s, pollsets, 1, on_connect, NULL);
+
+ gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset));
+
+ for (i = 0; i < number_of_clients; i++) {
+ deadline = GRPC_TIMEOUT_SECONDS_TO_DEADLINE(4000);
+
+ number_of_reads_before = g_number_of_reads;
+ /* Create a socket, send a packet to the UDP server. */
+ clifd = socket(addr.ss_family, SOCK_DGRAM, 0);
+ GPR_ASSERT(clifd >= 0);
+ GPR_ASSERT(connect(clifd, (struct sockaddr *)&addr, addr_len) == 0);
+ GPR_ASSERT(5 == write(clifd, "hello", 5));
+ 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, gpr_now(GPR_CLOCK_MONOTONIC),
+ deadline);
+ }
+ GPR_ASSERT(g_number_of_reads == number_of_reads_before + 1);
+ close(clifd);
+ }
+ GPR_ASSERT(g_number_of_bytes_read == 5 * number_of_clients);
+
+ gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset));
+
+ grpc_udp_server_destroy(s, NULL, NULL);
+}
+
+static void destroy_pollset(void *p) { grpc_pollset_destroy(p); }
+
+int main(int argc, char **argv) {
+ grpc_test_init(argc, argv);
+ grpc_iomgr_init();
+ grpc_pollset_init(&g_pollset);
+
+ test_no_op();
+ test_no_op_with_start();
+ test_no_op_with_port();
+ test_no_op_with_port_and_start();
+ test_receive(1);
+ test_receive(10);
+
+ grpc_pollset_shutdown(&g_pollset, destroy_pollset, &g_pollset);
+ grpc_iomgr_shutdown();
+ return 0;
+}
diff --git a/test/core/json/json_test.c b/test/core/json/json_test.c
index 3033419118..a500effcea 100644
--- a/test/core/json/json_test.c
+++ b/test/core/json/json_test.c
@@ -66,7 +66,7 @@ static testing_pair testing_pairs[] = {
{"\"\\ud834\\udd1e\"", "\"\\ud834\\udd1e\""},
/* Testing nested empty containers. */
{
- " [ [ ] , { } , [ ] ] ", "[[],{},[]]",
+ " [ [ ] , { } , [ ] ] ", "[[],{},[]]",
},
/* Testing escapes and control chars in key strings. */
{" { \"\x7f\\n\\\\a , b\": 1, \"\": 0 } ",
diff --git a/test/core/security/auth_context_test.c b/test/core/security/auth_context_test.c
index d785eb6064..d091c7e7e6 100644
--- a/test/core/security/auth_context_test.c
+++ b/test/core/security/auth_context_test.c
@@ -151,4 +151,3 @@ int main(int argc, char **argv) {
test_chained_context();
return 0;
}
-
diff --git a/test/core/security/json_token_test.c b/test/core/security/json_token_test.c
index da57cef15c..0bac61eb54 100644
--- a/test/core/security/json_token_test.c
+++ b/test/core/security/json_token_test.c
@@ -263,8 +263,8 @@ static void check_jwt_header(grpc_json *header) {
GPR_ASSERT(kid != NULL);
GPR_ASSERT(kid->type == GRPC_JSON_STRING);
- GPR_ASSERT(strcmp(kid->value,
- "e6b5137873db8d2ef81e06a47289e6434ec8a165") == 0);
+ GPR_ASSERT(strcmp(kid->value, "e6b5137873db8d2ef81e06a47289e6434ec8a165") ==
+ 0);
}
static void check_jwt_claim(grpc_json *claim, const char *expected_audience,
@@ -298,9 +298,11 @@ static void check_jwt_claim(grpc_json *claim, const char *expected_audience,
GPR_ASSERT(iss != NULL);
GPR_ASSERT(iss->type == GRPC_JSON_STRING);
- GPR_ASSERT(strcmp(iss->value,
- "777-abaslkan11hlb6nmim3bpspl31ud@developer.gserviceaccount.com")
- ==0);
+ GPR_ASSERT(
+ strcmp(
+ iss->value,
+ "777-abaslkan11hlb6nmim3bpspl31ud@developer.gserviceaccount.com") ==
+ 0);
if (expected_scope != NULL) {
GPR_ASSERT(scope != NULL);
diff --git a/test/core/security/jwt_verifier_test.c b/test/core/security/jwt_verifier_test.c
index 440286ea1a..5cc8b2e9be 100644
--- a/test/core/security/jwt_verifier_test.c
+++ b/test/core/security/jwt_verifier_test.c
@@ -93,8 +93,7 @@ static const char json_key_str_part3_for_custom_email_issuer[] =
"com\", \"type\": \"service_account\" }";
static grpc_jwt_verifier_email_domain_key_url_mapping custom_mapping = {
- "bar.com", "keys.bar.com/jwk"
-};
+ "bar.com", "keys.bar.com/jwk"};
static const char expected_user_data[] = "user data";
@@ -153,7 +152,7 @@ static const char expired_claims[] =
" \"iss\": \"blah.foo.com\","
" \"sub\": \"juju@blah.foo.com\","
" \"jti\": \"jwtuniqueid\","
- " \"iat\": 100," /* Way back in the past... */
+ " \"iat\": 100," /* Way back in the past... */
" \"exp\": 120,"
" \"nbf\": 60,"
" \"foo\": \"bar\"}";
@@ -316,8 +315,8 @@ static void test_jwt_verifier_google_email_issuer_success(void) {
GPR_ASSERT(grpc_auth_json_key_is_valid(&key));
grpc_httpcli_set_override(httpcli_get_google_keys_for_email,
httpcli_post_should_not_be_called);
- jwt =
- grpc_jwt_encode_and_sign(&key, expected_audience, expected_lifetime, NULL);
+ jwt = grpc_jwt_encode_and_sign(&key, expected_audience, expected_lifetime,
+ NULL);
grpc_auth_json_key_destruct(&key);
GPR_ASSERT(jwt != NULL);
grpc_jwt_verifier_verify(verifier, NULL, jwt, expected_audience,
@@ -348,8 +347,8 @@ static void test_jwt_verifier_custom_email_issuer_success(void) {
GPR_ASSERT(grpc_auth_json_key_is_valid(&key));
grpc_httpcli_set_override(httpcli_get_custom_keys_for_email,
httpcli_post_should_not_be_called);
- jwt =
- grpc_jwt_encode_and_sign(&key, expected_audience, expected_lifetime, NULL);
+ jwt = grpc_jwt_encode_and_sign(&key, expected_audience, expected_lifetime,
+ NULL);
grpc_auth_json_key_destruct(&key);
GPR_ASSERT(jwt != NULL);
grpc_jwt_verifier_verify(verifier, NULL, jwt, expected_audience,
@@ -359,9 +358,10 @@ static void test_jwt_verifier_custom_email_issuer_success(void) {
grpc_httpcli_set_override(NULL, NULL);
}
-static int httpcli_get_jwk_set(
- const grpc_httpcli_request *request, gpr_timespec deadline,
- grpc_httpcli_response_cb on_response, void *user_data) {
+static int httpcli_get_jwk_set(const grpc_httpcli_request *request,
+ gpr_timespec deadline,
+ grpc_httpcli_response_cb on_response,
+ void *user_data) {
grpc_httpcli_response response = http_response(200, gpr_strdup(good_jwk_set));
GPR_ASSERT(request->handshaker == &grpc_httpcli_ssl);
GPR_ASSERT(strcmp(request->host, "www.googleapis.com") == 0);
@@ -396,8 +396,8 @@ static void test_jwt_verifier_url_issuer_success(void) {
GPR_ASSERT(grpc_auth_json_key_is_valid(&key));
grpc_httpcli_set_override(httpcli_get_openid_config,
httpcli_post_should_not_be_called);
- jwt =
- grpc_jwt_encode_and_sign(&key, expected_audience, expected_lifetime, NULL);
+ jwt = grpc_jwt_encode_and_sign(&key, expected_audience, expected_lifetime,
+ NULL);
grpc_auth_json_key_destruct(&key);
GPR_ASSERT(jwt != NULL);
grpc_jwt_verifier_verify(verifier, NULL, jwt, expected_audience,
@@ -436,8 +436,8 @@ static void test_jwt_verifier_url_issuer_bad_config(void) {
GPR_ASSERT(grpc_auth_json_key_is_valid(&key));
grpc_httpcli_set_override(httpcli_get_bad_json,
httpcli_post_should_not_be_called);
- jwt =
- grpc_jwt_encode_and_sign(&key, expected_audience, expected_lifetime, NULL);
+ jwt = grpc_jwt_encode_and_sign(&key, expected_audience, expected_lifetime,
+ NULL);
grpc_auth_json_key_destruct(&key);
GPR_ASSERT(jwt != NULL);
grpc_jwt_verifier_verify(verifier, NULL, jwt, expected_audience,
@@ -457,8 +457,8 @@ static void test_jwt_verifier_bad_json_key(void) {
GPR_ASSERT(grpc_auth_json_key_is_valid(&key));
grpc_httpcli_set_override(httpcli_get_bad_json,
httpcli_post_should_not_be_called);
- jwt =
- grpc_jwt_encode_and_sign(&key, expected_audience, expected_lifetime, NULL);
+ jwt = grpc_jwt_encode_and_sign(&key, expected_audience, expected_lifetime,
+ NULL);
grpc_auth_json_key_destruct(&key);
GPR_ASSERT(jwt != NULL);
grpc_jwt_verifier_verify(verifier, NULL, jwt, expected_audience,
@@ -503,8 +503,8 @@ static void test_jwt_verifier_bad_signature(void) {
GPR_ASSERT(grpc_auth_json_key_is_valid(&key));
grpc_httpcli_set_override(httpcli_get_openid_config,
httpcli_post_should_not_be_called);
- jwt =
- grpc_jwt_encode_and_sign(&key, expected_audience, expected_lifetime, NULL);
+ jwt = grpc_jwt_encode_and_sign(&key, expected_audience, expected_lifetime,
+ NULL);
grpc_auth_json_key_destruct(&key);
corrupt_jwt_sig(jwt);
GPR_ASSERT(jwt != NULL);
@@ -546,7 +546,6 @@ static void test_jwt_verifier_bad_format(void) {
/* bad signature custom provided email*/
/* bad key */
-
int main(int argc, char **argv) {
grpc_test_init(argc, argv);
test_claims_success();
@@ -562,4 +561,3 @@ int main(int argc, char **argv) {
test_jwt_verifier_bad_format();
return 0;
}
-
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 7238efbbfd..753221cada 100644
--- a/test/core/security/print_google_default_creds_token.c
+++ b/test/core/security/print_google_default_creds_token.c
@@ -49,8 +49,7 @@ typedef struct {
int is_done;
} synchronizer;
-static void on_metadata_response(void *user_data,
- grpc_credentials_md *md_elems,
+static void on_metadata_response(void *user_data, grpc_credentials_md *md_elems,
size_t num_md,
grpc_credentials_status status) {
synchronizer *sync = user_data;
@@ -97,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/security_connector_test.c b/test/core/security/security_connector_test.c
index b37fd7213d..3f6c592b0b 100644
--- a/test/core/security/security_connector_test.c
+++ b/test/core/security/security_connector_test.c
@@ -77,9 +77,9 @@ static void test_unauthenticated_ssl_peer(void) {
}
static int check_identity(const grpc_auth_context *ctx,
- const char *expected_property_name,
- const char **expected_identities,
- size_t num_identities) {
+ const char *expected_property_name,
+ const char **expected_identities,
+ size_t num_identities) {
grpc_auth_property_iterator it;
const grpc_auth_property *prop;
size_t i;
@@ -166,7 +166,8 @@ static void test_cn_and_one_san_ssl_peer_to_auth_context(void) {
ctx = tsi_ssl_peer_to_auth_context(&peer);
GPR_ASSERT(ctx != NULL);
GPR_ASSERT(grpc_auth_context_peer_is_authenticated(ctx));
- GPR_ASSERT(check_identity(ctx, GRPC_X509_SAN_PROPERTY_NAME, &expected_san, 1));
+ GPR_ASSERT(
+ check_identity(ctx, GRPC_X509_SAN_PROPERTY_NAME, &expected_san, 1));
GPR_ASSERT(check_transport_security_type(ctx));
GPR_ASSERT(check_x509_cn(ctx, expected_cn));
diff --git a/test/core/security/verify_jwt.c b/test/core/security/verify_jwt.c
index 69bbc3cc0c..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));
@@ -120,4 +120,3 @@ int main(int argc, char **argv) {
gpr_cmdline_destroy(cl);
return !sync.success;
}
-
diff --git a/test/core/statistics/census_log_tests.h b/test/core/statistics/census_log_tests.h
index 28bde086f3..ec3241b4f9 100644
--- a/test/core/statistics/census_log_tests.h
+++ b/test/core/statistics/census_log_tests.h
@@ -48,4 +48,4 @@ void test_multiple_writers();
void test_performance();
void test_small_log();
-#endif /* GRPC_TEST_CORE_STATISTICS_CENSUS_LOG_TESTS_H */
+#endif /* GRPC_TEST_CORE_STATISTICS_CENSUS_LOG_TESTS_H */
diff --git a/test/core/statistics/hash_table_test.c b/test/core/statistics/hash_table_test.c
index 1e9e1c8d23..2568e96cba 100644
--- a/test/core/statistics/hash_table_test.c
+++ b/test/core/statistics/hash_table_test.c
@@ -65,8 +65,8 @@ static void free_data(void* data) { gpr_free(data); }
static void test_create_table(void) {
/* Create table with uint64 key type */
census_ht* ht = NULL;
- census_ht_option ht_options = {CENSUS_HT_UINT64, 1999, NULL,
- NULL, NULL, NULL};
+ census_ht_option ht_options = {
+ CENSUS_HT_UINT64, 1999, NULL, NULL, NULL, NULL};
ht = census_ht_create(&ht_options);
GPR_ASSERT(ht != NULL);
GPR_ASSERT(census_ht_get_size(ht) == 0);
@@ -97,7 +97,7 @@ static void test_table_with_int_key(void) {
for (i = 0; i < 20; ++i) {
census_ht_key key;
key.val = i;
- census_ht_insert(ht, key, (void*)(gpr_intptr) i);
+ census_ht_insert(ht, key, (void*)(gpr_intptr)i);
GPR_ASSERT(census_ht_get_size(ht) == i + 1);
}
for (i = 0; i < 20; i++) {
@@ -105,7 +105,7 @@ static void test_table_with_int_key(void) {
census_ht_key key;
key.val = i;
val = census_ht_find(ht, key);
- GPR_ASSERT(val == (void*)(gpr_intptr) i);
+ GPR_ASSERT(val == (void*)(gpr_intptr)i);
}
elements = census_ht_get_all_elements(ht, &num_elements);
GPR_ASSERT(elements != NULL);
@@ -212,9 +212,9 @@ static void test_table_with_string_key(void) {
census_ht_option opt = {CENSUS_HT_POINTER, 7, &hash64,
&cmp_str_keys, NULL, NULL};
census_ht* ht = census_ht_create(&opt);
- const char* keys[] = {"k1", "a", "000",
- "apple", "banana_a_long_long_long_banana", "%$",
- "111", "foo", "b"};
+ const char* keys[] = {
+ "k1", "a", "000", "apple", "banana_a_long_long_long_banana",
+ "%$", "111", "foo", "b"};
const int vals[] = {0, 1, 2, 3, 4, 5, 6, 7, 8};
int i = 0;
GPR_ASSERT(ht != NULL);
diff --git a/test/core/support/cancellable_test.c b/test/core/support/cancellable_test.c
deleted file mode 100644
index 9b321d388e..0000000000
--- a/test/core/support/cancellable_test.c
+++ /dev/null
@@ -1,172 +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.
- *
- */
-
-/* Test of gpr_cancellable. */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <grpc/support/log.h>
-#include <grpc/support/sync.h>
-#include <grpc/support/thd.h>
-#include <grpc/support/time.h>
-#include "test/core/util/test_config.h"
-
-struct test {
- gpr_mu mu;
- gpr_cv cv;
- gpr_event ev;
- gpr_event done;
- gpr_cancellable cancel;
- int n;
-};
-
-/* A thread body. Wait until t->cancel is cancelledm then
- decrement t->n. If t->n becomes 0, set t->done. */
-static void thd_body(void *v) {
- struct test *t = v;
- gpr_mu_lock(&t->mu);
- while (!gpr_cv_cancellable_wait(
- &t->cv, &t->mu, gpr_inf_future(GPR_CLOCK_REALTIME), &t->cancel)) {
- }
- t->n--;
- if (t->n == 0) {
- gpr_event_set(&t->done, (void *)1);
- }
- gpr_mu_unlock(&t->mu);
-}
-
-static void test(void) {
- int i;
- gpr_thd_id thd;
- struct test t;
- int n = 1;
- gpr_timespec interval;
-
- gpr_mu_init(&t.mu);
- gpr_cv_init(&t.cv);
- gpr_event_init(&t.ev);
- gpr_event_init(&t.done);
- gpr_cancellable_init(&t.cancel);
-
- /* A gpr_cancellable starts not cancelled. */
- GPR_ASSERT(!gpr_cancellable_is_cancelled(&t.cancel));
-
- /* Test timeout on event wait for uncancelled gpr_cancellable */
- interval = gpr_now(GPR_CLOCK_REALTIME);
- gpr_event_cancellable_wait(
- &t.ev, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME),
- gpr_time_from_micros(1000000, GPR_TIMESPAN)),
- &t.cancel);
- interval = gpr_time_sub(gpr_now(GPR_CLOCK_REALTIME), interval);
- GPR_ASSERT(
- gpr_time_cmp(interval, gpr_time_from_micros(500000, GPR_TIMESPAN)) >= 0);
- GPR_ASSERT(
- gpr_time_cmp(gpr_time_from_micros(2000000, GPR_TIMESPAN), interval) >= 0);
-
- /* Test timeout on cv wait for uncancelled gpr_cancellable */
- gpr_mu_lock(&t.mu);
- interval = gpr_now(GPR_CLOCK_REALTIME);
- while (!gpr_cv_cancellable_wait(
- &t.cv, &t.mu, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME),
- gpr_time_from_micros(1000000, GPR_TIMESPAN)),
- &t.cancel)) {
- }
- interval = gpr_time_sub(gpr_now(GPR_CLOCK_REALTIME), interval);
- GPR_ASSERT(
- gpr_time_cmp(interval, gpr_time_from_micros(500000, GPR_TIMESPAN)) >= 0);
- GPR_ASSERT(
- gpr_time_cmp(gpr_time_from_micros(2000000, GPR_TIMESPAN), interval) >= 0);
- gpr_mu_unlock(&t.mu);
-
- /* Create some threads. They all wait until cancelled; the last to finish
- sets t.done. */
- t.n = n;
- for (i = 0; i != n; i++) {
- GPR_ASSERT(gpr_thd_new(&thd, &thd_body, &t, NULL));
- }
- /* Check that t.cancel still is not cancelled. */
- GPR_ASSERT(!gpr_cancellable_is_cancelled(&t.cancel));
-
- /* Wait a second, and check that no threads have finished waiting. */
- gpr_mu_lock(&t.mu);
- gpr_cv_wait(&t.cv, &t.mu,
- gpr_time_add(gpr_now(GPR_CLOCK_REALTIME),
- gpr_time_from_micros(1000000, GPR_TIMESPAN)));
- GPR_ASSERT(t.n == n);
- gpr_mu_unlock(&t.mu);
-
- /* Check that t.cancel still is not cancelled, but when
- cancelled it retports that it is cacncelled. */
- GPR_ASSERT(!gpr_cancellable_is_cancelled(&t.cancel));
- gpr_cancellable_cancel(&t.cancel);
- GPR_ASSERT(gpr_cancellable_is_cancelled(&t.cancel));
-
- /* Wait for threads to finish. */
- gpr_event_wait(&t.done, gpr_inf_future(GPR_CLOCK_REALTIME));
- GPR_ASSERT(t.n == 0);
-
- /* Test timeout on cv wait for cancelled gpr_cancellable */
- gpr_mu_lock(&t.mu);
- interval = gpr_now(GPR_CLOCK_REALTIME);
- while (!gpr_cv_cancellable_wait(
- &t.cv, &t.mu, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME),
- gpr_time_from_micros(1000000, GPR_TIMESPAN)),
- &t.cancel)) {
- }
- interval = gpr_time_sub(gpr_now(GPR_CLOCK_REALTIME), interval);
- GPR_ASSERT(
- gpr_time_cmp(gpr_time_from_micros(100000, GPR_TIMESPAN), interval) >= 0);
- gpr_mu_unlock(&t.mu);
-
- /* Test timeout on event wait for cancelled gpr_cancellable */
- interval = gpr_now(GPR_CLOCK_REALTIME);
- gpr_event_cancellable_wait(
- &t.ev, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME),
- gpr_time_from_micros(1000000, GPR_TIMESPAN)),
- &t.cancel);
- interval = gpr_time_sub(gpr_now(GPR_CLOCK_REALTIME), interval);
- GPR_ASSERT(
- gpr_time_cmp(gpr_time_from_micros(100000, GPR_TIMESPAN), interval) >= 0);
-
- gpr_mu_destroy(&t.mu);
- gpr_cv_destroy(&t.cv);
- gpr_cancellable_destroy(&t.cancel);
-}
-
-/* ------------------------------------------------- */
-
-int main(int argc, char *argv[]) {
- grpc_test_init(argc, argv);
- test();
- return 0;
-}
diff --git a/test/core/support/cmdline_test.c b/test/core/support/cmdline_test.c
index 26153b192c..1c77c15233 100644
--- a/test/core/support/cmdline_test.c
+++ b/test/core/support/cmdline_test.c
@@ -287,8 +287,9 @@ static void test_usage(void) {
gpr_cmdline_add_flag(cl, "flag", NULL, &flag);
usage = gpr_cmdline_usage_string(cl, "test");
- GPR_ASSERT(0 == strcmp(usage,
- "Usage: test [--str=string] [--x=int] [--flag|--no-flag]\n"));
+ GPR_ASSERT(
+ 0 == strcmp(usage,
+ "Usage: test [--str=string] [--x=int] [--flag|--no-flag]\n"));
gpr_free(usage);
gpr_cmdline_destroy(cl);
diff --git a/test/core/support/string_test.c b/test/core/support/string_test.c
index 9023d0746b..f62cbe3435 100644
--- a/test/core/support/string_test.c
+++ b/test/core/support/string_test.c
@@ -71,7 +71,7 @@ static void test_dump(void) {
expect_dump("\x01", 1, GPR_DUMP_HEX | GPR_DUMP_ASCII, "01 '.'");
expect_dump("\x01\x02", 2, GPR_DUMP_HEX, "01 02");
expect_dump("\x01\x23\x45\x67\x89\xab\xcd\xef", 8, GPR_DUMP_HEX,
- "01 23 45 67 89 ab cd ef");
+ "01 23 45 67 89 ab cd ef");
expect_dump("ab", 2, GPR_DUMP_HEX | GPR_DUMP_ASCII, "61 62 'ab'");
}
@@ -221,7 +221,7 @@ static void test_strjoin_sep(void) {
}
static void test_strsplit(void) {
- gpr_slice_buffer* parts;
+ gpr_slice_buffer *parts;
gpr_slice str;
LOG_TEST_NAME("test_strsplit");
diff --git a/test/core/support/thd_test.c b/test/core/support/thd_test.c
index 7232cd9f5b..faba33c5e8 100644
--- a/test/core/support/thd_test.c
+++ b/test/core/support/thd_test.c
@@ -60,7 +60,7 @@ static void thd_body(void *v) {
gpr_mu_unlock(&t->mu);
}
-static void thd_body_joinable(void *v) { }
+static void thd_body_joinable(void *v) {}
/* Test that we can create a number of threads and wait for them. */
static void test(void) {
diff --git a/test/core/surface/completion_queue_test.c b/test/core/surface/completion_queue_test.c
index 0e59ea4b22..a5298a25e0 100644
--- a/test/core/surface/completion_queue_test.c
+++ b/test/core/surface/completion_queue_test.c
@@ -52,7 +52,7 @@ static void *create_test_tag(void) {
static void shutdown_and_destroy(grpc_completion_queue *cc) {
grpc_event ev;
grpc_completion_queue_shutdown(cc);
- ev = grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME));
+ ev = grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME), NULL);
GPR_ASSERT(ev.type == GRPC_QUEUE_SHUTDOWN);
grpc_completion_queue_destroy(cc);
}
@@ -60,17 +60,18 @@ static void shutdown_and_destroy(grpc_completion_queue *cc) {
/* ensure we can create and destroy a completion channel */
static void test_no_op(void) {
LOG_TEST("test_no_op");
- shutdown_and_destroy(grpc_completion_queue_create());
+ shutdown_and_destroy(grpc_completion_queue_create(NULL));
}
static void test_wait_empty(void) {
grpc_completion_queue *cc;
+ grpc_event event;
LOG_TEST("test_wait_empty");
- cc = grpc_completion_queue_create();
- GPR_ASSERT(grpc_completion_queue_next(cc, gpr_now(GPR_CLOCK_REALTIME)).type ==
- GRPC_QUEUE_TIMEOUT);
+ cc = grpc_completion_queue_create(NULL);
+ event = grpc_completion_queue_next(cc, gpr_now(GPR_CLOCK_REALTIME), NULL);
+ GPR_ASSERT(event.type == GRPC_QUEUE_TIMEOUT);
shutdown_and_destroy(cc);
}
@@ -84,12 +85,12 @@ static void test_cq_end_op(void) {
LOG_TEST("test_cq_end_op");
- cc = grpc_completion_queue_create();
+ cc = grpc_completion_queue_create(NULL);
grpc_cq_begin_op(cc);
grpc_cq_end_op(cc, tag, 1, do_nothing_end_completion, NULL, &completion);
- ev = grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME));
+ ev = grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME), NULL);
GPR_ASSERT(ev.type == GRPC_OP_COMPLETE);
GPR_ASSERT(ev.tag == tag);
GPR_ASSERT(ev.success);
@@ -99,23 +100,27 @@ static void test_cq_end_op(void) {
static void test_shutdown_then_next_polling(void) {
grpc_completion_queue *cc;
+ grpc_event event;
LOG_TEST("test_shutdown_then_next_polling");
- cc = grpc_completion_queue_create();
+ cc = grpc_completion_queue_create(NULL);
grpc_completion_queue_shutdown(cc);
- GPR_ASSERT(grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME))
- .type == GRPC_QUEUE_SHUTDOWN);
+ event =
+ grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME), NULL);
+ GPR_ASSERT(event.type == GRPC_QUEUE_SHUTDOWN);
grpc_completion_queue_destroy(cc);
}
static void test_shutdown_then_next_with_timeout(void) {
grpc_completion_queue *cc;
+ grpc_event event;
LOG_TEST("test_shutdown_then_next_with_timeout");
- cc = grpc_completion_queue_create();
+ cc = grpc_completion_queue_create(NULL);
grpc_completion_queue_shutdown(cc);
- GPR_ASSERT(grpc_completion_queue_next(cc, gpr_inf_future(GPR_CLOCK_REALTIME))
- .type == GRPC_QUEUE_SHUTDOWN);
+ event =
+ grpc_completion_queue_next(cc, gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
+ GPR_ASSERT(event.type == GRPC_QUEUE_SHUTDOWN);
grpc_completion_queue_destroy(cc);
}
@@ -135,7 +140,7 @@ static void test_pluck(void) {
}
}
- cc = grpc_completion_queue_create();
+ cc = grpc_completion_queue_create(NULL);
for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) {
grpc_cq_begin_op(cc);
@@ -145,7 +150,7 @@ static void test_pluck(void) {
for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) {
ev = grpc_completion_queue_pluck(cc, tags[i],
- gpr_inf_past(GPR_CLOCK_REALTIME));
+ gpr_inf_past(GPR_CLOCK_REALTIME), NULL);
GPR_ASSERT(ev.tag == tags[i]);
}
@@ -157,7 +162,7 @@ static void test_pluck(void) {
for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) {
ev = grpc_completion_queue_pluck(cc, tags[GPR_ARRAY_SIZE(tags) - i - 1],
- gpr_inf_past(GPR_CLOCK_REALTIME));
+ gpr_inf_past(GPR_CLOCK_REALTIME), NULL);
GPR_ASSERT(ev.tag == tags[GPR_ARRAY_SIZE(tags) - i - 1]);
}
@@ -229,7 +234,7 @@ static void consumer_thread(void *arg) {
gpr_log(GPR_INFO, "consumer %d phase 2", opt->id);
for (;;) {
- ev = grpc_completion_queue_next(opt->cc, ten_seconds_time());
+ ev = grpc_completion_queue_next(opt->cc, ten_seconds_time(), NULL);
switch (ev.type) {
case GRPC_OP_COMPLETE:
GPR_ASSERT(ev.success);
@@ -251,7 +256,7 @@ static void test_threading(int producers, int consumers) {
gpr_malloc((producers + consumers) * sizeof(test_thread_options));
gpr_event phase1 = GPR_EVENT_INIT;
gpr_event phase2 = GPR_EVENT_INIT;
- grpc_completion_queue *cc = grpc_completion_queue_create();
+ grpc_completion_queue *cc = grpc_completion_queue_create(NULL);
int i;
int total_consumed = 0;
static int optid = 101;
diff --git a/test/core/surface/lame_client_test.c b/test/core/surface/lame_client_test.c
index 5e6c9ae15c..96434193c9 100644
--- a/test/core/surface/lame_client_test.c
+++ b/test/core/surface/lame_client_test.c
@@ -49,6 +49,7 @@ int main(int argc, char **argv) {
grpc_op *op;
grpc_metadata_array trailing_metadata_recv;
grpc_status_code status;
+ grpc_call_error error;
char *details = NULL;
size_t details_capacity = 0;
@@ -57,12 +58,13 @@ int main(int argc, char **argv) {
grpc_metadata_array_init(&trailing_metadata_recv);
- chan = grpc_lame_client_channel_create("lampoon:national");
+ chan = grpc_lame_client_channel_create(
+ "lampoon:national", GRPC_STATUS_UNKNOWN, "Rpc sent on a lame channel.");
GPR_ASSERT(chan);
- cq = grpc_completion_queue_create();
+ cq = grpc_completion_queue_create(NULL);
call = grpc_channel_create_call(chan, NULL, GRPC_PROPAGATE_DEFAULTS, cq,
"/Foo", "anywhere",
- GRPC_TIMEOUT_SECONDS_TO_DEADLINE(100));
+ GRPC_TIMEOUT_SECONDS_TO_DEADLINE(100), NULL);
GPR_ASSERT(call);
cqv = cq_verifier_create(cq);
@@ -70,6 +72,7 @@ int main(int argc, char **argv) {
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
+ op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
@@ -77,9 +80,10 @@ int main(int argc, char **argv) {
op->data.recv_status_on_client.status_details = &details;
op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0;
+ op->reserved = NULL;
op++;
- GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_batch(call, ops, op - ops, tag(1)));
+ error = grpc_call_start_batch(call, ops, op - ops, tag(1), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
/* the call should immediately fail */
cq_expect_completion(cqv, tag(1), 1);
diff --git a/test/core/transport/chttp2/stream_map_test.c b/test/core/transport/chttp2/stream_map_test.c
index 3c6976ee9d..b0bb3a8904 100644
--- a/test/core/transport/chttp2/stream_map_test.c
+++ b/test/core/transport/chttp2/stream_map_test.c
@@ -93,7 +93,7 @@ static void test_basic_add_find(size_t n) {
grpc_chttp2_stream_map_init(&map, 8);
GPR_ASSERT(0 == grpc_chttp2_stream_map_size(&map));
for (i = 1; i <= n; i++) {
- grpc_chttp2_stream_map_add(&map, i, (void *)(gpr_uintptr) i);
+ grpc_chttp2_stream_map_add(&map, i, (void *)(gpr_uintptr)i);
}
GPR_ASSERT(n == grpc_chttp2_stream_map_size(&map));
GPR_ASSERT(NULL == grpc_chttp2_stream_map_find(&map, 0));
@@ -148,7 +148,7 @@ static void test_delete_evens_sweep(size_t n) {
grpc_chttp2_stream_map_init(&map, 8);
for (i = 1; i <= n; i++) {
- grpc_chttp2_stream_map_add(&map, i, (void *)(gpr_uintptr) i);
+ grpc_chttp2_stream_map_add(&map, i, (void *)(gpr_uintptr)i);
}
for (i = 1; i <= n; i++) {
if ((i & 1) == 0) {
@@ -170,7 +170,7 @@ static void test_delete_evens_incremental(size_t n) {
grpc_chttp2_stream_map_init(&map, 8);
for (i = 1; i <= n; i++) {
- grpc_chttp2_stream_map_add(&map, i, (void *)(gpr_uintptr) i);
+ grpc_chttp2_stream_map_add(&map, i, (void *)(gpr_uintptr)i);
if ((i & 1) == 0) {
grpc_chttp2_stream_map_delete(&map, i);
}
diff --git a/test/core/util/grpc_profiler.h b/test/core/util/grpc_profiler.h
index 347a1d39d5..88ec6bcb0e 100644
--- a/test/core/util/grpc_profiler.h
+++ b/test/core/util/grpc_profiler.h
@@ -45,4 +45,4 @@ void grpc_profiler_stop();
}
#endif /* __cplusplus */
-#endif /* GRPC_TEST_CORE_UTIL_GRPC_PROFILER_H */
+#endif /* GRPC_TEST_CORE_UTIL_GRPC_PROFILER_H */
diff --git a/test/core/util/parse_hexstring.h b/test/core/util/parse_hexstring.h
index 22bbd1756f..ddbfe541c6 100644
--- a/test/core/util/parse_hexstring.h
+++ b/test/core/util/parse_hexstring.h
@@ -38,4 +38,4 @@
gpr_slice parse_hexstring(const char *hexstring);
-#endif /* GRPC_TEST_CORE_UTIL_PARSE_HEXSTRING_H */
+#endif /* GRPC_TEST_CORE_UTIL_PARSE_HEXSTRING_H */
diff --git a/test/core/util/port.h b/test/core/util/port.h
index b516ec5a48..93788bcab2 100644
--- a/test/core/util/port.h
+++ b/test/core/util/port.h
@@ -49,4 +49,4 @@ int grpc_pick_unused_port_or_die();
}
#endif
-#endif /* GRPC_TEST_CORE_UTIL_PORT_H */
+#endif /* GRPC_TEST_CORE_UTIL_PORT_H */
diff --git a/test/core/util/port_posix.c b/test/core/util/port_posix.c
index 9bff18d311..836e62a541 100644
--- a/test/core/util/port_posix.c
+++ b/test/core/util/port_posix.c
@@ -66,9 +66,7 @@ static int has_port_been_chosen(int port) {
return 0;
}
-static void free_chosen_ports() {
- gpr_free(chosen_ports);
-}
+static void free_chosen_ports() { gpr_free(chosen_ports); }
static void chose_port(int port) {
if (chosen_ports == NULL) {
@@ -180,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));
@@ -206,7 +204,8 @@ int grpc_pick_unused_port(void) {
/* Type of port to first pick in next iteration */
int is_tcp = 1;
- int try = 0;
+ int try
+ = 0;
char *env = gpr_getenv("GRPC_TEST_PORT_SERVER");
if (env) {
@@ -219,7 +218,8 @@ int grpc_pick_unused_port(void) {
for (;;) {
int port;
- try++;
+ try
+ ++;
if (try == 1) {
port = getpid() % (65536 - 30000) + 30000;
} else if (try <= NUM_RANDOM_PORTS_TO_PICK) {
diff --git a/test/core/util/port_windows.c b/test/core/util/port_windows.c
index fc52150435..5b072f805a 100644
--- a/test/core/util/port_windows.c
+++ b/test/core/util/port_windows.c
@@ -63,7 +63,8 @@ static int is_port_available(int *port, int is_tcp) {
}
/* Reuseaddr lets us start up a server immediately after it exits */
- if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (const char*)&one, sizeof(one)) < 0) {
+ if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (const char *)&one,
+ sizeof(one)) < 0) {
gpr_log(GPR_ERROR, "setsockopt() failed: %s", strerror(errno));
closesocket(fd);
return 0;
@@ -75,14 +76,14 @@ static int is_port_available(int *port, int is_tcp) {
addr.sin_port = htons(*port);
if (bind(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
gpr_log(GPR_DEBUG, "bind(port=%d) failed: %s", *port, strerror(errno));
- closesocket(fd);
+ closesocket(fd);
return 0;
}
/* Get the bound port number */
if (getsockname(fd, (struct sockaddr *)&addr, &alen) < 0) {
gpr_log(GPR_ERROR, "getsockname() failed: %s", strerror(errno));
- closesocket(fd);
+ closesocket(fd);
return 0;
}
GPR_ASSERT(alen <= sizeof(addr));
@@ -113,11 +114,13 @@ int grpc_pick_unused_port(void) {
/* Type of port to first pick in next iteration */
int is_tcp = 1;
- int try = 0;
+ int try
+ = 0;
for (;;) {
int port;
- try++;
+ try
+ ++;
if (try == 1) {
port = _getpid() % (65536 - 30000) + 30000;
} else if (try <= NUM_RANDOM_PORTS_TO_PICK) {
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/core/util/slice_splitter.h b/test/core/util/slice_splitter.h
index 1ce1c097e2..d030c2cb55 100644
--- a/test/core/util/slice_splitter.h
+++ b/test/core/util/slice_splitter.h
@@ -65,4 +65,4 @@ gpr_slice grpc_slice_merge(gpr_slice *slices, size_t nslices);
const char *grpc_slice_split_mode_name(grpc_slice_split_mode mode);
-#endif /* GRPC_TEST_CORE_UTIL_SLICE_SPLITTER_H */
+#endif /* GRPC_TEST_CORE_UTIL_SLICE_SPLITTER_H */
diff --git a/test/core/util/test_config.c b/test/core/util/test_config.c
index cadf88a7c6..685bdff530 100644
--- a/test/core/util/test_config.c
+++ b/test/core/util/test_config.c
@@ -78,16 +78,16 @@ void abort_handler(int sig) {
}
static void install_crash_handler() {
- SetUnhandledExceptionFilter((LPTOP_LEVEL_EXCEPTION_FILTER) crash_handler);
+ SetUnhandledExceptionFilter((LPTOP_LEVEL_EXCEPTION_FILTER)crash_handler);
_set_abort_behavior(0, _WRITE_ABORT_MSG);
_set_abort_behavior(0, _CALL_REPORTFAULT);
signal(SIGABRT, abort_handler);
}
#else
-static void install_crash_handler() { }
+static void install_crash_handler() {}
#endif
-void grpc_test_init(int argc, char **argv) {
+void grpc_test_init(int argc, char** argv) {
install_crash_handler();
gpr_log(GPR_DEBUG, "test slowdown: machine=%f build=%f total=%f",
(double)GRPC_TEST_SLOWDOWN_MACHINE_FACTOR,
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 74b18ced0d..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"
@@ -61,11 +61,8 @@ class AuthPropertyIteratorTest : public ::testing::Test {
EXPECT_EQ(1,
grpc_auth_context_set_peer_identity_property_name(ctx_, "name"));
}
- void TearDown() GRPC_OVERRIDE {
- grpc_auth_context_release(ctx_);
- }
+ void TearDown() GRPC_OVERRIDE { grpc_auth_context_release(ctx_); }
grpc_auth_context* ctx_;
-
};
TEST_F(AuthPropertyIteratorTest, DefaultCtor) {
@@ -100,7 +97,7 @@ TEST_F(AuthPropertyIteratorTest, GeneralTest) {
} // namespace
} // namespace grpc
-int main(int argc, char **argv) {
+int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
diff --git a/test/cpp/common/secure_auth_context_test.cc b/test/cpp/common/secure_auth_context_test.cc
index 075d4ce8c9..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"
@@ -101,7 +101,7 @@ TEST_F(SecureAuthContextTest, Iterators) {
} // namespace
} // namespace grpc
-int main(int argc, char **argv) {
+int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc
index 9b53bdc999..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;
@@ -65,36 +64,102 @@ namespace testing {
namespace {
-void* tag(int i) { return (void*)(gpr_intptr) i; }
+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;
}
- void Verify(CompletionQueue *cq) {
+ void Verify(CompletionQueue* cq) {
GPR_ASSERT(!expectations_.empty());
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);
expectations_.erase(it);
}
}
- void Verify(CompletionQueue *cq, std::chrono::system_clock::time_point deadline) {
+ void Verify(CompletionQueue* cq,
+ std::chrono::system_clock::time_point deadline) {
if (expectations_.empty()) {
bool ok;
- void *got_tag;
- EXPECT_EQ(cq->AsyncNext(&got_tag, &ok, deadline), CompletionQueue::TIMEOUT);
+ void* got_tag;
+ 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);
+ void* got_tag;
+ 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);
@@ -105,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() {}
@@ -116,7 +182,8 @@ class AsyncEnd2endTest : public ::testing::Test {
server_address_ << "localhost:" << port;
// Setup server
ServerBuilder builder;
- builder.AddListeningPort(server_address_.str(), grpc::InsecureServerCredentials());
+ builder.AddListeningPort(server_address_.str(),
+ grpc::InsecureServerCredentials());
builder.RegisterAsyncService(&service_);
cq_ = builder.AddCompletionQueue();
server_ = builder.BuildAndStart();
@@ -132,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));
}
@@ -153,18 +220,18 @@ class AsyncEnd2endTest : public ::testing::Test {
std::unique_ptr<ClientAsyncResponseReader<EchoResponse> > response_reader(
stub_->AsyncEcho(&cli_ctx, send_request, cq_.get()));
- service_.RequestEcho(&srv_ctx, &recv_request, &response_writer,
- cq_.get(), cq_.get(), tag(2));
+ 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());
@@ -178,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;
@@ -210,28 +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;
@@ -247,44 +318,44 @@ TEST_F(AsyncEnd2endTest, SimpleClientStreaming) {
std::unique_ptr<ClientAsyncWriter<EchoRequest> > cli_stream(
stub_->AsyncRequestStream(&cli_ctx, &recv_response, cq_.get(), tag(1)));
- service_.RequestRequestStream(&srv_ctx, &srv_stream, cq_.get(),
- cq_.get(), tag(2));
+ 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;
@@ -303,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;
@@ -350,43 +421,43 @@ TEST_F(AsyncEnd2endTest, SimpleBidiStreaming) {
std::unique_ptr<ClientAsyncReaderWriter<EchoRequest, EchoResponse> >
cli_stream(stub_->AsyncBidiStream(&cli_ctx, cq_.get(), tag(1)));
- service_.RequestBidiStream(&srv_ctx, &srv_stream, cq_.get(),
- cq_.get(), tag(2));
+ 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;
@@ -410,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);
@@ -420,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;
@@ -451,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);
@@ -467,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;
@@ -498,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();
@@ -520,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;
@@ -537,18 +608,17 @@ TEST_F(AsyncEnd2endTest, MetadataRpc) {
std::pair<grpc::string, grpc::string> meta1("key1", "val1");
std::pair<grpc::string, grpc::string> meta2(
"key2-bin",
- grpc::string("\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc",
- 13));
+ grpc::string("\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc", 13));
std::pair<grpc::string, grpc::string> meta3("key3", "val3");
std::pair<grpc::string, grpc::string> meta6(
"key4-bin",
grpc::string("\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d",
- 14));
+ 14));
std::pair<grpc::string, grpc::string> meta5("key5", "val5");
std::pair<grpc::string, grpc::string> meta4(
"key6-bin",
- grpc::string("\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee",
- 15));
+ grpc::string(
+ "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee", 15));
cli_ctx.AddMetadata(meta1.first, meta1.second);
cli_ctx.AddMetadata(meta2.first, meta2.second);
@@ -558,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);
@@ -568,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);
@@ -581,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();
@@ -594,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;
@@ -615,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;
@@ -650,22 +720,47 @@ 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_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 =
+ std::move(grpc::cpp::test::util::UnimplementedService::NewStub(channel));
+ EchoRequest send_request;
+ EchoResponse recv_response;
+ Status recv_status;
+
+ ClientContext cli_ctx;
+ send_request.set_message("Hello");
+ std::unique_ptr<ClientAsyncResponseReader<EchoResponse> > response_reader(
+ stub->AsyncUnimplemented(&cli_ctx, send_request, cq_.get()));
+
+ response_reader->Finish(&recv_response, &recv_status, tag(4));
+ 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 906f124c05..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;
@@ -77,17 +72,14 @@ class CrashTest : public ::testing::Test {
addr_stream << "localhost:" << port;
auto addr = addr_stream.str();
server_.reset(new SubProcess({
- g_root + "/client_crash_test_server",
- "--address=" + addr,
+ g_root + "/client_crash_test_server", "--address=" + addr,
}));
GPR_ASSERT(server_);
return grpc::cpp::test::util::TestService::NewStub(
CreateChannel(addr, InsecureCredentials(), ChannelArguments()));
}
- void KillServer() {
- server_.reset();
- }
+ void KillServer() { server_.reset(); }
private:
std::unique_ptr<SubProcess> server_;
diff --git a/test/cpp/end2end/client_crash_test_server.cc b/test/cpp/end2end/client_crash_test_server.cc
index 20808a0240..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");
@@ -58,7 +57,8 @@ using namespace gflags;
namespace grpc {
namespace testing {
-class ServiceImpl GRPC_FINAL : public ::grpc::cpp::test::util::TestService::Service {
+class ServiceImpl GRPC_FINAL
+ : public ::grpc::cpp::test::util::TestService::Service {
Status BidiStream(ServerContext* context,
ServerReaderWriter<EchoResponse, EchoRequest>* stream)
GRPC_OVERRIDE {
diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc
index 37669815c6..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();
@@ -270,7 +265,7 @@ class End2endTest : public ::testing::TestWithParam<bool> {
// Setup server
ServerBuilder builder;
SslServerCredentialsOptions::PemKeyCertPair pkcp = {test_server1_key,
- test_server1_cert};
+ test_server1_cert};
SslServerCredentialsOptions ssl_opts;
ssl_opts.pem_root_certs = "";
ssl_opts.pem_key_cert_pairs.push_back(pkcp);
@@ -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();
}
@@ -290,13 +284,17 @@ class End2endTest : public ::testing::TestWithParam<bool> {
if (proxy_server_) proxy_server_->Shutdown();
}
- void ResetStub(bool use_proxy) {
+ void ResetChannel() {
SslCredentialsOptions ssl_opts = {test_root_cert, "", ""};
ChannelArguments args;
args.SetSslTargetNameOverride("foo.test.google.fr");
args.SetString(GRPC_ARG_SECONDARY_USER_AGENT_STRING, "end2end_test");
- channel_ = CreateChannel(server_address_.str(), SslCredentials(ssl_opts),
- args);
+ channel_ =
+ CreateChannel(server_address_.str(), SslCredentials(ssl_opts), args);
+ }
+
+ void ResetStub(bool use_proxy) {
+ ResetChannel();
if (use_proxy) {
proxy_service_.reset(new Proxy(channel_));
int port = grpc_pick_unused_port_or_die();
@@ -305,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(),
@@ -315,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_;
@@ -325,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,
@@ -567,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));
@@ -579,15 +575,15 @@ TEST_F(End2endTest, BadCredentials) {
Status s = stub->Echo(&context, request, &response);
EXPECT_EQ("", response.message());
EXPECT_FALSE(s.ok());
- EXPECT_EQ(StatusCode::UNKNOWN, s.error_code());
- EXPECT_EQ("Rpc sent on a lame channel.", s.error_message());
+ EXPECT_EQ(StatusCode::INVALID_ARGUMENT, s.error_code());
+ EXPECT_EQ("Invalid credentials.", s.error_message());
ClientContext context2;
auto stream = stub->BidiStream(&context2);
s = stream->Finish();
EXPECT_FALSE(s.ok());
- EXPECT_EQ(StatusCode::UNKNOWN, s.error_code());
- EXPECT_EQ("Rpc sent on a lame channel.", s.error_message());
+ EXPECT_EQ(StatusCode::INVALID_ARGUMENT, s.error_code());
+ EXPECT_EQ("Invalid credentials.", s.error_message());
}
void CancelRpc(ClientContext* context, int delay_us, TestServiceImpl* service) {
@@ -870,7 +866,7 @@ TEST_P(End2endTest, HugeResponse) {
namespace {
void ReaderThreadFunc(ClientReaderWriter<EchoRequest, EchoResponse>* stream,
- gpr_event *ev) {
+ gpr_event* ev) {
EchoResponse resp;
gpr_event_set(ev, (void*)1);
while (stream->Read(&resp)) {
@@ -925,11 +921,28 @@ TEST_F(End2endTest, ChannelState) {
EXPECT_FALSE(ok);
EXPECT_EQ(GRPC_CHANNEL_IDLE, channel_->GetState(true));
- EXPECT_TRUE(channel_->WaitForStateChange(
- GRPC_CHANNEL_IDLE, gpr_inf_future(GPR_CLOCK_REALTIME)));
+ EXPECT_TRUE(channel_->WaitForStateChange(GRPC_CHANNEL_IDLE,
+ gpr_inf_future(GPR_CLOCK_REALTIME)));
EXPECT_EQ(GRPC_CHANNEL_CONNECTING, channel_->GetState(false));
}
+// Talking to a non-existing service.
+TEST_F(End2endTest, NonExistingService) {
+ ResetChannel();
+ std::unique_ptr<grpc::cpp::test::util::UnimplementedService::Stub> stub;
+ stub =
+ std::move(grpc::cpp::test::util::UnimplementedService::NewStub(channel_));
+
+ EchoRequest request;
+ EchoResponse response;
+ request.set_message("Hello");
+
+ ClientContext context;
+ Status s = stub->Unimplemented(&context, request, &response);
+ EXPECT_EQ(StatusCode::UNIMPLEMENTED, s.error_code());
+ EXPECT_EQ("", s.error_message());
+}
+
INSTANTIATE_TEST_CASE_P(End2end, End2endTest, ::testing::Values(false, true));
} // namespace testing
diff --git a/test/cpp/end2end/generic_end2end_test.cc b/test/cpp/end2end/generic_end2end_test.cc
index b53c32144b..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;
@@ -68,7 +62,7 @@ namespace grpc {
namespace testing {
namespace {
-void* tag(int i) { return (void*)(gpr_intptr) i; }
+void* tag(int i) { return (void*)(gpr_intptr)i; }
void verify_ok(CompletionQueue* cq, int i, bool expect_ok) {
bool ok;
@@ -107,7 +101,8 @@ class GenericEnd2endTest : public ::testing::Test {
server_address_ << server_host_ << ":" << port;
// Setup server
ServerBuilder builder;
- builder.AddListeningPort(server_address_.str(), InsecureServerCredentials());
+ builder.AddListeningPort(server_address_.str(),
+ InsecureServerCredentials());
builder.RegisterAsyncGenericService(&generic_service_);
srv_cq_ = builder.AddCompletionQueue();
server_ = builder.BuildAndStart();
@@ -126,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 497ccb4cb2..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");
@@ -60,8 +58,8 @@ using namespace gflags;
int main(int argc, char** argv) {
ParseCommandLineFlags(&argc, &argv, true);
- auto stub = grpc::cpp::test::util::TestService::NewStub(
- grpc::CreateChannel(FLAGS_address, grpc::InsecureCredentials(), grpc::ChannelArguments()));
+ auto stub = grpc::cpp::test::util::TestService::NewStub(grpc::CreateChannel(
+ FLAGS_address, grpc::InsecureCredentials(), grpc::ChannelArguments()));
EchoRequest request;
EchoResponse response;
diff --git a/test/cpp/end2end/shutdown_test.cc b/test/cpp/end2end/shutdown_test.cc
new file mode 100644
index 0000000000..e83f86f7ec
--- /dev/null
+++ b/test/cpp/end2end/shutdown_test.cc
@@ -0,0 +1,157 @@
+/*
+ *
+ * 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 <thread>
+
+#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>
+#include <grpc++/server.h>
+#include <grpc++/server_builder.h>
+#include <grpc++/server_context.h>
+#include <grpc++/server_credentials.h>
+#include <gtest/gtest.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;
+
+namespace grpc {
+namespace testing {
+
+class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service {
+ public:
+ explicit TestServiceImpl(gpr_event* ev) : ev_(ev) {}
+
+ Status Echo(ServerContext* context, const EchoRequest* request,
+ EchoResponse* response) GRPC_OVERRIDE {
+ gpr_event_set(ev_, (void*)1);
+ while (!context->IsCancelled()) {
+ }
+ return Status::OK;
+ }
+
+ private:
+ gpr_event* ev_;
+};
+
+class ShutdownTest : public ::testing::Test {
+ public:
+ ShutdownTest() : shutdown_(false), service_(&ev_) { gpr_event_init(&ev_); }
+
+ void SetUp() GRPC_OVERRIDE {
+ port_ = grpc_pick_unused_port_or_die();
+ server_ = SetUpServer(port_);
+ }
+
+ std::unique_ptr<Server> SetUpServer(const int port) {
+ grpc::string server_address = "localhost:" + to_string(port);
+
+ ServerBuilder builder;
+ builder.AddListeningPort(server_address, InsecureServerCredentials());
+ builder.RegisterService(&service_);
+ std::unique_ptr<Server> server = builder.BuildAndStart();
+ return server;
+ }
+
+ void TearDown() GRPC_OVERRIDE { GPR_ASSERT(shutdown_); }
+
+ void ResetStub() {
+ string target = "dns:localhost:" + to_string(port_);
+ channel_ = CreateChannel(target, InsecureCredentials(), ChannelArguments());
+ stub_ = std::move(grpc::cpp::test::util::TestService::NewStub(channel_));
+ }
+
+ string to_string(const int number) {
+ std::stringstream strs;
+ strs << number;
+ return strs.str();
+ }
+
+ void SendRequest() {
+ EchoRequest request;
+ EchoResponse response;
+ request.set_message("Hello");
+ ClientContext context;
+ GPR_ASSERT(!shutdown_);
+ Status s = stub_->Echo(&context, request, &response);
+ GPR_ASSERT(shutdown_);
+ }
+
+ protected:
+ std::shared_ptr<Channel> channel_;
+ std::unique_ptr<grpc::cpp::test::util::TestService::Stub> stub_;
+ std::unique_ptr<Server> server_;
+ bool shutdown_;
+ int port_;
+ gpr_event ev_;
+ TestServiceImpl service_;
+};
+
+// Tests zookeeper state change between two RPCs
+// TODO(ctiller): leaked objects in this test
+TEST_F(ShutdownTest, ShutdownTest) {
+ ResetStub();
+
+ // send the request in a background thread
+ std::thread thr(std::bind(&ShutdownTest::SendRequest, this));
+
+ // wait for the server to get the event
+ gpr_event_wait(&ev_, gpr_inf_future(GPR_CLOCK_MONOTONIC));
+
+ shutdown_ = true;
+
+ // shutdown should trigger cancellation causing everything to shutdown
+ auto deadline =
+ std::chrono::system_clock::now() + std::chrono::microseconds(100);
+ server_->Shutdown(deadline);
+ EXPECT_GE(std::chrono::system_clock::now(), deadline);
+
+ thr.join();
+}
+
+} // namespace testing
+} // namespace grpc
+
+int main(int argc, char** argv) {
+ grpc_test_init(argc, argv);
+ ::testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
+}
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
new file mode 100644
index 0000000000..e7d95b1c46
--- /dev/null
+++ b/test/cpp/end2end/zookeeper_test.cc
@@ -0,0 +1,221 @@
+/*
+ *
+ * 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++/channel.h>
+#include <grpc++/client_context.h>
+#include <grpc++/create_channel.h>
+#include <grpc++/credentials.h>
+#include <grpc++/server.h>
+#include <grpc++/server_builder.h>
+#include <grpc++/server_context.h>
+#include <grpc++/server_credentials.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;
+
+namespace grpc {
+namespace testing {
+
+class ZookeeperTestServiceImpl
+ : public ::grpc::cpp::test::util::TestService::Service {
+ public:
+ Status Echo(ServerContext* context, const EchoRequest* request,
+ EchoResponse* response) GRPC_OVERRIDE {
+ response->set_message(request->message());
+ return Status::OK;
+ }
+};
+
+class ZookeeperTest : public ::testing::Test {
+ protected:
+ ZookeeperTest() {}
+
+ void SetUp() GRPC_OVERRIDE {
+ SetUpZookeeper();
+
+ // Sets up two servers
+ int port1 = grpc_pick_unused_port_or_die();
+ server1_ = SetUpServer(port1);
+
+ int port2 = grpc_pick_unused_port_or_die();
+ server2_ = SetUpServer(port2);
+
+ // Registers service /test in zookeeper
+ RegisterService("/test", "test");
+
+ // Registers service instance /test/1 in zookeeper
+ string value =
+ "{\"host\":\"localhost\",\"port\":\"" + to_string(port1) + "\"}";
+ RegisterService("/test/1", value);
+
+ // Registers service instance /test/2 in zookeeper
+ value = "{\"host\":\"localhost\",\"port\":\"" + to_string(port2) + "\"}";
+ RegisterService("/test/2", value);
+ }
+
+ // Requires zookeeper server running
+ void SetUpZookeeper() {
+ // Finds zookeeper server address in environment
+ // Default is localhost:2181
+ zookeeper_address_ = "localhost:2181";
+ char* addr = gpr_getenv("GRPC_ZOOKEEPER_SERVER_TEST");
+ if (addr != NULL) {
+ string addr_str(addr);
+ zookeeper_address_ = addr_str;
+ gpr_free(addr);
+ }
+ gpr_log(GPR_DEBUG, zookeeper_address_.c_str());
+
+ // Connects to zookeeper server
+ zoo_set_debug_level(ZOO_LOG_LEVEL_WARN);
+ zookeeper_handle_ =
+ zookeeper_init(zookeeper_address_.c_str(), NULL, 15000, 0, 0, 0);
+ GPR_ASSERT(zookeeper_handle_ != NULL);
+
+ // Registers zookeeper name resolver in grpc
+ grpc_zookeeper_register();
+ }
+
+ std::unique_ptr<Server> SetUpServer(const int port) {
+ string server_address = "localhost:" + to_string(port);
+
+ ServerBuilder builder;
+ builder.AddListeningPort(server_address, InsecureServerCredentials());
+ builder.RegisterService(&service_);
+ std::unique_ptr<Server> server = builder.BuildAndStart();
+ return server;
+ }
+
+ void RegisterService(const string& name, const string& value) {
+ char* path = (char*)gpr_malloc(name.size());
+
+ int status = zoo_exists(zookeeper_handle_, name.c_str(), 0, NULL);
+ if (status == ZNONODE) {
+ status =
+ zoo_create(zookeeper_handle_, name.c_str(), value.c_str(),
+ value.size(), &ZOO_OPEN_ACL_UNSAFE, 0, path, name.size());
+ } else {
+ status = zoo_set(zookeeper_handle_, name.c_str(), value.c_str(),
+ value.size(), -1);
+ }
+ gpr_free(path);
+ GPR_ASSERT(status == 0);
+ }
+
+ void DeleteService(const string& name) {
+ int status = zoo_delete(zookeeper_handle_, name.c_str(), -1);
+ GPR_ASSERT(status == 0);
+ }
+
+ void ChangeZookeeperState() {
+ server1_->Shutdown();
+ DeleteService("/test/1");
+ }
+
+ void TearDown() GRPC_OVERRIDE {
+ server1_->Shutdown();
+ server2_->Shutdown();
+ zookeeper_close(zookeeper_handle_);
+ }
+
+ void ResetStub() {
+ string target = "zookeeper://" + zookeeper_address_ + "/test";
+ channel_ = CreateChannel(target, InsecureCredentials(), ChannelArguments());
+ stub_ = std::move(grpc::cpp::test::util::TestService::NewStub(channel_));
+ }
+
+ string to_string(const int number) {
+ std::stringstream strs;
+ strs << number;
+ return strs.str();
+ }
+
+ 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_;
+ ZookeeperTestServiceImpl service_;
+ zhandle_t* zookeeper_handle_;
+ string zookeeper_address_;
+};
+
+// Tests zookeeper state change between two RPCs
+// TODO(ctiller): leaked objects in this test
+TEST_F(ZookeeperTest, ZookeeperStateChangeTwoRpc) {
+ ResetStub();
+
+ // First RPC
+ EchoRequest request1;
+ EchoResponse response1;
+ ClientContext context1;
+ context1.set_authority("test");
+ request1.set_message("Hello");
+ Status s1 = stub_->Echo(&context1, request1, &response1);
+ EXPECT_EQ(response1.message(), request1.message());
+ EXPECT_TRUE(s1.ok());
+
+ // Zookeeper state changes
+ gpr_log(GPR_DEBUG, "Zookeeper state change");
+ ChangeZookeeperState();
+ // Waits for re-resolving addresses
+ // TODO(ctiller): RPC will probably fail if not waiting
+ sleep(1);
+
+ // Second RPC
+ EchoRequest request2;
+ EchoResponse response2;
+ ClientContext context2;
+ context2.set_authority("test");
+ request2.set_message("World");
+ Status s2 = stub_->Echo(&context2, request2, &response2);
+ EXPECT_EQ(response2.message(), request2.message());
+ EXPECT_TRUE(s2.ok());
+}
+
+} // namespace testing
+} // namespace grpc
+
+int main(int argc, char** argv) {
+ grpc_test_init(argc, argv);
+ ::testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
+}
diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc
index ebc5cfc85a..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"
@@ -56,8 +55,12 @@ DEFINE_string(test_case, "large_unary",
"Configure different test cases. Valid options are: "
"empty_unary : empty (zero bytes) request and response; "
"large_unary : single request and (large) response; "
+ "large_compressed_unary : single request and compressed (large) "
+ "response; "
"client_streaming : request streaming with single response; "
"server_streaming : single request with response streaming; "
+ "server_compressed_streaming : single request with compressed "
+ "response streaming; "
"slow_consumer : single request with response; "
" streaming with slow client consumer; "
"half_duplex : half-duplex streaming; "
@@ -70,7 +73,7 @@ DEFINE_string(test_case, "large_unary",
"jwt_token_creds: large_unary with JWT token auth; "
"oauth2_auth_token: raw oauth2 access token auth; "
"per_rpc_creds: raw oauth2 access token on a single rpc; "
- "status_code_and_message: verify status code & message; "
+ "status_code_and_message: verify status code & message; "
"all : all of above.");
DEFINE_string(default_service_account, "",
"Email of GCE default service account");
@@ -91,10 +94,14 @@ int main(int argc, char** argv) {
client.DoEmpty();
} else if (FLAGS_test_case == "large_unary") {
client.DoLargeUnary();
+ } else if (FLAGS_test_case == "large_compressed_unary") {
+ client.DoLargeCompressedUnary();
} else if (FLAGS_test_case == "client_streaming") {
client.DoRequestStreaming();
} else if (FLAGS_test_case == "server_streaming") {
client.DoResponseStreaming();
+ } else if (FLAGS_test_case == "server_compressed_streaming") {
+ client.DoResponseCompressedStreaming();
} else if (FLAGS_test_case == "slow_consumer") {
client.DoResponseStreamingWithSlowConsumer();
} else if (FLAGS_test_case == "half_duplex") {
@@ -129,6 +136,7 @@ int main(int argc, char** argv) {
client.DoLargeUnary();
client.DoRequestStreaming();
client.DoResponseStreaming();
+ client.DoResponseCompressedStreaming();
client.DoHalfDuplex();
client.DoPingPong();
client.DoCancelAfterBegin();
@@ -148,10 +156,11 @@ int main(int argc, char** argv) {
gpr_log(
GPR_ERROR,
"Unsupported test case %s. Valid options are all|empty_unary|"
- "large_unary|client_streaming|server_streaming|half_duplex|ping_pong|"
- "cancel_after_begin|cancel_after_first_response|"
- "timeout_on_sleeping_server|service_account_creds|compute_engine_creds|"
- "jwt_token_creds|oauth2_auth_token|per_rpc_creds",
+ "large_unary|large_compressed_unary|client_streaming|server_streaming|"
+ "server_compressed_streaming|half_duplex|ping_pong|cancel_after_begin|"
+ "cancel_after_first_response|timeout_on_sleeping_server|"
+ "service_account_creds|compute_engine_creds|jwt_token_creds|"
+ "oauth2_auth_token|per_rpc_creds",
FLAGS_test_case.c_str());
ret = 1;
}
diff --git a/test/cpp/interop/client_helper.cc b/test/cpp/interop/client_helper.cc
index 73d82f7b88..abc14aeb98 100644
--- a/test/cpp/interop/client_helper.cc
+++ b/test/cpp/interop/client_helper.cc
@@ -33,21 +33,20 @@
#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"
@@ -100,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 c4361bb9de..92d5078f48 100644
--- a/test/cpp/interop/client_helper.h
+++ b/test/cpp/interop/client_helper.h
@@ -36,8 +36,9 @@
#include <memory>
-#include <grpc++/config.h>
-#include <grpc++/channel_interface.h>
+#include <grpc++/channel.h>
+
+#include "src/core/surface/call.h"
namespace grpc {
namespace testing {
@@ -46,9 +47,27 @@ grpc::string GetServiceAccountJsonKey();
grpc::string GetOauth2AccessToken();
-std::shared_ptr<ChannelInterface> CreateChannelForTestCase(
+std::shared_ptr<Channel> CreateChannelForTestCase(
const grpc::string& test_case);
+class InteropClientContextInspector {
+ public:
+ InteropClientContextInspector(const ::grpc::ClientContext& context)
+ : context_(context) {}
+
+ // Inspector methods, able to peek inside ClientContext, follow.
+ grpc_compression_algorithm GetCallCompressionAlgorithm() const {
+ return grpc_call_get_compression_algorithm(context_.call_);
+ }
+
+ gpr_uint32 GetMessageFlags() const {
+ return grpc_call_get_message_flags(context_.call_);
+ }
+
+ private:
+ const ::grpc::ClientContext& context_;
+};
+
} // namespace testing
} // namespace grpc
diff --git a/test/cpp/interop/interop_client.cc b/test/cpp/interop/interop_client.cc
index dfb90fadc2..ca13cdc53d 100644
--- a/test/cpp/interop/interop_client.cc
+++ b/test/cpp/interop/interop_client.cc
@@ -33,17 +33,20 @@
#include "test/cpp/interop/interop_client.h"
-#include <memory>
-
#include <unistd.h>
+#include <fstream>
+#include <memory>
+
#include <grpc/grpc.h>
#include <grpc/support/log.h>
-#include <grpc++/channel_interface.h>
+#include <grpc/support/string_util.h>
+#include <grpc/support/useful.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"
@@ -52,6 +55,8 @@
namespace grpc {
namespace testing {
+static const char* kRandomFile = "test/cpp/interop/rnd.dat";
+
namespace {
// The same value is defined by the Java client.
const std::vector<int> request_stream_sizes = {27182, 8, 1828, 45904};
@@ -61,9 +66,23 @@ const int kResponseMessageSize = 1030;
const int kReceiveDelayMilliSeconds = 20;
const int kLargeRequestSize = 271828;
const int kLargeResponseSize = 314159;
+
+CompressionType GetInteropCompressionTypeFromCompressionAlgorithm(
+ grpc_compression_algorithm algorithm) {
+ switch (algorithm) {
+ case GRPC_COMPRESS_NONE:
+ return CompressionType::NONE;
+ case GRPC_COMPRESS_GZIP:
+ return CompressionType::GZIP;
+ case GRPC_COMPRESS_DEFLATE:
+ return CompressionType::DEFLATE;
+ default:
+ GPR_ASSERT(false);
+ }
+}
} // namespace
-InteropClient::InteropClient(std::shared_ptr<ChannelInterface> channel)
+InteropClient::InteropClient(std::shared_ptr<Channel> channel)
: channel_(channel) {}
void InteropClient::AssertOkOrPrintErrorStatus(const Status& s) {
@@ -95,17 +114,48 @@ void InteropClient::PerformLargeUnary(SimpleRequest* request,
std::unique_ptr<TestService::Stub> stub(TestService::NewStub(channel_));
ClientContext context;
- request->set_response_type(PayloadType::COMPRESSABLE);
+ InteropClientContextInspector inspector(context);
+ // If the request doesn't already specify the response type, default to
+ // COMPRESSABLE.
request->set_response_size(kLargeResponseSize);
grpc::string payload(kLargeRequestSize, '\0');
request->mutable_payload()->set_body(payload.c_str(), kLargeRequestSize);
Status s = stub->UnaryCall(&context, *request, response);
+ // Compression related checks.
+ GPR_ASSERT(request->response_compression() ==
+ GetInteropCompressionTypeFromCompressionAlgorithm(
+ inspector.GetCallCompressionAlgorithm()));
+ if (request->response_compression() == NONE) {
+ GPR_ASSERT(!(inspector.GetMessageFlags() & GRPC_WRITE_INTERNAL_COMPRESS));
+ } else if (request->response_type() == PayloadType::COMPRESSABLE) {
+ // requested compression and compressable response => results should always
+ // be compressed.
+ GPR_ASSERT(inspector.GetMessageFlags() & GRPC_WRITE_INTERNAL_COMPRESS);
+ }
+
AssertOkOrPrintErrorStatus(s);
- GPR_ASSERT(response->payload().type() == PayloadType::COMPRESSABLE);
- GPR_ASSERT(response->payload().body() ==
- grpc::string(kLargeResponseSize, '\0'));
+
+ // Payload related checks.
+ if (request->response_type() != PayloadType::RANDOM) {
+ GPR_ASSERT(response->payload().type() == request->response_type());
+ }
+ switch (response->payload().type()) {
+ case PayloadType::COMPRESSABLE:
+ GPR_ASSERT(response->payload().body() ==
+ grpc::string(kLargeResponseSize, '\0'));
+ break;
+ case PayloadType::UNCOMPRESSABLE: {
+ std::ifstream rnd_file(kRandomFile);
+ GPR_ASSERT(rnd_file.good());
+ for (int i = 0; i < kLargeResponseSize; i++) {
+ GPR_ASSERT(response->payload().body()[i] == (char)rnd_file.get());
+ }
+ } break;
+ default:
+ GPR_ASSERT(false);
+ }
}
void InteropClient::DoComputeEngineCreds(
@@ -117,6 +167,7 @@ void InteropClient::DoComputeEngineCreds(
SimpleResponse response;
request.set_fill_username(true);
request.set_fill_oauth_scope(true);
+ request.set_response_type(PayloadType::COMPRESSABLE);
PerformLargeUnary(&request, &response);
gpr_log(GPR_INFO, "Got username %s", response.username().c_str());
gpr_log(GPR_INFO, "Got oauth_scope %s", response.oauth_scope().c_str());
@@ -136,6 +187,7 @@ void InteropClient::DoServiceAccountCreds(const grpc::string& username,
SimpleResponse response;
request.set_fill_username(true);
request.set_fill_oauth_scope(true);
+ request.set_response_type(PayloadType::COMPRESSABLE);
PerformLargeUnary(&request, &response);
GPR_ASSERT(!response.username().empty());
GPR_ASSERT(!response.oauth_scope().empty());
@@ -199,6 +251,7 @@ void InteropClient::DoJwtTokenCreds(const grpc::string& username) {
SimpleRequest request;
SimpleResponse response;
request.set_fill_username(true);
+ request.set_response_type(PayloadType::COMPRESSABLE);
PerformLargeUnary(&request, &response);
GPR_ASSERT(!response.username().empty());
GPR_ASSERT(username.find(response.username()) != grpc::string::npos);
@@ -209,10 +262,33 @@ void InteropClient::DoLargeUnary() {
gpr_log(GPR_INFO, "Sending a large unary rpc...");
SimpleRequest request;
SimpleResponse response;
+ request.set_response_type(PayloadType::COMPRESSABLE);
PerformLargeUnary(&request, &response);
gpr_log(GPR_INFO, "Large unary done.");
}
+void InteropClient::DoLargeCompressedUnary() {
+ const CompressionType compression_types[] = {NONE, GZIP, DEFLATE};
+ const PayloadType payload_types[] = {COMPRESSABLE, UNCOMPRESSABLE, RANDOM};
+ for (size_t i = 0; i < GPR_ARRAY_SIZE(payload_types); i++) {
+ for (size_t j = 0; j < GPR_ARRAY_SIZE(compression_types); j++) {
+ char* log_suffix;
+ gpr_asprintf(&log_suffix, "(compression=%s; payload=%s)",
+ CompressionType_Name(compression_types[j]).c_str(),
+ PayloadType_Name(payload_types[i]).c_str());
+
+ gpr_log(GPR_INFO, "Sending a large compressed unary rpc %s.", log_suffix);
+ SimpleRequest request;
+ SimpleResponse response;
+ request.set_response_type(payload_types[i]);
+ request.set_response_compression(compression_types[j]);
+ PerformLargeUnary(&request, &response);
+ gpr_log(GPR_INFO, "Large compressed unary done %s.", log_suffix);
+ gpr_free(log_suffix);
+ }
+ }
+}
+
void InteropClient::DoRequestStreaming() {
gpr_log(GPR_INFO, "Sending request steaming rpc ...");
std::unique_ptr<TestService::Stub> stub(TestService::NewStub(channel_));
@@ -261,11 +337,90 @@ void InteropClient::DoResponseStreaming() {
}
GPR_ASSERT(response_stream_sizes.size() == i);
Status s = stream->Finish();
-
AssertOkOrPrintErrorStatus(s);
gpr_log(GPR_INFO, "Response streaming done.");
}
+void InteropClient::DoResponseCompressedStreaming() {
+ std::unique_ptr<TestService::Stub> stub(TestService::NewStub(channel_));
+
+ const CompressionType compression_types[] = {NONE, GZIP, DEFLATE};
+ const PayloadType payload_types[] = {COMPRESSABLE, UNCOMPRESSABLE, RANDOM};
+ for (size_t i = 0; i < GPR_ARRAY_SIZE(payload_types); i++) {
+ for (size_t j = 0; j < GPR_ARRAY_SIZE(compression_types); j++) {
+ ClientContext context;
+ InteropClientContextInspector inspector(context);
+ StreamingOutputCallRequest request;
+
+ char* log_suffix;
+ gpr_asprintf(&log_suffix, "(compression=%s; payload=%s)",
+ CompressionType_Name(compression_types[j]).c_str(),
+ PayloadType_Name(payload_types[i]).c_str());
+
+ gpr_log(GPR_INFO, "Receiving response steaming rpc %s.", log_suffix);
+
+ request.set_response_type(payload_types[i]);
+ request.set_response_compression(compression_types[j]);
+
+ for (size_t k = 0; k < response_stream_sizes.size(); ++k) {
+ ResponseParameters* response_parameter =
+ request.add_response_parameters();
+ response_parameter->set_size(response_stream_sizes[k]);
+ }
+ StreamingOutputCallResponse response;
+
+ std::unique_ptr<ClientReader<StreamingOutputCallResponse>> stream(
+ stub->StreamingOutputCall(&context, request));
+
+ size_t k = 0;
+ while (stream->Read(&response)) {
+ // Payload related checks.
+ if (request.response_type() != PayloadType::RANDOM) {
+ GPR_ASSERT(response.payload().type() == request.response_type());
+ }
+ switch (response.payload().type()) {
+ case PayloadType::COMPRESSABLE:
+ GPR_ASSERT(response.payload().body() ==
+ grpc::string(response_stream_sizes[k], '\0'));
+ break;
+ case PayloadType::UNCOMPRESSABLE: {
+ std::ifstream rnd_file(kRandomFile);
+ GPR_ASSERT(rnd_file.good());
+ for (int n = 0; n < response_stream_sizes[k]; n++) {
+ GPR_ASSERT(response.payload().body()[n] == (char)rnd_file.get());
+ }
+ } break;
+ default:
+ GPR_ASSERT(false);
+ }
+
+ // Compression related checks.
+ GPR_ASSERT(request.response_compression() ==
+ GetInteropCompressionTypeFromCompressionAlgorithm(
+ inspector.GetCallCompressionAlgorithm()));
+ if (request.response_compression() == NONE) {
+ GPR_ASSERT(
+ !(inspector.GetMessageFlags() & GRPC_WRITE_INTERNAL_COMPRESS));
+ } else if (request.response_type() == PayloadType::COMPRESSABLE) {
+ // requested compression and compressable response => results should
+ // always be compressed.
+ GPR_ASSERT(inspector.GetMessageFlags() &
+ GRPC_WRITE_INTERNAL_COMPRESS);
+ }
+
+ ++k;
+ }
+
+ GPR_ASSERT(response_stream_sizes.size() == k);
+ Status s = stream->Finish();
+
+ AssertOkOrPrintErrorStatus(s);
+ gpr_log(GPR_INFO, "Response streaming done %s.", log_suffix);
+ gpr_free(log_suffix);
+ }
+ }
+}
+
void InteropClient::DoResponseStreamingWithSlowConsumer() {
gpr_log(GPR_INFO, "Receiving response steaming rpc with slow consumer ...");
std::unique_ptr<TestService::Stub> stub(TestService::NewStub(channel_));
@@ -316,7 +471,6 @@ void InteropClient::DoHalfDuplex() {
unsigned int i = 0;
StreamingOutputCallResponse response;
while (stream->Read(&response)) {
- GPR_ASSERT(response.payload().has_body());
GPR_ASSERT(response.payload().body() ==
grpc::string(response_stream_sizes[i], '\0'));
++i;
@@ -346,7 +500,6 @@ void InteropClient::DoPingPong() {
payload->set_body(grpc::string(request_stream_sizes[i], '\0'));
GPR_ASSERT(stream->Write(request));
GPR_ASSERT(stream->Read(&response));
- GPR_ASSERT(response.payload().has_body());
GPR_ASSERT(response.payload().body() ==
grpc::string(response_stream_sizes[i], '\0'));
}
@@ -393,7 +546,6 @@ void InteropClient::DoCancelAfterFirstResponse() {
StreamingOutputCallResponse response;
GPR_ASSERT(stream->Write(request));
GPR_ASSERT(stream->Read(&response));
- GPR_ASSERT(response.payload().has_body());
GPR_ASSERT(response.payload().body() == grpc::string(31415, '\0'));
gpr_log(GPR_INFO, "Trying to cancel...");
context.TryCancel();
@@ -430,7 +582,7 @@ void InteropClient::DoStatusWithMessage() {
ClientContext context;
SimpleRequest request;
SimpleResponse response;
- EchoStatus *requested_status = request.mutable_response_status();
+ EchoStatus* requested_status = request.mutable_response_status();
requested_status->set_code(grpc::StatusCode::UNKNOWN);
grpc::string test_msg = "This is a test message";
requested_status->set_message(test_msg);
diff --git a/test/cpp/interop/interop_client.h b/test/cpp/interop/interop_client.h
index 6e26c49e5d..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,17 +45,19 @@ 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();
+ void DoLargeCompressedUnary();
void DoPingPong();
void DoHalfDuplex();
void DoRequestStreaming();
void DoResponseStreaming();
+ void DoResponseCompressedStreaming();
void DoResponseStreamingWithSlowConsumer();
void DoCancelAfterBegin();
void DoCancelAfterFirstResponse();
@@ -80,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/rnd.dat b/test/cpp/interop/rnd.dat
new file mode 100644
index 0000000000..8c7f38f9e0
--- /dev/null
+++ b/test/cpp/interop/rnd.dat
Binary files differ
diff --git a/test/cpp/interop/server.cc b/test/cpp/interop/server.cc
index 05a10de51e..4921fde9fa 100644
--- a/test/cpp/interop/server.cc
+++ b/test/cpp/interop/server.cc
@@ -31,28 +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++/config.h>
+#include <grpc/support/useful.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.");
@@ -65,6 +65,7 @@ using grpc::ServerReader;
using grpc::ServerReaderWriter;
using grpc::ServerWriter;
using grpc::SslServerCredentialsOptions;
+using grpc::testing::InteropServerContextInspector;
using grpc::testing::Payload;
using grpc::testing::PayloadType;
using grpc::testing::SimpleRequest;
@@ -77,19 +78,54 @@ using grpc::testing::TestService;
using grpc::Status;
static bool got_sigint = false;
+static const char* kRandomFile = "test/cpp/interop/rnd.dat";
bool SetPayload(PayloadType type, int size, Payload* payload) {
- PayloadType response_type = type;
- // TODO(yangg): Support UNCOMPRESSABLE payload.
- if (type != PayloadType::COMPRESSABLE) {
- return false;
+ PayloadType response_type;
+ if (type == PayloadType::RANDOM) {
+ response_type =
+ rand() & 0x1 ? PayloadType::COMPRESSABLE : PayloadType::UNCOMPRESSABLE;
+ } else {
+ response_type = type;
}
payload->set_type(response_type);
- std::unique_ptr<char[]> body(new char[size]());
- payload->set_body(body.get(), size);
+ switch (response_type) {
+ case PayloadType::COMPRESSABLE: {
+ std::unique_ptr<char[]> body(new char[size]());
+ payload->set_body(body.get(), size);
+ } break;
+ case PayloadType::UNCOMPRESSABLE: {
+ std::unique_ptr<char[]> body(new char[size]());
+ std::ifstream rnd_file(kRandomFile);
+ GPR_ASSERT(rnd_file.good());
+ rnd_file.read(body.get(), size);
+ GPR_ASSERT(!rnd_file.eof()); // Requested more rnd bytes than available
+ payload->set_body(body.get(), size);
+ } break;
+ default:
+ GPR_ASSERT(false);
+ }
return true;
}
+template <typename RequestType>
+void SetResponseCompression(ServerContext* context,
+ const RequestType& request) {
+ switch (request.response_compression()) {
+ case grpc::testing::NONE:
+ context->set_compression_algorithm(GRPC_COMPRESS_NONE);
+ break;
+ case grpc::testing::GZIP:
+ context->set_compression_algorithm(GRPC_COMPRESS_GZIP);
+ break;
+ case grpc::testing::DEFLATE:
+ context->set_compression_algorithm(GRPC_COMPRESS_DEFLATE);
+ break;
+ default:
+ abort();
+ }
+}
+
class TestServiceImpl : public TestService::Service {
public:
Status EmptyCall(ServerContext* context, const grpc::testing::Empty* request,
@@ -99,7 +135,8 @@ class TestServiceImpl : public TestService::Service {
Status UnaryCall(ServerContext* context, const SimpleRequest* request,
SimpleResponse* response) {
- if (request->has_response_size() && request->response_size() > 0) {
+ SetResponseCompression(context, *request);
+ if (request->response_size() > 0) {
if (!SetPayload(request->response_type(), request->response_size(),
response->mutable_payload())) {
return Status(grpc::StatusCode::INTERNAL, "Error creating payload.");
@@ -107,9 +144,9 @@ class TestServiceImpl : public TestService::Service {
}
if (request->has_response_status()) {
- return Status(static_cast<grpc::StatusCode>
- (request->response_status().code()),
- request->response_status().message());
+ return Status(
+ static_cast<grpc::StatusCode>(request->response_status().code()),
+ request->response_status().message());
}
return Status::OK;
@@ -118,13 +155,16 @@ class TestServiceImpl : public TestService::Service {
Status StreamingOutputCall(
ServerContext* context, const StreamingOutputCallRequest* request,
ServerWriter<StreamingOutputCallResponse>* writer) {
+ SetResponseCompression(context, *request);
StreamingOutputCallResponse response;
bool write_success = true;
- response.mutable_payload()->set_type(request->response_type());
for (int i = 0; write_success && i < request->response_parameters_size();
i++) {
- response.mutable_payload()->set_body(
- grpc::string(request->response_parameters(i).size(), '\0'));
+ if (!SetPayload(request->response_type(),
+ request->response_parameters(i).size(),
+ response.mutable_payload())) {
+ return Status(grpc::StatusCode::INTERNAL, "Error creating payload.");
+ }
write_success = writer->Write(response);
}
if (write_success) {
@@ -140,7 +180,7 @@ class TestServiceImpl : public TestService::Service {
StreamingInputCallRequest request;
int aggregated_payload_size = 0;
while (reader->Read(&request)) {
- if (request.has_payload() && request.payload().has_body()) {
+ if (request.has_payload()) {
aggregated_payload_size += request.payload().body().size();
}
}
@@ -156,6 +196,7 @@ class TestServiceImpl : public TestService::Service {
StreamingOutputCallResponse response;
bool write_success = true;
while (write_success && stream->Read(&request)) {
+ SetResponseCompression(context, request);
if (request.response_parameters_size() != 0) {
response.mutable_payload()->set_type(request.payload().type());
response.mutable_payload()->set_body(
diff --git a/test/cpp/interop/server_helper.cc b/test/cpp/interop/server_helper.cc
index 30a78ffddf..e897f4ebf0 100644
--- a/test/cpp/interop/server_helper.cc
+++ b/test/cpp/interop/server_helper.cc
@@ -36,10 +36,11 @@
#include <memory>
#include <gflags/gflags.h>
-#include "test/core/end2end/data/ssl_test_data.h"
-#include <grpc++/config.h>
#include <grpc++/server_credentials.h>
+#include "src/core/surface/call.h"
+#include "test/core/end2end/data/ssl_test_data.h"
+
DECLARE_bool(enable_ssl);
namespace grpc {
@@ -58,16 +59,25 @@ std::shared_ptr<ServerCredentials> CreateInteropServerCredentials() {
}
}
-InteropContextInspector::InteropContextInspector(
+InteropServerContextInspector::InteropServerContextInspector(
const ::grpc::ServerContext& context)
: context_(context) {}
-std::shared_ptr<const AuthContext> InteropContextInspector::GetAuthContext()
- const {
+grpc_compression_algorithm
+InteropServerContextInspector::GetCallCompressionAlgorithm() const {
+ return grpc_call_get_compression_algorithm(context_.call_);
+}
+
+gpr_uint32 InteropServerContextInspector::GetEncodingsAcceptedByClient() const {
+ return grpc_call_get_encodings_accepted_by_peer(context_.call_);
+}
+
+std::shared_ptr<const AuthContext>
+InteropServerContextInspector::GetAuthContext() const {
return context_.auth_context();
}
-bool InteropContextInspector::IsCancelled() const {
+bool InteropServerContextInspector::IsCancelled() const {
return context_.IsCancelled();
}
diff --git a/test/cpp/interop/server_helper.h b/test/cpp/interop/server_helper.h
index ce977b4705..7b6b12cd4d 100644
--- a/test/cpp/interop/server_helper.h
+++ b/test/cpp/interop/server_helper.h
@@ -36,6 +36,7 @@
#include <memory>
+#include <grpc/compression.h>
#include <grpc++/server_context.h>
#include <grpc++/server_credentials.h>
@@ -44,13 +45,15 @@ namespace testing {
std::shared_ptr<ServerCredentials> CreateInteropServerCredentials();
-class InteropContextInspector {
+class InteropServerContextInspector {
public:
- InteropContextInspector(const ::grpc::ServerContext& context);
+ InteropServerContextInspector(const ::grpc::ServerContext& context);
// Inspector methods, able to peek inside ServerContext, follow.
std::shared_ptr<const AuthContext> GetAuthContext() const;
bool IsCancelled() const;
+ grpc_compression_algorithm GetCallCompressionAlgorithm() const;
+ gpr_uint32 GetEncodingsAcceptedByClient() const;
private:
const ::grpc::ServerContext& context_;
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.cc b/test/cpp/qps/perf_db_client.cc
index 08d20f0b8d..98efd8c3e3 100644
--- a/test/cpp/qps/perf_db_client.cc
+++ b/test/cpp/qps/perf_db_client.cc
@@ -44,9 +44,7 @@ void PerfDbClient::setConfigs(const ClientConfig& client_config,
}
// sets the QPS
-void PerfDbClient::setQps(double qps) {
- qps_ = qps;
-}
+void PerfDbClient::setQps(double qps) { qps_ = qps; }
// sets the QPS per core
void PerfDbClient::setQpsPerCore(double qps_per_core) {
@@ -54,10 +52,8 @@ void PerfDbClient::setQpsPerCore(double qps_per_core) {
}
// sets the 50th, 90th, 95th, 99th and 99.9th percentile latency
-void PerfDbClient::setLatencies(double perc_lat_50,
- double perc_lat_90,
- double perc_lat_95,
- double perc_lat_99,
+void PerfDbClient::setLatencies(double perc_lat_50, double perc_lat_90,
+ double perc_lat_95, double perc_lat_99,
double perc_lat_99_point_9) {
perc_lat_50_ = perc_lat_50;
perc_lat_90_ = perc_lat_90;
@@ -68,7 +64,8 @@ void PerfDbClient::setLatencies(double perc_lat_50,
// sets the server and client, user and system times
void PerfDbClient::setTimes(double server_system_time, double server_user_time,
- double client_system_time, double client_user_time) {
+ double client_system_time,
+ double client_user_time) {
server_system_time_ = server_system_time;
server_user_time_ = server_user_time;
client_system_time_ = client_system_time;
diff --git a/test/cpp/qps/perf_db_client.h b/test/cpp/qps/perf_db_client.h
index ce7a88bbff..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);
}
@@ -82,9 +81,8 @@ class PerfDbClient {
void setQpsPerCore(double qps_per_core);
// sets the 50th, 90th, 95th, 99th and 99.9th percentile latency
- void setLatencies(double perc_lat_50, double perc_lat_90,
- double perc_lat_95, double perc_lat_99,
- double perc_lat_99_point_9);
+ void setLatencies(double perc_lat_50, double perc_lat_90, double perc_lat_95,
+ double perc_lat_99, double perc_lat_99_point_9);
// sets the server and client, user and system times
void setTimes(double server_system_time, double server_user_time,
diff --git a/test/cpp/qps/qps_interarrival_test.cc b/test/cpp/qps/qps_interarrival_test.cc
index cecd1be03f..a7979e6187 100644
--- a/test/cpp/qps/qps_interarrival_test.cc
+++ b/test/cpp/qps/qps_interarrival_test.cc
@@ -31,18 +31,18 @@
*
*/
-#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;
-void RunTest(RandomDist&& r, int threads, std::string title) {
+void RunTest(RandomDist &&r, int threads, std::string title) {
InterarrivalTimer timer;
timer.init(r, threads);
gpr_histogram *h(gpr_histogram_create(0.01, 60e9));
diff --git a/test/cpp/qps/qps_openloop_test.cc b/test/cpp/qps/qps_openloop_test.cc
index 96a9b4504c..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"
@@ -59,8 +59,8 @@ static void RunQPS() {
client_config.set_async_client_threads(8);
client_config.set_rpc_type(UNARY);
client_config.set_load_type(POISSON);
- client_config.mutable_load_params()->
- mutable_poisson()->set_offered_load(1000.0);
+ client_config.mutable_load_params()->mutable_poisson()->set_offered_load(
+ 1000.0);
ServerConfig server_config;
server_config.set_server_type(ASYNC_SERVER);
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/util/benchmark_config.cc b/test/cpp/util/benchmark_config.cc
index 91fbbf9677..3c38221b4c 100644
--- a/test/cpp/util/benchmark_config.cc
+++ b/test/cpp/util/benchmark_config.cc
@@ -37,7 +37,8 @@
DEFINE_bool(enable_log_reporter, true,
"Enable reporting of benchmark results through GprLog");
-DEFINE_bool(report_metrics_db, false, "True if metrics to be reported to performance database");
+DEFINE_bool(report_metrics_db, false,
+ "True if metrics to be reported to performance database");
DEFINE_string(hashed_id, "", "Hash of the user id");
@@ -45,7 +46,8 @@ DEFINE_string(test_name, "", "Name of the test being executed");
DEFINE_string(sys_info, "", "System information");
-DEFINE_string(server_address, "localhost:50052", "Address of the performance database server");
+DEFINE_string(server_address, "localhost:50052",
+ "Address of the performance database server");
DEFINE_string(tag, "", "Optional tag for the test");
@@ -69,10 +71,10 @@ static std::shared_ptr<Reporter> InitBenchmarkReporters() {
composite_reporter->add(
std::unique_ptr<Reporter>(new GprLogReporter("LogReporter")));
}
- if(FLAGS_report_metrics_db) {
- composite_reporter->add(
- std::unique_ptr<Reporter>(new PerfDbReporter("PerfDbReporter", FLAGS_hashed_id, FLAGS_test_name,
- FLAGS_sys_info, FLAGS_server_address, FLAGS_tag)));
+ if (FLAGS_report_metrics_db) {
+ composite_reporter->add(std::unique_ptr<Reporter>(
+ new PerfDbReporter("PerfDbReporter", FLAGS_hashed_id, FLAGS_test_name,
+ FLAGS_sys_info, FLAGS_server_address, FLAGS_tag)));
}
return std::shared_ptr<Reporter>(composite_reporter);
diff --git a/test/cpp/util/byte_buffer_test.cc b/test/cpp/util/byte_buffer_test.cc
index 13eb49730a..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 {
@@ -46,8 +46,7 @@ namespace {
const char* kContent1 = "hello xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
const char* kContent2 = "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy world";
-class ByteBufferTest : public ::testing::Test {
-};
+class ByteBufferTest : public ::testing::Test {};
TEST_F(ByteBufferTest, CreateFromSingleSlice) {
gpr_slice hello = gpr_slice_from_copied_string(kContent1);
diff --git a/test/cpp/util/cli_call.cc b/test/cpp/util/cli_call.cc
index 83a7a1744a..d60cee9c02 100644
--- a/test/cpp/util/cli_call.cc
+++ b/test/cpp/util/cli_call.cc
@@ -35,24 +35,21 @@
#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 {
namespace {
-void* tag(int i) { return (void*)(gpr_intptr) i; }
+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/echo.proto b/test/cpp/util/echo.proto
index 58ec680ecd..8ea2f59897 100644
--- a/test/cpp/util/echo.proto
+++ b/test/cpp/util/echo.proto
@@ -28,7 +28,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-syntax = "proto2";
+syntax = "proto3";
import "test/cpp/util/messages.proto";
@@ -41,3 +41,7 @@ service TestService {
rpc BidiStream(stream EchoRequest) returns (stream EchoResponse);
rpc Unimplemented(EchoRequest) returns (EchoResponse);
}
+
+service UnimplementedService {
+ rpc Unimplemented(EchoRequest) returns (EchoResponse);
+}
diff --git a/test/cpp/util/echo_duplicate.proto b/test/cpp/util/echo_duplicate.proto
index e54c016d2f..9c1d67825a 100644
--- a/test/cpp/util/echo_duplicate.proto
+++ b/test/cpp/util/echo_duplicate.proto
@@ -30,7 +30,7 @@
// This is a partial copy of echo.proto with a different package name.
-syntax = "proto2";
+syntax = "proto3";
import "test/cpp/util/messages.proto";
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/messages.proto b/test/cpp/util/messages.proto
index 24e199b809..359d1db74f 100644
--- a/test/cpp/util/messages.proto
+++ b/test/cpp/util/messages.proto
@@ -28,32 +28,32 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-syntax = "proto2";
+syntax = "proto3";
package grpc.cpp.test.util;
message RequestParams {
- optional bool echo_deadline = 1;
- optional int32 client_cancel_after_us = 2;
- optional int32 server_cancel_after_us = 3;
- optional bool echo_metadata = 4;
- optional bool check_auth_context = 5;
- optional int32 response_message_length = 6;
- optional bool echo_peer = 7;
+ bool echo_deadline = 1;
+ int32 client_cancel_after_us = 2;
+ int32 server_cancel_after_us = 3;
+ bool echo_metadata = 4;
+ bool check_auth_context = 5;
+ int32 response_message_length = 6;
+ bool echo_peer = 7;
}
message EchoRequest {
- optional string message = 1;
- optional RequestParams param = 2;
+ string message = 1;
+ RequestParams param = 2;
}
message ResponseParams {
- optional int64 request_deadline = 1;
- optional string host = 2;
- optional string peer = 3;
+ int64 request_deadline = 1;
+ string host = 2;
+ string peer = 3;
}
message EchoResponse {
- optional string message = 1;
- optional ResponseParams param = 2;
+ string message = 1;
+ ResponseParams param = 2;
}
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;
diff --git a/test/proto/empty.proto b/test/proto/empty.proto
index 4295a0a960..6d0eb937d6 100644
--- a/test/proto/empty.proto
+++ b/test/proto/empty.proto
@@ -28,7 +28,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-syntax = "proto2";
+syntax = "proto3";
package grpc.testing;
diff --git a/test/proto/messages.proto b/test/proto/messages.proto
index 89e55443b5..193b6c4171 100644
--- a/test/proto/messages.proto
+++ b/test/proto/messages.proto
@@ -30,7 +30,7 @@
// Message definitions to be used by integration test service definitions.
-syntax = "proto2";
+syntax = "proto3";
package grpc.testing;
@@ -57,59 +57,59 @@ enum CompressionType {
// A block of data, to simply increase gRPC message size.
message Payload {
// The type of data in body.
- optional PayloadType type = 1;
+ PayloadType type = 1;
// Primary contents of payload.
- optional bytes body = 2;
+ bytes body = 2;
}
// A protobuf representation for grpc status. This is used by test
// clients to specify a status that the server should attempt to return.
-message EchoStatus {
- optional int32 code = 1;
- optional string message = 2;
+message EchoStatus {
+ int32 code = 1;
+ string message = 2;
}
// Unary request.
message SimpleRequest {
// Desired payload type in the response from the server.
// If response_type is RANDOM, server randomly chooses one from other formats.
- optional PayloadType response_type = 1;
+ PayloadType response_type = 1;
// Desired payload size in the response from the server.
// If response_type is COMPRESSABLE, this denotes the size before compression.
- optional int32 response_size = 2;
+ int32 response_size = 2;
// Optional input payload sent along with the request.
- optional Payload payload = 3;
+ Payload payload = 3;
// Whether SimpleResponse should include username.
- optional bool fill_username = 4;
+ bool fill_username = 4;
// Whether SimpleResponse should include OAuth scope.
- optional bool fill_oauth_scope = 5;
+ bool fill_oauth_scope = 5;
// Compression algorithm to be used by the server for the response (stream)
- optional CompressionType response_compression = 6;
+ CompressionType response_compression = 6;
// Whether server should return a given status
- optional EchoStatus response_status = 7;
+ EchoStatus response_status = 7;
}
// Unary response, as configured by the request.
message SimpleResponse {
// Payload to increase message size.
- optional Payload payload = 1;
+ Payload payload = 1;
// The user the request came from, for verifying authentication was
// successful when the client expected it.
- optional string username = 2;
+ string username = 2;
// OAuth scope.
- optional string oauth_scope = 3;
+ string oauth_scope = 3;
}
// Client-streaming request.
message StreamingInputCallRequest {
// Optional input payload sent along with the request.
- optional Payload payload = 1;
+ Payload payload = 1;
// Not expecting any payload from the response.
}
@@ -117,18 +117,18 @@ message StreamingInputCallRequest {
// Client-streaming response.
message StreamingInputCallResponse {
// Aggregated size of payloads received from the client.
- optional int32 aggregated_payload_size = 1;
+ int32 aggregated_payload_size = 1;
}
// Configuration for a particular response.
message ResponseParameters {
// Desired payload sizes in responses from the server.
// If response_type is COMPRESSABLE, this denotes the size before compression.
- optional int32 size = 1;
+ int32 size = 1;
// Desired interval between consecutive responses in the response stream in
// microseconds.
- optional int32 interval_us = 2;
+ int32 interval_us = 2;
}
// Server-streaming request.
@@ -137,31 +137,31 @@ message StreamingOutputCallRequest {
// If response_type is RANDOM, the payload from each response in the stream
// might be of different types. This is to simulate a mixed type of payload
// stream.
- optional PayloadType response_type = 1;
+ PayloadType response_type = 1;
// Configuration for each expected response message.
repeated ResponseParameters response_parameters = 2;
// Optional input payload sent along with the request.
- optional Payload payload = 3;
+ Payload payload = 3;
// Compression algorithm to be used by the server for the response (stream)
- optional CompressionType response_compression = 6;
+ CompressionType response_compression = 6;
// Whether server should return a given status
- optional EchoStatus response_status = 7;
+ EchoStatus response_status = 7;
}
// Server-streaming response, as configured by the request and parameters.
message StreamingOutputCallResponse {
// Payload to increase response size.
- optional Payload payload = 1;
+ Payload payload = 1;
}
// For reconnect interop test only.
// Server tells client whether its reconnects are following the spec and the
// reconnect backoffs it saw.
message ReconnectInfo {
- optional bool passed = 1;
+ bool passed = 1;
repeated int32 backoff_ms = 2;
}
diff --git a/test/proto/test.proto b/test/proto/test.proto
index 368522dc4c..92aff23929 100644
--- a/test/proto/test.proto
+++ b/test/proto/test.proto
@@ -31,7 +31,7 @@
// An integration test service that covers all the method signature permutations
// of unary/streaming requests/responses.
-syntax = "proto2";
+syntax = "proto3";
import "test/proto/empty.proto";
import "test/proto/messages.proto";