aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-11-16 15:54:03 -0800
committerGravatar Craig Tiller <ctiller@google.com>2016-11-16 15:54:03 -0800
commit1094c32f358cef7df323952c117a6773809019c0 (patch)
tree5923eced0f83d9f5df5a04c77b919b22bc2d9dae /test/core
parentdf5b62755155883a888a783b783319e8a2f1110e (diff)
parentf2752ebb3b81cbad4e3b9ac0df5d7021c4659243 (diff)
Merge branch 'slice_with_exec_ctx' into slice_interning
Diffstat (limited to 'test/core')
-rw-r--r--test/core/channel/channel_args_test.c14
-rw-r--r--test/core/channel/channel_stack_test.c7
-rw-r--r--test/core/client_channel/lb_policies_test.c337
-rw-r--r--test/core/end2end/end2end_nosec_tests.c8
-rw-r--r--test/core/end2end/end2end_tests.c8
-rwxr-xr-xtest/core/end2end/gen_build_yaml.py1
-rw-r--r--test/core/end2end/tests/binary_metadata.c37
-rw-r--r--test/core/end2end/tests/filter_latency.c360
-rw-r--r--test/core/internal_api_canaries/iomgr.c7
-rw-r--r--test/core/iomgr/fd_conservation_posix_test.c6
-rw-r--r--test/core/iomgr/fd_posix_test.c5
-rw-r--r--test/core/iomgr/resolve_address_test.c8
-rw-r--r--test/core/iomgr/socket_utils_test.c67
-rw-r--r--test/core/iomgr/udp_server_test.c2
-rw-r--r--test/core/network_benchmarks/low_level_ping_pong.c31
-rw-r--r--test/core/profiling/mark_timings.stp2
-rw-r--r--test/core/security/corpus/ssl_server_corpus/05cda1e986096f42698ee2d86ab0a4a3f6a6690bbin0 -> 158 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/0f65ef472e8308561c77ada56afd4de5932d950abin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/128915cb83e66a736f8a1833c8901eccb81e0656bin0 -> 473 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/134d3a5e7a1609a583f6282c48ef9b871e0fdc15bin0 -> 64 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/13fccd43a6b52c62851ea24e8be4f8cfe6c0103dbin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/171bc6b14b94c72435d2da2e31e9682f12a3f13cbin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/17dea38d21e9282ecd062466cf287ecf5b30c1cfbin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/1961eb9d4dd4bf21cbcd9c45a17b1d025eb0d200bin0 -> 43 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/226ebb5cc16ac42fae3be273de533ac79759ae01bin0 -> 470 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/2333cf428cb1e2976679ac84e64873bf76c6595ebin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/2885553a9e6829265d5f44ea4e24fcf7d6513436bin0 -> 313 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/28bce9a7cb21f3232239b9b71ef568137bf801f4bin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/2a0286615be426d1e7fd5894aadf1a503df05a0abin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/2b4a1f3ebe223d91c042a5e86aff31e460f6cc3fbin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/2cfbe809bcf53160ecc0109b2df01a8696a226fdbin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/2f770de96db36ef9a71f7eb09b2e8695ac1f0655bin0 -> 172 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/30ba8ad171657470b5312232387b7da70c387219bin0 -> 63 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/36548a97a8b847e17a77d1e646c6eb5ec001d84abin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/3c442804f73cfe826a609d97c12ef87852742883bin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/3dad758011b16a3771376f9af91242953be3e47bbin0 -> 61 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/43b56a1adffaf2c3c994679bf2b6fe6414e13df4bin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/4446c60ab89c34e5ccc26bec18d7e7d21fe5aec1bin0 -> 42 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/44924b3866956d0668ec65750c3663279ac84a36bin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/44e4370a4eafde61f8e7dc7e4542e0ad5ecf5253bin0 -> 471 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/44fb8c02117ebd75c97e517624c0abc9f9a76aa7bin0 -> 63 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/45d76dd1f0a29fce3f8d289b5177263871eb3f83bin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/4fcbf18c4135352539eaf445c26f2f8a5da9b68ebin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/508ca86c6f4e6ecc30c252ccf74e78256a893b17bin0 -> 43 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/515d240b860fcd1e77d4a5af291aa4a667d9b609bin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/528e9738d5016f01cf59d74f20a8aa3f341ad89ebin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/54b636a2bb66ccf8247b53ff76a6400e9f1355d0bin0 -> 313 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/5cc337c4b33cd703cd354804530f5b72684260d0bin0 -> 7 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/5ce3ec59111bf328044e41fcf26b3bc542df527ebin0 -> 314 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/5eaac270339f19cfce4eafa2e69d62adf100ad1c1
-rw-r--r--test/core/security/corpus/ssl_server_corpus/6129382083353687a5c3acb3d4274b811227bf3dbin0 -> 43 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/616a25f7c4557ef9eb33d4367c6884abc336802dbin0 -> 46 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/6214e558afbfdb8451e49b62619896492f1a8972bin0 -> 312 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/6c6a6b2ce74acf8a8b90fc0b268ecc7dc992cd602
-rw-r--r--test/core/security/corpus/ssl_server_corpus/6f72309e1b23b824e9bbb9abf74a014b78be038ebin0 -> 64 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/7137ffad853e4dd76c6d6490f37b36e20de7ede0bin0 -> 64 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/71c9356b6b6c5a3a07033d0fa4ed417fa74a77e5bin0 -> 395 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/7414938799ed61282f41d5fb1474751ca52b2682bin0 -> 315 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/75e853eb2ff7e78efb327e114b39baff5a1dd5bbbin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/7607c92952b4429e350260d8074c3c460468fd49bin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/7677373c082fee56d8cdde009d9db5b117a4c8debin0 -> 42 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/76abde5c970743f9fb8bc781e46c431dee2aa1042
-rw-r--r--test/core/security/corpus/ssl_server_corpus/77e0b4e2066853df9d32d475b8788e3d7d19329bbin0 -> 313 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/78e66840048ddc3c75e0e4abffbb3109af0d750ebin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/7dc620eb45764390c7b106362fc4922227415407bin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/82ca7a52d589e9dbae37ebf1c59fac7ad876eb7c1
-rw-r--r--test/core/security/corpus/ssl_server_corpus/8997d472f73eec84fea712638abd762818ec92ecbin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/933bc3fdc56718d7ac0486c26eecddb6db1c5ba2bin0 -> 161 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/94431bda60ddc175cf86273ddc07cb41ecf45fa1bin0 -> 64 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/94c4272b2bb4fa9178eb4ae7dcf4b796fdcb22acbin0 -> 472 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/9551c32a794250fb425005d8faf4bd24475acd41bin0 -> 314 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/9677da7c82f18cec3e0ed2e78aadd6e590271a52bin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/9c2e6291aff608f3f5307a7c80db6b17107f0575bin0 -> 313 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/9c39dc04c7414ca0bb64fb942422bebe83ed8e8fbin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/9cc8547d183a4f2ab7022b36376ca4a6230726c6bin0 -> 313 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/9e19e5e77789c34f99bbe1e6de198610d6765806bin0 -> 317 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/9f0853ccf6912df9fba2d5fc3a1ddece41c377acbin0 -> 20 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/a6d521e501322f052df5a81ee622e0e4942ddcdabin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/a9dc20f09890403be510357a7665a8f0db2468a4bin0 -> 313 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/ac1c60970910880558ae7a2ca2e155cfd7772e05bin0 -> 312 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/afe36d0187a155fc6e4e5c055c0ed0f3802cf696bin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/b12b5fc39edc5407b4a525c414ff6b5e116eee05bin0 -> 65 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/b5b088c6e3a96f88119a940874ab04cb954797ae1
-rw-r--r--test/core/security/corpus/ssl_server_corpus/b65ad77a43ede3394ba714238829860c4ef4bc9fbin0 -> 312 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/b6f265cad9d47e2ccd17a73a6d309d8898dc5428bin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/b7ca5868bca7ae7d1952f44ca966218b26fb7207bin0 -> 43 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/bd20809eacabadb9bcc77d31e42d3359117b03f2bin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/c328623c4ce12505a54cf1a7a1606e1db36e870dbin0 -> 165 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/c823e8bd5526d9fe7d51319737f51bd18bdd75e8bin0 -> 64 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/c9394095d86ff36b69d90f7122592bf51cafe7ddbin0 -> 157 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/cdbf0d2ae953bec07a67b7152785b548e55f85a41
-rw-r--r--test/core/security/corpus/ssl_server_corpus/cef06f9c35ee338998703555847d70c26bfc9474bin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/cfb40ab8eb7031e978bed2418cdc2f0b8a8d8ec7bin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/d30840c3f48f11179ef976ada30477045c6d1e98bin0 -> 312 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/d5afef69141edc7f4911243cf2deb19c912999cfbin0 -> 155 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/d5cf71396e1a04da1a7ec266957ffd2de29d6a57bin0 -> 312 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/d6dd8a2b085db5d33ef24b23502293ce1ce906a3bin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/d7676dcd39b7c7cfaac513a98b56fe4ac8ea27d8bin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/d8c9e9ef14abc23b36cb493283ba3e2812d9e537bin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/d9edb0aa5d2fe4af26ac861770c1530a4075f9191
-rw-r--r--test/core/security/corpus/ssl_server_corpus/da1b52041957334b9ea1371bd2993013118bc82dbin0 -> 62 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/dca7861424c8f92d3720de5c4488454cde1c39dfbin0 -> 64 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/df3755e257d024ef8ab08f6d5cefcf28148ea4b1bin0 -> 64 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/e360a49faefb87d671edb99e777f528f52cac9aebin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/e5e789605744d47e5a5d433bb04db1b413bc91a8bin0 -> 43 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/e6e44a6aa0ece409450c85e43d02c57e338ce1dabin0 -> 314 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/e8ebd49ee98cf57ca7eb35b6e96ef8866270aac6bin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/ea0645f46ccd233337a8389b6118db5b0289f040bin0 -> 312 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/f6f7687df6b7056d3c819c03c9268e22a956b6b5bin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/f725caa73aa9467c5e934c49780fc409b36b251cbin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/f8d3326a860091edd4d60725f96f429d13f3abe6bin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/f9261344b4049e90e88b5af784dd29b938c5c838bin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/f95b97ece3b46815204a8e6d6e94f92ec40a9672bin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/f97db29497e4e3225016a6ced837e20a13622f16bin0 -> 156 bytes
-rw-r--r--test/core/security/corpus/ssl_server_corpus/ff1a900b12f19772f9a86bd5f560a754cdb18d1abin0 -> 311 bytes
-rw-r--r--test/core/security/jwt_verifier_test.c14
-rw-r--r--test/core/security/ssl_server_fuzzer.c146
-rw-r--r--test/core/security/verify_jwt.c4
-rw-r--r--test/core/util/mock_endpoint.c4
-rw-r--r--test/core/util/passthru_endpoint.c4
120 files changed, 918 insertions, 163 deletions
diff --git a/test/core/channel/channel_args_test.c b/test/core/channel/channel_args_test.c
index 261d0c5916..6a325bc12f 100644
--- a/test/core/channel/channel_args_test.c
+++ b/test/core/channel/channel_args_test.c
@@ -141,12 +141,26 @@ static void test_compression_algorithm_states(void) {
grpc_exec_ctx_finish(&exec_ctx);
}
+static void test_set_socket_mutator(void) {
+ grpc_channel_args *ch_args;
+ grpc_socket_mutator mutator;
+ grpc_socket_mutator_init(&mutator, NULL);
+
+ ch_args = grpc_channel_args_set_socket_mutator(NULL, &mutator);
+ GPR_ASSERT(ch_args->num_args == 1);
+ GPR_ASSERT(strcmp(ch_args->args[0].key, GRPC_ARG_SOCKET_MUTATOR) == 0);
+ GPR_ASSERT(ch_args->args[0].type == GRPC_ARG_POINTER);
+
+ grpc_channel_args_destroy(ch_args);
+}
+
int main(int argc, char **argv) {
grpc_test_init(argc, argv);
grpc_init();
test_create();
test_set_compression_algorithm();
test_compression_algorithm_states();
+ test_set_socket_mutator();
grpc_shutdown();
return 0;
}
diff --git a/test/core/channel/channel_stack_test.c b/test/core/channel/channel_stack_test.c
index 3ecc8c0364..54575ae499 100644
--- a/test/core/channel/channel_stack_test.c
+++ b/test/core/channel/channel_stack_test.c
@@ -137,9 +137,10 @@ static void test_create_channel_stack(void) {
GPR_ASSERT(*channel_data == 0);
call_stack = gpr_malloc(channel_stack->call_stack_size);
- grpc_error *error = grpc_call_stack_init(
- &exec_ctx, channel_stack, 1, free_call, call_stack, NULL, NULL, path,
- gpr_inf_future(GPR_CLOCK_MONOTONIC), call_stack);
+ grpc_error *error =
+ grpc_call_stack_init(&exec_ctx, channel_stack, 1, free_call, call_stack,
+ NULL, NULL, path, gpr_now(GPR_CLOCK_MONOTONIC),
+ gpr_inf_future(GPR_CLOCK_MONOTONIC), call_stack);
GPR_ASSERT(error == GRPC_ERROR_NONE);
GPR_ASSERT(call_stack->count == 1);
call_elem = grpc_call_stack_element(call_stack, 0);
diff --git a/test/core/client_channel/lb_policies_test.c b/test/core/client_channel/lb_policies_test.c
index 198aafb91f..c373505dd7 100644
--- a/test/core/client_channel/lb_policies_test.c
+++ b/test/core/client_channel/lb_policies_test.c
@@ -62,8 +62,14 @@ typedef struct servers_fixture {
grpc_metadata_array *request_metadata_recv;
} servers_fixture;
+typedef struct request_sequences {
+ size_t n;
+ int *connections;
+ int *connectivity_states;
+} request_sequences;
+
typedef void (*verifier_fn)(const servers_fixture *, grpc_channel *,
- const int *, const size_t);
+ const request_sequences *, const size_t);
typedef struct test_spec {
size_t num_iters;
@@ -227,9 +233,24 @@ static void teardown_servers(servers_fixture *f) {
gpr_free(f);
}
+static request_sequences request_sequences_create(size_t n) {
+ request_sequences res;
+ res.n = n;
+ res.connections = gpr_malloc(sizeof(*res.connections) * n);
+ res.connectivity_states = gpr_malloc(sizeof(*res.connectivity_states) * n);
+ return res;
+}
+
+static void request_sequences_destroy(const request_sequences *rseqs) {
+ gpr_free(rseqs->connections);
+ gpr_free(rseqs->connectivity_states);
+}
+
/** Returns connection sequence (server indices), which must be freed */
-static int *perform_request(servers_fixture *f, grpc_channel *client,
- request_data *rdata, const test_spec *spec) {
+static request_sequences perform_request(servers_fixture *f,
+ grpc_channel *client,
+ request_data *rdata,
+ const test_spec *spec) {
grpc_call *c;
int s_idx;
int *s_valid;
@@ -239,11 +260,10 @@ static int *perform_request(servers_fixture *f, grpc_channel *client,
size_t i, iter_num;
grpc_event ev;
int read_tag;
- int *connection_sequence;
int completed_client;
+ const request_sequences sequences = request_sequences_create(spec->num_iters);
s_valid = gpr_malloc(sizeof(int) * f->num_servers);
- connection_sequence = gpr_malloc(sizeof(int) * spec->num_iters);
for (iter_num = 0; iter_num < spec->num_iters; iter_num++) {
cq_verifier *cqv = cq_verifier_create(f->cq);
@@ -260,7 +280,7 @@ static int *perform_request(servers_fixture *f, grpc_channel *client,
}
}
- connection_sequence[iter_num] = -1;
+ sequences.connections[iter_num] = -1;
grpc_metadata_array_init(&rdata->initial_metadata_recv);
grpc_metadata_array_init(&rdata->trailing_metadata_recv);
@@ -305,12 +325,14 @@ static int *perform_request(servers_fixture *f, grpc_channel *client,
grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL));
s_idx = -1;
- while (
- (ev = grpc_completion_queue_next(
- f->cq, GRPC_TIMEOUT_MILLIS_TO_DEADLINE(10 * RETRY_TIMEOUT), NULL))
- .type != GRPC_QUEUE_TIMEOUT) {
+ while ((ev = grpc_completion_queue_next(
+ f->cq, GRPC_TIMEOUT_MILLIS_TO_DEADLINE(RETRY_TIMEOUT), NULL))
+ .type != GRPC_QUEUE_TIMEOUT) {
GPR_ASSERT(ev.type == GRPC_OP_COMPLETE);
read_tag = ((int)(intptr_t)ev.tag);
+ const grpc_connectivity_state conn_state =
+ grpc_channel_check_connectivity_state(client, 0);
+ sequences.connectivity_states[iter_num] = conn_state;
gpr_log(GPR_DEBUG, "EVENT: success:%d, type:%d, tag:%d iter:%" PRIuPTR,
ev.success, ev.type, read_tag, iter_num);
if (ev.success && read_tag >= 1000) {
@@ -318,7 +340,7 @@ static int *perform_request(servers_fixture *f, grpc_channel *client,
/* only server notifications for non-shutdown events */
s_idx = read_tag - 1000;
s_valid[s_idx] = 1;
- connection_sequence[iter_num] = s_idx;
+ sequences.connections[iter_num] = s_idx;
break;
} else if (read_tag == 1) {
gpr_log(GPR_DEBUG, "client timed out");
@@ -381,10 +403,9 @@ static int *perform_request(servers_fixture *f, grpc_channel *client,
}
}
- GPR_ASSERT(
- grpc_completion_queue_next(
- f->cq, GRPC_TIMEOUT_MILLIS_TO_DEADLINE(2 * RETRY_TIMEOUT), NULL)
- .type == GRPC_QUEUE_TIMEOUT);
+ GPR_ASSERT(grpc_completion_queue_next(
+ f->cq, GRPC_TIMEOUT_MILLIS_TO_DEADLINE(RETRY_TIMEOUT), NULL)
+ .type == GRPC_QUEUE_TIMEOUT);
grpc_metadata_array_destroy(&rdata->initial_metadata_recv);
grpc_metadata_array_destroy(&rdata->trailing_metadata_recv);
@@ -401,7 +422,7 @@ static int *perform_request(servers_fixture *f, grpc_channel *client,
gpr_free(s_valid);
- return connection_sequence;
+ return sequences;
}
static grpc_call **perform_multirequest(servers_fixture *f,
@@ -441,62 +462,10 @@ static grpc_call **perform_multirequest(servers_fixture *f,
return calls;
}
-static void assert_channel_connectivity(grpc_channel *ch,
- size_t num_accepted_conn_states,
- int accepted_conn_state, ...) {
- size_t i;
- grpc_channel_stack *client_stack;
- grpc_channel_element *client_channel_filter;
- grpc_connectivity_state actual_conn_state;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- va_list ap;
-
- client_stack = grpc_channel_get_channel_stack(ch);
- client_channel_filter = grpc_channel_stack_last_element(client_stack);
-
- actual_conn_state = grpc_client_channel_check_connectivity_state(
- &exec_ctx, client_channel_filter, 0 /* don't try to connect */);
- grpc_exec_ctx_finish(&exec_ctx);
- va_start(ap, accepted_conn_state);
- for (i = 0; i < num_accepted_conn_states; i++) {
- if ((int)actual_conn_state == accepted_conn_state) {
- break;
- }
- accepted_conn_state = va_arg(ap, grpc_connectivity_state);
- }
- va_end(ap);
- if (i == num_accepted_conn_states) {
- char **accepted_strs =
- gpr_malloc(sizeof(char *) * num_accepted_conn_states);
- char *accepted_str_joined;
- va_start(ap, accepted_conn_state);
- for (i = 0; i < num_accepted_conn_states; i++) {
- GPR_ASSERT(gpr_asprintf(&accepted_strs[i], "%d", accepted_conn_state) >
- 0);
- accepted_conn_state = va_arg(ap, grpc_connectivity_state);
- }
- va_end(ap);
- accepted_str_joined = gpr_strjoin_sep((const char **)accepted_strs,
- num_accepted_conn_states, ", ", NULL);
- gpr_log(
- GPR_ERROR,
- "Channel connectivity assertion failed: expected <one of [%s]>, got %d",
- accepted_str_joined, actual_conn_state);
-
- for (i = 0; i < num_accepted_conn_states; i++) {
- gpr_free(accepted_strs[i]);
- }
- gpr_free(accepted_strs);
- gpr_free(accepted_str_joined);
- abort();
- }
-}
-
void run_spec(const test_spec *spec) {
grpc_channel *client;
char *client_hostport;
char *servers_hostports_str;
- int *actual_connection_sequence;
request_data rdata;
servers_fixture *f;
grpc_channel_args args;
@@ -524,14 +493,14 @@ void run_spec(const test_spec *spec) {
gpr_log(GPR_INFO, "Testing '%s' with servers=%s client=%s", spec->description,
servers_hostports_str, client_hostport);
- actual_connection_sequence = perform_request(f, client, &rdata, spec);
+ const request_sequences sequences = perform_request(f, client, &rdata, spec);
- spec->verifier(f, client, actual_connection_sequence, spec->num_iters);
+ spec->verifier(f, client, &sequences, spec->num_iters);
gpr_free(client_hostport);
gpr_free(servers_hostports_str);
- gpr_free(actual_connection_sequence);
gpr_free(rdata.call_details);
+ request_sequences_destroy(&sequences);
grpc_channel_destroy(client); /* calls the LB's shutdown func */
teardown_servers(f);
@@ -642,8 +611,16 @@ static void test_pending_calls(size_t concurrent_calls) {
}
static void test_get_channel_info() {
- grpc_channel *channel = grpc_insecure_channel_create(
- "test:127.0.0.1:1234?lb_policy=round_robin", NULL, NULL);
+ grpc_channel_args args;
+ grpc_arg arg_array[1];
+ arg_array[0].type = GRPC_ARG_STRING;
+ arg_array[0].key = GRPC_ARG_LB_POLICY_NAME;
+ arg_array[0].value.string = "round_robin";
+ args.num_args = 1;
+ args.args = arg_array;
+
+ grpc_channel *channel =
+ grpc_insecure_channel_create("ipv4:127.0.0.1:1234", &args, NULL);
// Ensures that resolver returns.
grpc_channel_check_connectivity_state(channel, true /* try_to_connect */);
// Use grpc_channel_get_info() to get LB policy name.
@@ -676,29 +653,43 @@ static void print_failed_expectations(const int *expected_connection_sequence,
static void verify_vanilla_round_robin(const servers_fixture *f,
grpc_channel *client,
- const int *actual_connection_sequence,
+ const request_sequences *sequences,
const size_t num_iters) {
- int *expected_connection_sequence;
- size_t i;
const size_t expected_seq_length = f->num_servers;
/* verify conn. seq. expectation */
/* get the first sequence of "num_servers" elements */
- expected_connection_sequence = gpr_malloc(sizeof(int) * expected_seq_length);
- memcpy(expected_connection_sequence, actual_connection_sequence,
+ int *expected_connection_sequence =
+ gpr_malloc(sizeof(int) * expected_seq_length);
+ memcpy(expected_connection_sequence, sequences->connections,
sizeof(int) * expected_seq_length);
- for (i = 0; i < num_iters; i++) {
- const int actual = actual_connection_sequence[i];
+ for (size_t i = 0; i < num_iters; i++) {
+ const int actual = sequences->connections[i];
const int expected = expected_connection_sequence[i % expected_seq_length];
if (actual != expected) {
- print_failed_expectations(expected_connection_sequence,
- actual_connection_sequence, expected_seq_length,
- num_iters);
+ gpr_log(
+ GPR_ERROR,
+ "CONNECTION SEQUENCE FAILURE: expected %d, got %d at iteration #%d",
+ expected, actual, (int)i);
+ abort();
+ }
+ }
+
+ /* All servers are available, therefore all client subchannels are READY, even
+ * when we only need one for the client channel state to be READY */
+ for (size_t i = 0; i < sequences->n; i++) {
+ const grpc_connectivity_state actual = sequences->connectivity_states[i];
+ const grpc_connectivity_state expected = GRPC_CHANNEL_READY;
+ if (actual != expected) {
+ gpr_log(GPR_ERROR,
+ "CONNECTIVITY STATUS SEQUENCE FAILURE: expected '%s', got '%s' "
+ "at iteration #%d",
+ grpc_connectivity_state_name(expected),
+ grpc_connectivity_state_name(actual), (int)i);
abort();
}
}
- assert_channel_connectivity(client, 1, GRPC_CHANNEL_READY);
gpr_free(expected_connection_sequence);
}
@@ -707,7 +698,7 @@ static void verify_vanilla_round_robin(const servers_fixture *f,
* given in "f") are killed */
static void verify_vanishing_floor_round_robin(
const servers_fixture *f, grpc_channel *client,
- const int *actual_connection_sequence, const size_t num_iters) {
+ const request_sequences *sequences, const size_t num_iters) {
int *expected_connection_sequence;
const size_t expected_seq_length = 2;
size_t i;
@@ -715,57 +706,83 @@ static void verify_vanishing_floor_round_robin(
/* verify conn. seq. expectation */
/* copy the first full sequence (without -1s) */
expected_connection_sequence = gpr_malloc(sizeof(int) * expected_seq_length);
- memcpy(expected_connection_sequence, actual_connection_sequence + 2,
+ memcpy(expected_connection_sequence, sequences->connections + 2,
expected_seq_length * sizeof(int));
/* first two elements of the sequence should be [0 (1st server), -1 (failure)]
*/
- GPR_ASSERT(actual_connection_sequence[0] == 0);
- GPR_ASSERT(actual_connection_sequence[1] == -1);
+ GPR_ASSERT(sequences->connections[0] == 0);
+ GPR_ASSERT(sequences->connections[1] == -1);
/* the next two element must be [3, 0], repeating from that point: the 3 is
* brought forth by servers 1 and 2 disappearing after the intial pick of 0 */
- GPR_ASSERT(actual_connection_sequence[2] == 3);
- GPR_ASSERT(actual_connection_sequence[3] == 0);
+ GPR_ASSERT(sequences->connections[2] == 3);
+ GPR_ASSERT(sequences->connections[3] == 0);
/* make sure that the expectation obliges */
for (i = 2; i < num_iters; i++) {
- const int actual = actual_connection_sequence[i];
+ const int actual = sequences->connections[i];
const int expected = expected_connection_sequence[i % expected_seq_length];
if (actual != expected) {
print_failed_expectations(expected_connection_sequence,
- actual_connection_sequence, expected_seq_length,
+ sequences->connections, expected_seq_length,
num_iters);
abort();
}
}
+
+ /* There's always at least one subchannel READY (connected), therefore the
+ * overall state of the client channel is READY at all times. */
+ for (i = 0; i < sequences->n; i++) {
+ const grpc_connectivity_state actual = sequences->connectivity_states[i];
+ const grpc_connectivity_state expected = GRPC_CHANNEL_READY;
+ if (actual != expected) {
+ gpr_log(GPR_ERROR,
+ "CONNECTIVITY STATUS SEQUENCE FAILURE: expected '%s', got '%s' "
+ "at iteration #%d",
+ grpc_connectivity_state_name(expected),
+ grpc_connectivity_state_name(actual), (int)i);
+ abort();
+ }
+ }
+
gpr_free(expected_connection_sequence);
}
-static void verify_total_carnage_round_robin(
- const servers_fixture *f, grpc_channel *client,
- const int *actual_connection_sequence, const size_t num_iters) {
- size_t i;
-
- for (i = 0; i < num_iters; i++) {
- const int actual = actual_connection_sequence[i];
+static void verify_total_carnage_round_robin(const servers_fixture *f,
+ grpc_channel *client,
+ const request_sequences *sequences,
+ const size_t num_iters) {
+ for (size_t i = 0; i < num_iters; i++) {
+ const int actual = sequences->connections[i];
const int expected = -1;
if (actual != expected) {
- gpr_log(GPR_ERROR, "FAILURE: expected %d, actual %d at iter %" PRIuPTR,
- expected, actual, i);
+ gpr_log(
+ GPR_ERROR,
+ "CONNECTION SEQUENCE FAILURE: expected %d, got %d at iteration #%d",
+ expected, actual, (int)i);
abort();
}
}
- /* even though we know all the servers are dead, the client is still trying
- * retrying, believing it's in a transient failure situation */
- assert_channel_connectivity(client, 2, GRPC_CHANNEL_TRANSIENT_FAILURE,
- GRPC_CHANNEL_CONNECTING);
+ /* no server is ever available. The persistent state is TRANSIENT_FAILURE */
+ for (size_t i = 0; i < sequences->n; i++) {
+ const grpc_connectivity_state actual = sequences->connectivity_states[i];
+ const grpc_connectivity_state expected = GRPC_CHANNEL_TRANSIENT_FAILURE;
+ if (actual != expected) {
+ gpr_log(GPR_ERROR,
+ "CONNECTIVITY STATUS SEQUENCE FAILURE: expected '%s', got '%s' "
+ "at iteration #%d",
+ grpc_connectivity_state_name(expected),
+ grpc_connectivity_state_name(actual), (int)i);
+ abort();
+ }
+ }
}
static void verify_partial_carnage_round_robin(
const servers_fixture *f, grpc_channel *client,
- const int *actual_connection_sequence, const size_t num_iters) {
+ const request_sequences *sequences, const size_t num_iters) {
int *expected_connection_sequence;
size_t i;
const size_t expected_seq_length = f->num_servers;
@@ -773,15 +790,15 @@ static void verify_partial_carnage_round_robin(
/* verify conn. seq. expectation */
/* get the first sequence of "num_servers" elements */
expected_connection_sequence = gpr_malloc(sizeof(int) * expected_seq_length);
- memcpy(expected_connection_sequence, actual_connection_sequence,
+ memcpy(expected_connection_sequence, sequences->connections,
sizeof(int) * expected_seq_length);
for (i = 0; i < num_iters / 2; i++) {
- const int actual = actual_connection_sequence[i];
+ const int actual = sequences->connections[i];
const int expected = expected_connection_sequence[i % expected_seq_length];
if (actual != expected) {
print_failed_expectations(expected_connection_sequence,
- actual_connection_sequence, expected_seq_length,
+ sequences->connections, expected_seq_length,
num_iters);
abort();
}
@@ -789,13 +806,34 @@ static void verify_partial_carnage_round_robin(
/* second half of the iterations go without response */
for (; i < num_iters; i++) {
- GPR_ASSERT(actual_connection_sequence[i] == -1);
+ GPR_ASSERT(sequences->connections[i] == -1);
+ }
+
+ /* We can assert that the first client channel state should be READY, when all
+ * servers were available; and that the last one should be TRANSIENT_FAILURE,
+ * after all servers are gone. */
+ grpc_connectivity_state actual = sequences->connectivity_states[0];
+ grpc_connectivity_state expected = GRPC_CHANNEL_READY;
+ if (actual != expected) {
+ gpr_log(GPR_ERROR,
+ "CONNECTIVITY STATUS SEQUENCE FAILURE: expected '%s', got '%s' "
+ "at iteration #%d",
+ grpc_connectivity_state_name(expected),
+ grpc_connectivity_state_name(actual), 0);
+ abort();
+ }
+
+ actual = sequences->connectivity_states[num_iters - 1];
+ expected = GRPC_CHANNEL_TRANSIENT_FAILURE;
+ if (actual != expected) {
+ gpr_log(GPR_ERROR,
+ "CONNECTIVITY STATUS SEQUENCE FAILURE: expected '%s', got '%s' "
+ "at iteration #%d",
+ grpc_connectivity_state_name(expected),
+ grpc_connectivity_state_name(actual), (int)num_iters - 1);
+ abort();
}
- /* even though we know all the servers are dead, the client is still trying
- * retrying, believing it's in a transient failure situation */
- assert_channel_connectivity(client, 2, GRPC_CHANNEL_TRANSIENT_FAILURE,
- GRPC_CHANNEL_CONNECTING);
gpr_free(expected_connection_sequence);
}
@@ -818,15 +856,14 @@ static void dump_array(const char *desc, const int *data, const size_t count) {
static void verify_rebirth_round_robin(const servers_fixture *f,
grpc_channel *client,
- const int *actual_connection_sequence,
+ const request_sequences *sequences,
const size_t num_iters) {
int *expected_connection_sequence;
size_t i, j, unique_seq_last_idx, unique_seq_first_idx;
const size_t expected_seq_length = f->num_servers;
int *seen_elements;
- dump_array("actual_connection_sequence", actual_connection_sequence,
- num_iters);
+ dump_array("actual_connection_sequence", sequences->connections, num_iters);
/* verify conn. seq. expectation */
/* get the first unique run of length "num_servers". */
@@ -837,13 +874,13 @@ static void verify_rebirth_round_robin(const servers_fixture *f,
memset(seen_elements, 0, sizeof(int) * expected_seq_length);
for (i = 0; i < num_iters; i++) {
- if (actual_connection_sequence[i] < 0 ||
- seen_elements[actual_connection_sequence[i]] != 0) {
+ if (sequences->connections[i] < 0 ||
+ seen_elements[sequences->connections[i]] != 0) {
/* if anything breaks the uniqueness of the run, back to square zero */
memset(seen_elements, 0, sizeof(int) * expected_seq_length);
continue;
}
- seen_elements[actual_connection_sequence[i]] = 1;
+ seen_elements[sequences->connections[i]] = 1;
for (j = 0; j < expected_seq_length; j++) {
if (seen_elements[j] == 0) break;
}
@@ -862,30 +899,72 @@ static void verify_rebirth_round_robin(const servers_fixture *f,
unique_seq_first_idx = (unique_seq_last_idx - expected_seq_length + 1);
memcpy(expected_connection_sequence,
- actual_connection_sequence + unique_seq_first_idx,
+ sequences->connections + unique_seq_first_idx,
sizeof(int) * expected_seq_length);
/* first iteration succeeds */
- GPR_ASSERT(actual_connection_sequence[0] != -1);
+ GPR_ASSERT(sequences->connections[0] != -1);
/* then we fail for a while... */
- GPR_ASSERT(actual_connection_sequence[1] == -1);
+ GPR_ASSERT(sequences->connections[1] == -1);
/* ... but should be up at "unique_seq_first_idx" */
- GPR_ASSERT(actual_connection_sequence[unique_seq_first_idx] != -1);
+ GPR_ASSERT(sequences->connections[unique_seq_first_idx] != -1);
for (j = 0, i = unique_seq_first_idx; i < num_iters; i++) {
- const int actual = actual_connection_sequence[i];
+ const int actual = sequences->connections[i];
const int expected =
expected_connection_sequence[j++ % expected_seq_length];
if (actual != expected) {
print_failed_expectations(expected_connection_sequence,
- actual_connection_sequence, expected_seq_length,
+ sequences->connections, expected_seq_length,
num_iters);
abort();
}
}
- /* things are fine once the servers are brought back up */
- assert_channel_connectivity(client, 1, GRPC_CHANNEL_READY);
+ /* We can assert that the first client channel state should be READY, when all
+ * servers were available; same thing for the last one. In the middle
+ * somewhere there must exist at least one TRANSIENT_FAILURE */
+ grpc_connectivity_state actual = sequences->connectivity_states[0];
+ grpc_connectivity_state expected = GRPC_CHANNEL_READY;
+ if (actual != expected) {
+ gpr_log(GPR_ERROR,
+ "CONNECTIVITY STATUS SEQUENCE FAILURE: expected '%s', got '%s' "
+ "at iteration #%d",
+ grpc_connectivity_state_name(expected),
+ grpc_connectivity_state_name(actual), 0);
+ abort();
+ }
+
+ actual = sequences->connectivity_states[num_iters - 1];
+ expected = GRPC_CHANNEL_READY;
+ if (actual != expected) {
+ gpr_log(GPR_ERROR,
+ "CONNECTIVITY STATUS SEQUENCE FAILURE: expected '%s', got '%s' "
+ "at iteration #%d",
+ grpc_connectivity_state_name(expected),
+ grpc_connectivity_state_name(actual), (int)num_iters - 1);
+ abort();
+ }
+
+ bool found_failure_status = false;
+ for (i = 1; i < sequences->n - 1; i++) {
+ if (sequences->connectivity_states[i] == GRPC_CHANNEL_TRANSIENT_FAILURE) {
+ found_failure_status = true;
+ break;
+ }
+ }
+ if (!found_failure_status) {
+ gpr_log(
+ GPR_ERROR,
+ "CONNECTIVITY STATUS SEQUENCE FAILURE: "
+ "GRPC_CHANNEL_TRANSIENT_FAILURE status not found. Got the following "
+ "instead:");
+ for (i = 0; i < num_iters; i++) {
+ gpr_log(GPR_ERROR, "[%d]: %s", (int)i,
+ grpc_connectivity_state_name(sequences->connectivity_states[i]));
+ }
+ }
+
gpr_free(expected_connection_sequence);
gpr_free(seen_elements);
}
@@ -926,7 +1005,7 @@ int main(int argc, char **argv) {
* This should knock down the server bound to be selected next */
test_spec_reset(spec);
spec->verifier = verify_vanishing_floor_round_robin;
- spec->description = "test_kill_all_server_at_2nd_iteration";
+ spec->description = "test_kill_middle_servers_at_2nd_iteration";
for (i = 1; i < NUM_SERVERS - 1; i++) {
spec->kill_at[1][i] = 1;
}
diff --git a/test/core/end2end/end2end_nosec_tests.c b/test/core/end2end/end2end_nosec_tests.c
index 457c188ce5..663489082f 100644
--- a/test/core/end2end/end2end_nosec_tests.c
+++ b/test/core/end2end/end2end_nosec_tests.c
@@ -75,6 +75,8 @@ extern void filter_call_init_fails(grpc_end2end_test_config config);
extern void filter_call_init_fails_pre_init(void);
extern void filter_causes_close(grpc_end2end_test_config config);
extern void filter_causes_close_pre_init(void);
+extern void filter_latency(grpc_end2end_test_config config);
+extern void filter_latency_pre_init(void);
extern void graceful_server_shutdown(grpc_end2end_test_config config);
extern void graceful_server_shutdown_pre_init(void);
extern void high_initial_seqno(grpc_end2end_test_config config);
@@ -153,6 +155,7 @@ void grpc_end2end_tests_pre_init(void) {
empty_batch_pre_init();
filter_call_init_fails_pre_init();
filter_causes_close_pre_init();
+ filter_latency_pre_init();
graceful_server_shutdown_pre_init();
high_initial_seqno_pre_init();
hpack_size_pre_init();
@@ -207,6 +210,7 @@ void grpc_end2end_tests(int argc, char **argv,
empty_batch(config);
filter_call_init_fails(config);
filter_causes_close(config);
+ filter_latency(config);
graceful_server_shutdown(config);
high_initial_seqno(config);
hpack_size(config);
@@ -304,6 +308,10 @@ void grpc_end2end_tests(int argc, char **argv,
filter_causes_close(config);
continue;
}
+ if (0 == strcmp("filter_latency", argv[i])) {
+ filter_latency(config);
+ continue;
+ }
if (0 == strcmp("graceful_server_shutdown", argv[i])) {
graceful_server_shutdown(config);
continue;
diff --git a/test/core/end2end/end2end_tests.c b/test/core/end2end/end2end_tests.c
index dc2d68a486..25c7c62fde 100644
--- a/test/core/end2end/end2end_tests.c
+++ b/test/core/end2end/end2end_tests.c
@@ -77,6 +77,8 @@ extern void filter_call_init_fails(grpc_end2end_test_config config);
extern void filter_call_init_fails_pre_init(void);
extern void filter_causes_close(grpc_end2end_test_config config);
extern void filter_causes_close_pre_init(void);
+extern void filter_latency(grpc_end2end_test_config config);
+extern void filter_latency_pre_init(void);
extern void graceful_server_shutdown(grpc_end2end_test_config config);
extern void graceful_server_shutdown_pre_init(void);
extern void high_initial_seqno(grpc_end2end_test_config config);
@@ -156,6 +158,7 @@ void grpc_end2end_tests_pre_init(void) {
empty_batch_pre_init();
filter_call_init_fails_pre_init();
filter_causes_close_pre_init();
+ filter_latency_pre_init();
graceful_server_shutdown_pre_init();
high_initial_seqno_pre_init();
hpack_size_pre_init();
@@ -211,6 +214,7 @@ void grpc_end2end_tests(int argc, char **argv,
empty_batch(config);
filter_call_init_fails(config);
filter_causes_close(config);
+ filter_latency(config);
graceful_server_shutdown(config);
high_initial_seqno(config);
hpack_size(config);
@@ -312,6 +316,10 @@ void grpc_end2end_tests(int argc, char **argv,
filter_causes_close(config);
continue;
}
+ if (0 == strcmp("filter_latency", argv[i])) {
+ filter_latency(config);
+ continue;
+ }
if (0 == strcmp("graceful_server_shutdown", argv[i])) {
graceful_server_shutdown(config);
continue;
diff --git a/test/core/end2end/gen_build_yaml.py b/test/core/end2end/gen_build_yaml.py
index 5f54b821a7..201a92a1fd 100755
--- a/test/core/end2end/gen_build_yaml.py
+++ b/test/core/end2end/gen_build_yaml.py
@@ -111,6 +111,7 @@ END2END_TESTS = {
'empty_batch': default_test_options,
'filter_causes_close': default_test_options,
'filter_call_init_fails': default_test_options,
+ 'filter_latency': default_test_options,
'graceful_server_shutdown': default_test_options._replace(cpu_cost=LOWCPU),
'hpack_size': default_test_options._replace(proxyable=False,
traceable=False),
diff --git a/test/core/end2end/tests/binary_metadata.c b/test/core/end2end/tests/binary_metadata.c
index a13613a472..dd7a8a9ad3 100644
--- a/test/core/end2end/tests/binary_metadata.c
+++ b/test/core/end2end/tests/binary_metadata.c
@@ -238,7 +238,22 @@ static void test_request_response_with_metadata_and_payload(
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 0;
op->data.send_status_from_server.status = GRPC_STATUS_OK;
- op->data.send_status_from_server.status_details = "xyz";
+ op->data.send_status_from_server.status_details =
+ "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12"
+ "\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20\x21\x22\x23\x24"
+ "\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36"
+ "\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48"
+ "\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a"
+ "\x5b\x5c\x5d\x5e\x5f\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c"
+ "\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e"
+ "\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90"
+ "\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2"
+ "\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4"
+ "\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6"
+ "\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8"
+ "\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea"
+ "\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc"
+ "\xfd\xfe\xff";
op->flags = 0;
op->reserved = NULL;
op++;
@@ -250,7 +265,25 @@ static void test_request_response_with_metadata_and_payload(
cq_verify(cqv);
GPR_ASSERT(status == GRPC_STATUS_OK);
- GPR_ASSERT(0 == strcmp(details, "xyz"));
+ GPR_ASSERT(
+ 0 ==
+ strcmp(details,
+ "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10"
+ "\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20"
+ "\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30"
+ "\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40"
+ "\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50"
+ "\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f\x60"
+ "\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70"
+ "\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\x80"
+ "\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90"
+ "\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0"
+ "\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0"
+ "\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0"
+ "\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0"
+ "\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0"
+ "\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0"
+ "\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"));
GPR_ASSERT(0 == strcmp(call_details.method, "/foo"));
validate_host_override_string("foo.test.google.fr:1234", call_details.host,
config);
diff --git a/test/core/end2end/tests/filter_latency.c b/test/core/end2end/tests/filter_latency.c
new file mode 100644
index 0000000000..043f12dd9a
--- /dev/null
+++ b/test/core/end2end/tests/filter_latency.c
@@ -0,0 +1,360 @@
+/*
+ *
+ * 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 "test/core/end2end/end2end_tests.h"
+
+#include <limits.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <grpc/byte_buffer.h>
+#include <grpc/support/alloc.h>
+#include <grpc/support/log.h>
+#include <grpc/support/time.h>
+#include <grpc/support/useful.h>
+
+#include "src/core/lib/channel/channel_stack_builder.h"
+#include "src/core/lib/surface/channel_init.h"
+#include "test/core/end2end/cq_verifier.h"
+
+enum { TIMEOUT = 200000 };
+
+static bool g_enable_filter = false;
+static gpr_mu g_mu;
+static gpr_timespec g_client_latency;
+static gpr_timespec g_server_latency;
+
+static void *tag(intptr_t t) { return (void *)t; }
+
+static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
+ const char *test_name,
+ grpc_channel_args *client_args,
+ grpc_channel_args *server_args) {
+ grpc_end2end_test_fixture f;
+ gpr_log(GPR_INFO, "%s/%s", test_name, config.name);
+ f = config.create_fixture(client_args, server_args);
+ config.init_server(&f, server_args);
+ config.init_client(&f, client_args);
+ return f;
+}
+
+static gpr_timespec n_seconds_time(int n) {
+ return GRPC_TIMEOUT_SECONDS_TO_DEADLINE(n);
+}
+
+static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
+
+static void drain_cq(grpc_completion_queue *cq) {
+ grpc_event ev;
+ do {
+ ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
+ } while (ev.type != GRPC_QUEUE_SHUTDOWN);
+}
+
+static void shutdown_server(grpc_end2end_test_fixture *f) {
+ if (!f->server) return;
+ grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(
+ f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL)
+ .type == GRPC_OP_COMPLETE);
+ grpc_server_destroy(f->server);
+ f->server = NULL;
+}
+
+static void shutdown_client(grpc_end2end_test_fixture *f) {
+ if (!f->client) return;
+ grpc_channel_destroy(f->client);
+ f->client = NULL;
+}
+
+static void end_test(grpc_end2end_test_fixture *f) {
+ shutdown_server(f);
+ shutdown_client(f);
+
+ grpc_completion_queue_shutdown(f->cq);
+ drain_cq(f->cq);
+ grpc_completion_queue_destroy(f->cq);
+}
+
+// Simple request via a server filter that saves the reported latency value.
+static void test_request(grpc_end2end_test_config config) {
+ grpc_call *c;
+ grpc_call *s;
+ grpc_slice request_payload_slice =
+ grpc_slice_from_copied_string("hello world");
+ grpc_byte_buffer *request_payload =
+ grpc_raw_byte_buffer_create(&request_payload_slice, 1);
+ gpr_timespec deadline = five_seconds_time();
+ grpc_end2end_test_fixture f =
+ begin_test(config, "filter_latency", NULL, NULL);
+ cq_verifier *cqv = cq_verifier_create(f.cq);
+ grpc_op ops[6];
+ grpc_op *op;
+ grpc_metadata_array initial_metadata_recv;
+ grpc_metadata_array trailing_metadata_recv;
+ grpc_metadata_array request_metadata_recv;
+ grpc_byte_buffer *request_payload_recv = NULL;
+ grpc_call_details call_details;
+ grpc_status_code status;
+ grpc_call_error error;
+ char *details = NULL;
+ size_t details_capacity = 0;
+ int was_cancelled = 2;
+
+ gpr_mu_lock(&g_mu);
+ g_client_latency = gpr_time_0(GPR_TIMESPAN);
+ g_server_latency = gpr_time_0(GPR_TIMESPAN);
+ gpr_mu_unlock(&g_mu);
+ const gpr_timespec start_time = gpr_now(GPR_CLOCK_MONOTONIC);
+
+ c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ "/foo", "foo.test.google.fr", deadline, NULL);
+ GPR_ASSERT(c);
+
+ grpc_metadata_array_init(&initial_metadata_recv);
+ grpc_metadata_array_init(&trailing_metadata_recv);
+ grpc_metadata_array_init(&request_metadata_recv);
+ grpc_call_details_init(&call_details);
+
+ memset(ops, 0, sizeof(ops));
+ op = ops;
+ op->op = GRPC_OP_SEND_INITIAL_METADATA;
+ op->data.send_initial_metadata.count = 0;
+ op->data.send_initial_metadata.metadata = NULL;
+ op->flags = 0;
+ op->reserved = NULL;
+ op++;
+ op->op = GRPC_OP_SEND_MESSAGE;
+ op->data.send_message = request_payload;
+ op->flags = 0;
+ op->reserved = NULL;
+ op++;
+ op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
+ op->flags = 0;
+ op->reserved = NULL;
+ op++;
+ op->op = GRPC_OP_RECV_INITIAL_METADATA;
+ op->data.recv_initial_metadata = &initial_metadata_recv;
+ op->flags = 0;
+ op->reserved = NULL;
+ op++;
+ op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
+ op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
+ op->data.recv_status_on_client.status = &status;
+ op->data.recv_status_on_client.status_details = &details;
+ op->data.recv_status_on_client.status_details_capacity = &details_capacity;
+ op->flags = 0;
+ op->reserved = NULL;
+ op++;
+ error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
+
+ error =
+ grpc_server_request_call(f.server, &s, &call_details,
+ &request_metadata_recv, f.cq, f.cq, tag(101));
+ GPR_ASSERT(GRPC_CALL_OK == error);
+
+ CQ_EXPECT_COMPLETION(cqv, tag(101), 1);
+ cq_verify(cqv);
+
+ memset(ops, 0, sizeof(ops));
+ op = ops;
+ op->op = GRPC_OP_SEND_INITIAL_METADATA;
+ op->data.send_initial_metadata.count = 0;
+ op->flags = 0;
+ op->reserved = NULL;
+ op++;
+ op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
+ op->data.send_status_from_server.trailing_metadata_count = 0;
+ op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED;
+ op->data.send_status_from_server.status_details = "xyz";
+ op->flags = 0;
+ op->reserved = NULL;
+ op++;
+ op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
+ op->data.recv_close_on_server.cancelled = &was_cancelled;
+ op->flags = 0;
+ op->reserved = NULL;
+ op++;
+ error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL);
+ GPR_ASSERT(GRPC_CALL_OK == error);
+
+ CQ_EXPECT_COMPLETION(cqv, tag(102), 1);
+ CQ_EXPECT_COMPLETION(cqv, tag(1), 1);
+ cq_verify(cqv);
+
+ GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED);
+ GPR_ASSERT(0 == strcmp(details, "xyz"));
+
+ gpr_free(details);
+ grpc_metadata_array_destroy(&initial_metadata_recv);
+ grpc_metadata_array_destroy(&trailing_metadata_recv);
+ grpc_metadata_array_destroy(&request_metadata_recv);
+ grpc_call_details_destroy(&call_details);
+
+ grpc_call_destroy(s);
+ grpc_call_destroy(c);
+
+ const gpr_timespec end_time = gpr_now(GPR_CLOCK_MONOTONIC);
+ const gpr_timespec max_latency = gpr_time_sub(end_time, start_time);
+
+ gpr_mu_lock(&g_mu);
+ GPR_ASSERT(gpr_time_cmp(max_latency, g_client_latency) >= 0);
+ GPR_ASSERT(gpr_time_cmp(gpr_time_0(GPR_TIMESPAN), g_client_latency) < 0);
+ GPR_ASSERT(gpr_time_cmp(max_latency, g_server_latency) >= 0);
+ GPR_ASSERT(gpr_time_cmp(gpr_time_0(GPR_TIMESPAN), g_server_latency) < 0);
+ // Server latency should always be smaller than client latency.
+ GPR_ASSERT(gpr_time_cmp(g_server_latency, g_client_latency) < 0);
+ gpr_mu_unlock(&g_mu);
+
+ cq_verifier_destroy(cqv);
+
+ grpc_byte_buffer_destroy(request_payload);
+ grpc_byte_buffer_destroy(request_payload_recv);
+
+ end_test(&f);
+ config.tear_down_data(&f);
+}
+
+/*******************************************************************************
+ * Test latency filter
+ */
+
+static grpc_error *init_call_elem(grpc_exec_ctx *exec_ctx,
+ grpc_call_element *elem,
+ grpc_call_element_args *args) {
+ return GRPC_ERROR_NONE;
+}
+
+static void client_destroy_call_elem(grpc_exec_ctx *exec_ctx,
+ grpc_call_element *elem,
+ const grpc_call_final_info *final_info,
+ void *and_free_memory) {
+ gpr_mu_lock(&g_mu);
+ g_client_latency = final_info->stats.latency;
+ gpr_mu_unlock(&g_mu);
+}
+
+static void server_destroy_call_elem(grpc_exec_ctx *exec_ctx,
+ grpc_call_element *elem,
+ const grpc_call_final_info *final_info,
+ void *and_free_memory) {
+ gpr_mu_lock(&g_mu);
+ g_server_latency = final_info->stats.latency;
+ gpr_mu_unlock(&g_mu);
+}
+
+static void init_channel_elem(grpc_exec_ctx *exec_ctx,
+ grpc_channel_element *elem,
+ grpc_channel_element_args *args) {}
+
+static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
+ grpc_channel_element *elem) {}
+
+static const grpc_channel_filter test_client_filter = {
+ grpc_call_next_op,
+ grpc_channel_next_op,
+ 0,
+ init_call_elem,
+ grpc_call_stack_ignore_set_pollset_or_pollset_set,
+ client_destroy_call_elem,
+ 0,
+ init_channel_elem,
+ destroy_channel_elem,
+ grpc_call_next_get_peer,
+ grpc_channel_next_get_info,
+ "client_filter_latency"};
+
+static const grpc_channel_filter test_server_filter = {
+ grpc_call_next_op,
+ grpc_channel_next_op,
+ 0,
+ init_call_elem,
+ grpc_call_stack_ignore_set_pollset_or_pollset_set,
+ server_destroy_call_elem,
+ 0,
+ init_channel_elem,
+ destroy_channel_elem,
+ grpc_call_next_get_peer,
+ grpc_channel_next_get_info,
+ "server_filter_latency"};
+
+/*******************************************************************************
+ * Registration
+ */
+
+static bool maybe_add_filter(grpc_exec_ctx *exec_ctx,
+ grpc_channel_stack_builder *builder, void *arg) {
+ grpc_channel_filter *filter = arg;
+ if (g_enable_filter) {
+ // Want to add the filter as close to the end as possible, to make
+ // sure that all of the filters work well together. However, we
+ // can't add it at the very end, because the connected channel filter
+ // must be the last one. So we add it right before the last one.
+ grpc_channel_stack_builder_iterator *it =
+ grpc_channel_stack_builder_create_iterator_at_last(builder);
+ GPR_ASSERT(grpc_channel_stack_builder_move_prev(it));
+ const bool retval =
+ grpc_channel_stack_builder_add_filter_before(it, filter, NULL, NULL);
+ grpc_channel_stack_builder_iterator_destroy(it);
+ return retval;
+ } else {
+ return true;
+ }
+}
+
+static void init_plugin(void) {
+ gpr_mu_init(&g_mu);
+ grpc_channel_init_register_stage(GRPC_CLIENT_CHANNEL, INT_MAX,
+ maybe_add_filter,
+ (void *)&test_client_filter);
+ grpc_channel_init_register_stage(GRPC_CLIENT_DIRECT_CHANNEL, INT_MAX,
+ maybe_add_filter,
+ (void *)&test_client_filter);
+ grpc_channel_init_register_stage(GRPC_SERVER_CHANNEL, INT_MAX,
+ maybe_add_filter,
+ (void *)&test_server_filter);
+}
+
+static void destroy_plugin(void) { gpr_mu_destroy(&g_mu); }
+
+void filter_latency(grpc_end2end_test_config config) {
+ g_enable_filter = true;
+ test_request(config);
+ g_enable_filter = false;
+}
+
+void filter_latency_pre_init(void) {
+ grpc_register_plugin(init_plugin, destroy_plugin);
+}
diff --git a/test/core/internal_api_canaries/iomgr.c b/test/core/internal_api_canaries/iomgr.c
index f1efa87a69..82eeb0e1bf 100644
--- a/test/core/internal_api_canaries/iomgr.c
+++ b/test/core/internal_api_canaries/iomgr.c
@@ -48,7 +48,7 @@
static void test_code(void) {
/* iomgr.h */
grpc_iomgr_init();
- grpc_iomgr_shutdown();
+ grpc_iomgr_shutdown(NULL);
/* closure.h */
grpc_closure closure;
@@ -85,7 +85,8 @@ static void test_code(void) {
grpc_endpoint_shutdown,
grpc_endpoint_destroy,
grpc_endpoint_get_resource_user,
- grpc_endpoint_get_peer};
+ grpc_endpoint_get_peer,
+ grpc_endpoint_get_fd};
endpoint.vtable = &vtable;
grpc_endpoint_read(&exec_ctx, &endpoint, NULL, NULL);
@@ -99,7 +100,7 @@ static void test_code(void) {
/* executor.h */
grpc_executor_init();
grpc_executor_push(&closure, GRPC_ERROR_CREATE("Phi"));
- grpc_executor_shutdown();
+ grpc_executor_shutdown(NULL);
/* pollset.h */
grpc_pollset_size();
diff --git a/test/core/iomgr/fd_conservation_posix_test.c b/test/core/iomgr/fd_conservation_posix_test.c
index 652b37eb6f..3dffa02c3c 100644
--- a/test/core/iomgr/fd_conservation_posix_test.c
+++ b/test/core/iomgr/fd_conservation_posix_test.c
@@ -65,6 +65,10 @@ int main(int argc, char **argv) {
grpc_resource_quota_unref(resource_quota);
- grpc_iomgr_shutdown();
+ {
+ grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_iomgr_shutdown(&exec_ctx);
+ grpc_exec_ctx_finish(&exec_ctx);
+ }
return 0;
}
diff --git a/test/core/iomgr/fd_posix_test.c b/test/core/iomgr/fd_posix_test.c
index 6166699fe6..951a247d02 100644
--- a/test/core/iomgr/fd_posix_test.c
+++ b/test/core/iomgr/fd_posix_test.c
@@ -548,9 +548,10 @@ int main(int argc, char **argv) {
test_grpc_fd_change();
grpc_closure_init(&destroyed, destroy_pollset, g_pollset);
grpc_pollset_shutdown(&exec_ctx, g_pollset, &destroyed);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_flush(&exec_ctx);
gpr_free(g_pollset);
- grpc_iomgr_shutdown();
+ grpc_iomgr_shutdown(&exec_ctx);
+ grpc_exec_ctx_finish(&exec_ctx);
return 0;
}
diff --git a/test/core/iomgr/resolve_address_test.c b/test/core/iomgr/resolve_address_test.c
index 2dd0d88b3f..36ee0db97a 100644
--- a/test/core/iomgr/resolve_address_test.c
+++ b/test/core/iomgr/resolve_address_test.c
@@ -172,7 +172,11 @@ int main(int argc, char **argv) {
test_ipv6_without_port();
test_invalid_ip_addresses();
test_unparseable_hostports();
- grpc_iomgr_shutdown();
- grpc_executor_shutdown();
+ {
+ grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_executor_shutdown(&exec_ctx);
+ grpc_iomgr_shutdown(&exec_ctx);
+ grpc_exec_ctx_finish(&exec_ctx);
+ }
return 0;
}
diff --git a/test/core/iomgr/socket_utils_test.c b/test/core/iomgr/socket_utils_test.c
index 67bc914c15..7eee2d1d10 100644
--- a/test/core/iomgr/socket_utils_test.c
+++ b/test/core/iomgr/socket_utils_test.c
@@ -39,13 +39,57 @@
#include "src/core/lib/iomgr/socket_utils_posix.h"
#include <errno.h>
+#include <netinet/ip.h>
#include <string.h>
+#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
+#include <grpc/support/sync.h>
+#include <grpc/support/useful.h>
+#include "src/core/lib/iomgr/socket_mutator.h"
#include "test/core/util/test_config.h"
+struct test_socket_mutator {
+ grpc_socket_mutator base;
+ int option_value;
+};
+
+static bool mutate_fd(int fd, grpc_socket_mutator *mutator) {
+ int newval;
+ socklen_t intlen = sizeof(newval);
+ struct test_socket_mutator *m = (struct test_socket_mutator *)mutator;
+
+ if (0 != setsockopt(fd, IPPROTO_IP, IP_TOS, &m->option_value,
+ sizeof(m->option_value))) {
+ return false;
+ }
+ if (0 != getsockopt(fd, IPPROTO_IP, IP_TOS, &newval, &intlen)) {
+ return false;
+ }
+ if (newval != m->option_value) {
+ return false;
+ }
+ return true;
+}
+
+static void destroy_test_mutator(grpc_socket_mutator *mutator) {
+ struct test_socket_mutator *m = (struct test_socket_mutator *)mutator;
+ gpr_free(m);
+}
+
+static int compare_test_mutator(grpc_socket_mutator *a,
+ grpc_socket_mutator *b) {
+ struct test_socket_mutator *ma = (struct test_socket_mutator *)a;
+ struct test_socket_mutator *mb = (struct test_socket_mutator *)b;
+ return GPR_ICMP(ma->option_value, mb->option_value);
+}
+
+static const grpc_socket_mutator_vtable mutator_vtable = {
+ mutate_fd, compare_test_mutator, destroy_test_mutator};
+
int main(int argc, char **argv) {
int sock;
+ grpc_error *err;
grpc_test_init(argc, argv);
sock = socket(PF_INET, SOCK_STREAM, 0);
@@ -68,6 +112,29 @@ int main(int argc, char **argv) {
GPR_ASSERT(GRPC_LOG_IF_ERROR("set_socket_low_latency",
grpc_set_socket_low_latency(sock, 0)));
+ struct test_socket_mutator mutator;
+ grpc_socket_mutator_init(&mutator.base, &mutator_vtable);
+
+ mutator.option_value = IPTOS_LOWDELAY;
+ GPR_ASSERT(GRPC_LOG_IF_ERROR(
+ "set_socket_with_mutator",
+ grpc_set_socket_with_mutator(sock, (grpc_socket_mutator *)&mutator)));
+
+ mutator.option_value = IPTOS_THROUGHPUT;
+ GPR_ASSERT(GRPC_LOG_IF_ERROR(
+ "set_socket_with_mutator",
+ grpc_set_socket_with_mutator(sock, (grpc_socket_mutator *)&mutator)));
+
+ mutator.option_value = IPTOS_RELIABILITY;
+ GPR_ASSERT(GRPC_LOG_IF_ERROR(
+ "set_socket_with_mutator",
+ grpc_set_socket_with_mutator(sock, (grpc_socket_mutator *)&mutator)));
+
+ mutator.option_value = -1;
+ err = grpc_set_socket_with_mutator(sock, (grpc_socket_mutator *)&mutator);
+ GPR_ASSERT(err != GRPC_ERROR_NONE);
+ GRPC_ERROR_UNREF(err);
+
close(sock);
return 0;
diff --git a/test/core/iomgr/udp_server_test.c b/test/core/iomgr/udp_server_test.c
index 9bea229466..6bd6d60604 100644
--- a/test/core/iomgr/udp_server_test.c
+++ b/test/core/iomgr/udp_server_test.c
@@ -238,7 +238,7 @@ int main(int argc, char **argv) {
grpc_pollset_shutdown(&exec_ctx, g_pollset, &destroyed);
grpc_exec_ctx_finish(&exec_ctx);
gpr_free(g_pollset);
- grpc_iomgr_shutdown();
+ grpc_shutdown();
return 0;
}
diff --git a/test/core/network_benchmarks/low_level_ping_pong.c b/test/core/network_benchmarks/low_level_ping_pong.c
index 9038d07675..0b2a920873 100644
--- a/test/core/network_benchmarks/low_level_ping_pong.c
+++ b/test/core/network_benchmarks/low_level_ping_pong.c
@@ -56,6 +56,7 @@
#include <grpc/support/thd.h>
#include <grpc/support/time.h>
#include <grpc/support/useful.h>
+#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/iomgr/socket_utils_posix.h"
typedef struct fd_pair {
@@ -229,12 +230,12 @@ static int blocking_write_bytes(struct thread_args *args, char *buf) {
on the scenario we're using.
*/
static int set_socket_nonblocking(thread_args *args) {
- if (!grpc_set_socket_nonblocking(args->fds.read_fd, 1)) {
- gpr_log(GPR_ERROR, "Unable to set socket nonblocking: %s", strerror(errno));
+ if (!GRPC_LOG_IF_ERROR("Unable to set read socket nonblocking",
+ grpc_set_socket_nonblocking(args->fds.read_fd, 1))) {
return -1;
}
- if (!grpc_set_socket_nonblocking(args->fds.write_fd, 1)) {
- gpr_log(GPR_ERROR, "Unable to set socket nonblocking: %s", strerror(errno));
+ if (!GRPC_LOG_IF_ERROR("Unable to set write socket nonblocking",
+ grpc_set_socket_nonblocking(args->fds.write_fd, 1))) {
return -1;
}
return 0;
@@ -347,10 +348,16 @@ static int create_listening_socket(struct sockaddr *port, socklen_t len) {
goto error;
}
- if (!grpc_set_socket_cloexec(fd, 1) || !grpc_set_socket_low_latency(fd, 1) ||
- !grpc_set_socket_reuse_addr(fd, 1)) {
- gpr_log(GPR_ERROR, "Unable to configure socket %d: %s", fd,
- strerror(errno));
+ if (!GRPC_LOG_IF_ERROR("Failed to set listening socket cloexec",
+ grpc_set_socket_cloexec(fd, 1))) {
+ goto error;
+ }
+ if (!GRPC_LOG_IF_ERROR("Failed to set listening socket low latency",
+ grpc_set_socket_low_latency(fd, 1))) {
+ goto error;
+ }
+ if (!GRPC_LOG_IF_ERROR("Failed to set listening socket reuse addr",
+ grpc_set_socket_reuse_addr(fd, 1))) {
goto error;
}
@@ -386,8 +393,12 @@ static int connect_client(struct sockaddr *addr, socklen_t len) {
goto error;
}
- if (!grpc_set_socket_cloexec(fd, 1) || !grpc_set_socket_low_latency(fd, 1)) {
- gpr_log(GPR_ERROR, "Failed to configure socket");
+ if (!GRPC_LOG_IF_ERROR("Failed to set connecting socket cloexec",
+ grpc_set_socket_cloexec(fd, 1))) {
+ goto error;
+ }
+ if (!GRPC_LOG_IF_ERROR("Failed to set connecting socket low latency",
+ grpc_set_socket_low_latency(fd, 1))) {
goto error;
}
diff --git a/test/core/profiling/mark_timings.stp b/test/core/profiling/mark_timings.stp
index 0c0a417faf..e96edbc149 100644
--- a/test/core/profiling/mark_timings.stp
+++ b/test/core/profiling/mark_timings.stp
@@ -2,7 +2,7 @@
* probe definition.
*
* For a statically build binary, that'd be the name of the binary itself.
- * For dinamically built ones, point to the location of the libgprc.so being
+ * For dynamically built ones, point to the location of the libgrpc.so being
* used. */
global starts, times, times_per_tag
diff --git a/test/core/security/corpus/ssl_server_corpus/05cda1e986096f42698ee2d86ab0a4a3f6a6690b b/test/core/security/corpus/ssl_server_corpus/05cda1e986096f42698ee2d86ab0a4a3f6a6690b
new file mode 100644
index 0000000000..272c22d321
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/05cda1e986096f42698ee2d86ab0a4a3f6a6690b
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/0f65ef472e8308561c77ada56afd4de5932d950a b/test/core/security/corpus/ssl_server_corpus/0f65ef472e8308561c77ada56afd4de5932d950a
new file mode 100644
index 0000000000..eeba79a9f2
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/0f65ef472e8308561c77ada56afd4de5932d950a
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/128915cb83e66a736f8a1833c8901eccb81e0656 b/test/core/security/corpus/ssl_server_corpus/128915cb83e66a736f8a1833c8901eccb81e0656
new file mode 100644
index 0000000000..e699abcea0
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/128915cb83e66a736f8a1833c8901eccb81e0656
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/134d3a5e7a1609a583f6282c48ef9b871e0fdc15 b/test/core/security/corpus/ssl_server_corpus/134d3a5e7a1609a583f6282c48ef9b871e0fdc15
new file mode 100644
index 0000000000..13c6a93dcf
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/134d3a5e7a1609a583f6282c48ef9b871e0fdc15
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/13fccd43a6b52c62851ea24e8be4f8cfe6c0103d b/test/core/security/corpus/ssl_server_corpus/13fccd43a6b52c62851ea24e8be4f8cfe6c0103d
new file mode 100644
index 0000000000..505cfa73fc
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/13fccd43a6b52c62851ea24e8be4f8cfe6c0103d
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/171bc6b14b94c72435d2da2e31e9682f12a3f13c b/test/core/security/corpus/ssl_server_corpus/171bc6b14b94c72435d2da2e31e9682f12a3f13c
new file mode 100644
index 0000000000..06020e8895
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/171bc6b14b94c72435d2da2e31e9682f12a3f13c
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/17dea38d21e9282ecd062466cf287ecf5b30c1cf b/test/core/security/corpus/ssl_server_corpus/17dea38d21e9282ecd062466cf287ecf5b30c1cf
new file mode 100644
index 0000000000..7e77bb6371
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/17dea38d21e9282ecd062466cf287ecf5b30c1cf
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/1961eb9d4dd4bf21cbcd9c45a17b1d025eb0d200 b/test/core/security/corpus/ssl_server_corpus/1961eb9d4dd4bf21cbcd9c45a17b1d025eb0d200
new file mode 100644
index 0000000000..f3b9d87bdf
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/1961eb9d4dd4bf21cbcd9c45a17b1d025eb0d200
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/226ebb5cc16ac42fae3be273de533ac79759ae01 b/test/core/security/corpus/ssl_server_corpus/226ebb5cc16ac42fae3be273de533ac79759ae01
new file mode 100644
index 0000000000..e300b25dd6
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/226ebb5cc16ac42fae3be273de533ac79759ae01
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/2333cf428cb1e2976679ac84e64873bf76c6595e b/test/core/security/corpus/ssl_server_corpus/2333cf428cb1e2976679ac84e64873bf76c6595e
new file mode 100644
index 0000000000..de233b4df7
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/2333cf428cb1e2976679ac84e64873bf76c6595e
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/2885553a9e6829265d5f44ea4e24fcf7d6513436 b/test/core/security/corpus/ssl_server_corpus/2885553a9e6829265d5f44ea4e24fcf7d6513436
new file mode 100644
index 0000000000..c52dac2160
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/2885553a9e6829265d5f44ea4e24fcf7d6513436
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/28bce9a7cb21f3232239b9b71ef568137bf801f4 b/test/core/security/corpus/ssl_server_corpus/28bce9a7cb21f3232239b9b71ef568137bf801f4
new file mode 100644
index 0000000000..99bde1b486
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/28bce9a7cb21f3232239b9b71ef568137bf801f4
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/2a0286615be426d1e7fd5894aadf1a503df05a0a b/test/core/security/corpus/ssl_server_corpus/2a0286615be426d1e7fd5894aadf1a503df05a0a
new file mode 100644
index 0000000000..e36dac871a
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/2a0286615be426d1e7fd5894aadf1a503df05a0a
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/2b4a1f3ebe223d91c042a5e86aff31e460f6cc3f b/test/core/security/corpus/ssl_server_corpus/2b4a1f3ebe223d91c042a5e86aff31e460f6cc3f
new file mode 100644
index 0000000000..eca71b4ca6
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/2b4a1f3ebe223d91c042a5e86aff31e460f6cc3f
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/2cfbe809bcf53160ecc0109b2df01a8696a226fd b/test/core/security/corpus/ssl_server_corpus/2cfbe809bcf53160ecc0109b2df01a8696a226fd
new file mode 100644
index 0000000000..6a2035fe37
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/2cfbe809bcf53160ecc0109b2df01a8696a226fd
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/2f770de96db36ef9a71f7eb09b2e8695ac1f0655 b/test/core/security/corpus/ssl_server_corpus/2f770de96db36ef9a71f7eb09b2e8695ac1f0655
new file mode 100644
index 0000000000..0d1c163bb2
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/2f770de96db36ef9a71f7eb09b2e8695ac1f0655
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/30ba8ad171657470b5312232387b7da70c387219 b/test/core/security/corpus/ssl_server_corpus/30ba8ad171657470b5312232387b7da70c387219
new file mode 100644
index 0000000000..297c1ce649
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/30ba8ad171657470b5312232387b7da70c387219
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/36548a97a8b847e17a77d1e646c6eb5ec001d84a b/test/core/security/corpus/ssl_server_corpus/36548a97a8b847e17a77d1e646c6eb5ec001d84a
new file mode 100644
index 0000000000..9c209ebb50
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/36548a97a8b847e17a77d1e646c6eb5ec001d84a
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/3c442804f73cfe826a609d97c12ef87852742883 b/test/core/security/corpus/ssl_server_corpus/3c442804f73cfe826a609d97c12ef87852742883
new file mode 100644
index 0000000000..e8574594af
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/3c442804f73cfe826a609d97c12ef87852742883
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/3dad758011b16a3771376f9af91242953be3e47b b/test/core/security/corpus/ssl_server_corpus/3dad758011b16a3771376f9af91242953be3e47b
new file mode 100644
index 0000000000..11f9b74e3f
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/3dad758011b16a3771376f9af91242953be3e47b
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/43b56a1adffaf2c3c994679bf2b6fe6414e13df4 b/test/core/security/corpus/ssl_server_corpus/43b56a1adffaf2c3c994679bf2b6fe6414e13df4
new file mode 100644
index 0000000000..197cc02ebc
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/43b56a1adffaf2c3c994679bf2b6fe6414e13df4
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/4446c60ab89c34e5ccc26bec18d7e7d21fe5aec1 b/test/core/security/corpus/ssl_server_corpus/4446c60ab89c34e5ccc26bec18d7e7d21fe5aec1
new file mode 100644
index 0000000000..baff50d61d
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/4446c60ab89c34e5ccc26bec18d7e7d21fe5aec1
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/44924b3866956d0668ec65750c3663279ac84a36 b/test/core/security/corpus/ssl_server_corpus/44924b3866956d0668ec65750c3663279ac84a36
new file mode 100644
index 0000000000..4fb36b65bb
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/44924b3866956d0668ec65750c3663279ac84a36
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/44e4370a4eafde61f8e7dc7e4542e0ad5ecf5253 b/test/core/security/corpus/ssl_server_corpus/44e4370a4eafde61f8e7dc7e4542e0ad5ecf5253
new file mode 100644
index 0000000000..0bc4da2caa
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/44e4370a4eafde61f8e7dc7e4542e0ad5ecf5253
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/44fb8c02117ebd75c97e517624c0abc9f9a76aa7 b/test/core/security/corpus/ssl_server_corpus/44fb8c02117ebd75c97e517624c0abc9f9a76aa7
new file mode 100644
index 0000000000..9e4b559e97
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/44fb8c02117ebd75c97e517624c0abc9f9a76aa7
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/45d76dd1f0a29fce3f8d289b5177263871eb3f83 b/test/core/security/corpus/ssl_server_corpus/45d76dd1f0a29fce3f8d289b5177263871eb3f83
new file mode 100644
index 0000000000..52168fa700
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/45d76dd1f0a29fce3f8d289b5177263871eb3f83
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/4fcbf18c4135352539eaf445c26f2f8a5da9b68e b/test/core/security/corpus/ssl_server_corpus/4fcbf18c4135352539eaf445c26f2f8a5da9b68e
new file mode 100644
index 0000000000..e35f17d7e4
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/4fcbf18c4135352539eaf445c26f2f8a5da9b68e
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/508ca86c6f4e6ecc30c252ccf74e78256a893b17 b/test/core/security/corpus/ssl_server_corpus/508ca86c6f4e6ecc30c252ccf74e78256a893b17
new file mode 100644
index 0000000000..5692502a64
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/508ca86c6f4e6ecc30c252ccf74e78256a893b17
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/515d240b860fcd1e77d4a5af291aa4a667d9b609 b/test/core/security/corpus/ssl_server_corpus/515d240b860fcd1e77d4a5af291aa4a667d9b609
new file mode 100644
index 0000000000..2de4f1f2bf
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/515d240b860fcd1e77d4a5af291aa4a667d9b609
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/528e9738d5016f01cf59d74f20a8aa3f341ad89e b/test/core/security/corpus/ssl_server_corpus/528e9738d5016f01cf59d74f20a8aa3f341ad89e
new file mode 100644
index 0000000000..91fd77f9e3
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/528e9738d5016f01cf59d74f20a8aa3f341ad89e
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/54b636a2bb66ccf8247b53ff76a6400e9f1355d0 b/test/core/security/corpus/ssl_server_corpus/54b636a2bb66ccf8247b53ff76a6400e9f1355d0
new file mode 100644
index 0000000000..0e8bf5b9dd
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/54b636a2bb66ccf8247b53ff76a6400e9f1355d0
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/5cc337c4b33cd703cd354804530f5b72684260d0 b/test/core/security/corpus/ssl_server_corpus/5cc337c4b33cd703cd354804530f5b72684260d0
new file mode 100644
index 0000000000..0b8827c39b
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/5cc337c4b33cd703cd354804530f5b72684260d0
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/5ce3ec59111bf328044e41fcf26b3bc542df527e b/test/core/security/corpus/ssl_server_corpus/5ce3ec59111bf328044e41fcf26b3bc542df527e
new file mode 100644
index 0000000000..9ab3862c7d
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/5ce3ec59111bf328044e41fcf26b3bc542df527e
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/5eaac270339f19cfce4eafa2e69d62adf100ad1c b/test/core/security/corpus/ssl_server_corpus/5eaac270339f19cfce4eafa2e69d62adf100ad1c
new file mode 100644
index 0000000000..93d651b9a2
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/5eaac270339f19cfce4eafa2e69d62adf100ad1c
@@ -0,0 +1 @@
+ GEF \ No newline at end of file
diff --git a/test/core/security/corpus/ssl_server_corpus/6129382083353687a5c3acb3d4274b811227bf3d b/test/core/security/corpus/ssl_server_corpus/6129382083353687a5c3acb3d4274b811227bf3d
new file mode 100644
index 0000000000..f8a9920fa8
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/6129382083353687a5c3acb3d4274b811227bf3d
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/616a25f7c4557ef9eb33d4367c6884abc336802d b/test/core/security/corpus/ssl_server_corpus/616a25f7c4557ef9eb33d4367c6884abc336802d
new file mode 100644
index 0000000000..25ce7c1041
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/616a25f7c4557ef9eb33d4367c6884abc336802d
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/6214e558afbfdb8451e49b62619896492f1a8972 b/test/core/security/corpus/ssl_server_corpus/6214e558afbfdb8451e49b62619896492f1a8972
new file mode 100644
index 0000000000..db4c693368
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/6214e558afbfdb8451e49b62619896492f1a8972
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/6c6a6b2ce74acf8a8b90fc0b268ecc7dc992cd60 b/test/core/security/corpus/ssl_server_corpus/6c6a6b2ce74acf8a8b90fc0b268ecc7dc992cd60
new file mode 100644
index 0000000000..74960bda47
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/6c6a6b2ce74acf8a8b90fc0b268ecc7dc992cd60
@@ -0,0 +1,2 @@
+POST TF
+ \ No newline at end of file
diff --git a/test/core/security/corpus/ssl_server_corpus/6f72309e1b23b824e9bbb9abf74a014b78be038e b/test/core/security/corpus/ssl_server_corpus/6f72309e1b23b824e9bbb9abf74a014b78be038e
new file mode 100644
index 0000000000..74b7f9c4b2
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/6f72309e1b23b824e9bbb9abf74a014b78be038e
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/7137ffad853e4dd76c6d6490f37b36e20de7ede0 b/test/core/security/corpus/ssl_server_corpus/7137ffad853e4dd76c6d6490f37b36e20de7ede0
new file mode 100644
index 0000000000..c28d5e39e5
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/7137ffad853e4dd76c6d6490f37b36e20de7ede0
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/71c9356b6b6c5a3a07033d0fa4ed417fa74a77e5 b/test/core/security/corpus/ssl_server_corpus/71c9356b6b6c5a3a07033d0fa4ed417fa74a77e5
new file mode 100644
index 0000000000..9bfed86391
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/71c9356b6b6c5a3a07033d0fa4ed417fa74a77e5
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/7414938799ed61282f41d5fb1474751ca52b2682 b/test/core/security/corpus/ssl_server_corpus/7414938799ed61282f41d5fb1474751ca52b2682
new file mode 100644
index 0000000000..96343edcfd
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/7414938799ed61282f41d5fb1474751ca52b2682
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/75e853eb2ff7e78efb327e114b39baff5a1dd5bb b/test/core/security/corpus/ssl_server_corpus/75e853eb2ff7e78efb327e114b39baff5a1dd5bb
new file mode 100644
index 0000000000..a53b956562
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/75e853eb2ff7e78efb327e114b39baff5a1dd5bb
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/7607c92952b4429e350260d8074c3c460468fd49 b/test/core/security/corpus/ssl_server_corpus/7607c92952b4429e350260d8074c3c460468fd49
new file mode 100644
index 0000000000..b6607caf0b
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/7607c92952b4429e350260d8074c3c460468fd49
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/7677373c082fee56d8cdde009d9db5b117a4c8de b/test/core/security/corpus/ssl_server_corpus/7677373c082fee56d8cdde009d9db5b117a4c8de
new file mode 100644
index 0000000000..1a6a772917
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/7677373c082fee56d8cdde009d9db5b117a4c8de
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/76abde5c970743f9fb8bc781e46c431dee2aa104 b/test/core/security/corpus/ssl_server_corpus/76abde5c970743f9fb8bc781e46c431dee2aa104
new file mode 100644
index 0000000000..11ab460090
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/76abde5c970743f9fb8bc781e46c431dee2aa104
@@ -0,0 +1,2 @@
+CONNETF
+ \ No newline at end of file
diff --git a/test/core/security/corpus/ssl_server_corpus/77e0b4e2066853df9d32d475b8788e3d7d19329b b/test/core/security/corpus/ssl_server_corpus/77e0b4e2066853df9d32d475b8788e3d7d19329b
new file mode 100644
index 0000000000..6eddfc2c2a
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/77e0b4e2066853df9d32d475b8788e3d7d19329b
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/78e66840048ddc3c75e0e4abffbb3109af0d750e b/test/core/security/corpus/ssl_server_corpus/78e66840048ddc3c75e0e4abffbb3109af0d750e
new file mode 100644
index 0000000000..f7cd40b1d0
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/78e66840048ddc3c75e0e4abffbb3109af0d750e
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/7dc620eb45764390c7b106362fc4922227415407 b/test/core/security/corpus/ssl_server_corpus/7dc620eb45764390c7b106362fc4922227415407
new file mode 100644
index 0000000000..cc0b544aba
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/7dc620eb45764390c7b106362fc4922227415407
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/82ca7a52d589e9dbae37ebf1c59fac7ad876eb7c b/test/core/security/corpus/ssl_server_corpus/82ca7a52d589e9dbae37ebf1c59fac7ad876eb7c
new file mode 100644
index 0000000000..36bf08db66
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/82ca7a52d589e9dbae37ebf1c59fac7ad876eb7c
@@ -0,0 +1 @@
+HTT
diff --git a/test/core/security/corpus/ssl_server_corpus/8997d472f73eec84fea712638abd762818ec92ec b/test/core/security/corpus/ssl_server_corpus/8997d472f73eec84fea712638abd762818ec92ec
new file mode 100644
index 0000000000..0a1b6bee6c
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/8997d472f73eec84fea712638abd762818ec92ec
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/933bc3fdc56718d7ac0486c26eecddb6db1c5ba2 b/test/core/security/corpus/ssl_server_corpus/933bc3fdc56718d7ac0486c26eecddb6db1c5ba2
new file mode 100644
index 0000000000..2e3c2c83e3
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/933bc3fdc56718d7ac0486c26eecddb6db1c5ba2
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/94431bda60ddc175cf86273ddc07cb41ecf45fa1 b/test/core/security/corpus/ssl_server_corpus/94431bda60ddc175cf86273ddc07cb41ecf45fa1
new file mode 100644
index 0000000000..8f9893f46e
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/94431bda60ddc175cf86273ddc07cb41ecf45fa1
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/94c4272b2bb4fa9178eb4ae7dcf4b796fdcb22ac b/test/core/security/corpus/ssl_server_corpus/94c4272b2bb4fa9178eb4ae7dcf4b796fdcb22ac
new file mode 100644
index 0000000000..4b77d18fef
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/94c4272b2bb4fa9178eb4ae7dcf4b796fdcb22ac
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/9551c32a794250fb425005d8faf4bd24475acd41 b/test/core/security/corpus/ssl_server_corpus/9551c32a794250fb425005d8faf4bd24475acd41
new file mode 100644
index 0000000000..548f26968d
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/9551c32a794250fb425005d8faf4bd24475acd41
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/9677da7c82f18cec3e0ed2e78aadd6e590271a52 b/test/core/security/corpus/ssl_server_corpus/9677da7c82f18cec3e0ed2e78aadd6e590271a52
new file mode 100644
index 0000000000..c0dbbdfc8e
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/9677da7c82f18cec3e0ed2e78aadd6e590271a52
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/9c2e6291aff608f3f5307a7c80db6b17107f0575 b/test/core/security/corpus/ssl_server_corpus/9c2e6291aff608f3f5307a7c80db6b17107f0575
new file mode 100644
index 0000000000..86c59f30eb
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/9c2e6291aff608f3f5307a7c80db6b17107f0575
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/9c39dc04c7414ca0bb64fb942422bebe83ed8e8f b/test/core/security/corpus/ssl_server_corpus/9c39dc04c7414ca0bb64fb942422bebe83ed8e8f
new file mode 100644
index 0000000000..3bb43d133f
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/9c39dc04c7414ca0bb64fb942422bebe83ed8e8f
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/9cc8547d183a4f2ab7022b36376ca4a6230726c6 b/test/core/security/corpus/ssl_server_corpus/9cc8547d183a4f2ab7022b36376ca4a6230726c6
new file mode 100644
index 0000000000..5a1b23f80c
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/9cc8547d183a4f2ab7022b36376ca4a6230726c6
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/9e19e5e77789c34f99bbe1e6de198610d6765806 b/test/core/security/corpus/ssl_server_corpus/9e19e5e77789c34f99bbe1e6de198610d6765806
new file mode 100644
index 0000000000..66648167e5
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/9e19e5e77789c34f99bbe1e6de198610d6765806
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/9f0853ccf6912df9fba2d5fc3a1ddece41c377ac b/test/core/security/corpus/ssl_server_corpus/9f0853ccf6912df9fba2d5fc3a1ddece41c377ac
new file mode 100644
index 0000000000..30d80d86c9
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/9f0853ccf6912df9fba2d5fc3a1ddece41c377ac
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/a6d521e501322f052df5a81ee622e0e4942ddcda b/test/core/security/corpus/ssl_server_corpus/a6d521e501322f052df5a81ee622e0e4942ddcda
new file mode 100644
index 0000000000..0552176dcb
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/a6d521e501322f052df5a81ee622e0e4942ddcda
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/a9dc20f09890403be510357a7665a8f0db2468a4 b/test/core/security/corpus/ssl_server_corpus/a9dc20f09890403be510357a7665a8f0db2468a4
new file mode 100644
index 0000000000..2c82ef585a
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/a9dc20f09890403be510357a7665a8f0db2468a4
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/ac1c60970910880558ae7a2ca2e155cfd7772e05 b/test/core/security/corpus/ssl_server_corpus/ac1c60970910880558ae7a2ca2e155cfd7772e05
new file mode 100644
index 0000000000..9040ab0a63
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/ac1c60970910880558ae7a2ca2e155cfd7772e05
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/afe36d0187a155fc6e4e5c055c0ed0f3802cf696 b/test/core/security/corpus/ssl_server_corpus/afe36d0187a155fc6e4e5c055c0ed0f3802cf696
new file mode 100644
index 0000000000..473e77e048
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/afe36d0187a155fc6e4e5c055c0ed0f3802cf696
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/b12b5fc39edc5407b4a525c414ff6b5e116eee05 b/test/core/security/corpus/ssl_server_corpus/b12b5fc39edc5407b4a525c414ff6b5e116eee05
new file mode 100644
index 0000000000..09018f3092
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/b12b5fc39edc5407b4a525c414ff6b5e116eee05
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/b5b088c6e3a96f88119a940874ab04cb954797ae b/test/core/security/corpus/ssl_server_corpus/b5b088c6e3a96f88119a940874ab04cb954797ae
new file mode 100644
index 0000000000..d0f3d4d116
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/b5b088c6e3a96f88119a940874ab04cb954797ae
@@ -0,0 +1 @@
+FT
diff --git a/test/core/security/corpus/ssl_server_corpus/b65ad77a43ede3394ba714238829860c4ef4bc9f b/test/core/security/corpus/ssl_server_corpus/b65ad77a43ede3394ba714238829860c4ef4bc9f
new file mode 100644
index 0000000000..fdb6e038e2
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/b65ad77a43ede3394ba714238829860c4ef4bc9f
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/b6f265cad9d47e2ccd17a73a6d309d8898dc5428 b/test/core/security/corpus/ssl_server_corpus/b6f265cad9d47e2ccd17a73a6d309d8898dc5428
new file mode 100644
index 0000000000..bd6b0d89c1
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/b6f265cad9d47e2ccd17a73a6d309d8898dc5428
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/b7ca5868bca7ae7d1952f44ca966218b26fb7207 b/test/core/security/corpus/ssl_server_corpus/b7ca5868bca7ae7d1952f44ca966218b26fb7207
new file mode 100644
index 0000000000..29873bae09
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/b7ca5868bca7ae7d1952f44ca966218b26fb7207
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/bd20809eacabadb9bcc77d31e42d3359117b03f2 b/test/core/security/corpus/ssl_server_corpus/bd20809eacabadb9bcc77d31e42d3359117b03f2
new file mode 100644
index 0000000000..150b87d741
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/bd20809eacabadb9bcc77d31e42d3359117b03f2
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/c328623c4ce12505a54cf1a7a1606e1db36e870d b/test/core/security/corpus/ssl_server_corpus/c328623c4ce12505a54cf1a7a1606e1db36e870d
new file mode 100644
index 0000000000..32ef98cdb6
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/c328623c4ce12505a54cf1a7a1606e1db36e870d
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/c823e8bd5526d9fe7d51319737f51bd18bdd75e8 b/test/core/security/corpus/ssl_server_corpus/c823e8bd5526d9fe7d51319737f51bd18bdd75e8
new file mode 100644
index 0000000000..ed09bd0f4a
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/c823e8bd5526d9fe7d51319737f51bd18bdd75e8
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/c9394095d86ff36b69d90f7122592bf51cafe7dd b/test/core/security/corpus/ssl_server_corpus/c9394095d86ff36b69d90f7122592bf51cafe7dd
new file mode 100644
index 0000000000..6aa6cd853f
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/c9394095d86ff36b69d90f7122592bf51cafe7dd
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/cdbf0d2ae953bec07a67b7152785b548e55f85a4 b/test/core/security/corpus/ssl_server_corpus/cdbf0d2ae953bec07a67b7152785b548e55f85a4
new file mode 100644
index 0000000000..05a2a33184
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/cdbf0d2ae953bec07a67b7152785b548e55f85a4
@@ -0,0 +1 @@
+HTTP
diff --git a/test/core/security/corpus/ssl_server_corpus/cef06f9c35ee338998703555847d70c26bfc9474 b/test/core/security/corpus/ssl_server_corpus/cef06f9c35ee338998703555847d70c26bfc9474
new file mode 100644
index 0000000000..09f8c4ef69
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/cef06f9c35ee338998703555847d70c26bfc9474
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/cfb40ab8eb7031e978bed2418cdc2f0b8a8d8ec7 b/test/core/security/corpus/ssl_server_corpus/cfb40ab8eb7031e978bed2418cdc2f0b8a8d8ec7
new file mode 100644
index 0000000000..b1eceeaa0b
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/cfb40ab8eb7031e978bed2418cdc2f0b8a8d8ec7
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/d30840c3f48f11179ef976ada30477045c6d1e98 b/test/core/security/corpus/ssl_server_corpus/d30840c3f48f11179ef976ada30477045c6d1e98
new file mode 100644
index 0000000000..03710842a2
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/d30840c3f48f11179ef976ada30477045c6d1e98
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/d5afef69141edc7f4911243cf2deb19c912999cf b/test/core/security/corpus/ssl_server_corpus/d5afef69141edc7f4911243cf2deb19c912999cf
new file mode 100644
index 0000000000..3086e8e133
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/d5afef69141edc7f4911243cf2deb19c912999cf
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/d5cf71396e1a04da1a7ec266957ffd2de29d6a57 b/test/core/security/corpus/ssl_server_corpus/d5cf71396e1a04da1a7ec266957ffd2de29d6a57
new file mode 100644
index 0000000000..9e88e9e405
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/d5cf71396e1a04da1a7ec266957ffd2de29d6a57
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/d6dd8a2b085db5d33ef24b23502293ce1ce906a3 b/test/core/security/corpus/ssl_server_corpus/d6dd8a2b085db5d33ef24b23502293ce1ce906a3
new file mode 100644
index 0000000000..8bd63513c9
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/d6dd8a2b085db5d33ef24b23502293ce1ce906a3
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/d7676dcd39b7c7cfaac513a98b56fe4ac8ea27d8 b/test/core/security/corpus/ssl_server_corpus/d7676dcd39b7c7cfaac513a98b56fe4ac8ea27d8
new file mode 100644
index 0000000000..87dcaf1fc3
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/d7676dcd39b7c7cfaac513a98b56fe4ac8ea27d8
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/d8c9e9ef14abc23b36cb493283ba3e2812d9e537 b/test/core/security/corpus/ssl_server_corpus/d8c9e9ef14abc23b36cb493283ba3e2812d9e537
new file mode 100644
index 0000000000..463accbde7
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/d8c9e9ef14abc23b36cb493283ba3e2812d9e537
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/d9edb0aa5d2fe4af26ac861770c1530a4075f919 b/test/core/security/corpus/ssl_server_corpus/d9edb0aa5d2fe4af26ac861770c1530a4075f919
new file mode 100644
index 0000000000..809604e344
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/d9edb0aa5d2fe4af26ac861770c1530a4075f919
@@ -0,0 +1 @@
+GET F \ No newline at end of file
diff --git a/test/core/security/corpus/ssl_server_corpus/da1b52041957334b9ea1371bd2993013118bc82d b/test/core/security/corpus/ssl_server_corpus/da1b52041957334b9ea1371bd2993013118bc82d
new file mode 100644
index 0000000000..6f09bd8856
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/da1b52041957334b9ea1371bd2993013118bc82d
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/dca7861424c8f92d3720de5c4488454cde1c39df b/test/core/security/corpus/ssl_server_corpus/dca7861424c8f92d3720de5c4488454cde1c39df
new file mode 100644
index 0000000000..e3bf947570
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/dca7861424c8f92d3720de5c4488454cde1c39df
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/df3755e257d024ef8ab08f6d5cefcf28148ea4b1 b/test/core/security/corpus/ssl_server_corpus/df3755e257d024ef8ab08f6d5cefcf28148ea4b1
new file mode 100644
index 0000000000..a2a28cd60b
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/df3755e257d024ef8ab08f6d5cefcf28148ea4b1
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/e360a49faefb87d671edb99e777f528f52cac9ae b/test/core/security/corpus/ssl_server_corpus/e360a49faefb87d671edb99e777f528f52cac9ae
new file mode 100644
index 0000000000..92a0113f43
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/e360a49faefb87d671edb99e777f528f52cac9ae
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/e5e789605744d47e5a5d433bb04db1b413bc91a8 b/test/core/security/corpus/ssl_server_corpus/e5e789605744d47e5a5d433bb04db1b413bc91a8
new file mode 100644
index 0000000000..55f63dcec9
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/e5e789605744d47e5a5d433bb04db1b413bc91a8
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/e6e44a6aa0ece409450c85e43d02c57e338ce1da b/test/core/security/corpus/ssl_server_corpus/e6e44a6aa0ece409450c85e43d02c57e338ce1da
new file mode 100644
index 0000000000..6363a5796c
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/e6e44a6aa0ece409450c85e43d02c57e338ce1da
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/e8ebd49ee98cf57ca7eb35b6e96ef8866270aac6 b/test/core/security/corpus/ssl_server_corpus/e8ebd49ee98cf57ca7eb35b6e96ef8866270aac6
new file mode 100644
index 0000000000..cc292176e8
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/e8ebd49ee98cf57ca7eb35b6e96ef8866270aac6
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/ea0645f46ccd233337a8389b6118db5b0289f040 b/test/core/security/corpus/ssl_server_corpus/ea0645f46ccd233337a8389b6118db5b0289f040
new file mode 100644
index 0000000000..8379f01823
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/ea0645f46ccd233337a8389b6118db5b0289f040
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/f6f7687df6b7056d3c819c03c9268e22a956b6b5 b/test/core/security/corpus/ssl_server_corpus/f6f7687df6b7056d3c819c03c9268e22a956b6b5
new file mode 100644
index 0000000000..0a3b794dbf
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/f6f7687df6b7056d3c819c03c9268e22a956b6b5
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/f725caa73aa9467c5e934c49780fc409b36b251c b/test/core/security/corpus/ssl_server_corpus/f725caa73aa9467c5e934c49780fc409b36b251c
new file mode 100644
index 0000000000..146d7f9924
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/f725caa73aa9467c5e934c49780fc409b36b251c
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/f8d3326a860091edd4d60725f96f429d13f3abe6 b/test/core/security/corpus/ssl_server_corpus/f8d3326a860091edd4d60725f96f429d13f3abe6
new file mode 100644
index 0000000000..fa54b7b7b6
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/f8d3326a860091edd4d60725f96f429d13f3abe6
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/f9261344b4049e90e88b5af784dd29b938c5c838 b/test/core/security/corpus/ssl_server_corpus/f9261344b4049e90e88b5af784dd29b938c5c838
new file mode 100644
index 0000000000..02a90fb3a4
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/f9261344b4049e90e88b5af784dd29b938c5c838
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/f95b97ece3b46815204a8e6d6e94f92ec40a9672 b/test/core/security/corpus/ssl_server_corpus/f95b97ece3b46815204a8e6d6e94f92ec40a9672
new file mode 100644
index 0000000000..c21b9b830e
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/f95b97ece3b46815204a8e6d6e94f92ec40a9672
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/f97db29497e4e3225016a6ced837e20a13622f16 b/test/core/security/corpus/ssl_server_corpus/f97db29497e4e3225016a6ced837e20a13622f16
new file mode 100644
index 0000000000..1159a7772b
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/f97db29497e4e3225016a6ced837e20a13622f16
Binary files differ
diff --git a/test/core/security/corpus/ssl_server_corpus/ff1a900b12f19772f9a86bd5f560a754cdb18d1a b/test/core/security/corpus/ssl_server_corpus/ff1a900b12f19772f9a86bd5f560a754cdb18d1a
new file mode 100644
index 0000000000..85adeac4bb
--- /dev/null
+++ b/test/core/security/corpus/ssl_server_corpus/ff1a900b12f19772f9a86bd5f560a754cdb18d1a
Binary files differ
diff --git a/test/core/security/jwt_verifier_test.c b/test/core/security/jwt_verifier_test.c
index 14321d164e..71da935eeb 100644
--- a/test/core/security/jwt_verifier_test.c
+++ b/test/core/security/jwt_verifier_test.c
@@ -306,16 +306,14 @@ static int httpcli_get_google_keys_for_email(
return 1;
}
-static void on_verification_success(void *user_data,
+static void on_verification_success(grpc_exec_ctx *exec_ctx, void *user_data,
grpc_jwt_verifier_status status,
grpc_jwt_claims *claims) {
GPR_ASSERT(status == GRPC_JWT_VERIFIER_OK);
GPR_ASSERT(claims != NULL);
GPR_ASSERT(user_data == (void *)expected_user_data);
GPR_ASSERT(strcmp(grpc_jwt_claims_audience(claims), expected_audience) == 0);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_jwt_claims_destroy(&exec_ctx, claims);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_jwt_claims_destroy(exec_ctx, claims);
}
static void test_jwt_verifier_google_email_issuer_success(void) {
@@ -423,7 +421,8 @@ static void test_jwt_verifier_url_issuer_success(void) {
grpc_httpcli_set_override(NULL, NULL);
}
-static void on_verification_key_retrieval_error(void *user_data,
+static void on_verification_key_retrieval_error(grpc_exec_ctx *exec_ctx,
+ void *user_data,
grpc_jwt_verifier_status status,
grpc_jwt_claims *claims) {
GPR_ASSERT(status == GRPC_JWT_VERIFIER_KEY_RETRIEVAL_ERROR);
@@ -508,7 +507,8 @@ static void corrupt_jwt_sig(char *jwt) {
grpc_slice_unref(sig);
}
-static void on_verification_bad_signature(void *user_data,
+static void on_verification_bad_signature(grpc_exec_ctx *exec_ctx,
+ void *user_data,
grpc_jwt_verifier_status status,
grpc_jwt_claims *claims) {
GPR_ASSERT(status == GRPC_JWT_VERIFIER_BAD_SIGNATURE);
@@ -549,7 +549,7 @@ static int httpcli_get_should_not_be_called(grpc_exec_ctx *exec_ctx,
return 1;
}
-static void on_verification_bad_format(void *user_data,
+static void on_verification_bad_format(grpc_exec_ctx *exec_ctx, void *user_data,
grpc_jwt_verifier_status status,
grpc_jwt_claims *claims) {
GPR_ASSERT(status == GRPC_JWT_VERIFIER_BAD_FORMAT);
diff --git a/test/core/security/ssl_server_fuzzer.c b/test/core/security/ssl_server_fuzzer.c
new file mode 100644
index 0000000000..04969765f5
--- /dev/null
+++ b/test/core/security/ssl_server_fuzzer.c
@@ -0,0 +1,146 @@
+/*
+ *
+ * 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 <grpc/grpc.h>
+#include <grpc/grpc_security.h>
+#include <grpc/support/log.h>
+
+#include "src/core/lib/iomgr/load_file.h"
+#include "src/core/lib/security/credentials/credentials.h"
+#include "src/core/lib/security/transport/security_connector.h"
+#include "test/core/util/memory_counters.h"
+#include "test/core/util/mock_endpoint.h"
+
+bool squelch = true;
+// ssl has an array of global gpr_mu's that are never released.
+// Turning this on will fail the leak check.
+bool leak_check = false;
+
+#define SSL_CERT_PATH "src/core/lib/tsi/test_creds/server1.pem"
+#define SSL_KEY_PATH "src/core/lib/tsi/test_creds/server1.key"
+#define SSL_CA_PATH "src/core/lib/tsi/test_creds/ca.pem"
+
+static void discard_write(grpc_slice slice) {}
+
+static void dont_log(gpr_log_func_args *args) {}
+
+struct handshake_state {
+ bool done_callback_called;
+};
+
+static void on_secure_handshake_done(grpc_exec_ctx *exec_ctx, void *statep,
+ grpc_security_status status,
+ grpc_endpoint *secure_endpoint,
+ grpc_auth_context *auth_context) {
+ struct handshake_state *state = (struct handshake_state *)statep;
+ GPR_ASSERT(state->done_callback_called == false);
+ state->done_callback_called = true;
+ // The fuzzer should not pass the handshake.
+ GPR_ASSERT(status != GRPC_SECURITY_OK);
+ GPR_ASSERT(secure_endpoint == NULL);
+ GPR_ASSERT(auth_context == NULL);
+}
+
+int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
+ struct grpc_memory_counters counters;
+ if (squelch) gpr_set_log_function(dont_log);
+ if (leak_check) grpc_memory_counters_init();
+ grpc_init();
+ grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+
+ grpc_resource_quota *resource_quota =
+ grpc_resource_quota_create("ssl_server_fuzzer");
+ grpc_endpoint *mock_endpoint =
+ grpc_mock_endpoint_create(discard_write, resource_quota);
+ grpc_resource_quota_internal_unref(&exec_ctx, resource_quota);
+
+ grpc_mock_endpoint_put_read(
+ &exec_ctx, mock_endpoint,
+ grpc_slice_from_copied_buffer((const char *)data, size));
+
+ // Load key pair and establish server SSL credentials.
+ grpc_ssl_pem_key_cert_pair pem_key_cert_pair;
+ grpc_slice ca_slice, cert_slice, key_slice;
+ GPR_ASSERT(GRPC_LOG_IF_ERROR("load_file",
+ grpc_load_file(SSL_CA_PATH, 1, &ca_slice)));
+ GPR_ASSERT(GRPC_LOG_IF_ERROR("load_file",
+ grpc_load_file(SSL_CERT_PATH, 1, &cert_slice)));
+ GPR_ASSERT(GRPC_LOG_IF_ERROR("load_file",
+ grpc_load_file(SSL_KEY_PATH, 1, &key_slice)));
+ const char *ca_cert = (const char *)GRPC_SLICE_START_PTR(ca_slice);
+ pem_key_cert_pair.private_key = (const char *)GRPC_SLICE_START_PTR(key_slice);
+ pem_key_cert_pair.cert_chain = (const char *)GRPC_SLICE_START_PTR(cert_slice);
+ grpc_server_credentials *creds = grpc_ssl_server_credentials_create(
+ ca_cert, &pem_key_cert_pair, 1, 0, NULL);
+
+ // Create security connector
+ grpc_server_security_connector *sc = NULL;
+ grpc_security_status status =
+ grpc_server_credentials_create_security_connector(creds, &sc);
+ GPR_ASSERT(status == GRPC_SECURITY_OK);
+ sc->channel_args = NULL;
+ gpr_timespec deadline = gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC),
+ gpr_time_from_seconds(1, GPR_TIMESPAN));
+
+ struct handshake_state state;
+ state.done_callback_called = false;
+ grpc_server_security_connector_do_handshake(&exec_ctx, sc, NULL,
+ mock_endpoint, NULL, deadline,
+ on_secure_handshake_done, &state);
+ grpc_exec_ctx_flush(&exec_ctx);
+
+ // If the given string happens to be part of the correct client hello, the
+ // server will wait for more data. Explicitly fail the server by shutting down
+ // the endpoint.
+ if (!state.done_callback_called) {
+ grpc_endpoint_shutdown(&exec_ctx, mock_endpoint);
+ grpc_exec_ctx_flush(&exec_ctx);
+ }
+
+ GPR_ASSERT(state.done_callback_called);
+
+ GRPC_SECURITY_CONNECTOR_UNREF(&sc->base, "test");
+ grpc_server_credentials_release(creds);
+ grpc_slice_unref(cert_slice);
+ grpc_slice_unref(key_slice);
+ grpc_slice_unref(ca_slice);
+ grpc_exec_ctx_flush(&exec_ctx);
+
+ grpc_shutdown();
+ if (leak_check) {
+ counters = grpc_memory_counters_snapshot();
+ grpc_memory_counters_destroy();
+ GPR_ASSERT(counters.total_size_relative == 0);
+ }
+ return 0;
+}
diff --git a/test/core/security/verify_jwt.c b/test/core/security/verify_jwt.c
index 043d29e6bb..32169bb8d2 100644
--- a/test/core/security/verify_jwt.c
+++ b/test/core/security/verify_jwt.c
@@ -59,7 +59,7 @@ static void print_usage_and_exit(gpr_cmdline *cl, const char *argv0) {
exit(1);
}
-static void on_jwt_verification_done(void *user_data,
+static void on_jwt_verification_done(grpc_exec_ctx *exec_ctx, void *user_data,
grpc_jwt_verifier_status status,
grpc_jwt_claims *claims) {
synchronizer *sync = user_data;
@@ -72,7 +72,7 @@ static void on_jwt_verification_done(void *user_data,
grpc_json_dump_to_string((grpc_json *)grpc_jwt_claims_json(claims), 2);
printf("Claims: \n\n%s\n", claims_str);
gpr_free(claims_str);
- grpc_jwt_claims_destroy(claims);
+ grpc_jwt_claims_destroy(exec_ctx, claims);
} else {
GPR_ASSERT(claims == NULL);
fprintf(stderr, "Verification failed with error %s\n",
diff --git a/test/core/util/mock_endpoint.c b/test/core/util/mock_endpoint.c
index 28ff0642cc..bf6d85252a 100644
--- a/test/core/util/mock_endpoint.c
+++ b/test/core/util/mock_endpoint.c
@@ -37,6 +37,7 @@
#include <grpc/support/alloc.h>
#include <grpc/support/string_util.h>
+#include "src/core/lib/iomgr/sockaddr.h"
typedef struct grpc_mock_endpoint {
grpc_endpoint base;
@@ -105,6 +106,8 @@ static grpc_resource_user *me_get_resource_user(grpc_endpoint *ep) {
return m->resource_user;
}
+static int me_get_fd(grpc_endpoint *ep) { return -1; }
+
static grpc_workqueue *me_get_workqueue(grpc_endpoint *ep) { return NULL; }
static const grpc_endpoint_vtable vtable = {
@@ -117,6 +120,7 @@ static const grpc_endpoint_vtable vtable = {
me_destroy,
me_get_resource_user,
me_get_peer,
+ me_get_fd,
};
grpc_endpoint *grpc_mock_endpoint_create(void (*on_write)(grpc_slice slice),
diff --git a/test/core/util/passthru_endpoint.c b/test/core/util/passthru_endpoint.c
index 62d5f1c3db..ecffe35e9e 100644
--- a/test/core/util/passthru_endpoint.c
+++ b/test/core/util/passthru_endpoint.c
@@ -37,6 +37,7 @@
#include <grpc/support/alloc.h>
#include <grpc/support/string_util.h>
+#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/slice/slice_internal.h"
@@ -148,6 +149,8 @@ static char *me_get_peer(grpc_endpoint *ep) {
return gpr_strdup("fake:mock_endpoint");
}
+static int me_get_fd(grpc_endpoint *ep) { return -1; }
+
static grpc_workqueue *me_get_workqueue(grpc_endpoint *ep) { return NULL; }
static grpc_resource_user *me_get_resource_user(grpc_endpoint *ep) {
@@ -165,6 +168,7 @@ static const grpc_endpoint_vtable vtable = {
me_destroy,
me_get_resource_user,
me_get_peer,
+ me_get_fd,
};
static void half_init(half *m, passthru_endpoint *parent,