diff options
author | Yash Tibrewal <yashkt@google.com> | 2017-11-06 14:39:17 -0800 |
---|---|---|
committer | Yash Tibrewal <yashkt@google.com> | 2017-11-06 14:43:31 -0800 |
commit | 40422d5fa621624868280094efb2f01c2cd1352b (patch) | |
tree | cbb2baa955e11c03fa004e9e0f4f3037ba3d6150 /test/core/fling | |
parent | aae4ca01a315a69fcf182d09aea1efdfcda13d48 (diff) | |
parent | e759d2ad7abdb0702970eeccc5f033ff4b2a4c7f (diff) |
Merge master
Diffstat (limited to 'test/core/fling')
-rw-r--r-- | test/core/fling/client.cc | 34 | ||||
-rw-r--r-- | test/core/fling/fling_stream_test.cc | 22 | ||||
-rw-r--r-- | test/core/fling/fling_test.cc | 22 | ||||
-rw-r--r-- | test/core/fling/server.cc | 43 |
4 files changed, 61 insertions, 60 deletions
diff --git a/test/core/fling/client.cc b/test/core/fling/client.cc index 356ec4bb28..64d1dc5089 100644 --- a/test/core/fling/client.cc +++ b/test/core/fling/client.cc @@ -30,20 +30,20 @@ #include "test/core/util/grpc_profiler.h" #include "test/core/util/test_config.h" -static gpr_histogram *histogram; -static grpc_byte_buffer *the_buffer; -static grpc_channel *channel; -static grpc_completion_queue *cq; -static grpc_call *call; +static gpr_histogram* histogram; +static grpc_byte_buffer* the_buffer; +static grpc_channel* channel; +static grpc_completion_queue* cq; +static grpc_call* call; static grpc_op ops[6]; static grpc_op stream_init_ops[2]; static grpc_op stream_step_ops[2]; static grpc_metadata_array initial_metadata_recv; static grpc_metadata_array trailing_metadata_recv; -static grpc_byte_buffer *response_payload_recv = NULL; +static grpc_byte_buffer* response_payload_recv = NULL; static grpc_status_code status; static grpc_slice details; -static grpc_op *op; +static grpc_op* op; static void init_ping_pong_request(void) { grpc_metadata_array_init(&initial_metadata_recv); @@ -81,8 +81,8 @@ static void step_ping_pong_request(void) { grpc_slice_from_static_string("/Reflector/reflectUnary"), &host, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call, ops, - (size_t)(op - ops), - (void *)1, NULL)); + (size_t)(op - ops), (void*)1, + NULL)); grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); grpc_call_unref(call); grpc_byte_buffer_destroy(response_payload_recv); @@ -104,7 +104,7 @@ static void init_ping_pong_stream(void) { stream_init_ops[1].op = GRPC_OP_RECV_INITIAL_METADATA; stream_init_ops[1].data.recv_initial_metadata.recv_initial_metadata = &initial_metadata_recv; - error = grpc_call_start_batch(call, stream_init_ops, 2, (void *)1, NULL); + error = grpc_call_start_batch(call, stream_init_ops, 2, (void*)1, NULL); GPR_ASSERT(GRPC_CALL_OK == error); grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); @@ -119,7 +119,7 @@ static void init_ping_pong_stream(void) { static void step_ping_pong_stream(void) { grpc_call_error error; GPR_TIMER_BEGIN("ping_pong", 1); - error = grpc_call_start_batch(call, stream_step_ops, 2, (void *)1, NULL); + error = grpc_call_start_batch(call, stream_step_ops, 2, (void*)1, NULL); GPR_ASSERT(GRPC_CALL_OK == error); grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); grpc_byte_buffer_destroy(response_payload_recv); @@ -132,7 +132,7 @@ static double now(void) { } typedef struct { - const char *name; + const char* name; void (*init)(); void (*do_one_step)(); } scenario; @@ -142,19 +142,19 @@ static const scenario scenarios[] = { {"ping-pong-stream", init_ping_pong_stream, step_ping_pong_stream}, }; -int main(int argc, char **argv) { +int main(int argc, char** argv) { grpc_slice slice = grpc_slice_from_copied_string("x"); double start, stop; unsigned i; - char *fake_argv[1]; + char* fake_argv[1]; int payload_size = 1; int secure = 0; - const char *target = "localhost:443"; - gpr_cmdline *cl; + const char* target = "localhost:443"; + gpr_cmdline* cl; grpc_event event; - const char *scenario_name = "ping-pong-request"; + const char* scenario_name = "ping-pong-request"; scenario sc = {NULL, NULL, NULL}; gpr_timers_set_log_filename("latency_trace.fling_client.txt"); diff --git a/test/core/fling/fling_stream_test.cc b/test/core/fling/fling_stream_test.cc index 4e3b63e192..620427e12a 100644 --- a/test/core/fling/fling_stream_test.cc +++ b/test/core/fling/fling_stream_test.cc @@ -26,12 +26,12 @@ #include "src/core/lib/support/string.h" #include "test/core/util/port.h" -int main(int argc, char **argv) { - char *me = argv[0]; - char *lslash = strrchr(me, '/'); +int main(int argc, char** argv) { + char* me = argv[0]; + char* lslash = strrchr(me, '/'); char root[1024]; int port = grpc_pick_unused_port_or_die(); - char *args[10]; + char* args[10]; int status; gpr_subprocess *svr, *cli; /* figure out where we are */ @@ -44,22 +44,22 @@ int main(int argc, char **argv) { /* start the server */ gpr_asprintf(&args[0], "%s/fling_server%s", root, gpr_subprocess_binary_extension()); - args[1] = const_cast<char *>("--bind"); + args[1] = const_cast<char*>("--bind"); gpr_join_host_port(&args[2], "::", port); - args[3] = const_cast<char *>("--no-secure"); - svr = gpr_subprocess_create(4, (const char **)args); + args[3] = const_cast<char*>("--no-secure"); + svr = gpr_subprocess_create(4, (const char**)args); gpr_free(args[0]); gpr_free(args[2]); /* start the client */ gpr_asprintf(&args[0], "%s/fling_client%s", root, gpr_subprocess_binary_extension()); - args[1] = const_cast<char *>("--target"); + args[1] = const_cast<char*>("--target"); gpr_join_host_port(&args[2], "127.0.0.1", port); - args[3] = const_cast<char *>("--scenario=ping-pong-stream"); - args[4] = const_cast<char *>("--no-secure"); + args[3] = const_cast<char*>("--scenario=ping-pong-stream"); + args[4] = const_cast<char*>("--no-secure"); args[5] = 0; - cli = gpr_subprocess_create(6, (const char **)args); + cli = gpr_subprocess_create(6, (const char**)args); gpr_free(args[0]); gpr_free(args[2]); diff --git a/test/core/fling/fling_test.cc b/test/core/fling/fling_test.cc index a7681d572a..1d4263ab01 100644 --- a/test/core/fling/fling_test.cc +++ b/test/core/fling/fling_test.cc @@ -26,12 +26,12 @@ #include "src/core/lib/support/string.h" #include "test/core/util/port.h" -int main(int argc, const char **argv) { - const char *me = argv[0]; - const char *lslash = strrchr(me, '/'); +int main(int argc, const char** argv) { + const char* me = argv[0]; + const char* lslash = strrchr(me, '/'); char root[1024]; int port = grpc_pick_unused_port_or_die(); - char *args[10]; + char* args[10]; int status; gpr_subprocess *svr, *cli; /* figure out where we are */ @@ -44,22 +44,22 @@ int main(int argc, const char **argv) { /* start the server */ gpr_asprintf(&args[0], "%s/fling_server%s", root, gpr_subprocess_binary_extension()); - args[1] = const_cast<char *>("--bind"); + args[1] = const_cast<char*>("--bind"); gpr_join_host_port(&args[2], "::", port); - args[3] = const_cast<char *>("--no-secure"); - svr = gpr_subprocess_create(4, (const char **)args); + args[3] = const_cast<char*>("--no-secure"); + svr = gpr_subprocess_create(4, (const char**)args); gpr_free(args[0]); gpr_free(args[2]); /* start the client */ gpr_asprintf(&args[0], "%s/fling_client%s", root, gpr_subprocess_binary_extension()); - args[1] = const_cast<char *>("--target"); + args[1] = const_cast<char*>("--target"); gpr_join_host_port(&args[2], "127.0.0.1", port); - args[3] = const_cast<char *>("--scenario=ping-pong-request"); - args[4] = const_cast<char *>("--no-secure"); + args[3] = const_cast<char*>("--scenario=ping-pong-request"); + args[4] = const_cast<char*>("--no-secure"); args[5] = 0; - cli = gpr_subprocess_create(6, (const char **)args); + cli = gpr_subprocess_create(6, (const char**)args); gpr_free(args[0]); gpr_free(args[2]); diff --git a/test/core/fling/server.cc b/test/core/fling/server.cc index 34e5f79f0b..4dfb30f107 100644 --- a/test/core/fling/server.cc +++ b/test/core/fling/server.cc @@ -40,15 +40,15 @@ #include "test/core/util/port.h" #include "test/core/util/test_config.h" -static grpc_completion_queue *cq; -static grpc_server *server; -static grpc_call *call; +static grpc_completion_queue* cq; +static grpc_server* server; +static grpc_call* call; static grpc_call_details call_details; static grpc_metadata_array request_metadata_recv; static grpc_metadata_array initial_metadata_send; -static grpc_byte_buffer *payload_buffer = NULL; +static grpc_byte_buffer* payload_buffer = NULL; /* Used to drain the terminal read in unary calls. */ -static grpc_byte_buffer *terminal_buffer = NULL; +static grpc_byte_buffer* terminal_buffer = NULL; static grpc_op read_op; static grpc_op metadata_send_op; @@ -58,7 +58,7 @@ static int was_cancelled = 2; static grpc_op unary_ops[6]; static int got_sigint = 0; -static void *tag(intptr_t t) { return (void *)t; } +static void* tag(intptr_t t) { return (void*)t; } typedef enum { FLING_SERVER_NEW_REQUEST = 1, @@ -84,7 +84,7 @@ static void request_call(void) { } static void handle_unary_method(void) { - grpc_op *op; + grpc_op* op; grpc_call_error error; grpc_metadata_array_init(&initial_metadata_send); @@ -118,7 +118,7 @@ static void handle_unary_method(void) { static void send_initial_metadata(void) { grpc_call_error error; - void *tagarg = tag(FLING_SERVER_SEND_INIT_METADATA_FOR_STREAMING); + void* tagarg = tag(FLING_SERVER_SEND_INIT_METADATA_FOR_STREAMING); grpc_metadata_array_init(&initial_metadata_send); metadata_send_op.op = GRPC_OP_SEND_INITIAL_METADATA; metadata_send_op.data.send_initial_metadata.count = 0; @@ -138,7 +138,7 @@ static void start_read_op(int t) { static void start_write_op(void) { grpc_call_error error; - void *tagarg = tag(FLING_SERVER_WRITE_FOR_STREAMING); + void* tagarg = tag(FLING_SERVER_WRITE_FOR_STREAMING); /* Starting write at server */ write_op.op = GRPC_OP_SEND_MESSAGE; if (payload_buffer == NULL) { @@ -151,7 +151,7 @@ static void start_write_op(void) { static void start_send_status(void) { grpc_call_error error; - void *tagarg = tag(FLING_SERVER_SEND_STATUS_FOR_STREAMING); + void* tagarg = tag(FLING_SERVER_SEND_STATUS_FOR_STREAMING); status_op[0].op = GRPC_OP_SEND_STATUS_FROM_SERVER; status_op[0].data.send_status_from_server.status = GRPC_STATUS_OK; status_op[0].data.send_status_from_server.trailing_metadata_count = 0; @@ -167,19 +167,19 @@ static void start_send_status(void) { When that is resolved, please remove the #include <unistd.h> above. */ static void sigint_handler(int x) { _exit(0); } -int main(int argc, char **argv) { +int main(int argc, char** argv) { grpc_event ev; - call_state *s; - char *addr_buf = NULL; - gpr_cmdline *cl; - grpc_completion_queue *shutdown_cq; + call_state* s; + char* addr_buf = NULL; + gpr_cmdline* cl; + grpc_completion_queue* shutdown_cq; int shutdown_started = 0; int shutdown_finished = 0; int secure = 0; - const char *addr = NULL; + const char* addr = NULL; - char *fake_argv[1]; + char* fake_argv[1]; gpr_timers_set_log_filename("latency_trace.fling_server.txt"); @@ -206,7 +206,7 @@ int main(int argc, char **argv) { if (secure) { grpc_ssl_pem_key_cert_pair pem_key_cert_pair = {test_server1_key, test_server1_cert}; - grpc_server_credentials *ssl_creds = grpc_ssl_server_credentials_create( + grpc_server_credentials* ssl_creds = grpc_ssl_server_credentials_create( NULL, &pem_key_cert_pair, 1, 0, NULL); server = grpc_server_create(NULL, NULL); GPR_ASSERT(grpc_server_add_secure_http2_port(server, addr, ssl_creds)); @@ -244,10 +244,11 @@ int main(int argc, char **argv) { shutdown_started = 1; } ev = grpc_completion_queue_next( - cq, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_micros(1000000, GPR_TIMESPAN)), + cq, + gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), + gpr_time_from_micros(1000000, GPR_TIMESPAN)), NULL); - s = static_cast<call_state *>(ev.tag); + s = static_cast<call_state*>(ev.tag); switch (ev.type) { case GRPC_OP_COMPLETE: switch ((intptr_t)s) { |