Calculate RPC deadline right before call creation

Most core end2end tests are written around a single RPC with an explicit
deadline. Currently, this deadline is calculated before bringing up the
test fixture, and thus time spent bringing up the test fixture is taken
from the time allotted to the RPC.

This change moves the calculation of these deadlines immediately before
call creation. Additionally, the functions that calculate these
deadlines have been renamed from 'xx_seconds_time()' to
'xx_seconds_from_now()' for clarity.
pull/10334/head
Chris Evans 8 years ago
parent 82c7fec59c
commit ed2a5470db
  1. 10
      test/core/end2end/tests/authority_not_supported.c
  2. 10
      test/core/end2end/tests/bad_hostname.c
  3. 10
      test/core/end2end/tests/binary_metadata.c
  4. 12
      test/core/end2end/tests/call_creds.c
  5. 14
      test/core/end2end/tests/cancel_after_accept.c
  6. 10
      test/core/end2end/tests/cancel_after_client_done.c
  7. 10
      test/core/end2end/tests/cancel_after_invoke.c
  8. 10
      test/core/end2end/tests/cancel_before_invoke.c
  9. 10
      test/core/end2end/tests/cancel_in_a_vacuum.c
  10. 10
      test/core/end2end/tests/cancel_with_status.c
  11. 12
      test/core/end2end/tests/compressed_payload.c
  12. 10
      test/core/end2end/tests/default_host.c
  13. 10
      test/core/end2end/tests/disappearing_server.c
  14. 10
      test/core/end2end/tests/empty_batch.c
  15. 10
      test/core/end2end/tests/filter_call_init_fails.c
  16. 10
      test/core/end2end/tests/filter_causes_close.c
  17. 10
      test/core/end2end/tests/filter_latency.c
  18. 10
      test/core/end2end/tests/graceful_server_shutdown.c
  19. 10
      test/core/end2end/tests/high_initial_seqno.c
  20. 10
      test/core/end2end/tests/hpack_size.c
  21. 10
      test/core/end2end/tests/idempotent_request.c
  22. 6
      test/core/end2end/tests/invoke_large_request.c
  23. 16
      test/core/end2end/tests/keepalive_timeout.c
  24. 10
      test/core/end2end/tests/large_metadata.c
  25. 10
      test/core/end2end/tests/load_reporting_hook.c
  26. 20
      test/core/end2end/tests/max_concurrent_streams.c
  27. 8
      test/core/end2end/tests/max_message_length.c
  28. 10
      test/core/end2end/tests/negative_deadline.c
  29. 10
      test/core/end2end/tests/network_status_change.c
  30. 10
      test/core/end2end/tests/no_logging.c
  31. 8
      test/core/end2end/tests/no_op.c
  32. 10
      test/core/end2end/tests/payload.c
  33. 10
      test/core/end2end/tests/ping_pong_streaming.c
  34. 10
      test/core/end2end/tests/registered_call.c
  35. 10
      test/core/end2end/tests/request_with_flags.c
  36. 10
      test/core/end2end/tests/request_with_payload.c
  37. 13
      test/core/end2end/tests/resource_quota_server.c
  38. 10
      test/core/end2end/tests/server_finishes_request.c
  39. 10
      test/core/end2end/tests/shutdown_finishes_calls.c
  40. 8
      test/core/end2end/tests/shutdown_finishes_tags.c
  41. 10
      test/core/end2end/tests/simple_cacheable_request.c
  42. 10
      test/core/end2end/tests/simple_delayed_request.c
  43. 10
      test/core/end2end/tests/simple_metadata.c
  44. 10
      test/core/end2end/tests/simple_request.c
  45. 10
      test/core/end2end/tests/streaming_error_response.c
  46. 10
      test/core/end2end/tests/trailing_metadata.c
  47. 10
      test/core/end2end/tests/write_buffering.c
  48. 10
      test/core/end2end/tests/write_buffering_at_end.c

@ -57,16 +57,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -102,7 +104,6 @@ static void test_with_authority_header(grpc_end2end_test_config config) {
grpc_slice_from_copied_string("hello world");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
gpr_timespec deadline = five_seconds_time();
grpc_metadata meta_c[2] = {{grpc_slice_from_static_string("key1"),
grpc_slice_from_static_string("val1"),
0,
@ -124,6 +125,7 @@ static void test_with_authority_header(grpc_end2end_test_config config) {
grpc_slice details;
grpc_slice host = grpc_slice_from_static_string("foo.test.google.fr");
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"), &host,
deadline, NULL);

@ -59,16 +59,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -99,7 +101,6 @@ static void end_test(grpc_end2end_test_fixture *f) {
static void simple_request_body(grpc_end2end_test_fixture f) {
grpc_call *c;
gpr_timespec deadline = five_seconds_time();
cq_verifier *cqv = cq_verifier_create(f.cq);
grpc_op ops[6];
grpc_op *op;
@ -112,6 +113,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
grpc_slice details;
grpc_slice host = grpc_slice_from_static_string("slartibartfast.local");
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"), &host,
deadline, NULL);

@ -57,16 +57,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -108,7 +110,6 @@ static void test_request_response_with_metadata_and_payload(
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
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] = {
{grpc_slice_from_static_string("key1-bin"),
grpc_slice_from_static_string(
@ -147,6 +148,7 @@ static void test_request_response_with_metadata_and_payload(
grpc_slice details;
int was_cancelled = 2;
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),

@ -75,16 +75,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -143,7 +145,6 @@ static void request_response_with_payload_and_call_creds(
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
grpc_byte_buffer *response_payload =
grpc_raw_byte_buffer_create(&response_payload_slice, 1);
gpr_timespec deadline = five_seconds_time();
grpc_end2end_test_fixture f;
cq_verifier *cqv;
grpc_op ops[6];
@ -165,6 +166,7 @@ static void request_response_with_payload_and_call_creds(
f = begin_test(config, test_name, 0);
cqv = cq_verifier_create(f.cq);
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),
@ -383,7 +385,7 @@ static void test_request_with_server_rejecting_client_creds(
grpc_op *op;
grpc_call *c;
grpc_end2end_test_fixture f;
gpr_timespec deadline = five_seconds_time();
gpr_timespec deadline = five_seconds_from_now();
cq_verifier *cqv;
grpc_metadata_array initial_metadata_recv;
grpc_metadata_array trailing_metadata_recv;

@ -64,16 +64,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -110,9 +112,6 @@ static void test_cancel_after_accept(grpc_end2end_test_config config,
grpc_op *op;
grpc_call *c;
grpc_call *s;
gpr_timespec deadline = use_service_config
? gpr_inf_future(GPR_CLOCK_MONOTONIC)
: five_seconds_time();
grpc_metadata_array initial_metadata_recv;
grpc_metadata_array trailing_metadata_recv;
grpc_metadata_array request_metadata_recv;
@ -153,6 +152,9 @@ static void test_cancel_after_accept(grpc_end2end_test_config config,
begin_test(config, "cancel_after_accept", args, NULL);
cq_verifier *cqv = cq_verifier_create(f.cq);
gpr_timespec deadline = use_service_config
? gpr_inf_future(GPR_CLOCK_MONOTONIC)
: five_seconds_from_now();
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/service/method"),

@ -58,16 +58,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -105,7 +107,6 @@ static void test_cancel_after_accept_and_writes_closed(
grpc_call *s;
grpc_end2end_test_fixture f = begin_test(
config, "test_cancel_after_accept_and_writes_closed", NULL, NULL);
gpr_timespec deadline = five_seconds_time();
cq_verifier *cqv = cq_verifier_create(f.cq);
grpc_metadata_array initial_metadata_recv;
grpc_metadata_array trailing_metadata_recv;
@ -126,6 +127,7 @@ static void test_cancel_after_accept_and_writes_closed(
grpc_raw_byte_buffer_create(&response_payload_slice, 1);
int was_cancelled = 2;
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),

@ -60,16 +60,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -106,7 +108,6 @@ static void test_cancel_after_invoke(grpc_end2end_test_config config,
grpc_call *c;
grpc_end2end_test_fixture f =
begin_test(config, "test_cancel_after_invoke", mode, NULL, NULL);
gpr_timespec deadline = five_seconds_time();
cq_verifier *cqv = cq_verifier_create(f.cq);
grpc_metadata_array initial_metadata_recv;
grpc_metadata_array trailing_metadata_recv;
@ -121,6 +122,7 @@ static void test_cancel_after_invoke(grpc_end2end_test_config config,
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),

@ -57,16 +57,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -103,7 +105,6 @@ static void test_cancel_before_invoke(grpc_end2end_test_config config,
grpc_call *c;
grpc_end2end_test_fixture f =
begin_test(config, "cancel_before_invoke", NULL, NULL);
gpr_timespec deadline = five_seconds_time();
cq_verifier *cqv = cq_verifier_create(f.cq);
grpc_metadata_array initial_metadata_recv;
grpc_metadata_array trailing_metadata_recv;
@ -118,6 +119,7 @@ static void test_cancel_before_invoke(grpc_end2end_test_config config,
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),

@ -58,16 +58,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -102,9 +104,9 @@ static void test_cancel_in_a_vacuum(grpc_end2end_test_config config,
grpc_call *c;
grpc_end2end_test_fixture f =
begin_test(config, "test_cancel_in_a_vacuum", NULL, NULL);
gpr_timespec deadline = five_seconds_time();
cq_verifier *v_client = cq_verifier_create(f.cq);
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),

@ -59,16 +59,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -100,7 +102,6 @@ static void end_test(grpc_end2end_test_fixture *f) {
static void simple_request_body(grpc_end2end_test_config config,
grpc_end2end_test_fixture f, size_t num_ops) {
grpc_call *c;
gpr_timespec deadline = five_seconds_time();
cq_verifier *cqv = cq_verifier_create(f.cq);
grpc_op ops[6];
grpc_op *op;
@ -112,6 +113,7 @@ static void simple_request_body(grpc_end2end_test_config config,
gpr_log(GPR_DEBUG, "test with %" PRIuPTR " ops", num_ops);
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),

@ -65,16 +65,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -113,7 +115,6 @@ static void request_for_disabled_algorithm(
grpc_call *s;
grpc_slice request_payload_slice;
grpc_byte_buffer *request_payload;
gpr_timespec deadline = five_seconds_time();
grpc_channel_args *client_args;
grpc_channel_args *server_args;
grpc_end2end_test_fixture f;
@ -150,6 +151,7 @@ static void request_for_disabled_algorithm(
f = begin_test(config, test_name, client_args, server_args);
cqv = cq_verifier_create(f.cq);
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),
@ -290,7 +292,6 @@ static void request_with_payload_template(
grpc_call *s;
grpc_slice request_payload_slice;
grpc_byte_buffer *request_payload;
gpr_timespec deadline = five_seconds_time();
grpc_channel_args *client_args;
grpc_channel_args *server_args;
grpc_end2end_test_fixture f;
@ -329,6 +330,7 @@ static void request_with_payload_template(
f = begin_test(config, test_name, client_args, server_args);
cqv = cq_verifier_create(f.cq);
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),

@ -59,16 +59,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -100,7 +102,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;
gpr_timespec deadline = five_seconds_time();
cq_verifier *cqv = cq_verifier_create(f.cq);
grpc_op ops[6];
grpc_op *op;
@ -114,6 +115,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
int was_cancelled = 2;
char *peer;
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"), NULL,
deadline, NULL);

@ -45,16 +45,18 @@
static void *tag(intptr_t t) { return (void *)t; }
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -84,7 +86,6 @@ static void do_request_and_shutdown_server(grpc_end2end_test_config config,
cq_verifier *cqv) {
grpc_call *c;
grpc_call *s;
gpr_timespec deadline = five_seconds_time();
grpc_op ops[6];
grpc_op *op;
grpc_metadata_array initial_metadata_recv;
@ -96,6 +97,7 @@ static void do_request_and_shutdown_server(grpc_end2end_test_config config,
grpc_slice details;
int was_cancelled = 2;
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(
f->client, NULL, GRPC_PROPAGATE_DEFAULTS, f->cq,
grpc_slice_from_static_string("/foo"),

@ -59,16 +59,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -100,11 +102,11 @@ static void end_test(grpc_end2end_test_fixture *f) {
static void empty_batch_body(grpc_end2end_test_config config,
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;
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),

@ -65,16 +65,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -112,7 +114,6 @@ static void test_request(grpc_end2end_test_config config) {
grpc_slice_from_copied_string("hello world");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
gpr_timespec deadline = five_seconds_time();
grpc_end2end_test_fixture f =
begin_test(config, "filter_call_init_fails", NULL, NULL);
cq_verifier *cqv = cq_verifier_create(f.cq);
@ -127,6 +128,7 @@ static void test_request(grpc_end2end_test_config config) {
grpc_call_error error;
grpc_slice details;
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),

@ -62,16 +62,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -108,7 +110,6 @@ static void test_request(grpc_end2end_test_config config) {
grpc_slice_from_copied_string("hello world");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
gpr_timespec deadline = five_seconds_time();
grpc_end2end_test_fixture f =
begin_test(config, "filter_causes_close", NULL, NULL);
cq_verifier *cqv = cq_verifier_create(f.cq);
@ -123,6 +124,7 @@ static void test_request(grpc_end2end_test_config config) {
grpc_call_error error;
grpc_slice details;
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),

@ -69,16 +69,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -115,7 +117,6 @@ static void test_request(grpc_end2end_test_config config) {
grpc_slice_from_copied_string("hello world");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
gpr_timespec deadline = five_seconds_time();
grpc_end2end_test_fixture f =
begin_test(config, "filter_latency", NULL, NULL);
cq_verifier *cqv = cq_verifier_create(f.cq);
@ -137,6 +138,7 @@ static void test_request(grpc_end2end_test_config config) {
gpr_mu_unlock(&g_mu);
const gpr_timespec start_time = gpr_now(GPR_CLOCK_MONOTONIC);
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),

@ -57,16 +57,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -95,7 +97,6 @@ static void test_early_server_shutdown_finishes_inflight_calls(
grpc_end2end_test_config config) {
grpc_call *c;
grpc_call *s;
gpr_timespec deadline = n_seconds_time(10);
grpc_end2end_test_fixture f = begin_test(
config, "test_early_server_shutdown_finishes_inflight_calls", NULL, NULL);
cq_verifier *cqv = cq_verifier_create(f.cq);
@ -110,6 +111,7 @@ static void test_early_server_shutdown_finishes_inflight_calls(
grpc_slice details;
int was_cancelled = 2;
gpr_timespec deadline = n_seconds_from_now(10);
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),

@ -61,16 +61,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -103,7 +105,6 @@ static void simple_request_body(grpc_end2end_test_config config,
grpc_end2end_test_fixture f) {
grpc_call *c;
grpc_call *s;
gpr_timespec deadline = five_seconds_time();
cq_verifier *cqv = cq_verifier_create(f.cq);
grpc_op ops[6];
grpc_op *op;
@ -116,6 +117,7 @@ static void simple_request_body(grpc_end2end_test_config config,
grpc_slice details;
int was_cancelled = 2;
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),

@ -201,16 +201,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -243,7 +245,6 @@ static void simple_request_body(grpc_end2end_test_config config,
grpc_end2end_test_fixture f, size_t index) {
grpc_call *c;
grpc_call *s;
gpr_timespec deadline = five_seconds_time();
cq_verifier *cqv = cq_verifier_create(f.cq);
grpc_op ops[6];
grpc_op *op;
@ -268,6 +269,7 @@ static void simple_request_body(grpc_end2end_test_config config,
extra_metadata[2].value =
grpc_slice_from_static_string(dragons[index % GPR_ARRAY_SIZE(dragons)]);
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),

@ -59,16 +59,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -101,7 +103,6 @@ static void simple_request_body(grpc_end2end_test_config config,
grpc_end2end_test_fixture f) {
grpc_call *c;
grpc_call *s;
gpr_timespec deadline = five_seconds_time();
cq_verifier *cqv = cq_verifier_create(f.cq);
grpc_op ops[6];
grpc_op *op;
@ -115,6 +116,7 @@ static void simple_request_body(grpc_end2end_test_config config,
int was_cancelled = 2;
char *peer;
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),

@ -58,14 +58,14 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, n_seconds_time(5), NULL);
ev = grpc_completion_queue_next(cq, n_seconds_from_now(5), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -128,7 +128,6 @@ static void test_invoke_large_request(grpc_end2end_test_config config,
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
grpc_byte_buffer *response_payload =
grpc_raw_byte_buffer_create(&response_payload_slice, 1);
gpr_timespec deadline = n_seconds_time(30);
cq_verifier *cqv = cq_verifier_create(f.cq);
grpc_op ops[6];
grpc_op *op;
@ -143,6 +142,7 @@ static void test_invoke_large_request(grpc_end2end_test_config config,
grpc_slice details;
int was_cancelled = 2;
gpr_timespec deadline = n_seconds_from_now(30);
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),

@ -61,25 +61,27 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), 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), five_seconds_time(), NULL)
.type == GRPC_OP_COMPLETE);
GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
five_seconds_from_now(), NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
}
@ -108,7 +110,6 @@ static void test_keepalive_timeout(grpc_end2end_test_config config) {
grpc_slice_from_copied_string("hello world");
grpc_byte_buffer *response_payload =
grpc_raw_byte_buffer_create(&response_payload_slice, 1);
gpr_timespec deadline = five_seconds_time();
grpc_arg keepalive_args[] = {{.type = GRPC_ARG_INTEGER,
.key = GRPC_ARG_CLIENT_KEEPALIVE_TIME_S,
@ -140,6 +141,7 @@ static void test_keepalive_timeout(grpc_end2end_test_config config) {
/* Disable ping ack to trigger the keepalive timeout */
grpc_set_disable_ping_ack(true);
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),

@ -57,16 +57,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -103,7 +105,6 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) {
grpc_slice_from_copied_string("hello world");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
gpr_timespec deadline = five_seconds_time();
grpc_metadata meta;
const size_t large_size = 64 * 1024;
grpc_arg arg = {GRPC_ARG_INTEGER,
@ -125,6 +126,7 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) {
grpc_slice details;
int was_cancelled = 2;
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),

@ -84,16 +84,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -136,7 +138,6 @@ static void request_response_with_payload(
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
grpc_byte_buffer *response_payload =
grpc_raw_byte_buffer_create(&response_payload_slice, 1);
gpr_timespec deadline = five_seconds_time();
cq_verifier *cqv = cq_verifier_create(f.cq);
grpc_op ops[6];
grpc_op *op;
@ -151,6 +152,7 @@ static void request_response_with_payload(
grpc_slice details;
int was_cancelled = 2;
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string(method_name),

@ -57,16 +57,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -99,7 +101,6 @@ static void simple_request_body(grpc_end2end_test_config config,
grpc_end2end_test_fixture f) {
grpc_call *c;
grpc_call *s;
gpr_timespec deadline = five_seconds_time();
cq_verifier *cqv = cq_verifier_create(f.cq);
grpc_op ops[6];
grpc_op *op;
@ -112,6 +113,7 @@ static void simple_request_body(grpc_end2end_test_config config,
grpc_slice details;
int was_cancelled = 2;
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),
@ -257,7 +259,7 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) {
/* start two requests - ensuring that the second is not accepted until
the first completes */
deadline = n_seconds_time(1000);
deadline = n_seconds_from_now(1000);
c1 = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/alpha"),
@ -502,13 +504,13 @@ static void test_max_concurrent_streams_with_timeout_on_first(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/alpha"),
get_host_override_slice("foo.test.google.fr:1234", config),
n_seconds_time(3), NULL);
n_seconds_from_now(3), NULL);
GPR_ASSERT(c1);
c2 = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/beta"),
get_host_override_slice("foo.test.google.fr:1234", config),
n_seconds_time(1000), NULL);
n_seconds_from_now(1000), NULL);
GPR_ASSERT(c2);
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(
@ -697,13 +699,13 @@ static void test_max_concurrent_streams_with_timeout_on_second(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/alpha"),
get_host_override_slice("foo.test.google.fr:1234", config),
n_seconds_time(1000), NULL);
n_seconds_from_now(1000), NULL);
GPR_ASSERT(c1);
c2 = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/beta"),
get_host_override_slice("foo.test.google.fr:1234", config),
n_seconds_time(3), NULL);
n_seconds_from_now(3), NULL);
GPR_ASSERT(c2);
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(

@ -66,16 +66,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}

@ -59,16 +59,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -100,7 +102,6 @@ static void end_test(grpc_end2end_test_fixture *f) {
static void simple_request_body(grpc_end2end_test_config config,
grpc_end2end_test_fixture f, size_t num_ops) {
grpc_call *c;
gpr_timespec deadline = gpr_inf_past(GPR_CLOCK_REALTIME);
cq_verifier *cqv = cq_verifier_create(f.cq);
grpc_op ops[6];
grpc_op *op;
@ -112,6 +113,7 @@ static void simple_request_body(grpc_end2end_test_config config,
gpr_log(GPR_DEBUG, "test with %" PRIuPTR " ops", num_ops);
gpr_timespec deadline = gpr_inf_past(GPR_CLOCK_REALTIME);
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),

@ -60,16 +60,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(500); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(500);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -106,7 +108,6 @@ static void test_invoke_network_status_change(grpc_end2end_test_config config) {
grpc_slice_from_copied_string("hello world");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
gpr_timespec deadline = five_seconds_time();
grpc_end2end_test_fixture f =
begin_test(config, "test_invoke_request_with_payload", NULL, NULL);
cq_verifier *cqv = cq_verifier_create(f.cq);
@ -122,6 +123,7 @@ static void test_invoke_network_status_change(grpc_end2end_test_config config) {
grpc_slice details;
int was_cancelled = 2;
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),

@ -87,16 +87,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -129,7 +131,6 @@ static void simple_request_body(grpc_end2end_test_config config,
grpc_end2end_test_fixture f) {
grpc_call *c;
grpc_call *s;
gpr_timespec deadline = five_seconds_time();
cq_verifier *cqv = cq_verifier_create(f.cq);
grpc_op ops[6];
grpc_op *op;
@ -143,6 +144,7 @@ static void simple_request_body(grpc_end2end_test_config config,
int was_cancelled = 2;
char *peer;
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),

@ -57,16 +57,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}

@ -57,16 +57,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -126,7 +128,6 @@ static void request_response_with_payload(grpc_end2end_test_config config,
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
grpc_byte_buffer *response_payload =
grpc_raw_byte_buffer_create(&response_payload_slice, 1);
gpr_timespec deadline = n_seconds_time(60);
cq_verifier *cqv = cq_verifier_create(f.cq);
grpc_op ops[6];
grpc_op *op;
@ -141,6 +142,7 @@ static void request_response_with_payload(grpc_end2end_test_config config,
grpc_slice details;
int was_cancelled = 2;
gpr_timespec deadline = n_seconds_from_now(60);
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),

@ -57,16 +57,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -102,7 +104,6 @@ static void test_pingpong_streaming(grpc_end2end_test_config config,
begin_test(config, "test_pingpong_streaming", NULL, NULL);
grpc_call *c;
grpc_call *s;
gpr_timespec deadline = five_seconds_time();
cq_verifier *cqv = cq_verifier_create(f.cq);
grpc_op ops[6];
grpc_op *op;
@ -124,6 +125,7 @@ static void test_pingpong_streaming(grpc_end2end_test_config config,
grpc_slice response_payload_slice =
grpc_slice_from_copied_string("hello you");
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),

@ -59,16 +59,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -101,7 +103,6 @@ static void simple_request_body(grpc_end2end_test_config config,
grpc_end2end_test_fixture f, void *rc) {
grpc_call *c;
grpc_call *s;
gpr_timespec deadline = five_seconds_time();
cq_verifier *cqv = cq_verifier_create(f.cq);
grpc_op ops[6];
grpc_op *op;
@ -114,6 +115,7 @@ static void simple_request_body(grpc_end2end_test_config config,
grpc_slice details;
int was_cancelled = 2;
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_registered_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, rc, deadline, NULL);
GPR_ASSERT(c);

@ -58,16 +58,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -104,7 +106,6 @@ static void test_invoke_request_with_flags(
grpc_slice_from_copied_string("hello world");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
gpr_timespec deadline = five_seconds_time();
grpc_end2end_test_fixture f =
begin_test(config, "test_invoke_request_with_flags", NULL, NULL);
cq_verifier *cqv = cq_verifier_create(f.cq);
@ -120,6 +121,7 @@ static void test_invoke_request_with_flags(
grpc_slice details;
grpc_call_error expectation;
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),

@ -57,16 +57,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -103,7 +105,6 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) {
grpc_slice_from_copied_string("hello world");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
gpr_timespec deadline = five_seconds_time();
grpc_end2end_test_fixture f =
begin_test(config, "test_invoke_request_with_payload", NULL, NULL);
cq_verifier *cqv = cq_verifier_create(f.cq);
@ -119,6 +120,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) {
grpc_slice details;
int was_cancelled = 2;
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),

@ -57,16 +57,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -195,7 +197,7 @@ void resource_quota_server(grpc_end2end_test_config config) {
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),
get_host_override_slice("foo.test.google.fr", config),
n_seconds_time(60), NULL);
n_seconds_from_now(60), NULL);
memset(ops, 0, sizeof(ops));
op = ops;
@ -237,7 +239,8 @@ void resource_quota_server(grpc_end2end_test_config config) {
while (pending_client_calls + pending_server_recv_calls +
pending_server_end_calls >
0) {
grpc_event ev = grpc_completion_queue_next(f.cq, n_seconds_time(60), NULL);
grpc_event ev =
grpc_completion_queue_next(f.cq, n_seconds_from_now(60), NULL);
GPR_ASSERT(ev.type == GRPC_OP_COMPLETE);
int ev_tag = (int)(intptr_t)ev.tag;

@ -59,16 +59,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -101,7 +103,6 @@ static void simple_request_body(grpc_end2end_test_config config,
grpc_end2end_test_fixture f) {
grpc_call *c;
grpc_call *s;
gpr_timespec deadline = five_seconds_time();
cq_verifier *cqv = cq_verifier_create(f.cq);
grpc_op ops[6];
grpc_op *op;
@ -114,6 +115,7 @@ static void simple_request_body(grpc_end2end_test_config config,
grpc_slice details;
int was_cancelled = 2;
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),

@ -57,16 +57,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -88,7 +90,6 @@ static void test_early_server_shutdown_finishes_inflight_calls(
grpc_end2end_test_config config) {
grpc_call *c;
grpc_call *s;
gpr_timespec deadline = five_seconds_time();
grpc_end2end_test_fixture f = begin_test(
config, "test_early_server_shutdown_finishes_inflight_calls", NULL, NULL);
cq_verifier *cqv = cq_verifier_create(f.cq);
@ -103,6 +104,7 @@ static void test_early_server_shutdown_finishes_inflight_calls(
grpc_slice details;
int was_cancelled = 2;
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),

@ -57,16 +57,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}

@ -59,16 +59,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -110,7 +112,6 @@ static void test_cacheable_request_response_with_metadata_and_payload(
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
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] = {{grpc_slice_from_static_string("key1"),
grpc_slice_from_static_string("val1"),
0,
@ -144,6 +145,7 @@ static void test_cacheable_request_response_with_metadata_and_payload(
grpc_slice details;
int was_cancelled = 2;
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),

@ -45,16 +45,18 @@
static void *tag(intptr_t t) { return (void *)t; }
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -90,7 +92,6 @@ static void simple_delayed_request_body(grpc_end2end_test_config config,
long delay_us) {
grpc_call *c;
grpc_call *s;
gpr_timespec deadline = five_seconds_time();
cq_verifier *cqv = cq_verifier_create(f->cq);
grpc_op ops[6];
grpc_op *op;
@ -106,6 +107,7 @@ static void simple_delayed_request_body(grpc_end2end_test_config config,
config.init_client(f, client_args);
config.init_server(f, server_args);
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(
f->client, NULL, GRPC_PROPAGATE_DEFAULTS, f->cq,
grpc_slice_from_static_string("/foo"),

@ -57,16 +57,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -108,7 +110,6 @@ static void test_request_response_with_metadata_and_payload(
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
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] = {{grpc_slice_from_static_string("key1"),
grpc_slice_from_static_string("val1"),
0,
@ -141,6 +142,7 @@ static void test_request_response_with_metadata_and_payload(
grpc_slice details;
int was_cancelled = 2;
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),

@ -59,16 +59,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -101,7 +103,6 @@ static void simple_request_body(grpc_end2end_test_config config,
grpc_end2end_test_fixture f) {
grpc_call *c;
grpc_call *s;
gpr_timespec deadline = five_seconds_time();
cq_verifier *cqv = cq_verifier_create(f.cq);
grpc_op ops[6];
grpc_op *op;
@ -115,6 +116,7 @@ static void simple_request_body(grpc_end2end_test_config config,
int was_cancelled = 2;
char *peer;
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),

@ -62,16 +62,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -110,7 +112,6 @@ static void test(grpc_end2end_test_config config, bool request_status_early) {
grpc_slice response_payload2_slice = grpc_slice_from_copied_string("world");
grpc_byte_buffer *response_payload2 =
grpc_raw_byte_buffer_create(&response_payload2_slice, 1);
gpr_timespec deadline = five_seconds_time();
grpc_end2end_test_fixture f = begin_test(config, "streaming_error_response",
NULL, NULL, request_status_early);
cq_verifier *cqv = cq_verifier_create(f.cq);
@ -127,6 +128,7 @@ static void test(grpc_end2end_test_config config, bool request_status_early) {
grpc_slice details;
int was_cancelled = 2;
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),

@ -57,16 +57,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -108,7 +110,6 @@ static void test_request_response_with_metadata_and_payload(
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
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] = {{grpc_slice_from_static_string("key1"),
grpc_slice_from_static_string("val1"),
0,
@ -149,6 +150,7 @@ static void test_request_response_with_metadata_and_payload(
grpc_slice details;
int was_cancelled = 2;
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),

@ -57,16 +57,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -106,7 +108,6 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) {
grpc_slice request_payload_slice2 = grpc_slice_from_copied_string("abc123");
grpc_byte_buffer *request_payload2 =
grpc_raw_byte_buffer_create(&request_payload_slice2, 1);
gpr_timespec deadline = five_seconds_time();
grpc_end2end_test_fixture f =
begin_test(config, "test_invoke_request_with_payload", NULL, NULL);
cq_verifier *cqv = cq_verifier_create(f.cq);
@ -123,6 +124,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) {
grpc_slice details = grpc_empty_slice();
int was_cancelled = 2;
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),

@ -57,16 +57,18 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
return f;
}
static gpr_timespec n_seconds_time(int n) {
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -103,7 +105,6 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) {
grpc_slice_from_copied_string("hello world");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
gpr_timespec deadline = five_seconds_time();
grpc_end2end_test_fixture f =
begin_test(config, "test_invoke_request_with_payload", NULL, NULL);
cq_verifier *cqv = cq_verifier_create(f.cq);
@ -120,6 +121,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) {
grpc_slice details = grpc_empty_slice();
int was_cancelled = 2;
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),

Loading…
Cancel
Save