aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/build/systemtap.c42
-rw-r--r--test/core/channel/channel_stack_test.c13
-rw-r--r--test/core/end2end/dualstack_socket_test.c2
-rw-r--r--test/core/end2end/fixtures/chttp2_fullstack.c1
-rw-r--r--test/core/end2end/fixtures/chttp2_fullstack_uds.c1
-rw-r--r--test/core/end2end/fixtures/chttp2_socket_pair.c11
-rw-r--r--test/core/end2end/fixtures/chttp2_socket_pair_one_byte_at_a_time.c11
-rw-r--r--test/core/fling/server.c3
-rw-r--r--test/core/iomgr/tcp_posix_test.c8
-rw-r--r--test/core/profiling/mark_timings.stp40
-rw-r--r--test/core/profiling/timers_test.c4
-rw-r--r--test/core/transport/chttp2/stream_encoder_test.c5
-rw-r--r--test/core/transport/stream_op_test.c13
-rw-r--r--test/core/util/port_windows.c2
-rw-r--r--test/cpp/interop/client.cc9
-rw-r--r--test/cpp/interop/interop_client.cc44
-rw-r--r--test/cpp/interop/interop_client.h2
-rw-r--r--test/cpp/qps/client_sync.cc4
18 files changed, 168 insertions, 47 deletions
diff --git a/test/build/systemtap.c b/test/build/systemtap.c
new file mode 100644
index 0000000000..66ff38ebd6
--- /dev/null
+++ b/test/build/systemtap.c
@@ -0,0 +1,42 @@
+/*
+ *
+ * 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 <sys/sdt.h>
+
+#ifndef _SYS_SDT_H
+#error "_SYS_SDT_H not defined, despite <sys/sdt.h> being present."
+#endif
+
+int main() {
+ return 0;
+}
diff --git a/test/core/channel/channel_stack_test.c b/test/core/channel/channel_stack_test.c
index e92db59249..957dee1aa7 100644
--- a/test/core/channel/channel_stack_test.c
+++ b/test/core/channel/channel_stack_test.c
@@ -55,7 +55,8 @@ static void channel_init_func(grpc_channel_element *elem,
}
static void call_init_func(grpc_call_element *elem,
- const void *server_transport_data) {
+ const void *server_transport_data,
+ grpc_transport_op *initial_op) {
++*(int *)(elem->channel_data);
*(int *)(elem->call_data) = 0;
}
@@ -66,8 +67,7 @@ static void call_destroy_func(grpc_call_element *elem) {
++*(int *)(elem->channel_data);
}
-static void call_func(grpc_call_element *elem, grpc_call_element *from_elem,
- grpc_call_op *op) {
+static void call_func(grpc_call_element *elem, grpc_transport_op *op) {
++*(int *)(elem->call_data);
}
@@ -78,9 +78,8 @@ static void channel_func(grpc_channel_element *elem,
static void test_create_channel_stack(void) {
const grpc_channel_filter filter = {
- call_func, channel_func, sizeof(int),
- call_init_func, call_destroy_func, sizeof(int),
- channel_init_func, channel_destroy_func, "some_test_filter"};
+ call_func, channel_func, sizeof(int), call_init_func, call_destroy_func,
+ sizeof(int), channel_init_func, channel_destroy_func, "some_test_filter"};
const grpc_channel_filter *filters = &filter;
grpc_channel_stack *channel_stack;
grpc_call_stack *call_stack;
@@ -112,7 +111,7 @@ static void test_create_channel_stack(void) {
GPR_ASSERT(*channel_data == 0);
call_stack = gpr_malloc(channel_stack->call_stack_size);
- grpc_call_stack_init(channel_stack, NULL, call_stack);
+ grpc_call_stack_init(channel_stack, NULL, NULL, call_stack);
GPR_ASSERT(call_stack->count == 1);
call_elem = grpc_call_stack_element(call_stack, 0);
GPR_ASSERT(call_elem->filter == channel_elem->filter);
diff --git a/test/core/end2end/dualstack_socket_test.c b/test/core/end2end/dualstack_socket_test.c
index 29097661bc..7b3500233b 100644
--- a/test/core/end2end/dualstack_socket_test.c
+++ b/test/core/end2end/dualstack_socket_test.c
@@ -158,7 +158,7 @@ void test_connect(const char *server_host, const char *client_host, int port,
cq_expect_finished_with_status(v_client, tag(3),
GRPC_STATUS_DEADLINE_EXCEEDED,
"Deadline Exceeded", NULL);
- cq_expect_finish_accepted(v_client, tag(4), GRPC_OP_ERROR);
+ cq_expect_finish_accepted(v_client, tag(4), GRPC_OP_OK);
cq_verify(v_client);
grpc_call_destroy(c);
diff --git a/test/core/end2end/fixtures/chttp2_fullstack.c b/test/core/end2end/fixtures/chttp2_fullstack.c
index ab7c7f4caa..d7de5e5434 100644
--- a/test/core/end2end/fixtures/chttp2_fullstack.c
+++ b/test/core/end2end/fixtures/chttp2_fullstack.c
@@ -37,7 +37,6 @@
#include "src/core/channel/client_channel.h"
#include "src/core/channel/connected_channel.h"
-#include "src/core/channel/http_filter.h"
#include "src/core/channel/http_server_filter.h"
#include "src/core/surface/channel.h"
#include "src/core/surface/client.h"
diff --git a/test/core/end2end/fixtures/chttp2_fullstack_uds.c b/test/core/end2end/fixtures/chttp2_fullstack_uds.c
index 27e4baf3c0..53803b0f1d 100644
--- a/test/core/end2end/fixtures/chttp2_fullstack_uds.c
+++ b/test/core/end2end/fixtures/chttp2_fullstack_uds.c
@@ -39,7 +39,6 @@
#include "src/core/channel/client_channel.h"
#include "src/core/channel/connected_channel.h"
-#include "src/core/channel/http_filter.h"
#include "src/core/channel/http_server_filter.h"
#include "src/core/support/string.h"
#include "src/core/surface/channel.h"
diff --git a/test/core/end2end/fixtures/chttp2_socket_pair.c b/test/core/end2end/fixtures/chttp2_socket_pair.c
index 1225f7db0c..d19ceb178b 100644
--- a/test/core/end2end/fixtures/chttp2_socket_pair.c
+++ b/test/core/end2end/fixtures/chttp2_socket_pair.c
@@ -37,7 +37,6 @@
#include "src/core/channel/client_channel.h"
#include "src/core/channel/connected_channel.h"
-#include "src/core/channel/http_filter.h"
#include "src/core/channel/http_client_filter.h"
#include "src/core/channel/http_server_filter.h"
#include "src/core/iomgr/endpoint_pair.h"
@@ -60,8 +59,8 @@
static grpc_transport_setup_result server_setup_transport(
void *ts, grpc_transport *transport, grpc_mdctx *mdctx) {
grpc_end2end_test_fixture *f = ts;
- static grpc_channel_filter const *extra_filters[] = {&grpc_http_server_filter,
- &grpc_http_filter};
+ static grpc_channel_filter const *extra_filters[] = {
+ &grpc_http_server_filter};
return grpc_server_setup_transport(f->server, transport, extra_filters,
GPR_ARRAY_SIZE(extra_filters), mdctx);
}
@@ -75,9 +74,9 @@ static grpc_transport_setup_result client_setup_transport(
void *ts, grpc_transport *transport, grpc_mdctx *mdctx) {
sp_client_setup *cs = ts;
- const grpc_channel_filter *filters[] = {
- &grpc_client_surface_filter, &grpc_http_client_filter, &grpc_http_filter,
- &grpc_connected_channel_filter};
+ const grpc_channel_filter *filters[] = {&grpc_client_surface_filter,
+ &grpc_http_client_filter,
+ &grpc_connected_channel_filter};
size_t nfilters = sizeof(filters) / sizeof(*filters);
grpc_channel *channel = grpc_channel_create_from_filters(
filters, nfilters, cs->client_args, mdctx, 1);
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 9f6ad98006..ddde585b83 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
@@ -37,7 +37,6 @@
#include "src/core/channel/client_channel.h"
#include "src/core/channel/connected_channel.h"
-#include "src/core/channel/http_filter.h"
#include "src/core/channel/http_client_filter.h"
#include "src/core/channel/http_server_filter.h"
#include "src/core/iomgr/endpoint_pair.h"
@@ -60,8 +59,8 @@
static grpc_transport_setup_result server_setup_transport(
void *ts, grpc_transport *transport, grpc_mdctx *mdctx) {
grpc_end2end_test_fixture *f = ts;
- static grpc_channel_filter const *extra_filters[] = {&grpc_http_server_filter,
- &grpc_http_filter};
+ static grpc_channel_filter const *extra_filters[] = {
+ &grpc_http_server_filter};
return grpc_server_setup_transport(f->server, transport, extra_filters,
GPR_ARRAY_SIZE(extra_filters), mdctx);
}
@@ -75,9 +74,9 @@ static grpc_transport_setup_result client_setup_transport(
void *ts, grpc_transport *transport, grpc_mdctx *mdctx) {
sp_client_setup *cs = ts;
- const grpc_channel_filter *filters[] = {
- &grpc_client_surface_filter, &grpc_http_client_filter, &grpc_http_filter,
- &grpc_connected_channel_filter};
+ const grpc_channel_filter *filters[] = {&grpc_client_surface_filter,
+ &grpc_http_client_filter,
+ &grpc_connected_channel_filter};
size_t nfilters = sizeof(filters) / sizeof(*filters);
grpc_channel *channel = grpc_channel_create_from_filters(
filters, nfilters, cs->client_args, mdctx, 1);
diff --git a/test/core/fling/server.c b/test/core/fling/server.c
index ca39cd84b1..1785461383 100644
--- a/test/core/fling/server.c
+++ b/test/core/fling/server.c
@@ -39,6 +39,7 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
+#include <unistd.h>
#include "test/core/util/grpc_profiler.h"
#include "test/core/util/test_config.h"
@@ -165,7 +166,7 @@ static void start_send_status(void) {
tag(FLING_SERVER_SEND_STATUS_FOR_STREAMING)));
}
-static void sigint_handler(int x) { got_sigint = 1; }
+static void sigint_handler(int x) { _exit(0); }
int main(int argc, char **argv) {
grpc_event *ev;
diff --git a/test/core/iomgr/tcp_posix_test.c b/test/core/iomgr/tcp_posix_test.c
index 59e525a8e1..40abed5f6e 100644
--- a/test/core/iomgr/tcp_posix_test.c
+++ b/test/core/iomgr/tcp_posix_test.c
@@ -40,6 +40,7 @@
#include <sys/socket.h>
#include <unistd.h>
+#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
@@ -140,11 +141,12 @@ static void read_cb(void *user_data, gpr_slice *slices, size_t nslices,
grpc_endpoint_cb_status error) {
struct read_socket_state *state = (struct read_socket_state *)user_data;
ssize_t read_bytes;
- int current_data = 0;
+ int current_data;
GPR_ASSERT(error == GRPC_ENDPOINT_CB_OK);
gpr_mu_lock(&state->mu);
+ current_data = state->read_bytes % 256;
read_bytes = count_and_unref_slices(slices, nslices, &current_data);
state->read_bytes += read_bytes;
gpr_log(GPR_INFO, "Read %d bytes of %d", read_bytes,
@@ -483,10 +485,10 @@ static grpc_endpoint_test_config configs[] = {
int main(int argc, char **argv) {
grpc_test_init(argc, argv);
- grpc_iomgr_init();
+ grpc_init();
run_tests();
grpc_endpoint_tests(configs[0]);
- grpc_iomgr_shutdown();
+ grpc_shutdown();
return 0;
}
diff --git a/test/core/profiling/mark_timings.stp b/test/core/profiling/mark_timings.stp
new file mode 100644
index 0000000000..0c0a417faf
--- /dev/null
+++ b/test/core/profiling/mark_timings.stp
@@ -0,0 +1,40 @@
+/* This script requires a command line argument, to be used in the "process"
+ * probe definition.
+ *
+ * For a statically build binary, that'd be the name of the binary itself.
+ * For dinamically built ones, point to the location of the libgprc.so being
+ * used. */
+
+global starts, times, times_per_tag
+
+probe process(@1).mark("timing_ns_begin") {
+ starts[$arg1, tid()] = gettimeofday_ns();
+}
+
+probe process(@1).mark("timing_ns_end") {
+ tag = $arg1
+ t = gettimeofday_ns();
+ if (s = starts[tag, tid()]) {
+ times[tag, tid()] <<< t-s;
+ delete starts[tag, tid()];
+ }
+}
+
+probe end {
+ printf("%15s %9s %10s %10s %10s %10s\n", "tag", "tid", "count",
+ "min(ns)", "avg(ns)", "max(ns)");
+ foreach ([tag+, tid] in times) {
+ printf("%15X %9d %10d %10d %10d %10d\n", tag, tid, @count(times[tag, tid]),
+ @min(times[tag, tid]), @avg(times[tag, tid]), @max(times[tag, tid]));
+ }
+
+ printf("Per tag average of averages\n");
+ foreach ([tag+, tid] in times) {
+ times_per_tag[tag] <<< @avg(times[tag, tid]);
+ }
+ printf("%15s %10s %10s\n", "tag", "count", "avg(ns)");
+ foreach ([tag+] in times_per_tag) {
+ printf("%15X %10d %10d\n", tag, @count(times_per_tag[tag]),
+ @avg(times_per_tag[tag]));
+ }
+}
diff --git a/test/core/profiling/timers_test.c b/test/core/profiling/timers_test.c
index 55e59c969e..12b08c115e 100644
--- a/test/core/profiling/timers_test.c
+++ b/test/core/profiling/timers_test.c
@@ -76,8 +76,8 @@ void test_log_events(int num_seqs) {
int main(int argc, char **argv) {
grpc_test_init(argc, argv);
- grpc_timers_log_global_init();
+ grpc_timers_global_init();
test_log_events(1000000);
- grpc_timers_log_global_destroy();
+ grpc_timers_global_destroy();
return 0;
}
diff --git a/test/core/transport/chttp2/stream_encoder_test.c b/test/core/transport/chttp2/stream_encoder_test.c
index bda8298eb3..91833440cd 100644
--- a/test/core/transport/chttp2/stream_encoder_test.c
+++ b/test/core/transport/chttp2/stream_encoder_test.c
@@ -102,15 +102,10 @@ static void verify_sopb(size_t window_available, int eof,
gpr_slice_unref(expect);
}
-static void assert_result_ok(void *user_data, grpc_op_error error) {
- GPR_ASSERT(error == GRPC_OP_OK);
-}
-
static void test_small_data_framing(void) {
grpc_sopb_add_no_op(&g_sopb);
verify_sopb(10, 0, 0, "");
- grpc_sopb_add_flow_ctl_cb(&g_sopb, assert_result_ok, NULL);
grpc_sopb_add_slice(&g_sopb, create_test_slice(3));
verify_sopb(10, 0, 3, "000003 0000 deadbeef 000102");
diff --git a/test/core/transport/stream_op_test.c b/test/core/transport/stream_op_test.c
index 5885223894..546080deb9 100644
--- a/test/core/transport/stream_op_test.c
+++ b/test/core/transport/stream_op_test.c
@@ -38,10 +38,6 @@
#include <grpc/support/log.h>
#include "test/core/util/test_config.h"
-static void flow_ctl_cb_fails(void *ignored, grpc_op_error error) {
- GPR_ASSERT(error == GRPC_OP_ERROR);
-}
-
static void assert_slices_equal(gpr_slice a, gpr_slice b) {
GPR_ASSERT(a.refcount == b.refcount);
if (a.refcount) {
@@ -60,7 +56,6 @@ int main(int argc, char **argv) {
gpr_slice test_slice_2 = gpr_slice_malloc(2);
gpr_slice test_slice_3 = gpr_slice_malloc(3);
gpr_slice test_slice_4 = gpr_slice_malloc(4);
- char x;
unsigned i;
grpc_stream_op_buffer buf;
@@ -78,11 +73,10 @@ int main(int argc, char **argv) {
grpc_sopb_add_slice(&buf, test_slice_2);
grpc_sopb_add_slice(&buf, test_slice_3);
grpc_sopb_add_slice(&buf, test_slice_4);
- grpc_sopb_add_flow_ctl_cb(&buf, flow_ctl_cb_fails, &x);
grpc_sopb_add_no_op(&buf);
/* verify that the data went in ok */
- GPR_ASSERT(buf.nops == 7);
+ GPR_ASSERT(buf.nops == 6);
GPR_ASSERT(buf.ops[0].type == GRPC_OP_BEGIN_MESSAGE);
GPR_ASSERT(buf.ops[0].data.begin_message.length == 1);
GPR_ASSERT(buf.ops[0].data.begin_message.flags == 2);
@@ -94,10 +88,7 @@ int main(int argc, char **argv) {
assert_slices_equal(buf.ops[3].data.slice, test_slice_3);
GPR_ASSERT(buf.ops[4].type == GRPC_OP_SLICE);
assert_slices_equal(buf.ops[4].data.slice, test_slice_4);
- GPR_ASSERT(buf.ops[5].type == GRPC_OP_FLOW_CTL_CB);
- GPR_ASSERT(buf.ops[5].data.flow_ctl_cb.cb == flow_ctl_cb_fails);
- GPR_ASSERT(buf.ops[5].data.flow_ctl_cb.arg == &x);
- GPR_ASSERT(buf.ops[6].type == GRPC_NO_OP);
+ GPR_ASSERT(buf.ops[5].type == GRPC_NO_OP);
/* initialize the second buffer */
grpc_sopb_init(&buf2);
diff --git a/test/core/util/port_windows.c b/test/core/util/port_windows.c
index 17058c3353..fc52150435 100644
--- a/test/core/util/port_windows.c
+++ b/test/core/util/port_windows.c
@@ -57,7 +57,7 @@ static int is_port_available(int *port, int is_tcp) {
GPR_ASSERT(*port >= 0);
GPR_ASSERT(*port <= 65535);
- if (fd < 0) {
+ if (INVALID_SOCKET == fd) {
gpr_log(GPR_ERROR, "socket() failed: %s", strerror(errno));
return 0;
}
diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc
index 072968f7cd..65ce2e9c2a 100644
--- a/test/cpp/interop/client.cc
+++ b/test/cpp/interop/client.cc
@@ -62,6 +62,8 @@ DEFINE_string(test_case, "large_unary",
" streaming with slow client consumer; "
"half_duplex : half-duplex streaming; "
"ping_pong : full-duplex streaming; "
+ "cancel_after_begin : cancel stream after starting it; "
+ "cancel_after_first_response: cancel on first response; "
"service_account_creds : large_unary with service_account auth; "
"compute_engine_creds: large_unary with compute engine auth; "
"jwt_token_creds: large_unary with JWT token auth; "
@@ -95,6 +97,10 @@ int main(int argc, char** argv) {
client.DoHalfDuplex();
} else if (FLAGS_test_case == "ping_pong") {
client.DoPingPong();
+ } else if (FLAGS_test_case == "cancel_after_begin") {
+ client.DoCancelAfterBegin();
+ } else if (FLAGS_test_case == "cancel_after_first_response") {
+ client.DoCancelAfterFirstResponse();
} else if (FLAGS_test_case == "service_account_creds") {
grpc::string json_key = GetServiceAccountJsonKey();
client.DoServiceAccountCreds(json_key, FLAGS_oauth_scope);
@@ -111,6 +117,8 @@ int main(int argc, char** argv) {
client.DoResponseStreaming();
client.DoHalfDuplex();
client.DoPingPong();
+ client.DoCancelAfterBegin();
+ client.DoCancelAfterFirstResponse();
// service_account_creds and jwt_token_creds can only run with ssl.
if (FLAGS_enable_ssl) {
grpc::string json_key = GetServiceAccountJsonKey();
@@ -123,6 +131,7 @@ int main(int argc, char** argv) {
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|"
"service_account_creds|compute_engine_creds|jwt_token_creds",
FLAGS_test_case.c_str());
ret = 1;
diff --git a/test/cpp/interop/interop_client.cc b/test/cpp/interop/interop_client.cc
index 7f5757d2ba..874510e54f 100644
--- a/test/cpp/interop/interop_client.cc
+++ b/test/cpp/interop/interop_client.cc
@@ -307,5 +307,49 @@ void InteropClient::DoPingPong() {
gpr_log(GPR_INFO, "Ping pong streaming done.");
}
+void InteropClient::DoCancelAfterBegin() {
+ gpr_log(GPR_INFO, "Sending request steaming rpc ...");
+ std::unique_ptr<TestService::Stub> stub(TestService::NewStub(channel_));
+
+ ClientContext context;
+ StreamingInputCallRequest request;
+ StreamingInputCallResponse response;
+
+ std::unique_ptr<ClientWriter<StreamingInputCallRequest>> stream(
+ stub->StreamingInputCall(&context, &response));
+
+ gpr_log(GPR_INFO, "Trying to cancel...");
+ context.TryCancel();
+ Status s = stream->Finish();
+ GPR_ASSERT(s.code() == StatusCode::CANCELLED);
+ gpr_log(GPR_INFO, "Canceling streaming done.");
+}
+
+void InteropClient::DoCancelAfterFirstResponse() {
+ gpr_log(GPR_INFO, "Sending Ping Pong streaming rpc ...");
+ std::unique_ptr<TestService::Stub> stub(TestService::NewStub(channel_));
+
+ ClientContext context;
+ std::unique_ptr<ClientReaderWriter<StreamingOutputCallRequest,
+ StreamingOutputCallResponse>>
+ stream(stub->FullDuplexCall(&context));
+
+ StreamingOutputCallRequest request;
+ request.set_response_type(PayloadType::COMPRESSABLE);
+ ResponseParameters* response_parameter = request.add_response_parameters();
+ response_parameter->set_size(31415);
+ request.mutable_payload()->set_body(grpc::string(27182, '\0'));
+ 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();
+
+ Status s = stream->Finish();
+ gpr_log(GPR_INFO, "Canceling pingpong streaming done.");
+}
+
} // namespace testing
} // namespace grpc
diff --git a/test/cpp/interop/interop_client.h b/test/cpp/interop/interop_client.h
index 3161f7f875..d9c895dfd9 100644
--- a/test/cpp/interop/interop_client.h
+++ b/test/cpp/interop/interop_client.h
@@ -57,6 +57,8 @@ class InteropClient {
void DoRequestStreaming();
void DoResponseStreaming();
void DoResponseStreamingWithSlowConsumer();
+ void DoCancelAfterBegin();
+ void DoCancelAfterFirstResponse();
// Auth tests.
// username is a string containing the user email
void DoJwtTokenCreds(const grpc::string& username);
diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc
index 5dd64d0b13..0809eb5b6c 100644
--- a/test/cpp/qps/client_sync.cc
+++ b/test/cpp/qps/client_sync.cc
@@ -70,7 +70,7 @@ class SynchronousClient : public Client {
responses_.resize(num_threads_);
}
- virtual ~SynchronousClient() { EndThreads(); }
+ virtual ~SynchronousClient() {};
protected:
size_t num_threads_;
@@ -81,7 +81,7 @@ class SynchronousUnaryClient GRPC_FINAL : public SynchronousClient {
public:
SynchronousUnaryClient(const ClientConfig& config):
SynchronousClient(config) {StartThreads(num_threads_);}
- ~SynchronousUnaryClient() {}
+ ~SynchronousUnaryClient() {EndThreads();}
bool ThreadFunc(Histogram* histogram, size_t thread_idx) GRPC_OVERRIDE {
auto* stub = channels_[thread_idx % channels_.size()].get_stub();