diff options
Diffstat (limited to 'test/core/end2end/invalid_call_argument_test.cc')
-rw-r--r-- | test/core/end2end/invalid_call_argument_test.cc | 148 |
1 files changed, 74 insertions, 74 deletions
diff --git a/test/core/end2end/invalid_call_argument_test.cc b/test/core/end2end/invalid_call_argument_test.cc index c310a0e9ba..ff7f710095 100644 --- a/test/core/end2end/invalid_call_argument_test.cc +++ b/test/core/end2end/invalid_call_argument_test.cc @@ -60,7 +60,7 @@ static void prepare_test(int is_client) { grpc_metadata_array_init(&g_state.initial_metadata_recv); grpc_metadata_array_init(&g_state.trailing_metadata_recv); g_state.deadline = grpc_timeout_seconds_to_deadline(5); - g_state.cq = grpc_completion_queue_create_for_next(NULL); + g_state.cq = grpc_completion_queue_create_for_next(nullptr); g_state.cqv = cq_verifier_create(g_state.cq); g_state.details = grpc_empty_slice(); memset(g_state.ops, 0, sizeof(g_state.ops)); @@ -68,36 +68,36 @@ static void prepare_test(int is_client) { if (is_client) { /* create a call, channel to a non existant server */ g_state.chan = - grpc_insecure_channel_create("nonexistant:54321", NULL, NULL); + grpc_insecure_channel_create("nonexistant:54321", nullptr, nullptr); grpc_slice host = grpc_slice_from_static_string("nonexistant"); g_state.call = grpc_channel_create_call( - g_state.chan, NULL, GRPC_PROPAGATE_DEFAULTS, g_state.cq, - grpc_slice_from_static_string("/Foo"), &host, g_state.deadline, NULL); + g_state.chan, nullptr, GRPC_PROPAGATE_DEFAULTS, g_state.cq, + grpc_slice_from_static_string("/Foo"), &host, g_state.deadline, nullptr); } else { - g_state.server = grpc_server_create(NULL, NULL); - grpc_server_register_completion_queue(g_state.server, g_state.cq, NULL); + g_state.server = grpc_server_create(nullptr, nullptr); + grpc_server_register_completion_queue(g_state.server, g_state.cq, nullptr); gpr_join_host_port(&server_hostport, "0.0.0.0", port); grpc_server_add_insecure_http2_port(g_state.server, server_hostport); grpc_server_start(g_state.server); gpr_free(server_hostport); gpr_join_host_port(&server_hostport, "localhost", port); - g_state.chan = grpc_insecure_channel_create(server_hostport, NULL, NULL); + g_state.chan = grpc_insecure_channel_create(server_hostport, nullptr, nullptr); gpr_free(server_hostport); grpc_slice host = grpc_slice_from_static_string("bar"); g_state.call = grpc_channel_create_call( - g_state.chan, NULL, GRPC_PROPAGATE_DEFAULTS, g_state.cq, - grpc_slice_from_static_string("/Foo"), &host, g_state.deadline, NULL); + g_state.chan, nullptr, GRPC_PROPAGATE_DEFAULTS, g_state.cq, + grpc_slice_from_static_string("/Foo"), &host, g_state.deadline, nullptr); grpc_metadata_array_init(&g_state.server_initial_metadata_recv); grpc_call_details_init(&g_state.call_details); op = g_state.ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = GRPC_INITIAL_METADATA_WAIT_FOR_READY; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(g_state.call, g_state.ops, (size_t)(op - g_state.ops), - tag(1), NULL)); + tag(1), nullptr)); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(g_state.server, &g_state.server_call, &g_state.call_details, @@ -119,12 +119,12 @@ static void cleanup_test() { grpc_metadata_array_destroy(&g_state.trailing_metadata_recv); if (!g_state.is_client) { - shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); + shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr); grpc_call_unref(g_state.server_call); grpc_server_shutdown_and_notify(g_state.server, shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_completion_queue_destroy(shutdown_cq); grpc_server_destroy(g_state.server); @@ -133,7 +133,7 @@ static void cleanup_test() { } grpc_completion_queue_shutdown(g_state.cq); while (grpc_completion_queue_next(g_state.cq, - gpr_inf_future(GPR_CLOCK_REALTIME), NULL) + gpr_inf_future(GPR_CLOCK_REALTIME), nullptr) .type != GRPC_QUEUE_SHUTDOWN) ; grpc_completion_queue_destroy(g_state.cq); @@ -144,7 +144,7 @@ static void test_non_null_reserved_on_start_batch() { prepare_test(1); GPR_ASSERT(GRPC_CALL_ERROR == - grpc_call_start_batch(g_state.call, NULL, 0, NULL, tag(1))); + grpc_call_start_batch(g_state.call, nullptr, 0, nullptr, tag(1))); cleanup_test(); } @@ -162,7 +162,7 @@ static void test_non_null_reserved_on_op() { op++; GPR_ASSERT(GRPC_CALL_ERROR == grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), tag(1), NULL)); + (size_t)(op - g_state.ops), tag(1), nullptr)); cleanup_test(); } @@ -176,11 +176,11 @@ static void test_send_initial_metadata_more_than_once() { op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(g_state.call, g_state.ops, (size_t)(op - g_state.ops), - tag(1), NULL)); + tag(1), nullptr)); CQ_EXPECT_COMPLETION(g_state.cqv, tag(1), 0); cq_verify(g_state.cqv); @@ -188,11 +188,11 @@ static void test_send_initial_metadata_more_than_once() { op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS == grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), tag(1), NULL)); + (size_t)(op - g_state.ops), tag(1), nullptr)); cleanup_test(); } @@ -206,11 +206,11 @@ static void test_too_many_metadata() { op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = (size_t)INT_MAX + 1; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_ERROR_INVALID_METADATA == grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), tag(1), NULL)); + (size_t)(op - g_state.ops), tag(1), nullptr)); cleanup_test(); } @@ -224,16 +224,16 @@ static void test_send_null_message() { op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_MESSAGE; - op->data.send_message.send_message = NULL; + op->data.send_message.send_message = nullptr; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_ERROR_INVALID_MESSAGE == grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), tag(1), NULL)); + (size_t)(op - g_state.ops), tag(1), nullptr)); cleanup_test(); } @@ -250,21 +250,21 @@ static void test_send_messages_at_the_same_time() { op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = request_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = static_cast<grpc_byte_buffer*>(tag(2)); op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS == grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), tag(1), NULL)); + (size_t)(op - g_state.ops), tag(1), nullptr)); grpc_byte_buffer_destroy(request_payload); cleanup_test(); } @@ -282,11 +282,11 @@ static void test_send_server_status_from_client() { grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_ERROR_NOT_ON_CLIENT == grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), tag(1), NULL)); + (size_t)(op - g_state.ops), tag(1), nullptr)); cleanup_test(); } @@ -300,11 +300,11 @@ static void test_receive_initial_metadata_twice_at_client() { op->data.recv_initial_metadata.recv_initial_metadata = &g_state.initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(g_state.call, g_state.ops, (size_t)(op - g_state.ops), - tag(1), NULL)); + tag(1), nullptr)); CQ_EXPECT_COMPLETION(g_state.cqv, tag(1), 0); cq_verify(g_state.cqv); op = g_state.ops; @@ -312,11 +312,11 @@ static void test_receive_initial_metadata_twice_at_client() { op->data.recv_initial_metadata.recv_initial_metadata = &g_state.initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS == grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), tag(1), NULL)); + (size_t)(op - g_state.ops), tag(1), nullptr)); cleanup_test(); } @@ -324,17 +324,17 @@ static void test_receive_message_with_invalid_flags() { gpr_log(GPR_INFO, "test_receive_message_with_invalid_flags"); grpc_op* op; - grpc_byte_buffer* payload = NULL; + grpc_byte_buffer* payload = nullptr; prepare_test(1); op = g_state.ops; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &payload; op->flags = 1; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_ERROR_INVALID_FLAGS == grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), tag(1), NULL)); + (size_t)(op - g_state.ops), tag(1), nullptr)); cleanup_test(); } @@ -342,22 +342,22 @@ static void test_receive_two_messages_at_the_same_time() { gpr_log(GPR_INFO, "test_receive_two_messages_at_the_same_time"); grpc_op* op; - grpc_byte_buffer* payload = NULL; + grpc_byte_buffer* payload = nullptr; prepare_test(1); op = g_state.ops; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS == grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), tag(1), NULL)); + (size_t)(op - g_state.ops), tag(1), nullptr)); cleanup_test(); } @@ -369,13 +369,13 @@ static void test_recv_close_on_server_from_client() { op = g_state.ops; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; - op->data.recv_close_on_server.cancelled = NULL; + op->data.recv_close_on_server.cancelled = nullptr; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_ERROR_NOT_ON_CLIENT == grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), tag(1), NULL)); + (size_t)(op - g_state.ops), tag(1), nullptr)); cleanup_test(); } @@ -392,25 +392,25 @@ static void test_recv_status_on_client_twice() { op->data.recv_status_on_client.status = &g_state.status; op->data.recv_status_on_client.status_details = &g_state.details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(g_state.call, g_state.ops, (size_t)(op - g_state.ops), - tag(1), NULL)); + tag(1), nullptr)); CQ_EXPECT_COMPLETION(g_state.cqv, tag(1), 1); cq_verify(g_state.cqv); op = g_state.ops; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; - op->data.recv_status_on_client.trailing_metadata = NULL; - op->data.recv_status_on_client.status = NULL; - op->data.recv_status_on_client.status_details = NULL; + op->data.recv_status_on_client.trailing_metadata = nullptr; + op->data.recv_status_on_client.status = nullptr; + op->data.recv_status_on_client.status_details = nullptr; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS == grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), tag(1), NULL)); + (size_t)(op - g_state.ops), tag(1), nullptr)); cleanup_test(); } @@ -423,11 +423,11 @@ static void test_send_close_from_client_on_server() { op = g_state.ops; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_ERROR_NOT_ON_SERVER == grpc_call_start_batch(g_state.server_call, g_state.ops, - (size_t)(op - g_state.ops), tag(2), NULL)); + (size_t)(op - g_state.ops), tag(2), nullptr)); cleanup_test(); } @@ -444,11 +444,11 @@ static void test_recv_status_on_client_from_server() { op->data.recv_status_on_client.status = &g_state.status; op->data.recv_status_on_client.status_details = &g_state.details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_ERROR_NOT_ON_SERVER == grpc_call_start_batch(g_state.server_call, g_state.ops, - (size_t)(op - g_state.ops), tag(2), NULL)); + (size_t)(op - g_state.ops), tag(2), nullptr)); cleanup_test(); } @@ -465,11 +465,11 @@ static void test_send_status_from_server_with_invalid_flags() { grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 1; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_ERROR_INVALID_FLAGS == grpc_call_start_batch(g_state.server_call, g_state.ops, - (size_t)(op - g_state.ops), tag(2), NULL)); + (size_t)(op - g_state.ops), tag(2), nullptr)); cleanup_test(); } @@ -487,11 +487,11 @@ static void test_too_many_trailing_metadata() { grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_ERROR_INVALID_METADATA == grpc_call_start_batch(g_state.server_call, g_state.ops, - (size_t)(op - g_state.ops), tag(2), NULL)); + (size_t)(op - g_state.ops), tag(2), nullptr)); cleanup_test(); } @@ -508,18 +508,18 @@ static void test_send_server_status_twice() { grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED; op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS == grpc_call_start_batch(g_state.server_call, g_state.ops, - (size_t)(op - g_state.ops), tag(2), NULL)); + (size_t)(op - g_state.ops), tag(2), nullptr)); cleanup_test(); } @@ -531,13 +531,13 @@ static void test_recv_close_on_server_with_invalid_flags() { op = g_state.ops; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; - op->data.recv_close_on_server.cancelled = NULL; + op->data.recv_close_on_server.cancelled = nullptr; op->flags = 1; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_ERROR_INVALID_FLAGS == grpc_call_start_batch(g_state.server_call, g_state.ops, - (size_t)(op - g_state.ops), tag(2), NULL)); + (size_t)(op - g_state.ops), tag(2), nullptr)); cleanup_test(); } @@ -549,18 +549,18 @@ static void test_recv_close_on_server_twice() { op = g_state.ops; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; - op->data.recv_close_on_server.cancelled = NULL; + op->data.recv_close_on_server.cancelled = nullptr; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; - op->data.recv_close_on_server.cancelled = NULL; + op->data.recv_close_on_server.cancelled = nullptr; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS == grpc_call_start_batch(g_state.server_call, g_state.ops, - (size_t)(op - g_state.ops), tag(2), NULL)); + (size_t)(op - g_state.ops), tag(2), nullptr)); cleanup_test(); } @@ -578,11 +578,11 @@ static void test_invalid_initial_metadata_reserved_key() { op->data.send_initial_metadata.count = 1; op->data.send_initial_metadata.metadata = &metadata; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_ERROR_INVALID_METADATA == grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), tag(1), NULL)); + (size_t)(op - g_state.ops), tag(1), nullptr)); cleanup_test(); } |