From 6d686451627122eeb5a07da2ede2cebc1c289acd Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 19 Sep 2016 16:48:36 -0700 Subject: Update unit tests and fixtures with AUTHORITY_HEADER support option --- test/core/end2end/end2end_tests.h | 4 ++++ test/core/end2end/fixtures/h2_census.c | 3 ++- test/core/end2end/fixtures/h2_compress.c | 3 ++- test/core/end2end/fixtures/h2_fakesec.c | 3 ++- test/core/end2end/fixtures/h2_fd.c | 6 +++--- test/core/end2end/fixtures/h2_full+pipe.c | 3 ++- test/core/end2end/fixtures/h2_full+trace.c | 3 ++- test/core/end2end/fixtures/h2_full.c | 3 ++- test/core/end2end/fixtures/h2_load_reporting.c | 2 +- test/core/end2end/fixtures/h2_oauth2.c | 3 ++- test/core/end2end/fixtures/h2_proxy.c | 6 ++++-- test/core/end2end/fixtures/h2_sockpair+trace.c | 2 +- test/core/end2end/fixtures/h2_sockpair.c | 3 ++- test/core/end2end/fixtures/h2_sockpair_1byte.c | 3 ++- test/core/end2end/fixtures/h2_ssl.c | 3 ++- test/core/end2end/fixtures/h2_ssl_proxy.c | 3 ++- test/core/end2end/fixtures/h2_uds.c | 4 +++- test/core/end2end/tests/call_creds.c | 11 ++++++++--- test/core/end2end/tests/cancel_after_accept.c | 5 ++++- test/core/end2end/tests/cancel_after_client_done.c | 5 ++++- test/core/end2end/tests/cancel_after_invoke.c | 5 ++++- test/core/end2end/tests/cancel_before_invoke.c | 5 ++++- test/core/end2end/tests/cancel_in_a_vacuum.c | 5 ++++- test/core/end2end/tests/cancel_with_status.c | 5 ++++- test/core/end2end/tests/compressed_payload.c | 15 +++++++++++---- test/core/end2end/tests/disappearing_server.c | 9 +++++++-- test/core/end2end/tests/empty_batch.c | 5 ++++- test/core/end2end/tests/filter_call_init_fails.c | 5 ++++- test/core/end2end/tests/filter_causes_close.c | 5 ++++- test/core/end2end/tests/graceful_server_shutdown.c | 9 +++++++-- test/core/end2end/tests/high_initial_seqno.c | 9 +++++++-- test/core/end2end/tests/hpack_size.c | 9 +++++++-- test/core/end2end/tests/idempotent_request.c | 9 +++++++-- test/core/end2end/tests/invoke_large_request.c | 9 +++++++-- test/core/end2end/tests/large_metadata.c | 9 +++++++-- test/core/end2end/tests/load_reporting_hook.c | 5 ++++- test/core/end2end/tests/max_concurrent_streams.c | 13 +++++++++---- test/core/end2end/tests/max_message_length.c | 9 +++++++-- test/core/end2end/tests/negative_deadline.c | 5 ++++- test/core/end2end/tests/network_status_change.c | 9 +++++++-- test/core/end2end/tests/no_logging.c | 9 +++++++-- test/core/end2end/tests/payload.c | 9 +++++++-- test/core/end2end/tests/ping_pong_streaming.c | 5 ++++- test/core/end2end/tests/registered_call.c | 11 ++++++++--- test/core/end2end/tests/request_with_flags.c | 5 ++++- test/core/end2end/tests/request_with_payload.c | 9 +++++++-- test/core/end2end/tests/server_finishes_request.c | 9 +++++++-- test/core/end2end/tests/shutdown_finishes_calls.c | 9 +++++++-- test/core/end2end/tests/simple_cacheable_request.c | 9 +++++++-- test/core/end2end/tests/simple_delayed_request.c | 9 +++++++-- test/core/end2end/tests/simple_metadata.c | 9 +++++++-- test/core/end2end/tests/simple_request.c | 10 +++++++--- test/core/end2end/tests/streaming_error_response.c | 9 +++++++-- test/core/end2end/tests/trailing_metadata.c | 9 +++++++-- 54 files changed, 266 insertions(+), 87 deletions(-) (limited to 'test') diff --git a/test/core/end2end/end2end_tests.h b/test/core/end2end/end2end_tests.h index 34af0936cd..6380b96f33 100644 --- a/test/core/end2end/end2end_tests.h +++ b/test/core/end2end/end2end_tests.h @@ -43,9 +43,13 @@ typedef struct grpc_end2end_test_config grpc_end2end_test_config; #define FEATURE_MASK_SUPPORTS_HOSTNAME_VERIFICATION 2 #define FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS 4 #define FEATURE_MASK_SUPPORTS_REQUEST_PROXYING 8 +#define FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER 16 #define FAIL_AUTH_CHECK_SERVER_ARG_NAME "fail_auth_check" +#define validate_host_override_string(str, config) \ + ((config).feature_mask & FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER ? (str) : NULL) + struct grpc_end2end_test_fixture { grpc_completion_queue *cq; grpc_server *server; diff --git a/test/core/end2end/fixtures/h2_census.c b/test/core/end2end/fixtures/h2_census.c index e46b39e476..e81cf82af1 100644 --- a/test/core/end2end/fixtures/h2_census.c +++ b/test/core/end2end/fixtures/h2_census.c @@ -111,7 +111,8 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack+census", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION, + {"chttp2/fullstack+census", + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_compress.c b/test/core/end2end/fixtures/h2_compress.c index 8f9b7c9cd9..41a48b920f 100644 --- a/test/core/end2end/fixtures/h2_compress.c +++ b/test/core/end2end/fixtures/h2_compress.c @@ -113,7 +113,8 @@ void chttp2_tear_down_fullstack_compression(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack_compression", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION, + {"chttp2/fullstack_compression", + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack_compression, chttp2_init_client_fullstack_compression, chttp2_init_server_fullstack_compression, diff --git a/test/core/end2end/fixtures/h2_fakesec.c b/test/core/end2end/fixtures/h2_fakesec.c index 44408b28af..30da801dee 100644 --- a/test/core/end2end/fixtures/h2_fakesec.c +++ b/test/core/end2end/fixtures/h2_fakesec.c @@ -140,7 +140,8 @@ static void chttp2_init_server_fake_secure_fullstack( static grpc_end2end_test_config configs[] = { {"chttp2/fake_secure_fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS, + FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_secure_fullstack, chttp2_init_client_fake_secure_fullstack, chttp2_init_server_fake_secure_fullstack, diff --git a/test/core/end2end/fixtures/h2_fd.c b/test/core/end2end/fixtures/h2_fd.c index 89fa02517d..ed71d72ef4 100644 --- a/test/core/end2end/fixtures/h2_fd.c +++ b/test/core/end2end/fixtures/h2_fd.c @@ -106,9 +106,9 @@ static void chttp2_tear_down_socketpair(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fd", 0, chttp2_create_fixture_socketpair, - chttp2_init_client_socketpair, chttp2_init_server_socketpair, - chttp2_tear_down_socketpair}, + {"chttp2/fd", FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + chttp2_create_fixture_socketpair, chttp2_init_client_socketpair, + chttp2_init_server_socketpair, chttp2_tear_down_socketpair}, }; int main(int argc, char **argv) { diff --git a/test/core/end2end/fixtures/h2_full+pipe.c b/test/core/end2end/fixtures/h2_full+pipe.c index e7dfc561a1..d67bf9f1bb 100644 --- a/test/core/end2end/fixtures/h2_full+pipe.c +++ b/test/core/end2end/fixtures/h2_full+pipe.c @@ -97,7 +97,8 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION, + {"chttp2/fullstack", + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_full+trace.c b/test/core/end2end/fixtures/h2_full+trace.c index c4dc5b9bc1..6f2b4e37db 100644 --- a/test/core/end2end/fixtures/h2_full+trace.c +++ b/test/core/end2end/fixtures/h2_full+trace.c @@ -97,7 +97,8 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION, + {"chttp2/fullstack", + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_full.c b/test/core/end2end/fixtures/h2_full.c index 4a2f17eb91..d85669e021 100644 --- a/test/core/end2end/fixtures/h2_full.c +++ b/test/core/end2end/fixtures/h2_full.c @@ -96,7 +96,8 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION, + {"chttp2/fullstack", + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_load_reporting.c b/test/core/end2end/fixtures/h2_load_reporting.c index f6d3923db9..6965418eef 100644 --- a/test/core/end2end/fixtures/h2_load_reporting.c +++ b/test/core/end2end/fixtures/h2_load_reporting.c @@ -103,7 +103,7 @@ void chttp2_tear_down_load_reporting(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { {"chttp2/fullstack+load_reporting", - FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION, + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_load_reporting, chttp2_init_client_load_reporting, chttp2_init_server_load_reporting, chttp2_tear_down_load_reporting}, }; diff --git a/test/core/end2end/fixtures/h2_oauth2.c b/test/core/end2end/fixtures/h2_oauth2.c index fc56998cdb..784836c2e0 100644 --- a/test/core/end2end/fixtures/h2_oauth2.c +++ b/test/core/end2end/fixtures/h2_oauth2.c @@ -216,7 +216,8 @@ static void chttp2_init_server_simple_ssl_secure_fullstack( static grpc_end2end_test_config configs[] = { {"chttp2/simple_ssl_with_oauth2_fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS, + FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_secure_fullstack, chttp2_init_client_simple_ssl_with_oauth2_secure_fullstack, chttp2_init_server_simple_ssl_secure_fullstack, diff --git a/test/core/end2end/fixtures/h2_proxy.c b/test/core/end2end/fixtures/h2_proxy.c index c7b99863f0..695d51a9c7 100644 --- a/test/core/end2end/fixtures/h2_proxy.c +++ b/test/core/end2end/fixtures/h2_proxy.c @@ -113,8 +113,10 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack+proxy", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_REQUEST_PROXYING, + {"chttp2/fullstack+proxy", + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_REQUEST_PROXYING | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_sockpair+trace.c b/test/core/end2end/fixtures/h2_sockpair+trace.c index b8a5257ab2..674aee5b78 100644 --- a/test/core/end2end/fixtures/h2_sockpair+trace.c +++ b/test/core/end2end/fixtures/h2_sockpair+trace.c @@ -134,7 +134,7 @@ static void chttp2_tear_down_socketpair(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/socketpair", 0, chttp2_create_fixture_socketpair, + {"chttp2/socketpair", FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_socketpair, chttp2_init_client_socketpair, chttp2_init_server_socketpair, chttp2_tear_down_socketpair}, }; diff --git a/test/core/end2end/fixtures/h2_sockpair.c b/test/core/end2end/fixtures/h2_sockpair.c index a57990d6e7..4164bc9cf3 100644 --- a/test/core/end2end/fixtures/h2_sockpair.c +++ b/test/core/end2end/fixtures/h2_sockpair.c @@ -133,7 +133,8 @@ static void chttp2_tear_down_socketpair(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/socketpair", 0, chttp2_create_fixture_socketpair, + {"chttp2/socketpair", FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + chttp2_create_fixture_socketpair, chttp2_init_client_socketpair, chttp2_init_server_socketpair, chttp2_tear_down_socketpair}, }; diff --git a/test/core/end2end/fixtures/h2_sockpair_1byte.c b/test/core/end2end/fixtures/h2_sockpair_1byte.c index 50aac8045a..e8a33bb2d4 100644 --- a/test/core/end2end/fixtures/h2_sockpair_1byte.c +++ b/test/core/end2end/fixtures/h2_sockpair_1byte.c @@ -133,7 +133,8 @@ static void chttp2_tear_down_socketpair(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/socketpair_one_byte_at_a_time", 0, + {"chttp2/socketpair_one_byte_at_a_time", + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_socketpair, chttp2_init_client_socketpair, chttp2_init_server_socketpair, chttp2_tear_down_socketpair}, }; diff --git a/test/core/end2end/fixtures/h2_ssl.c b/test/core/end2end/fixtures/h2_ssl.c index eb28623264..e2b9bb874b 100644 --- a/test/core/end2end/fixtures/h2_ssl.c +++ b/test/core/end2end/fixtures/h2_ssl.c @@ -151,7 +151,8 @@ static void chttp2_init_server_simple_ssl_secure_fullstack( static grpc_end2end_test_config configs[] = { {"chttp2/simple_ssl_fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS, + FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_secure_fullstack, chttp2_init_client_simple_ssl_secure_fullstack, chttp2_init_server_simple_ssl_secure_fullstack, diff --git a/test/core/end2end/fixtures/h2_ssl_proxy.c b/test/core/end2end/fixtures/h2_ssl_proxy.c index eeb54b8b88..5f131273f7 100644 --- a/test/core/end2end/fixtures/h2_ssl_proxy.c +++ b/test/core/end2end/fixtures/h2_ssl_proxy.c @@ -185,7 +185,8 @@ static grpc_end2end_test_config configs[] = { {"chttp2/simple_ssl_fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | FEATURE_MASK_SUPPORTS_REQUEST_PROXYING | - FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS, + FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_secure_fullstack, chttp2_init_client_simple_ssl_secure_fullstack, chttp2_init_server_simple_ssl_secure_fullstack, diff --git a/test/core/end2end/fixtures/h2_uds.c b/test/core/end2end/fixtures/h2_uds.c index cffbeaf045..d8892c0c88 100644 --- a/test/core/end2end/fixtures/h2_uds.c +++ b/test/core/end2end/fixtures/h2_uds.c @@ -101,7 +101,9 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack_uds", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION, + {"chttp2/fullstack_uds", + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/tests/call_creds.c b/test/core/end2end/tests/call_creds.c index 981c0fcc8c..ab8efa488b 100644 --- a/test/core/end2end/tests/call_creds.c +++ b/test/core/end2end/tests/call_creds.c @@ -51,6 +51,8 @@ static const char iam_selector[] = "selector"; static const char overridden_iam_token[] = "overridden_token"; static const char overridden_iam_selector[] = "overridden_selector"; +static char *authority; + typedef enum { NONE, OVERRIDE, DESTROY } override_mode; static void *tag(intptr_t t) { return (void *)t; } @@ -165,7 +167,7 @@ static void request_response_with_payload_and_call_creds( cqv = cq_verifier_create(f.cq); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); creds = grpc_google_iam_credentials_create(iam_token, iam_selector, NULL); GPR_ASSERT(creds != NULL); @@ -294,7 +296,9 @@ static void request_response_with_payload_and_call_creds( GPR_ASSERT(status == GRPC_STATUS_OK); 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); GPR_ASSERT(byte_buffer_eq_string(response_payload_recv, "hello you")); @@ -398,7 +402,7 @@ static void test_request_with_server_rejecting_client_creds( cqv = cq_verifier_create(f.cq); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); creds = grpc_google_iam_credentials_create(iam_token, iam_selector, NULL); @@ -471,6 +475,7 @@ static void test_request_with_server_rejecting_client_creds( void call_creds(grpc_end2end_test_config config) { if (config.feature_mask & FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS) { + authority = validate_host_override_string("foo.test.google.fr", config); test_request_response_with_payload_and_call_creds(config); test_request_response_with_payload_and_overridden_call_creds(config); test_request_response_with_payload_and_deleted_call_creds(config); diff --git a/test/core/end2end/tests/cancel_after_accept.c b/test/core/end2end/tests/cancel_after_accept.c index b4ac3b3249..dd1d5bcf46 100644 --- a/test/core/end2end/tests/cancel_after_accept.c +++ b/test/core/end2end/tests/cancel_after_accept.c @@ -44,6 +44,8 @@ #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/tests/cancel_test_helpers.h" +static void *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -126,7 +128,7 @@ static void test_cancel_after_accept(grpc_end2end_test_config config, int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -229,6 +231,7 @@ static void test_cancel_after_accept(grpc_end2end_test_config config, void cancel_after_accept(grpc_end2end_test_config config) { unsigned i; + authority = validate_host_override_string("foo.test.google.fr", config); for (i = 0; i < GPR_ARRAY_SIZE(cancellation_modes); i++) { test_cancel_after_accept(config, cancellation_modes[i]); } diff --git a/test/core/end2end/tests/cancel_after_client_done.c b/test/core/end2end/tests/cancel_after_client_done.c index 5adc71e255..90a84d1d0f 100644 --- a/test/core/end2end/tests/cancel_after_client_done.c +++ b/test/core/end2end/tests/cancel_after_client_done.c @@ -44,6 +44,8 @@ #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/tests/cancel_test_helpers.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -126,7 +128,7 @@ static void test_cancel_after_accept_and_writes_closed( int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -233,6 +235,7 @@ static void test_cancel_after_accept_and_writes_closed( void cancel_after_client_done(grpc_end2end_test_config config) { unsigned i; + authority = validate_host_override_string("foo.test.google.fr", config); for (i = 0; i < GPR_ARRAY_SIZE(cancellation_modes); i++) { test_cancel_after_accept_and_writes_closed(config, cancellation_modes[i]); } diff --git a/test/core/end2end/tests/cancel_after_invoke.c b/test/core/end2end/tests/cancel_after_invoke.c index 85d8799f36..346e41edae 100644 --- a/test/core/end2end/tests/cancel_after_invoke.c +++ b/test/core/end2end/tests/cancel_after_invoke.c @@ -44,6 +44,8 @@ #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/tests/cancel_test_helpers.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -121,7 +123,7 @@ static void test_cancel_after_invoke(grpc_end2end_test_config config, grpc_raw_byte_buffer_create(&request_payload_slice, 1); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -192,6 +194,7 @@ static void test_cancel_after_invoke(grpc_end2end_test_config config, void cancel_after_invoke(grpc_end2end_test_config config) { unsigned i, j; + authority = validate_host_override_string("foo.test.google.fr", config); for (j = 2; j < 6; j++) { for (i = 0; i < GPR_ARRAY_SIZE(cancellation_modes); i++) { test_cancel_after_invoke(config, cancellation_modes[i], j); diff --git a/test/core/end2end/tests/cancel_before_invoke.c b/test/core/end2end/tests/cancel_before_invoke.c index c57091476e..b446264f9d 100644 --- a/test/core/end2end/tests/cancel_before_invoke.c +++ b/test/core/end2end/tests/cancel_before_invoke.c @@ -43,6 +43,8 @@ #include #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -119,7 +121,7 @@ static void test_cancel_before_invoke(grpc_end2end_test_config config, grpc_raw_byte_buffer_create(&request_payload_slice, 1); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); GPR_ASSERT(GRPC_CALL_OK == grpc_call_cancel(c, NULL)); @@ -189,6 +191,7 @@ static void test_cancel_before_invoke(grpc_end2end_test_config config, void cancel_before_invoke(grpc_end2end_test_config config) { size_t i; + authority = validate_host_override_string("foo.test.google.fr", config); for (i = 1; i <= 6; i++) { test_cancel_before_invoke(config, i); } diff --git a/test/core/end2end/tests/cancel_in_a_vacuum.c b/test/core/end2end/tests/cancel_in_a_vacuum.c index 3b03616b3b..02e5fa555d 100644 --- a/test/core/end2end/tests/cancel_in_a_vacuum.c +++ b/test/core/end2end/tests/cancel_in_a_vacuum.c @@ -44,6 +44,8 @@ #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/tests/cancel_test_helpers.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -106,7 +108,7 @@ static void test_cancel_in_a_vacuum(grpc_end2end_test_config config, cq_verifier *v_client = cq_verifier_create(f.cq); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c, NULL)); @@ -121,6 +123,7 @@ static void test_cancel_in_a_vacuum(grpc_end2end_test_config config, void cancel_in_a_vacuum(grpc_end2end_test_config config) { unsigned i; + authority = validate_host_override_string("foo.test.google.fr", config); for (i = 0; i < GPR_ARRAY_SIZE(cancellation_modes); i++) { test_cancel_in_a_vacuum(config, cancellation_modes[i]); } diff --git a/test/core/end2end/tests/cancel_with_status.c b/test/core/end2end/tests/cancel_with_status.c index e65390ac4a..b2da1099eb 100644 --- a/test/core/end2end/tests/cancel_with_status.c +++ b/test/core/end2end/tests/cancel_with_status.c @@ -45,6 +45,8 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -113,7 +115,7 @@ static void simple_request_body(grpc_end2end_test_fixture f, size_t num_ops) { gpr_log(GPR_DEBUG, "test with %" PRIuPTR " ops", num_ops); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr:1234", deadline, + "/foo", authority, deadline, NULL); GPR_ASSERT(c); @@ -177,6 +179,7 @@ static void test_invoke_simple_request(grpc_end2end_test_config config, void cancel_with_status(grpc_end2end_test_config config) { size_t i; + authority = validate_host_override_string("foo.test.google.fr:1234", config); for (i = 1; i <= 4; i++) { test_invoke_simple_request(config, i); } diff --git a/test/core/end2end/tests/compressed_payload.c b/test/core/end2end/tests/compressed_payload.c index 1724da4d0c..7a9d9a706b 100644 --- a/test/core/end2end/tests/compressed_payload.c +++ b/test/core/end2end/tests/compressed_payload.c @@ -50,6 +50,8 @@ #include "src/core/lib/surface/call_test_only.h" #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -147,7 +149,7 @@ static void request_for_disabled_algorithm( cqv = cq_verifier_create(f.cq); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -242,7 +244,9 @@ static void request_for_disabled_algorithm( GPR_ASSERT(0 == strcmp(details, expected_details)); gpr_free(expected_details); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } gpr_free(details); grpc_metadata_array_destroy(&initial_metadata_recv); @@ -319,7 +323,7 @@ static void request_with_payload_template( cqv = cq_verifier_create(f.cq); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -491,7 +495,9 @@ static void request_with_payload_template( GPR_ASSERT(status == GRPC_STATUS_OK); 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(was_cancelled == 0); gpr_free(details); @@ -594,6 +600,7 @@ static void test_invoke_request_with_disabled_algorithm( } void compressed_payload(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr", config); test_invoke_request_with_exceptionally_uncompressed_payload(config); test_invoke_request_with_uncompressed_payload(config); test_invoke_request_with_compressed_payload(config); diff --git a/test/core/end2end/tests/disappearing_server.c b/test/core/end2end/tests/disappearing_server.c index a0059b9ad5..e761aa7d19 100644 --- a/test/core/end2end/tests/disappearing_server.c +++ b/test/core/end2end/tests/disappearing_server.c @@ -43,6 +43,8 @@ #include #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static gpr_timespec n_seconds_time(int n) { @@ -97,7 +99,7 @@ static void do_request_and_shutdown_server(grpc_end2end_test_fixture *f, int was_cancelled = 2; c = grpc_channel_create_call(f->client, NULL, GRPC_PROPAGATE_DEFAULTS, f->cq, - "/foo", "foo.test.google.fr:1234", deadline, + "/foo", authority, deadline, NULL); GPR_ASSERT(c); @@ -174,7 +176,9 @@ static void do_request_and_shutdown_server(grpc_end2end_test_fixture *f, 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(was_cancelled == 1); gpr_free(details); @@ -210,6 +214,7 @@ static void disappearing_server_test(grpc_end2end_test_config config) { } void disappearing_server(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr:1234", config); GPR_ASSERT(config.feature_mask & FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION); disappearing_server_test(config); } diff --git a/test/core/end2end/tests/empty_batch.c b/test/core/end2end/tests/empty_batch.c index ac53e1839b..230ee204f8 100644 --- a/test/core/end2end/tests/empty_batch.c +++ b/test/core/end2end/tests/empty_batch.c @@ -45,6 +45,8 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -105,7 +107,7 @@ static void empty_batch_body(grpc_end2end_test_fixture f) { grpc_op *op = NULL; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); error = grpc_call_start_batch(c, op, 0, tag(1), NULL); @@ -128,6 +130,7 @@ static void test_invoke_empty_body(grpc_end2end_test_config config) { } void empty_batch(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr", config); test_invoke_empty_body(config); } diff --git a/test/core/end2end/tests/filter_call_init_fails.c b/test/core/end2end/tests/filter_call_init_fails.c index a70f50af98..6569110c67 100644 --- a/test/core/end2end/tests/filter_call_init_fails.c +++ b/test/core/end2end/tests/filter_call_init_fails.c @@ -49,6 +49,8 @@ enum { TIMEOUT = 200000 }; +static char *authority; + static bool g_enable_filter = false; static void *tag(intptr_t t) { return (void *)t; } @@ -128,7 +130,7 @@ static void test_request(grpc_end2end_test_config config) { size_t details_capacity = 0; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -263,6 +265,7 @@ static void init_plugin(void) { static void destroy_plugin(void) {} void filter_call_init_fails(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr", config); g_enable_filter = true; test_request(config); g_enable_filter = false; diff --git a/test/core/end2end/tests/filter_causes_close.c b/test/core/end2end/tests/filter_causes_close.c index cdf868377a..c8a94c440c 100644 --- a/test/core/end2end/tests/filter_causes_close.c +++ b/test/core/end2end/tests/filter_causes_close.c @@ -46,6 +46,8 @@ #include "src/core/lib/surface/channel_init.h" #include "test/core/end2end/cq_verifier.h" +static char *authority; + static bool g_enable_filter = false; static void *tag(intptr_t t) { return (void *)t; } @@ -124,7 +126,7 @@ static void test_request(grpc_end2end_test_config config) { size_t details_capacity = 0; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -282,6 +284,7 @@ static void init_plugin(void) { static void destroy_plugin(void) {} void filter_causes_close(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr", config); g_enable_filter = true; test_request(config); g_enable_filter = false; diff --git a/test/core/end2end/tests/graceful_server_shutdown.c b/test/core/end2end/tests/graceful_server_shutdown.c index 29347a068a..4c5ecb9f5c 100644 --- a/test/core/end2end/tests/graceful_server_shutdown.c +++ b/test/core/end2end/tests/graceful_server_shutdown.c @@ -43,6 +43,8 @@ #include #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -112,7 +114,7 @@ static void test_early_server_shutdown_finishes_inflight_calls( int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -190,7 +192,9 @@ static void test_early_server_shutdown_finishes_inflight_calls( GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(was_cancelled == 1); gpr_free(details); @@ -208,6 +212,7 @@ static void test_early_server_shutdown_finishes_inflight_calls( } void graceful_server_shutdown(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr", config); test_early_server_shutdown_finishes_inflight_calls(config); } diff --git a/test/core/end2end/tests/high_initial_seqno.c b/test/core/end2end/tests/high_initial_seqno.c index dab527005c..dbd99e8feb 100644 --- a/test/core/end2end/tests/high_initial_seqno.c +++ b/test/core/end2end/tests/high_initial_seqno.c @@ -47,6 +47,8 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -117,7 +119,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr:1234", deadline, + "/foo", authority, deadline, NULL); GPR_ASSERT(c); @@ -189,7 +191,9 @@ static void simple_request_body(grpc_end2end_test_fixture f) { 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(was_cancelled == 1); gpr_free(details); @@ -238,6 +242,7 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config, } void high_initial_seqno(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr:1234", config); test_invoke_10_simple_requests(config, 16777213); if (config.feature_mask & FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION) { test_invoke_10_simple_requests(config, 2147483645); diff --git a/test/core/end2end/tests/hpack_size.c b/test/core/end2end/tests/hpack_size.c index fb00ae4eaa..c207639f7b 100644 --- a/test/core/end2end/tests/hpack_size.c +++ b/test/core/end2end/tests/hpack_size.c @@ -47,6 +47,8 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } const char *hobbits[][2] = { @@ -269,7 +271,7 @@ static void simple_request_body(grpc_end2end_test_fixture f, size_t index) { extra_metadata[2].value_length = strlen(extra_metadata[2].value); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr:1234", deadline, + "/foo", authority, deadline, NULL); GPR_ASSERT(c); @@ -342,7 +344,9 @@ static void simple_request_body(grpc_end2end_test_fixture f, size_t index) { 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(was_cancelled == 1); gpr_free(details); @@ -395,6 +399,7 @@ void hpack_size(grpc_end2end_test_config config) { 1000, 32768, 4 * 1024 * 1024}; size_t i, j; + authority = validate_host_override_string("foo.test.google.fr:1234", config); for (i = 0; i < GPR_ARRAY_SIZE(interesting_sizes); i++) { for (j = 0; j < GPR_ARRAY_SIZE(interesting_sizes); j++) { test_size(config, interesting_sizes[i], interesting_sizes[j]); diff --git a/test/core/end2end/tests/idempotent_request.c b/test/core/end2end/tests/idempotent_request.c index 65f6dd08c5..700cb21207 100644 --- a/test/core/end2end/tests/idempotent_request.c +++ b/test/core/end2end/tests/idempotent_request.c @@ -45,6 +45,8 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -116,7 +118,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { char *peer; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr:1234", deadline, + "/foo", authority, deadline, NULL); GPR_ASSERT(c); @@ -202,7 +204,9 @@ static void simple_request_body(grpc_end2end_test_fixture f) { 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST == call_details.flags); GPR_ASSERT(was_cancelled == 1); @@ -241,6 +245,7 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config) { void idempotent_request(grpc_end2end_test_config config) { int i; + authority = validate_host_override_string("foo.test.google.fr:1234", config); for (i = 0; i < 10; i++) { test_invoke_simple_request(config); } diff --git a/test/core/end2end/tests/invoke_large_request.c b/test/core/end2end/tests/invoke_large_request.c index 1df237cb6c..b807c94564 100644 --- a/test/core/end2end/tests/invoke_large_request.c +++ b/test/core/end2end/tests/invoke_large_request.c @@ -44,6 +44,8 @@ #include #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -145,7 +147,7 @@ static void test_invoke_large_request(grpc_end2end_test_config config, int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -244,7 +246,9 @@ static void test_invoke_large_request(grpc_end2end_test_config config, 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(was_cancelled == 1); gpr_free(details); @@ -270,6 +274,7 @@ static void test_invoke_large_request(grpc_end2end_test_config config, } void invoke_large_request(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr", config); test_invoke_large_request(config, 16384, 65536); test_invoke_large_request(config, 32768, 65536); diff --git a/test/core/end2end/tests/large_metadata.c b/test/core/end2end/tests/large_metadata.c index eb174a2dbb..c0819d090a 100644 --- a/test/core/end2end/tests/large_metadata.c +++ b/test/core/end2end/tests/large_metadata.c @@ -43,6 +43,8 @@ #include #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -126,7 +128,7 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); meta.key = "key"; @@ -227,7 +229,9 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { GPR_ASSERT(status == GRPC_STATUS_OK); 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); GPR_ASSERT(contains_metadata(&request_metadata_recv, "key", meta.value)); @@ -253,6 +257,7 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { } void large_metadata(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr", config); test_request_with_large_metadata(config); } diff --git a/test/core/end2end/tests/load_reporting_hook.c b/test/core/end2end/tests/load_reporting_hook.c index 59d054cf87..62d0dad936 100644 --- a/test/core/end2end/tests/load_reporting_hook.c +++ b/test/core/end2end/tests/load_reporting_hook.c @@ -48,6 +48,8 @@ #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/transport/static_metadata.h" +static char *authority; + enum { TIMEOUT = 200000 }; static void *tag(intptr_t t) { return (void *)t; } @@ -152,7 +154,7 @@ static void request_response_with_payload(grpc_end2end_test_fixture f, int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - method_name, "foo.test.google.fr", deadline, + method_name, authority, deadline, NULL); GPR_ASSERT(c); @@ -315,6 +317,7 @@ static void test_load_reporting_hook(grpc_end2end_test_config config) { } void load_reporting_hook(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr", config); test_load_reporting_hook(config); } diff --git a/test/core/end2end/tests/max_concurrent_streams.c b/test/core/end2end/tests/max_concurrent_streams.c index 65fa946838..925f45d42a 100644 --- a/test/core/end2end/tests/max_concurrent_streams.c +++ b/test/core/end2end/tests/max_concurrent_streams.c @@ -43,6 +43,8 @@ #include #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -113,7 +115,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr:1234", deadline, + "/foo", authority, deadline, NULL); GPR_ASSERT(c); @@ -185,7 +187,9 @@ static void simple_request_body(grpc_end2end_test_fixture f) { 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(was_cancelled == 1); gpr_free(details); @@ -258,11 +262,11 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { the first completes */ deadline = n_seconds_time(1000); c1 = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/alpha", "foo.test.google.fr:1234", deadline, + "/alpha", authority, deadline, NULL); GPR_ASSERT(c1); c2 = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/beta", "foo.test.google.fr:1234", deadline, + "/beta", authority, deadline, NULL); GPR_ASSERT(c2); @@ -440,6 +444,7 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { } void max_concurrent_streams(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr:1234", config); test_max_concurrent_streams(config); } diff --git a/test/core/end2end/tests/max_message_length.c b/test/core/end2end/tests/max_message_length.c index cdca3e6748..6ce63bf0c6 100644 --- a/test/core/end2end/tests/max_message_length.c +++ b/test/core/end2end/tests/max_message_length.c @@ -43,6 +43,8 @@ #include #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -138,7 +140,7 @@ static void test_max_message_length(grpc_end2end_test_config config, cqv = cq_verifier_create(f.cq); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr:1234", + "/foo", authority, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); GPR_ASSERT(c); @@ -212,7 +214,9 @@ static void test_max_message_length(grpc_end2end_test_config config, cq_verify(cqv); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr:1234")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(was_cancelled == 1); done: @@ -240,6 +244,7 @@ done: } void max_message_length(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr:1234", config); test_max_message_length(config, true); test_max_message_length(config, false); } diff --git a/test/core/end2end/tests/negative_deadline.c b/test/core/end2end/tests/negative_deadline.c index c999ac116a..258d4a7168 100644 --- a/test/core/end2end/tests/negative_deadline.c +++ b/test/core/end2end/tests/negative_deadline.c @@ -45,6 +45,8 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -113,7 +115,7 @@ static void simple_request_body(grpc_end2end_test_fixture f, size_t num_ops) { gpr_log(GPR_DEBUG, "test with %" PRIuPTR " ops", num_ops); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr:1234", deadline, + "/foo", authority, deadline, NULL); GPR_ASSERT(c); @@ -174,6 +176,7 @@ static void test_invoke_simple_request(grpc_end2end_test_config config, void negative_deadline(grpc_end2end_test_config config) { size_t i; + authority = validate_host_override_string("foo.test.google.fr:1234", config); for (i = 1; i <= 4; i++) { test_invoke_simple_request(config, i); } diff --git a/test/core/end2end/tests/network_status_change.c b/test/core/end2end/tests/network_status_change.c index 1d4b6dbb18..7bf003cb4a 100644 --- a/test/core/end2end/tests/network_status_change.c +++ b/test/core/end2end/tests/network_status_change.c @@ -43,6 +43,8 @@ #include #include "test/core/end2end/cq_verifier.h" +static char *authority; + /* this is a private API but exposed here for testing*/ extern void grpc_network_status_shutdown_all_endpoints(); @@ -123,7 +125,7 @@ static void test_invoke_network_status_change(grpc_end2end_test_config config) { int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -212,7 +214,9 @@ static void test_invoke_network_status_change(grpc_end2end_test_config config) { // Expected behavior of a RPC when network is lost. GPR_ASSERT(status == GRPC_STATUS_UNAVAILABLE); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(was_cancelled == 0); gpr_free(details); @@ -234,6 +238,7 @@ static void test_invoke_network_status_change(grpc_end2end_test_config config) { } void network_status_change(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr", config); test_invoke_network_status_change(config); } diff --git a/test/core/end2end/tests/no_logging.c b/test/core/end2end/tests/no_logging.c index 3c40e5dbac..42fe5b70f7 100644 --- a/test/core/end2end/tests/no_logging.c +++ b/test/core/end2end/tests/no_logging.c @@ -47,6 +47,8 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" +static char *authority; + enum { TIMEOUT = 200000 }; static void *tag(intptr_t t) { return (void *)t; } @@ -137,7 +139,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { char *peer; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr:1234", deadline, + "/foo", authority, deadline, NULL); GPR_ASSERT(c); @@ -220,7 +222,9 @@ static void simple_request_body(grpc_end2end_test_fixture f) { 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(0 == call_details.flags); GPR_ASSERT(was_cancelled == 1); @@ -286,6 +290,7 @@ static void test_no_logging_in_one_request(grpc_end2end_test_config config) { } void no_logging(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr:1234", config); test_no_logging_in_one_request(config); test_no_error_logging_in_entire_process(config); } diff --git a/test/core/end2end/tests/payload.c b/test/core/end2end/tests/payload.c index c71704ff61..292a92eeb8 100644 --- a/test/core/end2end/tests/payload.c +++ b/test/core/end2end/tests/payload.c @@ -43,6 +43,8 @@ #include #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -121,7 +123,7 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) { int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -220,7 +222,9 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) { GPR_ASSERT(status == GRPC_STATUS_OK); 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); GPR_ASSERT(byte_buffer_eq_string(response_payload_recv, "hello you")); @@ -266,6 +270,7 @@ static void test_invoke_10_request_response_with_payload( } void payload(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr", config); test_invoke_request_response_with_payload(config); test_invoke_10_request_response_with_payload(config); } diff --git a/test/core/end2end/tests/ping_pong_streaming.c b/test/core/end2end/tests/ping_pong_streaming.c index 7e360c415b..372766f470 100644 --- a/test/core/end2end/tests/ping_pong_streaming.c +++ b/test/core/end2end/tests/ping_pong_streaming.c @@ -43,6 +43,8 @@ #include #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -124,7 +126,7 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, gpr_slice response_payload_slice = gpr_slice_from_copied_string("hello you"); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr:1234", deadline, + "/foo", authority, deadline, NULL); GPR_ASSERT(c); @@ -276,6 +278,7 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, void ping_pong_streaming(grpc_end2end_test_config config) { int i; + authority = validate_host_override_string("foo.test.google.fr:1234", config); for (i = 1; i < 10; i++) { test_pingpong_streaming(config, i); } diff --git a/test/core/end2end/tests/registered_call.c b/test/core/end2end/tests/registered_call.c index 9b2b42b558..1bbae56a0f 100644 --- a/test/core/end2end/tests/registered_call.c +++ b/test/core/end2end/tests/registered_call.c @@ -45,6 +45,8 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -186,7 +188,9 @@ static void simple_request_body(grpc_end2end_test_fixture f, void *rc) { 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(was_cancelled == 1); gpr_free(details); @@ -205,7 +209,7 @@ 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); + authority, NULL); simple_request_body(f, rc); end_test(&f); @@ -217,7 +221,7 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config) { 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); + authority, NULL); for (i = 0; i < 10; i++) { simple_request_body(f, rc); @@ -228,6 +232,7 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config) { } void registered_call(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr:1234", config); test_invoke_simple_request(config); test_invoke_10_simple_requests(config); } diff --git a/test/core/end2end/tests/request_with_flags.c b/test/core/end2end/tests/request_with_flags.c index 25150e6f2d..623def9fd3 100644 --- a/test/core/end2end/tests/request_with_flags.c +++ b/test/core/end2end/tests/request_with_flags.c @@ -44,6 +44,8 @@ #include "src/core/lib/transport/byte_stream.h" #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -121,7 +123,7 @@ static void test_invoke_request_with_flags( grpc_call_error expectation; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -186,6 +188,7 @@ static void test_invoke_request_with_flags( void request_with_flags(grpc_end2end_test_config config) { size_t i; + authority = validate_host_override_string("foo.test.google.fr", config); uint32_t flags_for_op[GRPC_OP_RECV_CLOSE_ON_SERVER + 1]; { diff --git a/test/core/end2end/tests/request_with_payload.c b/test/core/end2end/tests/request_with_payload.c index 67208c050c..a0da85496d 100644 --- a/test/core/end2end/tests/request_with_payload.c +++ b/test/core/end2end/tests/request_with_payload.c @@ -43,6 +43,8 @@ #include #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -120,7 +122,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -208,7 +210,9 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { GPR_ASSERT(status == GRPC_STATUS_OK); 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); @@ -231,6 +235,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { } void request_with_payload(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr", config); test_invoke_request_with_payload(config); } diff --git a/test/core/end2end/tests/server_finishes_request.c b/test/core/end2end/tests/server_finishes_request.c index 7fb9025aa3..ca8bf9278b 100644 --- a/test/core/end2end/tests/server_finishes_request.c +++ b/test/core/end2end/tests/server_finishes_request.c @@ -45,6 +45,8 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -115,7 +117,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr:1234", deadline, + "/foo", authority, deadline, NULL); GPR_ASSERT(c); @@ -183,7 +185,9 @@ static void simple_request_body(grpc_end2end_test_fixture f) { 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(was_cancelled == 1); gpr_free(details); @@ -208,6 +212,7 @@ static void test_invoke_simple_request(grpc_end2end_test_config config) { } void server_finishes_request(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr:1234", config); test_invoke_simple_request(config); } diff --git a/test/core/end2end/tests/shutdown_finishes_calls.c b/test/core/end2end/tests/shutdown_finishes_calls.c index dff2e6f280..f08d0f2e10 100644 --- a/test/core/end2end/tests/shutdown_finishes_calls.c +++ b/test/core/end2end/tests/shutdown_finishes_calls.c @@ -43,6 +43,8 @@ #include #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -105,7 +107,7 @@ static void test_early_server_shutdown_finishes_inflight_calls( int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -171,7 +173,9 @@ static void test_early_server_shutdown_finishes_inflight_calls( GPR_ASSERT(status == GRPC_STATUS_UNAVAILABLE); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(was_cancelled == 1); gpr_free(details); @@ -190,6 +194,7 @@ static void test_early_server_shutdown_finishes_inflight_calls( } void shutdown_finishes_calls(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr", config); test_early_server_shutdown_finishes_inflight_calls(config); } diff --git a/test/core/end2end/tests/simple_cacheable_request.c b/test/core/end2end/tests/simple_cacheable_request.c index b52eb19315..997177cd4a 100644 --- a/test/core/end2end/tests/simple_cacheable_request.c +++ b/test/core/end2end/tests/simple_cacheable_request.c @@ -43,6 +43,8 @@ #include #include "test/core/end2end/cq_verifier.h" +static char *authority; + enum { TIMEOUT = 200000 }; static void *tag(intptr_t t) { return (void *)t; } @@ -134,7 +136,7 @@ static void test_cacheable_request_response_with_metadata_and_payload( int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -235,7 +237,9 @@ static void test_cacheable_request_response_with_metadata_and_payload( GPR_ASSERT(status == GRPC_STATUS_OK); 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } if (config.feature_mask & FEATURE_MASK_SUPPORTS_REQUEST_PROXYING) { // Our simple proxy does not support cacheable requests } else { @@ -270,6 +274,7 @@ static void test_cacheable_request_response_with_metadata_and_payload( } void simple_cacheable_request(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr", config); test_cacheable_request_response_with_metadata_and_payload(config); } diff --git a/test/core/end2end/tests/simple_delayed_request.c b/test/core/end2end/tests/simple_delayed_request.c index 74f1232d78..7f1a284739 100644 --- a/test/core/end2end/tests/simple_delayed_request.c +++ b/test/core/end2end/tests/simple_delayed_request.c @@ -43,6 +43,8 @@ #include #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static gpr_timespec n_seconds_time(int n) { @@ -107,7 +109,7 @@ static void simple_delayed_request_body(grpc_end2end_test_config config, config.init_client(f, client_args); c = grpc_channel_create_call(f->client, NULL, GRPC_PROPAGATE_DEFAULTS, f->cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -180,7 +182,9 @@ static void simple_delayed_request_body(grpc_end2end_test_config config, 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(was_cancelled == 1); gpr_free(details); @@ -217,6 +221,7 @@ static void test_simple_delayed_request_long(grpc_end2end_test_config config) { } void simple_delayed_request(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr", config); GPR_ASSERT(config.feature_mask & FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION); test_simple_delayed_request_short(config); test_simple_delayed_request_long(config); diff --git a/test/core/end2end/tests/simple_metadata.c b/test/core/end2end/tests/simple_metadata.c index 13c77c033e..a115ae665c 100644 --- a/test/core/end2end/tests/simple_metadata.c +++ b/test/core/end2end/tests/simple_metadata.c @@ -43,6 +43,8 @@ #include #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -131,7 +133,7 @@ static void test_request_response_with_metadata_and_payload( int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -232,7 +234,9 @@ static void test_request_response_with_metadata_and_payload( GPR_ASSERT(status == GRPC_STATUS_OK); 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); GPR_ASSERT(byte_buffer_eq_string(response_payload_recv, "hello you")); @@ -262,6 +266,7 @@ static void test_request_response_with_metadata_and_payload( } void simple_metadata(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr", config); test_request_response_with_metadata_and_payload(config); } diff --git a/test/core/end2end/tests/simple_request.c b/test/core/end2end/tests/simple_request.c index ed7b850808..8c311d3e7a 100644 --- a/test/core/end2end/tests/simple_request.c +++ b/test/core/end2end/tests/simple_request.c @@ -45,6 +45,8 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -116,8 +118,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { char *peer; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr:1234", deadline, - NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); peer = grpc_call_get_peer(c); @@ -202,7 +203,9 @@ static void simple_request_body(grpc_end2end_test_fixture f) { 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr:1234")); + } GPR_ASSERT(0 == call_details.flags); GPR_ASSERT(was_cancelled == 1); @@ -241,6 +244,7 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config) { void simple_request(grpc_end2end_test_config config) { int i; + authority = validate_host_override_string("foo.test.google.fr:1234", config); for (i = 0; i < 10; i++) { test_invoke_simple_request(config); } diff --git a/test/core/end2end/tests/streaming_error_response.c b/test/core/end2end/tests/streaming_error_response.c index 8285468321..13b7a372dd 100644 --- a/test/core/end2end/tests/streaming_error_response.c +++ b/test/core/end2end/tests/streaming_error_response.c @@ -43,6 +43,8 @@ #include #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -126,7 +128,7 @@ static void test(grpc_end2end_test_config config, bool request_status_early) { int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -245,7 +247,9 @@ static void test(grpc_end2end_test_config config, bool request_status_early) { GPR_ASSERT(status == GRPC_STATUS_FAILED_PRECONDITION); 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(was_cancelled == 1); gpr_free(details); @@ -269,6 +273,7 @@ static void test(grpc_end2end_test_config config, bool request_status_early) { } void streaming_error_response(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr", config); test(config, false); test(config, true); } diff --git a/test/core/end2end/tests/trailing_metadata.c b/test/core/end2end/tests/trailing_metadata.c index d7093ae723..11af60ffdd 100644 --- a/test/core/end2end/tests/trailing_metadata.c +++ b/test/core/end2end/tests/trailing_metadata.c @@ -43,6 +43,8 @@ #include #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -134,7 +136,7 @@ static void test_request_response_with_metadata_and_payload( int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -236,7 +238,9 @@ static void test_request_response_with_metadata_and_payload( GPR_ASSERT(status == GRPC_STATUS_OK); 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); GPR_ASSERT(byte_buffer_eq_string(response_payload_recv, "hello you")); GPR_ASSERT(contains_metadata(&request_metadata_recv, "key1", "val1")); @@ -267,6 +271,7 @@ static void test_request_response_with_metadata_and_payload( } void trailing_metadata(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr", config); test_request_response_with_metadata_and_payload(config); } -- cgit v1.2.3 From caa904486ee11d7dfc369a48db1bc6dee4f216c3 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Thu, 22 Sep 2016 16:23:10 -0700 Subject: Minor end2end test update --- test/core/end2end/tests/binary_metadata.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/core/end2end/tests/binary_metadata.c b/test/core/end2end/tests/binary_metadata.c index 6b105def33..c5c862bbf2 100644 --- a/test/core/end2end/tests/binary_metadata.c +++ b/test/core/end2end/tests/binary_metadata.c @@ -43,6 +43,8 @@ #include #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -147,7 +149,7 @@ static void test_request_response_with_metadata_and_payload( int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -248,7 +250,9 @@ static void test_request_response_with_metadata_and_payload( GPR_ASSERT(status == GRPC_STATUS_OK); 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); GPR_ASSERT(byte_buffer_eq_string(response_payload_recv, "hello you")); @@ -286,6 +290,7 @@ static void test_request_response_with_metadata_and_payload( } void binary_metadata(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr", config); test_request_response_with_metadata_and_payload(config); } -- cgit v1.2.3 From 90a283a4a8859ab548eff6fbcefea3f72357d41a Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Thu, 13 Oct 2016 11:40:31 -0700 Subject: Add FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER in h2_http_proxy.c --- test/core/end2end/fixtures/h2_http_proxy.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/core/end2end/fixtures/h2_http_proxy.c b/test/core/end2end/fixtures/h2_http_proxy.c index a675a11f66..db4afe5c1c 100644 --- a/test/core/end2end/fixtures/h2_http_proxy.c +++ b/test/core/end2end/fixtures/h2_http_proxy.c @@ -107,7 +107,9 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION, + {"chttp2/fullstack", + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; -- cgit v1.2.3 From ed2be64d82d7cff11b6c2fb2bf127585fd5f1107 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Thu, 13 Oct 2016 14:04:39 -0700 Subject: Clean format with clang-format --- test/core/end2end/fixtures/h2_census.c | 4 ++-- test/core/end2end/fixtures/h2_compress.c | 4 ++-- test/core/end2end/fixtures/h2_full+pipe.c | 4 ++-- test/core/end2end/fixtures/h2_full+trace.c | 4 ++-- test/core/end2end/fixtures/h2_full.c | 4 ++-- test/core/end2end/fixtures/h2_http_proxy.c | 5 ++--- test/core/end2end/fixtures/h2_load_reporting.c | 3 ++- test/core/end2end/fixtures/h2_proxy.c | 7 +++---- test/core/end2end/fixtures/h2_sockpair+trace.c | 6 +++--- test/core/end2end/fixtures/h2_sockpair.c | 5 ++--- test/core/end2end/fixtures/h2_sockpair_1byte.c | 6 +++--- test/core/end2end/fixtures/h2_uds.c | 5 ++--- test/core/end2end/tests/cancel_with_status.c | 3 +-- test/core/end2end/tests/disappearing_server.c | 3 +-- test/core/end2end/tests/high_initial_seqno.c | 3 +-- test/core/end2end/tests/hpack_size.c | 3 +-- test/core/end2end/tests/idempotent_request.c | 3 +-- test/core/end2end/tests/load_reporting_hook.c | 3 +-- test/core/end2end/tests/max_concurrent_streams.c | 9 +++------ test/core/end2end/tests/negative_deadline.c | 3 +-- test/core/end2end/tests/no_logging.c | 3 +-- test/core/end2end/tests/ping_pong_streaming.c | 3 +-- test/core/end2end/tests/registered_call.c | 6 ++---- test/core/end2end/tests/server_finishes_request.c | 3 +-- 24 files changed, 42 insertions(+), 60 deletions(-) (limited to 'test') diff --git a/test/core/end2end/fixtures/h2_census.c b/test/core/end2end/fixtures/h2_census.c index e81cf82af1..c06002deae 100644 --- a/test/core/end2end/fixtures/h2_census.c +++ b/test/core/end2end/fixtures/h2_census.c @@ -111,8 +111,8 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack+census", - FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack+census", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_compress.c b/test/core/end2end/fixtures/h2_compress.c index 41a48b920f..197b69e090 100644 --- a/test/core/end2end/fixtures/h2_compress.c +++ b/test/core/end2end/fixtures/h2_compress.c @@ -113,8 +113,8 @@ void chttp2_tear_down_fullstack_compression(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack_compression", - FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack_compression", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack_compression, chttp2_init_client_fullstack_compression, chttp2_init_server_fullstack_compression, diff --git a/test/core/end2end/fixtures/h2_full+pipe.c b/test/core/end2end/fixtures/h2_full+pipe.c index d67bf9f1bb..318e56992f 100644 --- a/test/core/end2end/fixtures/h2_full+pipe.c +++ b/test/core/end2end/fixtures/h2_full+pipe.c @@ -97,8 +97,8 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack", - FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_full+trace.c b/test/core/end2end/fixtures/h2_full+trace.c index 6f2b4e37db..d7ee2ef3c6 100644 --- a/test/core/end2end/fixtures/h2_full+trace.c +++ b/test/core/end2end/fixtures/h2_full+trace.c @@ -97,8 +97,8 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack", - FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_full.c b/test/core/end2end/fixtures/h2_full.c index d85669e021..f4dbb516f4 100644 --- a/test/core/end2end/fixtures/h2_full.c +++ b/test/core/end2end/fixtures/h2_full.c @@ -96,8 +96,8 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack", - FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_http_proxy.c b/test/core/end2end/fixtures/h2_http_proxy.c index db4afe5c1c..0dd5d2aa8a 100644 --- a/test/core/end2end/fixtures/h2_http_proxy.c +++ b/test/core/end2end/fixtures/h2_http_proxy.c @@ -107,9 +107,8 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack", - FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_load_reporting.c b/test/core/end2end/fixtures/h2_load_reporting.c index 6965418eef..63417adcc5 100644 --- a/test/core/end2end/fixtures/h2_load_reporting.c +++ b/test/core/end2end/fixtures/h2_load_reporting.c @@ -103,7 +103,8 @@ void chttp2_tear_down_load_reporting(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { {"chttp2/fullstack+load_reporting", - FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_load_reporting, chttp2_init_client_load_reporting, chttp2_init_server_load_reporting, chttp2_tear_down_load_reporting}, }; diff --git a/test/core/end2end/fixtures/h2_proxy.c b/test/core/end2end/fixtures/h2_proxy.c index 695d51a9c7..a2fefa7952 100644 --- a/test/core/end2end/fixtures/h2_proxy.c +++ b/test/core/end2end/fixtures/h2_proxy.c @@ -113,10 +113,9 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack+proxy", - FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_REQUEST_PROXYING | - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack+proxy", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_REQUEST_PROXYING | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_sockpair+trace.c b/test/core/end2end/fixtures/h2_sockpair+trace.c index 674aee5b78..f65a688454 100644 --- a/test/core/end2end/fixtures/h2_sockpair+trace.c +++ b/test/core/end2end/fixtures/h2_sockpair+trace.c @@ -134,9 +134,9 @@ static void chttp2_tear_down_socketpair(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/socketpair", FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_socketpair, - chttp2_init_client_socketpair, chttp2_init_server_socketpair, - chttp2_tear_down_socketpair}, + {"chttp2/socketpair", FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + chttp2_create_fixture_socketpair, chttp2_init_client_socketpair, + chttp2_init_server_socketpair, chttp2_tear_down_socketpair}, }; int main(int argc, char **argv) { diff --git a/test/core/end2end/fixtures/h2_sockpair.c b/test/core/end2end/fixtures/h2_sockpair.c index 4164bc9cf3..24232bb051 100644 --- a/test/core/end2end/fixtures/h2_sockpair.c +++ b/test/core/end2end/fixtures/h2_sockpair.c @@ -134,9 +134,8 @@ static void chttp2_tear_down_socketpair(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { {"chttp2/socketpair", FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, - chttp2_create_fixture_socketpair, - chttp2_init_client_socketpair, chttp2_init_server_socketpair, - chttp2_tear_down_socketpair}, + chttp2_create_fixture_socketpair, chttp2_init_client_socketpair, + chttp2_init_server_socketpair, chttp2_tear_down_socketpair}, }; int main(int argc, char **argv) { diff --git a/test/core/end2end/fixtures/h2_sockpair_1byte.c b/test/core/end2end/fixtures/h2_sockpair_1byte.c index e8a33bb2d4..e3f3002af1 100644 --- a/test/core/end2end/fixtures/h2_sockpair_1byte.c +++ b/test/core/end2end/fixtures/h2_sockpair_1byte.c @@ -134,9 +134,9 @@ static void chttp2_tear_down_socketpair(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { {"chttp2/socketpair_one_byte_at_a_time", - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, - chttp2_create_fixture_socketpair, chttp2_init_client_socketpair, - chttp2_init_server_socketpair, chttp2_tear_down_socketpair}, + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_socketpair, + chttp2_init_client_socketpair, chttp2_init_server_socketpair, + chttp2_tear_down_socketpair}, }; int main(int argc, char **argv) { diff --git a/test/core/end2end/fixtures/h2_uds.c b/test/core/end2end/fixtures/h2_uds.c index d8892c0c88..c15b70ded4 100644 --- a/test/core/end2end/fixtures/h2_uds.c +++ b/test/core/end2end/fixtures/h2_uds.c @@ -101,9 +101,8 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack_uds", - FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack_uds", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/tests/cancel_with_status.c b/test/core/end2end/tests/cancel_with_status.c index b2da1099eb..4ab4f1e92f 100644 --- a/test/core/end2end/tests/cancel_with_status.c +++ b/test/core/end2end/tests/cancel_with_status.c @@ -115,8 +115,7 @@ static void simple_request_body(grpc_end2end_test_fixture f, size_t num_ops) { gpr_log(GPR_DEBUG, "test with %" PRIuPTR " ops", num_ops); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, - NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); diff --git a/test/core/end2end/tests/disappearing_server.c b/test/core/end2end/tests/disappearing_server.c index e761aa7d19..624e148785 100644 --- a/test/core/end2end/tests/disappearing_server.c +++ b/test/core/end2end/tests/disappearing_server.c @@ -99,8 +99,7 @@ static void do_request_and_shutdown_server(grpc_end2end_test_fixture *f, int was_cancelled = 2; c = grpc_channel_create_call(f->client, NULL, GRPC_PROPAGATE_DEFAULTS, f->cq, - "/foo", authority, deadline, - NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); diff --git a/test/core/end2end/tests/high_initial_seqno.c b/test/core/end2end/tests/high_initial_seqno.c index dbd99e8feb..4a0d59f326 100644 --- a/test/core/end2end/tests/high_initial_seqno.c +++ b/test/core/end2end/tests/high_initial_seqno.c @@ -119,8 +119,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, - NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); diff --git a/test/core/end2end/tests/hpack_size.c b/test/core/end2end/tests/hpack_size.c index c207639f7b..80513e764c 100644 --- a/test/core/end2end/tests/hpack_size.c +++ b/test/core/end2end/tests/hpack_size.c @@ -271,8 +271,7 @@ static void simple_request_body(grpc_end2end_test_fixture f, size_t index) { extra_metadata[2].value_length = strlen(extra_metadata[2].value); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, - NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); diff --git a/test/core/end2end/tests/idempotent_request.c b/test/core/end2end/tests/idempotent_request.c index 700cb21207..6582eaf034 100644 --- a/test/core/end2end/tests/idempotent_request.c +++ b/test/core/end2end/tests/idempotent_request.c @@ -118,8 +118,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { char *peer; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, - NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); peer = grpc_call_get_peer(c); diff --git a/test/core/end2end/tests/load_reporting_hook.c b/test/core/end2end/tests/load_reporting_hook.c index 62d0dad936..e8bbbd9725 100644 --- a/test/core/end2end/tests/load_reporting_hook.c +++ b/test/core/end2end/tests/load_reporting_hook.c @@ -154,8 +154,7 @@ static void request_response_with_payload(grpc_end2end_test_fixture f, int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - method_name, authority, deadline, - NULL); + method_name, authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); diff --git a/test/core/end2end/tests/max_concurrent_streams.c b/test/core/end2end/tests/max_concurrent_streams.c index 925f45d42a..c6f634c457 100644 --- a/test/core/end2end/tests/max_concurrent_streams.c +++ b/test/core/end2end/tests/max_concurrent_streams.c @@ -115,8 +115,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, - NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -262,12 +261,10 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { the first completes */ deadline = n_seconds_time(1000); c1 = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/alpha", authority, deadline, - NULL); + "/alpha", authority, deadline, NULL); GPR_ASSERT(c1); c2 = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/beta", authority, deadline, - NULL); + "/beta", authority, deadline, NULL); GPR_ASSERT(c2); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( diff --git a/test/core/end2end/tests/negative_deadline.c b/test/core/end2end/tests/negative_deadline.c index 258d4a7168..ec45841e5f 100644 --- a/test/core/end2end/tests/negative_deadline.c +++ b/test/core/end2end/tests/negative_deadline.c @@ -115,8 +115,7 @@ static void simple_request_body(grpc_end2end_test_fixture f, size_t num_ops) { gpr_log(GPR_DEBUG, "test with %" PRIuPTR " ops", num_ops); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, - NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); diff --git a/test/core/end2end/tests/no_logging.c b/test/core/end2end/tests/no_logging.c index 32d357508b..0ddb4a5a05 100644 --- a/test/core/end2end/tests/no_logging.c +++ b/test/core/end2end/tests/no_logging.c @@ -146,8 +146,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { char *peer; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, - NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); peer = grpc_call_get_peer(c); diff --git a/test/core/end2end/tests/ping_pong_streaming.c b/test/core/end2end/tests/ping_pong_streaming.c index 372766f470..46fa0063f3 100644 --- a/test/core/end2end/tests/ping_pong_streaming.c +++ b/test/core/end2end/tests/ping_pong_streaming.c @@ -126,8 +126,7 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, gpr_slice response_payload_slice = gpr_slice_from_copied_string("hello you"); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, - NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); diff --git a/test/core/end2end/tests/registered_call.c b/test/core/end2end/tests/registered_call.c index 1bbae56a0f..d710b9e56f 100644 --- a/test/core/end2end/tests/registered_call.c +++ b/test/core/end2end/tests/registered_call.c @@ -208,8 +208,7 @@ static void simple_request_body(grpc_end2end_test_fixture f, void *rc) { 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", - authority, NULL); + void *rc = grpc_channel_register_call(f.client, "/foo", authority, NULL); simple_request_body(f, rc); end_test(&f); @@ -220,8 +219,7 @@ 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", - authority, NULL); + void *rc = grpc_channel_register_call(f.client, "/foo", authority, NULL); for (i = 0; i < 10; i++) { simple_request_body(f, rc); diff --git a/test/core/end2end/tests/server_finishes_request.c b/test/core/end2end/tests/server_finishes_request.c index ca8bf9278b..a824e6e1e4 100644 --- a/test/core/end2end/tests/server_finishes_request.c +++ b/test/core/end2end/tests/server_finishes_request.c @@ -117,8 +117,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, - NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); -- cgit v1.2.3 From dd2fa6482a945c17eba4c37ff42a8af0e9c4fa26 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 20 Oct 2016 15:46:32 -0700 Subject: Add pid controller test --- BUILD | 8 + CMakeLists.txt | 3 + Makefile | 40 +++++ binding.gyp | 1 + build.yaml | 12 ++ config.m4 | 1 + gRPC-Core.podspec | 3 + grpc.gemspec | 2 + package.xml | 2 + src/core/lib/transport/pid_controller.c | 6 +- src/python/grpcio/grpc_core_dependencies.py | 1 + test/core/transport/pid_controller_test.c | 77 ++++++++ tools/doxygen/Doxyfile.core.internal | 2 + tools/run_tests/sources_and_headers.json | 20 +++ tools/run_tests/tests.json | 21 +++ vsprojects/buildtests_c.sln | 27 +++ vsprojects/vcxproj/grpc/grpc.vcxproj | 3 + vsprojects/vcxproj/grpc/grpc.vcxproj.filters | 6 + .../vcxproj/grpc_test_util/grpc_test_util.vcxproj | 3 + .../grpc_test_util/grpc_test_util.vcxproj.filters | 6 + .../vcxproj/grpc_unsecure/grpc_unsecure.vcxproj | 3 + .../grpc_unsecure/grpc_unsecure.vcxproj.filters | 6 + .../transport_pid_controller_test.vcxproj | 199 +++++++++++++++++++++ .../transport_pid_controller_test.vcxproj.filters | 21 +++ 24 files changed, 470 insertions(+), 3 deletions(-) create mode 100644 test/core/transport/pid_controller_test.c create mode 100644 vsprojects/vcxproj/test/transport_pid_controller_test/transport_pid_controller_test.vcxproj create mode 100644 vsprojects/vcxproj/test/transport_pid_controller_test/transport_pid_controller_test.vcxproj.filters (limited to 'test') diff --git a/BUILD b/BUILD index 5c4333463c..fc436fde10 100644 --- a/BUILD +++ b/BUILD @@ -242,6 +242,7 @@ cc_library( "src/core/lib/transport/mdstr_hash_table.h", "src/core/lib/transport/metadata.h", "src/core/lib/transport/metadata_batch.h", + "src/core/lib/transport/pid_controller.h", "src/core/lib/transport/static_metadata.h", "src/core/lib/transport/timeout_encoding.h", "src/core/lib/transport/transport.h", @@ -414,6 +415,7 @@ cc_library( "src/core/lib/transport/mdstr_hash_table.c", "src/core/lib/transport/metadata.c", "src/core/lib/transport/metadata_batch.c", + "src/core/lib/transport/pid_controller.c", "src/core/lib/transport/static_metadata.c", "src/core/lib/transport/timeout_encoding.c", "src/core/lib/transport/transport.c", @@ -647,6 +649,7 @@ cc_library( "src/core/lib/transport/mdstr_hash_table.h", "src/core/lib/transport/metadata.h", "src/core/lib/transport/metadata_batch.h", + "src/core/lib/transport/pid_controller.h", "src/core/lib/transport/static_metadata.h", "src/core/lib/transport/timeout_encoding.h", "src/core/lib/transport/transport.h", @@ -804,6 +807,7 @@ cc_library( "src/core/lib/transport/mdstr_hash_table.c", "src/core/lib/transport/metadata.c", "src/core/lib/transport/metadata_batch.c", + "src/core/lib/transport/pid_controller.c", "src/core/lib/transport/static_metadata.c", "src/core/lib/transport/timeout_encoding.c", "src/core/lib/transport/transport.c", @@ -1007,6 +1011,7 @@ cc_library( "src/core/lib/transport/mdstr_hash_table.h", "src/core/lib/transport/metadata.h", "src/core/lib/transport/metadata_batch.h", + "src/core/lib/transport/pid_controller.h", "src/core/lib/transport/static_metadata.h", "src/core/lib/transport/timeout_encoding.h", "src/core/lib/transport/transport.h", @@ -1156,6 +1161,7 @@ cc_library( "src/core/lib/transport/mdstr_hash_table.c", "src/core/lib/transport/metadata.c", "src/core/lib/transport/metadata_batch.c", + "src/core/lib/transport/pid_controller.c", "src/core/lib/transport/static_metadata.c", "src/core/lib/transport/timeout_encoding.c", "src/core/lib/transport/transport.c", @@ -1921,6 +1927,7 @@ objc_library( "src/core/lib/transport/mdstr_hash_table.c", "src/core/lib/transport/metadata.c", "src/core/lib/transport/metadata_batch.c", + "src/core/lib/transport/pid_controller.c", "src/core/lib/transport/static_metadata.c", "src/core/lib/transport/timeout_encoding.c", "src/core/lib/transport/transport.c", @@ -2133,6 +2140,7 @@ objc_library( "src/core/lib/transport/mdstr_hash_table.h", "src/core/lib/transport/metadata.h", "src/core/lib/transport/metadata_batch.h", + "src/core/lib/transport/pid_controller.h", "src/core/lib/transport/static_metadata.h", "src/core/lib/transport/timeout_encoding.h", "src/core/lib/transport/transport.h", diff --git a/CMakeLists.txt b/CMakeLists.txt index 893aac36fb..95505a68df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -379,6 +379,7 @@ add_library(grpc src/core/lib/transport/mdstr_hash_table.c src/core/lib/transport/metadata.c src/core/lib/transport/metadata_batch.c + src/core/lib/transport/pid_controller.c src/core/lib/transport/static_metadata.c src/core/lib/transport/timeout_encoding.c src/core/lib/transport/transport.c @@ -640,6 +641,7 @@ add_library(grpc_cronet src/core/lib/transport/mdstr_hash_table.c src/core/lib/transport/metadata.c src/core/lib/transport/metadata_batch.c + src/core/lib/transport/pid_controller.c src/core/lib/transport/static_metadata.c src/core/lib/transport/timeout_encoding.c src/core/lib/transport/transport.c @@ -873,6 +875,7 @@ add_library(grpc_unsecure src/core/lib/transport/mdstr_hash_table.c src/core/lib/transport/metadata.c src/core/lib/transport/metadata_batch.c + src/core/lib/transport/pid_controller.c src/core/lib/transport/static_metadata.c src/core/lib/transport/timeout_encoding.c src/core/lib/transport/transport.c diff --git a/Makefile b/Makefile index 38be9e658c..7325a970e4 100644 --- a/Makefile +++ b/Makefile @@ -1021,6 +1021,7 @@ timer_heap_test: $(BINDIR)/$(CONFIG)/timer_heap_test timer_list_test: $(BINDIR)/$(CONFIG)/timer_list_test transport_connectivity_state_test: $(BINDIR)/$(CONFIG)/transport_connectivity_state_test transport_metadata_test: $(BINDIR)/$(CONFIG)/transport_metadata_test +transport_pid_controller_test: $(BINDIR)/$(CONFIG)/transport_pid_controller_test transport_security_test: $(BINDIR)/$(CONFIG)/transport_security_test udp_server_test: $(BINDIR)/$(CONFIG)/udp_server_test uri_fuzzer_test: $(BINDIR)/$(CONFIG)/uri_fuzzer_test @@ -1341,6 +1342,7 @@ buildtests_c: privatelibs_c \ $(BINDIR)/$(CONFIG)/timer_list_test \ $(BINDIR)/$(CONFIG)/transport_connectivity_state_test \ $(BINDIR)/$(CONFIG)/transport_metadata_test \ + $(BINDIR)/$(CONFIG)/transport_pid_controller_test \ $(BINDIR)/$(CONFIG)/transport_security_test \ $(BINDIR)/$(CONFIG)/udp_server_test \ $(BINDIR)/$(CONFIG)/uri_parser_test \ @@ -1741,6 +1743,8 @@ test_c: buildtests_c $(Q) $(BINDIR)/$(CONFIG)/transport_connectivity_state_test || ( echo test transport_connectivity_state_test failed ; exit 1 ) $(E) "[RUN] Testing transport_metadata_test" $(Q) $(BINDIR)/$(CONFIG)/transport_metadata_test || ( echo test transport_metadata_test failed ; exit 1 ) + $(E) "[RUN] Testing transport_pid_controller_test" + $(Q) $(BINDIR)/$(CONFIG)/transport_pid_controller_test || ( echo test transport_pid_controller_test failed ; exit 1 ) $(E) "[RUN] Testing transport_security_test" $(Q) $(BINDIR)/$(CONFIG)/transport_security_test || ( echo test transport_security_test failed ; exit 1 ) $(E) "[RUN] Testing udp_server_test" @@ -2636,6 +2640,7 @@ LIBGRPC_SRC = \ src/core/lib/transport/mdstr_hash_table.c \ src/core/lib/transport/metadata.c \ src/core/lib/transport/metadata_batch.c \ + src/core/lib/transport/pid_controller.c \ src/core/lib/transport/static_metadata.c \ src/core/lib/transport/timeout_encoding.c \ src/core/lib/transport/transport.c \ @@ -2915,6 +2920,7 @@ LIBGRPC_CRONET_SRC = \ src/core/lib/transport/mdstr_hash_table.c \ src/core/lib/transport/metadata.c \ src/core/lib/transport/metadata_batch.c \ + src/core/lib/transport/pid_controller.c \ src/core/lib/transport/static_metadata.c \ src/core/lib/transport/timeout_encoding.c \ src/core/lib/transport/transport.c \ @@ -3184,6 +3190,7 @@ LIBGRPC_TEST_UTIL_SRC = \ src/core/lib/transport/mdstr_hash_table.c \ src/core/lib/transport/metadata.c \ src/core/lib/transport/metadata_batch.c \ + src/core/lib/transport/pid_controller.c \ src/core/lib/transport/static_metadata.c \ src/core/lib/transport/timeout_encoding.c \ src/core/lib/transport/transport.c \ @@ -3379,6 +3386,7 @@ LIBGRPC_UNSECURE_SRC = \ src/core/lib/transport/mdstr_hash_table.c \ src/core/lib/transport/metadata.c \ src/core/lib/transport/metadata_batch.c \ + src/core/lib/transport/pid_controller.c \ src/core/lib/transport/static_metadata.c \ src/core/lib/transport/timeout_encoding.c \ src/core/lib/transport/transport.c \ @@ -10698,6 +10706,38 @@ endif endif +TRANSPORT_PID_CONTROLLER_TEST_SRC = \ + test/core/transport/pid_controller_test.c \ + +TRANSPORT_PID_CONTROLLER_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(TRANSPORT_PID_CONTROLLER_TEST_SRC)))) +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL. + +$(BINDIR)/$(CONFIG)/transport_pid_controller_test: openssl_dep_error + +else + + + +$(BINDIR)/$(CONFIG)/transport_pid_controller_test: $(TRANSPORT_PID_CONTROLLER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LD) $(LDFLAGS) $(TRANSPORT_PID_CONTROLLER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/transport_pid_controller_test + +endif + +$(OBJDIR)/$(CONFIG)/test/core/transport/pid_controller_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + +deps_transport_pid_controller_test: $(TRANSPORT_PID_CONTROLLER_TEST_OBJS:.o=.dep) + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(TRANSPORT_PID_CONTROLLER_TEST_OBJS:.o=.dep) +endif +endif + + TRANSPORT_SECURITY_TEST_SRC = \ test/core/tsi/transport_security_test.c \ diff --git a/binding.gyp b/binding.gyp index 397bb1b639..c6c08e260b 100644 --- a/binding.gyp +++ b/binding.gyp @@ -654,6 +654,7 @@ 'src/core/lib/transport/mdstr_hash_table.c', 'src/core/lib/transport/metadata.c', 'src/core/lib/transport/metadata_batch.c', + 'src/core/lib/transport/pid_controller.c', 'src/core/lib/transport/static_metadata.c', 'src/core/lib/transport/timeout_encoding.c', 'src/core/lib/transport/transport.c', diff --git a/build.yaml b/build.yaml index 2a06653103..73fb2b0bab 100644 --- a/build.yaml +++ b/build.yaml @@ -246,6 +246,7 @@ filegroups: - src/core/lib/transport/mdstr_hash_table.h - src/core/lib/transport/metadata.h - src/core/lib/transport/metadata_batch.h + - src/core/lib/transport/pid_controller.h - src/core/lib/transport/static_metadata.h - src/core/lib/transport/timeout_encoding.h - src/core/lib/transport/transport.h @@ -340,6 +341,7 @@ filegroups: - src/core/lib/transport/mdstr_hash_table.c - src/core/lib/transport/metadata.c - src/core/lib/transport/metadata_batch.c + - src/core/lib/transport/pid_controller.c - src/core/lib/transport/static_metadata.c - src/core/lib/transport/timeout_encoding.c - src/core/lib/transport/transport.c @@ -2554,6 +2556,16 @@ targets: - grpc - gpr_test_util - gpr +- name: transport_pid_controller_test + build: test + language: c + src: + - test/core/transport/pid_controller_test.c + deps: + - grpc_test_util + - grpc + - gpr_test_util + - gpr - name: transport_security_test build: test language: c diff --git a/config.m4 b/config.m4 index d8716753b6..1c6dc4aa24 100644 --- a/config.m4 +++ b/config.m4 @@ -173,6 +173,7 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/transport/mdstr_hash_table.c \ src/core/lib/transport/metadata.c \ src/core/lib/transport/metadata_batch.c \ + src/core/lib/transport/pid_controller.c \ src/core/lib/transport/static_metadata.c \ src/core/lib/transport/timeout_encoding.c \ src/core/lib/transport/transport.c \ diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index bb1bbc5f0e..17618bc175 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -329,6 +329,7 @@ Pod::Spec.new do |s| 'src/core/lib/transport/mdstr_hash_table.h', 'src/core/lib/transport/metadata.h', 'src/core/lib/transport/metadata_batch.h', + 'src/core/lib/transport/pid_controller.h', 'src/core/lib/transport/static_metadata.h', 'src/core/lib/transport/timeout_encoding.h', 'src/core/lib/transport/transport.h', @@ -505,6 +506,7 @@ Pod::Spec.new do |s| 'src/core/lib/transport/mdstr_hash_table.c', 'src/core/lib/transport/metadata.c', 'src/core/lib/transport/metadata_batch.c', + 'src/core/lib/transport/pid_controller.c', 'src/core/lib/transport/static_metadata.c', 'src/core/lib/transport/timeout_encoding.c', 'src/core/lib/transport/transport.c', @@ -706,6 +708,7 @@ Pod::Spec.new do |s| 'src/core/lib/transport/mdstr_hash_table.h', 'src/core/lib/transport/metadata.h', 'src/core/lib/transport/metadata_batch.h', + 'src/core/lib/transport/pid_controller.h', 'src/core/lib/transport/static_metadata.h', 'src/core/lib/transport/timeout_encoding.h', 'src/core/lib/transport/transport.h', diff --git a/grpc.gemspec b/grpc.gemspec index 85172922cc..c114157062 100755 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -249,6 +249,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/transport/mdstr_hash_table.h ) s.files += %w( src/core/lib/transport/metadata.h ) s.files += %w( src/core/lib/transport/metadata_batch.h ) + s.files += %w( src/core/lib/transport/pid_controller.h ) s.files += %w( src/core/lib/transport/static_metadata.h ) s.files += %w( src/core/lib/transport/timeout_encoding.h ) s.files += %w( src/core/lib/transport/transport.h ) @@ -425,6 +426,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/transport/mdstr_hash_table.c ) s.files += %w( src/core/lib/transport/metadata.c ) s.files += %w( src/core/lib/transport/metadata_batch.c ) + s.files += %w( src/core/lib/transport/pid_controller.c ) s.files += %w( src/core/lib/transport/static_metadata.c ) s.files += %w( src/core/lib/transport/timeout_encoding.c ) s.files += %w( src/core/lib/transport/transport.c ) diff --git a/package.xml b/package.xml index 31a2822a75..23a6f06fec 100644 --- a/package.xml +++ b/package.xml @@ -256,6 +256,7 @@ + @@ -432,6 +433,7 @@ + diff --git a/src/core/lib/transport/pid_controller.c b/src/core/lib/transport/pid_controller.c index a661116916..3cef225d4b 100644 --- a/src/core/lib/transport/pid_controller.c +++ b/src/core/lib/transport/pid_controller.c @@ -51,7 +51,7 @@ double grpc_pid_controller_update(grpc_pid_controller *pid_controller, pid_controller->error_integral += error * dt; double diff_error = (error - pid_controller->last_error) / dt; pid_controller->last_error = error; - return pid_controller->gain_p * error + - pid_controller->gain_i * pid_controller->error_integral + - pid_controller->gain_d * diff_error; + return dt * (pid_controller->gain_p * error + + pid_controller->gain_i * pid_controller->error_integral + + pid_controller->gain_d * diff_error); } diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index a40edfb090..015f774326 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -167,6 +167,7 @@ CORE_SOURCE_FILES = [ 'src/core/lib/transport/mdstr_hash_table.c', 'src/core/lib/transport/metadata.c', 'src/core/lib/transport/metadata_batch.c', + 'src/core/lib/transport/pid_controller.c', 'src/core/lib/transport/static_metadata.c', 'src/core/lib/transport/timeout_encoding.c', 'src/core/lib/transport/transport.c', diff --git a/test/core/transport/pid_controller_test.c b/test/core/transport/pid_controller_test.c new file mode 100644 index 0000000000..9614983b00 --- /dev/null +++ b/test/core/transport/pid_controller_test.c @@ -0,0 +1,77 @@ +/* + * + * Copyright 2016, 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 "src/core/lib/transport/pid_controller.h" + +#include + +#include +#include +#include +#include +#include "src/core/lib/support/string.h" +#include "test/core/util/test_config.h" + +static void test_noop(void) { + gpr_log(GPR_INFO, "test_noop"); + grpc_pid_controller pid; + grpc_pid_controller_init(&pid, 1, 1, 1); +} + +static void test_simple_convergence(double gain_p, double gain_i, double gain_d, + double dt, double set_point, double start) { + gpr_log(GPR_INFO, + "test_simple_convergence(p=%lf, i=%lf, d=%lf); dt=%lf set_point=%lf " + "start=%lf", + gain_p, gain_i, gain_d, dt, set_point, start); + grpc_pid_controller pid; + grpc_pid_controller_init(&pid, 0.2, 0.1, 0.1); + + double current = start; + + for (int i = 0; i < 1000; i++) { + current += grpc_pid_controller_update(&pid, set_point - current, 1); + } + + GPR_ASSERT(fabs(set_point - current) < 0.1); + GPR_ASSERT(fabs(pid.error_integral) < 0.1); +} + +int main(int argc, char **argv) { + grpc_test_init(argc, argv); + test_noop(); + test_simple_convergence(0.2, 0, 0, 1, 100, 0); + test_simple_convergence(0.2, 0.1, 0, 1, 100, 0); + test_simple_convergence(0.2, 0.1, 0.1, 1, 100, 0); + return 0; +} diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index e5c91cbb13..2cc0468802 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -866,6 +866,7 @@ src/core/lib/transport/connectivity_state.h \ src/core/lib/transport/mdstr_hash_table.h \ src/core/lib/transport/metadata.h \ src/core/lib/transport/metadata_batch.h \ +src/core/lib/transport/pid_controller.h \ src/core/lib/transport/static_metadata.h \ src/core/lib/transport/timeout_encoding.h \ src/core/lib/transport/transport.h \ @@ -1042,6 +1043,7 @@ src/core/lib/transport/connectivity_state.c \ src/core/lib/transport/mdstr_hash_table.c \ src/core/lib/transport/metadata.c \ src/core/lib/transport/metadata_batch.c \ +src/core/lib/transport/pid_controller.c \ src/core/lib/transport/static_metadata.c \ src/core/lib/transport/timeout_encoding.c \ src/core/lib/transport/transport.c \ diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index 7cfb1d4c17..df000be0e0 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -2011,6 +2011,23 @@ "third_party": false, "type": "target" }, + { + "deps": [ + "gpr", + "gpr_test_util", + "grpc", + "grpc_test_util" + ], + "headers": [], + "is_filegroup": false, + "language": "c", + "name": "transport_pid_controller_test", + "src": [ + "test/core/transport/pid_controller_test.c" + ], + "third_party": false, + "type": "target" + }, { "deps": [ "gpr", @@ -6519,6 +6536,7 @@ "src/core/lib/transport/mdstr_hash_table.h", "src/core/lib/transport/metadata.h", "src/core/lib/transport/metadata_batch.h", + "src/core/lib/transport/pid_controller.h", "src/core/lib/transport/static_metadata.h", "src/core/lib/transport/timeout_encoding.h", "src/core/lib/transport/transport.h", @@ -6704,6 +6722,8 @@ "src/core/lib/transport/metadata.h", "src/core/lib/transport/metadata_batch.c", "src/core/lib/transport/metadata_batch.h", + "src/core/lib/transport/pid_controller.c", + "src/core/lib/transport/pid_controller.h", "src/core/lib/transport/static_metadata.c", "src/core/lib/transport/static_metadata.h", "src/core/lib/transport/timeout_encoding.c", diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json index d831d6df0c..ec07eceec7 100644 --- a/tools/run_tests/tests.json +++ b/tools/run_tests/tests.json @@ -2002,6 +2002,27 @@ "windows" ] }, + { + "args": [], + "ci_platforms": [ + "linux", + "mac", + "posix", + "windows" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "gtest": false, + "language": "c", + "name": "transport_pid_controller_test", + "platforms": [ + "linux", + "mac", + "posix", + "windows" + ] + }, { "args": [], "ci_platforms": [ diff --git a/vsprojects/buildtests_c.sln b/vsprojects/buildtests_c.sln index 339b42f9d7..265179d7e7 100644 --- a/vsprojects/buildtests_c.sln +++ b/vsprojects/buildtests_c.sln @@ -1507,6 +1507,17 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "transport_metadata_test", " {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "transport_pid_controller_test", "vcxproj\test\transport_pid_controller_test\transport_pid_controller_test.vcxproj", "{B8790A2E-1106-2510-9D95-32C1D68E72EE}" + ProjectSection(myProperties) = preProject + lib = "False" + EndProjectSection + ProjectSection(ProjectDependencies) = postProject + {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} = {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} + {29D16885-7228-4C31-81ED-5F9187C7F2A9} = {29D16885-7228-4C31-81ED-5F9187C7F2A9} + {EAB0A629-17A9-44DB-B5FF-E91A721FE037} = {EAB0A629-17A9-44DB-B5FF-E91A721FE037} + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + EndProjectSection +EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unknown_frame_bad_client_test", "vcxproj\test\unknown_frame_bad_client_test\unknown_frame_bad_client_test.vcxproj", "{9E0A2239-20D5-DB2D-CA0D-69F24E3416E7}" ProjectSection(myProperties) = preProject lib = "False" @@ -3810,6 +3821,22 @@ Global {89A119C5-0F62-33B8-5D08-1FAA29DA7DEB}.Release-DLL|Win32.Build.0 = Release|Win32 {89A119C5-0F62-33B8-5D08-1FAA29DA7DEB}.Release-DLL|x64.ActiveCfg = Release|x64 {89A119C5-0F62-33B8-5D08-1FAA29DA7DEB}.Release-DLL|x64.Build.0 = Release|x64 + {B8790A2E-1106-2510-9D95-32C1D68E72EE}.Debug|Win32.ActiveCfg = Debug|Win32 + {B8790A2E-1106-2510-9D95-32C1D68E72EE}.Debug|x64.ActiveCfg = Debug|x64 + {B8790A2E-1106-2510-9D95-32C1D68E72EE}.Release|Win32.ActiveCfg = Release|Win32 + {B8790A2E-1106-2510-9D95-32C1D68E72EE}.Release|x64.ActiveCfg = Release|x64 + {B8790A2E-1106-2510-9D95-32C1D68E72EE}.Debug|Win32.Build.0 = Debug|Win32 + {B8790A2E-1106-2510-9D95-32C1D68E72EE}.Debug|x64.Build.0 = Debug|x64 + {B8790A2E-1106-2510-9D95-32C1D68E72EE}.Release|Win32.Build.0 = Release|Win32 + {B8790A2E-1106-2510-9D95-32C1D68E72EE}.Release|x64.Build.0 = Release|x64 + {B8790A2E-1106-2510-9D95-32C1D68E72EE}.Debug-DLL|Win32.ActiveCfg = Debug|Win32 + {B8790A2E-1106-2510-9D95-32C1D68E72EE}.Debug-DLL|Win32.Build.0 = Debug|Win32 + {B8790A2E-1106-2510-9D95-32C1D68E72EE}.Debug-DLL|x64.ActiveCfg = Debug|x64 + {B8790A2E-1106-2510-9D95-32C1D68E72EE}.Debug-DLL|x64.Build.0 = Debug|x64 + {B8790A2E-1106-2510-9D95-32C1D68E72EE}.Release-DLL|Win32.ActiveCfg = Release|Win32 + {B8790A2E-1106-2510-9D95-32C1D68E72EE}.Release-DLL|Win32.Build.0 = Release|Win32 + {B8790A2E-1106-2510-9D95-32C1D68E72EE}.Release-DLL|x64.ActiveCfg = Release|x64 + {B8790A2E-1106-2510-9D95-32C1D68E72EE}.Release-DLL|x64.Build.0 = Release|x64 {9E0A2239-20D5-DB2D-CA0D-69F24E3416E7}.Debug|Win32.ActiveCfg = Debug|Win32 {9E0A2239-20D5-DB2D-CA0D-69F24E3416E7}.Debug|x64.ActiveCfg = Debug|x64 {9E0A2239-20D5-DB2D-CA0D-69F24E3416E7}.Release|Win32.ActiveCfg = Release|Win32 diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj b/vsprojects/vcxproj/grpc/grpc.vcxproj index b8c0049db5..4ce0487981 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj @@ -375,6 +375,7 @@ + @@ -643,6 +644,8 @@ + + diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters index fb1f904811..d00d223638 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters @@ -271,6 +271,9 @@ src\core\lib\transport + + src\core\lib\transport + src\core\lib\transport @@ -914,6 +917,9 @@ src\core\lib\transport + + src\core\lib\transport + src\core\lib\transport diff --git a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj index eb3a94df64..eab3b72155 100644 --- a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj +++ b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj @@ -268,6 +268,7 @@ + @@ -490,6 +491,8 @@ + + diff --git a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters index fcc8e34db3..4da9b087fa 100644 --- a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters @@ -325,6 +325,9 @@ src\core\lib\transport + + src\core\lib\transport + src\core\lib\transport @@ -698,6 +701,9 @@ src\core\lib\transport + + src\core\lib\transport + src\core\lib\transport diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj index 519d7317ba..5cf6e2c8c3 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj @@ -365,6 +365,7 @@ + @@ -611,6 +612,8 @@ + + diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters index d30df5c03d..414dedb9ff 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters @@ -274,6 +274,9 @@ src\core\lib\transport + + src\core\lib\transport + src\core\lib\transport @@ -824,6 +827,9 @@ src\core\lib\transport + + src\core\lib\transport + src\core\lib\transport diff --git a/vsprojects/vcxproj/test/transport_pid_controller_test/transport_pid_controller_test.vcxproj b/vsprojects/vcxproj/test/transport_pid_controller_test/transport_pid_controller_test.vcxproj new file mode 100644 index 0000000000..b37310d7b0 --- /dev/null +++ b/vsprojects/vcxproj/test/transport_pid_controller_test/transport_pid_controller_test.vcxproj @@ -0,0 +1,199 @@ + + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {B8790A2E-1106-2510-9D95-32C1D68E72EE} + true + $(SolutionDir)IntDir\$(MSBuildProjectName)\ + + + + v100 + + + v110 + + + v120 + + + v140 + + + Application + true + Unicode + + + Application + false + true + Unicode + + + + + + + + + + + + + + transport_pid_controller_test + static + Debug + static + Debug + + + transport_pid_controller_test + static + Release + static + Release + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + MultiThreadedDebug + true + None + false + + + Console + true + false + + + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + MultiThreadedDebug + true + None + false + + + Console + true + false + + + + + + NotUsing + Level3 + MaxSpeed + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + true + true + MultiThreaded + true + None + false + + + Console + true + false + true + true + + + + + + NotUsing + Level3 + MaxSpeed + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + true + true + MultiThreaded + true + None + false + + + Console + true + false + true + true + + + + + + + + + + {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} + + + {29D16885-7228-4C31-81ED-5F9187C7F2A9} + + + {EAB0A629-17A9-44DB-B5FF-E91A721FE037} + + + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + diff --git a/vsprojects/vcxproj/test/transport_pid_controller_test/transport_pid_controller_test.vcxproj.filters b/vsprojects/vcxproj/test/transport_pid_controller_test/transport_pid_controller_test.vcxproj.filters new file mode 100644 index 0000000000..bfc3b8baf1 --- /dev/null +++ b/vsprojects/vcxproj/test/transport_pid_controller_test/transport_pid_controller_test.vcxproj.filters @@ -0,0 +1,21 @@ + + + + + test\core\transport + + + + + + {dd5fb527-8567-108a-e6d2-51380df8a82f} + + + {18437a81-c8a9-fd37-ad74-63e9ebf0eb7a} + + + {6325372c-19b9-37ab-e8ff-16554de3bb3b} + + + + -- cgit v1.2.3 From df1da9ffc0be338742481b4e1a5e2a20c04e3d99 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Sun, 30 Oct 2016 22:10:18 -0700 Subject: Convert validate_host_override_string into a function and rename into get_host_override_string --- test/core/end2end/end2end_nosec_tests.c | 4 ++++ test/core/end2end/end2end_tests.c | 4 ++++ test/core/end2end/end2end_tests.h | 5 ++--- test/core/end2end/tests/binary_metadata.c | 4 ++-- test/core/end2end/tests/call_creds.c | 4 ++-- test/core/end2end/tests/cancel_after_accept.c | 4 ++-- test/core/end2end/tests/cancel_after_client_done.c | 4 ++-- test/core/end2end/tests/cancel_after_invoke.c | 4 ++-- test/core/end2end/tests/cancel_before_invoke.c | 4 ++-- test/core/end2end/tests/cancel_in_a_vacuum.c | 4 ++-- test/core/end2end/tests/cancel_with_status.c | 4 ++-- test/core/end2end/tests/compressed_payload.c | 4 ++-- test/core/end2end/tests/disappearing_server.c | 4 ++-- test/core/end2end/tests/empty_batch.c | 4 ++-- test/core/end2end/tests/filter_call_init_fails.c | 4 ++-- test/core/end2end/tests/filter_causes_close.c | 4 ++-- test/core/end2end/tests/graceful_server_shutdown.c | 4 ++-- test/core/end2end/tests/high_initial_seqno.c | 4 ++-- test/core/end2end/tests/hpack_size.c | 4 ++-- test/core/end2end/tests/idempotent_request.c | 4 ++-- test/core/end2end/tests/invoke_large_request.c | 4 ++-- test/core/end2end/tests/large_metadata.c | 4 ++-- test/core/end2end/tests/load_reporting_hook.c | 4 ++-- test/core/end2end/tests/max_concurrent_streams.c | 4 ++-- test/core/end2end/tests/max_message_length.c | 4 ++-- test/core/end2end/tests/negative_deadline.c | 4 ++-- test/core/end2end/tests/network_status_change.c | 4 ++-- test/core/end2end/tests/no_logging.c | 4 ++-- test/core/end2end/tests/payload.c | 4 ++-- test/core/end2end/tests/ping_pong_streaming.c | 4 ++-- test/core/end2end/tests/registered_call.c | 4 ++-- test/core/end2end/tests/request_with_flags.c | 4 ++-- test/core/end2end/tests/request_with_payload.c | 4 ++-- test/core/end2end/tests/server_finishes_request.c | 4 ++-- test/core/end2end/tests/shutdown_finishes_calls.c | 4 ++-- test/core/end2end/tests/simple_cacheable_request.c | 4 ++-- test/core/end2end/tests/simple_delayed_request.c | 4 ++-- test/core/end2end/tests/simple_metadata.c | 4 ++-- test/core/end2end/tests/simple_request.c | 4 ++-- test/core/end2end/tests/streaming_error_response.c | 4 ++-- test/core/end2end/tests/trailing_metadata.c | 4 ++-- 41 files changed, 86 insertions(+), 79 deletions(-) (limited to 'test') diff --git a/test/core/end2end/end2end_nosec_tests.c b/test/core/end2end/end2end_nosec_tests.c index a630262197..00ee3ef9bc 100644 --- a/test/core/end2end/end2end_nosec_tests.c +++ b/test/core/end2end/end2end_nosec_tests.c @@ -408,3 +408,7 @@ void grpc_end2end_tests(int argc, char **argv, abort(); } } + +const char *get_host_override_string(const char *str, grpc_end2end_test_config config) { + return (config.feature_mask & FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER ? str : NULL); +} diff --git a/test/core/end2end/end2end_tests.c b/test/core/end2end/end2end_tests.c index 925872a71f..9ec3b6f3fa 100644 --- a/test/core/end2end/end2end_tests.c +++ b/test/core/end2end/end2end_tests.c @@ -416,3 +416,7 @@ void grpc_end2end_tests(int argc, char **argv, abort(); } } + +const char *get_host_override_string(const char *str, grpc_end2end_test_config config) { + return (config.feature_mask & FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER ? str : NULL); +} diff --git a/test/core/end2end/end2end_tests.h b/test/core/end2end/end2end_tests.h index 6380b96f33..d1758063a7 100644 --- a/test/core/end2end/end2end_tests.h +++ b/test/core/end2end/end2end_tests.h @@ -47,9 +47,6 @@ typedef struct grpc_end2end_test_config grpc_end2end_test_config; #define FAIL_AUTH_CHECK_SERVER_ARG_NAME "fail_auth_check" -#define validate_host_override_string(str, config) \ - ((config).feature_mask & FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER ? (str) : NULL) - struct grpc_end2end_test_fixture { grpc_completion_queue *cq; grpc_server *server; @@ -72,4 +69,6 @@ struct grpc_end2end_test_config { void grpc_end2end_tests_pre_init(void); void grpc_end2end_tests(int argc, char **argv, grpc_end2end_test_config config); +const char *get_host_override_string(const char *str, grpc_end2end_test_config config); + #endif /* GRPC_TEST_CORE_END2END_END2END_TESTS_H */ diff --git a/test/core/end2end/tests/binary_metadata.c b/test/core/end2end/tests/binary_metadata.c index c5c862bbf2..357b182fca 100644 --- a/test/core/end2end/tests/binary_metadata.c +++ b/test/core/end2end/tests/binary_metadata.c @@ -43,7 +43,7 @@ #include #include "test/core/end2end/cq_verifier.h" -static char *authority; +static const char *authority; static void *tag(intptr_t t) { return (void *)t; } @@ -290,7 +290,7 @@ static void test_request_response_with_metadata_and_payload( } void binary_metadata(grpc_end2end_test_config config) { - authority = validate_host_override_string("foo.test.google.fr", config); + authority = get_host_override_string("foo.test.google.fr", config); test_request_response_with_metadata_and_payload(config); } diff --git a/test/core/end2end/tests/call_creds.c b/test/core/end2end/tests/call_creds.c index ab8efa488b..ae3c3e7795 100644 --- a/test/core/end2end/tests/call_creds.c +++ b/test/core/end2end/tests/call_creds.c @@ -51,7 +51,7 @@ static const char iam_selector[] = "selector"; static const char overridden_iam_token[] = "overridden_token"; static const char overridden_iam_selector[] = "overridden_selector"; -static char *authority; +static const char *authority; typedef enum { NONE, OVERRIDE, DESTROY } override_mode; @@ -475,7 +475,7 @@ static void test_request_with_server_rejecting_client_creds( void call_creds(grpc_end2end_test_config config) { if (config.feature_mask & FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS) { - authority = validate_host_override_string("foo.test.google.fr", config); + authority = get_host_override_string("foo.test.google.fr", config); test_request_response_with_payload_and_call_creds(config); test_request_response_with_payload_and_overridden_call_creds(config); test_request_response_with_payload_and_deleted_call_creds(config); diff --git a/test/core/end2end/tests/cancel_after_accept.c b/test/core/end2end/tests/cancel_after_accept.c index dd1d5bcf46..238e603633 100644 --- a/test/core/end2end/tests/cancel_after_accept.c +++ b/test/core/end2end/tests/cancel_after_accept.c @@ -44,7 +44,7 @@ #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/tests/cancel_test_helpers.h" -static void *authority; +static const char *authority; static void *tag(intptr_t t) { return (void *)t; } @@ -231,7 +231,7 @@ static void test_cancel_after_accept(grpc_end2end_test_config config, void cancel_after_accept(grpc_end2end_test_config config) { unsigned i; - authority = validate_host_override_string("foo.test.google.fr", config); + authority = get_host_override_string("foo.test.google.fr", config); for (i = 0; i < GPR_ARRAY_SIZE(cancellation_modes); i++) { test_cancel_after_accept(config, cancellation_modes[i]); } diff --git a/test/core/end2end/tests/cancel_after_client_done.c b/test/core/end2end/tests/cancel_after_client_done.c index 90a84d1d0f..91b2589441 100644 --- a/test/core/end2end/tests/cancel_after_client_done.c +++ b/test/core/end2end/tests/cancel_after_client_done.c @@ -44,7 +44,7 @@ #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/tests/cancel_test_helpers.h" -static char *authority; +static const char *authority; static void *tag(intptr_t t) { return (void *)t; } @@ -235,7 +235,7 @@ static void test_cancel_after_accept_and_writes_closed( void cancel_after_client_done(grpc_end2end_test_config config) { unsigned i; - authority = validate_host_override_string("foo.test.google.fr", config); + authority = get_host_override_string("foo.test.google.fr", config); for (i = 0; i < GPR_ARRAY_SIZE(cancellation_modes); i++) { test_cancel_after_accept_and_writes_closed(config, cancellation_modes[i]); } diff --git a/test/core/end2end/tests/cancel_after_invoke.c b/test/core/end2end/tests/cancel_after_invoke.c index 346e41edae..b10a8756d4 100644 --- a/test/core/end2end/tests/cancel_after_invoke.c +++ b/test/core/end2end/tests/cancel_after_invoke.c @@ -44,7 +44,7 @@ #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/tests/cancel_test_helpers.h" -static char *authority; +static const char *authority; static void *tag(intptr_t t) { return (void *)t; } @@ -194,7 +194,7 @@ static void test_cancel_after_invoke(grpc_end2end_test_config config, void cancel_after_invoke(grpc_end2end_test_config config) { unsigned i, j; - authority = validate_host_override_string("foo.test.google.fr", config); + authority = get_host_override_string("foo.test.google.fr", config); for (j = 2; j < 6; j++) { for (i = 0; i < GPR_ARRAY_SIZE(cancellation_modes); i++) { test_cancel_after_invoke(config, cancellation_modes[i], j); diff --git a/test/core/end2end/tests/cancel_before_invoke.c b/test/core/end2end/tests/cancel_before_invoke.c index b446264f9d..e97ddd63ca 100644 --- a/test/core/end2end/tests/cancel_before_invoke.c +++ b/test/core/end2end/tests/cancel_before_invoke.c @@ -43,7 +43,7 @@ #include #include "test/core/end2end/cq_verifier.h" -static char *authority; +static const char *authority; static void *tag(intptr_t t) { return (void *)t; } @@ -191,7 +191,7 @@ static void test_cancel_before_invoke(grpc_end2end_test_config config, void cancel_before_invoke(grpc_end2end_test_config config) { size_t i; - authority = validate_host_override_string("foo.test.google.fr", config); + authority = get_host_override_string("foo.test.google.fr", config); for (i = 1; i <= 6; i++) { test_cancel_before_invoke(config, i); } diff --git a/test/core/end2end/tests/cancel_in_a_vacuum.c b/test/core/end2end/tests/cancel_in_a_vacuum.c index 02e5fa555d..f78d4cc891 100644 --- a/test/core/end2end/tests/cancel_in_a_vacuum.c +++ b/test/core/end2end/tests/cancel_in_a_vacuum.c @@ -44,7 +44,7 @@ #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/tests/cancel_test_helpers.h" -static char *authority; +static const char *authority; static void *tag(intptr_t t) { return (void *)t; } @@ -123,7 +123,7 @@ static void test_cancel_in_a_vacuum(grpc_end2end_test_config config, void cancel_in_a_vacuum(grpc_end2end_test_config config) { unsigned i; - authority = validate_host_override_string("foo.test.google.fr", config); + authority = get_host_override_string("foo.test.google.fr", config); for (i = 0; i < GPR_ARRAY_SIZE(cancellation_modes); i++) { test_cancel_in_a_vacuum(config, cancellation_modes[i]); } diff --git a/test/core/end2end/tests/cancel_with_status.c b/test/core/end2end/tests/cancel_with_status.c index 4ab4f1e92f..ebd7cb216f 100644 --- a/test/core/end2end/tests/cancel_with_status.c +++ b/test/core/end2end/tests/cancel_with_status.c @@ -45,7 +45,7 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" -static char *authority; +static const char *authority; static void *tag(intptr_t t) { return (void *)t; } @@ -178,7 +178,7 @@ static void test_invoke_simple_request(grpc_end2end_test_config config, void cancel_with_status(grpc_end2end_test_config config) { size_t i; - authority = validate_host_override_string("foo.test.google.fr:1234", config); + authority = get_host_override_string("foo.test.google.fr:1234", config); for (i = 1; i <= 4; i++) { test_invoke_simple_request(config, i); } diff --git a/test/core/end2end/tests/compressed_payload.c b/test/core/end2end/tests/compressed_payload.c index 7a9d9a706b..4607940e6c 100644 --- a/test/core/end2end/tests/compressed_payload.c +++ b/test/core/end2end/tests/compressed_payload.c @@ -50,7 +50,7 @@ #include "src/core/lib/surface/call_test_only.h" #include "test/core/end2end/cq_verifier.h" -static char *authority; +static const char *authority; static void *tag(intptr_t t) { return (void *)t; } @@ -600,7 +600,7 @@ static void test_invoke_request_with_disabled_algorithm( } void compressed_payload(grpc_end2end_test_config config) { - authority = validate_host_override_string("foo.test.google.fr", config); + authority = get_host_override_string("foo.test.google.fr", config); test_invoke_request_with_exceptionally_uncompressed_payload(config); test_invoke_request_with_uncompressed_payload(config); test_invoke_request_with_compressed_payload(config); diff --git a/test/core/end2end/tests/disappearing_server.c b/test/core/end2end/tests/disappearing_server.c index 624e148785..a934a9e5fe 100644 --- a/test/core/end2end/tests/disappearing_server.c +++ b/test/core/end2end/tests/disappearing_server.c @@ -43,7 +43,7 @@ #include #include "test/core/end2end/cq_verifier.h" -static char *authority; +static const char *authority; static void *tag(intptr_t t) { return (void *)t; } @@ -213,7 +213,7 @@ static void disappearing_server_test(grpc_end2end_test_config config) { } void disappearing_server(grpc_end2end_test_config config) { - authority = validate_host_override_string("foo.test.google.fr:1234", config); + authority = get_host_override_string("foo.test.google.fr:1234", config); GPR_ASSERT(config.feature_mask & FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION); disappearing_server_test(config); } diff --git a/test/core/end2end/tests/empty_batch.c b/test/core/end2end/tests/empty_batch.c index 230ee204f8..146f83b080 100644 --- a/test/core/end2end/tests/empty_batch.c +++ b/test/core/end2end/tests/empty_batch.c @@ -45,7 +45,7 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" -static char *authority; +static const char *authority; static void *tag(intptr_t t) { return (void *)t; } @@ -130,7 +130,7 @@ static void test_invoke_empty_body(grpc_end2end_test_config config) { } void empty_batch(grpc_end2end_test_config config) { - authority = validate_host_override_string("foo.test.google.fr", config); + authority = get_host_override_string("foo.test.google.fr", config); test_invoke_empty_body(config); } diff --git a/test/core/end2end/tests/filter_call_init_fails.c b/test/core/end2end/tests/filter_call_init_fails.c index 6569110c67..892e92e764 100644 --- a/test/core/end2end/tests/filter_call_init_fails.c +++ b/test/core/end2end/tests/filter_call_init_fails.c @@ -49,7 +49,7 @@ enum { TIMEOUT = 200000 }; -static char *authority; +static const char *authority; static bool g_enable_filter = false; @@ -265,7 +265,7 @@ static void init_plugin(void) { static void destroy_plugin(void) {} void filter_call_init_fails(grpc_end2end_test_config config) { - authority = validate_host_override_string("foo.test.google.fr", config); + authority = get_host_override_string("foo.test.google.fr", config); g_enable_filter = true; test_request(config); g_enable_filter = false; diff --git a/test/core/end2end/tests/filter_causes_close.c b/test/core/end2end/tests/filter_causes_close.c index c8a94c440c..163dbf87f0 100644 --- a/test/core/end2end/tests/filter_causes_close.c +++ b/test/core/end2end/tests/filter_causes_close.c @@ -46,7 +46,7 @@ #include "src/core/lib/surface/channel_init.h" #include "test/core/end2end/cq_verifier.h" -static char *authority; +static const char *authority; static bool g_enable_filter = false; @@ -284,7 +284,7 @@ static void init_plugin(void) { static void destroy_plugin(void) {} void filter_causes_close(grpc_end2end_test_config config) { - authority = validate_host_override_string("foo.test.google.fr", config); + authority = get_host_override_string("foo.test.google.fr", config); g_enable_filter = true; test_request(config); g_enable_filter = false; diff --git a/test/core/end2end/tests/graceful_server_shutdown.c b/test/core/end2end/tests/graceful_server_shutdown.c index 4c5ecb9f5c..5204c90b27 100644 --- a/test/core/end2end/tests/graceful_server_shutdown.c +++ b/test/core/end2end/tests/graceful_server_shutdown.c @@ -43,7 +43,7 @@ #include #include "test/core/end2end/cq_verifier.h" -static char *authority; +static const char *authority; static void *tag(intptr_t t) { return (void *)t; } @@ -212,7 +212,7 @@ static void test_early_server_shutdown_finishes_inflight_calls( } void graceful_server_shutdown(grpc_end2end_test_config config) { - authority = validate_host_override_string("foo.test.google.fr", config); + authority = get_host_override_string("foo.test.google.fr", config); test_early_server_shutdown_finishes_inflight_calls(config); } diff --git a/test/core/end2end/tests/high_initial_seqno.c b/test/core/end2end/tests/high_initial_seqno.c index 4a0d59f326..b9cfbd8b71 100644 --- a/test/core/end2end/tests/high_initial_seqno.c +++ b/test/core/end2end/tests/high_initial_seqno.c @@ -47,7 +47,7 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" -static char *authority; +static const char *authority; static void *tag(intptr_t t) { return (void *)t; } @@ -241,7 +241,7 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config, } void high_initial_seqno(grpc_end2end_test_config config) { - authority = validate_host_override_string("foo.test.google.fr:1234", config); + authority = get_host_override_string("foo.test.google.fr:1234", config); test_invoke_10_simple_requests(config, 16777213); if (config.feature_mask & FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION) { test_invoke_10_simple_requests(config, 2147483645); diff --git a/test/core/end2end/tests/hpack_size.c b/test/core/end2end/tests/hpack_size.c index 80513e764c..5b23d6b1e7 100644 --- a/test/core/end2end/tests/hpack_size.c +++ b/test/core/end2end/tests/hpack_size.c @@ -47,7 +47,7 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" -static char *authority; +static const char *authority; static void *tag(intptr_t t) { return (void *)t; } @@ -398,7 +398,7 @@ void hpack_size(grpc_end2end_test_config config) { 1000, 32768, 4 * 1024 * 1024}; size_t i, j; - authority = validate_host_override_string("foo.test.google.fr:1234", config); + authority = get_host_override_string("foo.test.google.fr:1234", config); for (i = 0; i < GPR_ARRAY_SIZE(interesting_sizes); i++) { for (j = 0; j < GPR_ARRAY_SIZE(interesting_sizes); j++) { test_size(config, interesting_sizes[i], interesting_sizes[j]); diff --git a/test/core/end2end/tests/idempotent_request.c b/test/core/end2end/tests/idempotent_request.c index 6582eaf034..5b02e4410a 100644 --- a/test/core/end2end/tests/idempotent_request.c +++ b/test/core/end2end/tests/idempotent_request.c @@ -45,7 +45,7 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" -static char *authority; +static const char *authority; static void *tag(intptr_t t) { return (void *)t; } @@ -244,7 +244,7 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config) { void idempotent_request(grpc_end2end_test_config config) { int i; - authority = validate_host_override_string("foo.test.google.fr:1234", config); + authority = get_host_override_string("foo.test.google.fr:1234", config); for (i = 0; i < 10; i++) { test_invoke_simple_request(config); } diff --git a/test/core/end2end/tests/invoke_large_request.c b/test/core/end2end/tests/invoke_large_request.c index b807c94564..c55bac4830 100644 --- a/test/core/end2end/tests/invoke_large_request.c +++ b/test/core/end2end/tests/invoke_large_request.c @@ -44,7 +44,7 @@ #include #include "test/core/end2end/cq_verifier.h" -static char *authority; +static const char *authority; static void *tag(intptr_t t) { return (void *)t; } @@ -274,7 +274,7 @@ static void test_invoke_large_request(grpc_end2end_test_config config, } void invoke_large_request(grpc_end2end_test_config config) { - authority = validate_host_override_string("foo.test.google.fr", config); + authority = get_host_override_string("foo.test.google.fr", config); test_invoke_large_request(config, 16384, 65536); test_invoke_large_request(config, 32768, 65536); diff --git a/test/core/end2end/tests/large_metadata.c b/test/core/end2end/tests/large_metadata.c index c0819d090a..b19b6f8b80 100644 --- a/test/core/end2end/tests/large_metadata.c +++ b/test/core/end2end/tests/large_metadata.c @@ -43,7 +43,7 @@ #include #include "test/core/end2end/cq_verifier.h" -static char *authority; +static const char *authority; static void *tag(intptr_t t) { return (void *)t; } @@ -257,7 +257,7 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { } void large_metadata(grpc_end2end_test_config config) { - authority = validate_host_override_string("foo.test.google.fr", config); + authority = get_host_override_string("foo.test.google.fr", config); test_request_with_large_metadata(config); } diff --git a/test/core/end2end/tests/load_reporting_hook.c b/test/core/end2end/tests/load_reporting_hook.c index e8bbbd9725..1f353ce7c9 100644 --- a/test/core/end2end/tests/load_reporting_hook.c +++ b/test/core/end2end/tests/load_reporting_hook.c @@ -48,7 +48,7 @@ #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/transport/static_metadata.h" -static char *authority; +static const char *authority; enum { TIMEOUT = 200000 }; @@ -316,7 +316,7 @@ static void test_load_reporting_hook(grpc_end2end_test_config config) { } void load_reporting_hook(grpc_end2end_test_config config) { - authority = validate_host_override_string("foo.test.google.fr", config); + authority = get_host_override_string("foo.test.google.fr", config); test_load_reporting_hook(config); } diff --git a/test/core/end2end/tests/max_concurrent_streams.c b/test/core/end2end/tests/max_concurrent_streams.c index c6f634c457..707be0950a 100644 --- a/test/core/end2end/tests/max_concurrent_streams.c +++ b/test/core/end2end/tests/max_concurrent_streams.c @@ -43,7 +43,7 @@ #include #include "test/core/end2end/cq_verifier.h" -static char *authority; +static const char *authority; static void *tag(intptr_t t) { return (void *)t; } @@ -441,7 +441,7 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { } void max_concurrent_streams(grpc_end2end_test_config config) { - authority = validate_host_override_string("foo.test.google.fr:1234", config); + authority = get_host_override_string("foo.test.google.fr:1234", config); test_max_concurrent_streams(config); } diff --git a/test/core/end2end/tests/max_message_length.c b/test/core/end2end/tests/max_message_length.c index eb1fc440f7..62e4cb35db 100644 --- a/test/core/end2end/tests/max_message_length.c +++ b/test/core/end2end/tests/max_message_length.c @@ -43,7 +43,7 @@ #include #include "test/core/end2end/cq_verifier.h" -static char *authority; +static const char *authority; static void *tag(intptr_t t) { return (void *)t; } @@ -397,7 +397,7 @@ static void test_max_message_length_on_response(grpc_end2end_test_config config, } void max_message_length(grpc_end2end_test_config config) { - authority = validate_host_override_string("foo.test.google.fr:1234", config); + authority = get_host_override_string("foo.test.google.fr:1234", config); test_max_message_length_on_request(config, false /* send_limit */); test_max_message_length_on_request(config, true /* send_limit */); test_max_message_length_on_response(config, false /* send_limit */); diff --git a/test/core/end2end/tests/negative_deadline.c b/test/core/end2end/tests/negative_deadline.c index ec45841e5f..a715c434bd 100644 --- a/test/core/end2end/tests/negative_deadline.c +++ b/test/core/end2end/tests/negative_deadline.c @@ -45,7 +45,7 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" -static char *authority; +static const char *authority; static void *tag(intptr_t t) { return (void *)t; } @@ -175,7 +175,7 @@ static void test_invoke_simple_request(grpc_end2end_test_config config, void negative_deadline(grpc_end2end_test_config config) { size_t i; - authority = validate_host_override_string("foo.test.google.fr:1234", config); + authority = get_host_override_string("foo.test.google.fr:1234", config); for (i = 1; i <= 4; i++) { test_invoke_simple_request(config, i); } diff --git a/test/core/end2end/tests/network_status_change.c b/test/core/end2end/tests/network_status_change.c index 7bf003cb4a..b55bebbf0f 100644 --- a/test/core/end2end/tests/network_status_change.c +++ b/test/core/end2end/tests/network_status_change.c @@ -43,7 +43,7 @@ #include #include "test/core/end2end/cq_verifier.h" -static char *authority; +static const char *authority; /* this is a private API but exposed here for testing*/ extern void grpc_network_status_shutdown_all_endpoints(); @@ -238,7 +238,7 @@ static void test_invoke_network_status_change(grpc_end2end_test_config config) { } void network_status_change(grpc_end2end_test_config config) { - authority = validate_host_override_string("foo.test.google.fr", config); + authority = get_host_override_string("foo.test.google.fr", config); test_invoke_network_status_change(config); } diff --git a/test/core/end2end/tests/no_logging.c b/test/core/end2end/tests/no_logging.c index 0ddb4a5a05..e299abe599 100644 --- a/test/core/end2end/tests/no_logging.c +++ b/test/core/end2end/tests/no_logging.c @@ -47,7 +47,7 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" -static char *authority; +static const char *authority; enum { TIMEOUT = 200000 }; @@ -296,7 +296,7 @@ static void test_no_logging_in_one_request(grpc_end2end_test_config config) { } void no_logging(grpc_end2end_test_config config) { - authority = validate_host_override_string("foo.test.google.fr:1234", config); + authority = get_host_override_string("foo.test.google.fr:1234", config); gpr_set_log_function(log_dispatcher_func); test_no_logging_in_one_request(config); test_no_error_logging_in_entire_process(config); diff --git a/test/core/end2end/tests/payload.c b/test/core/end2end/tests/payload.c index 292a92eeb8..9d593617ed 100644 --- a/test/core/end2end/tests/payload.c +++ b/test/core/end2end/tests/payload.c @@ -43,7 +43,7 @@ #include #include "test/core/end2end/cq_verifier.h" -static char *authority; +static const char *authority; static void *tag(intptr_t t) { return (void *)t; } @@ -270,7 +270,7 @@ static void test_invoke_10_request_response_with_payload( } void payload(grpc_end2end_test_config config) { - authority = validate_host_override_string("foo.test.google.fr", config); + authority = get_host_override_string("foo.test.google.fr", config); test_invoke_request_response_with_payload(config); test_invoke_10_request_response_with_payload(config); } diff --git a/test/core/end2end/tests/ping_pong_streaming.c b/test/core/end2end/tests/ping_pong_streaming.c index 46fa0063f3..f53a288890 100644 --- a/test/core/end2end/tests/ping_pong_streaming.c +++ b/test/core/end2end/tests/ping_pong_streaming.c @@ -43,7 +43,7 @@ #include #include "test/core/end2end/cq_verifier.h" -static char *authority; +static const char *authority; static void *tag(intptr_t t) { return (void *)t; } @@ -277,7 +277,7 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, void ping_pong_streaming(grpc_end2end_test_config config) { int i; - authority = validate_host_override_string("foo.test.google.fr:1234", config); + authority = get_host_override_string("foo.test.google.fr:1234", config); for (i = 1; i < 10; i++) { test_pingpong_streaming(config, i); } diff --git a/test/core/end2end/tests/registered_call.c b/test/core/end2end/tests/registered_call.c index d710b9e56f..fd1557a5d9 100644 --- a/test/core/end2end/tests/registered_call.c +++ b/test/core/end2end/tests/registered_call.c @@ -45,7 +45,7 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" -static char *authority; +static const char *authority; static void *tag(intptr_t t) { return (void *)t; } @@ -230,7 +230,7 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config) { } void registered_call(grpc_end2end_test_config config) { - authority = validate_host_override_string("foo.test.google.fr:1234", config); + authority = get_host_override_string("foo.test.google.fr:1234", config); test_invoke_simple_request(config); test_invoke_10_simple_requests(config); } diff --git a/test/core/end2end/tests/request_with_flags.c b/test/core/end2end/tests/request_with_flags.c index 623def9fd3..1ef0dbeb3f 100644 --- a/test/core/end2end/tests/request_with_flags.c +++ b/test/core/end2end/tests/request_with_flags.c @@ -44,7 +44,7 @@ #include "src/core/lib/transport/byte_stream.h" #include "test/core/end2end/cq_verifier.h" -static char *authority; +static const char *authority; static void *tag(intptr_t t) { return (void *)t; } @@ -188,7 +188,7 @@ static void test_invoke_request_with_flags( void request_with_flags(grpc_end2end_test_config config) { size_t i; - authority = validate_host_override_string("foo.test.google.fr", config); + authority = get_host_override_string("foo.test.google.fr", config); uint32_t flags_for_op[GRPC_OP_RECV_CLOSE_ON_SERVER + 1]; { diff --git a/test/core/end2end/tests/request_with_payload.c b/test/core/end2end/tests/request_with_payload.c index a0da85496d..9cbe9869f8 100644 --- a/test/core/end2end/tests/request_with_payload.c +++ b/test/core/end2end/tests/request_with_payload.c @@ -43,7 +43,7 @@ #include #include "test/core/end2end/cq_verifier.h" -static char *authority; +static const char *authority; static void *tag(intptr_t t) { return (void *)t; } @@ -235,7 +235,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { } void request_with_payload(grpc_end2end_test_config config) { - authority = validate_host_override_string("foo.test.google.fr", config); + authority = get_host_override_string("foo.test.google.fr", config); test_invoke_request_with_payload(config); } diff --git a/test/core/end2end/tests/server_finishes_request.c b/test/core/end2end/tests/server_finishes_request.c index a824e6e1e4..a85e9d425b 100644 --- a/test/core/end2end/tests/server_finishes_request.c +++ b/test/core/end2end/tests/server_finishes_request.c @@ -45,7 +45,7 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" -static char *authority; +static const char *authority; static void *tag(intptr_t t) { return (void *)t; } @@ -211,7 +211,7 @@ static void test_invoke_simple_request(grpc_end2end_test_config config) { } void server_finishes_request(grpc_end2end_test_config config) { - authority = validate_host_override_string("foo.test.google.fr:1234", config); + authority = get_host_override_string("foo.test.google.fr:1234", config); test_invoke_simple_request(config); } diff --git a/test/core/end2end/tests/shutdown_finishes_calls.c b/test/core/end2end/tests/shutdown_finishes_calls.c index f08d0f2e10..62fe068fa9 100644 --- a/test/core/end2end/tests/shutdown_finishes_calls.c +++ b/test/core/end2end/tests/shutdown_finishes_calls.c @@ -43,7 +43,7 @@ #include #include "test/core/end2end/cq_verifier.h" -static char *authority; +static const char *authority; static void *tag(intptr_t t) { return (void *)t; } @@ -194,7 +194,7 @@ static void test_early_server_shutdown_finishes_inflight_calls( } void shutdown_finishes_calls(grpc_end2end_test_config config) { - authority = validate_host_override_string("foo.test.google.fr", config); + authority = get_host_override_string("foo.test.google.fr", config); test_early_server_shutdown_finishes_inflight_calls(config); } diff --git a/test/core/end2end/tests/simple_cacheable_request.c b/test/core/end2end/tests/simple_cacheable_request.c index 997177cd4a..c1fef2768c 100644 --- a/test/core/end2end/tests/simple_cacheable_request.c +++ b/test/core/end2end/tests/simple_cacheable_request.c @@ -43,7 +43,7 @@ #include #include "test/core/end2end/cq_verifier.h" -static char *authority; +static const char *authority; enum { TIMEOUT = 200000 }; @@ -274,7 +274,7 @@ static void test_cacheable_request_response_with_metadata_and_payload( } void simple_cacheable_request(grpc_end2end_test_config config) { - authority = validate_host_override_string("foo.test.google.fr", config); + authority = get_host_override_string("foo.test.google.fr", config); test_cacheable_request_response_with_metadata_and_payload(config); } diff --git a/test/core/end2end/tests/simple_delayed_request.c b/test/core/end2end/tests/simple_delayed_request.c index b21fafa845..b76a53eb68 100644 --- a/test/core/end2end/tests/simple_delayed_request.c +++ b/test/core/end2end/tests/simple_delayed_request.c @@ -43,7 +43,7 @@ #include #include "test/core/end2end/cq_verifier.h" -static char *authority; +static const char *authority; static void *tag(intptr_t t) { return (void *)t; } @@ -221,7 +221,7 @@ static void test_simple_delayed_request_long(grpc_end2end_test_config config) { } void simple_delayed_request(grpc_end2end_test_config config) { - authority = validate_host_override_string("foo.test.google.fr", config); + authority = get_host_override_string("foo.test.google.fr", config); GPR_ASSERT(config.feature_mask & FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION); test_simple_delayed_request_short(config); test_simple_delayed_request_long(config); diff --git a/test/core/end2end/tests/simple_metadata.c b/test/core/end2end/tests/simple_metadata.c index a115ae665c..ede19b6a14 100644 --- a/test/core/end2end/tests/simple_metadata.c +++ b/test/core/end2end/tests/simple_metadata.c @@ -43,7 +43,7 @@ #include #include "test/core/end2end/cq_verifier.h" -static char *authority; +static const char *authority; static void *tag(intptr_t t) { return (void *)t; } @@ -266,7 +266,7 @@ static void test_request_response_with_metadata_and_payload( } void simple_metadata(grpc_end2end_test_config config) { - authority = validate_host_override_string("foo.test.google.fr", config); + authority = get_host_override_string("foo.test.google.fr", config); test_request_response_with_metadata_and_payload(config); } diff --git a/test/core/end2end/tests/simple_request.c b/test/core/end2end/tests/simple_request.c index 8c311d3e7a..bdda097878 100644 --- a/test/core/end2end/tests/simple_request.c +++ b/test/core/end2end/tests/simple_request.c @@ -45,7 +45,7 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" -static char *authority; +static const char *authority; static void *tag(intptr_t t) { return (void *)t; } @@ -244,7 +244,7 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config) { void simple_request(grpc_end2end_test_config config) { int i; - authority = validate_host_override_string("foo.test.google.fr:1234", config); + authority = get_host_override_string("foo.test.google.fr:1234", config); for (i = 0; i < 10; i++) { test_invoke_simple_request(config); } diff --git a/test/core/end2end/tests/streaming_error_response.c b/test/core/end2end/tests/streaming_error_response.c index 13b7a372dd..2eaa4a4d1b 100644 --- a/test/core/end2end/tests/streaming_error_response.c +++ b/test/core/end2end/tests/streaming_error_response.c @@ -43,7 +43,7 @@ #include #include "test/core/end2end/cq_verifier.h" -static char *authority; +static const char *authority; static void *tag(intptr_t t) { return (void *)t; } @@ -273,7 +273,7 @@ static void test(grpc_end2end_test_config config, bool request_status_early) { } void streaming_error_response(grpc_end2end_test_config config) { - authority = validate_host_override_string("foo.test.google.fr", config); + authority = get_host_override_string("foo.test.google.fr", config); test(config, false); test(config, true); } diff --git a/test/core/end2end/tests/trailing_metadata.c b/test/core/end2end/tests/trailing_metadata.c index 11af60ffdd..892a424777 100644 --- a/test/core/end2end/tests/trailing_metadata.c +++ b/test/core/end2end/tests/trailing_metadata.c @@ -43,7 +43,7 @@ #include #include "test/core/end2end/cq_verifier.h" -static char *authority; +static const char *authority; static void *tag(intptr_t t) { return (void *)t; } @@ -271,7 +271,7 @@ static void test_request_response_with_metadata_and_payload( } void trailing_metadata(grpc_end2end_test_config config) { - authority = validate_host_override_string("foo.test.google.fr", config); + authority = get_host_override_string("foo.test.google.fr", config); test_request_response_with_metadata_and_payload(config); } -- cgit v1.2.3 From 56456c38e070aa07bbef7748b46cacfae5d3c671 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Sun, 30 Oct 2016 23:11:11 -0700 Subject: Use get_host_override_string function inline --- test/core/end2end/tests/binary_metadata.c | 5 +---- test/core/end2end/tests/call_creds.c | 7 ++----- test/core/end2end/tests/cancel_after_accept.c | 5 +---- test/core/end2end/tests/cancel_after_client_done.c | 5 +---- test/core/end2end/tests/cancel_after_invoke.c | 5 +---- test/core/end2end/tests/cancel_before_invoke.c | 5 +---- test/core/end2end/tests/cancel_in_a_vacuum.c | 5 +---- test/core/end2end/tests/cancel_with_status.c | 9 +++------ test/core/end2end/tests/compressed_payload.c | 7 ++----- test/core/end2end/tests/disappearing_server.c | 12 +++++------- test/core/end2end/tests/empty_batch.c | 10 ++++------ test/core/end2end/tests/filter_call_init_fails.c | 5 +---- test/core/end2end/tests/filter_causes_close.c | 5 +---- test/core/end2end/tests/graceful_server_shutdown.c | 5 +---- test/core/end2end/tests/high_initial_seqno.c | 10 ++++------ test/core/end2end/tests/hpack_size.c | 9 +++------ test/core/end2end/tests/idempotent_request.c | 11 ++++------- test/core/end2end/tests/invoke_large_request.c | 5 +---- test/core/end2end/tests/large_metadata.c | 5 +---- test/core/end2end/tests/load_reporting_hook.c | 11 ++++------- test/core/end2end/tests/max_concurrent_streams.c | 16 +++++++--------- test/core/end2end/tests/max_message_length.c | 5 +---- test/core/end2end/tests/negative_deadline.c | 9 +++------ test/core/end2end/tests/network_status_change.c | 5 +---- test/core/end2end/tests/no_logging.c | 17 +++++++---------- test/core/end2end/tests/payload.c | 11 ++++------- test/core/end2end/tests/ping_pong_streaming.c | 5 +---- test/core/end2end/tests/registered_call.c | 7 ++----- test/core/end2end/tests/request_with_flags.c | 5 +---- test/core/end2end/tests/request_with_payload.c | 5 +---- test/core/end2end/tests/server_finishes_request.c | 9 +++------ test/core/end2end/tests/shutdown_finishes_calls.c | 5 +---- test/core/end2end/tests/simple_cacheable_request.c | 5 +---- test/core/end2end/tests/simple_delayed_request.c | 5 +---- test/core/end2end/tests/simple_metadata.c | 5 +---- test/core/end2end/tests/simple_request.c | 11 ++++------- test/core/end2end/tests/streaming_error_response.c | 5 +---- test/core/end2end/tests/trailing_metadata.c | 5 +---- 38 files changed, 83 insertions(+), 193 deletions(-) (limited to 'test') diff --git a/test/core/end2end/tests/binary_metadata.c b/test/core/end2end/tests/binary_metadata.c index 357b182fca..f2038d7cbc 100644 --- a/test/core/end2end/tests/binary_metadata.c +++ b/test/core/end2end/tests/binary_metadata.c @@ -43,8 +43,6 @@ #include #include "test/core/end2end/cq_verifier.h" -static const char *authority; - static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -149,7 +147,7 @@ static void test_request_response_with_metadata_and_payload( int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, NULL); + "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -290,7 +288,6 @@ static void test_request_response_with_metadata_and_payload( } void binary_metadata(grpc_end2end_test_config config) { - authority = get_host_override_string("foo.test.google.fr", config); test_request_response_with_metadata_and_payload(config); } diff --git a/test/core/end2end/tests/call_creds.c b/test/core/end2end/tests/call_creds.c index ae3c3e7795..027c5fdfd5 100644 --- a/test/core/end2end/tests/call_creds.c +++ b/test/core/end2end/tests/call_creds.c @@ -51,8 +51,6 @@ static const char iam_selector[] = "selector"; static const char overridden_iam_token[] = "overridden_token"; static const char overridden_iam_selector[] = "overridden_selector"; -static const char *authority; - typedef enum { NONE, OVERRIDE, DESTROY } override_mode; static void *tag(intptr_t t) { return (void *)t; } @@ -167,7 +165,7 @@ static void request_response_with_payload_and_call_creds( cqv = cq_verifier_create(f.cq); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, NULL); + "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c); creds = grpc_google_iam_credentials_create(iam_token, iam_selector, NULL); GPR_ASSERT(creds != NULL); @@ -402,7 +400,7 @@ static void test_request_with_server_rejecting_client_creds( cqv = cq_verifier_create(f.cq); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, NULL); + "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c); creds = grpc_google_iam_credentials_create(iam_token, iam_selector, NULL); @@ -475,7 +473,6 @@ static void test_request_with_server_rejecting_client_creds( void call_creds(grpc_end2end_test_config config) { if (config.feature_mask & FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS) { - authority = get_host_override_string("foo.test.google.fr", config); test_request_response_with_payload_and_call_creds(config); test_request_response_with_payload_and_overridden_call_creds(config); test_request_response_with_payload_and_deleted_call_creds(config); diff --git a/test/core/end2end/tests/cancel_after_accept.c b/test/core/end2end/tests/cancel_after_accept.c index 238e603633..010ad08812 100644 --- a/test/core/end2end/tests/cancel_after_accept.c +++ b/test/core/end2end/tests/cancel_after_accept.c @@ -44,8 +44,6 @@ #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/tests/cancel_test_helpers.h" -static const char *authority; - static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -128,7 +126,7 @@ static void test_cancel_after_accept(grpc_end2end_test_config config, int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, NULL); + "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -231,7 +229,6 @@ static void test_cancel_after_accept(grpc_end2end_test_config config, void cancel_after_accept(grpc_end2end_test_config config) { unsigned i; - authority = get_host_override_string("foo.test.google.fr", config); for (i = 0; i < GPR_ARRAY_SIZE(cancellation_modes); i++) { test_cancel_after_accept(config, cancellation_modes[i]); } diff --git a/test/core/end2end/tests/cancel_after_client_done.c b/test/core/end2end/tests/cancel_after_client_done.c index 91b2589441..7644658b19 100644 --- a/test/core/end2end/tests/cancel_after_client_done.c +++ b/test/core/end2end/tests/cancel_after_client_done.c @@ -44,8 +44,6 @@ #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/tests/cancel_test_helpers.h" -static const char *authority; - static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -128,7 +126,7 @@ static void test_cancel_after_accept_and_writes_closed( int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, NULL); + "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -235,7 +233,6 @@ static void test_cancel_after_accept_and_writes_closed( void cancel_after_client_done(grpc_end2end_test_config config) { unsigned i; - authority = get_host_override_string("foo.test.google.fr", config); for (i = 0; i < GPR_ARRAY_SIZE(cancellation_modes); i++) { test_cancel_after_accept_and_writes_closed(config, cancellation_modes[i]); } diff --git a/test/core/end2end/tests/cancel_after_invoke.c b/test/core/end2end/tests/cancel_after_invoke.c index b10a8756d4..1628f0d560 100644 --- a/test/core/end2end/tests/cancel_after_invoke.c +++ b/test/core/end2end/tests/cancel_after_invoke.c @@ -44,8 +44,6 @@ #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/tests/cancel_test_helpers.h" -static const char *authority; - static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -123,7 +121,7 @@ static void test_cancel_after_invoke(grpc_end2end_test_config config, grpc_raw_byte_buffer_create(&request_payload_slice, 1); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, NULL); + "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -194,7 +192,6 @@ static void test_cancel_after_invoke(grpc_end2end_test_config config, void cancel_after_invoke(grpc_end2end_test_config config) { unsigned i, j; - authority = get_host_override_string("foo.test.google.fr", config); for (j = 2; j < 6; j++) { for (i = 0; i < GPR_ARRAY_SIZE(cancellation_modes); i++) { test_cancel_after_invoke(config, cancellation_modes[i], j); diff --git a/test/core/end2end/tests/cancel_before_invoke.c b/test/core/end2end/tests/cancel_before_invoke.c index e97ddd63ca..7e1d4ca1fb 100644 --- a/test/core/end2end/tests/cancel_before_invoke.c +++ b/test/core/end2end/tests/cancel_before_invoke.c @@ -43,8 +43,6 @@ #include #include "test/core/end2end/cq_verifier.h" -static const char *authority; - static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -121,7 +119,7 @@ static void test_cancel_before_invoke(grpc_end2end_test_config config, grpc_raw_byte_buffer_create(&request_payload_slice, 1); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, NULL); + "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c); GPR_ASSERT(GRPC_CALL_OK == grpc_call_cancel(c, NULL)); @@ -191,7 +189,6 @@ static void test_cancel_before_invoke(grpc_end2end_test_config config, void cancel_before_invoke(grpc_end2end_test_config config) { size_t i; - authority = get_host_override_string("foo.test.google.fr", config); for (i = 1; i <= 6; i++) { test_cancel_before_invoke(config, i); } diff --git a/test/core/end2end/tests/cancel_in_a_vacuum.c b/test/core/end2end/tests/cancel_in_a_vacuum.c index f78d4cc891..780d693ac5 100644 --- a/test/core/end2end/tests/cancel_in_a_vacuum.c +++ b/test/core/end2end/tests/cancel_in_a_vacuum.c @@ -44,8 +44,6 @@ #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/tests/cancel_test_helpers.h" -static const char *authority; - static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -108,7 +106,7 @@ static void test_cancel_in_a_vacuum(grpc_end2end_test_config config, cq_verifier *v_client = cq_verifier_create(f.cq); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, NULL); + "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c); GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c, NULL)); @@ -123,7 +121,6 @@ static void test_cancel_in_a_vacuum(grpc_end2end_test_config config, void cancel_in_a_vacuum(grpc_end2end_test_config config) { unsigned i; - authority = get_host_override_string("foo.test.google.fr", config); for (i = 0; i < GPR_ARRAY_SIZE(cancellation_modes); i++) { test_cancel_in_a_vacuum(config, cancellation_modes[i]); } diff --git a/test/core/end2end/tests/cancel_with_status.c b/test/core/end2end/tests/cancel_with_status.c index ebd7cb216f..15de1eaaf7 100644 --- a/test/core/end2end/tests/cancel_with_status.c +++ b/test/core/end2end/tests/cancel_with_status.c @@ -45,8 +45,6 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" -static const char *authority; - static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -99,7 +97,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_destroy(f->cq); } -static void simple_request_body(grpc_end2end_test_fixture f, size_t num_ops) { +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); @@ -115,7 +113,7 @@ static void simple_request_body(grpc_end2end_test_fixture f, size_t num_ops) { gpr_log(GPR_DEBUG, "test with %" PRIuPTR " ops", num_ops); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, NULL); + "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -171,14 +169,13 @@ 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, num_ops); + simple_request_body(config, f, num_ops); end_test(&f); config.tear_down_data(&f); } void cancel_with_status(grpc_end2end_test_config config) { size_t i; - authority = get_host_override_string("foo.test.google.fr:1234", config); for (i = 1; i <= 4; i++) { test_invoke_simple_request(config, i); } diff --git a/test/core/end2end/tests/compressed_payload.c b/test/core/end2end/tests/compressed_payload.c index 4607940e6c..5925ce7b81 100644 --- a/test/core/end2end/tests/compressed_payload.c +++ b/test/core/end2end/tests/compressed_payload.c @@ -50,8 +50,6 @@ #include "src/core/lib/surface/call_test_only.h" #include "test/core/end2end/cq_verifier.h" -static const char *authority; - static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -149,7 +147,7 @@ static void request_for_disabled_algorithm( cqv = cq_verifier_create(f.cq); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, NULL); + "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -323,7 +321,7 @@ static void request_with_payload_template( cqv = cq_verifier_create(f.cq); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, NULL); + "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -600,7 +598,6 @@ static void test_invoke_request_with_disabled_algorithm( } void compressed_payload(grpc_end2end_test_config config) { - authority = get_host_override_string("foo.test.google.fr", config); test_invoke_request_with_exceptionally_uncompressed_payload(config); test_invoke_request_with_uncompressed_payload(config); test_invoke_request_with_compressed_payload(config); diff --git a/test/core/end2end/tests/disappearing_server.c b/test/core/end2end/tests/disappearing_server.c index a934a9e5fe..6b32b36d2c 100644 --- a/test/core/end2end/tests/disappearing_server.c +++ b/test/core/end2end/tests/disappearing_server.c @@ -43,8 +43,6 @@ #include #include "test/core/end2end/cq_verifier.h" -static const char *authority; - static void *tag(intptr_t t) { return (void *)t; } static gpr_timespec n_seconds_time(int n) { @@ -81,7 +79,8 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_destroy(f->cq); } -static void do_request_and_shutdown_server(grpc_end2end_test_fixture *f, +static void do_request_and_shutdown_server(grpc_end2end_test_config config, + grpc_end2end_test_fixture *f, cq_verifier *cqv) { grpc_call *c; grpc_call *s; @@ -99,7 +98,7 @@ static void do_request_and_shutdown_server(grpc_end2end_test_fixture *f, int was_cancelled = 2; c = grpc_channel_create_call(f->client, NULL, GRPC_PROPAGATE_DEFAULTS, f->cq, - "/foo", authority, deadline, NULL); + "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -199,12 +198,12 @@ static void disappearing_server_test(grpc_end2end_test_config config) { config.init_client(&f, NULL); config.init_server(&f, NULL); - do_request_and_shutdown_server(&f, cqv); + do_request_and_shutdown_server(config, &f, cqv); /* now destroy and recreate the server */ config.init_server(&f, NULL); - do_request_and_shutdown_server(&f, cqv); + do_request_and_shutdown_server(config, &f, cqv); cq_verifier_destroy(cqv); @@ -213,7 +212,6 @@ static void disappearing_server_test(grpc_end2end_test_config config) { } void disappearing_server(grpc_end2end_test_config config) { - authority = get_host_override_string("foo.test.google.fr:1234", config); GPR_ASSERT(config.feature_mask & FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION); disappearing_server_test(config); } diff --git a/test/core/end2end/tests/empty_batch.c b/test/core/end2end/tests/empty_batch.c index 146f83b080..580cbac67d 100644 --- a/test/core/end2end/tests/empty_batch.c +++ b/test/core/end2end/tests/empty_batch.c @@ -45,8 +45,6 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" -static const char *authority; - static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -99,7 +97,8 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_destroy(f->cq); } -static void empty_batch_body(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); @@ -107,7 +106,7 @@ static void empty_batch_body(grpc_end2end_test_fixture f) { grpc_op *op = NULL; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, NULL); + "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c); error = grpc_call_start_batch(c, op, 0, tag(1), NULL); @@ -124,13 +123,12 @@ static void test_invoke_empty_body(grpc_end2end_test_config config) { grpc_end2end_test_fixture f; f = begin_test(config, "test_invoke_empty_body", NULL, NULL); - empty_batch_body(f); + empty_batch_body(config, f); end_test(&f); config.tear_down_data(&f); } void empty_batch(grpc_end2end_test_config config) { - authority = get_host_override_string("foo.test.google.fr", config); test_invoke_empty_body(config); } diff --git a/test/core/end2end/tests/filter_call_init_fails.c b/test/core/end2end/tests/filter_call_init_fails.c index 892e92e764..4255e75814 100644 --- a/test/core/end2end/tests/filter_call_init_fails.c +++ b/test/core/end2end/tests/filter_call_init_fails.c @@ -49,8 +49,6 @@ enum { TIMEOUT = 200000 }; -static const char *authority; - static bool g_enable_filter = false; static void *tag(intptr_t t) { return (void *)t; } @@ -130,7 +128,7 @@ static void test_request(grpc_end2end_test_config config) { size_t details_capacity = 0; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, NULL); + "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -265,7 +263,6 @@ static void init_plugin(void) { static void destroy_plugin(void) {} void filter_call_init_fails(grpc_end2end_test_config config) { - authority = get_host_override_string("foo.test.google.fr", config); g_enable_filter = true; test_request(config); g_enable_filter = false; diff --git a/test/core/end2end/tests/filter_causes_close.c b/test/core/end2end/tests/filter_causes_close.c index 163dbf87f0..210c464cf1 100644 --- a/test/core/end2end/tests/filter_causes_close.c +++ b/test/core/end2end/tests/filter_causes_close.c @@ -46,8 +46,6 @@ #include "src/core/lib/surface/channel_init.h" #include "test/core/end2end/cq_verifier.h" -static const char *authority; - static bool g_enable_filter = false; static void *tag(intptr_t t) { return (void *)t; } @@ -126,7 +124,7 @@ static void test_request(grpc_end2end_test_config config) { size_t details_capacity = 0; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, NULL); + "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -284,7 +282,6 @@ static void init_plugin(void) { static void destroy_plugin(void) {} void filter_causes_close(grpc_end2end_test_config config) { - authority = get_host_override_string("foo.test.google.fr", config); g_enable_filter = true; test_request(config); g_enable_filter = false; diff --git a/test/core/end2end/tests/graceful_server_shutdown.c b/test/core/end2end/tests/graceful_server_shutdown.c index 5204c90b27..45892b8824 100644 --- a/test/core/end2end/tests/graceful_server_shutdown.c +++ b/test/core/end2end/tests/graceful_server_shutdown.c @@ -43,8 +43,6 @@ #include #include "test/core/end2end/cq_verifier.h" -static const char *authority; - static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -114,7 +112,7 @@ static void test_early_server_shutdown_finishes_inflight_calls( int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, NULL); + "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -212,7 +210,6 @@ static void test_early_server_shutdown_finishes_inflight_calls( } void graceful_server_shutdown(grpc_end2end_test_config config) { - authority = get_host_override_string("foo.test.google.fr", config); test_early_server_shutdown_finishes_inflight_calls(config); } diff --git a/test/core/end2end/tests/high_initial_seqno.c b/test/core/end2end/tests/high_initial_seqno.c index b9cfbd8b71..96d58d4787 100644 --- a/test/core/end2end/tests/high_initial_seqno.c +++ b/test/core/end2end/tests/high_initial_seqno.c @@ -47,8 +47,6 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" -static const char *authority; - static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -101,7 +99,8 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_destroy(f->cq); } -static void simple_request_body(grpc_end2end_test_fixture f) { +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(); @@ -119,7 +118,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, NULL); + "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -232,7 +231,7 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config, initial_sequence_number); f = begin_test(config, name, &client_args, NULL); for (i = 0; i < 10; i++) { - simple_request_body(f); + simple_request_body(config, f); gpr_log(GPR_INFO, "Passed simple request %d", i); } end_test(&f); @@ -241,7 +240,6 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config, } void high_initial_seqno(grpc_end2end_test_config config) { - authority = get_host_override_string("foo.test.google.fr:1234", config); test_invoke_10_simple_requests(config, 16777213); if (config.feature_mask & FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION) { test_invoke_10_simple_requests(config, 2147483645); diff --git a/test/core/end2end/tests/hpack_size.c b/test/core/end2end/tests/hpack_size.c index 5b23d6b1e7..c400134e1f 100644 --- a/test/core/end2end/tests/hpack_size.c +++ b/test/core/end2end/tests/hpack_size.c @@ -47,8 +47,6 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" -static const char *authority; - static void *tag(intptr_t t) { return (void *)t; } const char *hobbits[][2] = { @@ -241,7 +239,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_destroy(f->cq); } -static void simple_request_body(grpc_end2end_test_fixture f, size_t index) { +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(); @@ -271,7 +269,7 @@ static void simple_request_body(grpc_end2end_test_fixture f, size_t index) { extra_metadata[2].value_length = strlen(extra_metadata[2].value); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, NULL); + "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -386,7 +384,7 @@ static void test_size(grpc_end2end_test_config config, int encode_size, f = begin_test(config, name, encode_size != 4096 ? &client_args : NULL, decode_size != 4096 ? &server_args : NULL); for (i = 0; i < 4 * GPR_ARRAY_SIZE(hobbits); i++) { - simple_request_body(f, i); + simple_request_body(config, f, i); } end_test(&f); config.tear_down_data(&f); @@ -398,7 +396,6 @@ void hpack_size(grpc_end2end_test_config config) { 1000, 32768, 4 * 1024 * 1024}; size_t i, j; - authority = get_host_override_string("foo.test.google.fr:1234", config); for (i = 0; i < GPR_ARRAY_SIZE(interesting_sizes); i++) { for (j = 0; j < GPR_ARRAY_SIZE(interesting_sizes); j++) { test_size(config, interesting_sizes[i], interesting_sizes[j]); diff --git a/test/core/end2end/tests/idempotent_request.c b/test/core/end2end/tests/idempotent_request.c index 5b02e4410a..bbde35b5df 100644 --- a/test/core/end2end/tests/idempotent_request.c +++ b/test/core/end2end/tests/idempotent_request.c @@ -45,8 +45,6 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" -static const char *authority; - static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -99,7 +97,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_destroy(f->cq); } -static void simple_request_body(grpc_end2end_test_fixture f) { +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(); @@ -118,7 +116,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { char *peer; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, NULL); + "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c); peer = grpc_call_get_peer(c); @@ -225,7 +223,7 @@ 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); + simple_request_body(config, f); end_test(&f); config.tear_down_data(&f); } @@ -235,7 +233,7 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config) { 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); + simple_request_body(config, f); gpr_log(GPR_INFO, "Passed simple request %d", i); } end_test(&f); @@ -244,7 +242,6 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config) { void idempotent_request(grpc_end2end_test_config config) { int i; - authority = get_host_override_string("foo.test.google.fr:1234", config); for (i = 0; i < 10; i++) { test_invoke_simple_request(config); } diff --git a/test/core/end2end/tests/invoke_large_request.c b/test/core/end2end/tests/invoke_large_request.c index c55bac4830..67dc2c8f0a 100644 --- a/test/core/end2end/tests/invoke_large_request.c +++ b/test/core/end2end/tests/invoke_large_request.c @@ -44,8 +44,6 @@ #include #include "test/core/end2end/cq_verifier.h" -static const char *authority; - static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -147,7 +145,7 @@ static void test_invoke_large_request(grpc_end2end_test_config config, int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, NULL); + "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -274,7 +272,6 @@ static void test_invoke_large_request(grpc_end2end_test_config config, } void invoke_large_request(grpc_end2end_test_config config) { - authority = get_host_override_string("foo.test.google.fr", config); test_invoke_large_request(config, 16384, 65536); test_invoke_large_request(config, 32768, 65536); diff --git a/test/core/end2end/tests/large_metadata.c b/test/core/end2end/tests/large_metadata.c index b19b6f8b80..618e849770 100644 --- a/test/core/end2end/tests/large_metadata.c +++ b/test/core/end2end/tests/large_metadata.c @@ -43,8 +43,6 @@ #include #include "test/core/end2end/cq_verifier.h" -static const char *authority; - static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -128,7 +126,7 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, NULL); + "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c); meta.key = "key"; @@ -257,7 +255,6 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { } void large_metadata(grpc_end2end_test_config config) { - authority = get_host_override_string("foo.test.google.fr", config); test_request_with_large_metadata(config); } diff --git a/test/core/end2end/tests/load_reporting_hook.c b/test/core/end2end/tests/load_reporting_hook.c index 1f353ce7c9..652eedf717 100644 --- a/test/core/end2end/tests/load_reporting_hook.c +++ b/test/core/end2end/tests/load_reporting_hook.c @@ -48,8 +48,6 @@ #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/transport/static_metadata.h" -static const char *authority; - enum { TIMEOUT = 200000 }; static void *tag(intptr_t t) { return (void *)t; } @@ -123,7 +121,8 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_destroy(f->cq); } -static void request_response_with_payload(grpc_end2end_test_fixture f, +static void request_response_with_payload(grpc_end2end_test_config config, + grpc_end2end_test_fixture f, const char *method_name, const char *request_msg, const char *response_msg, @@ -154,7 +153,7 @@ static void request_response_with_payload(grpc_end2end_test_fixture f, int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - method_name, authority, deadline, NULL); + method_name, get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -308,15 +307,13 @@ static void test_load_reporting_hook(grpc_end2end_test_config config) { memset(&trailing_lr_metadata.internal_data, 0, sizeof(trailing_lr_metadata.internal_data)); - request_response_with_payload(f, method_name, request_msg, response_msg, - &initial_lr_metadata, &trailing_lr_metadata); + request_response_with_payload(config, f, method_name, request_msg, response_msg, &initial_lr_metadata, &trailing_lr_metadata); end_test(&f); grpc_channel_args_destroy(lr_server_args); config.tear_down_data(&f); } void load_reporting_hook(grpc_end2end_test_config config) { - authority = get_host_override_string("foo.test.google.fr", config); test_load_reporting_hook(config); } diff --git a/test/core/end2end/tests/max_concurrent_streams.c b/test/core/end2end/tests/max_concurrent_streams.c index 707be0950a..78c0237a66 100644 --- a/test/core/end2end/tests/max_concurrent_streams.c +++ b/test/core/end2end/tests/max_concurrent_streams.c @@ -43,8 +43,6 @@ #include #include "test/core/end2end/cq_verifier.h" -static const char *authority; - static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -97,7 +95,8 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_destroy(f->cq); } -static void simple_request_body(grpc_end2end_test_fixture f) { +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(); @@ -115,7 +114,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, NULL); + "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -253,18 +252,18 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { /* perform a ping-pong to ensure that settings have had a chance to round trip */ - simple_request_body(f); + simple_request_body(config, f); /* perform another one to make sure that the one stream case still works */ - simple_request_body(f); + simple_request_body(config, f); /* start two requests - ensuring that the second is not accepted until the first completes */ deadline = n_seconds_time(1000); c1 = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/alpha", authority, deadline, NULL); + "/alpha", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c1); c2 = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/beta", authority, deadline, NULL); + "/beta", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c2); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( @@ -441,7 +440,6 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { } void max_concurrent_streams(grpc_end2end_test_config config) { - authority = get_host_override_string("foo.test.google.fr:1234", config); test_max_concurrent_streams(config); } diff --git a/test/core/end2end/tests/max_message_length.c b/test/core/end2end/tests/max_message_length.c index 62e4cb35db..c98f52fed8 100644 --- a/test/core/end2end/tests/max_message_length.c +++ b/test/core/end2end/tests/max_message_length.c @@ -43,8 +43,6 @@ #include #include "test/core/end2end/cq_verifier.h" -static const char *authority; - static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -143,7 +141,7 @@ static void test_max_message_length_on_request(grpc_end2end_test_config config, cqv = cq_verifier_create(f.cq); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, + "/foo", get_host_override_string("foo.test.google.fr:1234", config), gpr_inf_future(GPR_CLOCK_REALTIME), NULL); GPR_ASSERT(c); @@ -397,7 +395,6 @@ static void test_max_message_length_on_response(grpc_end2end_test_config config, } void max_message_length(grpc_end2end_test_config config) { - authority = get_host_override_string("foo.test.google.fr:1234", config); test_max_message_length_on_request(config, false /* send_limit */); test_max_message_length_on_request(config, true /* send_limit */); test_max_message_length_on_response(config, false /* send_limit */); diff --git a/test/core/end2end/tests/negative_deadline.c b/test/core/end2end/tests/negative_deadline.c index a715c434bd..62490608fb 100644 --- a/test/core/end2end/tests/negative_deadline.c +++ b/test/core/end2end/tests/negative_deadline.c @@ -45,8 +45,6 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" -static const char *authority; - static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -99,7 +97,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_destroy(f->cq); } -static void simple_request_body(grpc_end2end_test_fixture f, size_t num_ops) { +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); @@ -115,7 +113,7 @@ static void simple_request_body(grpc_end2end_test_fixture f, size_t num_ops) { gpr_log(GPR_DEBUG, "test with %" PRIuPTR " ops", num_ops); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, NULL); + "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -168,14 +166,13 @@ 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, num_ops); + simple_request_body(config, f, num_ops); end_test(&f); config.tear_down_data(&f); } void negative_deadline(grpc_end2end_test_config config) { size_t i; - authority = get_host_override_string("foo.test.google.fr:1234", config); for (i = 1; i <= 4; i++) { test_invoke_simple_request(config, i); } diff --git a/test/core/end2end/tests/network_status_change.c b/test/core/end2end/tests/network_status_change.c index b55bebbf0f..bf02e6a9fc 100644 --- a/test/core/end2end/tests/network_status_change.c +++ b/test/core/end2end/tests/network_status_change.c @@ -43,8 +43,6 @@ #include #include "test/core/end2end/cq_verifier.h" -static const char *authority; - /* this is a private API but exposed here for testing*/ extern void grpc_network_status_shutdown_all_endpoints(); @@ -125,7 +123,7 @@ static void test_invoke_network_status_change(grpc_end2end_test_config config) { int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, NULL); + "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -238,7 +236,6 @@ static void test_invoke_network_status_change(grpc_end2end_test_config config) { } void network_status_change(grpc_end2end_test_config config) { - authority = get_host_override_string("foo.test.google.fr", config); test_invoke_network_status_change(config); } diff --git a/test/core/end2end/tests/no_logging.c b/test/core/end2end/tests/no_logging.c index e299abe599..99f2b46686 100644 --- a/test/core/end2end/tests/no_logging.c +++ b/test/core/end2end/tests/no_logging.c @@ -47,8 +47,6 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" -static const char *authority; - enum { TIMEOUT = 200000 }; static void *tag(intptr_t t) { return (void *)t; } @@ -127,7 +125,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_destroy(f->cq); } -static void simple_request_body(grpc_end2end_test_fixture f) { +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(); @@ -146,7 +144,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { char *peer; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, NULL); + "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c); peer = grpc_call_get_peer(c); @@ -251,7 +249,7 @@ static void test_invoke_simple_request(grpc_end2end_test_config config) { f = begin_test(config, "test_invoke_simple_request_with_no_error_logging", NULL, NULL); - simple_request_body(f); + simple_request_body(config, f); end_test(&f); config.tear_down_data(&f); } @@ -262,10 +260,10 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config) { begin_test(config, "test_invoke_10_simple_requests_with_no_error_logging", NULL, NULL); for (i = 0; i < 10; i++) { - simple_request_body(f); + simple_request_body(config, f); gpr_log(GPR_INFO, "Passed simple request %d", i); } - simple_request_body(f); + simple_request_body(config, f); end_test(&f); config.tear_down_data(&f); } @@ -286,17 +284,16 @@ static void test_no_logging_in_one_request(grpc_end2end_test_config config) { grpc_end2end_test_fixture f = begin_test(config, "test_no_logging_in_last_request", NULL, NULL); for (i = 0; i < 10; i++) { - simple_request_body(f); + simple_request_body(config, f); } gpr_atm_no_barrier_store(&g_log_func, (gpr_atm)test_no_log); - simple_request_body(f); + simple_request_body(config, f); gpr_atm_no_barrier_store(&g_log_func, (gpr_atm)gpr_default_log); end_test(&f); config.tear_down_data(&f); } void no_logging(grpc_end2end_test_config config) { - authority = get_host_override_string("foo.test.google.fr:1234", config); gpr_set_log_function(log_dispatcher_func); test_no_logging_in_one_request(config); test_no_error_logging_in_entire_process(config); diff --git a/test/core/end2end/tests/payload.c b/test/core/end2end/tests/payload.c index 9d593617ed..96a565db5a 100644 --- a/test/core/end2end/tests/payload.c +++ b/test/core/end2end/tests/payload.c @@ -43,8 +43,6 @@ #include #include "test/core/end2end/cq_verifier.h" -static const char *authority; - static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -97,7 +95,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_destroy(f->cq); } -static void request_response_with_payload(grpc_end2end_test_fixture f) { +static void request_response_with_payload(grpc_end2end_test_config config, grpc_end2end_test_fixture f) { gpr_slice request_payload_slice = gpr_slice_from_copied_string("hello world"); gpr_slice response_payload_slice = gpr_slice_from_copied_string("hello you"); grpc_call *c; @@ -123,7 +121,7 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) { int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, NULL); + "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -252,7 +250,7 @@ static void test_invoke_request_response_with_payload( grpc_end2end_test_config config) { grpc_end2end_test_fixture f = begin_test( config, "test_invoke_request_response_with_payload", NULL, NULL); - request_response_with_payload(f); + request_response_with_payload(config, f); end_test(&f); config.tear_down_data(&f); } @@ -263,14 +261,13 @@ static void test_invoke_10_request_response_with_payload( grpc_end2end_test_fixture f = begin_test( config, "test_invoke_10_request_response_with_payload", NULL, NULL); for (i = 0; i < 10; i++) { - request_response_with_payload(f); + request_response_with_payload(config, f); } end_test(&f); config.tear_down_data(&f); } void payload(grpc_end2end_test_config config) { - authority = get_host_override_string("foo.test.google.fr", config); test_invoke_request_response_with_payload(config); test_invoke_10_request_response_with_payload(config); } diff --git a/test/core/end2end/tests/ping_pong_streaming.c b/test/core/end2end/tests/ping_pong_streaming.c index f53a288890..a33ce5f862 100644 --- a/test/core/end2end/tests/ping_pong_streaming.c +++ b/test/core/end2end/tests/ping_pong_streaming.c @@ -43,8 +43,6 @@ #include #include "test/core/end2end/cq_verifier.h" -static const char *authority; - static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -126,7 +124,7 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, gpr_slice response_payload_slice = gpr_slice_from_copied_string("hello you"); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, NULL); + "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -277,7 +275,6 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, void ping_pong_streaming(grpc_end2end_test_config config) { int i; - authority = get_host_override_string("foo.test.google.fr:1234", config); for (i = 1; i < 10; i++) { test_pingpong_streaming(config, i); } diff --git a/test/core/end2end/tests/registered_call.c b/test/core/end2end/tests/registered_call.c index fd1557a5d9..05582f9682 100644 --- a/test/core/end2end/tests/registered_call.c +++ b/test/core/end2end/tests/registered_call.c @@ -45,8 +45,6 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" -static const char *authority; - static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -208,7 +206,7 @@ static void simple_request_body(grpc_end2end_test_fixture f, void *rc) { 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", authority, NULL); + void *rc = grpc_channel_register_call(f.client, "/foo", get_host_override_string("foo.test.google.fr:1234", config), NULL); simple_request_body(f, rc); end_test(&f); @@ -219,7 +217,7 @@ 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", authority, NULL); + void *rc = grpc_channel_register_call(f.client, "/foo", get_host_override_string("foo.test.google.fr:1234", config), NULL); for (i = 0; i < 10; i++) { simple_request_body(f, rc); @@ -230,7 +228,6 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config) { } void registered_call(grpc_end2end_test_config config) { - authority = get_host_override_string("foo.test.google.fr:1234", config); test_invoke_simple_request(config); test_invoke_10_simple_requests(config); } diff --git a/test/core/end2end/tests/request_with_flags.c b/test/core/end2end/tests/request_with_flags.c index 1ef0dbeb3f..c8489fb8c7 100644 --- a/test/core/end2end/tests/request_with_flags.c +++ b/test/core/end2end/tests/request_with_flags.c @@ -44,8 +44,6 @@ #include "src/core/lib/transport/byte_stream.h" #include "test/core/end2end/cq_verifier.h" -static const char *authority; - static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -123,7 +121,7 @@ static void test_invoke_request_with_flags( grpc_call_error expectation; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, NULL); + "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -188,7 +186,6 @@ static void test_invoke_request_with_flags( void request_with_flags(grpc_end2end_test_config config) { size_t i; - authority = get_host_override_string("foo.test.google.fr", config); uint32_t flags_for_op[GRPC_OP_RECV_CLOSE_ON_SERVER + 1]; { diff --git a/test/core/end2end/tests/request_with_payload.c b/test/core/end2end/tests/request_with_payload.c index 9cbe9869f8..5755d20fe5 100644 --- a/test/core/end2end/tests/request_with_payload.c +++ b/test/core/end2end/tests/request_with_payload.c @@ -43,8 +43,6 @@ #include #include "test/core/end2end/cq_verifier.h" -static const char *authority; - static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -122,7 +120,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, NULL); + "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -235,7 +233,6 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { } void request_with_payload(grpc_end2end_test_config config) { - authority = get_host_override_string("foo.test.google.fr", config); test_invoke_request_with_payload(config); } diff --git a/test/core/end2end/tests/server_finishes_request.c b/test/core/end2end/tests/server_finishes_request.c index a85e9d425b..313b0c3324 100644 --- a/test/core/end2end/tests/server_finishes_request.c +++ b/test/core/end2end/tests/server_finishes_request.c @@ -45,8 +45,6 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" -static const char *authority; - static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -99,7 +97,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_destroy(f->cq); } -static void simple_request_body(grpc_end2end_test_fixture f) { +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(); @@ -117,7 +115,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, NULL); + "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -205,13 +203,12 @@ 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); + simple_request_body(config, f); end_test(&f); config.tear_down_data(&f); } void server_finishes_request(grpc_end2end_test_config config) { - authority = get_host_override_string("foo.test.google.fr:1234", config); test_invoke_simple_request(config); } diff --git a/test/core/end2end/tests/shutdown_finishes_calls.c b/test/core/end2end/tests/shutdown_finishes_calls.c index 62fe068fa9..26d61f2dcf 100644 --- a/test/core/end2end/tests/shutdown_finishes_calls.c +++ b/test/core/end2end/tests/shutdown_finishes_calls.c @@ -43,8 +43,6 @@ #include #include "test/core/end2end/cq_verifier.h" -static const char *authority; - static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -107,7 +105,7 @@ static void test_early_server_shutdown_finishes_inflight_calls( int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, NULL); + "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -194,7 +192,6 @@ static void test_early_server_shutdown_finishes_inflight_calls( } void shutdown_finishes_calls(grpc_end2end_test_config config) { - authority = get_host_override_string("foo.test.google.fr", config); test_early_server_shutdown_finishes_inflight_calls(config); } diff --git a/test/core/end2end/tests/simple_cacheable_request.c b/test/core/end2end/tests/simple_cacheable_request.c index c1fef2768c..166ee638b9 100644 --- a/test/core/end2end/tests/simple_cacheable_request.c +++ b/test/core/end2end/tests/simple_cacheable_request.c @@ -43,8 +43,6 @@ #include #include "test/core/end2end/cq_verifier.h" -static const char *authority; - enum { TIMEOUT = 200000 }; static void *tag(intptr_t t) { return (void *)t; } @@ -136,7 +134,7 @@ static void test_cacheable_request_response_with_metadata_and_payload( int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, NULL); + "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -274,7 +272,6 @@ static void test_cacheable_request_response_with_metadata_and_payload( } void simple_cacheable_request(grpc_end2end_test_config config) { - authority = get_host_override_string("foo.test.google.fr", config); test_cacheable_request_response_with_metadata_and_payload(config); } diff --git a/test/core/end2end/tests/simple_delayed_request.c b/test/core/end2end/tests/simple_delayed_request.c index b76a53eb68..b19c798608 100644 --- a/test/core/end2end/tests/simple_delayed_request.c +++ b/test/core/end2end/tests/simple_delayed_request.c @@ -43,8 +43,6 @@ #include #include "test/core/end2end/cq_verifier.h" -static const char *authority; - static void *tag(intptr_t t) { return (void *)t; } static gpr_timespec n_seconds_time(int n) { @@ -109,7 +107,7 @@ static void simple_delayed_request_body(grpc_end2end_test_config config, config.init_client(f, client_args); c = grpc_channel_create_call(f->client, NULL, GRPC_PROPAGATE_DEFAULTS, f->cq, - "/foo", authority, deadline, NULL); + "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -221,7 +219,6 @@ static void test_simple_delayed_request_long(grpc_end2end_test_config config) { } void simple_delayed_request(grpc_end2end_test_config config) { - authority = get_host_override_string("foo.test.google.fr", config); GPR_ASSERT(config.feature_mask & FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION); test_simple_delayed_request_short(config); test_simple_delayed_request_long(config); diff --git a/test/core/end2end/tests/simple_metadata.c b/test/core/end2end/tests/simple_metadata.c index ede19b6a14..c8370b4b15 100644 --- a/test/core/end2end/tests/simple_metadata.c +++ b/test/core/end2end/tests/simple_metadata.c @@ -43,8 +43,6 @@ #include #include "test/core/end2end/cq_verifier.h" -static const char *authority; - static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -133,7 +131,7 @@ static void test_request_response_with_metadata_and_payload( int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, NULL); + "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -266,7 +264,6 @@ static void test_request_response_with_metadata_and_payload( } void simple_metadata(grpc_end2end_test_config config) { - authority = get_host_override_string("foo.test.google.fr", config); test_request_response_with_metadata_and_payload(config); } diff --git a/test/core/end2end/tests/simple_request.c b/test/core/end2end/tests/simple_request.c index bdda097878..a87a455a8d 100644 --- a/test/core/end2end/tests/simple_request.c +++ b/test/core/end2end/tests/simple_request.c @@ -45,8 +45,6 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" -static const char *authority; - static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -99,7 +97,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_destroy(f->cq); } -static void simple_request_body(grpc_end2end_test_fixture f) { +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(); @@ -118,7 +116,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { char *peer; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, NULL); + "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c); peer = grpc_call_get_peer(c); @@ -225,7 +223,7 @@ 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); + simple_request_body(config, f); end_test(&f); config.tear_down_data(&f); } @@ -235,7 +233,7 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config) { 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); + simple_request_body(config, f); gpr_log(GPR_INFO, "Passed simple request %d", i); } end_test(&f); @@ -244,7 +242,6 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config) { void simple_request(grpc_end2end_test_config config) { int i; - authority = get_host_override_string("foo.test.google.fr:1234", config); for (i = 0; i < 10; i++) { test_invoke_simple_request(config); } diff --git a/test/core/end2end/tests/streaming_error_response.c b/test/core/end2end/tests/streaming_error_response.c index 2eaa4a4d1b..b6167aa135 100644 --- a/test/core/end2end/tests/streaming_error_response.c +++ b/test/core/end2end/tests/streaming_error_response.c @@ -43,8 +43,6 @@ #include #include "test/core/end2end/cq_verifier.h" -static const char *authority; - static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -128,7 +126,7 @@ static void test(grpc_end2end_test_config config, bool request_status_early) { int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, NULL); + "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -273,7 +271,6 @@ static void test(grpc_end2end_test_config config, bool request_status_early) { } void streaming_error_response(grpc_end2end_test_config config) { - authority = get_host_override_string("foo.test.google.fr", config); test(config, false); test(config, true); } diff --git a/test/core/end2end/tests/trailing_metadata.c b/test/core/end2end/tests/trailing_metadata.c index 892a424777..39a90d17e1 100644 --- a/test/core/end2end/tests/trailing_metadata.c +++ b/test/core/end2end/tests/trailing_metadata.c @@ -43,8 +43,6 @@ #include #include "test/core/end2end/cq_verifier.h" -static const char *authority; - static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -136,7 +134,7 @@ static void test_request_response_with_metadata_and_payload( int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", authority, deadline, NULL); + "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -271,7 +269,6 @@ static void test_request_response_with_metadata_and_payload( } void trailing_metadata(grpc_end2end_test_config config) { - authority = get_host_override_string("foo.test.google.fr", config); test_request_response_with_metadata_and_payload(config); } -- cgit v1.2.3 From ea3b568b8fef498f6aeec4349702c588afe709da Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Sun, 30 Oct 2016 23:39:41 -0700 Subject: Put validation of host name in a function --- test/core/end2end/end2end_nosec_tests.c | 6 ++++++ test/core/end2end/end2end_tests.c | 6 ++++++ test/core/end2end/end2end_tests.h | 2 ++ test/core/end2end/tests/binary_metadata.c | 4 +--- test/core/end2end/tests/call_creds.c | 4 +--- test/core/end2end/tests/compressed_payload.c | 8 ++------ test/core/end2end/tests/disappearing_server.c | 4 +--- test/core/end2end/tests/graceful_server_shutdown.c | 4 +--- test/core/end2end/tests/high_initial_seqno.c | 4 +--- test/core/end2end/tests/hpack_size.c | 4 +--- test/core/end2end/tests/idempotent_request.c | 4 +--- test/core/end2end/tests/invoke_large_request.c | 4 +--- test/core/end2end/tests/large_metadata.c | 4 +--- test/core/end2end/tests/max_concurrent_streams.c | 4 +--- test/core/end2end/tests/max_message_length.c | 4 +--- test/core/end2end/tests/network_status_change.c | 4 +--- test/core/end2end/tests/no_logging.c | 4 +--- test/core/end2end/tests/payload.c | 4 +--- test/core/end2end/tests/registered_call.c | 10 ++++------ test/core/end2end/tests/request_with_payload.c | 4 +--- test/core/end2end/tests/server_finishes_request.c | 4 +--- test/core/end2end/tests/shutdown_finishes_calls.c | 4 +--- test/core/end2end/tests/simple_cacheable_request.c | 4 +--- test/core/end2end/tests/simple_delayed_request.c | 4 +--- test/core/end2end/tests/simple_metadata.c | 4 +--- test/core/end2end/tests/simple_request.c | 4 +--- test/core/end2end/tests/streaming_error_response.c | 4 +--- test/core/end2end/tests/trailing_metadata.c | 4 +--- 28 files changed, 43 insertions(+), 81 deletions(-) (limited to 'test') diff --git a/test/core/end2end/end2end_nosec_tests.c b/test/core/end2end/end2end_nosec_tests.c index 00ee3ef9bc..4cd424f8fe 100644 --- a/test/core/end2end/end2end_nosec_tests.c +++ b/test/core/end2end/end2end_nosec_tests.c @@ -412,3 +412,9 @@ void grpc_end2end_tests(int argc, char **argv, const char *get_host_override_string(const char *str, grpc_end2end_test_config config) { return (config.feature_mask & FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER ? str : NULL); } + +void validate_host_override_string(const char *pattern, const char *str, grpc_end2end_test_config config) { + if (config.feature_mask & FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER) { + GPR_ASSERT(0 == strcmp(str, pattern)); + } +} diff --git a/test/core/end2end/end2end_tests.c b/test/core/end2end/end2end_tests.c index 9ec3b6f3fa..d779e82e33 100644 --- a/test/core/end2end/end2end_tests.c +++ b/test/core/end2end/end2end_tests.c @@ -420,3 +420,9 @@ void grpc_end2end_tests(int argc, char **argv, const char *get_host_override_string(const char *str, grpc_end2end_test_config config) { return (config.feature_mask & FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER ? str : NULL); } + +void validate_host_override_string(const char *pattern, const char *str, grpc_end2end_test_config config) { + if (config.feature_mask & FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER) { + GPR_ASSERT(0 == strcmp(str, pattern)); + } +} diff --git a/test/core/end2end/end2end_tests.h b/test/core/end2end/end2end_tests.h index d1758063a7..1e78012ed9 100644 --- a/test/core/end2end/end2end_tests.h +++ b/test/core/end2end/end2end_tests.h @@ -71,4 +71,6 @@ void grpc_end2end_tests(int argc, char **argv, grpc_end2end_test_config config); const char *get_host_override_string(const char *str, grpc_end2end_test_config config); +void validate_host_override_string(const char *pattern, const char *str, grpc_end2end_test_config config); + #endif /* GRPC_TEST_CORE_END2END_END2END_TESTS_H */ diff --git a/test/core/end2end/tests/binary_metadata.c b/test/core/end2end/tests/binary_metadata.c index f2038d7cbc..1629b5d023 100644 --- a/test/core/end2end/tests/binary_metadata.c +++ b/test/core/end2end/tests/binary_metadata.c @@ -248,9 +248,7 @@ static void test_request_response_with_metadata_and_payload( GPR_ASSERT(status == GRPC_STATUS_OK); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - if (authority) { - GPR_ASSERT(0 == strcmp(call_details.host, authority)); - } + validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); GPR_ASSERT(byte_buffer_eq_string(response_payload_recv, "hello you")); diff --git a/test/core/end2end/tests/call_creds.c b/test/core/end2end/tests/call_creds.c index 027c5fdfd5..cb99e7454e 100644 --- a/test/core/end2end/tests/call_creds.c +++ b/test/core/end2end/tests/call_creds.c @@ -294,9 +294,7 @@ static void request_response_with_payload_and_call_creds( GPR_ASSERT(status == GRPC_STATUS_OK); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - if (authority) { - GPR_ASSERT(0 == strcmp(call_details.host, authority)); - } + validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); GPR_ASSERT(byte_buffer_eq_string(response_payload_recv, "hello you")); diff --git a/test/core/end2end/tests/compressed_payload.c b/test/core/end2end/tests/compressed_payload.c index 5925ce7b81..b1869c5945 100644 --- a/test/core/end2end/tests/compressed_payload.c +++ b/test/core/end2end/tests/compressed_payload.c @@ -242,9 +242,7 @@ static void request_for_disabled_algorithm( GPR_ASSERT(0 == strcmp(details, expected_details)); gpr_free(expected_details); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - if (authority) { - GPR_ASSERT(0 == strcmp(call_details.host, authority)); - } + validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); gpr_free(details); grpc_metadata_array_destroy(&initial_metadata_recv); @@ -493,9 +491,7 @@ static void request_with_payload_template( GPR_ASSERT(status == GRPC_STATUS_OK); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - if (authority) { - GPR_ASSERT(0 == strcmp(call_details.host, authority)); - } + validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); GPR_ASSERT(was_cancelled == 0); gpr_free(details); diff --git a/test/core/end2end/tests/disappearing_server.c b/test/core/end2end/tests/disappearing_server.c index 6b32b36d2c..ba3297323e 100644 --- a/test/core/end2end/tests/disappearing_server.c +++ b/test/core/end2end/tests/disappearing_server.c @@ -174,9 +174,7 @@ static void do_request_and_shutdown_server(grpc_end2end_test_config config, GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - if (authority) { - GPR_ASSERT(0 == strcmp(call_details.host, authority)); - } + validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); GPR_ASSERT(was_cancelled == 1); gpr_free(details); diff --git a/test/core/end2end/tests/graceful_server_shutdown.c b/test/core/end2end/tests/graceful_server_shutdown.c index 45892b8824..121e81b6f8 100644 --- a/test/core/end2end/tests/graceful_server_shutdown.c +++ b/test/core/end2end/tests/graceful_server_shutdown.c @@ -190,9 +190,7 @@ static void test_early_server_shutdown_finishes_inflight_calls( GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - if (authority) { - GPR_ASSERT(0 == strcmp(call_details.host, authority)); - } + validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); GPR_ASSERT(was_cancelled == 1); gpr_free(details); diff --git a/test/core/end2end/tests/high_initial_seqno.c b/test/core/end2end/tests/high_initial_seqno.c index 96d58d4787..61fda409ec 100644 --- a/test/core/end2end/tests/high_initial_seqno.c +++ b/test/core/end2end/tests/high_initial_seqno.c @@ -189,9 +189,7 @@ static void simple_request_body(grpc_end2end_test_config config, GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - if (authority) { - GPR_ASSERT(0 == strcmp(call_details.host, authority)); - } + validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); GPR_ASSERT(was_cancelled == 1); gpr_free(details); diff --git a/test/core/end2end/tests/hpack_size.c b/test/core/end2end/tests/hpack_size.c index c400134e1f..6784e2243d 100644 --- a/test/core/end2end/tests/hpack_size.c +++ b/test/core/end2end/tests/hpack_size.c @@ -341,9 +341,7 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_end2end_te GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - if (authority) { - GPR_ASSERT(0 == strcmp(call_details.host, authority)); - } + validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); GPR_ASSERT(was_cancelled == 1); gpr_free(details); diff --git a/test/core/end2end/tests/idempotent_request.c b/test/core/end2end/tests/idempotent_request.c index bbde35b5df..6355405ed2 100644 --- a/test/core/end2end/tests/idempotent_request.c +++ b/test/core/end2end/tests/idempotent_request.c @@ -201,9 +201,7 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_end2end_te GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - if (authority) { - GPR_ASSERT(0 == strcmp(call_details.host, authority)); - } + validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); GPR_ASSERT(GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST == call_details.flags); GPR_ASSERT(was_cancelled == 1); diff --git a/test/core/end2end/tests/invoke_large_request.c b/test/core/end2end/tests/invoke_large_request.c index 67dc2c8f0a..927e4ac2fa 100644 --- a/test/core/end2end/tests/invoke_large_request.c +++ b/test/core/end2end/tests/invoke_large_request.c @@ -244,9 +244,7 @@ static void test_invoke_large_request(grpc_end2end_test_config config, GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - if (authority) { - GPR_ASSERT(0 == strcmp(call_details.host, authority)); - } + validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); GPR_ASSERT(was_cancelled == 1); gpr_free(details); diff --git a/test/core/end2end/tests/large_metadata.c b/test/core/end2end/tests/large_metadata.c index 618e849770..9b139f57fd 100644 --- a/test/core/end2end/tests/large_metadata.c +++ b/test/core/end2end/tests/large_metadata.c @@ -227,9 +227,7 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { GPR_ASSERT(status == GRPC_STATUS_OK); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - if (authority) { - GPR_ASSERT(0 == strcmp(call_details.host, authority)); - } + validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); GPR_ASSERT(contains_metadata(&request_metadata_recv, "key", meta.value)); diff --git a/test/core/end2end/tests/max_concurrent_streams.c b/test/core/end2end/tests/max_concurrent_streams.c index 78c0237a66..2f29c9a721 100644 --- a/test/core/end2end/tests/max_concurrent_streams.c +++ b/test/core/end2end/tests/max_concurrent_streams.c @@ -185,9 +185,7 @@ static void simple_request_body(grpc_end2end_test_config config, GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - if (authority) { - GPR_ASSERT(0 == strcmp(call_details.host, authority)); - } + validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); GPR_ASSERT(was_cancelled == 1); gpr_free(details); diff --git a/test/core/end2end/tests/max_message_length.c b/test/core/end2end/tests/max_message_length.c index c98f52fed8..1a7f383a3d 100644 --- a/test/core/end2end/tests/max_message_length.c +++ b/test/core/end2end/tests/max_message_length.c @@ -215,9 +215,7 @@ static void test_max_message_length_on_request(grpc_end2end_test_config config, cq_verify(cqv); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - if (authority) { - GPR_ASSERT(0 == strcmp(call_details.host, authority)); - } + validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); GPR_ASSERT(was_cancelled == 1); done: diff --git a/test/core/end2end/tests/network_status_change.c b/test/core/end2end/tests/network_status_change.c index bf02e6a9fc..fa64057d08 100644 --- a/test/core/end2end/tests/network_status_change.c +++ b/test/core/end2end/tests/network_status_change.c @@ -212,9 +212,7 @@ static void test_invoke_network_status_change(grpc_end2end_test_config config) { // Expected behavior of a RPC when network is lost. GPR_ASSERT(status == GRPC_STATUS_UNAVAILABLE); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - if (authority) { - GPR_ASSERT(0 == strcmp(call_details.host, authority)); - } + validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); GPR_ASSERT(was_cancelled == 0); gpr_free(details); diff --git a/test/core/end2end/tests/no_logging.c b/test/core/end2end/tests/no_logging.c index 99f2b46686..6e8d424429 100644 --- a/test/core/end2end/tests/no_logging.c +++ b/test/core/end2end/tests/no_logging.c @@ -226,9 +226,7 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_end2end_te GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - if (authority) { - GPR_ASSERT(0 == strcmp(call_details.host, authority)); - } + validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); GPR_ASSERT(0 == call_details.flags); GPR_ASSERT(was_cancelled == 1); diff --git a/test/core/end2end/tests/payload.c b/test/core/end2end/tests/payload.c index 96a565db5a..ed6f816cf0 100644 --- a/test/core/end2end/tests/payload.c +++ b/test/core/end2end/tests/payload.c @@ -220,9 +220,7 @@ static void request_response_with_payload(grpc_end2end_test_config config, grpc_ GPR_ASSERT(status == GRPC_STATUS_OK); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - if (authority) { - GPR_ASSERT(0 == strcmp(call_details.host, authority)); - } + validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); GPR_ASSERT(byte_buffer_eq_string(response_payload_recv, "hello you")); diff --git a/test/core/end2end/tests/registered_call.c b/test/core/end2end/tests/registered_call.c index 05582f9682..c97f6e3a02 100644 --- a/test/core/end2end/tests/registered_call.c +++ b/test/core/end2end/tests/registered_call.c @@ -97,7 +97,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_destroy(f->cq); } -static void simple_request_body(grpc_end2end_test_fixture f, void *rc) { +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(); @@ -186,9 +186,7 @@ static void simple_request_body(grpc_end2end_test_fixture f, void *rc) { GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - if (authority) { - GPR_ASSERT(0 == strcmp(call_details.host, authority)); - } + validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); GPR_ASSERT(was_cancelled == 1); gpr_free(details); @@ -208,7 +206,7 @@ static void test_invoke_simple_request(grpc_end2end_test_config config) { begin_test(config, "test_invoke_simple_request", NULL, NULL); void *rc = grpc_channel_register_call(f.client, "/foo", get_host_override_string("foo.test.google.fr:1234", config), NULL); - simple_request_body(f, rc); + simple_request_body(config, f, rc); end_test(&f); config.tear_down_data(&f); } @@ -220,7 +218,7 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config) { void *rc = grpc_channel_register_call(f.client, "/foo", get_host_override_string("foo.test.google.fr:1234", config), NULL); for (i = 0; i < 10; i++) { - simple_request_body(f, rc); + simple_request_body(config, f, rc); gpr_log(GPR_INFO, "Passed simple request %d", i); } end_test(&f); diff --git a/test/core/end2end/tests/request_with_payload.c b/test/core/end2end/tests/request_with_payload.c index 5755d20fe5..0c18256549 100644 --- a/test/core/end2end/tests/request_with_payload.c +++ b/test/core/end2end/tests/request_with_payload.c @@ -208,9 +208,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { GPR_ASSERT(status == GRPC_STATUS_OK); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - if (authority) { - GPR_ASSERT(0 == strcmp(call_details.host, authority)); - } + validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); diff --git a/test/core/end2end/tests/server_finishes_request.c b/test/core/end2end/tests/server_finishes_request.c index 313b0c3324..e78a4aebe7 100644 --- a/test/core/end2end/tests/server_finishes_request.c +++ b/test/core/end2end/tests/server_finishes_request.c @@ -182,9 +182,7 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_end2end_te GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - if (authority) { - GPR_ASSERT(0 == strcmp(call_details.host, authority)); - } + validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); GPR_ASSERT(was_cancelled == 1); gpr_free(details); diff --git a/test/core/end2end/tests/shutdown_finishes_calls.c b/test/core/end2end/tests/shutdown_finishes_calls.c index 26d61f2dcf..68876d9166 100644 --- a/test/core/end2end/tests/shutdown_finishes_calls.c +++ b/test/core/end2end/tests/shutdown_finishes_calls.c @@ -171,9 +171,7 @@ static void test_early_server_shutdown_finishes_inflight_calls( GPR_ASSERT(status == GRPC_STATUS_UNAVAILABLE); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - if (authority) { - GPR_ASSERT(0 == strcmp(call_details.host, authority)); - } + validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); GPR_ASSERT(was_cancelled == 1); gpr_free(details); diff --git a/test/core/end2end/tests/simple_cacheable_request.c b/test/core/end2end/tests/simple_cacheable_request.c index 166ee638b9..8c8360d8ab 100644 --- a/test/core/end2end/tests/simple_cacheable_request.c +++ b/test/core/end2end/tests/simple_cacheable_request.c @@ -235,9 +235,7 @@ static void test_cacheable_request_response_with_metadata_and_payload( GPR_ASSERT(status == GRPC_STATUS_OK); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - if (authority) { - GPR_ASSERT(0 == strcmp(call_details.host, authority)); - } + validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); if (config.feature_mask & FEATURE_MASK_SUPPORTS_REQUEST_PROXYING) { // Our simple proxy does not support cacheable requests } else { diff --git a/test/core/end2end/tests/simple_delayed_request.c b/test/core/end2end/tests/simple_delayed_request.c index b19c798608..7b2c169093 100644 --- a/test/core/end2end/tests/simple_delayed_request.c +++ b/test/core/end2end/tests/simple_delayed_request.c @@ -180,9 +180,7 @@ static void simple_delayed_request_body(grpc_end2end_test_config config, GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - if (authority) { - GPR_ASSERT(0 == strcmp(call_details.host, authority)); - } + validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); GPR_ASSERT(was_cancelled == 1); gpr_free(details); diff --git a/test/core/end2end/tests/simple_metadata.c b/test/core/end2end/tests/simple_metadata.c index c8370b4b15..d618221362 100644 --- a/test/core/end2end/tests/simple_metadata.c +++ b/test/core/end2end/tests/simple_metadata.c @@ -232,9 +232,7 @@ static void test_request_response_with_metadata_and_payload( GPR_ASSERT(status == GRPC_STATUS_OK); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - if (authority) { - GPR_ASSERT(0 == strcmp(call_details.host, authority)); - } + validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); GPR_ASSERT(byte_buffer_eq_string(response_payload_recv, "hello you")); diff --git a/test/core/end2end/tests/simple_request.c b/test/core/end2end/tests/simple_request.c index a87a455a8d..4e6f32ea30 100644 --- a/test/core/end2end/tests/simple_request.c +++ b/test/core/end2end/tests/simple_request.c @@ -201,9 +201,7 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_end2end_te GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - if (authority) { - GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr:1234")); - } + validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); GPR_ASSERT(0 == call_details.flags); GPR_ASSERT(was_cancelled == 1); diff --git a/test/core/end2end/tests/streaming_error_response.c b/test/core/end2end/tests/streaming_error_response.c index b6167aa135..dc6228857a 100644 --- a/test/core/end2end/tests/streaming_error_response.c +++ b/test/core/end2end/tests/streaming_error_response.c @@ -245,9 +245,7 @@ static void test(grpc_end2end_test_config config, bool request_status_early) { GPR_ASSERT(status == GRPC_STATUS_FAILED_PRECONDITION); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - if (authority) { - GPR_ASSERT(0 == strcmp(call_details.host, authority)); - } + validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); GPR_ASSERT(was_cancelled == 1); gpr_free(details); diff --git a/test/core/end2end/tests/trailing_metadata.c b/test/core/end2end/tests/trailing_metadata.c index 39a90d17e1..094fbb2d9a 100644 --- a/test/core/end2end/tests/trailing_metadata.c +++ b/test/core/end2end/tests/trailing_metadata.c @@ -236,9 +236,7 @@ static void test_request_response_with_metadata_and_payload( GPR_ASSERT(status == GRPC_STATUS_OK); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - if (authority) { - GPR_ASSERT(0 == strcmp(call_details.host, authority)); - } + validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); GPR_ASSERT(byte_buffer_eq_string(response_payload_recv, "hello you")); GPR_ASSERT(contains_metadata(&request_metadata_recv, "key1", "val1")); -- cgit v1.2.3 From 5ebd327cf59cafdf129e33d5885cf31cc75ac737 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 31 Oct 2016 07:27:07 -0700 Subject: Clean with clang-format --- test/core/end2end/end2end_nosec_tests.c | 9 ++++++--- test/core/end2end/end2end_tests.c | 9 ++++++--- test/core/end2end/end2end_tests.h | 6 ++++-- test/core/end2end/tests/binary_metadata.c | 9 ++++++--- test/core/end2end/tests/call_creds.c | 15 ++++++++++----- test/core/end2end/tests/cancel_after_accept.c | 7 ++++--- test/core/end2end/tests/cancel_after_client_done.c | 6 ++++-- test/core/end2end/tests/cancel_after_invoke.c | 6 ++++-- test/core/end2end/tests/cancel_before_invoke.c | 6 ++++-- test/core/end2end/tests/cancel_in_a_vacuum.c | 6 ++++-- test/core/end2end/tests/cancel_with_status.c | 9 ++++++--- test/core/end2end/tests/compressed_payload.c | 18 ++++++++++++------ test/core/end2end/tests/disappearing_server.c | 9 ++++++--- test/core/end2end/tests/empty_batch.c | 6 ++++-- test/core/end2end/tests/filter_call_init_fails.c | 6 ++++-- test/core/end2end/tests/filter_causes_close.c | 6 ++++-- test/core/end2end/tests/graceful_server_shutdown.c | 9 ++++++--- test/core/end2end/tests/high_initial_seqno.c | 9 ++++++--- test/core/end2end/tests/hpack_size.c | 12 ++++++++---- test/core/end2end/tests/idempotent_request.c | 12 ++++++++---- test/core/end2end/tests/invoke_large_request.c | 9 ++++++--- test/core/end2end/tests/large_metadata.c | 9 ++++++--- test/core/end2end/tests/load_reporting_hook.c | 21 +++++++++++---------- test/core/end2end/tests/max_concurrent_streams.c | 21 ++++++++++++++------- test/core/end2end/tests/max_message_length.c | 10 ++++++---- test/core/end2end/tests/negative_deadline.c | 9 ++++++--- test/core/end2end/tests/network_status_change.c | 9 ++++++--- test/core/end2end/tests/no_logging.c | 12 ++++++++---- test/core/end2end/tests/payload.c | 12 ++++++++---- test/core/end2end/tests/ping_pong_streaming.c | 6 ++++-- test/core/end2end/tests/registered_call.c | 14 ++++++++++---- test/core/end2end/tests/request_with_flags.c | 6 ++++-- test/core/end2end/tests/request_with_payload.c | 9 ++++++--- test/core/end2end/tests/server_finishes_request.c | 12 ++++++++---- test/core/end2end/tests/shutdown_finishes_calls.c | 9 ++++++--- test/core/end2end/tests/simple_cacheable_request.c | 9 ++++++--- test/core/end2end/tests/simple_delayed_request.c | 9 ++++++--- test/core/end2end/tests/simple_metadata.c | 9 ++++++--- test/core/end2end/tests/simple_request.c | 12 ++++++++---- test/core/end2end/tests/streaming_error_response.c | 9 ++++++--- test/core/end2end/tests/trailing_metadata.c | 9 ++++++--- 41 files changed, 263 insertions(+), 137 deletions(-) (limited to 'test') diff --git a/test/core/end2end/end2end_nosec_tests.c b/test/core/end2end/end2end_nosec_tests.c index 6b24ea0308..7e9b6eb233 100644 --- a/test/core/end2end/end2end_nosec_tests.c +++ b/test/core/end2end/end2end_nosec_tests.c @@ -417,11 +417,14 @@ void grpc_end2end_tests(int argc, char **argv, } } -const char *get_host_override_string(const char *str, grpc_end2end_test_config config) { - return (config.feature_mask & FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER ? str : NULL); +const char *get_host_override_string(const char *str, + grpc_end2end_test_config config) { + return (config.feature_mask & FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER ? str + : NULL); } -void validate_host_override_string(const char *pattern, const char *str, grpc_end2end_test_config config) { +void validate_host_override_string(const char *pattern, const char *str, + grpc_end2end_test_config config) { if (config.feature_mask & FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER) { GPR_ASSERT(0 == strcmp(str, pattern)); } diff --git a/test/core/end2end/end2end_tests.c b/test/core/end2end/end2end_tests.c index 5130abd098..0fbad22641 100644 --- a/test/core/end2end/end2end_tests.c +++ b/test/core/end2end/end2end_tests.c @@ -425,11 +425,14 @@ void grpc_end2end_tests(int argc, char **argv, } } -const char *get_host_override_string(const char *str, grpc_end2end_test_config config) { - return (config.feature_mask & FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER ? str : NULL); +const char *get_host_override_string(const char *str, + grpc_end2end_test_config config) { + return (config.feature_mask & FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER ? str + : NULL); } -void validate_host_override_string(const char *pattern, const char *str, grpc_end2end_test_config config) { +void validate_host_override_string(const char *pattern, const char *str, + grpc_end2end_test_config config) { if (config.feature_mask & FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER) { GPR_ASSERT(0 == strcmp(str, pattern)); } diff --git a/test/core/end2end/end2end_tests.h b/test/core/end2end/end2end_tests.h index a6fbca0874..0124787bd0 100644 --- a/test/core/end2end/end2end_tests.h +++ b/test/core/end2end/end2end_tests.h @@ -70,8 +70,10 @@ struct grpc_end2end_test_config { void grpc_end2end_tests_pre_init(void); void grpc_end2end_tests(int argc, char **argv, grpc_end2end_test_config config); -const char *get_host_override_string(const char *str, grpc_end2end_test_config config); +const char *get_host_override_string(const char *str, + grpc_end2end_test_config config); -void validate_host_override_string(const char *pattern, const char *str, grpc_end2end_test_config config); +void validate_host_override_string(const char *pattern, const char *str, + grpc_end2end_test_config config); #endif /* GRPC_TEST_CORE_END2END_END2END_TESTS_H */ diff --git a/test/core/end2end/tests/binary_metadata.c b/test/core/end2end/tests/binary_metadata.c index 108272d296..19796bf7d2 100644 --- a/test/core/end2end/tests/binary_metadata.c +++ b/test/core/end2end/tests/binary_metadata.c @@ -146,8 +146,10 @@ static void test_request_response_with_metadata_and_payload( size_t details_capacity = 0; int was_cancelled = 2; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -248,7 +250,8 @@ static void test_request_response_with_metadata_and_payload( GPR_ASSERT(status == GRPC_STATUS_OK); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); GPR_ASSERT(byte_buffer_eq_string(response_payload_recv, "hello you")); diff --git a/test/core/end2end/tests/call_creds.c b/test/core/end2end/tests/call_creds.c index 83dfc62c6a..a2c041b156 100644 --- a/test/core/end2end/tests/call_creds.c +++ b/test/core/end2end/tests/call_creds.c @@ -164,8 +164,10 @@ static void request_response_with_payload_and_call_creds( f = begin_test(config, test_name, 0); cqv = cq_verifier_create(f.cq); - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); creds = grpc_google_iam_credentials_create(iam_token, iam_selector, NULL); GPR_ASSERT(creds != NULL); @@ -294,7 +296,8 @@ static void request_response_with_payload_and_call_creds( GPR_ASSERT(status == GRPC_STATUS_OK); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); GPR_ASSERT(byte_buffer_eq_string(response_payload_recv, "hello you")); @@ -397,8 +400,10 @@ static void test_request_with_server_rejecting_client_creds( f = begin_test(config, "test_request_with_server_rejecting_client_creds", 1); cqv = cq_verifier_create(f.cq); - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); creds = grpc_google_iam_credentials_create(iam_token, iam_selector, NULL); diff --git a/test/core/end2end/tests/cancel_after_accept.c b/test/core/end2end/tests/cancel_after_accept.c index 32aac55a92..6fd7ea2d69 100644 --- a/test/core/end2end/tests/cancel_after_accept.c +++ b/test/core/end2end/tests/cancel_after_accept.c @@ -136,9 +136,10 @@ static void test_cancel_after_accept(grpc_end2end_test_config config, begin_test(config, "cancel_after_accept", NULL, NULL, query_args); cq_verifier *cqv = cq_verifier_create(f.cq); - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/service/method", get_host_override_string("foo.test.google.fr:1234", config), - deadline, NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/service/method", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); diff --git a/test/core/end2end/tests/cancel_after_client_done.c b/test/core/end2end/tests/cancel_after_client_done.c index f6b03b03f5..8469633030 100644 --- a/test/core/end2end/tests/cancel_after_client_done.c +++ b/test/core/end2end/tests/cancel_after_client_done.c @@ -125,8 +125,10 @@ static void test_cancel_after_accept_and_writes_closed( grpc_raw_byte_buffer_create(&response_payload_slice, 1); int was_cancelled = 2; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); diff --git a/test/core/end2end/tests/cancel_after_invoke.c b/test/core/end2end/tests/cancel_after_invoke.c index 496235df1e..34bccbd57d 100644 --- a/test/core/end2end/tests/cancel_after_invoke.c +++ b/test/core/end2end/tests/cancel_after_invoke.c @@ -120,8 +120,10 @@ 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); - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); diff --git a/test/core/end2end/tests/cancel_before_invoke.c b/test/core/end2end/tests/cancel_before_invoke.c index 09049e58f0..acd10fe576 100644 --- a/test/core/end2end/tests/cancel_before_invoke.c +++ b/test/core/end2end/tests/cancel_before_invoke.c @@ -118,8 +118,10 @@ 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); - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); GPR_ASSERT(GRPC_CALL_OK == grpc_call_cancel(c, NULL)); diff --git a/test/core/end2end/tests/cancel_in_a_vacuum.c b/test/core/end2end/tests/cancel_in_a_vacuum.c index de801ca48d..f74881a592 100644 --- a/test/core/end2end/tests/cancel_in_a_vacuum.c +++ b/test/core/end2end/tests/cancel_in_a_vacuum.c @@ -105,8 +105,10 @@ static void test_cancel_in_a_vacuum(grpc_end2end_test_config config, gpr_timespec deadline = five_seconds_time(); cq_verifier *v_client = cq_verifier_create(f.cq); - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c, NULL)); diff --git a/test/core/end2end/tests/cancel_with_status.c b/test/core/end2end/tests/cancel_with_status.c index c50af38dc3..34075723f9 100644 --- a/test/core/end2end/tests/cancel_with_status.c +++ b/test/core/end2end/tests/cancel_with_status.c @@ -97,7 +97,8 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_destroy(f->cq); } -static void simple_request_body(grpc_end2end_test_config config, grpc_end2end_test_fixture f, size_t num_ops) { +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); @@ -112,8 +113,10 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_end2end_te gpr_log(GPR_DEBUG, "test with %" PRIuPTR " ops", num_ops); - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); diff --git a/test/core/end2end/tests/compressed_payload.c b/test/core/end2end/tests/compressed_payload.c index b249080aa2..80f4c12c4d 100644 --- a/test/core/end2end/tests/compressed_payload.c +++ b/test/core/end2end/tests/compressed_payload.c @@ -146,8 +146,10 @@ static void request_for_disabled_algorithm( f = begin_test(config, test_name, client_args, server_args); cqv = cq_verifier_create(f.cq); - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -242,7 +244,8 @@ static void request_for_disabled_algorithm( GPR_ASSERT(0 == strcmp(details, expected_details)); gpr_free(expected_details); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); gpr_free(details); grpc_metadata_array_destroy(&initial_metadata_recv); @@ -318,8 +321,10 @@ static void request_with_payload_template( f = begin_test(config, test_name, client_args, server_args); cqv = cq_verifier_create(f.cq); - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -491,7 +496,8 @@ static void request_with_payload_template( GPR_ASSERT(status == GRPC_STATUS_OK); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(was_cancelled == 0); gpr_free(details); diff --git a/test/core/end2end/tests/disappearing_server.c b/test/core/end2end/tests/disappearing_server.c index 7e9273f958..838402c6ea 100644 --- a/test/core/end2end/tests/disappearing_server.c +++ b/test/core/end2end/tests/disappearing_server.c @@ -97,8 +97,10 @@ static void do_request_and_shutdown_server(grpc_end2end_test_config config, size_t details_capacity = 0; int was_cancelled = 2; - c = grpc_channel_create_call(f->client, NULL, GRPC_PROPAGATE_DEFAULTS, f->cq, - "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); + c = grpc_channel_create_call( + f->client, NULL, GRPC_PROPAGATE_DEFAULTS, f->cq, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -174,7 +176,8 @@ static void do_request_and_shutdown_server(grpc_end2end_test_config config, GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(was_cancelled == 1); gpr_free(details); diff --git a/test/core/end2end/tests/empty_batch.c b/test/core/end2end/tests/empty_batch.c index a482c9eab7..0a22d67f75 100644 --- a/test/core/end2end/tests/empty_batch.c +++ b/test/core/end2end/tests/empty_batch.c @@ -105,8 +105,10 @@ static void empty_batch_body(grpc_end2end_test_config config, grpc_call_error error; grpc_op *op = NULL; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); error = grpc_call_start_batch(c, op, 0, tag(1), NULL); diff --git a/test/core/end2end/tests/filter_call_init_fails.c b/test/core/end2end/tests/filter_call_init_fails.c index 21cf5180dc..0b7d212f58 100644 --- a/test/core/end2end/tests/filter_call_init_fails.c +++ b/test/core/end2end/tests/filter_call_init_fails.c @@ -127,8 +127,10 @@ static void test_request(grpc_end2end_test_config config) { char *details = NULL; size_t details_capacity = 0; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); diff --git a/test/core/end2end/tests/filter_causes_close.c b/test/core/end2end/tests/filter_causes_close.c index 3d9c6f31b2..5a231e59c9 100644 --- a/test/core/end2end/tests/filter_causes_close.c +++ b/test/core/end2end/tests/filter_causes_close.c @@ -123,8 +123,10 @@ static void test_request(grpc_end2end_test_config config) { char *details = NULL; size_t details_capacity = 0; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); diff --git a/test/core/end2end/tests/graceful_server_shutdown.c b/test/core/end2end/tests/graceful_server_shutdown.c index ae850d2ae1..3e0092ec18 100644 --- a/test/core/end2end/tests/graceful_server_shutdown.c +++ b/test/core/end2end/tests/graceful_server_shutdown.c @@ -111,8 +111,10 @@ static void test_early_server_shutdown_finishes_inflight_calls( size_t details_capacity = 0; int was_cancelled = 2; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -190,7 +192,8 @@ static void test_early_server_shutdown_finishes_inflight_calls( GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(was_cancelled == 1); gpr_free(details); diff --git a/test/core/end2end/tests/high_initial_seqno.c b/test/core/end2end/tests/high_initial_seqno.c index 4bf351621b..209aae3eb6 100644 --- a/test/core/end2end/tests/high_initial_seqno.c +++ b/test/core/end2end/tests/high_initial_seqno.c @@ -117,8 +117,10 @@ static void simple_request_body(grpc_end2end_test_config config, size_t details_capacity = 0; int was_cancelled = 2; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -189,7 +191,8 @@ static void simple_request_body(grpc_end2end_test_config config, GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(was_cancelled == 1); gpr_free(details); diff --git a/test/core/end2end/tests/hpack_size.c b/test/core/end2end/tests/hpack_size.c index 903a71500a..cab997432f 100644 --- a/test/core/end2end/tests/hpack_size.c +++ b/test/core/end2end/tests/hpack_size.c @@ -239,7 +239,8 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_destroy(f->cq); } -static void simple_request_body(grpc_end2end_test_config config, grpc_end2end_test_fixture f, size_t index) { +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(); @@ -268,8 +269,10 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_end2end_te extra_metadata[2].value = dragons[index % GPR_ARRAY_SIZE(dragons)]; extra_metadata[2].value_length = strlen(extra_metadata[2].value); - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -341,7 +344,8 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_end2end_te GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(was_cancelled == 1); gpr_free(details); diff --git a/test/core/end2end/tests/idempotent_request.c b/test/core/end2end/tests/idempotent_request.c index 8174743e25..7dcf3c72e3 100644 --- a/test/core/end2end/tests/idempotent_request.c +++ b/test/core/end2end/tests/idempotent_request.c @@ -97,7 +97,8 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_destroy(f->cq); } -static void simple_request_body(grpc_end2end_test_config config, grpc_end2end_test_fixture f) { +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(); @@ -115,8 +116,10 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_end2end_te int was_cancelled = 2; char *peer; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); peer = grpc_call_get_peer(c); @@ -201,7 +204,8 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_end2end_te GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST == call_details.flags); GPR_ASSERT(was_cancelled == 1); diff --git a/test/core/end2end/tests/invoke_large_request.c b/test/core/end2end/tests/invoke_large_request.c index 7621acf00f..5b9e5c4273 100644 --- a/test/core/end2end/tests/invoke_large_request.c +++ b/test/core/end2end/tests/invoke_large_request.c @@ -144,8 +144,10 @@ static void test_invoke_large_request(grpc_end2end_test_config config, size_t details_capacity = 0; int was_cancelled = 2; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -244,7 +246,8 @@ static void test_invoke_large_request(grpc_end2end_test_config config, GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(was_cancelled == 1); gpr_free(details); diff --git a/test/core/end2end/tests/large_metadata.c b/test/core/end2end/tests/large_metadata.c index 3561ec755c..5403ed078a 100644 --- a/test/core/end2end/tests/large_metadata.c +++ b/test/core/end2end/tests/large_metadata.c @@ -125,8 +125,10 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { size_t details_capacity = 0; int was_cancelled = 2; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); meta.key = "key"; @@ -227,7 +229,8 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { GPR_ASSERT(status == GRPC_STATUS_OK); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); GPR_ASSERT(contains_metadata(&request_metadata_recv, "key", meta.value)); diff --git a/test/core/end2end/tests/load_reporting_hook.c b/test/core/end2end/tests/load_reporting_hook.c index 9b4bdc3895..217d47e7a8 100644 --- a/test/core/end2end/tests/load_reporting_hook.c +++ b/test/core/end2end/tests/load_reporting_hook.c @@ -121,13 +121,10 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_destroy(f->cq); } -static void request_response_with_payload(grpc_end2end_test_config config, - grpc_end2end_test_fixture f, - const char *method_name, - const char *request_msg, - const char *response_msg, - grpc_metadata *initial_lr_metadata, - grpc_metadata *trailing_lr_metadata) { +static void request_response_with_payload( + grpc_end2end_test_config config, grpc_end2end_test_fixture f, + const char *method_name, const char *request_msg, const char *response_msg, + grpc_metadata *initial_lr_metadata, grpc_metadata *trailing_lr_metadata) { gpr_slice request_payload_slice = gpr_slice_from_static_string(request_msg); gpr_slice response_payload_slice = gpr_slice_from_static_string(response_msg); grpc_call *c; @@ -152,8 +149,10 @@ static void request_response_with_payload(grpc_end2end_test_config config, size_t details_capacity = 0; int was_cancelled = 2; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - method_name, get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, method_name, + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -307,7 +306,9 @@ static void test_load_reporting_hook(grpc_end2end_test_config config) { memset(&trailing_lr_metadata.internal_data, 0, sizeof(trailing_lr_metadata.internal_data)); - request_response_with_payload(config, f, method_name, request_msg, response_msg, &initial_lr_metadata, &trailing_lr_metadata); + request_response_with_payload(config, f, method_name, request_msg, + response_msg, &initial_lr_metadata, + &trailing_lr_metadata); end_test(&f); grpc_channel_args_destroy(lr_server_args); config.tear_down_data(&f); diff --git a/test/core/end2end/tests/max_concurrent_streams.c b/test/core/end2end/tests/max_concurrent_streams.c index ef3704a428..ffc7f57f80 100644 --- a/test/core/end2end/tests/max_concurrent_streams.c +++ b/test/core/end2end/tests/max_concurrent_streams.c @@ -113,8 +113,10 @@ static void simple_request_body(grpc_end2end_test_config config, size_t details_capacity = 0; int was_cancelled = 2; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -185,7 +187,8 @@ static void simple_request_body(grpc_end2end_test_config config, GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(was_cancelled == 1); gpr_free(details); @@ -257,11 +260,15 @@ 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); - c1 = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/alpha", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); + c1 = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/alpha", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c1); - c2 = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/beta", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); + c2 = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/beta", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c2); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( diff --git a/test/core/end2end/tests/max_message_length.c b/test/core/end2end/tests/max_message_length.c index 19bf0dddaa..bb7033f6de 100644 --- a/test/core/end2end/tests/max_message_length.c +++ b/test/core/end2end/tests/max_message_length.c @@ -158,9 +158,10 @@ static void test_max_message_length_on_request(grpc_end2end_test_config config, server_args, query_args); cqv = cq_verifier_create(f.cq); - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/service/method", get_host_override_string("foo.test.google.fr:1234", config), - gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/service/method", + get_host_override_string("foo.test.google.fr:1234", config), + gpr_inf_future(GPR_CLOCK_REALTIME), NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -233,7 +234,8 @@ static void test_max_message_length_on_request(grpc_end2end_test_config config, cq_verify(cqv); GPR_ASSERT(0 == strcmp(call_details.method, "/service/method")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(was_cancelled == 1); done: diff --git a/test/core/end2end/tests/negative_deadline.c b/test/core/end2end/tests/negative_deadline.c index 335608f3f9..267b3f2c42 100644 --- a/test/core/end2end/tests/negative_deadline.c +++ b/test/core/end2end/tests/negative_deadline.c @@ -97,7 +97,8 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_destroy(f->cq); } -static void simple_request_body(grpc_end2end_test_config config, grpc_end2end_test_fixture f, size_t num_ops) { +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); @@ -112,8 +113,10 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_end2end_te gpr_log(GPR_DEBUG, "test with %" PRIuPTR " ops", num_ops); - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); diff --git a/test/core/end2end/tests/network_status_change.c b/test/core/end2end/tests/network_status_change.c index 71a24af53d..c5b953d6af 100644 --- a/test/core/end2end/tests/network_status_change.c +++ b/test/core/end2end/tests/network_status_change.c @@ -122,8 +122,10 @@ static void test_invoke_network_status_change(grpc_end2end_test_config config) { size_t details_capacity = 0; int was_cancelled = 2; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -212,7 +214,8 @@ static void test_invoke_network_status_change(grpc_end2end_test_config config) { // Expected behavior of a RPC when network is lost. GPR_ASSERT(status == GRPC_STATUS_UNAVAILABLE); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); gpr_free(details); grpc_metadata_array_destroy(&initial_metadata_recv); diff --git a/test/core/end2end/tests/no_logging.c b/test/core/end2end/tests/no_logging.c index 1d96efc276..ba21ed69dc 100644 --- a/test/core/end2end/tests/no_logging.c +++ b/test/core/end2end/tests/no_logging.c @@ -125,7 +125,8 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_destroy(f->cq); } -static void simple_request_body(grpc_end2end_test_config config, grpc_end2end_test_fixture f) { +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(); @@ -143,8 +144,10 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_end2end_te int was_cancelled = 2; char *peer; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); peer = grpc_call_get_peer(c); @@ -226,7 +229,8 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_end2end_te GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(0 == call_details.flags); GPR_ASSERT(was_cancelled == 1); diff --git a/test/core/end2end/tests/payload.c b/test/core/end2end/tests/payload.c index 341d510297..c5a198bea6 100644 --- a/test/core/end2end/tests/payload.c +++ b/test/core/end2end/tests/payload.c @@ -111,7 +111,8 @@ static gpr_slice generate_random_slice() { return out; } -static void request_response_with_payload(grpc_end2end_test_config config, grpc_end2end_test_fixture f) { +static void request_response_with_payload(grpc_end2end_test_config config, + grpc_end2end_test_fixture f) { /* Create large request and response bodies. These are big enough to require * multiple round trips to deliver to the peer, and their exact contents of * will be verified on completion. */ @@ -140,8 +141,10 @@ static void request_response_with_payload(grpc_end2end_test_config config, grpc_ size_t details_capacity = 0; int was_cancelled = 2; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -240,7 +243,8 @@ static void request_response_with_payload(grpc_end2end_test_config config, grpc_ GPR_ASSERT(status == GRPC_STATUS_OK); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_slice(request_payload_recv, request_payload_slice)); GPR_ASSERT( diff --git a/test/core/end2end/tests/ping_pong_streaming.c b/test/core/end2end/tests/ping_pong_streaming.c index 8eca462efd..22a69d0f2f 100644 --- a/test/core/end2end/tests/ping_pong_streaming.c +++ b/test/core/end2end/tests/ping_pong_streaming.c @@ -123,8 +123,10 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, gpr_slice request_payload_slice = gpr_slice_from_copied_string("hello world"); gpr_slice response_payload_slice = gpr_slice_from_copied_string("hello you"); - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); diff --git a/test/core/end2end/tests/registered_call.c b/test/core/end2end/tests/registered_call.c index dc46068e2f..4dbea86fa1 100644 --- a/test/core/end2end/tests/registered_call.c +++ b/test/core/end2end/tests/registered_call.c @@ -97,7 +97,8 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_destroy(f->cq); } -static void simple_request_body(grpc_end2end_test_config config, grpc_end2end_test_fixture f, void *rc) { +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(); @@ -186,7 +187,8 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_end2end_te GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(was_cancelled == 1); gpr_free(details); @@ -204,7 +206,9 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_end2end_te 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", get_host_override_string("foo.test.google.fr:1234", config), NULL); + void *rc = grpc_channel_register_call( + f.client, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), NULL); simple_request_body(config, f, rc); end_test(&f); @@ -215,7 +219,9 @@ 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", get_host_override_string("foo.test.google.fr:1234", config), NULL); + void *rc = grpc_channel_register_call( + f.client, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), NULL); for (i = 0; i < 10; i++) { simple_request_body(config, f, rc); diff --git a/test/core/end2end/tests/request_with_flags.c b/test/core/end2end/tests/request_with_flags.c index 223566321b..f53d30bd48 100644 --- a/test/core/end2end/tests/request_with_flags.c +++ b/test/core/end2end/tests/request_with_flags.c @@ -120,8 +120,10 @@ static void test_invoke_request_with_flags( size_t details_capacity = 0; grpc_call_error expectation; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); diff --git a/test/core/end2end/tests/request_with_payload.c b/test/core/end2end/tests/request_with_payload.c index 34e8c72b72..fa0d933b59 100644 --- a/test/core/end2end/tests/request_with_payload.c +++ b/test/core/end2end/tests/request_with_payload.c @@ -119,8 +119,10 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { size_t details_capacity = 0; int was_cancelled = 2; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -208,7 +210,8 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { GPR_ASSERT(status == GRPC_STATUS_OK); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); diff --git a/test/core/end2end/tests/server_finishes_request.c b/test/core/end2end/tests/server_finishes_request.c index c8eeadef4c..6268aa60b4 100644 --- a/test/core/end2end/tests/server_finishes_request.c +++ b/test/core/end2end/tests/server_finishes_request.c @@ -97,7 +97,8 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_destroy(f->cq); } -static void simple_request_body(grpc_end2end_test_config config, grpc_end2end_test_fixture f) { +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(); @@ -114,8 +115,10 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_end2end_te size_t details_capacity = 0; int was_cancelled = 2; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -182,7 +185,8 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_end2end_te GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(was_cancelled == 1); gpr_free(details); diff --git a/test/core/end2end/tests/shutdown_finishes_calls.c b/test/core/end2end/tests/shutdown_finishes_calls.c index 0de706c0e1..bd21cfd7b2 100644 --- a/test/core/end2end/tests/shutdown_finishes_calls.c +++ b/test/core/end2end/tests/shutdown_finishes_calls.c @@ -104,8 +104,10 @@ static void test_early_server_shutdown_finishes_inflight_calls( size_t details_capacity = 0; int was_cancelled = 2; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -171,7 +173,8 @@ static void test_early_server_shutdown_finishes_inflight_calls( GPR_ASSERT(status == GRPC_STATUS_UNAVAILABLE); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(was_cancelled == 1); gpr_free(details); diff --git a/test/core/end2end/tests/simple_cacheable_request.c b/test/core/end2end/tests/simple_cacheable_request.c index 60e286bfad..0775b2fc2f 100644 --- a/test/core/end2end/tests/simple_cacheable_request.c +++ b/test/core/end2end/tests/simple_cacheable_request.c @@ -133,8 +133,10 @@ static void test_cacheable_request_response_with_metadata_and_payload( size_t details_capacity = 0; int was_cancelled = 2; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -235,7 +237,8 @@ static void test_cacheable_request_response_with_metadata_and_payload( GPR_ASSERT(status == GRPC_STATUS_OK); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); if (config.feature_mask & FEATURE_MASK_SUPPORTS_REQUEST_PROXYING) { // Our simple proxy does not support cacheable requests } else { diff --git a/test/core/end2end/tests/simple_delayed_request.c b/test/core/end2end/tests/simple_delayed_request.c index db4a7e2524..e661a17eff 100644 --- a/test/core/end2end/tests/simple_delayed_request.c +++ b/test/core/end2end/tests/simple_delayed_request.c @@ -106,8 +106,10 @@ static void simple_delayed_request_body(grpc_end2end_test_config config, config.init_client(f, client_args, NULL); - c = grpc_channel_create_call(f->client, NULL, GRPC_PROPAGATE_DEFAULTS, f->cq, - "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); + c = grpc_channel_create_call( + f->client, NULL, GRPC_PROPAGATE_DEFAULTS, f->cq, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -180,7 +182,8 @@ static void simple_delayed_request_body(grpc_end2end_test_config config, GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(was_cancelled == 1); gpr_free(details); diff --git a/test/core/end2end/tests/simple_metadata.c b/test/core/end2end/tests/simple_metadata.c index 2f2aa14fab..98a494b171 100644 --- a/test/core/end2end/tests/simple_metadata.c +++ b/test/core/end2end/tests/simple_metadata.c @@ -130,8 +130,10 @@ static void test_request_response_with_metadata_and_payload( size_t details_capacity = 0; int was_cancelled = 2; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -232,7 +234,8 @@ static void test_request_response_with_metadata_and_payload( GPR_ASSERT(status == GRPC_STATUS_OK); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); GPR_ASSERT(byte_buffer_eq_string(response_payload_recv, "hello you")); diff --git a/test/core/end2end/tests/simple_request.c b/test/core/end2end/tests/simple_request.c index 40c1192d15..68f6fa5c4a 100644 --- a/test/core/end2end/tests/simple_request.c +++ b/test/core/end2end/tests/simple_request.c @@ -97,7 +97,8 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_destroy(f->cq); } -static void simple_request_body(grpc_end2end_test_config config, grpc_end2end_test_fixture f) { +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(); @@ -115,8 +116,10 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_end2end_te int was_cancelled = 2; char *peer; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); peer = grpc_call_get_peer(c); @@ -201,7 +204,8 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_end2end_te GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(0 == call_details.flags); GPR_ASSERT(was_cancelled == 1); diff --git a/test/core/end2end/tests/streaming_error_response.c b/test/core/end2end/tests/streaming_error_response.c index 9513a41e58..05cb920332 100644 --- a/test/core/end2end/tests/streaming_error_response.c +++ b/test/core/end2end/tests/streaming_error_response.c @@ -125,8 +125,10 @@ static void test(grpc_end2end_test_config config, bool request_status_early) { size_t details_capacity = 0; int was_cancelled = 2; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -245,7 +247,8 @@ static void test(grpc_end2end_test_config config, bool request_status_early) { GPR_ASSERT(status == GRPC_STATUS_FAILED_PRECONDITION); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(was_cancelled == 1); gpr_free(details); diff --git a/test/core/end2end/tests/trailing_metadata.c b/test/core/end2end/tests/trailing_metadata.c index d67babb64f..a7b2490b99 100644 --- a/test/core/end2end/tests/trailing_metadata.c +++ b/test/core/end2end/tests/trailing_metadata.c @@ -133,8 +133,10 @@ static void test_request_response_with_metadata_and_payload( size_t details_capacity = 0; int was_cancelled = 2; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", get_host_override_string("foo.test.google.fr:1234", config), deadline, NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -236,7 +238,8 @@ static void test_request_response_with_metadata_and_payload( GPR_ASSERT(status == GRPC_STATUS_OK); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); GPR_ASSERT(byte_buffer_eq_string(response_payload_recv, "hello you")); GPR_ASSERT(contains_metadata(&request_metadata_recv, "key1", "val1")); -- cgit v1.2.3 From a947f1c32ed756dcd4f0460130ad8450e216e0aa Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 4 Nov 2016 13:53:17 -0700 Subject: Make resource_quota a real object --- src/core/lib/iomgr/resource_quota.c | 197 ++++++++++++++++++-------- src/core/lib/iomgr/resource_quota.h | 88 +----------- src/core/lib/iomgr/tcp_posix.c | 37 ++--- test/core/iomgr/resource_quota_test.c | 253 ++++++++++++++-------------------- test/core/util/mock_endpoint.c | 33 +---- test/core/util/passthru_endpoint.c | 18 +-- 6 files changed, 266 insertions(+), 360 deletions(-) (limited to 'test') diff --git a/src/core/lib/iomgr/resource_quota.c b/src/core/lib/iomgr/resource_quota.c index 8a06443d58..1770d72268 100644 --- a/src/core/lib/iomgr/resource_quota.c +++ b/src/core/lib/iomgr/resource_quota.c @@ -44,6 +44,81 @@ int grpc_resource_quota_trace = 0; +/* Internal linked list pointers for a resource user */ +typedef struct { + grpc_resource_user *next; + grpc_resource_user *prev; +} grpc_resource_user_link; + +/* Resource users are kept in (potentially) several intrusive linked lists + at once. These are the list names. */ +typedef enum { + /* Resource users that are waiting for an allocation */ + GRPC_RULIST_AWAITING_ALLOCATION, + /* Resource users that have free memory available for internal reclamation */ + GRPC_RULIST_NON_EMPTY_FREE_POOL, + /* Resource users that have published a benign reclamation is available */ + GRPC_RULIST_RECLAIMER_BENIGN, + /* Resource users that have published a destructive reclamation is + available */ + GRPC_RULIST_RECLAIMER_DESTRUCTIVE, + /* Number of lists: must be last */ + GRPC_RULIST_COUNT +} grpc_rulist; + +struct grpc_resource_user { + /* The quota this resource user consumes from */ + grpc_resource_quota *resource_quota; + + /* Closure to schedule an allocation under the resource quota combiner lock */ + grpc_closure allocate_closure; + /* Closure to publish a non empty free pool under the resource quota combiner + lock */ + grpc_closure add_to_free_pool_closure; + + /* one ref for each ref call (released by grpc_resource_user_unref), and one + ref for each byte allocated (released by grpc_resource_user_free) */ + gpr_atm refs; + /* is this resource user unlocked? starts at 0, increases for each shutdown + call */ + gpr_atm shutdown; + + gpr_mu mu; + /* The amount of memory (in bytes) this user has cached for its own use: to + avoid quota contention, each resource user can keep some memory in + addition to what it is immediately using (e.g., for caching), and the quota + can pull it back under memory pressure. + This value can become negative if more memory has been requested than + existed in the free pool, at which point the quota is consulted to bring + this value non-negative (asynchronously). */ + int64_t free_pool; + /* A list of closures to call once free_pool becomes non-negative - ie when + all outstanding allocations have been granted. */ + grpc_closure_list on_allocated; + /* True if we are currently trying to allocate from the quota, false if not */ + bool allocating; + /* True if we are currently trying to add ourselves to the non-free quota + list, false otherwise */ + bool added_to_free_pool; + + /* Reclaimers: index 0 is the benign reclaimer, 1 is the destructive reclaimer + */ + grpc_closure *reclaimers[2]; + /* Trampoline closures to finish reclamation and re-enter the quota combiner + lock */ + grpc_closure post_reclaimer_closure[2]; + + /* Closure to execute under the quota combiner to de-register and shutdown the + resource user */ + grpc_closure destroy_closure; + + /* Links in the various grpc_rulist lists */ + grpc_resource_user_link links[GRPC_RULIST_COUNT]; + + /* The name of this resource user, for debugging/tracing */ + char *name; +}; + struct grpc_resource_quota { /* refcount */ gpr_refcount refs; @@ -373,9 +448,19 @@ static void ru_post_destructive_reclaimer(grpc_exec_ctx *exec_ctx, void *ru, rulist_add_tail(resource_user, GRPC_RULIST_RECLAIMER_DESTRUCTIVE); } +static void ru_shutdown(grpc_exec_ctx *exec_ctx, void *ru, grpc_error *error) { + grpc_resource_user *resource_user = ru; + grpc_exec_ctx_sched(exec_ctx, resource_user->reclaimers[0], + GRPC_ERROR_CANCELLED, NULL); + grpc_exec_ctx_sched(exec_ctx, resource_user->reclaimers[1], + GRPC_ERROR_CANCELLED, NULL); + resource_user->reclaimers[0] = NULL; + resource_user->reclaimers[1] = NULL; +} + static void ru_destroy(grpc_exec_ctx *exec_ctx, void *ru, grpc_error *error) { grpc_resource_user *resource_user = ru; - GPR_ASSERT(resource_user->allocated == 0); + GPR_ASSERT(gpr_atm_no_barrier_load(&resource_user->refs) == 0); for (int i = 0; i < GRPC_RULIST_COUNT; i++) { rulist_remove(resource_user, (grpc_rulist)i); } @@ -383,13 +468,14 @@ static void ru_destroy(grpc_exec_ctx *exec_ctx, void *ru, grpc_error *error) { GRPC_ERROR_CANCELLED, NULL); grpc_exec_ctx_sched(exec_ctx, resource_user->reclaimers[1], GRPC_ERROR_CANCELLED, NULL); - grpc_exec_ctx_sched(exec_ctx, (grpc_closure *)gpr_atm_no_barrier_load( - &resource_user->on_done_destroy_closure), - GRPC_ERROR_NONE, NULL); if (resource_user->free_pool != 0) { resource_user->resource_quota->free_pool += resource_user->free_pool; rq_step_sched(exec_ctx, resource_user->resource_quota); } + grpc_resource_quota_internal_unref(exec_ctx, resource_user->resource_quota); + gpr_mu_destroy(&resource_user->mu); + gpr_free(resource_user->name); + gpr_free(resource_user); } static void ru_allocated_slices(grpc_exec_ctx *exec_ctx, void *arg, @@ -539,9 +625,9 @@ const grpc_arg_pointer_vtable *grpc_resource_quota_arg_vtable(void) { * grpc_resource_user api */ -void grpc_resource_user_init(grpc_resource_user *resource_user, - grpc_resource_quota *resource_quota, - const char *name) { +grpc_resource_user *grpc_resource_user_create( + grpc_resource_quota *resource_quota, const char *name) { + grpc_resource_user *resource_user = gpr_malloc(sizeof(*resource_user)); resource_user->resource_quota = grpc_resource_quota_internal_ref(resource_quota); grpc_closure_init(&resource_user->allocate_closure, &ru_allocate, @@ -555,12 +641,12 @@ void grpc_resource_user_init(grpc_resource_user *resource_user, grpc_closure_init(&resource_user->destroy_closure, &ru_destroy, resource_user); gpr_mu_init(&resource_user->mu); - resource_user->allocated = 0; + gpr_atm_rel_store(&resource_user->refs, 1); + gpr_atm_rel_store(&resource_user->shutdown, 0); resource_user->free_pool = 0; grpc_closure_list_init(&resource_user->on_allocated); resource_user->allocating = false; resource_user->added_to_free_pool = false; - gpr_atm_no_barrier_store(&resource_user->on_done_destroy_closure, 0); resource_user->reclaimers[0] = NULL; resource_user->reclaimers[1] = NULL; for (int i = 0; i < GRPC_RULIST_COUNT; i++) { @@ -572,56 +658,54 @@ void grpc_resource_user_init(grpc_resource_user *resource_user, gpr_asprintf(&resource_user->name, "anonymous_resource_user_%" PRIxPTR, (intptr_t)resource_user); } + return resource_user; } -void grpc_resource_user_shutdown(grpc_exec_ctx *exec_ctx, - grpc_resource_user *resource_user, - grpc_closure *on_done) { - gpr_mu_lock(&resource_user->mu); - GPR_ASSERT(gpr_atm_no_barrier_load(&resource_user->on_done_destroy_closure) == - 0); - gpr_atm_no_barrier_store(&resource_user->on_done_destroy_closure, - (gpr_atm)on_done); - if (resource_user->allocated == 0) { +static void ru_ref_by(grpc_resource_user *resource_user, gpr_atm amount) { + GPR_ASSERT(amount > 0); + GPR_ASSERT(gpr_atm_no_barrier_fetch_add(&resource_user->refs, amount) != 0); +} + +static void ru_unref_by(grpc_exec_ctx *exec_ctx, + grpc_resource_user *resource_user, gpr_atm amount) { + GPR_ASSERT(amount > 0); + gpr_atm old = gpr_atm_full_fetch_add(&resource_user->refs, -amount); + GPR_ASSERT(old >= amount); + if (old == amount) { grpc_combiner_execute(exec_ctx, resource_user->resource_quota->combiner, &resource_user->destroy_closure, GRPC_ERROR_NONE, false); } - gpr_mu_unlock(&resource_user->mu); } -void grpc_resource_user_destroy(grpc_exec_ctx *exec_ctx, - grpc_resource_user *resource_user) { - grpc_resource_quota_internal_unref(exec_ctx, resource_user->resource_quota); - gpr_mu_destroy(&resource_user->mu); - gpr_free(resource_user->name); +void grpc_resource_user_ref(grpc_resource_user *resource_user) { + ru_ref_by(resource_user, 1); +} + +void grpc_resource_user_unref(grpc_exec_ctx *exec_ctx, + grpc_resource_user *resource_user) { + ru_unref_by(exec_ctx, resource_user, 1); +} + +void grpc_resource_user_shutdown(grpc_exec_ctx *exec_ctx, + grpc_resource_user *resource_user) { + if (gpr_atm_full_fetch_add(&resource_user->shutdown, 1) == 0) { + grpc_combiner_execute(exec_ctx, resource_user->resource_quota->combiner, + grpc_closure_create(ru_shutdown, resource_user), + GRPC_ERROR_NONE, false); + } } void grpc_resource_user_alloc(grpc_exec_ctx *exec_ctx, grpc_resource_user *resource_user, size_t size, grpc_closure *optional_on_done) { gpr_mu_lock(&resource_user->mu); - grpc_closure *on_done_destroy = (grpc_closure *)gpr_atm_no_barrier_load( - &resource_user->on_done_destroy_closure); - if (on_done_destroy != NULL) { - /* already shutdown */ - if (grpc_resource_quota_trace) { - gpr_log(GPR_DEBUG, "RQ %s %s: alloc %" PRIdPTR " after shutdown", - resource_user->resource_quota->name, resource_user->name, size); - } - grpc_exec_ctx_sched( - exec_ctx, optional_on_done, - GRPC_ERROR_CREATE("Buffer pool user is already shutdown"), NULL); - gpr_mu_unlock(&resource_user->mu); - return; - } - resource_user->allocated += (int64_t)size; + ru_ref_by(resource_user, (gpr_atm)size); resource_user->free_pool -= (int64_t)size; if (grpc_resource_quota_trace) { - gpr_log(GPR_DEBUG, "RQ %s %s: alloc %" PRIdPTR "; allocated -> %" PRId64 - ", free_pool -> %" PRId64, + gpr_log(GPR_DEBUG, "RQ %s %s: alloc %" PRIdPTR "; free_pool -> %" PRId64, resource_user->resource_quota->name, resource_user->name, size, - resource_user->allocated, resource_user->free_pool); + resource_user->free_pool); } if (resource_user->free_pool < 0) { grpc_closure_list_append(&resource_user->on_allocated, optional_on_done, @@ -641,15 +725,12 @@ void grpc_resource_user_alloc(grpc_exec_ctx *exec_ctx, void grpc_resource_user_free(grpc_exec_ctx *exec_ctx, grpc_resource_user *resource_user, size_t size) { gpr_mu_lock(&resource_user->mu); - GPR_ASSERT(resource_user->allocated >= (int64_t)size); bool was_zero_or_negative = resource_user->free_pool <= 0; resource_user->free_pool += (int64_t)size; - resource_user->allocated -= (int64_t)size; if (grpc_resource_quota_trace) { - gpr_log(GPR_DEBUG, "RQ %s %s: free %" PRIdPTR "; allocated -> %" PRId64 - ", free_pool -> %" PRId64, + gpr_log(GPR_DEBUG, "RQ %s %s: free %" PRIdPTR "; free_pool -> %" PRId64, resource_user->resource_quota->name, resource_user->name, size, - resource_user->allocated, resource_user->free_pool); + resource_user->free_pool); } bool is_bigger_than_zero = resource_user->free_pool > 0; if (is_bigger_than_zero && was_zero_or_negative && @@ -659,29 +740,23 @@ void grpc_resource_user_free(grpc_exec_ctx *exec_ctx, &resource_user->add_to_free_pool_closure, GRPC_ERROR_NONE, false); } - grpc_closure *on_done_destroy = (grpc_closure *)gpr_atm_no_barrier_load( - &resource_user->on_done_destroy_closure); - if (on_done_destroy != NULL && resource_user->allocated == 0) { - grpc_combiner_execute(exec_ctx, resource_user->resource_quota->combiner, - &resource_user->destroy_closure, GRPC_ERROR_NONE, - false); - } gpr_mu_unlock(&resource_user->mu); + ru_unref_by(exec_ctx, resource_user, (gpr_atm)size); } void grpc_resource_user_post_reclaimer(grpc_exec_ctx *exec_ctx, grpc_resource_user *resource_user, bool destructive, grpc_closure *closure) { - if (gpr_atm_acq_load(&resource_user->on_done_destroy_closure) == 0) { - GPR_ASSERT(resource_user->reclaimers[destructive] == NULL); - resource_user->reclaimers[destructive] = closure; - grpc_combiner_execute(exec_ctx, resource_user->resource_quota->combiner, - &resource_user->post_reclaimer_closure[destructive], - GRPC_ERROR_NONE, false); - } else { + GPR_ASSERT(resource_user->reclaimers[destructive] == NULL); + if (gpr_atm_acq_load(&resource_user->shutdown) > 0) { grpc_exec_ctx_sched(exec_ctx, closure, GRPC_ERROR_CANCELLED, NULL); + return; } + resource_user->reclaimers[destructive] = closure; + grpc_combiner_execute(exec_ctx, resource_user->resource_quota->combiner, + &resource_user->post_reclaimer_closure[destructive], + GRPC_ERROR_NONE, false); } void grpc_resource_user_finish_reclamation(grpc_exec_ctx *exec_ctx, diff --git a/src/core/lib/iomgr/resource_quota.h b/src/core/lib/iomgr/resource_quota.h index da68f21a2c..bbe0af1a14 100644 --- a/src/core/lib/iomgr/resource_quota.h +++ b/src/core/lib/iomgr/resource_quota.h @@ -84,91 +84,15 @@ void grpc_resource_quota_internal_unref(grpc_exec_ctx *exec_ctx, grpc_resource_quota *grpc_resource_quota_from_channel_args( const grpc_channel_args *channel_args); -/* Resource users are kept in (potentially) several intrusive linked lists - at once. These are the list names. */ -typedef enum { - /* Resource users that are waiting for an allocation */ - GRPC_RULIST_AWAITING_ALLOCATION, - /* Resource users that have free memory available for internal reclamation */ - GRPC_RULIST_NON_EMPTY_FREE_POOL, - /* Resource users that have published a benign reclamation is available */ - GRPC_RULIST_RECLAIMER_BENIGN, - /* Resource users that have published a destructive reclamation is - available */ - GRPC_RULIST_RECLAIMER_DESTRUCTIVE, - /* Number of lists: must be last */ - GRPC_RULIST_COUNT -} grpc_rulist; - typedef struct grpc_resource_user grpc_resource_user; -/* Internal linked list pointers for a resource user */ -typedef struct { - grpc_resource_user *next; - grpc_resource_user *prev; -} grpc_resource_user_link; - -struct grpc_resource_user { - /* The quota this resource user consumes from */ - grpc_resource_quota *resource_quota; - - /* Closure to schedule an allocation under the resource quota combiner lock */ - grpc_closure allocate_closure; - /* Closure to publish a non empty free pool under the resource quota combiner - lock */ - grpc_closure add_to_free_pool_closure; - - gpr_mu mu; - /* Total allocated memory outstanding by this resource user in bytes; - always positive */ - int64_t allocated; - /* The amount of memory (in bytes) this user has cached for its own use: to - avoid quota contention, each resource user can keep some memory in - addition to what it is immediately using (e.g., for caching), and the quota - can pull it back under memory pressure. - This value can become negative if more memory has been requested than - existed in the free pool, at which point the quota is consulted to bring - this value non-negative (asynchronously). */ - int64_t free_pool; - /* A list of closures to call once free_pool becomes non-negative - ie when - all outstanding allocations have been granted. */ - grpc_closure_list on_allocated; - /* True if we are currently trying to allocate from the quota, false if not */ - bool allocating; - /* True if we are currently trying to add ourselves to the non-free quota - list, false otherwise */ - bool added_to_free_pool; - - /* Reclaimers: index 0 is the benign reclaimer, 1 is the destructive reclaimer - */ - grpc_closure *reclaimers[2]; - /* Trampoline closures to finish reclamation and re-enter the quota combiner - lock */ - grpc_closure post_reclaimer_closure[2]; - - /* Closure to execute under the quota combiner to de-register and shutdown the - resource user */ - grpc_closure destroy_closure; - /* User supplied closure to call once the user has finished shutting down AND - all outstanding allocations have been freed. Real type is grpc_closure*, - but it's stored as an atomic to avoid a mutex on some fast paths. */ - gpr_atm on_done_destroy_closure; - - /* Links in the various grpc_rulist lists */ - grpc_resource_user_link links[GRPC_RULIST_COUNT]; - - /* The name of this resource user, for debugging/tracing */ - char *name; -}; - -void grpc_resource_user_init(grpc_resource_user *resource_user, - grpc_resource_quota *resource_quota, - const char *name); +grpc_resource_user *grpc_resource_user_create( + grpc_resource_quota *resource_quota, const char *name); +void grpc_resource_user_ref(grpc_resource_user *resource_user); +void grpc_resource_user_unref(grpc_exec_ctx *exec_ctx, + grpc_resource_user *resource_user); void grpc_resource_user_shutdown(grpc_exec_ctx *exec_ctx, - grpc_resource_user *resource_user, - grpc_closure *on_done); -void grpc_resource_user_destroy(grpc_exec_ctx *exec_ctx, - grpc_resource_user *resource_user); + grpc_resource_user *resource_user); /* Allocate from the resource user (and its quota). If optional_on_done is NULL, then allocate immediately. This may push the diff --git a/src/core/lib/iomgr/tcp_posix.c b/src/core/lib/iomgr/tcp_posix.c index 880af93ee1..70416c6eef 100644 --- a/src/core/lib/iomgr/tcp_posix.c +++ b/src/core/lib/iomgr/tcp_posix.c @@ -102,7 +102,7 @@ typedef struct { char *peer_string; - grpc_resource_user resource_user; + grpc_resource_user *resource_user; grpc_resource_user_slice_allocator slice_allocator; } grpc_tcp; @@ -110,28 +110,18 @@ static void tcp_handle_read(grpc_exec_ctx *exec_ctx, void *arg /* grpc_tcp */, grpc_error *error); static void tcp_handle_write(grpc_exec_ctx *exec_ctx, void *arg /* grpc_tcp */, grpc_error *error); -static void tcp_unref_closure(grpc_exec_ctx *exec_ctx, void *arg /* grpc_tcp */, - grpc_error *error); - -static void tcp_maybe_shutdown_resource_user(grpc_exec_ctx *exec_ctx, - grpc_tcp *tcp) { - if (gpr_atm_full_fetch_add(&tcp->shutdown_count, 1) == 0) { - grpc_resource_user_shutdown(exec_ctx, &tcp->resource_user, - grpc_closure_create(tcp_unref_closure, tcp)); - } -} static void tcp_shutdown(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep) { grpc_tcp *tcp = (grpc_tcp *)ep; - tcp_maybe_shutdown_resource_user(exec_ctx, tcp); grpc_fd_shutdown(exec_ctx, tcp->em_fd); + grpc_resource_user_shutdown(exec_ctx, tcp->resource_user); } static void tcp_free(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp) { grpc_fd_orphan(exec_ctx, tcp->em_fd, tcp->release_fd_cb, tcp->release_fd, "tcp_unref_orphan"); gpr_slice_buffer_destroy(&tcp->last_read_buffer); - grpc_resource_user_destroy(exec_ctx, &tcp->resource_user); + grpc_resource_user_unref(exec_ctx, tcp->resource_user); gpr_free(tcp->peer_string); gpr_free(tcp); } @@ -168,15 +158,9 @@ static void tcp_unref(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp) { static void tcp_ref(grpc_tcp *tcp) { gpr_ref(&tcp->refcount); } #endif -static void tcp_unref_closure(grpc_exec_ctx *exec_ctx, void *arg, - grpc_error *error) { - TCP_UNREF(exec_ctx, arg, "resource_user"); -} - static void tcp_destroy(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep) { grpc_network_status_unregister_endpoint(ep); grpc_tcp *tcp = (grpc_tcp *)ep; - tcp_maybe_shutdown_resource_user(exec_ctx, tcp); gpr_slice_buffer_reset_and_unref(&tcp->last_read_buffer); TCP_UNREF(exec_ctx, tcp, "destroy"); } @@ -515,7 +499,7 @@ static grpc_workqueue *tcp_get_workqueue(grpc_endpoint *ep) { static grpc_resource_user *tcp_get_resource_user(grpc_endpoint *ep) { grpc_tcp *tcp = (grpc_tcp *)ep; - return &tcp->resource_user; + return tcp->resource_user; } static const grpc_endpoint_vtable vtable = {tcp_read, @@ -543,9 +527,8 @@ grpc_endpoint *grpc_tcp_create(grpc_fd *em_fd, tcp->slice_size = slice_size; tcp->iov_size = 1; tcp->finished_edge = true; - /* paired with unref in grpc_tcp_destroy, and with the shutdown for our - * resource_user */ - gpr_ref_init(&tcp->refcount, 2); + /* paired with unref in grpc_tcp_destroy */ + gpr_ref_init(&tcp->refcount, 1); gpr_atm_no_barrier_store(&tcp->shutdown_count, 0); tcp->em_fd = em_fd; tcp->read_closure.cb = tcp_handle_read; @@ -553,10 +536,9 @@ grpc_endpoint *grpc_tcp_create(grpc_fd *em_fd, tcp->write_closure.cb = tcp_handle_write; tcp->write_closure.cb_arg = tcp; gpr_slice_buffer_init(&tcp->last_read_buffer); - grpc_resource_user_init(&tcp->resource_user, resource_quota, peer_string); - grpc_resource_user_slice_allocator_init(&tcp->slice_allocator, - &tcp->resource_user, - tcp_read_allocation_done, tcp); + tcp->resource_user = grpc_resource_user_create(resource_quota, peer_string); + grpc_resource_user_slice_allocator_init( + &tcp->slice_allocator, tcp->resource_user, tcp_read_allocation_done, tcp); /* Tell network status tracker about new endpoint */ grpc_network_status_register_endpoint(&tcp->base); @@ -576,7 +558,6 @@ void grpc_tcp_destroy_and_release_fd(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, GPR_ASSERT(ep->vtable == &vtable); tcp->release_fd = fd; tcp->release_fd_cb = done; - tcp_maybe_shutdown_resource_user(exec_ctx, tcp); gpr_slice_buffer_reset_and_unref(&tcp->last_read_buffer); TCP_UNREF(exec_ctx, tcp, "destroy"); } diff --git a/test/core/iomgr/resource_quota_test.c b/test/core/iomgr/resource_quota_test.c index 34dee1aee1..22c4e4e989 100644 --- a/test/core/iomgr/resource_quota_test.c +++ b/test/core/iomgr/resource_quota_test.c @@ -81,11 +81,7 @@ grpc_closure *make_unused_reclaimer(grpc_closure *then) { static void destroy_user(grpc_resource_user *usr) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - bool done = false; - grpc_resource_user_shutdown(&exec_ctx, usr, set_bool(&done)); - grpc_exec_ctx_flush(&exec_ctx); - GPR_ASSERT(done); - grpc_resource_user_destroy(&exec_ctx, usr); + grpc_resource_user_unref(&exec_ctx, usr); grpc_exec_ctx_finish(&exec_ctx); } @@ -106,10 +102,9 @@ static void test_resource_user_no_op(void) { gpr_log(GPR_INFO, "** test_resource_user_no_op **"); grpc_resource_quota *q = grpc_resource_quota_create("test_resource_user_no_op"); - grpc_resource_user usr; - grpc_resource_user_init(&usr, q, "usr"); + grpc_resource_user *usr = grpc_resource_user_create(q, "usr"); grpc_resource_quota_unref(q); - destroy_user(&usr); + destroy_user(usr); } static void test_instant_alloc_then_free(void) { @@ -117,20 +112,19 @@ static void test_instant_alloc_then_free(void) { grpc_resource_quota *q = grpc_resource_quota_create("test_instant_alloc_then_free"); grpc_resource_quota_resize(q, 1024 * 1024); - grpc_resource_user usr; - grpc_resource_user_init(&usr, q, "usr"); + grpc_resource_user *usr = grpc_resource_user_create(q, "usr"); { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_alloc(&exec_ctx, &usr, 1024, NULL); + grpc_resource_user_alloc(&exec_ctx, usr, 1024, NULL); grpc_exec_ctx_finish(&exec_ctx); } { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_free(&exec_ctx, &usr, 1024); + grpc_resource_user_free(&exec_ctx, usr, 1024); grpc_exec_ctx_finish(&exec_ctx); } grpc_resource_quota_unref(q); - destroy_user(&usr); + destroy_user(usr); } static void test_instant_alloc_free_pair(void) { @@ -138,16 +132,15 @@ static void test_instant_alloc_free_pair(void) { grpc_resource_quota *q = grpc_resource_quota_create("test_instant_alloc_free_pair"); grpc_resource_quota_resize(q, 1024 * 1024); - grpc_resource_user usr; - grpc_resource_user_init(&usr, q, "usr"); + grpc_resource_user *usr = grpc_resource_user_create(q, "usr"); { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_alloc(&exec_ctx, &usr, 1024, NULL); - grpc_resource_user_free(&exec_ctx, &usr, 1024); + grpc_resource_user_alloc(&exec_ctx, usr, 1024, NULL); + grpc_resource_user_free(&exec_ctx, usr, 1024); grpc_exec_ctx_finish(&exec_ctx); } grpc_resource_quota_unref(q); - destroy_user(&usr); + destroy_user(usr); } static void test_simple_async_alloc(void) { @@ -155,22 +148,21 @@ static void test_simple_async_alloc(void) { grpc_resource_quota *q = grpc_resource_quota_create("test_simple_async_alloc"); grpc_resource_quota_resize(q, 1024 * 1024); - grpc_resource_user usr; - grpc_resource_user_init(&usr, q, "usr"); + grpc_resource_user *usr = grpc_resource_user_create(q, "usr"); { bool done = false; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_alloc(&exec_ctx, &usr, 1024, set_bool(&done)); + grpc_resource_user_alloc(&exec_ctx, usr, 1024, set_bool(&done)); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(done); } { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_free(&exec_ctx, &usr, 1024); + grpc_resource_user_free(&exec_ctx, usr, 1024); grpc_exec_ctx_finish(&exec_ctx); } grpc_resource_quota_unref(q); - destroy_user(&usr); + destroy_user(usr); } static void test_async_alloc_blocked_by_size(void) { @@ -178,12 +170,11 @@ static void test_async_alloc_blocked_by_size(void) { grpc_resource_quota *q = grpc_resource_quota_create("test_async_alloc_blocked_by_size"); grpc_resource_quota_resize(q, 1); - grpc_resource_user usr; - grpc_resource_user_init(&usr, q, "usr"); + grpc_resource_user *usr = grpc_resource_user_create(q, "usr"); bool done = false; { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_alloc(&exec_ctx, &usr, 1024, set_bool(&done)); + grpc_resource_user_alloc(&exec_ctx, usr, 1024, set_bool(&done)); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(!done); } @@ -191,87 +182,83 @@ static void test_async_alloc_blocked_by_size(void) { GPR_ASSERT(done); { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_free(&exec_ctx, &usr, 1024); + grpc_resource_user_free(&exec_ctx, usr, 1024); grpc_exec_ctx_finish(&exec_ctx); } grpc_resource_quota_unref(q); - destroy_user(&usr); + destroy_user(usr); } static void test_scavenge(void) { gpr_log(GPR_INFO, "** test_scavenge **"); grpc_resource_quota *q = grpc_resource_quota_create("test_scavenge"); grpc_resource_quota_resize(q, 1024); - grpc_resource_user usr1; - grpc_resource_user usr2; - grpc_resource_user_init(&usr1, q, "usr1"); - grpc_resource_user_init(&usr2, q, "usr2"); + grpc_resource_user *usr1 = grpc_resource_user_create(q, "usr1"); + grpc_resource_user *usr2 = grpc_resource_user_create(q, "usr2"); { bool done = false; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_alloc(&exec_ctx, &usr1, 1024, set_bool(&done)); + grpc_resource_user_alloc(&exec_ctx, usr1, 1024, set_bool(&done)); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(done); } { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_free(&exec_ctx, &usr1, 1024); + grpc_resource_user_free(&exec_ctx, usr1, 1024); grpc_exec_ctx_finish(&exec_ctx); } { bool done = false; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_alloc(&exec_ctx, &usr2, 1024, set_bool(&done)); + grpc_resource_user_alloc(&exec_ctx, usr2, 1024, set_bool(&done)); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(done); } { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_free(&exec_ctx, &usr2, 1024); + grpc_resource_user_free(&exec_ctx, usr2, 1024); grpc_exec_ctx_finish(&exec_ctx); } grpc_resource_quota_unref(q); - destroy_user(&usr1); - destroy_user(&usr2); + destroy_user(usr1); + destroy_user(usr2); } static void test_scavenge_blocked(void) { gpr_log(GPR_INFO, "** test_scavenge_blocked **"); grpc_resource_quota *q = grpc_resource_quota_create("test_scavenge_blocked"); grpc_resource_quota_resize(q, 1024); - grpc_resource_user usr1; - grpc_resource_user usr2; - grpc_resource_user_init(&usr1, q, "usr1"); - grpc_resource_user_init(&usr2, q, "usr2"); + grpc_resource_user *usr1 = grpc_resource_user_create(q, "usr1"); + grpc_resource_user *usr2 = grpc_resource_user_create(q, "usr2"); bool done; { done = false; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_alloc(&exec_ctx, &usr1, 1024, set_bool(&done)); + grpc_resource_user_alloc(&exec_ctx, usr1, 1024, set_bool(&done)); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(done); } { done = false; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_alloc(&exec_ctx, &usr2, 1024, set_bool(&done)); + grpc_resource_user_alloc(&exec_ctx, usr2, 1024, set_bool(&done)); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(!done); } { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_free(&exec_ctx, &usr1, 1024); + grpc_resource_user_free(&exec_ctx, usr1, 1024); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(done); } { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_free(&exec_ctx, &usr2, 1024); + grpc_resource_user_free(&exec_ctx, usr2, 1024); grpc_exec_ctx_finish(&exec_ctx); } grpc_resource_quota_unref(q); - destroy_user(&usr1); - destroy_user(&usr2); + destroy_user(usr1); + destroy_user(usr2); } static void test_blocked_until_scheduled_reclaim(void) { @@ -279,12 +266,11 @@ static void test_blocked_until_scheduled_reclaim(void) { grpc_resource_quota *q = grpc_resource_quota_create("test_blocked_until_scheduled_reclaim"); grpc_resource_quota_resize(q, 1024); - grpc_resource_user usr; - grpc_resource_user_init(&usr, q, "usr"); + grpc_resource_user *usr = grpc_resource_user_create(q, "usr"); { bool done = false; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_alloc(&exec_ctx, &usr, 1024, set_bool(&done)); + grpc_resource_user_alloc(&exec_ctx, usr, 1024, set_bool(&done)); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(done); } @@ -292,25 +278,25 @@ static void test_blocked_until_scheduled_reclaim(void) { { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_resource_user_post_reclaimer( - &exec_ctx, &usr, false, - make_reclaimer(&usr, 1024, set_bool(&reclaim_done))); + &exec_ctx, usr, false, + make_reclaimer(usr, 1024, set_bool(&reclaim_done))); grpc_exec_ctx_finish(&exec_ctx); } { bool done = false; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_alloc(&exec_ctx, &usr, 1024, set_bool(&done)); + grpc_resource_user_alloc(&exec_ctx, usr, 1024, set_bool(&done)); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(reclaim_done); GPR_ASSERT(done); } { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_free(&exec_ctx, &usr, 1024); + grpc_resource_user_free(&exec_ctx, usr, 1024); grpc_exec_ctx_finish(&exec_ctx); } grpc_resource_quota_unref(q); - destroy_user(&usr); + destroy_user(usr); } static void test_blocked_until_scheduled_reclaim_and_scavenge(void) { @@ -318,14 +304,12 @@ static void test_blocked_until_scheduled_reclaim_and_scavenge(void) { grpc_resource_quota *q = grpc_resource_quota_create( "test_blocked_until_scheduled_reclaim_and_scavenge"); grpc_resource_quota_resize(q, 1024); - grpc_resource_user usr1; - grpc_resource_user usr2; - grpc_resource_user_init(&usr1, q, "usr1"); - grpc_resource_user_init(&usr2, q, "usr2"); + grpc_resource_user *usr1 = grpc_resource_user_create(q, "usr1"); + grpc_resource_user *usr2 = grpc_resource_user_create(q, "usr2"); { bool done = false; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_alloc(&exec_ctx, &usr1, 1024, set_bool(&done)); + grpc_resource_user_alloc(&exec_ctx, usr1, 1024, set_bool(&done)); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(done); } @@ -333,26 +317,26 @@ static void test_blocked_until_scheduled_reclaim_and_scavenge(void) { { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_resource_user_post_reclaimer( - &exec_ctx, &usr1, false, - make_reclaimer(&usr1, 1024, set_bool(&reclaim_done))); + &exec_ctx, usr1, false, + make_reclaimer(usr1, 1024, set_bool(&reclaim_done))); grpc_exec_ctx_finish(&exec_ctx); } { bool done = false; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_alloc(&exec_ctx, &usr2, 1024, set_bool(&done)); + grpc_resource_user_alloc(&exec_ctx, usr2, 1024, set_bool(&done)); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(reclaim_done); GPR_ASSERT(done); } { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_free(&exec_ctx, &usr2, 1024); + grpc_resource_user_free(&exec_ctx, usr2, 1024); grpc_exec_ctx_finish(&exec_ctx); } grpc_resource_quota_unref(q); - destroy_user(&usr1); - destroy_user(&usr2); + destroy_user(usr1); + destroy_user(usr2); } static void test_blocked_until_scheduled_destructive_reclaim(void) { @@ -360,12 +344,11 @@ static void test_blocked_until_scheduled_destructive_reclaim(void) { grpc_resource_quota *q = grpc_resource_quota_create( "test_blocked_until_scheduled_destructive_reclaim"); grpc_resource_quota_resize(q, 1024); - grpc_resource_user usr; - grpc_resource_user_init(&usr, q, "usr"); + grpc_resource_user *usr = grpc_resource_user_create(q, "usr"); { bool done = false; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_alloc(&exec_ctx, &usr, 1024, set_bool(&done)); + grpc_resource_user_alloc(&exec_ctx, usr, 1024, set_bool(&done)); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(done); } @@ -373,25 +356,25 @@ static void test_blocked_until_scheduled_destructive_reclaim(void) { { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_resource_user_post_reclaimer( - &exec_ctx, &usr, true, - make_reclaimer(&usr, 1024, set_bool(&reclaim_done))); + &exec_ctx, usr, true, + make_reclaimer(usr, 1024, set_bool(&reclaim_done))); grpc_exec_ctx_finish(&exec_ctx); } { bool done = false; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_alloc(&exec_ctx, &usr, 1024, set_bool(&done)); + grpc_resource_user_alloc(&exec_ctx, usr, 1024, set_bool(&done)); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(reclaim_done); GPR_ASSERT(done); } { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_free(&exec_ctx, &usr, 1024); + grpc_resource_user_free(&exec_ctx, usr, 1024); grpc_exec_ctx_finish(&exec_ctx); } grpc_resource_quota_unref(q); - destroy_user(&usr); + destroy_user(usr); } static void test_unused_reclaim_is_cancelled(void) { @@ -399,23 +382,22 @@ static void test_unused_reclaim_is_cancelled(void) { grpc_resource_quota *q = grpc_resource_quota_create("test_unused_reclaim_is_cancelled"); grpc_resource_quota_resize(q, 1024); - grpc_resource_user usr; - grpc_resource_user_init(&usr, q, "usr"); + grpc_resource_user *usr = grpc_resource_user_create(q, "usr"); bool benign_done = false; bool destructive_done = false; { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_resource_user_post_reclaimer( - &exec_ctx, &usr, false, make_unused_reclaimer(set_bool(&benign_done))); + &exec_ctx, usr, false, make_unused_reclaimer(set_bool(&benign_done))); grpc_resource_user_post_reclaimer( - &exec_ctx, &usr, true, + &exec_ctx, usr, true, make_unused_reclaimer(set_bool(&destructive_done))); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(!benign_done); GPR_ASSERT(!destructive_done); } grpc_resource_quota_unref(q); - destroy_user(&usr); + destroy_user(usr); GPR_ASSERT(benign_done); GPR_ASSERT(destructive_done); } @@ -425,24 +407,23 @@ static void test_benign_reclaim_is_preferred(void) { grpc_resource_quota *q = grpc_resource_quota_create("test_benign_reclaim_is_preferred"); grpc_resource_quota_resize(q, 1024); - grpc_resource_user usr; - grpc_resource_user_init(&usr, q, "usr"); + grpc_resource_user *usr = grpc_resource_user_create(q, "usr"); bool benign_done = false; bool destructive_done = false; { bool done = false; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_alloc(&exec_ctx, &usr, 1024, set_bool(&done)); + grpc_resource_user_alloc(&exec_ctx, usr, 1024, set_bool(&done)); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(done); } { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_resource_user_post_reclaimer( - &exec_ctx, &usr, false, - make_reclaimer(&usr, 1024, set_bool(&benign_done))); + &exec_ctx, usr, false, + make_reclaimer(usr, 1024, set_bool(&benign_done))); grpc_resource_user_post_reclaimer( - &exec_ctx, &usr, true, + &exec_ctx, usr, true, make_unused_reclaimer(set_bool(&destructive_done))); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(!benign_done); @@ -451,7 +432,7 @@ static void test_benign_reclaim_is_preferred(void) { { bool done = false; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_alloc(&exec_ctx, &usr, 1024, set_bool(&done)); + grpc_resource_user_alloc(&exec_ctx, usr, 1024, set_bool(&done)); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(benign_done); GPR_ASSERT(!destructive_done); @@ -459,11 +440,11 @@ static void test_benign_reclaim_is_preferred(void) { } { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_free(&exec_ctx, &usr, 1024); + grpc_resource_user_free(&exec_ctx, usr, 1024); grpc_exec_ctx_finish(&exec_ctx); } grpc_resource_quota_unref(q); - destroy_user(&usr); + destroy_user(usr); GPR_ASSERT(benign_done); GPR_ASSERT(destructive_done); } @@ -473,25 +454,24 @@ static void test_multiple_reclaims_can_be_triggered(void) { grpc_resource_quota *q = grpc_resource_quota_create("test_multiple_reclaims_can_be_triggered"); grpc_resource_quota_resize(q, 1024); - grpc_resource_user usr; - grpc_resource_user_init(&usr, q, "usr"); + grpc_resource_user *usr = grpc_resource_user_create(q, "usr"); bool benign_done = false; bool destructive_done = false; { bool done = false; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_alloc(&exec_ctx, &usr, 1024, set_bool(&done)); + grpc_resource_user_alloc(&exec_ctx, usr, 1024, set_bool(&done)); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(done); } { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_resource_user_post_reclaimer( - &exec_ctx, &usr, false, - make_reclaimer(&usr, 512, set_bool(&benign_done))); + &exec_ctx, usr, false, + make_reclaimer(usr, 512, set_bool(&benign_done))); grpc_resource_user_post_reclaimer( - &exec_ctx, &usr, true, - make_reclaimer(&usr, 512, set_bool(&destructive_done))); + &exec_ctx, usr, true, + make_reclaimer(usr, 512, set_bool(&destructive_done))); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(!benign_done); GPR_ASSERT(!destructive_done); @@ -499,7 +479,7 @@ static void test_multiple_reclaims_can_be_triggered(void) { { bool done = false; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_alloc(&exec_ctx, &usr, 1024, set_bool(&done)); + grpc_resource_user_alloc(&exec_ctx, usr, 1024, set_bool(&done)); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(benign_done); GPR_ASSERT(destructive_done); @@ -507,11 +487,11 @@ static void test_multiple_reclaims_can_be_triggered(void) { } { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_free(&exec_ctx, &usr, 1024); + grpc_resource_user_free(&exec_ctx, usr, 1024); grpc_exec_ctx_finish(&exec_ctx); } grpc_resource_quota_unref(q); - destroy_user(&usr); + destroy_user(usr); GPR_ASSERT(benign_done); GPR_ASSERT(destructive_done); } @@ -522,30 +502,21 @@ static void test_resource_user_stays_allocated_until_memory_released(void) { grpc_resource_quota *q = grpc_resource_quota_create( "test_resource_user_stays_allocated_until_memory_released"); grpc_resource_quota_resize(q, 1024 * 1024); - grpc_resource_user usr; - grpc_resource_user_init(&usr, q, "usr"); - bool done = false; + grpc_resource_user *usr = grpc_resource_user_create(q, "usr"); { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_alloc(&exec_ctx, &usr, 1024, NULL); + grpc_resource_user_alloc(&exec_ctx, usr, 1024, NULL); grpc_exec_ctx_finish(&exec_ctx); } { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_resource_quota_unref(q); - grpc_resource_user_shutdown(&exec_ctx, &usr, set_bool(&done)); + grpc_resource_user_unref(&exec_ctx, usr); grpc_exec_ctx_finish(&exec_ctx); - GPR_ASSERT(!done); } { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_free(&exec_ctx, &usr, 1024); - grpc_exec_ctx_finish(&exec_ctx); - GPR_ASSERT(done); - } - { - grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_destroy(&exec_ctx, &usr); + grpc_resource_user_free(&exec_ctx, usr, 1024); grpc_exec_ctx_finish(&exec_ctx); } } @@ -562,14 +533,12 @@ test_resource_user_stays_allocated_and_reclaimers_unrun_until_memory_released( "released"); grpc_resource_quota_resize(q, 1024); for (int i = 0; i < 10; i++) { - grpc_resource_user usr; - grpc_resource_user_init(&usr, q, "usr"); - bool done = false; + grpc_resource_user *usr = grpc_resource_user_create(q, "usr"); bool reclaimer_cancelled = false; { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_resource_user_post_reclaimer( - &exec_ctx, &usr, false, + &exec_ctx, usr, false, make_unused_reclaimer(set_bool(&reclaimer_cancelled))); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(!reclaimer_cancelled); @@ -577,30 +546,23 @@ test_resource_user_stays_allocated_and_reclaimers_unrun_until_memory_released( { bool allocated = false; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_alloc(&exec_ctx, &usr, 1024, set_bool(&allocated)); + grpc_resource_user_alloc(&exec_ctx, usr, 1024, set_bool(&allocated)); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(allocated); GPR_ASSERT(!reclaimer_cancelled); } { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_shutdown(&exec_ctx, &usr, set_bool(&done)); + grpc_resource_user_unref(&exec_ctx, usr); grpc_exec_ctx_finish(&exec_ctx); - GPR_ASSERT(!done); GPR_ASSERT(!reclaimer_cancelled); } { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_free(&exec_ctx, &usr, 1024); + grpc_resource_user_free(&exec_ctx, usr, 1024); grpc_exec_ctx_finish(&exec_ctx); - GPR_ASSERT(done); GPR_ASSERT(reclaimer_cancelled); } - { - grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_destroy(&exec_ctx, &usr); - grpc_exec_ctx_finish(&exec_ctx); - } } grpc_resource_quota_unref(q); } @@ -610,12 +572,11 @@ static void test_reclaimers_can_be_posted_repeatedly(void) { grpc_resource_quota *q = grpc_resource_quota_create("test_reclaimers_can_be_posted_repeatedly"); grpc_resource_quota_resize(q, 1024); - grpc_resource_user usr; - grpc_resource_user_init(&usr, q, "usr"); + grpc_resource_user *usr = grpc_resource_user_create(q, "usr"); { bool allocated = false; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_alloc(&exec_ctx, &usr, 1024, set_bool(&allocated)); + grpc_resource_user_alloc(&exec_ctx, usr, 1024, set_bool(&allocated)); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(allocated); } @@ -624,15 +585,15 @@ static void test_reclaimers_can_be_posted_repeatedly(void) { { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_resource_user_post_reclaimer( - &exec_ctx, &usr, false, - make_reclaimer(&usr, 1024, set_bool(&reclaimer_done))); + &exec_ctx, usr, false, + make_reclaimer(usr, 1024, set_bool(&reclaimer_done))); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(!reclaimer_done); } { bool allocated = false; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_alloc(&exec_ctx, &usr, 1024, set_bool(&allocated)); + grpc_resource_user_alloc(&exec_ctx, usr, 1024, set_bool(&allocated)); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(allocated); GPR_ASSERT(reclaimer_done); @@ -640,10 +601,10 @@ static void test_reclaimers_can_be_posted_repeatedly(void) { } { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_free(&exec_ctx, &usr, 1024); + grpc_resource_user_free(&exec_ctx, usr, 1024); grpc_exec_ctx_finish(&exec_ctx); } - destroy_user(&usr); + destroy_user(usr); grpc_resource_quota_unref(q); } @@ -653,13 +614,11 @@ static void test_one_slice(void) { grpc_resource_quota *q = grpc_resource_quota_create("test_one_slice"); grpc_resource_quota_resize(q, 1024); - grpc_resource_user usr; - grpc_resource_user_init(&usr, q, "usr"); + grpc_resource_user *usr = grpc_resource_user_create(q, "usr"); grpc_resource_user_slice_allocator alloc; int num_allocs = 0; - grpc_resource_user_slice_allocator_init(&alloc, &usr, inc_int_cb, - &num_allocs); + grpc_resource_user_slice_allocator_init(&alloc, usr, inc_int_cb, &num_allocs); gpr_slice_buffer buffer; gpr_slice_buffer_init(&buffer); @@ -673,7 +632,7 @@ static void test_one_slice(void) { } gpr_slice_buffer_destroy(&buffer); - destroy_user(&usr); + destroy_user(usr); grpc_resource_quota_unref(q); } @@ -684,13 +643,11 @@ static void test_one_slice_deleted_late(void) { grpc_resource_quota_create("test_one_slice_deleted_late"); grpc_resource_quota_resize(q, 1024); - grpc_resource_user usr; - grpc_resource_user_init(&usr, q, "usr"); + grpc_resource_user *usr = grpc_resource_user_create(q, "usr"); grpc_resource_user_slice_allocator alloc; int num_allocs = 0; - grpc_resource_user_slice_allocator_init(&alloc, &usr, inc_int_cb, - &num_allocs); + grpc_resource_user_slice_allocator_init(&alloc, usr, inc_int_cb, &num_allocs); gpr_slice_buffer buffer; gpr_slice_buffer_init(&buffer); @@ -703,22 +660,14 @@ static void test_one_slice_deleted_late(void) { GPR_ASSERT(num_allocs == start_allocs + 1); } - bool done = false; { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_shutdown(&exec_ctx, &usr, set_bool(&done)); + grpc_resource_user_unref(&exec_ctx, usr); grpc_exec_ctx_finish(&exec_ctx); - GPR_ASSERT(!done); } grpc_resource_quota_unref(q); gpr_slice_buffer_destroy(&buffer); - GPR_ASSERT(done); - { - grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_destroy(&exec_ctx, &usr); - grpc_exec_ctx_finish(&exec_ctx); - } } int main(int argc, char **argv) { diff --git a/test/core/util/mock_endpoint.c b/test/core/util/mock_endpoint.c index 2b041a4484..2dac877a65 100644 --- a/test/core/util/mock_endpoint.c +++ b/test/core/util/mock_endpoint.c @@ -41,12 +41,11 @@ typedef struct grpc_mock_endpoint { grpc_endpoint base; gpr_mu mu; - int refs; void (*on_write)(gpr_slice slice); gpr_slice_buffer read_buffer; gpr_slice_buffer *on_read_out; grpc_closure *on_read; - grpc_resource_user resource_user; + grpc_resource_user *resource_user; } grpc_mock_endpoint; static void me_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, @@ -78,24 +77,6 @@ static void me_add_to_pollset(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, static void me_add_to_pollset_set(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, grpc_pollset_set *pollset) {} -static void unref(grpc_exec_ctx *exec_ctx, grpc_mock_endpoint *m) { - gpr_mu_lock(&m->mu); - if (0 == --m->refs) { - gpr_mu_unlock(&m->mu); - gpr_slice_buffer_destroy(&m->read_buffer); - grpc_resource_user_destroy(exec_ctx, &m->resource_user); - gpr_free(m); - } else { - gpr_mu_unlock(&m->mu); - } -} - -static void me_finish_shutdown(grpc_exec_ctx *exec_ctx, void *me, - grpc_error *error) { - grpc_mock_endpoint *m = me; - unref(exec_ctx, m); -} - static void me_shutdown(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep) { grpc_mock_endpoint *m = (grpc_mock_endpoint *)ep; gpr_mu_lock(&m->mu); @@ -104,14 +85,15 @@ static void me_shutdown(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep) { GRPC_ERROR_CREATE("Endpoint Shutdown"), NULL); m->on_read = NULL; } - grpc_resource_user_shutdown(exec_ctx, &m->resource_user, - grpc_closure_create(me_finish_shutdown, m)); gpr_mu_unlock(&m->mu); + grpc_resource_user_shutdown(exec_ctx, m->resource_user); } static void me_destroy(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep) { grpc_mock_endpoint *m = (grpc_mock_endpoint *)ep; - unref(exec_ctx, m); + gpr_slice_buffer_destroy(&m->read_buffer); + grpc_resource_user_unref(exec_ctx, m->resource_user); + gpr_free(m); } static char *me_get_peer(grpc_endpoint *ep) { @@ -120,7 +102,7 @@ static char *me_get_peer(grpc_endpoint *ep) { static grpc_resource_user *me_get_resource_user(grpc_endpoint *ep) { grpc_mock_endpoint *m = (grpc_mock_endpoint *)ep; - return &m->resource_user; + return m->resource_user; } static grpc_workqueue *me_get_workqueue(grpc_endpoint *ep) { return NULL; } @@ -141,10 +123,9 @@ grpc_endpoint *grpc_mock_endpoint_create(void (*on_write)(gpr_slice slice), grpc_resource_quota *resource_quota) { grpc_mock_endpoint *m = gpr_malloc(sizeof(*m)); m->base.vtable = &vtable; - m->refs = 2; char *name; gpr_asprintf(&name, "mock_endpoint_%" PRIxPTR, (intptr_t)m); - grpc_resource_user_init(&m->resource_user, resource_quota, name); + m->resource_user = grpc_resource_user_create(resource_quota, name); gpr_free(name); gpr_slice_buffer_init(&m->read_buffer); gpr_mu_init(&m->mu); diff --git a/test/core/util/passthru_endpoint.c b/test/core/util/passthru_endpoint.c index ee6ef7da60..a920a15aa5 100644 --- a/test/core/util/passthru_endpoint.c +++ b/test/core/util/passthru_endpoint.c @@ -46,7 +46,7 @@ typedef struct { gpr_slice_buffer read_buffer; gpr_slice_buffer *on_read_out; grpc_closure *on_read; - grpc_resource_user resource_user; + grpc_resource_user *resource_user; } half; struct passthru_endpoint { @@ -123,10 +123,10 @@ static void me_shutdown(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep) { m->on_read = NULL; } gpr_mu_unlock(&m->parent->mu); + grpc_resource_user_shutdown(exec_ctx, m->resource_user); } -static void me_really_destroy(grpc_exec_ctx *exec_ctx, void *ep, - grpc_error *error) { +static void me_destroy(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep) { passthru_endpoint *p = ((half *)ep)->parent; gpr_mu_lock(&p->mu); if (0 == --p->halves) { @@ -134,18 +134,14 @@ static void me_really_destroy(grpc_exec_ctx *exec_ctx, void *ep, gpr_mu_destroy(&p->mu); gpr_slice_buffer_destroy(&p->client.read_buffer); gpr_slice_buffer_destroy(&p->server.read_buffer); + grpc_resource_user_unref(exec_ctx, p->client.resource_user); + grpc_resource_user_unref(exec_ctx, p->server.resource_user); gpr_free(p); } else { gpr_mu_unlock(&p->mu); } } -static void me_destroy(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep) { - half *m = (half *)ep; - grpc_resource_user_shutdown(exec_ctx, &m->resource_user, - grpc_closure_create(me_really_destroy, m)); -} - static char *me_get_peer(grpc_endpoint *ep) { return gpr_strdup("fake:mock_endpoint"); } @@ -154,7 +150,7 @@ static grpc_workqueue *me_get_workqueue(grpc_endpoint *ep) { return NULL; } static grpc_resource_user *me_get_resource_user(grpc_endpoint *ep) { half *m = (half *)ep; - return &m->resource_user; + return m->resource_user; } static const grpc_endpoint_vtable vtable = { @@ -179,7 +175,7 @@ static void half_init(half *m, passthru_endpoint *parent, char *name; gpr_asprintf(&name, "passthru_endpoint_%s_%" PRIxPTR, half_name, (intptr_t)parent); - grpc_resource_user_init(&m->resource_user, resource_quota, name); + m->resource_user = grpc_resource_user_create(resource_quota, name); gpr_free(name); } -- cgit v1.2.3 From 314f43991c273683bbcd1789dea71c08a52617c0 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 4 Nov 2016 15:33:10 -0700 Subject: Increase test timeouts These tests are failing when run as a batch, but passing when run in isolation. Suspect something more is up, but this will at least make our builds much greener until we figure that out. --- test/cpp/qps/gen_build_yaml.py | 2 +- tools/run_tests/tests.json | 68 +++++++++++++++++++++--------------------- 2 files changed, 35 insertions(+), 35 deletions(-) (limited to 'test') diff --git a/test/cpp/qps/gen_build_yaml.py b/test/cpp/qps/gen_build_yaml.py index 369da2c8ca..e4d9e7ac58 100755 --- a/test/cpp/qps/gen_build_yaml.py +++ b/test/cpp/qps/gen_build_yaml.py @@ -82,7 +82,7 @@ print yaml.dump({ 'defaults': 'boringssl', 'cpu_cost': guess_cpu(scenario_json), 'exclude_configs': [], - 'timeout_seconds': 3*60 + 'timeout_seconds': 6*60 } for scenario_json in scenario_config.CXXLanguage().scenarios() if 'scalable' in scenario_json.get('CATEGORIES', []) diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json index 7bace54299..49c6d38300 100644 --- a/tools/run_tests/tests.json +++ b/tools/run_tests/tests.json @@ -35266,7 +35266,7 @@ "linux" ], "shortname": "json_run_localhost:cpp_generic_async_streaming_ping_pong_secure", - "timeout_seconds": 180 + "timeout_seconds": 360 }, { "args": [ @@ -35287,7 +35287,7 @@ "linux" ], "shortname": "json_run_localhost:cpp_generic_async_streaming_qps_unconstrained_secure", - "timeout_seconds": 180 + "timeout_seconds": 360 }, { "args": [ @@ -35308,7 +35308,7 @@ "linux" ], "shortname": "json_run_localhost:cpp_generic_async_streaming_qps_one_server_core_secure", - "timeout_seconds": 180 + "timeout_seconds": 360 }, { "args": [ @@ -35329,7 +35329,7 @@ "linux" ], "shortname": "json_run_localhost:cpp_protobuf_async_client_sync_server_unary_qps_unconstrained_secure", - "timeout_seconds": 180 + "timeout_seconds": 360 }, { "args": [ @@ -35350,7 +35350,7 @@ "linux" ], "shortname": "json_run_localhost:cpp_protobuf_async_client_sync_server_streaming_qps_unconstrained_secure", - "timeout_seconds": 180 + "timeout_seconds": 360 }, { "args": [ @@ -35371,7 +35371,7 @@ "linux" ], "shortname": "json_run_localhost:cpp_protobuf_sync_unary_ping_pong_secure", - "timeout_seconds": 180 + "timeout_seconds": 360 }, { "args": [ @@ -35392,7 +35392,7 @@ "linux" ], "shortname": "json_run_localhost:cpp_protobuf_sync_unary_qps_unconstrained_secure", - "timeout_seconds": 180 + "timeout_seconds": 360 }, { "args": [ @@ -35413,7 +35413,7 @@ "linux" ], "shortname": "json_run_localhost:cpp_protobuf_sync_unary_qps_unconstrained_secure_500kib_resource_quota", - "timeout_seconds": 180 + "timeout_seconds": 360 }, { "args": [ @@ -35434,7 +35434,7 @@ "linux" ], "shortname": "json_run_localhost:cpp_protobuf_async_unary_ping_pong_secure", - "timeout_seconds": 180 + "timeout_seconds": 360 }, { "args": [ @@ -35455,7 +35455,7 @@ "linux" ], "shortname": "json_run_localhost:cpp_protobuf_async_unary_qps_unconstrained_secure", - "timeout_seconds": 180 + "timeout_seconds": 360 }, { "args": [ @@ -35476,7 +35476,7 @@ "linux" ], "shortname": "json_run_localhost:cpp_protobuf_async_unary_qps_unconstrained_secure_500kib_resource_quota", - "timeout_seconds": 180 + "timeout_seconds": 360 }, { "args": [ @@ -35497,7 +35497,7 @@ "linux" ], "shortname": "json_run_localhost:cpp_protobuf_sync_streaming_ping_pong_secure", - "timeout_seconds": 180 + "timeout_seconds": 360 }, { "args": [ @@ -35518,7 +35518,7 @@ "linux" ], "shortname": "json_run_localhost:cpp_protobuf_sync_streaming_qps_unconstrained_secure", - "timeout_seconds": 180 + "timeout_seconds": 360 }, { "args": [ @@ -35539,7 +35539,7 @@ "linux" ], "shortname": "json_run_localhost:cpp_protobuf_sync_streaming_qps_unconstrained_secure_500kib_resource_quota", - "timeout_seconds": 180 + "timeout_seconds": 360 }, { "args": [ @@ -35560,7 +35560,7 @@ "linux" ], "shortname": "json_run_localhost:cpp_protobuf_async_streaming_ping_pong_secure", - "timeout_seconds": 180 + "timeout_seconds": 360 }, { "args": [ @@ -35581,7 +35581,7 @@ "linux" ], "shortname": "json_run_localhost:cpp_protobuf_async_streaming_qps_unconstrained_secure", - "timeout_seconds": 180 + "timeout_seconds": 360 }, { "args": [ @@ -35602,7 +35602,7 @@ "linux" ], "shortname": "json_run_localhost:cpp_protobuf_async_streaming_qps_unconstrained_secure_500kib_resource_quota", - "timeout_seconds": 180 + "timeout_seconds": 360 }, { "args": [ @@ -35623,7 +35623,7 @@ "linux" ], "shortname": "json_run_localhost:cpp_generic_async_streaming_ping_pong_insecure", - "timeout_seconds": 180 + "timeout_seconds": 360 }, { "args": [ @@ -35644,7 +35644,7 @@ "linux" ], "shortname": "json_run_localhost:cpp_generic_async_streaming_qps_unconstrained_insecure", - "timeout_seconds": 180 + "timeout_seconds": 360 }, { "args": [ @@ -35665,7 +35665,7 @@ "linux" ], "shortname": "json_run_localhost:cpp_generic_async_streaming_qps_one_server_core_insecure", - "timeout_seconds": 180 + "timeout_seconds": 360 }, { "args": [ @@ -35686,7 +35686,7 @@ "linux" ], "shortname": "json_run_localhost:cpp_protobuf_async_client_sync_server_unary_qps_unconstrained_insecure", - "timeout_seconds": 180 + "timeout_seconds": 360 }, { "args": [ @@ -35707,7 +35707,7 @@ "linux" ], "shortname": "json_run_localhost:cpp_protobuf_async_client_sync_server_streaming_qps_unconstrained_insecure", - "timeout_seconds": 180 + "timeout_seconds": 360 }, { "args": [ @@ -35728,7 +35728,7 @@ "linux" ], "shortname": "json_run_localhost:cpp_protobuf_sync_unary_ping_pong_insecure", - "timeout_seconds": 180 + "timeout_seconds": 360 }, { "args": [ @@ -35749,7 +35749,7 @@ "linux" ], "shortname": "json_run_localhost:cpp_protobuf_sync_unary_qps_unconstrained_insecure", - "timeout_seconds": 180 + "timeout_seconds": 360 }, { "args": [ @@ -35770,7 +35770,7 @@ "linux" ], "shortname": "json_run_localhost:cpp_protobuf_sync_unary_qps_unconstrained_insecure_500kib_resource_quota", - "timeout_seconds": 180 + "timeout_seconds": 360 }, { "args": [ @@ -35791,7 +35791,7 @@ "linux" ], "shortname": "json_run_localhost:cpp_protobuf_async_unary_ping_pong_insecure", - "timeout_seconds": 180 + "timeout_seconds": 360 }, { "args": [ @@ -35812,7 +35812,7 @@ "linux" ], "shortname": "json_run_localhost:cpp_protobuf_async_unary_qps_unconstrained_insecure", - "timeout_seconds": 180 + "timeout_seconds": 360 }, { "args": [ @@ -35833,7 +35833,7 @@ "linux" ], "shortname": "json_run_localhost:cpp_protobuf_async_unary_qps_unconstrained_insecure_500kib_resource_quota", - "timeout_seconds": 180 + "timeout_seconds": 360 }, { "args": [ @@ -35854,7 +35854,7 @@ "linux" ], "shortname": "json_run_localhost:cpp_protobuf_sync_streaming_ping_pong_insecure", - "timeout_seconds": 180 + "timeout_seconds": 360 }, { "args": [ @@ -35875,7 +35875,7 @@ "linux" ], "shortname": "json_run_localhost:cpp_protobuf_sync_streaming_qps_unconstrained_insecure", - "timeout_seconds": 180 + "timeout_seconds": 360 }, { "args": [ @@ -35896,7 +35896,7 @@ "linux" ], "shortname": "json_run_localhost:cpp_protobuf_sync_streaming_qps_unconstrained_insecure_500kib_resource_quota", - "timeout_seconds": 180 + "timeout_seconds": 360 }, { "args": [ @@ -35917,7 +35917,7 @@ "linux" ], "shortname": "json_run_localhost:cpp_protobuf_async_streaming_ping_pong_insecure", - "timeout_seconds": 180 + "timeout_seconds": 360 }, { "args": [ @@ -35938,7 +35938,7 @@ "linux" ], "shortname": "json_run_localhost:cpp_protobuf_async_streaming_qps_unconstrained_insecure", - "timeout_seconds": 180 + "timeout_seconds": 360 }, { "args": [ @@ -35959,7 +35959,7 @@ "linux" ], "shortname": "json_run_localhost:cpp_protobuf_async_streaming_qps_unconstrained_insecure_500kib_resource_quota", - "timeout_seconds": 180 + "timeout_seconds": 360 }, { "args": [ -- cgit v1.2.3 From 25c3543a260fa82b0a43708454e560e1fc1daa77 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 8 Nov 2016 07:57:08 -0800 Subject: Fix sanity --- Makefile | 2 + src/cpp/common/version_cc.cc | 2 +- test/core/end2end/end2end_nosec_tests.c | 13 ------ test/core/end2end/end2end_test_utils.c | 51 ++++++++++++++++++++++ test/core/end2end/end2end_tests.c | 13 ------ test/core/end2end/gen_build_yaml.py | 6 ++- tools/run_tests/sources_and_headers.json | 2 + .../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 ++ 11 files changed, 70 insertions(+), 29 deletions(-) create mode 100644 test/core/end2end/end2end_test_utils.c (limited to 'test') diff --git a/Makefile b/Makefile index 9dc4340a58..09520d0b68 100644 --- a/Makefile +++ b/Makefile @@ -6941,6 +6941,7 @@ endif LIBEND2END_TESTS_SRC = \ test/core/end2end/end2end_tests.c \ + test/core/end2end/end2end_test_utils.c \ test/core/end2end/tests/bad_hostname.c \ test/core/end2end/tests/binary_metadata.c \ test/core/end2end/tests/call_creds.c \ @@ -7025,6 +7026,7 @@ endif LIBEND2END_NOSEC_TESTS_SRC = \ test/core/end2end/end2end_nosec_tests.c \ + test/core/end2end/end2end_test_utils.c \ test/core/end2end/tests/bad_hostname.c \ test/core/end2end/tests/binary_metadata.c \ test/core/end2end/tests/cancel_after_accept.c \ diff --git a/src/cpp/common/version_cc.cc b/src/cpp/common/version_cc.cc index 826ddfba61..7be338417f 100644 --- a/src/cpp/common/version_cc.cc +++ b/src/cpp/common/version_cc.cc @@ -37,5 +37,5 @@ #include namespace grpc { -std::string Version() { return "1.1.0-dev"; } +grpc::string Version() { return "1.1.0-dev"; } } diff --git a/test/core/end2end/end2end_nosec_tests.c b/test/core/end2end/end2end_nosec_tests.c index 7e9b6eb233..caaa97c215 100644 --- a/test/core/end2end/end2end_nosec_tests.c +++ b/test/core/end2end/end2end_nosec_tests.c @@ -416,16 +416,3 @@ void grpc_end2end_tests(int argc, char **argv, abort(); } } - -const char *get_host_override_string(const char *str, - grpc_end2end_test_config config) { - return (config.feature_mask & FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER ? str - : NULL); -} - -void validate_host_override_string(const char *pattern, const char *str, - grpc_end2end_test_config config) { - if (config.feature_mask & FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER) { - GPR_ASSERT(0 == strcmp(str, pattern)); - } -} diff --git a/test/core/end2end/end2end_test_utils.c b/test/core/end2end/end2end_test_utils.c new file mode 100644 index 0000000000..46fb4ec1af --- /dev/null +++ b/test/core/end2end/end2end_test_utils.c @@ -0,0 +1,51 @@ +/* + * + * 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 + +const char *get_host_override_string(const char *str, + grpc_end2end_test_config config) { + return (config.feature_mask & FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER ? str + : NULL); +} + +void validate_host_override_string(const char *pattern, const char *str, + grpc_end2end_test_config config) { + if (config.feature_mask & FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER) { + GPR_ASSERT(0 == strcmp(str, pattern)); + } +} diff --git a/test/core/end2end/end2end_tests.c b/test/core/end2end/end2end_tests.c index 0fbad22641..6d17e686e6 100644 --- a/test/core/end2end/end2end_tests.c +++ b/test/core/end2end/end2end_tests.c @@ -424,16 +424,3 @@ void grpc_end2end_tests(int argc, char **argv, abort(); } } - -const char *get_host_override_string(const char *str, - grpc_end2end_test_config config) { - return (config.feature_mask & FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER ? str - : NULL); -} - -void validate_host_override_string(const char *pattern, const char *str, - grpc_end2end_test_config config) { - if (config.feature_mask & FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER) { - GPR_ASSERT(0 == strcmp(str, pattern)); - } -} diff --git a/test/core/end2end/gen_build_yaml.py b/test/core/end2end/gen_build_yaml.py index 7f33e07a00..26eee93439 100755 --- a/test/core/end2end/gen_build_yaml.py +++ b/test/core/end2end/gen_build_yaml.py @@ -190,7 +190,8 @@ def main(): 'build': 'private', 'language': 'c', 'secure': True, - 'src': ['test/core/end2end/end2end_tests.c'] + [ + 'src': ['test/core/end2end/end2end_tests.c', + 'test/core/end2end/end2end_test_utils.c'] + [ 'test/core/end2end/tests/%s.c' % t for t in sorted(END2END_TESTS.keys())], 'headers': ['test/core/end2end/tests/cancel_test_helpers.h', @@ -204,7 +205,8 @@ def main(): 'build': 'private', 'language': 'c', 'secure': False, - 'src': ['test/core/end2end/end2end_nosec_tests.c'] + [ + 'src': ['test/core/end2end/end2end_nosec_tests.c', + 'test/core/end2end/end2end_test_utils.c'] + [ 'test/core/end2end/tests/%s.c' % t for t in sorted(END2END_TESTS.keys()) if not END2END_TESTS[t].secure], diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index 5bee7ecaff..2faeed8d39 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -6215,6 +6215,7 @@ "language": "c", "name": "end2end_tests", "src": [ + "test/core/end2end/end2end_test_utils.c", "test/core/end2end/end2end_tests.c", "test/core/end2end/end2end_tests.h", "test/core/end2end/tests/bad_hostname.c", @@ -6283,6 +6284,7 @@ "name": "end2end_nosec_tests", "src": [ "test/core/end2end/end2end_nosec_tests.c", + "test/core/end2end/end2end_test_utils.c", "test/core/end2end/end2end_tests.h", "test/core/end2end/tests/bad_hostname.c", "test/core/end2end/tests/binary_metadata.c", 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 a47c40f0f7..3d510d5156 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 @@ -153,6 +153,8 @@ + + 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 71cf6838fe..a0b01ddbc8 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 @@ -4,6 +4,9 @@ test\core\end2end + + test\core\end2end + 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 68ff5f1ebd..5699e8308e 100644 --- a/vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj +++ b/vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj @@ -153,6 +153,8 @@ + + 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 7a620f61a5..bfb5e2b229 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 @@ -4,6 +4,9 @@ test\core\end2end + + test\core\end2end + test\core\end2end\tests -- cgit v1.2.3