diff options
Diffstat (limited to 'test')
48 files changed, 138 insertions, 448 deletions
diff --git a/test/core/bad_client/bad_client.c b/test/core/bad_client/bad_client.c index e5820688ef..f753b6fd24 100644 --- a/test/core/bad_client/bad_client.c +++ b/test/core/bad_client/bad_client.c @@ -70,7 +70,7 @@ static void done_write(grpc_exec_ctx *exec_ctx, void *arg, bool success) { static void server_setup_transport(void *ts, grpc_transport *transport) { thd_args *a = ts; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_server_setup_transport(&exec_ctx, a->server, transport, + grpc_server_setup_transport(&exec_ctx, a->server, transport, NULL, grpc_server_get_channel_args(a->server)); grpc_exec_ctx_finish(&exec_ctx); } diff --git a/test/core/client_config/set_initial_connect_string_test.c b/test/core/client_config/set_initial_connect_string_test.c index c1b8452866..5390c4ab98 100644 --- a/test/core/client_config/set_initial_connect_string_test.c +++ b/test/core/client_config/set_initial_connect_string_test.c @@ -41,7 +41,7 @@ #include "src/core/ext/client_config/initial_connect_string.h" #include "src/core/lib/iomgr/sockaddr.h" -#include "src/core/lib/security/credentials.h" +#include "src/core/lib/security/credentials/fake/fake_credentials.h" #include "src/core/lib/support/string.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" @@ -69,6 +69,8 @@ static void handle_read(grpc_exec_ctx *exec_ctx, void *arg, bool success) { GPR_ASSERT(success); gpr_slice_buffer_move_into(&state.temp_incoming_buffer, &state.incoming_buffer); + gpr_log(GPR_DEBUG, "got %d bytes, magic is %d bytes", + state.incoming_buffer.length, strlen(magic_connect_string)); if (state.incoming_buffer.length > strlen(magic_connect_string)) { gpr_atm_rel_store(&state.done_atm, 1); grpc_endpoint_shutdown(exec_ctx, state.tcp); @@ -80,6 +82,7 @@ static void handle_read(grpc_exec_ctx *exec_ctx, void *arg, bool success) { } static void on_connect(grpc_exec_ctx *exec_ctx, void *arg, grpc_endpoint *tcp, + grpc_pollset *accepting_pollset, grpc_tcp_server_acceptor *acceptor) { test_tcp_server *server = arg; grpc_closure_init(&on_read, handle_read, NULL); @@ -117,7 +120,6 @@ static gpr_timespec n_sec_deadline(int seconds) { } static void start_rpc(int use_creds, int target_port) { - gpr_atm_rel_store(&state.done_atm, 0); state.cq = grpc_completion_queue_create(NULL); if (use_creds) { state.creds = grpc_fake_transport_security_credentials_create(); @@ -166,8 +168,15 @@ typedef struct { static void actually_poll_server(void *arg) { poll_args *pa = arg; gpr_timespec deadline = n_sec_deadline(10); - while (gpr_atm_acq_load(&state.done_atm) == 0 && - gpr_time_cmp(gpr_now(GPR_CLOCK_REALTIME), deadline) < 0) { + while (true) { + bool done = gpr_atm_acq_load(&state.done_atm) != 0; + gpr_timespec time_left = + gpr_time_sub(deadline, gpr_now(GPR_CLOCK_REALTIME)); + gpr_log(GPR_DEBUG, "done=%d, time_left=%d.%09d", done, time_left.tv_sec, + time_left.tv_nsec); + if (done || gpr_time_cmp(time_left, gpr_time_0(GPR_TIMESPAN)) < 0) { + break; + } test_tcp_server_poll(pa->server, 1); } gpr_event_set(pa->signal_when_done, (void *)1); @@ -176,6 +185,7 @@ static void actually_poll_server(void *arg) { static void poll_server_until_read_done(test_tcp_server *server, gpr_event *signal_when_done) { + gpr_atm_rel_store(&state.done_atm, 0); gpr_thd_id id; poll_args *pa = gpr_malloc(sizeof(*pa)); pa->server = server; diff --git a/test/core/end2end/fixtures/h2_fakesec.c b/test/core/end2end/fixtures/h2_fakesec.c index 246619bf68..44408b28af 100644 --- a/test/core/end2end/fixtures/h2_fakesec.c +++ b/test/core/end2end/fixtures/h2_fakesec.c @@ -40,7 +40,7 @@ #include <grpc/support/host_port.h> #include <grpc/support/log.h> #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/security/credentials.h" +#include "src/core/lib/security/credentials/fake/fake_credentials.h" #include "test/core/end2end/data/ssl_test_data.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" diff --git a/test/core/end2end/fixtures/h2_oauth2.c b/test/core/end2end/fixtures/h2_oauth2.c index 550ff33140..fc56998cdb 100644 --- a/test/core/end2end/fixtures/h2_oauth2.c +++ b/test/core/end2end/fixtures/h2_oauth2.c @@ -41,7 +41,7 @@ #include <grpc/support/log.h> #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/iomgr/iomgr.h" -#include "src/core/lib/security/credentials.h" +#include "src/core/lib/security/credentials/credentials.h" #include "test/core/end2end/data/ssl_test_data.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" diff --git a/test/core/end2end/fixtures/h2_sockpair+trace.c b/test/core/end2end/fixtures/h2_sockpair+trace.c index 87533a9b7f..6b0769b608 100644 --- a/test/core/end2end/fixtures/h2_sockpair+trace.c +++ b/test/core/end2end/fixtures/h2_sockpair+trace.c @@ -50,6 +50,7 @@ #include "src/core/lib/iomgr/iomgr.h" #include "src/core/lib/support/env.h" #include "src/core/lib/surface/channel.h" +#include "src/core/lib/surface/completion_queue.h" #include "src/core/lib/surface/server.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" @@ -60,7 +61,9 @@ static void server_setup_transport(void *ts, grpc_transport *transport) { grpc_end2end_test_fixture *f = ts; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_server_setup_transport(&exec_ctx, f->server, transport, + grpc_endpoint_pair *sfd = f->fixture_data; + grpc_endpoint_add_to_pollset(&exec_ctx, sfd->server, grpc_cq_pollset(f->cq)); + grpc_server_setup_transport(&exec_ctx, f->server, transport, NULL, grpc_server_get_channel_args(f->server)); grpc_exec_ctx_finish(&exec_ctx); } diff --git a/test/core/end2end/fixtures/h2_sockpair.c b/test/core/end2end/fixtures/h2_sockpair.c index f28147cf40..7be88f8a68 100644 --- a/test/core/end2end/fixtures/h2_sockpair.c +++ b/test/core/end2end/fixtures/h2_sockpair.c @@ -49,6 +49,7 @@ #include "src/core/lib/iomgr/endpoint_pair.h" #include "src/core/lib/iomgr/iomgr.h" #include "src/core/lib/surface/channel.h" +#include "src/core/lib/surface/completion_queue.h" #include "src/core/lib/surface/server.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" @@ -59,7 +60,9 @@ static void server_setup_transport(void *ts, grpc_transport *transport) { grpc_end2end_test_fixture *f = ts; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_server_setup_transport(&exec_ctx, f->server, transport, + grpc_endpoint_pair *sfd = f->fixture_data; + grpc_endpoint_add_to_pollset(&exec_ctx, sfd->server, grpc_cq_pollset(f->cq)); + grpc_server_setup_transport(&exec_ctx, f->server, transport, NULL, grpc_server_get_channel_args(f->server)); grpc_exec_ctx_finish(&exec_ctx); } diff --git a/test/core/end2end/fixtures/h2_sockpair_1byte.c b/test/core/end2end/fixtures/h2_sockpair_1byte.c index 302b16b372..166654bcbf 100644 --- a/test/core/end2end/fixtures/h2_sockpair_1byte.c +++ b/test/core/end2end/fixtures/h2_sockpair_1byte.c @@ -49,6 +49,7 @@ #include "src/core/lib/iomgr/endpoint_pair.h" #include "src/core/lib/iomgr/iomgr.h" #include "src/core/lib/surface/channel.h" +#include "src/core/lib/surface/completion_queue.h" #include "src/core/lib/surface/server.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" @@ -59,7 +60,9 @@ static void server_setup_transport(void *ts, grpc_transport *transport) { grpc_end2end_test_fixture *f = ts; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_server_setup_transport(&exec_ctx, f->server, transport, + grpc_endpoint_pair *sfd = f->fixture_data; + grpc_endpoint_add_to_pollset(&exec_ctx, sfd->server, grpc_cq_pollset(f->cq)); + grpc_server_setup_transport(&exec_ctx, f->server, transport, NULL, grpc_server_get_channel_args(f->server)); grpc_exec_ctx_finish(&exec_ctx); } diff --git a/test/core/end2end/fixtures/h2_ssl.c b/test/core/end2end/fixtures/h2_ssl.c index 69f7616074..eb28623264 100644 --- a/test/core/end2end/fixtures/h2_ssl.c +++ b/test/core/end2end/fixtures/h2_ssl.c @@ -41,7 +41,7 @@ #include <grpc/support/log.h> #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/security/credentials.h" +#include "src/core/lib/security/credentials/credentials.h" #include "src/core/lib/support/env.h" #include "src/core/lib/support/string.h" #include "src/core/lib/support/tmpfile.h" diff --git a/test/core/end2end/fixtures/h2_ssl_cert.c b/test/core/end2end/fixtures/h2_ssl_cert.c index f4dea2cc01..0fa525175b 100644 --- a/test/core/end2end/fixtures/h2_ssl_cert.c +++ b/test/core/end2end/fixtures/h2_ssl_cert.c @@ -41,7 +41,7 @@ #include <grpc/support/log.h> #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/security/credentials.h" +#include "src/core/lib/security/credentials/credentials.h" #include "src/core/lib/support/env.h" #include "src/core/lib/support/string.h" #include "src/core/lib/support/tmpfile.h" diff --git a/test/core/end2end/fixtures/h2_ssl_proxy.c b/test/core/end2end/fixtures/h2_ssl_proxy.c index 151a86cb8f..238e6bca46 100644 --- a/test/core/end2end/fixtures/h2_ssl_proxy.c +++ b/test/core/end2end/fixtures/h2_ssl_proxy.c @@ -41,7 +41,7 @@ #include <grpc/support/log.h> #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/security/credentials.h" +#include "src/core/lib/security/credentials/credentials.h" #include "src/core/lib/support/env.h" #include "src/core/lib/support/string.h" #include "src/core/lib/support/tmpfile.h" diff --git a/test/core/end2end/fixtures/proxy.c b/test/core/end2end/fixtures/proxy.c index f6e01ec41c..7f10649fa6 100644 --- a/test/core/end2end/fixtures/proxy.c +++ b/test/core/end2end/fixtures/proxy.c @@ -282,6 +282,8 @@ static void on_p2s_recv_msg(void *arg, int success) { err = grpc_call_start_batch(pc->c2p, &op, 1, new_closure(on_c2p_sent_message, pc), NULL); GPR_ASSERT(err == GRPC_CALL_OK); + } else { + grpc_byte_buffer_destroy(pc->p2s_msg); } unrefpc(pc, "on_p2s_recv_msg"); } diff --git a/test/core/end2end/fuzzers/api_fuzzer.c b/test/core/end2end/fuzzers/api_fuzzer.c index cdfa960623..e6cd88acee 100644 --- a/test/core/end2end/fuzzers/api_fuzzer.c +++ b/test/core/end2end/fuzzers/api_fuzzer.c @@ -252,7 +252,7 @@ static void do_connect(grpc_exec_ctx *exec_ctx, void *arg, bool success) { grpc_transport *transport = grpc_create_chttp2_transport(exec_ctx, NULL, server, 0); - grpc_server_setup_transport(exec_ctx, g_server, transport, NULL); + grpc_server_setup_transport(exec_ctx, g_server, transport, NULL, NULL); grpc_chttp2_transport_start_reading(exec_ctx, transport, NULL, 0); grpc_exec_ctx_enqueue(exec_ctx, fc->closure, false, NULL); @@ -424,15 +424,19 @@ static void add_to_free(call_state *call, void *p) { static void read_metadata(input_stream *inp, size_t *count, grpc_metadata **metadata, call_state *cs) { *count = next_byte(inp); - *metadata = gpr_malloc(*count * sizeof(**metadata)); - memset(*metadata, 0, *count * sizeof(**metadata)); - for (size_t i = 0; i < *count; i++) { - (*metadata)[i].key = read_string(inp); - read_buffer(inp, (char **)&(*metadata)[i].value, - &(*metadata)[i].value_length); - (*metadata)[i].flags = read_uint32(inp); - add_to_free(cs, (void *)(*metadata)[i].key); - add_to_free(cs, (void *)(*metadata)[i].value); + if (*count) { + *metadata = gpr_malloc(*count * sizeof(**metadata)); + memset(*metadata, 0, *count * sizeof(**metadata)); + for (size_t i = 0; i < *count; i++) { + (*metadata)[i].key = read_string(inp); + read_buffer(inp, (char **)&(*metadata)[i].value, + &(*metadata)[i].value_length); + (*metadata)[i].flags = read_uint32(inp); + add_to_free(cs, (void *)(*metadata)[i].key); + add_to_free(cs, (void *)(*metadata)[i].value); + } + } else { + *metadata = gpr_malloc(1); } add_to_free(cs, *metadata); } diff --git a/test/core/end2end/fuzzers/server_fuzzer.c b/test/core/end2end/fuzzers/server_fuzzer.c index 40273711ab..0a7d6d92aa 100644 --- a/test/core/end2end/fuzzers/server_fuzzer.c +++ b/test/core/end2end/fuzzers/server_fuzzer.c @@ -69,7 +69,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { grpc_server_start(server); grpc_transport *transport = grpc_create_chttp2_transport(&exec_ctx, NULL, mock_endpoint, 0); - grpc_server_setup_transport(&exec_ctx, server, transport, NULL); + grpc_server_setup_transport(&exec_ctx, server, transport, NULL, NULL); grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL, 0); grpc_call *call1 = NULL; diff --git a/test/core/end2end/tests/call_creds.c b/test/core/end2end/tests/call_creds.c index b555bea740..5c6791f6f7 100644 --- a/test/core/end2end/tests/call_creds.c +++ b/test/core/end2end/tests/call_creds.c @@ -42,7 +42,7 @@ #include <grpc/support/log.h> #include <grpc/support/time.h> #include <grpc/support/useful.h> -#include "src/core/lib/security/credentials.h" +#include "src/core/lib/security/credentials/credentials.h" #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" diff --git a/test/core/end2end/tests/request_with_flags.c b/test/core/end2end/tests/request_with_flags.c index 779895b970..f5a8d4d60c 100644 --- a/test/core/end2end/tests/request_with_flags.c +++ b/test/core/end2end/tests/request_with_flags.c @@ -105,7 +105,7 @@ static void test_invoke_request_with_flags( gpr_slice request_payload_slice = gpr_slice_from_copied_string("hello world"); grpc_byte_buffer *request_payload = grpc_raw_byte_buffer_create(&request_payload_slice, 1); - gpr_timespec deadline = GRPC_TIMEOUT_MILLIS_TO_DEADLINE(10); + gpr_timespec deadline = five_seconds_time(); grpc_end2end_test_fixture f = begin_test(config, "test_invoke_request_with_flags", NULL, NULL); cq_verifier *cqv = cq_verifier_create(f.cq); diff --git a/test/core/iomgr/tcp_server_posix_test.c b/test/core/iomgr/tcp_server_posix_test.c index 266d2396af..222ae774fc 100644 --- a/test/core/iomgr/tcp_server_posix_test.c +++ b/test/core/iomgr/tcp_server_posix_test.c @@ -113,6 +113,7 @@ static void server_weak_ref_set(server_weak_ref *weak_ref, } static void on_connect(grpc_exec_ctx *exec_ctx, void *arg, grpc_endpoint *tcp, + grpc_pollset *pollset, grpc_tcp_server_acceptor *acceptor) { grpc_endpoint_shutdown(exec_ctx, tcp); grpc_endpoint_destroy(exec_ctx, tcp); diff --git a/test/core/security/auth_context_test.c b/test/core/security/auth_context_test.c index d1ead16235..e2f44ebe24 100644 --- a/test/core/security/auth_context_test.c +++ b/test/core/security/auth_context_test.c @@ -33,7 +33,7 @@ #include <string.h> -#include "src/core/lib/security/security_context.h" +#include "src/core/lib/security/context/security_context.h" #include "src/core/lib/support/string.h" #include "test/core/util/test_config.h" diff --git a/test/core/security/b64_test.c b/test/core/security/b64_test.c index cea870321d..b26bd026fd 100644 --- a/test/core/security/b64_test.c +++ b/test/core/security/b64_test.c @@ -31,7 +31,7 @@ * */ -#include "src/core/lib/security/b64.h" +#include "src/core/lib/security/util/b64.h" #include <string.h> diff --git a/test/core/security/create_jwt.c b/test/core/security/create_jwt.c index 6d4707f3c7..3c36b767d3 100644 --- a/test/core/security/create_jwt.c +++ b/test/core/security/create_jwt.c @@ -34,8 +34,7 @@ #include <stdio.h> #include <string.h> -#include "src/core/lib/security/credentials.h" -#include "src/core/lib/security/json_token.h" +#include "src/core/lib/security/credentials/jwt/jwt_credentials.h" #include "src/core/lib/support/load_file.h" #include <grpc/support/alloc.h> diff --git a/test/core/security/credentials_test.c b/test/core/security/credentials_test.c index 7867293278..31e06372b9 100644 --- a/test/core/security/credentials_test.c +++ b/test/core/security/credentials_test.c @@ -33,7 +33,7 @@ #include <grpc/support/port_platform.h> -#include "src/core/lib/security/credentials.h" +#include "src/core/lib/security/credentials/credentials.h" #include <openssl/rsa.h> #include <stdlib.h> @@ -45,7 +45,10 @@ #include <grpc/support/time.h> #include "src/core/lib/http/httpcli.h" -#include "src/core/lib/security/json_token.h" +#include "src/core/lib/security/credentials/composite/composite_credentials.h" +#include "src/core/lib/security/credentials/google_default/google_default_credentials.h" +#include "src/core/lib/security/credentials/jwt/jwt_credentials.h" +#include "src/core/lib/security/credentials/oauth2/oauth2_credentials.h" #include "src/core/lib/support/env.h" #include "src/core/lib/support/string.h" #include "src/core/lib/support/tmpfile.h" diff --git a/test/core/security/fetch_oauth2.c b/test/core/security/fetch_oauth2.c index bd314e90d8..2a102fb139 100644 --- a/test/core/security/fetch_oauth2.c +++ b/test/core/security/fetch_oauth2.c @@ -42,7 +42,7 @@ #include <grpc/support/slice.h> #include <grpc/support/sync.h> -#include "src/core/lib/security/credentials.h" +#include "src/core/lib/security/credentials/credentials.h" #include "src/core/lib/support/load_file.h" #include "test/core/security/oauth2_utils.h" diff --git a/test/core/security/json_token_test.c b/test/core/security/json_token_test.c index 3aee52ee5c..405fe56c46 100644 --- a/test/core/security/json_token_test.c +++ b/test/core/security/json_token_test.c @@ -31,7 +31,7 @@ * */ -#include "src/core/lib/security/json_token.h" +#include "src/core/lib/security/credentials/jwt/json_token.h" #include <openssl/evp.h> #include <string.h> @@ -42,7 +42,8 @@ #include <grpc/support/slice.h> #include "src/core/lib/json/json.h" -#include "src/core/lib/security/b64.h" +#include "src/core/lib/security/credentials/oauth2/oauth2_credentials.h" +#include "src/core/lib/security/util/b64.h" #include "test/core/util/test_config.h" /* This JSON key was generated with the GCE console and revoked immediately. diff --git a/test/core/security/jwt_verifier_test.c b/test/core/security/jwt_verifier_test.c index 077f44d1d6..7f4f4ffadf 100644 --- a/test/core/security/jwt_verifier_test.c +++ b/test/core/security/jwt_verifier_test.c @@ -31,7 +31,7 @@ * */ -#include "src/core/lib/security/jwt_verifier.h" +#include "src/core/lib/security/credentials/jwt/jwt_verifier.h" #include <string.h> @@ -43,8 +43,8 @@ #include <grpc/support/string_util.h> #include "src/core/lib/http/httpcli.h" -#include "src/core/lib/security/b64.h" -#include "src/core/lib/security/json_token.h" +#include "src/core/lib/security/credentials/jwt/json_token.h" +#include "src/core/lib/security/util/b64.h" #include "test/core/util/test_config.h" /* This JSON key was generated with the GCE console and revoked immediately. diff --git a/test/core/security/oauth2_utils.c b/test/core/security/oauth2_utils.c index 20815d184c..80d21cc602 100644 --- a/test/core/security/oauth2_utils.c +++ b/test/core/security/oauth2_utils.c @@ -42,7 +42,7 @@ #include <grpc/support/slice.h> #include <grpc/support/sync.h> -#include "src/core/lib/security/credentials.h" +#include "src/core/lib/security/credentials/credentials.h" typedef struct { gpr_mu *mu; diff --git a/test/core/security/oauth2_utils.h b/test/core/security/oauth2_utils.h index eff98270c8..0f4e8857b0 100644 --- a/test/core/security/oauth2_utils.h +++ b/test/core/security/oauth2_utils.h @@ -34,7 +34,7 @@ #ifndef GRPC_TEST_CORE_SECURITY_OAUTH2_UTILS_H #define GRPC_TEST_CORE_SECURITY_OAUTH2_UTILS_H -#include "src/core/lib/security/credentials.h" +#include "src/core/lib/security/credentials/credentials.h" #ifdef __cplusplus extern "C" { diff --git a/test/core/security/print_google_default_creds_token.c b/test/core/security/print_google_default_creds_token.c index 99bce4fbdf..1b7036cf9e 100644 --- a/test/core/security/print_google_default_creds_token.c +++ b/test/core/security/print_google_default_creds_token.c @@ -42,7 +42,8 @@ #include <grpc/support/slice.h> #include <grpc/support/sync.h> -#include "src/core/lib/security/credentials.h" +#include "src/core/lib/security/credentials/composite/composite_credentials.h" +#include "src/core/lib/security/credentials/credentials.h" #include "src/core/lib/support/string.h" typedef struct { diff --git a/test/core/security/secure_endpoint_test.c b/test/core/security/secure_endpoint_test.c index aeaf38209b..6aba21a98c 100644 --- a/test/core/security/secure_endpoint_test.c +++ b/test/core/security/secure_endpoint_test.c @@ -41,7 +41,7 @@ #include <grpc/support/log.h> #include "src/core/lib/iomgr/endpoint_pair.h" #include "src/core/lib/iomgr/iomgr.h" -#include "src/core/lib/security/secure_endpoint.h" +#include "src/core/lib/security/transport/secure_endpoint.h" #include "src/core/lib/tsi/fake_transport_security.h" #include "test/core/util/test_config.h" diff --git a/test/core/security/security_connector_test.c b/test/core/security/security_connector_test.c index 1a4e64b30c..6106bec9d3 100644 --- a/test/core/security/security_connector_test.c +++ b/test/core/security/security_connector_test.c @@ -40,8 +40,8 @@ #include <grpc/support/string_util.h> #include <grpc/support/useful.h> -#include "src/core/lib/security/security_connector.h" -#include "src/core/lib/security/security_context.h" +#include "src/core/lib/security/context/security_context.h" +#include "src/core/lib/security/transport/security_connector.h" #include "src/core/lib/support/env.h" #include "src/core/lib/support/string.h" #include "src/core/lib/support/tmpfile.h" diff --git a/test/core/security/verify_jwt.c b/test/core/security/verify_jwt.c index 2274fe18d8..ecb873b655 100644 --- a/test/core/security/verify_jwt.c +++ b/test/core/security/verify_jwt.c @@ -42,7 +42,7 @@ #include <grpc/support/slice.h> #include <grpc/support/sync.h> -#include "src/core/lib/security/jwt_verifier.h" +#include "src/core/lib/security/credentials/jwt/jwt_verifier.h" typedef struct { grpc_pollset *pollset; diff --git a/test/core/surface/completion_queue_test.c b/test/core/surface/completion_queue_test.c index d62d5a93b1..49a1fc441f 100644 --- a/test/core/surface/completion_queue_test.c +++ b/test/core/surface/completion_queue_test.c @@ -63,6 +63,12 @@ static void test_no_op(void) { shutdown_and_destroy(grpc_completion_queue_create(NULL)); } +static void test_pollset_conversion(void) { + grpc_completion_queue *cq = grpc_completion_queue_create(NULL); + GPR_ASSERT(grpc_cq_from_pollset(grpc_cq_pollset(cq)) == cq); + shutdown_and_destroy(cq); +} + static void test_wait_empty(void) { grpc_completion_queue *cc; grpc_event event; @@ -408,6 +414,7 @@ int main(int argc, char **argv) { grpc_test_init(argc, argv); grpc_init(); test_no_op(); + test_pollset_conversion(); test_wait_empty(); test_shutdown_then_next_polling(); test_shutdown_then_next_with_timeout(); diff --git a/test/core/surface/concurrent_connectivity_test.c b/test/core/surface/concurrent_connectivity_test.c index 28ddf58cc8..de9ba8d27b 100644 --- a/test/core/surface/concurrent_connectivity_test.c +++ b/test/core/surface/concurrent_connectivity_test.c @@ -96,6 +96,7 @@ void server_thread(void *vargs) { } static void on_connect(grpc_exec_ctx *exec_ctx, void *vargs, grpc_endpoint *tcp, + grpc_pollset *accepting_pollset, grpc_tcp_server_acceptor *acceptor) { struct server_thread_args *args = (struct server_thread_args *)vargs; (void)acceptor; diff --git a/test/core/surface/secure_channel_create_test.c b/test/core/surface/secure_channel_create_test.c index 80419efce4..b952503167 100644 --- a/test/core/surface/secure_channel_create_test.c +++ b/test/core/surface/secure_channel_create_test.c @@ -37,8 +37,8 @@ #include <grpc/grpc_security.h> #include <grpc/support/log.h> #include "src/core/ext/client_config/resolver_registry.h" -#include "src/core/lib/security/credentials.h" -#include "src/core/lib/security/security_connector.h" +#include "src/core/lib/security/credentials/fake/fake_credentials.h" +#include "src/core/lib/security/transport/security_connector.h" #include "src/core/lib/surface/channel.h" #include "test/core/util/test_config.h" diff --git a/test/core/surface/server_chttp2_test.c b/test/core/surface/server_chttp2_test.c index d22c164972..f42ca9f9cd 100644 --- a/test/core/surface/server_chttp2_test.c +++ b/test/core/surface/server_chttp2_test.c @@ -37,7 +37,8 @@ #include <grpc/support/host_port.h> #include <grpc/support/log.h> #include <grpc/support/time.h> -#include "src/core/lib/security/credentials.h" +#include "src/core/lib/security/credentials/credentials.h" +#include "src/core/lib/security/credentials/fake/fake_credentials.h" #include "src/core/lib/tsi/fake_transport_security.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" diff --git a/test/core/surface/server_test.c b/test/core/surface/server_test.c index 3d2e25379a..1e94c5a41b 100644 --- a/test/core/surface/server_test.c +++ b/test/core/surface/server_test.c @@ -67,12 +67,14 @@ void test_register_method_fail(void) { void test_request_call_on_no_server_cq(void) { grpc_completion_queue *cc = grpc_completion_queue_create(NULL); + grpc_server *server = grpc_server_create(NULL, NULL); GPR_ASSERT(GRPC_CALL_ERROR_NOT_SERVER_COMPLETION_QUEUE == - grpc_server_request_call(NULL, NULL, NULL, NULL, cc, cc, NULL)); + grpc_server_request_call(server, NULL, NULL, NULL, cc, cc, NULL)); GPR_ASSERT(GRPC_CALL_ERROR_NOT_SERVER_COMPLETION_QUEUE == - grpc_server_request_registered_call(NULL, NULL, NULL, NULL, NULL, + grpc_server_request_registered_call(server, NULL, NULL, NULL, NULL, NULL, cc, cc, NULL)); grpc_completion_queue_destroy(cc); + grpc_server_destroy(server); } void test_bind_server_twice(void) { diff --git a/test/core/util/reconnect_server.c b/test/core/util/reconnect_server.c index d408374a09..6509cc5b68 100644 --- a/test/core/util/reconnect_server.c +++ b/test/core/util/reconnect_server.c @@ -71,6 +71,7 @@ static void pretty_print_backoffs(reconnect_server *server) { } static void on_connect(grpc_exec_ctx *exec_ctx, void *arg, grpc_endpoint *tcp, + grpc_pollset *accepting_pollset, grpc_tcp_server_acceptor *acceptor) { char *peer; char *last_colon; diff --git a/test/cpp/common/auth_property_iterator_test.cc b/test/cpp/common/auth_property_iterator_test.cc index 0e43d4e1e0..66225ff335 100644 --- a/test/cpp/common/auth_property_iterator_test.cc +++ b/test/cpp/common/auth_property_iterator_test.cc @@ -38,7 +38,7 @@ #include "test/cpp/util/string_ref_helper.h" extern "C" { -#include "src/core/lib/security/security_context.h" +#include "src/core/lib/security/context/security_context.h" } using ::grpc::testing::ToString; diff --git a/test/cpp/common/secure_auth_context_test.cc b/test/cpp/common/secure_auth_context_test.cc index 067361334d..b131452f73 100644 --- a/test/cpp/common/secure_auth_context_test.cc +++ b/test/cpp/common/secure_auth_context_test.cc @@ -38,7 +38,7 @@ #include "test/cpp/util/string_ref_helper.h" extern "C" { -#include "src/core/lib/security/security_context.h" +#include "src/core/lib/security/context/security_context.h" } using grpc::testing::ToString; diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index e3408bff75..f52aa52f39 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -48,7 +48,7 @@ #include <grpc/support/time.h> #include <gtest/gtest.h> -#include "src/core/lib/security/credentials.h" +#include "src/core/lib/security/credentials/credentials.h" #include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/core/util/port.h" diff --git a/test/cpp/end2end/hybrid_end2end_test.cc b/test/cpp/end2end/hybrid_end2end_test.cc index 02043a89d3..2c05db345b 100644 --- a/test/cpp/end2end/hybrid_end2end_test.cc +++ b/test/cpp/end2end/hybrid_end2end_test.cc @@ -207,6 +207,9 @@ class HybridEnd2endTest : public ::testing::Test { ServerBuilder builder; builder.AddListeningPort(server_address_.str(), grpc::InsecureServerCredentials()); + // Always add a sync unimplemented service: we rely on having at least one + // synchronous method to get a listening cq + builder.RegisterService(&unimplemented_service_); builder.RegisterService(service1); if (service2) { builder.RegisterService(service2); @@ -216,7 +219,7 @@ class HybridEnd2endTest : public ::testing::Test { } // Create a separate cq for each potential handler. for (int i = 0; i < 5; i++) { - cqs_.push_back(builder.AddCompletionQueue()); + cqs_.push_back(builder.AddCompletionQueue(false)); } server_ = builder.BuildAndStart(); } @@ -252,6 +255,7 @@ class HybridEnd2endTest : public ::testing::Test { EchoRequest send_request; EchoResponse recv_response; ClientContext cli_ctx; + cli_ctx.set_fail_fast(false); send_request.set_message("Hello"); Status recv_status = stub_->Echo(&cli_ctx, send_request, &recv_response); EXPECT_EQ(send_request.message(), recv_response.message()); @@ -265,6 +269,7 @@ class HybridEnd2endTest : public ::testing::Test { EchoRequest send_request; EchoResponse recv_response; ClientContext cli_ctx; + cli_ctx.set_fail_fast(false); send_request.set_message("Hello"); Status recv_status = stub->Echo(&cli_ctx, send_request, &recv_response); EXPECT_EQ(send_request.message() + "_dup", recv_response.message()); @@ -276,6 +281,7 @@ class HybridEnd2endTest : public ::testing::Test { EchoResponse recv_response; grpc::string expected_message; ClientContext cli_ctx; + cli_ctx.set_fail_fast(false); send_request.set_message("Hello"); auto stream = stub_->RequestStream(&cli_ctx, &recv_response); for (int i = 0; i < 5; i++) { @@ -292,6 +298,7 @@ class HybridEnd2endTest : public ::testing::Test { EchoRequest request; EchoResponse response; ClientContext context; + context.set_fail_fast(false); request.set_message("hello"); auto stream = stub_->ResponseStream(&context, request); @@ -311,6 +318,7 @@ class HybridEnd2endTest : public ::testing::Test { EchoRequest request; EchoResponse response; ClientContext context; + context.set_fail_fast(false); grpc::string msg("hello"); auto stream = stub_->BidiStream(&context); @@ -338,6 +346,7 @@ class HybridEnd2endTest : public ::testing::Test { EXPECT_TRUE(s.ok()); } + grpc::testing::UnimplementedService::Service unimplemented_service_; std::vector<std::unique_ptr<ServerCompletionQueue> > cqs_; std::unique_ptr<grpc::testing::EchoTestService::Stub> stub_; std::unique_ptr<Server> server_; diff --git a/test/cpp/end2end/server_builder_plugin_test.cc b/test/cpp/end2end/server_builder_plugin_test.cc index 87e3709d7d..8a74621e5a 100644 --- a/test/cpp/end2end/server_builder_plugin_test.cc +++ b/test/cpp/end2end/server_builder_plugin_test.cc @@ -189,6 +189,7 @@ class ServerBuilderPluginTest : public ::testing::TestWithParam<bool> { void StartServer() { grpc::string server_address = "localhost:" + to_string(port_); builder_->AddListeningPort(server_address, InsecureServerCredentials()); + cq_ = builder_->AddCompletionQueue(); server_ = builder_->BuildAndStart(); EXPECT_TRUE(builder_->plugins_[PLUGIN_NAME] != nullptr); } @@ -206,6 +207,12 @@ class ServerBuilderPluginTest : public ::testing::TestWithParam<bool> { EXPECT_TRUE(plugin != nullptr); EXPECT_TRUE(plugin->init_server_is_called()); EXPECT_TRUE(plugin->finish_is_called()); + server_->Shutdown(); + void* tag; + bool ok; + cq_->Shutdown(); + while (cq_->Next(&tag, &ok)) + ; } string to_string(const int number) { @@ -218,6 +225,7 @@ class ServerBuilderPluginTest : public ::testing::TestWithParam<bool> { std::shared_ptr<Channel> channel_; std::unique_ptr<ServerBuilder> builder_; std::unique_ptr<grpc::testing::EchoTestService::Stub> stub_; + std::unique_ptr<ServerCompletionQueue> cq_; std::unique_ptr<Server> server_; TestServiceImpl service_; int port_; diff --git a/test/cpp/qps/async_streaming_ping_pong_test.cc b/test/cpp/qps/async_streaming_ping_pong_test.cc deleted file mode 100644 index 4b6bae0d5c..0000000000 --- a/test/cpp/qps/async_streaming_ping_pong_test.cc +++ /dev/null @@ -1,78 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include <set> - -#include <grpc/support/log.h> - -#include "test/cpp/qps/driver.h" -#include "test/cpp/qps/report.h" -#include "test/cpp/util/benchmark_config.h" - -namespace grpc { -namespace testing { - -static const int WARMUP = 5; -static const int BENCHMARK = 5; - -static void RunAsyncStreamingPingPong() { - gpr_log(GPR_INFO, "Running Async Streaming Ping Pong"); - - ClientConfig client_config; - client_config.set_client_type(ASYNC_CLIENT); - client_config.set_outstanding_rpcs_per_channel(1); - client_config.set_client_channels(1); - client_config.set_async_client_threads(1); - client_config.set_rpc_type(STREAMING); - client_config.mutable_load_params()->mutable_closed_loop(); - - ServerConfig server_config; - server_config.set_server_type(ASYNC_SERVER); - server_config.set_async_server_threads(1); - - const auto result = - RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2); - - GetReporter()->ReportQPS(*result); - GetReporter()->ReportLatency(*result); -} - -} // namespace testing -} // namespace grpc - -int main(int argc, char** argv) { - grpc::testing::InitBenchmark(&argc, &argv, true); - - grpc::testing::RunAsyncStreamingPingPong(); - return 0; -} diff --git a/test/cpp/qps/async_unary_ping_pong_test.cc b/test/cpp/qps/async_unary_ping_pong_test.cc deleted file mode 100644 index 571a8b7300..0000000000 --- a/test/cpp/qps/async_unary_ping_pong_test.cc +++ /dev/null @@ -1,77 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include <set> - -#include <grpc/support/log.h> - -#include "test/cpp/qps/driver.h" -#include "test/cpp/qps/report.h" -#include "test/cpp/util/benchmark_config.h" - -namespace grpc { -namespace testing { - -static const int WARMUP = 5; -static const int BENCHMARK = 5; - -static void RunAsyncUnaryPingPong() { - gpr_log(GPR_INFO, "Running Async Unary Ping Pong"); - - ClientConfig client_config; - client_config.set_client_type(ASYNC_CLIENT); - client_config.set_outstanding_rpcs_per_channel(1); - client_config.set_client_channels(1); - client_config.set_async_client_threads(1); - client_config.set_rpc_type(UNARY); - client_config.mutable_load_params()->mutable_closed_loop(); - - ServerConfig server_config; - server_config.set_server_type(ASYNC_SERVER); - server_config.set_async_server_threads(1); - - const auto result = - RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2); - - GetReporter()->ReportQPS(*result); - GetReporter()->ReportLatency(*result); -} -} // namespace testing -} // namespace grpc - -int main(int argc, char** argv) { - grpc::testing::InitBenchmark(&argc, &argv, true); - - grpc::testing::RunAsyncUnaryPingPong(); - return 0; -} diff --git a/test/cpp/qps/gen_build_yaml.py b/test/cpp/qps/gen_build_yaml.py index 6b3329b046..34b8151441 100755 --- a/test/cpp/qps/gen_build_yaml.py +++ b/test/cpp/qps/gen_build_yaml.py @@ -44,8 +44,29 @@ sys.path.append(run_tests_root) import performance.scenario_config as scenario_config def _scenario_json_string(scenario_json): + # tweak parameters to get fast test times + scenario_json['warmup_seconds'] = 1 + scenario_json['benchmark_seconds'] = 1 return json.dumps(scenario_config.remove_nonproto_fields(scenario_json)) +def threads_of_type(scenario_json, path): + d = scenario_json + for el in path.split('/'): + if el not in d: + return 0 + d = d[el] + return d + +def guess_cpu(scenario_json): + client = threads_of_type(scenario_json, 'client_config/async_client_threads') + server = threads_of_type(scenario_json, 'server_config/async_server_threads') + # make an arbitrary guess if set to auto-detect + # about the size of the jenkins instances we have for unit tests + if client == 0: client = 8 + if server == 0: server = 8 + return (scenario_json['num_clients'] * client + + scenario_json['num_servers'] * server) + print yaml.dump({ 'tests': [ { @@ -59,7 +80,7 @@ print yaml.dump({ 'language': 'c++', 'boringssl': True, 'defaults': 'boringssl', - 'cpu_cost': 1000.0, + 'cpu_cost': guess_cpu(scenario_json), 'exclude_configs': [] } for scenario_json in scenario_config.CXXLanguage().scenarios() diff --git a/test/cpp/qps/generic_async_streaming_ping_pong_test.cc b/test/cpp/qps/generic_async_streaming_ping_pong_test.cc deleted file mode 100644 index ea373ece84..0000000000 --- a/test/cpp/qps/generic_async_streaming_ping_pong_test.cc +++ /dev/null @@ -1,82 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include <set> - -#include <grpc/support/log.h> - -#include "test/cpp/qps/driver.h" -#include "test/cpp/qps/report.h" -#include "test/cpp/util/benchmark_config.h" - -namespace grpc { -namespace testing { - -static const int WARMUP = 5; -static const int BENCHMARK = 5; - -static void RunGenericAsyncStreamingPingPong() { - gpr_log(GPR_INFO, "Running Generic Async Streaming Ping Pong"); - - ClientConfig client_config; - client_config.set_client_type(ASYNC_CLIENT); - client_config.set_outstanding_rpcs_per_channel(1); - client_config.set_client_channels(1); - client_config.set_async_client_threads(1); - client_config.set_rpc_type(STREAMING); - client_config.mutable_load_params()->mutable_closed_loop(); - auto bbuf = client_config.mutable_payload_config()->mutable_bytebuf_params(); - bbuf->set_resp_size(0); - bbuf->set_req_size(0); - - ServerConfig server_config; - server_config.set_server_type(ASYNC_GENERIC_SERVER); - server_config.set_async_server_threads(1); - *server_config.mutable_payload_config() = client_config.payload_config(); - - const auto result = - RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2); - - GetReporter()->ReportQPS(*result); - GetReporter()->ReportLatency(*result); -} - -} // namespace testing -} // namespace grpc - -int main(int argc, char** argv) { - grpc::testing::InitBenchmark(&argc, &argv, true); - - grpc::testing::RunGenericAsyncStreamingPingPong(); - return 0; -} diff --git a/test/cpp/qps/qps_test.cc b/test/cpp/qps/qps_test.cc index c3e72d9b17..f94ea0cb49 100644 --- a/test/cpp/qps/qps_test.cc +++ b/test/cpp/qps/qps_test.cc @@ -50,8 +50,8 @@ static void RunQPS() { ClientConfig client_config; client_config.set_client_type(ASYNC_CLIENT); - client_config.set_outstanding_rpcs_per_channel(1000); - client_config.set_client_channels(8); + client_config.set_outstanding_rpcs_per_channel(100); + client_config.set_client_channels(64); client_config.set_async_client_threads(8); client_config.set_rpc_type(STREAMING); client_config.mutable_load_params()->mutable_closed_loop(); diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc index 1234542687..1eddb1dc1d 100644 --- a/test/cpp/qps/server_async.cc +++ b/test/cpp/qps/server_async.cc @@ -131,10 +131,10 @@ class AsyncQpsServerTest : public Server { } } ~AsyncQpsServerTest() { - server_->Shutdown(); for (auto ss = shutdown_state_.begin(); ss != shutdown_state_.end(); ++ss) { (*ss)->set_shutdown(); } + server_->Shutdown(); for (auto thr = threads_.begin(); thr != threads_.end(); thr++) { thr->join(); } diff --git a/test/cpp/qps/sync_streaming_ping_pong_test.cc b/test/cpp/qps/sync_streaming_ping_pong_test.cc deleted file mode 100644 index 67c62f4bae..0000000000 --- a/test/cpp/qps/sync_streaming_ping_pong_test.cc +++ /dev/null @@ -1,76 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include <set> - -#include <grpc/support/log.h> - -#include "test/cpp/qps/driver.h" -#include "test/cpp/qps/report.h" -#include "test/cpp/util/benchmark_config.h" - -namespace grpc { -namespace testing { - -static const int WARMUP = 5; -static const int BENCHMARK = 5; - -static void RunSynchronousStreamingPingPong() { - gpr_log(GPR_INFO, "Running Synchronous Streaming Ping Pong"); - - ClientConfig client_config; - client_config.set_client_type(SYNC_CLIENT); - client_config.set_outstanding_rpcs_per_channel(1); - client_config.set_client_channels(1); - client_config.set_rpc_type(STREAMING); - client_config.mutable_load_params()->mutable_closed_loop(); - - ServerConfig server_config; - server_config.set_server_type(SYNC_SERVER); - - const auto result = - RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2); - - GetReporter()->ReportQPS(*result); - GetReporter()->ReportLatency(*result); -} -} // namespace testing -} // namespace grpc - -int main(int argc, char** argv) { - grpc::testing::InitBenchmark(&argc, &argv, true); - - grpc::testing::RunSynchronousStreamingPingPong(); - - return 0; -} diff --git a/test/cpp/qps/sync_unary_ping_pong_test.cc b/test/cpp/qps/sync_unary_ping_pong_test.cc deleted file mode 100644 index aa0c0c3013..0000000000 --- a/test/cpp/qps/sync_unary_ping_pong_test.cc +++ /dev/null @@ -1,77 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include <set> - -#include <grpc/support/log.h> - -#include "test/cpp/qps/driver.h" -#include "test/cpp/qps/report.h" -#include "test/cpp/util/benchmark_config.h" - -namespace grpc { -namespace testing { - -static const int WARMUP = 5; -static const int BENCHMARK = 5; - -static void RunSynchronousUnaryPingPong() { - gpr_log(GPR_INFO, "Running Synchronous Unary Ping Pong"); - - ClientConfig client_config; - client_config.set_client_type(SYNC_CLIENT); - client_config.set_outstanding_rpcs_per_channel(1); - client_config.set_client_channels(1); - client_config.set_rpc_type(UNARY); - client_config.mutable_load_params()->mutable_closed_loop(); - - ServerConfig server_config; - server_config.set_server_type(SYNC_SERVER); - - const auto result = - RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2); - - GetReporter()->ReportQPS(*result); - GetReporter()->ReportLatency(*result); -} - -} // namespace testing -} // namespace grpc - -int main(int argc, char** argv) { - grpc::testing::InitBenchmark(&argc, &argv, true); - - grpc::testing::RunSynchronousUnaryPingPong(); - - return 0; -} |