aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar ctiller <ctiller@google.com>2014-12-15 15:14:12 -0800
committerGravatar Nicolas Noble <nnoble@google.com>2014-12-16 16:57:49 -0800
commit2845cade4cfb481bc93e9f97430cb6982ec30c21 (patch)
tree836d20fb4dfd0bd681bf9e571141996d3ba8f809 /test
parentc6d61c4dd6deb80477cb5977b79b00614b20b409 (diff)
Trailing metadata support.
Actually exposing it from the C API. Also removing grpc_status, since it's mostly useless. Change on 2014/12/15 by ctiller <ctiller@google.com> ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=82180546
Diffstat (limited to 'test')
-rw-r--r--test/core/echo/server.c6
-rw-r--r--test/core/end2end/cq_verifier.c32
-rw-r--r--test/core/end2end/cq_verifier.h3
-rw-r--r--test/core/end2end/dualstack_socket_test.c11
-rwxr-xr-xtest/core/end2end/gen_build_json.py1
-rw-r--r--test/core/end2end/no_server_test.c4
-rw-r--r--test/core/end2end/tests/cancel_after_accept.c7
-rw-r--r--test/core/end2end/tests/cancel_after_accept_and_writes_closed.c7
-rw-r--r--test/core/end2end/tests/cancel_after_invoke.c4
-rw-r--r--test/core/end2end/tests/cancel_before_invoke.c4
-rw-r--r--test/core/end2end/tests/disappearing_server.c8
-rw-r--r--test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls.c4
-rw-r--r--test/core/end2end/tests/invoke_large_request.c8
-rw-r--r--test/core/end2end/tests/max_concurrent_streams.c21
-rw-r--r--test/core/end2end/tests/ping_pong_streaming.c8
-rw-r--r--test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c8
-rw-r--r--test/core/end2end/tests/request_response_with_metadata_and_payload.c8
-rw-r--r--test/core/end2end/tests/request_response_with_payload.c8
-rw-r--r--test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c214
-rw-r--r--test/core/end2end/tests/request_with_large_metadata.c5
-rw-r--r--test/core/end2end/tests/request_with_payload.c8
-rw-r--r--test/core/end2end/tests/simple_delayed_request.c8
-rw-r--r--test/core/end2end/tests/simple_request.c16
-rw-r--r--test/core/end2end/tests/thread_stress.c3
-rw-r--r--test/core/end2end/tests/writes_done_hangs_with_pending_read.c8
-rw-r--r--test/core/fling/server.c6
26 files changed, 320 insertions, 100 deletions
diff --git a/test/core/echo/server.c b/test/core/echo/server.c
index d80b55e76d..e70743af22 100644
--- a/test/core/echo/server.c
+++ b/test/core/echo/server.c
@@ -51,8 +51,6 @@ static grpc_completion_queue *cq;
static grpc_server *server;
static int got_sigint = 0;
-static const grpc_status status_ok = {GRPC_STATUS_OK, NULL};
-
typedef struct {
gpr_refcount pending_ops;
gpr_intmax bytes_read;
@@ -145,8 +143,8 @@ int main(int argc, char **argv) {
GRPC_WRITE_BUFFER_HINT) ==
GRPC_CALL_OK);
} else {
- GPR_ASSERT(grpc_call_start_write_status(ev->call, status_ok, s) ==
- GRPC_CALL_OK);
+ GPR_ASSERT(grpc_call_start_write_status(ev->call, GRPC_STATUS_OK,
+ NULL, s) == GRPC_CALL_OK);
}
break;
case GRPC_FINISH_ACCEPTED:
diff --git a/test/core/end2end/cq_verifier.c b/test/core/end2end/cq_verifier.c
index 4d57fdc37f..1181f1b4de 100644
--- a/test/core/end2end/cq_verifier.c
+++ b/test/core/end2end/cq_verifier.c
@@ -80,7 +80,8 @@ typedef struct expectation {
} server_rpc_new;
metadata *client_metadata_read;
struct {
- grpc_status status;
+ grpc_status_code status;
+ const char *details;
metadata *metadata;
} finished;
gpr_slice *read;
@@ -201,12 +202,14 @@ static void verify_matches(expectation *e, grpc_event *ev) {
ev->data.client_metadata_read.count);
break;
case GRPC_FINISHED:
- if (e->data.finished.status.code != GRPC_STATUS__DO_NOT_USE) {
- GPR_ASSERT(e->data.finished.status.code == ev->data.finished.code);
- GPR_ASSERT(string_equivalent(e->data.finished.status.details,
+ if (e->data.finished.status != GRPC_STATUS__DO_NOT_USE) {
+ GPR_ASSERT(e->data.finished.status == ev->data.finished.status);
+ GPR_ASSERT(string_equivalent(e->data.finished.details,
ev->data.finished.details));
}
- verify_and_destroy_metadata(e->data.finished.metadata, NULL, 0);
+ verify_and_destroy_metadata(e->data.finished.metadata,
+ ev->data.finished.metadata_elements,
+ ev->data.finished.metadata_count);
break;
case GRPC_QUEUE_SHUTDOWN:
gpr_log(GPR_ERROR, "premature queue shutdown");
@@ -279,9 +282,8 @@ static size_t expectation_to_string(char *out, expectation *e) {
return len;
case GRPC_FINISHED:
str = metadata_expectation_string(e->data.finished.metadata);
- len = sprintf(out, "GRPC_FINISHED code=%d details=%s %s",
- e->data.finished.status.code,
- e->data.finished.status.details, str);
+ len = sprintf(out, "GRPC_FINISHED status=%d details=%s %s",
+ e->data.finished.status, e->data.finished.details, str);
gpr_free(str);
return len;
case GRPC_READ:
@@ -456,25 +458,27 @@ void cq_expect_client_metadata_read(cq_verifier *v, void *tag, ...) {
va_end(args);
}
-static void finished_internal(cq_verifier *v, void *tag, grpc_status status,
+static void finished_internal(cq_verifier *v, void *tag,
+ grpc_status_code status, const char *details,
va_list args) {
expectation *e = add(v, GRPC_FINISHED, tag);
e->data.finished.status = status;
+ e->data.finished.details = details;
e->data.finished.metadata = metadata_from_args(args);
}
void cq_expect_finished_with_status(cq_verifier *v, void *tag,
- grpc_status status, ...) {
+ grpc_status_code status,
+ const char *details, ...) {
va_list args;
- va_start(args, status);
- finished_internal(v, tag, status, args);
+ va_start(args, details);
+ finished_internal(v, tag, status, details, args);
va_end(args);
}
void cq_expect_finished(cq_verifier *v, void *tag, ...) {
va_list args;
- grpc_status status = {GRPC_STATUS__DO_NOT_USE, NULL};
va_start(args, tag);
- finished_internal(v, tag, status, args);
+ finished_internal(v, tag, GRPC_STATUS__DO_NOT_USE, NULL, args);
va_end(args);
}
diff --git a/test/core/end2end/cq_verifier.h b/test/core/end2end/cq_verifier.h
index 60f56bde67..9711e0067c 100644
--- a/test/core/end2end/cq_verifier.h
+++ b/test/core/end2end/cq_verifier.h
@@ -67,7 +67,8 @@ void cq_expect_server_rpc_new(cq_verifier *v, grpc_call **output_call,
gpr_timespec deadline, ...);
void cq_expect_client_metadata_read(cq_verifier *v, void *tag, ...);
void cq_expect_finished_with_status(cq_verifier *v, void *tag,
- grpc_status status, ...);
+ grpc_status_code status_code,
+ const char *details, ...);
void cq_expect_finished(cq_verifier *v, void *tag, ...);
#endif /* __GRPC_TEST_END2END_CQ_VERIFIER_H__ */
diff --git a/test/core/end2end/dualstack_socket_test.c b/test/core/end2end/dualstack_socket_test.c
index 55c4bb25b2..808fcbd65d 100644
--- a/test/core/end2end/dualstack_socket_test.c
+++ b/test/core/end2end/dualstack_socket_test.c
@@ -63,8 +63,6 @@ static void drain_cq(grpc_completion_queue *cq) {
void test_connect(const char *server_host, const char *client_host, int port,
int expect_ok) {
- const grpc_status send_status = {GRPC_STATUS_UNIMPLEMENTED, "xyz"};
- const grpc_status cancelled_status = {GRPC_STATUS_CANCELLED, NULL};
char *client_hostport;
char *server_hostport;
grpc_channel *client;
@@ -130,8 +128,10 @@ void test_connect(const char *server_host, const char *client_host, int port,
cq_verify(v_client);
GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_write_status(s, send_status, tag(5)));
- cq_expect_finished_with_status(v_client, tag(3), send_status, NULL);
+ grpc_call_start_write_status(s, GRPC_STATUS_UNIMPLEMENTED, "xyz",
+ tag(5)));
+ cq_expect_finished_with_status(v_client, tag(3), GRPC_STATUS_UNIMPLEMENTED,
+ "xyz", NULL);
cq_verify(v_client);
cq_expect_finish_accepted(v_server, tag(5), GRPC_OP_OK);
@@ -145,7 +145,8 @@ void test_connect(const char *server_host, const char *client_host, int port,
/* Check for a failed connection. */
cq_expect_invoke_accepted(v_client, tag(1), GRPC_OP_ERROR);
cq_expect_client_metadata_read(v_client, tag(2), NULL);
- cq_expect_finished_with_status(v_client, tag(3), cancelled_status, NULL);
+ cq_expect_finished_with_status(v_client, tag(3), GRPC_STATUS_CANCELLED,
+ NULL, NULL);
cq_verify(v_client);
grpc_call_destroy(c);
diff --git a/test/core/end2end/gen_build_json.py b/test/core/end2end/gen_build_json.py
index a6b5a0c827..4412556590 100755
--- a/test/core/end2end/gen_build_json.py
+++ b/test/core/end2end/gen_build_json.py
@@ -31,6 +31,7 @@ END2END_TESTS = [
'request_response_with_binary_metadata_and_payload',
'request_response_with_metadata_and_payload',
'request_response_with_payload',
+ 'request_response_with_trailing_metadata_and_payload',
'simple_delayed_request',
'simple_request',
'thread_stress',
diff --git a/test/core/end2end/no_server_test.c b/test/core/end2end/no_server_test.c
index f0810563a7..f506b8bcf7 100644
--- a/test/core/end2end/no_server_test.c
+++ b/test/core/end2end/no_server_test.c
@@ -47,7 +47,6 @@ int main(int argc, char **argv) {
cq_verifier *cqv;
grpc_event *ev;
int done;
- grpc_status expect_status = {GRPC_STATUS_CANCELLED, NULL};
grpc_test_init(argc, argv);
grpc_init();
@@ -63,7 +62,8 @@ int main(int argc, char **argv) {
/* verify that all tags get completed */
cq_expect_invoke_accepted(cqv, tag(1), GRPC_OP_ERROR);
cq_expect_client_metadata_read(cqv, tag(2), NULL);
- cq_expect_finished_with_status(cqv, tag(3), expect_status, NULL);
+ cq_expect_finished_with_status(cqv, tag(3), GRPC_STATUS_CANCELLED, NULL,
+ NULL);
cq_verify(cqv);
grpc_completion_queue_shutdown(cq);
diff --git a/test/core/end2end/tests/cancel_after_accept.c b/test/core/end2end/tests/cancel_after_accept.c
index c9c3a18923..3b570401ef 100644
--- a/test/core/end2end/tests/cancel_after_accept.c
+++ b/test/core/end2end/tests/cancel_after_accept.c
@@ -119,7 +119,6 @@ static void test_cancel_after_accept(grpc_end2end_test_config config,
gpr_timespec deadline = five_seconds_time();
cq_verifier *v_client = cq_verifier_create(f.client_cq);
cq_verifier *v_server = cq_verifier_create(f.server_cq);
- grpc_status chk_status = {GRPC_STATUS_CANCELLED, NULL};
c = grpc_channel_create_call(f.client, "/foo", "test.google.com", deadline);
GPR_ASSERT(c);
@@ -140,10 +139,12 @@ static void test_cancel_after_accept(grpc_end2end_test_config config,
GPR_ASSERT(GRPC_CALL_OK == call_cancel(c));
- cq_expect_finished_with_status(v_client, tag(3), chk_status, NULL);
+ cq_expect_finished_with_status(v_client, tag(3), GRPC_STATUS_CANCELLED, NULL,
+ NULL);
cq_verify(v_client);
- cq_expect_finished_with_status(v_server, tag(102), chk_status, NULL);
+ cq_expect_finished_with_status(v_server, tag(102), GRPC_STATUS_CANCELLED,
+ NULL, NULL);
cq_verify(v_server);
grpc_call_destroy(c);
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 904dabe231..e20b0ec0b2 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
@@ -119,7 +119,6 @@ static void test_cancel_after_accept_and_writes_closed(
gpr_timespec deadline = five_seconds_time();
cq_verifier *v_client = cq_verifier_create(f.client_cq);
cq_verifier *v_server = cq_verifier_create(f.server_cq);
- grpc_status chk_status = {GRPC_STATUS_CANCELLED, NULL};
c = grpc_channel_create_call(f.client, "/foo", "test.google.com", deadline);
GPR_ASSERT(c);
@@ -148,10 +147,12 @@ static void test_cancel_after_accept_and_writes_closed(
GPR_ASSERT(GRPC_CALL_OK == call_cancel(c));
- cq_expect_finished_with_status(v_client, tag(3), chk_status, NULL);
+ cq_expect_finished_with_status(v_client, tag(3), GRPC_STATUS_CANCELLED, NULL,
+ NULL);
cq_verify(v_client);
- cq_expect_finished_with_status(v_server, tag(102), chk_status, NULL);
+ cq_expect_finished_with_status(v_server, tag(102), GRPC_STATUS_CANCELLED,
+ NULL, NULL);
cq_verify(v_server);
grpc_call_destroy(c);
diff --git a/test/core/end2end/tests/cancel_after_invoke.c b/test/core/end2end/tests/cancel_after_invoke.c
index 59208134a4..4fab9f7eff 100644
--- a/test/core/end2end/tests/cancel_after_invoke.c
+++ b/test/core/end2end/tests/cancel_after_invoke.c
@@ -117,7 +117,6 @@ static void test_cancel_after_invoke(grpc_end2end_test_config config,
grpc_end2end_test_fixture f = begin_test(config, __FUNCTION__, NULL, NULL);
gpr_timespec deadline = five_seconds_time();
cq_verifier *v_client = cq_verifier_create(f.client_cq);
- grpc_status chk_status = {GRPC_STATUS_CANCELLED, NULL};
c = grpc_channel_create_call(f.client, "/foo", "test.google.com", deadline);
GPR_ASSERT(c);
@@ -130,7 +129,8 @@ static void test_cancel_after_invoke(grpc_end2end_test_config config,
GPR_ASSERT(GRPC_CALL_OK == call_cancel(c));
cq_expect_client_metadata_read(v_client, tag(2), NULL);
- cq_expect_finished_with_status(v_client, tag(3), chk_status, NULL);
+ cq_expect_finished_with_status(v_client, tag(3), GRPC_STATUS_CANCELLED, NULL,
+ NULL);
cq_verify(v_client);
grpc_call_destroy(c);
diff --git a/test/core/end2end/tests/cancel_before_invoke.c b/test/core/end2end/tests/cancel_before_invoke.c
index afffc2fba4..2d8d465b24 100644
--- a/test/core/end2end/tests/cancel_before_invoke.c
+++ b/test/core/end2end/tests/cancel_before_invoke.c
@@ -112,7 +112,6 @@ static void test_cancel_before_invoke(grpc_end2end_test_config config) {
grpc_end2end_test_fixture f = begin_test(config, __FUNCTION__, NULL, NULL);
gpr_timespec deadline = five_seconds_time();
cq_verifier *v_client = cq_verifier_create(f.client_cq);
- grpc_status chk_status = {GRPC_STATUS_CANCELLED, NULL};
c = grpc_channel_create_call(f.client, "/foo", "test.google.com", deadline);
GPR_ASSERT(c);
@@ -123,7 +122,8 @@ static void test_cancel_before_invoke(grpc_end2end_test_config config) {
grpc_call_start_invoke(c, f.client_cq, tag(1), tag(2), tag(3), 0));
cq_expect_invoke_accepted(v_client, tag(1), GRPC_OP_ERROR);
cq_expect_client_metadata_read(v_client, tag(2), NULL);
- cq_expect_finished_with_status(v_client, tag(3), chk_status, NULL);
+ cq_expect_finished_with_status(v_client, tag(3), GRPC_STATUS_CANCELLED, NULL,
+ NULL);
cq_verify(v_client);
grpc_call_destroy(c);
diff --git a/test/core/end2end/tests/disappearing_server.c b/test/core/end2end/tests/disappearing_server.c
index 4d3738a365..c421798fc7 100644
--- a/test/core/end2end/tests/disappearing_server.c
+++ b/test/core/end2end/tests/disappearing_server.c
@@ -95,7 +95,6 @@ static void do_request_and_shutdown_server(grpc_end2end_test_fixture *f,
cq_verifier *v_server) {
grpc_call *c;
grpc_call *s;
- grpc_status send_status = {GRPC_STATUS_UNIMPLEMENTED, "xyz"};
gpr_timespec deadline = five_seconds_time();
c = grpc_channel_create_call(f->client, "/foo", "test.google.com", deadline);
@@ -124,9 +123,10 @@ static void do_request_and_shutdown_server(grpc_end2end_test_fixture *f,
- and still complete the request */
grpc_server_shutdown(f->server);
- GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_write_status(s, send_status, tag(5)));
- cq_expect_finished_with_status(v_client, tag(3), send_status, NULL);
+ GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_write_status(
+ s, GRPC_STATUS_UNIMPLEMENTED, "xyz", tag(5)));
+ cq_expect_finished_with_status(v_client, tag(3), GRPC_STATUS_UNIMPLEMENTED,
+ "xyz", NULL);
cq_verify(v_client);
cq_expect_finish_accepted(v_server, tag(5), GRPC_OP_OK);
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 8d73e2c15e..3855a7a3de 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
@@ -107,7 +107,6 @@ static void test_early_server_shutdown_finishes_inflight_calls(
grpc_end2end_test_fixture f = begin_test(config, __FUNCTION__, NULL, NULL);
grpc_call *c;
grpc_call *s;
- grpc_status expect_status = {GRPC_STATUS_UNAVAILABLE, NULL};
gpr_timespec deadline = five_seconds_time();
cq_verifier *v_client = cq_verifier_create(f.client_cq);
cq_verifier *v_server = cq_verifier_create(f.server_cq);
@@ -141,7 +140,8 @@ static void test_early_server_shutdown_finishes_inflight_calls(
grpc_call_destroy(s);
- cq_expect_finished_with_status(v_client, tag(3), expect_status, NULL);
+ cq_expect_finished_with_status(v_client, tag(3), GRPC_STATUS_UNAVAILABLE,
+ NULL, NULL);
cq_verify(v_client);
grpc_call_destroy(c);
diff --git a/test/core/end2end/tests/invoke_large_request.c b/test/core/end2end/tests/invoke_large_request.c
index 57214242c0..d15fef6adc 100644
--- a/test/core/end2end/tests/invoke_large_request.c
+++ b/test/core/end2end/tests/invoke_large_request.c
@@ -109,7 +109,6 @@ static gpr_slice large_slice() {
static void test_invoke_large_request(grpc_end2end_test_config config) {
grpc_call *c;
grpc_call *s;
- grpc_status send_status = {GRPC_STATUS_UNIMPLEMENTED, "xyz"};
gpr_slice request_payload_slice = large_slice();
grpc_byte_buffer *request_payload =
grpc_byte_buffer_create(&request_payload_slice, 1);
@@ -156,11 +155,12 @@ static void test_invoke_large_request(grpc_end2end_test_config config) {
cq_verify(v_server);
GPR_ASSERT(GRPC_CALL_OK == grpc_call_writes_done(c, tag(8)));
- GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_write_status(s, send_status, tag(9)));
+ GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_write_status(
+ s, GRPC_STATUS_UNIMPLEMENTED, "xyz", tag(9)));
cq_expect_finish_accepted(v_client, tag(8), GRPC_OP_OK);
- cq_expect_finished_with_status(v_client, tag(3), send_status, NULL);
+ cq_expect_finished_with_status(v_client, tag(3), GRPC_STATUS_UNIMPLEMENTED,
+ "xyz", NULL);
cq_verify(v_client);
cq_expect_finish_accepted(v_server, tag(9), GRPC_OP_OK);
diff --git a/test/core/end2end/tests/max_concurrent_streams.c b/test/core/end2end/tests/max_concurrent_streams.c
index 6b331a550c..08198d49fb 100644
--- a/test/core/end2end/tests/max_concurrent_streams.c
+++ b/test/core/end2end/tests/max_concurrent_streams.c
@@ -105,7 +105,6 @@ static void end_test(grpc_end2end_test_fixture *f) {
static void simple_request_body(grpc_end2end_test_fixture f) {
grpc_call *c;
grpc_call *s;
- grpc_status send_status = {GRPC_STATUS_UNIMPLEMENTED, "xyz"};
gpr_timespec deadline = five_seconds_time();
cq_verifier *v_client = cq_verifier_create(f.client_cq);
cq_verifier *v_server = cq_verifier_create(f.server_cq);
@@ -131,9 +130,10 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
cq_expect_client_metadata_read(v_client, tag(2), NULL);
cq_verify(v_client);
- GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_write_status(s, send_status, tag(5)));
- cq_expect_finished_with_status(v_client, tag(3), send_status, NULL);
+ GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_write_status(
+ s, GRPC_STATUS_UNIMPLEMENTED, "xyz", tag(5)));
+ cq_expect_finished_with_status(v_client, tag(3), GRPC_STATUS_UNIMPLEMENTED,
+ "xyz", NULL);
cq_verify(v_client);
cq_expect_finish_accepted(v_server, tag(5), GRPC_OP_OK);
@@ -157,7 +157,6 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) {
grpc_call *s1;
grpc_call *s2;
gpr_timespec deadline;
- grpc_status send_status = {GRPC_STATUS_UNIMPLEMENTED, "xyz"};
cq_verifier *v_client;
cq_verifier *v_server;
@@ -208,13 +207,15 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) {
cq_verify(v_client);
GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_write_status(s1, send_status, tag(103)));
+ grpc_call_start_write_status(s1, GRPC_STATUS_UNIMPLEMENTED, "xyz",
+ tag(103)));
cq_expect_finish_accepted(v_server, tag(103), GRPC_OP_OK);
cq_expect_finished(v_server, tag(102), NULL);
cq_verify(v_server);
/* first request is finished, we should be able to start the second */
- cq_expect_finished_with_status(v_client, tag(302), send_status, NULL);
+ cq_expect_finished_with_status(v_client, tag(302), GRPC_STATUS_UNIMPLEMENTED,
+ "xyz", NULL);
cq_expect_invoke_accepted(v_client, tag(400), GRPC_OP_OK);
cq_verify(v_client);
@@ -232,12 +233,14 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) {
cq_verify(v_client);
GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_write_status(s2, send_status, tag(203)));
+ grpc_call_start_write_status(s2, GRPC_STATUS_UNIMPLEMENTED, "xyz",
+ tag(203)));
cq_expect_finish_accepted(v_server, tag(203), GRPC_OP_OK);
cq_expect_finished(v_server, tag(202), NULL);
cq_verify(v_server);
- cq_expect_finished_with_status(v_client, tag(402), send_status, NULL);
+ cq_expect_finished_with_status(v_client, tag(402), GRPC_STATUS_UNIMPLEMENTED,
+ "xyz", NULL);
cq_verify(v_client);
cq_verifier_destroy(v_client);
diff --git a/test/core/end2end/tests/ping_pong_streaming.c b/test/core/end2end/tests/ping_pong_streaming.c
index 84e7bb41b8..02a05e8e0c 100644
--- a/test/core/end2end/tests/ping_pong_streaming.c
+++ b/test/core/end2end/tests/ping_pong_streaming.c
@@ -108,7 +108,6 @@ static void test_pingpong_streaming(grpc_end2end_test_config config,
int i;
grpc_call *c;
grpc_call *s = NULL;
- grpc_status send_status = {GRPC_STATUS_UNIMPLEMENTED, "xyz"};
gpr_slice request_payload_slice = gpr_slice_from_copied_string("hello world");
gpr_slice response_payload_slice = gpr_slice_from_copied_string("hello you");
grpc_byte_buffer *request_payload = NULL;
@@ -171,11 +170,12 @@ static void test_pingpong_streaming(grpc_end2end_test_config config,
gpr_slice_unref(response_payload_slice);
GPR_ASSERT(GRPC_CALL_OK == grpc_call_writes_done(c, tag(6)));
- GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_write_status(s, send_status, tag(7)));
+ GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_write_status(
+ s, GRPC_STATUS_UNIMPLEMENTED, "xyz", tag(7)));
cq_expect_finish_accepted(v_client, tag(6), GRPC_OP_OK);
- cq_expect_finished_with_status(v_client, tag(3), send_status, NULL);
+ cq_expect_finished_with_status(v_client, tag(3), GRPC_STATUS_UNIMPLEMENTED,
+ "xyz", NULL);
cq_verify(v_client);
cq_expect_finish_accepted(v_server, tag(7), GRPC_OP_OK);
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 7be6558ccf..8a0eea8072 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
@@ -107,7 +107,6 @@ static void test_request_response_with_metadata_and_payload(
grpc_end2end_test_config config) {
grpc_call *c;
grpc_call *s;
- grpc_status send_status = {GRPC_STATUS_UNIMPLEMENTED, "xyz"};
gpr_slice request_payload_slice = gpr_slice_from_copied_string("hello world");
gpr_slice response_payload_slice = gpr_slice_from_copied_string("hello you");
grpc_byte_buffer *request_payload =
@@ -197,11 +196,12 @@ static void test_request_response_with_metadata_and_payload(
cq_verify(v_client);
GPR_ASSERT(GRPC_CALL_OK == grpc_call_writes_done(c, tag(8)));
- GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_write_status(s, send_status, tag(9)));
+ GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_write_status(
+ s, GRPC_STATUS_UNIMPLEMENTED, "xyz", tag(9)));
cq_expect_finish_accepted(v_client, tag(8), GRPC_OP_OK);
- cq_expect_finished_with_status(v_client, tag(3), send_status, NULL);
+ cq_expect_finished_with_status(v_client, tag(3), GRPC_STATUS_UNIMPLEMENTED,
+ "xyz", NULL);
cq_verify(v_client);
cq_expect_finish_accepted(v_server, tag(9), GRPC_OP_OK);
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 f828ebb8e7..77e490710c 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
@@ -107,7 +107,6 @@ static void test_request_response_with_metadata_and_payload(
grpc_end2end_test_config config) {
grpc_call *c;
grpc_call *s;
- grpc_status send_status = {GRPC_STATUS_UNIMPLEMENTED, "xyz"};
gpr_slice request_payload_slice = gpr_slice_from_copied_string("hello world");
gpr_slice response_payload_slice = gpr_slice_from_copied_string("hello you");
grpc_byte_buffer *request_payload =
@@ -183,11 +182,12 @@ static void test_request_response_with_metadata_and_payload(
cq_verify(v_client);
GPR_ASSERT(GRPC_CALL_OK == grpc_call_writes_done(c, tag(8)));
- GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_write_status(s, send_status, tag(9)));
+ GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_write_status(
+ s, GRPC_STATUS_UNIMPLEMENTED, "xyz", tag(9)));
cq_expect_finish_accepted(v_client, tag(8), GRPC_OP_OK);
- cq_expect_finished_with_status(v_client, tag(3), send_status, NULL);
+ cq_expect_finished_with_status(v_client, tag(3), GRPC_STATUS_UNIMPLEMENTED,
+ "xyz", NULL);
cq_verify(v_client);
cq_expect_finish_accepted(v_server, tag(9), GRPC_OP_OK);
diff --git a/test/core/end2end/tests/request_response_with_payload.c b/test/core/end2end/tests/request_response_with_payload.c
index fb9b59a5ab..deb61a7a8b 100644
--- a/test/core/end2end/tests/request_response_with_payload.c
+++ b/test/core/end2end/tests/request_response_with_payload.c
@@ -105,7 +105,6 @@ static void end_test(grpc_end2end_test_fixture *f) {
static void request_response_with_payload(grpc_end2end_test_fixture f) {
grpc_call *c;
grpc_call *s;
- grpc_status send_status = {GRPC_STATUS_UNIMPLEMENTED, "xyz"};
gpr_slice request_payload_slice = gpr_slice_from_copied_string("hello world");
gpr_slice response_payload_slice = gpr_slice_from_copied_string("hello you");
grpc_byte_buffer *request_payload =
@@ -162,11 +161,12 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) {
cq_expect_read(v_client, tag(7), gpr_slice_from_copied_string("hello you"));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_writes_done(c, tag(8)));
- GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_write_status(s, send_status, tag(9)));
+ GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_write_status(
+ s, GRPC_STATUS_UNIMPLEMENTED, "xyz", tag(9)));
cq_expect_finish_accepted(v_client, tag(8), GRPC_OP_OK);
- cq_expect_finished_with_status(v_client, tag(3), send_status, NULL);
+ cq_expect_finished_with_status(v_client, tag(3), GRPC_STATUS_UNIMPLEMENTED,
+ "xyz", NULL);
cq_verify(v_client);
cq_expect_finish_accepted(v_server, tag(9), GRPC_OP_OK);
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
new file mode 100644
index 0000000000..95e268441b
--- /dev/null
+++ b/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c
@@ -0,0 +1,214 @@
+/*
+ *
+ * Copyright 2014, 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 "test/core/end2end/end2end_tests.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <grpc/byte_buffer.h>
+#include <grpc/support/alloc.h>
+#include <grpc/support/log.h>
+#include <grpc/support/time.h>
+#include <grpc/support/useful.h>
+#include "test/core/end2end/cq_verifier.h"
+
+enum { TIMEOUT = 200000 };
+
+static void *tag(gpr_intptr t) { return (void *)t; }
+
+static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
+ const char *test_name,
+ grpc_channel_args *client_args,
+ grpc_channel_args *server_args) {
+ grpc_end2end_test_fixture f;
+ gpr_log(GPR_INFO, "%s/%s", test_name, config.name);
+ f = config.create_fixture(client_args, server_args);
+ config.init_client(&f, client_args);
+ config.init_server(&f, server_args);
+ return f;
+}
+
+static gpr_timespec n_seconds_time(int n) {
+ return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n));
+}
+
+static gpr_timespec five_seconds_time() { return n_seconds_time(5); }
+
+static void drain_cq(grpc_completion_queue *cq) {
+ grpc_event *ev;
+ grpc_completion_type type;
+ do {
+ ev = grpc_completion_queue_next(cq, five_seconds_time());
+ GPR_ASSERT(ev);
+ type = ev->type;
+ grpc_event_finish(ev);
+ } while (type != GRPC_QUEUE_SHUTDOWN);
+}
+
+static void shutdown_server(grpc_end2end_test_fixture *f) {
+ if (!f->server) return;
+ grpc_server_shutdown(f->server);
+ grpc_server_destroy(f->server);
+ f->server = NULL;
+}
+
+static void shutdown_client(grpc_end2end_test_fixture *f) {
+ if (!f->client) return;
+ grpc_channel_destroy(f->client);
+ f->client = NULL;
+}
+
+static void end_test(grpc_end2end_test_fixture *f) {
+ shutdown_server(f);
+ shutdown_client(f);
+
+ grpc_completion_queue_shutdown(f->server_cq);
+ drain_cq(f->server_cq);
+ grpc_completion_queue_destroy(f->server_cq);
+ grpc_completion_queue_shutdown(f->client_cq);
+ drain_cq(f->client_cq);
+ grpc_completion_queue_destroy(f->client_cq);
+}
+
+/* Request/response with metadata and payload.*/
+static void test_request_response_with_metadata_and_payload(
+ grpc_end2end_test_config config) {
+ grpc_call *c;
+ grpc_call *s;
+ gpr_slice request_payload_slice = gpr_slice_from_copied_string("hello world");
+ gpr_slice response_payload_slice = gpr_slice_from_copied_string("hello you");
+ grpc_byte_buffer *request_payload =
+ grpc_byte_buffer_create(&request_payload_slice, 1);
+ grpc_byte_buffer *response_payload =
+ grpc_byte_buffer_create(&response_payload_slice, 1);
+ gpr_timespec deadline = five_seconds_time();
+ grpc_metadata meta1 = {"key1", "val1", 4};
+ grpc_metadata meta2 = {"key2", "val2", 4};
+ grpc_metadata meta3 = {"key3", "val3", 4};
+ grpc_metadata meta4 = {"key4", "val4", 4};
+ grpc_metadata meta5 = {"key5", "val5", 4};
+ grpc_metadata meta6 = {"key6", "val6", 4};
+ grpc_end2end_test_fixture f = begin_test(config, __FUNCTION__, NULL, NULL);
+ cq_verifier *v_client = cq_verifier_create(f.client_cq);
+ cq_verifier *v_server = cq_verifier_create(f.server_cq);
+
+ GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(f.server, tag(100)));
+
+ /* byte buffer holds the slice, we can unref it already */
+ gpr_slice_unref(request_payload_slice);
+ gpr_slice_unref(response_payload_slice);
+
+ c = grpc_channel_create_call(f.client, "/foo", "test.google.com", deadline);
+ GPR_ASSERT(c);
+
+ /* add multiple metadata */
+ GPR_ASSERT(GRPC_CALL_OK == grpc_call_add_metadata(c, &meta1, 0));
+ GPR_ASSERT(GRPC_CALL_OK == grpc_call_add_metadata(c, &meta2, 0));
+
+ GPR_ASSERT(GRPC_CALL_OK ==
+ grpc_call_start_invoke(c, f.client_cq, tag(1), tag(2), tag(3), 0));
+ cq_expect_invoke_accepted(v_client, tag(1), GRPC_OP_OK);
+ cq_verify(v_client);
+
+ GPR_ASSERT(GRPC_CALL_OK ==
+ grpc_call_start_write(c, request_payload, tag(4), 0));
+ /* destroy byte buffer early to ensure async code keeps track of its contents
+ correctly */
+ grpc_byte_buffer_destroy(request_payload);
+ cq_expect_write_accepted(v_client, tag(4), GRPC_OP_OK);
+ cq_verify(v_client);
+
+ cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "test.google.com",
+ deadline, "key1", "val1", "key2", "val2", NULL);
+ cq_verify(v_server);
+
+ grpc_call_server_accept(s, f.server_cq, tag(102));
+
+ /* add multiple metadata */
+ GPR_ASSERT(GRPC_CALL_OK == grpc_call_add_metadata(s, &meta3, 0));
+ GPR_ASSERT(GRPC_CALL_OK == grpc_call_add_metadata(s, &meta4, 0));
+
+ grpc_call_server_end_initial_metadata(s, 0);
+
+ GPR_ASSERT(GRPC_CALL_OK == grpc_call_add_metadata(s, &meta5, 0));
+ GPR_ASSERT(GRPC_CALL_OK == grpc_call_add_metadata(s, &meta6, 0));
+
+ GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_read(s, tag(5)));
+ cq_expect_read(v_server, tag(5), gpr_slice_from_copied_string("hello world"));
+ cq_verify(v_server);
+
+ GPR_ASSERT(GRPC_CALL_OK ==
+ grpc_call_start_write(s, response_payload, tag(6), 0));
+ /* destroy byte buffer early to ensure async code keeps track of its contents
+ correctly */
+ grpc_byte_buffer_destroy(response_payload);
+ cq_expect_write_accepted(v_server, tag(6), GRPC_OP_OK);
+ cq_verify(v_server);
+
+ /* fetch metadata.. */
+ cq_expect_client_metadata_read(v_client, tag(2), "key3", "val3", "key4",
+ "val4", NULL);
+ cq_verify(v_client);
+
+ GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_read(c, tag(7)));
+ cq_expect_read(v_client, tag(7), gpr_slice_from_copied_string("hello you"));
+ cq_verify(v_client);
+
+ GPR_ASSERT(GRPC_CALL_OK == grpc_call_writes_done(c, tag(8)));
+ GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_write_status(
+ s, GRPC_STATUS_UNIMPLEMENTED, "xyz", tag(9)));
+
+ cq_expect_finish_accepted(v_client, tag(8), GRPC_OP_OK);
+ cq_expect_finished_with_status(v_client, tag(3), GRPC_STATUS_UNIMPLEMENTED,
+ "xyz", "key5", "val5", "key6", "val6", NULL);
+ cq_verify(v_client);
+
+ cq_expect_finish_accepted(v_server, tag(9), GRPC_OP_OK);
+ cq_expect_finished(v_server, tag(102), NULL);
+ cq_verify(v_server);
+
+ grpc_call_destroy(c);
+ grpc_call_destroy(s);
+
+ end_test(&f);
+ config.tear_down_data(&f);
+
+ cq_verifier_destroy(v_client);
+ cq_verifier_destroy(v_server);
+}
+
+void grpc_end2end_tests(grpc_end2end_test_config config) {
+ test_request_response_with_metadata_and_payload(config);
+}
diff --git a/test/core/end2end/tests/request_with_large_metadata.c b/test/core/end2end/tests/request_with_large_metadata.c
index ccdee4025e..26b165625e 100644
--- a/test/core/end2end/tests/request_with_large_metadata.c
+++ b/test/core/end2end/tests/request_with_large_metadata.c
@@ -106,7 +106,6 @@ static void end_test(grpc_end2end_test_fixture *f) {
static void test_request_with_large_metadata(grpc_end2end_test_config config) {
grpc_call *c;
grpc_call *s;
- grpc_status send_status = {GRPC_STATUS_OK, NULL};
gpr_timespec deadline = five_seconds_time();
grpc_metadata meta;
grpc_end2end_test_fixture f = begin_test(config, __FUNCTION__, NULL, NULL);
@@ -145,10 +144,10 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) {
GPR_ASSERT(GRPC_CALL_OK == grpc_call_writes_done(c, tag(8)));
GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_write_status(s, send_status, tag(9)));
+ grpc_call_start_write_status(s, GRPC_STATUS_OK, NULL, tag(9)));
cq_expect_finish_accepted(v_client, tag(8), GRPC_OP_OK);
- cq_expect_finished_with_status(v_client, tag(3), send_status, NULL);
+ cq_expect_finished_with_status(v_client, tag(3), GRPC_STATUS_OK, NULL, NULL);
cq_verify(v_client);
cq_expect_finish_accepted(v_server, tag(9), GRPC_OP_OK);
diff --git a/test/core/end2end/tests/request_with_payload.c b/test/core/end2end/tests/request_with_payload.c
index 38a29e379e..602ade6f90 100644
--- a/test/core/end2end/tests/request_with_payload.c
+++ b/test/core/end2end/tests/request_with_payload.c
@@ -106,7 +106,6 @@ static void end_test(grpc_end2end_test_fixture *f) {
static void test_invoke_request_with_payload(grpc_end2end_test_config config) {
grpc_call *c;
grpc_call *s;
- grpc_status send_status = {GRPC_STATUS_UNIMPLEMENTED, "xyz"};
gpr_slice payload_slice = gpr_slice_from_copied_string("hello world");
grpc_byte_buffer *payload = grpc_byte_buffer_create(&payload_slice, 1);
gpr_timespec deadline = five_seconds_time();
@@ -146,10 +145,11 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) {
cq_expect_read(v_server, tag(4), gpr_slice_from_copied_string("hello world"));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_writes_done(c, tag(5)));
- GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_write_status(s, send_status, tag(6)));
+ GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_write_status(
+ s, GRPC_STATUS_UNIMPLEMENTED, "xyz", tag(6)));
cq_expect_finish_accepted(v_client, tag(5), GRPC_OP_OK);
- cq_expect_finished_with_status(v_client, tag(3), send_status, NULL);
+ cq_expect_finished_with_status(v_client, tag(3), GRPC_STATUS_UNIMPLEMENTED,
+ "xyz", NULL);
cq_verify(v_client);
cq_expect_finish_accepted(v_server, tag(6), GRPC_OP_OK);
diff --git a/test/core/end2end/tests/simple_delayed_request.c b/test/core/end2end/tests/simple_delayed_request.c
index dde6eb6d23..b90316c32e 100644
--- a/test/core/end2end/tests/simple_delayed_request.c
+++ b/test/core/end2end/tests/simple_delayed_request.c
@@ -97,7 +97,6 @@ static void simple_delayed_request_body(grpc_end2end_test_config config,
long delay_us) {
grpc_call *c;
grpc_call *s;
- grpc_status send_status = {GRPC_STATUS_UNIMPLEMENTED, "xyz"};
gpr_timespec deadline = five_seconds_time();
cq_verifier *v_client = cq_verifier_create(f->client_cq);
cq_verifier *v_server = cq_verifier_create(f->server_cq);
@@ -129,9 +128,10 @@ static void simple_delayed_request_body(grpc_end2end_test_config config,
cq_expect_client_metadata_read(v_client, tag(2), NULL);
cq_verify(v_client);
- GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_write_status(s, send_status, tag(5)));
- cq_expect_finished_with_status(v_client, tag(3), send_status, NULL);
+ GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_write_status(
+ s, GRPC_STATUS_UNIMPLEMENTED, "xyz", tag(5)));
+ cq_expect_finished_with_status(v_client, tag(3), GRPC_STATUS_UNIMPLEMENTED,
+ "xyz", NULL);
cq_verify(v_client);
cq_expect_finish_accepted(v_server, tag(5), GRPC_OP_OK);
diff --git a/test/core/end2end/tests/simple_request.c b/test/core/end2end/tests/simple_request.c
index 15214ffb2b..3511f276e6 100644
--- a/test/core/end2end/tests/simple_request.c
+++ b/test/core/end2end/tests/simple_request.c
@@ -105,7 +105,6 @@ static void end_test(grpc_end2end_test_fixture *f) {
static void simple_request_body(grpc_end2end_test_fixture f) {
grpc_call *c;
grpc_call *s;
- grpc_status send_status = {GRPC_STATUS_UNIMPLEMENTED, "xyz"};
gpr_timespec deadline = five_seconds_time();
cq_verifier *v_client = cq_verifier_create(f.client_cq);
cq_verifier *v_server = cq_verifier_create(f.server_cq);
@@ -131,9 +130,10 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
cq_expect_client_metadata_read(v_client, tag(2), NULL);
cq_verify(v_client);
- GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_write_status(s, send_status, tag(5)));
- cq_expect_finished_with_status(v_client, tag(3), send_status, NULL);
+ GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_write_status(
+ s, GRPC_STATUS_UNIMPLEMENTED, "xyz", tag(5)));
+ cq_expect_finished_with_status(v_client, tag(3), GRPC_STATUS_UNIMPLEMENTED,
+ "xyz", NULL);
cq_verify(v_client);
cq_expect_finish_accepted(v_server, tag(5), GRPC_OP_OK);
@@ -152,7 +152,6 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
static void simple_request_body2(grpc_end2end_test_fixture f) {
grpc_call *c;
grpc_call *s;
- grpc_status send_status = {GRPC_STATUS_UNIMPLEMENTED, "xyz"};
gpr_timespec deadline = five_seconds_time();
cq_verifier *v_client = cq_verifier_create(f.client_cq);
cq_verifier *v_server = cq_verifier_create(f.server_cq);
@@ -176,15 +175,16 @@ static void simple_request_body2(grpc_end2end_test_fixture f) {
GPR_ASSERT(GRPC_CALL_OK == grpc_call_accept(s, f.server_cq, tag(102), 0));
- GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_write_status(s, send_status, tag(5)));
+ GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_write_status(
+ s, GRPC_STATUS_UNIMPLEMENTED, "xyz", tag(5)));
cq_expect_finish_accepted(v_server, tag(5), GRPC_OP_OK);
cq_verify(v_server);
cq_expect_client_metadata_read(v_client, tag(2), NULL);
cq_verify(v_client);
- cq_expect_finished_with_status(v_client, tag(3), send_status, NULL);
+ cq_expect_finished_with_status(v_client, tag(3), GRPC_STATUS_UNIMPLEMENTED,
+ "xyz", NULL);
cq_verify(v_client);
cq_expect_finished(v_server, tag(102), NULL);
diff --git a/test/core/end2end/tests/thread_stress.c b/test/core/end2end/tests/thread_stress.c
index 29944d84f9..4100b0e35d 100644
--- a/test/core/end2end/tests/thread_stress.c
+++ b/test/core/end2end/tests/thread_stress.c
@@ -187,10 +187,9 @@ static void request_server_call() {
}
static void maybe_end_server_call(grpc_call *call, gpr_refcount *rc) {
- grpc_status ok_status = {GRPC_STATUS_OK, NULL};
if (gpr_unref(rc)) {
GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_write_status(call, ok_status, NULL));
+ grpc_call_start_write_status(call, GRPC_STATUS_OK, NULL, NULL));
gpr_free(rc);
}
}
diff --git a/test/core/end2end/tests/writes_done_hangs_with_pending_read.c b/test/core/end2end/tests/writes_done_hangs_with_pending_read.c
index 555d7b92c0..2241519e89 100644
--- a/test/core/end2end/tests/writes_done_hangs_with_pending_read.c
+++ b/test/core/end2end/tests/writes_done_hangs_with_pending_read.c
@@ -109,7 +109,6 @@ static void test_writes_done_hangs_with_pending_read(
grpc_end2end_test_config config) {
grpc_call *c;
grpc_call *s;
- grpc_status send_status = {GRPC_STATUS_UNIMPLEMENTED, "xyz"};
gpr_slice request_payload_slice = gpr_slice_from_copied_string("hello world");
gpr_slice response_payload_slice = gpr_slice_from_copied_string("hello you");
grpc_byte_buffer *request_payload =
@@ -163,8 +162,8 @@ static void test_writes_done_hangs_with_pending_read(
cq_verify(v_server);
GPR_ASSERT(GRPC_CALL_OK == grpc_call_writes_done(c, tag(6)));
- GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_write_status(s, send_status, tag(7)));
+ GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_write_status(
+ s, GRPC_STATUS_UNIMPLEMENTED, "xyz", tag(7)));
cq_expect_finish_accepted(v_client, tag(6), GRPC_OP_OK);
cq_verify(v_client);
@@ -176,7 +175,8 @@ static void test_writes_done_hangs_with_pending_read(
cq_expect_read(v_client, tag(8), gpr_slice_from_copied_string("hello you"));
cq_verify(v_client);
- cq_expect_finished_with_status(v_client, tag(3), send_status, NULL);
+ cq_expect_finished_with_status(v_client, tag(3), GRPC_STATUS_UNIMPLEMENTED,
+ "xyz", NULL);
cq_verify(v_client);
cq_expect_finish_accepted(v_server, tag(7), GRPC_OP_OK);
diff --git a/test/core/fling/server.c b/test/core/fling/server.c
index c35bab5789..44dc33a461 100644
--- a/test/core/fling/server.c
+++ b/test/core/fling/server.c
@@ -52,8 +52,6 @@ static grpc_completion_queue *cq;
static grpc_server *server;
static int got_sigint = 0;
-static const grpc_status status_ok = {GRPC_STATUS_OK, NULL};
-
typedef struct {
gpr_refcount pending_ops;
gpr_uint32 flags;
@@ -149,8 +147,8 @@ int main(int argc, char **argv) {
GPR_ASSERT(grpc_call_start_write(ev->call, ev->data.read, s,
s->flags) == GRPC_CALL_OK);
} else {
- GPR_ASSERT(grpc_call_start_write_status(ev->call, status_ok, s) ==
- GRPC_CALL_OK);
+ GPR_ASSERT(grpc_call_start_write_status(ev->call, GRPC_STATUS_OK,
+ NULL, s) == GRPC_CALL_OK);
}
break;
case GRPC_FINISH_ACCEPTED: