From 7885ea5e313b6bb59647881bf15c505aed66c98f Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 10 Mar 2016 06:53:29 -0800 Subject: Add a place for tests --- test/core/end2end/tests/idempotent_request.c | 247 ++++++++++++++++++++++++ test/core/end2end/tests/registered_idempotent.c | 233 ++++++++++++++++++++++ 2 files changed, 480 insertions(+) create mode 100644 test/core/end2end/tests/idempotent_request.c create mode 100644 test/core/end2end/tests/registered_idempotent.c (limited to 'test/core/end2end/tests') diff --git a/test/core/end2end/tests/idempotent_request.c b/test/core/end2end/tests/idempotent_request.c new file mode 100644 index 0000000000..fd9788d0ba --- /dev/null +++ b/test/core/end2end/tests/idempotent_request.c @@ -0,0 +1,247 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "test/core/end2end/end2end_tests.h" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include "src/core/support/string.h" +#include "test/core/end2end/cq_verifier.h" + +enum { TIMEOUT = 200000 }; + +static void *tag(intptr_t 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_server(&f, server_args); + config.init_client(&f, client_args); + return f; +} + +static gpr_timespec n_seconds_time(int n) { + return GRPC_TIMEOUT_SECONDS_TO_DEADLINE(n); +} + +static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } + +static void drain_cq(grpc_completion_queue *cq) { + grpc_event ev; + do { + ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL); + } while (ev.type != GRPC_QUEUE_SHUTDOWN); +} + +static void shutdown_server(grpc_end2end_test_fixture *f) { + if (!f->server) return; + grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck( + f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) + .type == GRPC_OP_COMPLETE); + 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->cq); + drain_cq(f->cq); + grpc_completion_queue_destroy(f->cq); +} + +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; + grpc_metadata_array initial_metadata_recv; + grpc_metadata_array trailing_metadata_recv; + grpc_metadata_array request_metadata_recv; + grpc_call_details call_details; + grpc_status_code status; + grpc_call_error error; + char *details = NULL; + size_t details_capacity = 0; + int was_cancelled = 2; + char *peer; + + c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + "/foo", "foo.test.google.fr:1234", deadline, + NULL); + GPR_ASSERT(c); + + peer = grpc_call_get_peer(c); + GPR_ASSERT(peer != NULL); + gpr_log(GPR_DEBUG, "client_peer_before_call=%s", peer); + gpr_free(peer); + + grpc_metadata_array_init(&initial_metadata_recv); + grpc_metadata_array_init(&trailing_metadata_recv); + grpc_metadata_array_init(&request_metadata_recv); + grpc_call_details_init(&call_details); + + op = ops; + op->op = GRPC_OP_SEND_INITIAL_METADATA; + op->data.send_initial_metadata.count = 0; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_INITIAL_METADATA; + op->data.recv_initial_metadata = &initial_metadata_recv; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; + op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; + op->data.recv_status_on_client.status = &status; + op->data.recv_status_on_client.status_details = &details; + op->data.recv_status_on_client.status_details_capacity = &details_capacity; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + error = + grpc_server_request_call(f.server, &s, &call_details, + &request_metadata_recv, f.cq, f.cq, tag(101)); + GPR_ASSERT(GRPC_CALL_OK == error); + cq_expect_completion(cqv, tag(101), 1); + cq_verify(cqv); + + peer = grpc_call_get_peer(s); + GPR_ASSERT(peer != NULL); + gpr_log(GPR_DEBUG, "server_peer=%s", peer); + gpr_free(peer); + peer = grpc_call_get_peer(c); + GPR_ASSERT(peer != NULL); + gpr_log(GPR_DEBUG, "client_peer=%s", peer); + gpr_free(peer); + + op = ops; + op->op = GRPC_OP_SEND_INITIAL_METADATA; + op->data.send_initial_metadata.count = 0; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; + op->data.send_status_from_server.trailing_metadata_count = 0; + op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED; + op->data.send_status_from_server.status_details = "xyz"; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; + op->data.recv_close_on_server.cancelled = &was_cancelled; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + cq_expect_completion(cqv, tag(102), 1); + cq_expect_completion(cqv, tag(1), 1); + cq_verify(cqv); + + GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); + GPR_ASSERT(0 == strcmp(details, "xyz")); + GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); + GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr:1234")); + GPR_ASSERT(was_cancelled == 1); + + gpr_free(details); + grpc_metadata_array_destroy(&initial_metadata_recv); + grpc_metadata_array_destroy(&trailing_metadata_recv); + grpc_metadata_array_destroy(&request_metadata_recv); + grpc_call_details_destroy(&call_details); + + grpc_call_destroy(c); + grpc_call_destroy(s); + + cq_verifier_destroy(cqv); +} + +static void test_invoke_simple_request(grpc_end2end_test_config config) { + grpc_end2end_test_fixture f; + + f = begin_test(config, "test_invoke_simple_request", NULL, NULL); + simple_request_body(f); + end_test(&f); + config.tear_down_data(&f); +} + +static void test_invoke_10_simple_requests(grpc_end2end_test_config config) { + int i; + grpc_end2end_test_fixture f = + begin_test(config, "test_invoke_10_simple_requests", NULL, NULL); + for (i = 0; i < 10; i++) { + simple_request_body(f); + gpr_log(GPR_INFO, "Passed simple request %d", i); + } + end_test(&f); + config.tear_down_data(&f); +} + +void simple_request(grpc_end2end_test_config config) { + int i; + for (i = 0; i < 10; i++) { + test_invoke_simple_request(config); + } + test_invoke_10_simple_requests(config); +} diff --git a/test/core/end2end/tests/registered_idempotent.c b/test/core/end2end/tests/registered_idempotent.c new file mode 100644 index 0000000000..d9d2b19d12 --- /dev/null +++ b/test/core/end2end/tests/registered_idempotent.c @@ -0,0 +1,233 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "test/core/end2end/end2end_tests.h" + +#include +#include + +#include "src/core/support/string.h" +#include +#include +#include +#include +#include +#include +#include "test/core/end2end/cq_verifier.h" + +enum { TIMEOUT = 200000 }; + +static void *tag(intptr_t 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_server(&f, server_args); + config.init_client(&f, client_args); + return f; +} + +static gpr_timespec n_seconds_time(int n) { + return GRPC_TIMEOUT_SECONDS_TO_DEADLINE(n); +} + +static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } + +static void drain_cq(grpc_completion_queue *cq) { + grpc_event ev; + do { + ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL); + } while (ev.type != GRPC_QUEUE_SHUTDOWN); +} + +static void shutdown_server(grpc_end2end_test_fixture *f) { + if (!f->server) return; + grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), + NULL).type == GRPC_OP_COMPLETE); + 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->cq); + drain_cq(f->cq); + grpc_completion_queue_destroy(f->cq); +} + +static void simple_request_body(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; + grpc_metadata_array initial_metadata_recv; + grpc_metadata_array trailing_metadata_recv; + grpc_metadata_array request_metadata_recv; + grpc_call_details call_details; + grpc_status_code status; + grpc_call_error error; + char *details = NULL; + size_t details_capacity = 0; + int was_cancelled = 2; + + c = grpc_channel_create_registered_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, rc, deadline, NULL); + GPR_ASSERT(c); + + grpc_metadata_array_init(&initial_metadata_recv); + grpc_metadata_array_init(&trailing_metadata_recv); + grpc_metadata_array_init(&request_metadata_recv); + grpc_call_details_init(&call_details); + + op = ops; + op->op = GRPC_OP_SEND_INITIAL_METADATA; + op->data.send_initial_metadata.count = 0; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_INITIAL_METADATA; + op->data.recv_initial_metadata = &initial_metadata_recv; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; + op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; + op->data.recv_status_on_client.status = &status; + op->data.recv_status_on_client.status_details = &details; + op->data.recv_status_on_client.status_details_capacity = &details_capacity; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + error = + grpc_server_request_call(f.server, &s, &call_details, + &request_metadata_recv, f.cq, f.cq, tag(101)); + GPR_ASSERT(GRPC_CALL_OK == error); + cq_expect_completion(cqv, tag(101), 1); + cq_verify(cqv); + + op = ops; + op->op = GRPC_OP_SEND_INITIAL_METADATA; + op->data.send_initial_metadata.count = 0; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; + op->data.send_status_from_server.trailing_metadata_count = 0; + op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED; + op->data.send_status_from_server.status_details = "xyz"; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; + op->data.recv_close_on_server.cancelled = &was_cancelled; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + cq_expect_completion(cqv, tag(102), 1); + cq_expect_completion(cqv, tag(1), 1); + cq_verify(cqv); + + GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); + GPR_ASSERT(0 == strcmp(details, "xyz")); + GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); + GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr:1234")); + GPR_ASSERT(was_cancelled == 1); + + gpr_free(details); + grpc_metadata_array_destroy(&initial_metadata_recv); + grpc_metadata_array_destroy(&trailing_metadata_recv); + grpc_metadata_array_destroy(&request_metadata_recv); + grpc_call_details_destroy(&call_details); + + grpc_call_destroy(c); + grpc_call_destroy(s); + + cq_verifier_destroy(cqv); +} + +static void test_invoke_simple_request(grpc_end2end_test_config config) { + grpc_end2end_test_fixture f = + begin_test(config, "test_invoke_simple_request", NULL, NULL); + void *rc = grpc_channel_register_call(f.client, "/foo", + "foo.test.google.fr:1234", NULL); + + simple_request_body(f, rc); + end_test(&f); + config.tear_down_data(&f); +} + +static void test_invoke_10_simple_requests(grpc_end2end_test_config config) { + int i; + grpc_end2end_test_fixture f = + begin_test(config, "test_invoke_10_simple_requests", NULL, NULL); + void *rc = grpc_channel_register_call(f.client, "/foo", + "foo.test.google.fr:1234", NULL); + + for (i = 0; i < 10; i++) { + simple_request_body(f, rc); + gpr_log(GPR_INFO, "Passed simple request %d", i); + } + end_test(&f); + config.tear_down_data(&f); +} + +void registered_call(grpc_end2end_test_config config) { + test_invoke_simple_request(config); + test_invoke_10_simple_requests(config); +} -- cgit v1.2.3 From df5231ec09caf2422f939a5a910854033b81e015 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 10 Mar 2016 07:00:47 -0800 Subject: Implement tests --- Makefile | 2 - test/core/bad_client/bad_client.c | 10 +- test/core/end2end/end2end_nosec_tests.c | 6 - test/core/end2end/end2end_tests.c | 6 - test/core/end2end/gen_build_yaml.py | 1 - test/core/end2end/tests/idempotent_request.c | 5 +- test/core/end2end/tests/registered_idempotent.c | 233 -------- test/core/end2end/tests/simple_request.c | 1 + test/core/surface/server_test.c | 14 +- tools/run_tests/sources_and_headers.json | 2 - tools/run_tests/tests.json | 621 +-------------------- .../end2end_nosec_tests.vcxproj | 2 - .../end2end_nosec_tests.vcxproj.filters | 3 - .../tests/end2end_tests/end2end_tests.vcxproj | 2 - .../end2end_tests/end2end_tests.vcxproj.filters | 3 - 15 files changed, 23 insertions(+), 888 deletions(-) delete mode 100644 test/core/end2end/tests/registered_idempotent.c (limited to 'test/core/end2end/tests') diff --git a/Makefile b/Makefile index d2ec1d815d..fb10905015 100644 --- a/Makefile +++ b/Makefile @@ -5544,7 +5544,6 @@ LIBEND2END_TESTS_SRC = \ test/core/end2end/tests/ping.c \ test/core/end2end/tests/ping_pong_streaming.c \ test/core/end2end/tests/registered_call.c \ - test/core/end2end/tests/registered_idempotent.c \ test/core/end2end/tests/request_with_flags.c \ test/core/end2end/tests/request_with_payload.c \ test/core/end2end/tests/server_finishes_request.c \ @@ -5619,7 +5618,6 @@ LIBEND2END_NOSEC_TESTS_SRC = \ test/core/end2end/tests/ping.c \ test/core/end2end/tests/ping_pong_streaming.c \ test/core/end2end/tests/registered_call.c \ - test/core/end2end/tests/registered_idempotent.c \ test/core/end2end/tests/request_with_flags.c \ test/core/end2end/tests/request_with_payload.c \ test/core/end2end/tests/server_finishes_request.c \ diff --git a/test/core/bad_client/bad_client.c b/test/core/bad_client/bad_client.c index 1a2ca6f0c0..1d066e2e80 100644 --- a/test/core/bad_client/bad_client.c +++ b/test/core/bad_client/bad_client.c @@ -36,9 +36,9 @@ #include "src/core/channel/channel_stack.h" #include "src/core/channel/http_server_filter.h" #include "src/core/iomgr/endpoint_pair.h" +#include "src/core/support/string.h" #include "src/core/surface/completion_queue.h" #include "src/core/surface/server.h" -#include "src/core/support/string.h" #include "src/core/transport/chttp2_transport.h" #include @@ -113,7 +113,7 @@ void grpc_run_bad_client_test(grpc_bad_client_server_side_validator validator, grpc_server_register_completion_queue(a.server, a.cq, NULL); a.registered_method = grpc_server_register_method(a.server, GRPC_BAD_CLIENT_REGISTERED_METHOD, - GRPC_BAD_CLIENT_REGISTERED_HOST); + GRPC_BAD_CLIENT_REGISTERED_HOST, 0); grpc_server_start(a.server); transport = grpc_create_chttp2_transport(&exec_ctx, NULL, sfd.server, 0); server_setup_transport(&a, transport); @@ -158,9 +158,9 @@ void grpc_run_bad_client_test(grpc_bad_client_server_side_validator validator, grpc_exec_ctx_finish(&exec_ctx); } grpc_server_shutdown_and_notify(a.server, a.cq, NULL); - GPR_ASSERT(grpc_completion_queue_pluck(a.cq, NULL, - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1), - NULL).type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck( + a.cq, NULL, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1), NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(a.server); grpc_completion_queue_destroy(a.cq); gpr_slice_buffer_destroy(&outgoing); diff --git a/test/core/end2end/end2end_nosec_tests.c b/test/core/end2end/end2end_nosec_tests.c index 7b6d0d3f9b..bf4dd3555c 100644 --- a/test/core/end2end/end2end_nosec_tests.c +++ b/test/core/end2end/end2end_nosec_tests.c @@ -65,7 +65,6 @@ extern void payload(grpc_end2end_test_config config); extern void ping(grpc_end2end_test_config config); extern void ping_pong_streaming(grpc_end2end_test_config config); extern void registered_call(grpc_end2end_test_config config); -extern void registered_idempotent(grpc_end2end_test_config config); extern void request_with_flags(grpc_end2end_test_config config); extern void request_with_payload(grpc_end2end_test_config config); extern void server_finishes_request(grpc_end2end_test_config config); @@ -108,7 +107,6 @@ void grpc_end2end_tests(int argc, char **argv, ping(config); ping_pong_streaming(config); registered_call(config); - registered_idempotent(config); request_with_flags(config); request_with_payload(config); server_finishes_request(config); @@ -230,10 +228,6 @@ void grpc_end2end_tests(int argc, char **argv, registered_call(config); continue; } - if (0 == strcmp("registered_idempotent", argv[i])) { - registered_idempotent(config); - continue; - } if (0 == strcmp("request_with_flags", argv[i])) { request_with_flags(config); continue; diff --git a/test/core/end2end/end2end_tests.c b/test/core/end2end/end2end_tests.c index 2d139c7e5d..c37f670e68 100644 --- a/test/core/end2end/end2end_tests.c +++ b/test/core/end2end/end2end_tests.c @@ -66,7 +66,6 @@ extern void payload(grpc_end2end_test_config config); extern void ping(grpc_end2end_test_config config); extern void ping_pong_streaming(grpc_end2end_test_config config); extern void registered_call(grpc_end2end_test_config config); -extern void registered_idempotent(grpc_end2end_test_config config); extern void request_with_flags(grpc_end2end_test_config config); extern void request_with_payload(grpc_end2end_test_config config); extern void server_finishes_request(grpc_end2end_test_config config); @@ -110,7 +109,6 @@ void grpc_end2end_tests(int argc, char **argv, ping(config); ping_pong_streaming(config); registered_call(config); - registered_idempotent(config); request_with_flags(config); request_with_payload(config); server_finishes_request(config); @@ -236,10 +234,6 @@ void grpc_end2end_tests(int argc, char **argv, registered_call(config); continue; } - if (0 == strcmp("registered_idempotent", argv[i])) { - registered_idempotent(config); - continue; - } if (0 == strcmp("request_with_flags", argv[i])) { request_with_flags(config); continue; diff --git a/test/core/end2end/gen_build_yaml.py b/test/core/end2end/gen_build_yaml.py index d185a189d8..1c0923d2c8 100755 --- a/test/core/end2end/gen_build_yaml.py +++ b/test/core/end2end/gen_build_yaml.py @@ -115,7 +115,6 @@ END2END_TESTS = { 'ping_pong_streaming': default_test_options, 'ping': connectivity_test_options._replace(proxyable=False), 'registered_call': default_test_options, - 'registered_idempotent': default_test_options, 'request_with_flags': default_test_options._replace(proxyable=False), 'request_with_payload': default_test_options, 'server_finishes_request': default_test_options, diff --git a/test/core/end2end/tests/idempotent_request.c b/test/core/end2end/tests/idempotent_request.c index fd9788d0ba..4a9bd7bb1e 100644 --- a/test/core/end2end/tests/idempotent_request.c +++ b/test/core/end2end/tests/idempotent_request.c @@ -135,7 +135,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; - op->flags = 0; + op->flags = GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST; op->reserved = NULL; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; @@ -203,6 +203,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr:1234")); + GPR_ASSERT(GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST == call_details.flags); GPR_ASSERT(was_cancelled == 1); gpr_free(details); @@ -238,7 +239,7 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config) { config.tear_down_data(&f); } -void simple_request(grpc_end2end_test_config config) { +void idempotent_request(grpc_end2end_test_config config) { int i; for (i = 0; i < 10; i++) { test_invoke_simple_request(config); diff --git a/test/core/end2end/tests/registered_idempotent.c b/test/core/end2end/tests/registered_idempotent.c deleted file mode 100644 index d9d2b19d12..0000000000 --- a/test/core/end2end/tests/registered_idempotent.c +++ /dev/null @@ -1,233 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include "test/core/end2end/end2end_tests.h" - -#include -#include - -#include "src/core/support/string.h" -#include -#include -#include -#include -#include -#include -#include "test/core/end2end/cq_verifier.h" - -enum { TIMEOUT = 200000 }; - -static void *tag(intptr_t 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_server(&f, server_args); - config.init_client(&f, client_args); - return f; -} - -static gpr_timespec n_seconds_time(int n) { - return GRPC_TIMEOUT_SECONDS_TO_DEADLINE(n); -} - -static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } - -static void drain_cq(grpc_completion_queue *cq) { - grpc_event ev; - do { - ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL); - } while (ev.type != GRPC_QUEUE_SHUTDOWN); -} - -static void shutdown_server(grpc_end2end_test_fixture *f) { - if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), - NULL).type == GRPC_OP_COMPLETE); - 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->cq); - drain_cq(f->cq); - grpc_completion_queue_destroy(f->cq); -} - -static void simple_request_body(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; - grpc_metadata_array initial_metadata_recv; - grpc_metadata_array trailing_metadata_recv; - grpc_metadata_array request_metadata_recv; - grpc_call_details call_details; - grpc_status_code status; - grpc_call_error error; - char *details = NULL; - size_t details_capacity = 0; - int was_cancelled = 2; - - c = grpc_channel_create_registered_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, rc, deadline, NULL); - GPR_ASSERT(c); - - grpc_metadata_array_init(&initial_metadata_recv); - grpc_metadata_array_init(&trailing_metadata_recv); - grpc_metadata_array_init(&request_metadata_recv); - grpc_call_details_init(&call_details); - - op = ops; - op->op = GRPC_OP_SEND_INITIAL_METADATA; - op->data.send_initial_metadata.count = 0; - op->flags = 0; - op->reserved = NULL; - op++; - op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; - op->flags = 0; - op->reserved = NULL; - op++; - op->op = GRPC_OP_RECV_INITIAL_METADATA; - op->data.recv_initial_metadata = &initial_metadata_recv; - op->flags = 0; - op->reserved = NULL; - op++; - op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; - op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; - op->data.recv_status_on_client.status = &status; - op->data.recv_status_on_client.status_details = &details; - op->data.recv_status_on_client.status_details_capacity = &details_capacity; - op->flags = 0; - op->reserved = NULL; - op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); - GPR_ASSERT(GRPC_CALL_OK == error); - - error = - grpc_server_request_call(f.server, &s, &call_details, - &request_metadata_recv, f.cq, f.cq, tag(101)); - GPR_ASSERT(GRPC_CALL_OK == error); - cq_expect_completion(cqv, tag(101), 1); - cq_verify(cqv); - - op = ops; - op->op = GRPC_OP_SEND_INITIAL_METADATA; - op->data.send_initial_metadata.count = 0; - op->flags = 0; - op->reserved = NULL; - op++; - op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; - op->data.send_status_from_server.trailing_metadata_count = 0; - op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED; - op->data.send_status_from_server.status_details = "xyz"; - op->flags = 0; - op->reserved = NULL; - op++; - op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; - op->data.recv_close_on_server.cancelled = &was_cancelled; - op->flags = 0; - op->reserved = NULL; - op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); - GPR_ASSERT(GRPC_CALL_OK == error); - - cq_expect_completion(cqv, tag(102), 1); - cq_expect_completion(cqv, tag(1), 1); - cq_verify(cqv); - - GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); - GPR_ASSERT(0 == strcmp(details, "xyz")); - GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr:1234")); - GPR_ASSERT(was_cancelled == 1); - - gpr_free(details); - grpc_metadata_array_destroy(&initial_metadata_recv); - grpc_metadata_array_destroy(&trailing_metadata_recv); - grpc_metadata_array_destroy(&request_metadata_recv); - grpc_call_details_destroy(&call_details); - - grpc_call_destroy(c); - grpc_call_destroy(s); - - cq_verifier_destroy(cqv); -} - -static void test_invoke_simple_request(grpc_end2end_test_config config) { - grpc_end2end_test_fixture f = - begin_test(config, "test_invoke_simple_request", NULL, NULL); - void *rc = grpc_channel_register_call(f.client, "/foo", - "foo.test.google.fr:1234", NULL); - - simple_request_body(f, rc); - end_test(&f); - config.tear_down_data(&f); -} - -static void test_invoke_10_simple_requests(grpc_end2end_test_config config) { - int i; - grpc_end2end_test_fixture f = - begin_test(config, "test_invoke_10_simple_requests", NULL, NULL); - void *rc = grpc_channel_register_call(f.client, "/foo", - "foo.test.google.fr:1234", NULL); - - for (i = 0; i < 10; i++) { - simple_request_body(f, rc); - gpr_log(GPR_INFO, "Passed simple request %d", i); - } - end_test(&f); - config.tear_down_data(&f); -} - -void registered_call(grpc_end2end_test_config config) { - test_invoke_simple_request(config); - test_invoke_10_simple_requests(config); -} diff --git a/test/core/end2end/tests/simple_request.c b/test/core/end2end/tests/simple_request.c index 3720cd1631..6d3afad1b1 100644 --- a/test/core/end2end/tests/simple_request.c +++ b/test/core/end2end/tests/simple_request.c @@ -203,6 +203,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr:1234")); + GPR_ASSERT(0 == call_details.flags); GPR_ASSERT(was_cancelled == 1); gpr_free(details); diff --git a/test/core/surface/server_test.c b/test/core/surface/server_test.c index 1d5211d225..beb685b338 100644 --- a/test/core/surface/server_test.c +++ b/test/core/surface/server_test.c @@ -42,11 +42,19 @@ void test_register_method_fail(void) { grpc_server *server = grpc_server_create(NULL, NULL); void *method; void *method_old; - method = grpc_server_register_method(server, NULL, NULL); + method = grpc_server_register_method(server, NULL, NULL, 0); GPR_ASSERT(method == NULL); - method_old = grpc_server_register_method(server, "m", "h"); + method_old = grpc_server_register_method(server, "m", "h", 0); GPR_ASSERT(method_old != NULL); - method = grpc_server_register_method(server, "m", "h"); + method = grpc_server_register_method(server, "m", "h", 0); + GPR_ASSERT(method == NULL); + method_old = grpc_server_register_method( + server, "m2", "h2", GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST); + GPR_ASSERT(method_old != NULL); + method = grpc_server_register_method(server, "m2", "h2", 0); + GPR_ASSERT(method == NULL); + method = grpc_server_register_method( + server, "m2", "h2", GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST); GPR_ASSERT(method == NULL); grpc_server_destroy(server); } diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index a42fdc6722..36e010c3b5 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -6311,7 +6311,6 @@ "test/core/end2end/tests/ping.c", "test/core/end2end/tests/ping_pong_streaming.c", "test/core/end2end/tests/registered_call.c", - "test/core/end2end/tests/registered_idempotent.c", "test/core/end2end/tests/request_with_flags.c", "test/core/end2end/tests/request_with_payload.c", "test/core/end2end/tests/server_finishes_request.c", @@ -6369,7 +6368,6 @@ "test/core/end2end/tests/ping.c", "test/core/end2end/tests/ping_pong_streaming.c", "test/core/end2end/tests/registered_call.c", - "test/core/end2end/tests/registered_idempotent.c", "test/core/end2end/tests/request_with_flags.c", "test/core/end2end/tests/request_with_payload.c", "test/core/end2end/tests/server_finishes_request.c", diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json index 6bbb322655..21967ecd6c 100644 --- a/tools/run_tests/tests.json +++ b/tools/run_tests/tests.json @@ -4783,28 +4783,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_census_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_flags" @@ -5619,28 +5597,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_compress_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_flags" @@ -6427,27 +6383,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_fakesec_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_flags" @@ -7253,28 +7188,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_full_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_flags" @@ -7921,22 +7834,6 @@ "linux" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "linux" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_full+pipe_test", - "platforms": [ - "linux" - ] - }, { "args": [ "request_with_flags" @@ -8529,22 +8426,6 @@ "linux" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "linux" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_full+poll_test", - "platforms": [ - "linux" - ] - }, { "args": [ "request_with_flags" @@ -9137,22 +9018,6 @@ "linux" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "linux" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_full+poll+pipe_test", - "platforms": [ - "linux" - ] - }, { "args": [ "request_with_flags" @@ -9885,27 +9750,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_oauth2_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_flags" @@ -10578,27 +10422,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_proxy_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_payload" @@ -11271,27 +11094,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_sockpair_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_flags" @@ -11966,28 +11768,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_sockpair+trace_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_flags" @@ -12668,27 +12448,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_sockpair_1byte_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_flags" @@ -13473,28 +13232,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_ssl_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_flags" @@ -14143,7 +13880,7 @@ }, { "args": [ - "registered_idempotent" + "request_with_flags" ], "ci_platforms": [ "linux" @@ -14159,7 +13896,7 @@ }, { "args": [ - "request_with_flags" + "request_with_payload" ], "ci_platforms": [ "linux" @@ -14175,23 +13912,7 @@ }, { "args": [ - "request_with_payload" - ], - "ci_platforms": [ - "linux" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_ssl+poll_test", - "platforms": [ - "linux" - ] - }, - { - "args": [ - "server_finishes_request" + "server_finishes_request" ], "ci_platforms": [ "linux" @@ -14784,27 +14505,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_ssl_proxy_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_payload" @@ -15501,28 +15201,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_uchannel_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_flags" @@ -16239,26 +15917,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_uds_test", - "platforms": [ - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_flags" @@ -16871,22 +16529,6 @@ "linux" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "linux" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_uds+poll_test", - "platforms": [ - "linux" - ] - }, { "args": [ "request_with_flags" @@ -17625,28 +17267,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_census_nosec_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_flags" @@ -18439,28 +18059,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_compress_nosec_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_flags" @@ -19253,28 +18851,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_full_nosec_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_flags" @@ -19905,22 +19481,6 @@ "linux" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "linux" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_full+pipe_nosec_test", - "platforms": [ - "linux" - ] - }, { "args": [ "request_with_flags" @@ -20497,22 +20057,6 @@ "linux" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "linux" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_full+poll_nosec_test", - "platforms": [ - "linux" - ] - }, { "args": [ "request_with_flags" @@ -21089,22 +20633,6 @@ "linux" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "linux" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_full+poll+pipe_nosec_test", - "platforms": [ - "linux" - ] - }, { "args": [ "request_with_flags" @@ -21711,27 +21239,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_proxy_nosec_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_payload" @@ -22383,27 +21890,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_sockpair_nosec_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_flags" @@ -23056,28 +22542,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_sockpair+trace_nosec_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_flags" @@ -23737,27 +23201,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_sockpair_1byte_nosec_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_flags" @@ -24432,28 +23875,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_uchannel_nosec_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_flags" @@ -25150,26 +24571,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_uds_nosec_test", - "platforms": [ - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_flags" @@ -25766,22 +25167,6 @@ "linux" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "linux" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_uds+poll_nosec_test", - "platforms": [ - "linux" - ] - }, { "args": [ "request_with_flags" diff --git a/vsprojects/vcxproj/test/end2end/tests/end2end_nosec_tests/end2end_nosec_tests.vcxproj b/vsprojects/vcxproj/test/end2end/tests/end2end_nosec_tests/end2end_nosec_tests.vcxproj index e87abfaf51..23fa3739af 100644 --- a/vsprojects/vcxproj/test/end2end/tests/end2end_nosec_tests/end2end_nosec_tests.vcxproj +++ b/vsprojects/vcxproj/test/end2end/tests/end2end_nosec_tests/end2end_nosec_tests.vcxproj @@ -207,8 +207,6 @@ - - diff --git a/vsprojects/vcxproj/test/end2end/tests/end2end_nosec_tests/end2end_nosec_tests.vcxproj.filters b/vsprojects/vcxproj/test/end2end/tests/end2end_nosec_tests/end2end_nosec_tests.vcxproj.filters index f373c48ddf..924352abfa 100644 --- a/vsprojects/vcxproj/test/end2end/tests/end2end_nosec_tests/end2end_nosec_tests.vcxproj.filters +++ b/vsprojects/vcxproj/test/end2end/tests/end2end_nosec_tests/end2end_nosec_tests.vcxproj.filters @@ -85,9 +85,6 @@ test\core\end2end\tests - - test\core\end2end\tests - test\core\end2end\tests diff --git a/vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj b/vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj index 989da8873e..47b84cc9c2 100644 --- a/vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj +++ b/vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj @@ -209,8 +209,6 @@ - - diff --git a/vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj.filters b/vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj.filters index a7d188962a..b7d3d5492c 100644 --- a/vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj.filters +++ b/vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj.filters @@ -88,9 +88,6 @@ test\core\end2end\tests - - test\core\end2end\tests - test\core\end2end\tests -- cgit v1.2.3 From 4cf0448fbc015962c664bbfe1c03a7fcbddc81e9 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 10 Mar 2016 07:12:42 -0800 Subject: clang-format --- include/grpc/grpc.h | 24 +++--- src/core/channel/http_client_filter.c | 15 +--- src/core/channel/http_server_filter.c | 15 +--- src/core/surface/server.c | 20 ++--- src/core/transport/static_metadata.c | 108 +++++---------------------- test/core/bad_client/bad_client.c | 6 +- test/core/end2end/tests/idempotent_request.c | 6 +- 7 files changed, 51 insertions(+), 143 deletions(-) (limited to 'test/core/end2end/tests') diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index dbd2cc0000..5335dd0cc6 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -154,8 +154,9 @@ GRPCAPI void grpc_alarm_cancel(grpc_alarm *alarm); GRPCAPI void grpc_alarm_destroy(grpc_alarm *alarm); /** Check the connectivity state of a channel. */ -GRPCAPI grpc_connectivity_state grpc_channel_check_connectivity_state( - grpc_channel *channel, int try_to_connect); +GRPCAPI grpc_connectivity_state +grpc_channel_check_connectivity_state(grpc_channel *channel, + int try_to_connect); /** Watch for a change in connectivity state. Once the channel connectivity state is different from last_observed_state, @@ -266,10 +267,9 @@ GRPCAPI grpc_call_error grpc_call_cancel(grpc_call *call, void *reserved); and description passed in. Importantly, this function does not send status nor description to the remote endpoint. */ -GRPCAPI grpc_call_error grpc_call_cancel_with_status(grpc_call *call, - grpc_status_code status, - const char *description, - void *reserved); +GRPCAPI grpc_call_error +grpc_call_cancel_with_status(grpc_call *call, grpc_status_code status, + const char *description, void *reserved); /** Destroy a call. THREAD SAFETY: grpc_call_destroy is thread-compatible */ @@ -283,11 +283,13 @@ GRPCAPI void grpc_call_destroy(grpc_call *call); to \a cq_bound_to_call. Note that \a cq_for_notification must have been registered to the server via \a grpc_server_register_completion_queue. */ -GRPCAPI grpc_call_error grpc_server_request_call( - grpc_server *server, grpc_call **call, grpc_call_details *details, - grpc_metadata_array *request_metadata, - grpc_completion_queue *cq_bound_to_call, - grpc_completion_queue *cq_for_notification, void *tag_new); +GRPCAPI grpc_call_error +grpc_server_request_call(grpc_server *server, grpc_call **call, + grpc_call_details *details, + grpc_metadata_array *request_metadata, + grpc_completion_queue *cq_bound_to_call, + grpc_completion_queue *cq_for_notification, + void *tag_new); /** Registers a method in the server. Methods to this (host, method) pair will not be reported by diff --git a/src/core/channel/http_client_filter.c b/src/core/channel/http_client_filter.c index 0f44f4e844..32c808cf6a 100644 --- a/src/core/channel/http_client_filter.c +++ b/src/core/channel/http_client_filter.c @@ -244,14 +244,7 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx, } const grpc_channel_filter grpc_http_client_filter = { - hc_start_transport_op, - grpc_channel_next_op, - sizeof(call_data), - init_call_elem, - grpc_call_stack_ignore_set_pollset, - destroy_call_elem, - sizeof(channel_data), - init_channel_elem, - destroy_channel_elem, - grpc_call_next_get_peer, - "http-client"}; + hc_start_transport_op, grpc_channel_next_op, sizeof(call_data), + init_call_elem, grpc_call_stack_ignore_set_pollset, destroy_call_elem, + sizeof(channel_data), init_channel_elem, destroy_channel_elem, + grpc_call_next_get_peer, "http-client"}; diff --git a/src/core/channel/http_server_filter.c b/src/core/channel/http_server_filter.c index f4d69212b1..42ce8bc887 100644 --- a/src/core/channel/http_server_filter.c +++ b/src/core/channel/http_server_filter.c @@ -235,14 +235,7 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem) {} const grpc_channel_filter grpc_http_server_filter = { - hs_start_transport_op, - grpc_channel_next_op, - sizeof(call_data), - init_call_elem, - grpc_call_stack_ignore_set_pollset, - destroy_call_elem, - sizeof(channel_data), - init_channel_elem, - destroy_channel_elem, - grpc_call_next_get_peer, - "http-server"}; + hs_start_transport_op, grpc_channel_next_op, sizeof(call_data), + init_call_elem, grpc_call_stack_ignore_set_pollset, destroy_call_elem, + sizeof(channel_data), init_channel_elem, destroy_channel_elem, + grpc_call_next_get_peer, "http-server"}; diff --git a/src/core/surface/server.c b/src/core/surface/server.c index 4b46f2b3c2..068ea9d9a3 100644 --- a/src/core/surface/server.c +++ b/src/core/surface/server.c @@ -769,17 +769,10 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx, } static const grpc_channel_filter server_surface_filter = { - server_start_transport_stream_op, - grpc_channel_next_op, - sizeof(call_data), - init_call_elem, - grpc_call_stack_ignore_set_pollset, - destroy_call_elem, - sizeof(channel_data), - init_channel_elem, - destroy_channel_elem, - grpc_call_next_get_peer, - "server", + server_start_transport_stream_op, grpc_channel_next_op, sizeof(call_data), + init_call_elem, grpc_call_stack_ignore_set_pollset, destroy_call_elem, + sizeof(channel_data), init_channel_elem, destroy_channel_elem, + grpc_call_next_get_peer, "server", }; void grpc_server_register_completion_queue(grpc_server *server, @@ -956,8 +949,7 @@ void grpc_server_setup_transport(grpc_exec_ctx *exec_ctx, grpc_server *s, channel = grpc_channel_create_from_filters(exec_ctx, NULL, filters, num_filters, args, 0); chand = (channel_data *)grpc_channel_stack_element( - grpc_channel_get_channel_stack(channel), 0) - ->channel_data; + grpc_channel_get_channel_stack(channel), 0)->channel_data; chand->server = s; server_ref(s); chand->channel = channel; @@ -978,7 +970,7 @@ void grpc_server_setup_transport(grpc_exec_ctx *exec_ctx, grpc_server *s, method = grpc_mdstr_from_string(rm->method); hash = GRPC_MDSTR_KV_HASH(host ? host->hash : 0, method->hash); for (probes = 0; chand->registered_methods[(hash + probes) % slots] - .server_registered_method != NULL; + .server_registered_method != NULL; probes++) ; if (probes > max_probes) max_probes = probes; diff --git a/src/core/transport/static_metadata.c b/src/core/transport/static_metadata.c index fc01b89b1d..5459b74e7e 100644 --- a/src/core/transport/static_metadata.c +++ b/src/core/transport/static_metadata.c @@ -64,96 +64,24 @@ const uint8_t grpc_static_metadata_elem_indices[GRPC_STATIC_MDELEM_COUNT * 2] = 82, 35, 83, 84, 85, 35, 86, 35, 87, 35, 88, 35, 89, 35}; const char *const grpc_static_metadata_strings[GRPC_STATIC_MDSTR_COUNT] = { - "0", - "1", - "2", - "200", - "204", - "206", - "304", - "400", - "404", - "500", - "accept", - "accept-charset", - "accept-encoding", - "accept-language", - "accept-ranges", - "access-control-allow-origin", - "age", - "allow", - "application/grpc", - ":authority", - "authorization", - "cache-control", - "census-bin", - "census-binary-bin", - "content-disposition", - "content-encoding", - "content-language", - "content-length", - "content-location", - "content-range", - "content-type", - "cookie", - "date", - "deflate", - "deflate,gzip", - "", - "etag", - "expect", - "expires", - "from", - "GET", - "grpc", - "grpc-accept-encoding", - "grpc-encoding", - "grpc-internal-encoding-request", - "grpc-message", - "grpc-status", - "grpc-timeout", - "gzip", - "gzip, deflate", - "host", - "http", - "https", - "identity", - "identity,deflate", - "identity,deflate,gzip", - "identity,gzip", - "if-match", - "if-modified-since", - "if-none-match", - "if-range", - "if-unmodified-since", - "last-modified", - "link", - "location", - "max-forwards", - ":method", - ":path", - "POST", - "proxy-authenticate", - "proxy-authorization", - "PUT", - "range", - "referer", - "refresh", - "retry-after", - ":scheme", - "server", - "set-cookie", - "/", - "/index.html", - ":status", - "strict-transport-security", - "te", - "trailers", - "transfer-encoding", - "user-agent", - "vary", - "via", - "www-authenticate"}; + "0", "1", "2", "200", "204", "206", "304", "400", "404", "500", "accept", + "accept-charset", "accept-encoding", "accept-language", "accept-ranges", + "access-control-allow-origin", "age", "allow", "application/grpc", + ":authority", "authorization", "cache-control", "census-bin", + "census-binary-bin", "content-disposition", "content-encoding", + "content-language", "content-length", "content-location", "content-range", + "content-type", "cookie", "date", "deflate", "deflate,gzip", "", "etag", + "expect", "expires", "from", "GET", "grpc", "grpc-accept-encoding", + "grpc-encoding", "grpc-internal-encoding-request", "grpc-message", + "grpc-status", "grpc-timeout", "gzip", "gzip, deflate", "host", "http", + "https", "identity", "identity,deflate", "identity,deflate,gzip", + "identity,gzip", "if-match", "if-modified-since", "if-none-match", + "if-range", "if-unmodified-since", "last-modified", "link", "location", + "max-forwards", ":method", ":path", "POST", "proxy-authenticate", + "proxy-authorization", "PUT", "range", "referer", "refresh", "retry-after", + ":scheme", "server", "set-cookie", "/", "/index.html", ":status", + "strict-transport-security", "te", "trailers", "transfer-encoding", + "user-agent", "vary", "via", "www-authenticate"}; const uint8_t grpc_static_accept_encoding_metadata[8] = {0, 29, 26, 30, 28, 32, 27, 31}; diff --git a/test/core/bad_client/bad_client.c b/test/core/bad_client/bad_client.c index 1d066e2e80..40c9877ab0 100644 --- a/test/core/bad_client/bad_client.c +++ b/test/core/bad_client/bad_client.c @@ -158,9 +158,9 @@ void grpc_run_bad_client_test(grpc_bad_client_server_side_validator validator, grpc_exec_ctx_finish(&exec_ctx); } grpc_server_shutdown_and_notify(a.server, a.cq, NULL); - GPR_ASSERT(grpc_completion_queue_pluck( - a.cq, NULL, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1), NULL) - .type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck(a.cq, NULL, + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(a.server); grpc_completion_queue_destroy(a.cq); gpr_slice_buffer_destroy(&outgoing); diff --git a/test/core/end2end/tests/idempotent_request.c b/test/core/end2end/tests/idempotent_request.c index 4a9bd7bb1e..18a0016995 100644 --- a/test/core/end2end/tests/idempotent_request.c +++ b/test/core/end2end/tests/idempotent_request.c @@ -77,9 +77,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) - .type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } -- cgit v1.2.3 From b093686e59ccb2a74329ce73e23d4993162dad89 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 10 Mar 2016 07:17:25 -0800 Subject: Fix copyright --- src/core/transport/static_metadata.c | 6 +++--- src/core/transport/static_metadata.h | 6 +++--- test/core/end2end/fixtures/proxy.c | 2 +- test/core/end2end/tests/idempotent_request.c | 2 +- test/core/end2end/tests/simple_request.c | 2 +- test/core/surface/server_test.c | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) (limited to 'test/core/end2end/tests') diff --git a/src/core/transport/static_metadata.c b/src/core/transport/static_metadata.c index 5459b74e7e..140ec5edc7 100644 --- a/src/core/transport/static_metadata.c +++ b/src/core/transport/static_metadata.c @@ -6,13 +6,13 @@ * modification, are permitted provided that the following conditions are * met: * - * * Redistributions of source code must retain the above copyright + * * 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 + * * 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 + * * 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. * diff --git a/src/core/transport/static_metadata.h b/src/core/transport/static_metadata.h index b0e5b2fcdf..3382b1b291 100644 --- a/src/core/transport/static_metadata.h +++ b/src/core/transport/static_metadata.h @@ -6,13 +6,13 @@ * modification, are permitted provided that the following conditions are * met: * - * * Redistributions of source code must retain the above copyright + * * 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 + * * 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 + * * 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. * diff --git a/test/core/end2end/fixtures/proxy.c b/test/core/end2end/fixtures/proxy.c index a6487a17ac..1ca53cdad9 100644 --- a/test/core/end2end/fixtures/proxy.c +++ b/test/core/end2end/fixtures/proxy.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/test/core/end2end/tests/idempotent_request.c b/test/core/end2end/tests/idempotent_request.c index 18a0016995..f445a9ab37 100644 --- a/test/core/end2end/tests/idempotent_request.c +++ b/test/core/end2end/tests/idempotent_request.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/test/core/end2end/tests/simple_request.c b/test/core/end2end/tests/simple_request.c index 6d3afad1b1..2353698b0b 100644 --- a/test/core/end2end/tests/simple_request.c +++ b/test/core/end2end/tests/simple_request.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/test/core/surface/server_test.c b/test/core/surface/server_test.c index beb685b338..4c62d8caad 100644 --- a/test/core/surface/server_test.c +++ b/test/core/surface/server_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without -- cgit v1.2.3