From afd541cbd35d873a98aee02ed0bd8177f3343410 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 3 Mar 2015 18:16:09 -0800 Subject: Updated C extension to new call API --- src/php/ext/grpc/call.c | 523 +++++++++++++++++++----------------- src/php/ext/grpc/call.h | 14 +- src/php/ext/grpc/channel.c | 1 - src/php/ext/grpc/completion_queue.c | 168 ------------ src/php/ext/grpc/completion_queue.h | 62 ----- src/php/ext/grpc/config.m4 | 2 +- src/php/ext/grpc/event.c | 150 ----------- src/php/ext/grpc/event.h | 51 ---- src/php/ext/grpc/php_grpc.c | 36 +-- src/php/ext/grpc/server.c | 75 ++++-- src/php/ext/grpc/server.h | 1 + 11 files changed, 347 insertions(+), 736 deletions(-) delete mode 100644 src/php/ext/grpc/completion_queue.c delete mode 100755 src/php/ext/grpc/completion_queue.h delete mode 100644 src/php/ext/grpc/event.c delete mode 100755 src/php/ext/grpc/event.h diff --git a/src/php/ext/grpc/call.c b/src/php/ext/grpc/call.c index df0635dc72..b1ac1b7640 100644 --- a/src/php/ext/grpc/call.c +++ b/src/php/ext/grpc/call.c @@ -49,16 +49,28 @@ #include #include "grpc/support/log.h" +#include "grpc/support/alloc.h" #include "grpc/grpc.h" #include "timeval.h" #include "channel.h" -#include "completion_queue.h" #include "byte_buffer.h" /* Frees and destroys an instance of wrapped_grpc_call */ void free_wrapped_grpc_call(void *object TSRMLS_DC) { wrapped_grpc_call *call = (wrapped_grpc_call *)object; + grpc_event *event; + if (call->queue != NULL) { + grpc_completion_queue_shutdown(call->queue); + event = grpc_completion_queue_next(call->queue, gpr_inf_future); + while (event != NULL) { + if (event->type == GRPC_QUEUE_SHUTDOWN) { + break; + } + event = grpc_completion_queue_next(call->queue, gpr_inf_future); + } + grpc_completion_queue_destroy(call->queue); + } if (call->owned && call->wrapped != NULL) { grpc_call_destroy(call->wrapped); } @@ -93,10 +105,13 @@ zval *grpc_php_wrap_call(grpc_call *wrapped, bool owned) { wrapped_grpc_call *call = (wrapped_grpc_call *)zend_object_store_get_object(call_object TSRMLS_CC); call->wrapped = wrapped; + call->queue = grpc_completion_queue_create(); return call_object; } -zval *grpc_call_create_metadata_array(int count, grpc_metadata *elements) { +zval *grpc_parse_metadata_array(grpc_metadata_array *metadata_array) { + int count = metadata_array->count; + grpc_metadata *elements = metadata_array->metadata; int i; zval *array; zval **data = NULL; @@ -137,6 +152,62 @@ zval *grpc_call_create_metadata_array(int count, grpc_metadata *elements) { return array; } +bool create_metadata_array(zval *array, grpc_metadata_array *metadata) { + zval **inner_array; + zval **value; + HashTable *array_hash; + HashPosition array_pointer; + HashTable *inner_array_hash; + HashPosition inner_array_pointer; + char *key; + uint key_len; + ulong index; + if (Z_TYPE_P(array) != IS_ARRAY) { + return false; + } + grpc_metadata_array_init(metadata); + array_hash = Z_ARRVAL_P(array); + for (zend_hash_internal_pointer_reset_ex(array_hash, &array_pointer); + zend_hash_get_current_data_ex(array_hash, (void**)&inner_array, + &array_pointer) == SUCCESS; + zend_hash_move_forward_ex(array_hash, &array_pointer)) { + if (zend_hash_get_current_key_ex(array_hash, &key, &key_len, &index, 0, + &array_pointer) != HASH_KEY_IS_STRING) { + return false; + } + if (Z_TYPE_P(*inner_array) != IS_ARRAY) { + return false; + } + inner_array_hash = Z_ARRVAL_P(*inner_array); + metadata->capacity += zend_hash_num_elements(inner_array_hash); + } + metadata->metadata = gpr_malloc(metadata->capacity * sizeof(grpc_metadata)); + for (zend_hash_internal_pointer_reset_ex(array_hash, &array_pointer); + zend_hash_get_current_data_ex(array_hash, (void**)&inner_array, + &array_pointer) == SUCCESS; + zend_hash_move_forward_ex(array_hash, &array_pointer)) { + if (zend_hash_get_current_key_ex(array_hash, &key, &key_len, &index, 0, + &array_pointer) != HASH_KEY_IS_STRING) { + return false; + } + inner_array_hash = Z_ARRVAL_P(*inner_array); + for (zend_hash_internal_pointer_reset_ex(inner_array_hash, + &inner_array_pointer); + zend_hash_get_current_data_ex(inner_array_hash, (void**)&value, + &inner_array_pointer) == SUCCESS; + zend_hash_move_forward_ex(inner_array_hash, &inner_array_pointer)) { + if (Z_TYPE_P(*value) != IS_STRING) { + return false; + } + metadata->metadata[metadata->count].key = key; + metadata->metadata[metadata->count].value = Z_STRVAL_P(*value); + metadata->metadata[metadata->count].value_length = Z_STRLEN_P(*value); + metadata->count += 1; + } + } + return true; +} + /** * Constructs a new instance of the Call class. * @param Channel $channel The channel to associate the call with. Must not be @@ -155,9 +226,10 @@ PHP_METHOD(Call, __construct) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OsO", &channel_obj, grpc_ce_channel, &method, &method_len, &deadline_obj, grpc_ce_timeval) == FAILURE) { - zend_throw_exception(spl_ce_InvalidArgumentException, - "Call expects a Channel, a String, and a Timeval", - 1 TSRMLS_CC); + zend_throw_exception( + spl_ce_InvalidArgumentException, + "Call expects a Channel, a String, and a Timeval", + 1 TSRMLS_CC); return; } wrapped_grpc_channel *channel = @@ -173,289 +245,238 @@ PHP_METHOD(Call, __construct) { wrapped_grpc_timeval *deadline = (wrapped_grpc_timeval *)zend_object_store_get_object( deadline_obj TSRMLS_CC); - call->wrapped = grpc_channel_create_call_old( - channel->wrapped, method, channel->target, deadline->wrapped); + call->queue = grpc_completion_queue_create(); + call->wrapped = grpc_channel_create_call( + channel->wrapped, call->queue, method, channel->target, + deadline->wrapped); } /** - * Add metadata to the call. All array keys must be strings. If the value is a - * string, it is added as a key/value pair. If it is an array, each value is - * added paired with the same string - * @param array $metadata The metadata to add - * @param long $flags A bitwise combination of the Grpc\WRITE_* constants - * (optional) - * @return Void + * Start a batch of RPC actions. + * @param array batch Array of actions to take + * @return object Object with results of all actions */ -PHP_METHOD(Call, add_metadata) { +PHP_METHOD(Call, start_batch) { wrapped_grpc_call *call = (wrapped_grpc_call *)zend_object_store_get_object(getThis() TSRMLS_CC); - grpc_metadata metadata; - grpc_call_error error_code; + grpc_op ops[8]; + size_t op_num = 0; zval *array; - zval **inner_array; zval **value; + zval **inner_value; HashTable *array_hash; HashPosition array_pointer; - HashTable *inner_array_hash; - HashPosition inner_array_pointer; + HashTable *status_hash; char *key; uint key_len; ulong index; - long flags = 0; - /* "a|l" == 1 array, 1 optional long */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|l", &array, &flags) == + grpc_metadata_array metadata; + grpc_metadata_array trailing_metadata; + grpc_metadata_array recv_metadata; + grpc_metadata_array recv_trailing_metadata; + grpc_status_code status; + char *status_details = NULL; + size_t status_details_capacity; + grpc_byte_buffer *message; + int cancelled; + grpc_call_error error; + grpc_event *event; + zval *result; + char *message_str; + size_t message_len; + zval *recv_status; + grpc_metadata_array_init(&metadata); + grpc_metadata_array_init(&trailing_metadata); + MAKE_STD_ZVAL(result); + object_init(result); + /* "a" == 1 array */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &array) == FAILURE) { zend_throw_exception(spl_ce_InvalidArgumentException, - "add_metadata expects an array and an optional long", - 1 TSRMLS_CC); - return; + "start_batch expects an array", 1 TSRMLS_CC); + goto cleanup; } array_hash = Z_ARRVAL_P(array); for (zend_hash_internal_pointer_reset_ex(array_hash, &array_pointer); - zend_hash_get_current_data_ex(array_hash, (void**)&inner_array, + zend_hash_get_current_data_ex(array_hash, (void**)&value, &array_pointer) == SUCCESS; zend_hash_move_forward_ex(array_hash, &array_pointer)) { if (zend_hash_get_current_key_ex(array_hash, &key, &key_len, &index, 0, - &array_pointer) != HASH_KEY_IS_STRING) { + &array_pointer) != HASH_KEY_IS_LONG) { zend_throw_exception(spl_ce_InvalidArgumentException, - "metadata keys must be strings", 1 TSRMLS_CC); - return; + "batch keys must be integers", 1 TSRMLS_CC); + goto cleanup; } - if (Z_TYPE_P(*inner_array) != IS_ARRAY) { - zend_throw_exception(spl_ce_InvalidArgumentException, - "metadata values must be arrays", - 1 TSRMLS_CC); - return; - } - inner_array_hash = Z_ARRVAL_P(*inner_array); - for (zend_hash_internal_pointer_reset_ex(inner_array_hash, - &inner_array_pointer); - zend_hash_get_current_data_ex(inner_array_hash, (void**)&value, - &inner_array_pointer) == SUCCESS; - zend_hash_move_forward_ex(inner_array_hash, &inner_array_pointer)) { - if (Z_TYPE_P(*value) != IS_STRING) { + switch(index) { + case GRPC_OP_SEND_INITIAL_METADATA: + if (!create_metadata_array(*value, &metadata)) { + zend_throw_exception(spl_ce_InvalidArgumentException, + "Bad metadata value given", 1 TSRMLS_CC); + goto cleanup; + } + ops[op_num].data.send_initial_metadata.count = + metadata.count; + ops[op_num].data.send_initial_metadata.metadata = + metadata.metadata; + break; + case GRPC_OP_SEND_MESSAGE: + if (Z_TYPE_PP(value) != IS_STRING) { + zend_throw_exception(spl_ce_InvalidArgumentException, + "Expected a string for send message", + 1 TSRMLS_CC); + } + ops[op_num].data.send_message = + string_to_byte_buffer(Z_STRVAL_PP(value), Z_STRLEN_PP(value)); + break; + case GRPC_OP_SEND_CLOSE_FROM_CLIENT: + break; + case GRPC_OP_SEND_STATUS_FROM_SERVER: + status_hash = Z_ARRVAL_PP(value); + if (zend_hash_find(status_hash, "metadata", sizeof("metadata"), + (void **)&inner_value) == SUCCESS) { + if (!create_metadata_array(*inner_value, &trailing_metadata)) { + zend_throw_exception(spl_ce_InvalidArgumentException, + "Bad trailing metadata value given", + 1 TSRMLS_CC); + goto cleanup; + } + ops[op_num].data.send_status_from_server.trailing_metadata = + trailing_metadata.metadata; + ops[op_num].data.send_status_from_server.trailing_metadata_count = + trailing_metadata.count; + } + if (zend_hash_find(status_hash, "code", sizeof("code"), + (void**)&inner_value) == SUCCESS) { + if (Z_TYPE_PP(inner_value) != IS_LONG) { + zend_throw_exception(spl_ce_InvalidArgumentException, + "Status code must be an integer", + 1 TSRMLS_CC); + goto cleanup; + } + ops[op_num].data.send_status_from_server.status = + Z_LVAL_PP(inner_value); + } else { + zend_throw_exception(spl_ce_InvalidArgumentException, + "Integer status code is required", + 1 TSRMLS_CC); + goto cleanup; + } + if (zend_hash_find(status_hash, "details", sizeof("details"), + (void**)&inner_value) == SUCCESS) { + if (Z_TYPE_PP(inner_value) != IS_STRING) { + zend_throw_exception(spl_ce_InvalidArgumentException, + "Status details must be a string", + 1 TSRMLS_CC); + goto cleanup; + } + ops[op_num].data.send_status_from_server.status_details = + Z_STRVAL_PP(inner_value); + } else { + zend_throw_exception(spl_ce_InvalidArgumentException, + "String status details is required", + 1 TSRMLS_CC); + goto cleanup; + } + break; + case GRPC_OP_RECV_INITIAL_METADATA: + ops[op_num].data.recv_initial_metadata = &recv_metadata; + break; + case GRPC_OP_RECV_MESSAGE: + ops[op_num].data.recv_message = &message; + break; + case GRPC_OP_RECV_STATUS_ON_CLIENT: + ops[op_num].data.recv_status_on_client.trailing_metadata = + &recv_trailing_metadata; + ops[op_num].data.recv_status_on_client.status = &status; + ops[op_num].data.recv_status_on_client.status_details = + &status_details; + ops[op_num].data.recv_status_on_client.status_details_capacity = + &status_details_capacity; + break; + case GRPC_OP_RECV_CLOSE_ON_SERVER: + ops[op_num].data.recv_close_on_server.cancelled = &cancelled; + break; + default: zend_throw_exception(spl_ce_InvalidArgumentException, - "metadata values must be arrays of strings", - 1 TSRMLS_CC); - return; - } - metadata.key = key; - metadata.value = Z_STRVAL_P(*value); - metadata.value_length = Z_STRLEN_P(*value); - error_code = grpc_call_add_metadata_old(call->wrapped, &metadata, 0u); - MAYBE_THROW_CALL_ERROR(add_metadata, error_code); + "Unrecognized key in batch", 1 TSRMLS_CC); + goto cleanup; } + ops[op_num].op = (grpc_op_type)index; + op_num++; } -} - -/** - * Invoke the RPC. Starts sending metadata and request headers over the wire - * @param CompletionQueue $queue The completion queue to use with this call - * @param long $metadata_tag The tag to associate with returned metadata - * @param long $finished_tag The tag to associate with the finished event - * @param long $flags A bitwise combination of the Grpc\WRITE_* constants - * (optional) - * @return Void - */ -PHP_METHOD(Call, invoke) { - grpc_call_error error_code; - long tag1; - long tag2; - zval *queue_obj; - long flags = 0; - /* "Oll|l" == 1 Object, 3 mandatory longs, 1 optional long */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Oll|l", &queue_obj, - grpc_ce_completion_queue, &tag1, &tag2, - &flags) == FAILURE) { - zend_throw_exception( - spl_ce_InvalidArgumentException, - "invoke needs a CompletionQueue, 2 longs, and an optional long", - 1 TSRMLS_CC); - return; - } - add_property_zval(getThis(), "completion_queue", queue_obj); - wrapped_grpc_call *call = - (wrapped_grpc_call *)zend_object_store_get_object(getThis() TSRMLS_CC); - wrapped_grpc_completion_queue *queue = - (wrapped_grpc_completion_queue *)zend_object_store_get_object( - queue_obj TSRMLS_CC); - error_code = grpc_call_invoke_old(call->wrapped, queue->wrapped, (void *)tag1, - (void *)tag2, (gpr_uint32)flags); - MAYBE_THROW_CALL_ERROR(invoke, error_code); -} - -/** - * Accept an incoming RPC, binding a completion queue to it. To be called after - * adding metadata to the call, but before sending messages. Can only be called - * on the server - * @param CompletionQueue $queue The completion queue to use with this call - * @param long $finished_tag The tag to associate with the finished event - * @param long $flags A bitwise combination of the Grpc\WRITE_* constants - * (optional) - * @return Void - */ -PHP_METHOD(Call, server_accept) { - long tag; - zval *queue_obj; - grpc_call_error error_code; - /* "Ol|l" == 1 Object, 1 long */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ol", &queue_obj, - grpc_ce_completion_queue, &tag) == FAILURE) { - zend_throw_exception( - spl_ce_InvalidArgumentException, - "server_accept expects a CompletionQueue, a long, and an optional long", - 1 TSRMLS_CC); - return; + error = grpc_call_start_batch(call->wrapped, ops, op_num, NULL); + if (error != GRPC_CALL_OK) { + zend_throw_exception(spl_ce_LogicException, + "start_batch was called incorrectly", + (long)error TSRMLS_CC); + goto cleanup; } - add_property_zval(getThis(), "completion_queue", queue_obj); - wrapped_grpc_call *call = - (wrapped_grpc_call *)zend_object_store_get_object(getThis() TSRMLS_CC); - wrapped_grpc_completion_queue *queue = - (wrapped_grpc_completion_queue *)zend_object_store_get_object( - queue_obj TSRMLS_CC); - error_code = - grpc_call_server_accept_old(call->wrapped, queue->wrapped, (void *)tag); - MAYBE_THROW_CALL_ERROR(server_accept, error_code); -} - -PHP_METHOD(Call, server_end_initial_metadata) { - grpc_call_error error_code; - long flags = 0; - /* "|l" == 1 optional long */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flags) == - FAILURE) { - zend_throw_exception(spl_ce_InvalidArgumentException, - "server_end_initial_metadata expects an optional long", + event = grpc_completion_queue_pluck(call->queue, NULL, gpr_inf_future); + if (event->data.op_complete != GRPC_OP_OK) { + zend_throw_exception(spl_ce_LogicException, + "The batch failed for some reason", 1 TSRMLS_CC); + goto cleanup; } - wrapped_grpc_call *call = - (wrapped_grpc_call *)zend_object_store_get_object(getThis() TSRMLS_CC); - error_code = grpc_call_server_end_initial_metadata_old(call->wrapped, flags); - MAYBE_THROW_CALL_ERROR(server_end_initial_metadata, error_code); -} - -/** - * Called by clients to cancel an RPC on the server. - * @return Void - */ -PHP_METHOD(Call, cancel) { - wrapped_grpc_call *call = - (wrapped_grpc_call *)zend_object_store_get_object(getThis() TSRMLS_CC); - grpc_call_error error_code = grpc_call_cancel(call->wrapped); - MAYBE_THROW_CALL_ERROR(cancel, error_code); -} - -/** - * Queue a byte buffer for writing - * @param string $buffer The buffer to queue for writing - * @param long $tag The tag to associate with this write - * @param long $flags A bitwise combination of the Grpc\WRITE_* constants - * (optional) - * @return Void - */ -PHP_METHOD(Call, start_write) { - grpc_call_error error_code; - wrapped_grpc_call *call = - (wrapped_grpc_call *)zend_object_store_get_object(getThis() TSRMLS_CC); - char *buffer; - int buffer_len; - long tag; - long flags = 0; - /* "Ol|l" == 1 Object, 1 mandatory long, 1 optional long */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|l", &buffer, - &buffer_len, &tag, &flags) == FAILURE) { - zend_throw_exception(spl_ce_InvalidArgumentException, - "start_write expects a string and an optional long", - 1 TSRMLS_CC); - return; + for (int i = 0; i < op_num; i++) { + switch(ops[i].op) { + case GRPC_OP_SEND_INITIAL_METADATA: + add_property_bool(result, "send_metadata", true); + break; + case GRPC_OP_SEND_MESSAGE: + add_property_bool(result, "send_message", true); + break; + case GRPC_OP_SEND_CLOSE_FROM_CLIENT: + add_property_bool(result, "send_close", true); + break; + case GRPC_OP_SEND_STATUS_FROM_SERVER: + add_property_bool(result, "send_status", true); + break; + case GRPC_OP_RECV_INITIAL_METADATA: + add_property_zval(result, "metadata", + grpc_parse_metadata_array(&recv_metadata)); + break; + case GRPC_OP_RECV_MESSAGE: + byte_buffer_to_string(message, &message_str, &message_len); + add_property_stringl(result, "message", message_str, message_len, + false); + break; + case GRPC_OP_RECV_STATUS_ON_CLIENT: + MAKE_STD_ZVAL(recv_status); + object_init(recv_status); + add_property_zval(recv_status, "metadata", + grpc_parse_metadata_array(&recv_trailing_metadata)); + add_property_long(recv_status, "code", status); + add_property_string(recv_status, "details", status_details, false); + add_property_zval(result, "status", recv_status); + break; + case GRPC_OP_RECV_CLOSE_ON_SERVER: + add_property_bool(result, "cancelled", cancelled); + break; + default: + break; + } } - error_code = grpc_call_start_write_old( - call->wrapped, string_to_byte_buffer(buffer, buffer_len), (void *)tag, - (gpr_uint32)flags); - MAYBE_THROW_CALL_ERROR(start_write, error_code); -} - -/** - * Queue a status for writing - * @param long $status_code The status code to send - * @param string $status_details The status details to send - * @param long $tag The tag to associate with this status - * @return Void - */ -PHP_METHOD(Call, start_write_status) { - grpc_call_error error_code; - wrapped_grpc_call *call = - (wrapped_grpc_call *)zend_object_store_get_object(getThis() TSRMLS_CC); - long status_code; - int status_details_length; - long tag; - char *status_details; - /* "lsl" == 1 long, 1 string, 1 long */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lsl", &status_code, - &status_details, &status_details_length, - &tag) == FAILURE) { - zend_throw_exception( - spl_ce_InvalidArgumentException, - "start_write_status expects a long, a string, and a long", 1 TSRMLS_CC); - return; +cleanup: + if (metadata.metadata != NULL) { + gpr_free(metadata.metadata); } - error_code = grpc_call_start_write_status_old(call->wrapped, - (grpc_status_code)status_code, - status_details, (void *)tag); - MAYBE_THROW_CALL_ERROR(start_write_status, error_code); -} - -/** - * Indicate that there are no more messages to send - * @return Void - */ -PHP_METHOD(Call, writes_done) { - grpc_call_error error_code; - wrapped_grpc_call *call = - (wrapped_grpc_call *)zend_object_store_get_object(getThis() TSRMLS_CC); - long tag; - /* "l" == 1 long */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &tag) == FAILURE) { - zend_throw_exception(spl_ce_InvalidArgumentException, - "writes_done expects a long", 1 TSRMLS_CC); - return; + grpc_metadata_array_destroy(&metadata); + if (trailing_metadata.metadata != NULL) { + gpr_free(trailing_metadata.metadata); } - error_code = grpc_call_writes_done_old(call->wrapped, (void *)tag); - MAYBE_THROW_CALL_ERROR(writes_done, error_code); -} - -/** - * Initiate a read on a call. Output event contains a byte buffer with the - * result of the read - * @param long $tag The tag to associate with this read - * @return Void - */ -PHP_METHOD(Call, start_read) { - grpc_call_error error_code; - wrapped_grpc_call *call = - (wrapped_grpc_call *)zend_object_store_get_object(getThis() TSRMLS_CC); - long tag; - /* "l" == 1 long */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &tag) == FAILURE) { - zend_throw_exception(spl_ce_InvalidArgumentException, - "start_read expects a long", 1 TSRMLS_CC); - return; + grpc_metadata_array_destroy(&trailing_metadata); + grpc_metadata_array_destroy(&recv_metadata); + grpc_metadata_array_destroy(&recv_trailing_metadata); + if (status_details != NULL) { + gpr_free(status_details); } - error_code = grpc_call_start_read_old(call->wrapped, (void *)tag); - MAYBE_THROW_CALL_ERROR(start_read, error_code); + RETURN_DESTROY_ZVAL(result); } static zend_function_entry call_methods[] = { PHP_ME(Call, __construct, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR) - PHP_ME(Call, server_accept, NULL, ZEND_ACC_PUBLIC) - PHP_ME(Call, server_end_initial_metadata, NULL, ZEND_ACC_PUBLIC) - PHP_ME(Call, add_metadata, NULL, ZEND_ACC_PUBLIC) - PHP_ME(Call, cancel, NULL, ZEND_ACC_PUBLIC) - PHP_ME(Call, invoke, NULL, ZEND_ACC_PUBLIC) - PHP_ME(Call, start_read, NULL, ZEND_ACC_PUBLIC) - PHP_ME(Call, start_write, NULL, ZEND_ACC_PUBLIC) - PHP_ME(Call, start_write_status, NULL, ZEND_ACC_PUBLIC) - PHP_ME(Call, writes_done, NULL, ZEND_ACC_PUBLIC) PHP_FE_END}; + PHP_ME(Call, start_batch, NULL, ZEND_ACC_PUBLIC) PHP_FE_END}; void grpc_init_call(TSRMLS_D) { zend_class_entry ce; diff --git a/src/php/ext/grpc/call.h b/src/php/ext/grpc/call.h index 827e9a27a8..5ec9a9f8ea 100644 --- a/src/php/ext/grpc/call.h +++ b/src/php/ext/grpc/call.h @@ -45,17 +45,6 @@ #include "grpc/grpc.h" -// Throw an exception if error_code is not OK -#define MAYBE_THROW_CALL_ERROR(func_name, error_code) \ - do { \ - if (error_code != GRPC_CALL_OK) { \ - zend_throw_exception(spl_ce_LogicException, \ - #func_name " was called incorrectly", \ - (long)error_code TSRMLS_CC); \ - return; \ - } \ - } while (0) - /* Class entry for the Call PHP class */ zend_class_entry *grpc_ce_call; @@ -65,6 +54,7 @@ typedef struct wrapped_grpc_call { bool owned; grpc_call *wrapped; + grpc_completion_queue *queue; } wrapped_grpc_call; /* Initializes the Call PHP class */ @@ -75,6 +65,6 @@ zval *grpc_php_wrap_call(grpc_call *wrapped, bool owned); /* Creates and returns a PHP associative array of metadata from a C array of * call metadata */ -zval *grpc_call_create_metadata_array(int count, grpc_metadata *elements); +zval *grpc_parse_metadata_array(grpc_metadata_array *metadata_array); #endif /* NET_GRPC_PHP_GRPC_CHANNEL_H_ */ diff --git a/src/php/ext/grpc/channel.c b/src/php/ext/grpc/channel.c index d6296f9413..e631abacec 100644 --- a/src/php/ext/grpc/channel.c +++ b/src/php/ext/grpc/channel.c @@ -51,7 +51,6 @@ #include "grpc/support/log.h" #include "grpc/grpc_security.h" -#include "completion_queue.h" #include "server.h" #include "credentials.h" diff --git a/src/php/ext/grpc/completion_queue.c b/src/php/ext/grpc/completion_queue.c deleted file mode 100644 index 30c871b078..0000000000 --- a/src/php/ext/grpc/completion_queue.c +++ /dev/null @@ -1,168 +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 "completion_queue.h" - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "php.h" -#include "php_ini.h" -#include "ext/standard/info.h" -#include "ext/spl/spl_exceptions.h" -#include "php_grpc.h" - -#include "zend_exceptions.h" - -#include - -#include "grpc/grpc.h" - -#include "event.h" -#include "timeval.h" - -/* Frees and destroys a wrapped instance of grpc_completion_queue */ -void free_wrapped_grpc_completion_queue(void *object TSRMLS_DC) { - wrapped_grpc_completion_queue *queue = NULL; - grpc_event *event; - queue = (wrapped_grpc_completion_queue *)object; - if (queue->wrapped != NULL) { - grpc_completion_queue_shutdown(queue->wrapped); - event = grpc_completion_queue_next(queue->wrapped, gpr_inf_future); - while (event != NULL) { - if (event->type == GRPC_QUEUE_SHUTDOWN) { - break; - } - event = grpc_completion_queue_next(queue->wrapped, gpr_inf_future); - } - grpc_completion_queue_destroy(queue->wrapped); - } - efree(queue); -} - -/* Initializes an instance of wrapped_grpc_channel to be associated with an - * object of a class specified by class_type */ -zend_object_value create_wrapped_grpc_completion_queue( - zend_class_entry *class_type TSRMLS_DC) { - zend_object_value retval; - wrapped_grpc_completion_queue *intern; - - intern = (wrapped_grpc_completion_queue *)emalloc( - sizeof(wrapped_grpc_completion_queue)); - memset(intern, 0, sizeof(wrapped_grpc_completion_queue)); - - zend_object_std_init(&intern->std, class_type TSRMLS_CC); - object_properties_init(&intern->std, class_type); - retval.handle = zend_objects_store_put( - intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, - free_wrapped_grpc_completion_queue, NULL TSRMLS_CC); - retval.handlers = zend_get_std_object_handlers(); - return retval; -} - -/** - * Construct an instance of CompletionQueue - */ -PHP_METHOD(CompletionQueue, __construct) { - wrapped_grpc_completion_queue *queue = - (wrapped_grpc_completion_queue *)zend_object_store_get_object(getThis() - TSRMLS_CC); - queue->wrapped = grpc_completion_queue_create(); -} - -/** - * Blocks until an event is available, the completion queue is being shutdown, - * or timeout is reached. Returns NULL on timeout, otherwise the event that - * occurred. Callers should call event.finish once they have processed the - * event. - * @param Timeval $timeout The timeout for the event - * @return Event The event that occurred - */ -PHP_METHOD(CompletionQueue, next) { - zval *timeout; - /* "O" == 1 Object */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &timeout, - grpc_ce_timeval) == FAILURE) { - zend_throw_exception(spl_ce_InvalidArgumentException, - "next needs a Timeval", 1 TSRMLS_CC); - return; - } - wrapped_grpc_completion_queue *completion_queue = - (wrapped_grpc_completion_queue *)zend_object_store_get_object(getThis() - TSRMLS_CC); - wrapped_grpc_timeval *wrapped_timeout = - (wrapped_grpc_timeval *)zend_object_store_get_object(timeout TSRMLS_CC); - grpc_event *event = grpc_completion_queue_next(completion_queue->wrapped, - wrapped_timeout->wrapped); - if (event == NULL) { - RETURN_NULL(); - } - zval *wrapped_event = grpc_php_convert_event(event); - RETURN_DESTROY_ZVAL(wrapped_event); -} - -PHP_METHOD(CompletionQueue, pluck) { - long tag; - zval *timeout; - /* "lO" == 1 long, 1 Object */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lO", &tag, &timeout, - grpc_ce_timeval) == FAILURE) { - zend_throw_exception(spl_ce_InvalidArgumentException, - "pluck needs a long and a Timeval", 1 TSRMLS_CC); - } - wrapped_grpc_completion_queue *completion_queue = - (wrapped_grpc_completion_queue *)zend_object_store_get_object(getThis() - TSRMLS_CC); - wrapped_grpc_timeval *wrapped_timeout = - (wrapped_grpc_timeval *)zend_object_store_get_object(timeout TSRMLS_CC); - grpc_event *event = grpc_completion_queue_pluck( - completion_queue->wrapped, (void *)tag, wrapped_timeout->wrapped); - if (event == NULL) { - RETURN_NULL(); - } - zval *wrapped_event = grpc_php_convert_event(event); - RETURN_DESTROY_ZVAL(wrapped_event); -} - -static zend_function_entry completion_queue_methods[] = { - PHP_ME(CompletionQueue, __construct, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR) - PHP_ME(CompletionQueue, next, NULL, ZEND_ACC_PUBLIC) - PHP_ME(CompletionQueue, pluck, NULL, ZEND_ACC_PUBLIC) PHP_FE_END}; - -void grpc_init_completion_queue(TSRMLS_D) { - zend_class_entry ce; - INIT_CLASS_ENTRY(ce, "Grpc\\CompletionQueue", completion_queue_methods); - ce.create_object = create_wrapped_grpc_completion_queue; - grpc_ce_completion_queue = zend_register_internal_class(&ce TSRMLS_CC); -} diff --git a/src/php/ext/grpc/completion_queue.h b/src/php/ext/grpc/completion_queue.h deleted file mode 100755 index 6ce1df7c8c..0000000000 --- a/src/php/ext/grpc/completion_queue.h +++ /dev/null @@ -1,62 +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. - * - */ - -#ifndef NET_GRPC_PHP_GRPC_COMPLETION_QUEUE_H_ -#define NET_GRPC_PHP_GRPC_COMPLETION_QUEUE_H_ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "php.h" -#include "php_ini.h" -#include "ext/standard/info.h" -#include "php_grpc.h" - -#include "grpc/grpc.h" - -/* Class entry for the PHP CompletionQueue class */ -zend_class_entry *grpc_ce_completion_queue; - -/* Wrapper class for grpc_completion_queue that can be associated with a - PHP object */ -typedef struct wrapped_grpc_completion_queue { - zend_object std; - - grpc_completion_queue *wrapped; -} wrapped_grpc_completion_queue; - -/* Initialize the CompletionQueue class */ -void grpc_init_completion_queue(TSRMLS_D); - -#endif /* NET_GRPC_PHP_GRPC_COMPLETION_QUEUE_H_ */ diff --git a/src/php/ext/grpc/config.m4 b/src/php/ext/grpc/config.m4 index 27c67781e7..d1a8decb73 100755 --- a/src/php/ext/grpc/config.m4 +++ b/src/php/ext/grpc/config.m4 @@ -66,5 +66,5 @@ if test "$PHP_GRPC" != "no"; then PHP_SUBST(GRPC_SHARED_LIBADD) - PHP_NEW_EXTENSION(grpc, byte_buffer.c call.c channel.c completion_queue.c credentials.c event.c timeval.c server.c server_credentials.c php_grpc.c, $ext_shared, , -Wall -Werror -pedantic -std=c99) + PHP_NEW_EXTENSION(grpc, byte_buffer.c call.c channel.c credentials.c timeval.c server.c server_credentials.c php_grpc.c, $ext_shared, , -Wall -Werror -pedantic -std=c99) fi diff --git a/src/php/ext/grpc/event.c b/src/php/ext/grpc/event.c deleted file mode 100644 index 452c4b8bcb..0000000000 --- a/src/php/ext/grpc/event.c +++ /dev/null @@ -1,150 +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 "event.h" - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "php.h" -#include "php_ini.h" -#include "ext/standard/info.h" -#include "php_grpc.h" - -#include - -#include "grpc/grpc.h" - -#include "byte_buffer.h" -#include "call.h" -#include "timeval.h" - -/* Create a new PHP object containing the event data in the event struct. - event must not be used after this function is called */ -zval *grpc_php_convert_event(grpc_event *event) { - zval *data_object; - char *detail_string; - size_t detail_len; - char *method_string; - size_t method_len; - char *host_string; - size_t host_len; - char *read_string; - size_t read_len; - - zval *event_object; - - if (event == NULL) { - return NULL; - } - - MAKE_STD_ZVAL(event_object); - object_init(event_object); - - add_property_zval( - event_object, "call", - grpc_php_wrap_call(event->call, event->type == GRPC_SERVER_RPC_NEW)); - add_property_long(event_object, "type", event->type); - add_property_long(event_object, "tag", (long)event->tag); - - switch (event->type) { - case GRPC_QUEUE_SHUTDOWN: - add_property_null(event_object, "data"); - break; - case GRPC_READ: - if (event->data.read == NULL) { - add_property_null(event_object, "data"); - } else { - byte_buffer_to_string(event->data.read, &read_string, &read_len); - add_property_stringl(event_object, "data", read_string, read_len, true); - } - break; - case GRPC_WRITE_ACCEPTED: - add_property_long(event_object, "data", (long)event->data.write_accepted); - break; - case GRPC_FINISH_ACCEPTED: - add_property_long(event_object, "data", - (long)event->data.finish_accepted); - break; - case GRPC_CLIENT_METADATA_READ: - data_object = grpc_call_create_metadata_array( - event->data.client_metadata_read.count, - event->data.client_metadata_read.elements); - add_property_zval(event_object, "data", data_object); - break; - case GRPC_FINISHED: - MAKE_STD_ZVAL(data_object); - object_init(data_object); - add_property_long(data_object, "code", event->data.finished.status); - if (event->data.finished.details == NULL) { - add_property_null(data_object, "details"); - } else { - detail_len = strlen(event->data.finished.details); - detail_string = ecalloc(detail_len + 1, sizeof(char)); - memcpy(detail_string, event->data.finished.details, detail_len); - add_property_string(data_object, "details", detail_string, true); - } - add_property_zval(data_object, "metadata", - grpc_call_create_metadata_array( - event->data.finished.metadata_count, - event->data.finished.metadata_elements)); - add_property_zval(event_object, "data", data_object); - break; - case GRPC_SERVER_RPC_NEW: - MAKE_STD_ZVAL(data_object); - object_init(data_object); - method_len = strlen(event->data.server_rpc_new.method); - method_string = ecalloc(method_len + 1, sizeof(char)); - memcpy(method_string, event->data.server_rpc_new.method, method_len); - add_property_string(data_object, "method", method_string, false); - host_len = strlen(event->data.server_rpc_new.host); - host_string = ecalloc(host_len + 1, sizeof(char)); - memcpy(host_string, event->data.server_rpc_new.host, host_len); - add_property_string(data_object, "host", host_string, false); - add_property_zval( - data_object, "absolute_timeout", - grpc_php_wrap_timeval(event->data.server_rpc_new.deadline)); - add_property_zval(data_object, "metadata", - grpc_call_create_metadata_array( - event->data.server_rpc_new.metadata_count, - event->data.server_rpc_new.metadata_elements)); - add_property_zval(event_object, "data", data_object); - break; - default: - add_property_null(event_object, "data"); - break; - } - grpc_event_finish(event); - return event_object; -} diff --git a/src/php/ext/grpc/event.h b/src/php/ext/grpc/event.h deleted file mode 100755 index ef5846aee1..0000000000 --- a/src/php/ext/grpc/event.h +++ /dev/null @@ -1,51 +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. - * - */ - -#ifndef NET_GRPC_PHP_GRPC_EVENT_H_ -#define NET_GRPC_PHP_GRPC_EVENT_H_ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "php.h" -#include "php_ini.h" -#include "ext/standard/info.h" -#include "php_grpc.h" - -#include "grpc/grpc.h" - -/* Create a new Event object that wraps an existing grpc_event struct */ -zval *grpc_php_convert_event(grpc_event *event); - -#endif /* NET_GRPC_PHP_GRPC_COMPLETION_CHANNEL_H */ diff --git a/src/php/ext/grpc/php_grpc.c b/src/php/ext/grpc/php_grpc.c index 67e366c385..1f9edfe881 100644 --- a/src/php/ext/grpc/php_grpc.c +++ b/src/php/ext/grpc/php_grpc.c @@ -34,8 +34,6 @@ #include "call.h" #include "channel.h" #include "server.h" -#include "completion_queue.h" -#include "event.h" #include "timeval.h" #include "credentials.h" #include "server_credentials.h" @@ -127,27 +125,12 @@ PHP_MINIT_FUNCTION(grpc) { REGISTER_LONG_CONSTANT("Grpc\\CALL_ERROR_INVALID_FLAGS", GRPC_CALL_ERROR_INVALID_FLAGS, CONST_CS); - /* Register op error constants */ - REGISTER_LONG_CONSTANT("Grpc\\OP_OK", GRPC_OP_OK, CONST_CS); - REGISTER_LONG_CONSTANT("Grpc\\OP_ERROR", GRPC_OP_ERROR, CONST_CS); - /* Register flag constants */ REGISTER_LONG_CONSTANT("Grpc\\WRITE_BUFFER_HINT", GRPC_WRITE_BUFFER_HINT, CONST_CS); REGISTER_LONG_CONSTANT("Grpc\\WRITE_NO_COMPRESS", GRPC_WRITE_NO_COMPRESS, CONST_CS); - /* Register completion type constants */ - REGISTER_LONG_CONSTANT("Grpc\\QUEUE_SHUTDOWN", GRPC_QUEUE_SHUTDOWN, CONST_CS); - REGISTER_LONG_CONSTANT("Grpc\\READ", GRPC_READ, CONST_CS); - REGISTER_LONG_CONSTANT("Grpc\\FINISH_ACCEPTED", GRPC_FINISH_ACCEPTED, - CONST_CS); - REGISTER_LONG_CONSTANT("Grpc\\WRITE_ACCEPTED", GRPC_WRITE_ACCEPTED, CONST_CS); - REGISTER_LONG_CONSTANT("Grpc\\CLIENT_METADATA_READ", - GRPC_CLIENT_METADATA_READ, CONST_CS); - REGISTER_LONG_CONSTANT("Grpc\\FINISHED", GRPC_FINISHED, CONST_CS); - REGISTER_LONG_CONSTANT("Grpc\\SERVER_RPC_NEW", GRPC_SERVER_RPC_NEW, CONST_CS); - /* Register status constants */ REGISTER_LONG_CONSTANT("Grpc\\STATUS_OK", GRPC_STATUS_OK, CONST_CS); REGISTER_LONG_CONSTANT("Grpc\\STATUS_CANCELLED", GRPC_STATUS_CANCELLED, @@ -181,10 +164,27 @@ PHP_MINIT_FUNCTION(grpc) { REGISTER_LONG_CONSTANT("Grpc\\STATUS_DATA_LOSS", GRPC_STATUS_DATA_LOSS, CONST_CS); + /* Register op type constants */ + REGISTER_LONG_CONSTANT("Grpc\\OP_SEND_INITIAL_METADATA", + GRPC_OP_SEND_INITIAL_METADATA, CONST_CS); + REGISTER_LONG_CONSTANT("Grpc\\OP_SEND_MESSAGE", + GRPC_OP_SEND_MESSAGE, CONST_CS); + REGISTER_LONG_CONSTANT("Grpc\\OP_SEND_CLOSE_FROM_CLIENT", + GRPC_OP_SEND_CLOSE_FROM_CLIENT, CONST_CS); + REGISTER_LONG_CONSTANT("Grpc\\OP_SEND_STATUS_FROM_SERVER", + GRPC_OP_SEND_STATUS_FROM_SERVER, CONST_CS); + REGISTER_LONG_CONSTANT("Grpc\\OP_RECV_INITIAL_METADATA", + GRPC_OP_RECV_INITIAL_METADATA, CONST_CS); + REGISTER_LONG_CONSTANT("Grpc\\OP_RECV_MESSAGE", + GRPC_OP_RECV_MESSAGE, CONST_CS); + REGISTER_LONG_CONSTANT("Grpc\\OP_RECV_STATUS_ON_CLIENT", + GRPC_OP_RECV_STATUS_ON_CLIENT, CONST_CS); + REGISTER_LONG_CONSTANT("Grpc\\OP_RECV_CLOSE_ON_SERVER", + GRPC_OP_RECV_CLOSE_ON_SERVER, CONST_CS); + grpc_init_call(TSRMLS_C); grpc_init_channel(TSRMLS_C); grpc_init_server(TSRMLS_C); - grpc_init_completion_queue(TSRMLS_C); grpc_init_timeval(TSRMLS_C); grpc_init_credentials(TSRMLS_C); grpc_init_server_credentials(TSRMLS_C); diff --git a/src/php/ext/grpc/server.c b/src/php/ext/grpc/server.c index 32cc19775c..36c0ad384c 100644 --- a/src/php/ext/grpc/server.c +++ b/src/php/ext/grpc/server.c @@ -52,13 +52,25 @@ #include "grpc/grpc_security.h" #include "server.h" -#include "completion_queue.h" #include "channel.h" #include "server_credentials.h" +#include "timeval.h" /* Frees and destroys an instance of wrapped_grpc_server */ void free_wrapped_grpc_server(void *object TSRMLS_DC) { wrapped_grpc_server *server = (wrapped_grpc_server *)object; + grpc_event *event; + if (server->queue != NULL) { + grpc_completion_queue_shutdown(server->queue); + event = grpc_completion_queue_next(server->queue, gpr_inf_future); + while (event != NULL) { + if (event->type == GRPC_QUEUE_SHUTDOWN) { + break; + } + event = grpc_completion_queue_next(server->queue, gpr_inf_future); + } + grpc_completion_queue_destroy(server->queue); + } if (server->wrapped != NULL) { grpc_server_shutdown(server->wrapped); grpc_server_destroy(server->wrapped); @@ -93,26 +105,22 @@ zend_object_value create_wrapped_grpc_server(zend_class_entry *class_type PHP_METHOD(Server, __construct) { wrapped_grpc_server *server = (wrapped_grpc_server *)zend_object_store_get_object(getThis() TSRMLS_CC); - zval *queue_obj; zval *args_array = NULL; grpc_channel_args args; HashTable *array_hash; zval **creds_obj = NULL; wrapped_grpc_server_credentials *creds = NULL; - /* "O|a" == 1 Object, 1 optional array */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|a", &queue_obj, - grpc_ce_completion_queue, &args_array) == FAILURE) { + /* "a" == 1 optional array */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &args_array) == + FAILURE) { zend_throw_exception(spl_ce_InvalidArgumentException, - "Server expects a CompletionQueue and an array", + "Server expects an array", 1 TSRMLS_CC); return; } - add_property_zval(getThis(), "completion_queue", queue_obj); - wrapped_grpc_completion_queue *queue = - (wrapped_grpc_completion_queue *)zend_object_store_get_object( - queue_obj TSRMLS_CC); + server->queue = grpc_completion_queue_create(); if (args_array == NULL) { - server->wrapped = grpc_server_create(queue->wrapped, NULL); + server->wrapped = grpc_server_create(server->queue, NULL); } else { array_hash = Z_ARRVAL_P(args_array); if (zend_hash_find(array_hash, "credentials", sizeof("credentials"), @@ -130,11 +138,11 @@ PHP_METHOD(Server, __construct) { } php_grpc_read_args_array(args_array, &args); if (creds == NULL) { - server->wrapped = grpc_server_create(queue->wrapped, &args); + server->wrapped = grpc_server_create(server->queue, &args); } else { gpr_log(GPR_DEBUG, "Initialized secure server"); server->wrapped = - grpc_secure_server_create(creds->wrapped, queue->wrapped, &args); + grpc_secure_server_create(creds->wrapped, server->queue, &args); } efree(args.args); } @@ -150,16 +158,39 @@ PHP_METHOD(Server, request_call) { grpc_call_error error_code; wrapped_grpc_server *server = (wrapped_grpc_server *)zend_object_store_get_object(getThis() TSRMLS_CC); - long tag_new; - /* "l" == 1 long */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &tag_new) == - FAILURE) { - zend_throw_exception(spl_ce_InvalidArgumentException, - "request_call expects a long", 1 TSRMLS_CC); - return; + grpc_call *call; + grpc_call_details details; + grpc_metadata_array metadata; + zval *result; + grpc_event *event; + MAKE_STD_ZVAL(result); + object_init(result); + grpc_call_details_init(&details); + grpc_metadata_array_init(&metadata); + error_code = grpc_server_request_call(server->wrapped, &call, &details, + &metadata, server->queue, NULL); + if (error_code != GRPC_CALL_OK) { + zend_throw_exception(spl_ce_LogicException, "request_call failed", + (long)error_code TSRMLS_CC); + goto cleanup; + } + event = grpc_completion_queue_pluck(server->queue, NULL, gpr_inf_future); + if (event->data.op_complete != GRPC_OP_OK) { + zend_throw_exception(spl_ce_LogicException, + "Failed to request a call for some reason", + 1 TSRMLS_CC); + goto cleanup; } - error_code = grpc_server_request_call_old(server->wrapped, (void *)tag_new); - MAYBE_THROW_CALL_ERROR(request_call, error_code); + add_property_zval(result, "call", grpc_php_wrap_call(call, true)); + add_property_string(result, "method", details.method, false); + add_property_string(result, "host", details.host, false); + add_property_zval(result, "absolute_deadline", + grpc_php_wrap_timeval(details.deadline)); + add_property_zval(result, "metadata", grpc_parse_metadata_array(&metadata)); +cleanup: + grpc_call_details_destroy(&details); + grpc_metadata_array_destroy(&metadata); + RETURN_DESTROY_ZVAL(result); } /** diff --git a/src/php/ext/grpc/server.h b/src/php/ext/grpc/server.h index ecef4c6429..a796a374d0 100755 --- a/src/php/ext/grpc/server.h +++ b/src/php/ext/grpc/server.h @@ -53,6 +53,7 @@ typedef struct wrapped_grpc_server { zend_object std; grpc_server *wrapped; + grpc_completion_queue *queue; } wrapped_grpc_server; /* Initializes the Server class */ -- cgit v1.2.3 From d47946be2aba5b4197d168d38982ac71b2494e60 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Mon, 9 Mar 2015 14:27:07 -0700 Subject: Added batch GRPC_TRACE option to trace calls to grpc_call_start_batch --- Makefile | 5 + build.json | 1 + src/core/surface/call.c | 2 + src/core/surface/call.h | 9 ++ src/core/surface/call_log_batch.c | 121 ++++++++++++++++++++++++ src/core/surface/init.c | 3 +- vsprojects/vs2013/grpc.vcxproj | 2 + vsprojects/vs2013/grpc.vcxproj.filters | 3 + vsprojects/vs2013/grpc_shared.vcxproj | 2 + vsprojects/vs2013/grpc_shared.vcxproj.filters | 3 + vsprojects/vs2013/grpc_unsecure.vcxproj | 2 + vsprojects/vs2013/grpc_unsecure.vcxproj.filters | 3 + 12 files changed, 155 insertions(+), 1 deletion(-) create mode 100644 src/core/surface/call_log_batch.c diff --git a/Makefile b/Makefile index 8c6fc3220d..242ce7915a 100644 --- a/Makefile +++ b/Makefile @@ -2436,6 +2436,7 @@ LIBGRPC_SRC = \ src/core/surface/byte_buffer_reader.c \ src/core/surface/call.c \ src/core/surface/call_details.c \ + src/core/surface/call_log_batch.c \ src/core/surface/channel.c \ src/core/surface/channel_create.c \ src/core/surface/client.c \ @@ -2581,6 +2582,7 @@ src/core/surface/byte_buffer_queue.c: $(OPENSSL_DEP) src/core/surface/byte_buffer_reader.c: $(OPENSSL_DEP) src/core/surface/call.c: $(OPENSSL_DEP) src/core/surface/call_details.c: $(OPENSSL_DEP) +src/core/surface/call_log_batch.c: $(OPENSSL_DEP) src/core/surface/channel.c: $(OPENSSL_DEP) src/core/surface/channel_create.c: $(OPENSSL_DEP) src/core/surface/client.c: $(OPENSSL_DEP) @@ -2743,6 +2745,7 @@ $(OBJDIR)/$(CONFIG)/src/core/surface/byte_buffer_queue.o: $(OBJDIR)/$(CONFIG)/src/core/surface/byte_buffer_reader.o: $(OBJDIR)/$(CONFIG)/src/core/surface/call.o: $(OBJDIR)/$(CONFIG)/src/core/surface/call_details.o: +$(OBJDIR)/$(CONFIG)/src/core/surface/call_log_batch.o: $(OBJDIR)/$(CONFIG)/src/core/surface/channel.o: $(OBJDIR)/$(CONFIG)/src/core/surface/channel_create.o: $(OBJDIR)/$(CONFIG)/src/core/surface/client.o: @@ -2918,6 +2921,7 @@ LIBGRPC_UNSECURE_SRC = \ src/core/surface/byte_buffer_reader.c \ src/core/surface/call.c \ src/core/surface/call_details.c \ + src/core/surface/call_log_batch.c \ src/core/surface/channel.c \ src/core/surface/channel_create.c \ src/core/surface/client.c \ @@ -3056,6 +3060,7 @@ $(OBJDIR)/$(CONFIG)/src/core/surface/byte_buffer_queue.o: $(OBJDIR)/$(CONFIG)/src/core/surface/byte_buffer_reader.o: $(OBJDIR)/$(CONFIG)/src/core/surface/call.o: $(OBJDIR)/$(CONFIG)/src/core/surface/call_details.o: +$(OBJDIR)/$(CONFIG)/src/core/surface/call_log_batch.o: $(OBJDIR)/$(CONFIG)/src/core/surface/channel.o: $(OBJDIR)/$(CONFIG)/src/core/surface/channel_create.o: $(OBJDIR)/$(CONFIG)/src/core/surface/client.o: diff --git a/build.json b/build.json index c9500ebe1b..665080107a 100644 --- a/build.json +++ b/build.json @@ -224,6 +224,7 @@ "src/core/surface/byte_buffer_reader.c", "src/core/surface/call.c", "src/core/surface/call_details.c", + "src/core/surface/call_log_batch.c", "src/core/surface/channel.c", "src/core/surface/channel_create.c", "src/core/surface/client.c", diff --git a/src/core/surface/call.c b/src/core/surface/call.c index cfce943794..dba63058b8 100644 --- a/src/core/surface/call.c +++ b/src/core/surface/call.c @@ -1006,6 +1006,8 @@ grpc_call_error grpc_call_start_batch(grpc_call *call, const grpc_op *ops, const grpc_op *op; grpc_ioreq *req; + GRPC_CALL_LOG_BATCH(GPR_INFO, call, ops, nops, tag); + if (nops == 0) { grpc_cq_begin_op(call->cq, call, GRPC_OP_COMPLETE); grpc_cq_end_op_complete(call->cq, tag, call, do_nothing, NULL, GRPC_OP_OK); diff --git a/src/core/surface/call.h b/src/core/surface/call.h index cb81cb52c2..06434f87ac 100644 --- a/src/core/surface/call.h +++ b/src/core/surface/call.h @@ -119,4 +119,13 @@ grpc_call_stack *grpc_call_get_call_stack(grpc_call *call); /* Given the top call_element, get the call object. */ grpc_call *grpc_call_from_top_element(grpc_call_element *surface_element); +extern int grpc_trace_batch; + +void grpc_call_log_batch(char *file, int line, gpr_log_severity severity, + grpc_call *call, const grpc_op *ops, size_t nops, + void *tag); + +#define GRPC_CALL_LOG_BATCH(sev, call, ops, nops, tag) \ + if (grpc_trace_batch) grpc_call_log_batch(sev, call, ops, nops, tag) + #endif /* GRPC_INTERNAL_CORE_SURFACE_CALL_H */ diff --git a/src/core/surface/call_log_batch.c b/src/core/surface/call_log_batch.c new file mode 100644 index 0000000000..482957d839 --- /dev/null +++ b/src/core/surface/call_log_batch.c @@ -0,0 +1,121 @@ +/* + * + * 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 "src/core/surface/call.h" + +#include "src/core/support/string.h" +#include + +int grpc_trace_batch = 0; + +static void add_metadata(gpr_strvec *b, const grpc_metadata *md, size_t count) { + size_t i; + for(i = 0; i < count; i++) { + gpr_strvec_add(b, gpr_strdup("\nkey=")); + gpr_strvec_add(b, gpr_strdup(md[i].key)); + + gpr_strvec_add(b, gpr_strdup(" value=")); + gpr_strvec_add(b, gpr_hexdump(md[i].value, md[i].value_length, + GPR_HEXDUMP_PLAINTEXT)); + } +} + +char *grpc_op_string(const grpc_op *op) { + char *tmp; + char *out; + + gpr_strvec b; + gpr_strvec_init(&b); + + switch (op->op) { + case GRPC_OP_SEND_INITIAL_METADATA: + gpr_strvec_add(&b, gpr_strdup("SEND_INITIAL_METADATA")); + add_metadata(&b, op->data.send_initial_metadata.metadata, + op->data.send_initial_metadata.count); + break; + case GRPC_OP_SEND_MESSAGE: + gpr_asprintf(&tmp, "SEND_MESSAGE ptr=%p", op->data.send_message); + gpr_strvec_add(&b, tmp); + break; + case GRPC_OP_SEND_CLOSE_FROM_CLIENT: + gpr_strvec_add(&b, gpr_strdup("SEND_CLOSE_FROM_CLIENT")); + break; + case GRPC_OP_SEND_STATUS_FROM_SERVER: + gpr_asprintf(&tmp, "SEND_STATUS_FROM_SERVER status=%d details=%s", + op->data.send_status_from_server.status, + op->data.send_status_from_server.status_details); + gpr_strvec_add(&b, tmp); + add_metadata(&b, op->data.send_status_from_server.trailing_metadata, + op->data.send_status_from_server.trailing_metadata_count); + break; + case GRPC_OP_RECV_INITIAL_METADATA: + gpr_asprintf(&tmp, "RECV_INITIAL_METADATA ptr=%p", + op->data.recv_initial_metadata); + gpr_strvec_add(&b, tmp); + break; + case GRPC_OP_RECV_MESSAGE: + gpr_asprintf(&tmp, "RECV_MESSAGE ptr=%p", op->data.recv_message); + gpr_strvec_add(&b, tmp); + break; + case GRPC_OP_RECV_STATUS_ON_CLIENT: + gpr_asprintf(&tmp, + "RECV_STATUS_ON_CLIENT metadata=%p status=%p details=%p", + op->data.recv_status_on_client.trailing_metadata, + op->data.recv_status_on_client.status, + op->data.recv_status_on_client.status_details); + gpr_strvec_add(&b, tmp); + break; + case GRPC_OP_RECV_CLOSE_ON_SERVER: + gpr_asprintf(&tmp, "RECV_CLOSE_ON_SERVER cancelled=%p", + op->data.recv_close_on_server.cancelled); + gpr_strvec_add(&b, tmp); + } + out = gpr_strvec_flatten(&b, NULL); + gpr_strvec_destroy(&b); + + return out; +} + +void grpc_call_log_batch(char *file, int line, gpr_log_severity severity, + grpc_call *call, const grpc_op *ops, size_t nops, + void *tag) { + char *tmp; + size_t i; + gpr_log(file, line, severity, + "grpc_call_start_batch(%p, %p, %d, 0x%x)", call, ops, nops); + for(i = 0; i < nops; i++) { + tmp = grpc_op_string(&ops[i]); + gpr_log(file, line, severity, "ops[%d]: %s", i, tmp); + gpr_free(tmp); + } +} diff --git a/src/core/surface/init.c b/src/core/surface/init.c index e48c4202e5..d4f0eb40e8 100644 --- a/src/core/surface/init.c +++ b/src/core/surface/init.c @@ -36,6 +36,7 @@ #include "src/core/debug/trace.h" #include "src/core/statistics/census_interface.h" #include "src/core/channel/channel_stack.h" +#include "src/core/surface/call.h" #include "src/core/surface/init.h" #include "src/core/surface/surface_trace.h" #include "src/core/transport/chttp2_transport.h" @@ -57,6 +58,7 @@ void grpc_init(void) { grpc_register_tracer("channel", &grpc_trace_channel); grpc_register_tracer("surface", &grpc_surface_trace); grpc_register_tracer("http", &grpc_http_trace); + grpc_register_tracer("batch", &grpc_trace_batch); grpc_security_pre_init(); grpc_tracer_init("GRPC_TRACE"); grpc_iomgr_init(); @@ -82,4 +84,3 @@ int grpc_is_initialized(void) { gpr_mu_unlock(&g_init_mu); return r; } - diff --git a/vsprojects/vs2013/grpc.vcxproj b/vsprojects/vs2013/grpc.vcxproj index 9d0bcb3271..d5079d6161 100644 --- a/vsprojects/vs2013/grpc.vcxproj +++ b/vsprojects/vs2013/grpc.vcxproj @@ -355,6 +355,8 @@ + + diff --git a/vsprojects/vs2013/grpc.vcxproj.filters b/vsprojects/vs2013/grpc.vcxproj.filters index af38d8de35..bb91b71038 100644 --- a/vsprojects/vs2013/grpc.vcxproj.filters +++ b/vsprojects/vs2013/grpc.vcxproj.filters @@ -253,6 +253,9 @@ src\core\surface + + src\core\surface + src\core\surface diff --git a/vsprojects/vs2013/grpc_shared.vcxproj b/vsprojects/vs2013/grpc_shared.vcxproj index f5575dc3f1..f81539ed55 100644 --- a/vsprojects/vs2013/grpc_shared.vcxproj +++ b/vsprojects/vs2013/grpc_shared.vcxproj @@ -359,6 +359,8 @@ + + diff --git a/vsprojects/vs2013/grpc_shared.vcxproj.filters b/vsprojects/vs2013/grpc_shared.vcxproj.filters index af38d8de35..bb91b71038 100644 --- a/vsprojects/vs2013/grpc_shared.vcxproj.filters +++ b/vsprojects/vs2013/grpc_shared.vcxproj.filters @@ -253,6 +253,9 @@ src\core\surface + + src\core\surface + src\core\surface diff --git a/vsprojects/vs2013/grpc_unsecure.vcxproj b/vsprojects/vs2013/grpc_unsecure.vcxproj index ad7bf4762f..ddf6982747 100644 --- a/vsprojects/vs2013/grpc_unsecure.vcxproj +++ b/vsprojects/vs2013/grpc_unsecure.vcxproj @@ -300,6 +300,8 @@ + + diff --git a/vsprojects/vs2013/grpc_unsecure.vcxproj.filters b/vsprojects/vs2013/grpc_unsecure.vcxproj.filters index 205942a450..38c7109ae3 100644 --- a/vsprojects/vs2013/grpc_unsecure.vcxproj.filters +++ b/vsprojects/vs2013/grpc_unsecure.vcxproj.filters @@ -193,6 +193,9 @@ src\core\surface + + src\core\surface + src\core\surface -- cgit v1.2.3 From dc9faa343080fe47bc60b3078cad9b42121b182d Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Mon, 9 Mar 2015 14:41:41 -0700 Subject: Added missing log argument --- src/core/surface/call_log_batch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/surface/call_log_batch.c b/src/core/surface/call_log_batch.c index 482957d839..a33583a12d 100644 --- a/src/core/surface/call_log_batch.c +++ b/src/core/surface/call_log_batch.c @@ -112,7 +112,7 @@ void grpc_call_log_batch(char *file, int line, gpr_log_severity severity, char *tmp; size_t i; gpr_log(file, line, severity, - "grpc_call_start_batch(%p, %p, %d, 0x%x)", call, ops, nops); + "grpc_call_start_batch(%p, %p, %d, 0x%x)", call, ops, nops, tag); for(i = 0; i < nops; i++) { tmp = grpc_op_string(&ops[i]); gpr_log(file, line, severity, "ops[%d]: %s", i, tmp); -- cgit v1.2.3 From d8bb9578efa3ff6d287ec7bf735dc97b636b9f04 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 11 Mar 2015 09:18:06 -0700 Subject: Fixed some tests for new API --- src/php/ext/grpc/call.c | 8 +-- src/php/tests/unit_tests/CallTest.php | 62 +++++++++--------------- src/php/tests/unit_tests/CompletionQueueTest.php | 46 ------------------ src/php/tests/unit_tests/EndToEndTest.php | 31 ++++++++++-- 4 files changed, 52 insertions(+), 95 deletions(-) delete mode 100755 src/php/tests/unit_tests/CompletionQueueTest.php diff --git a/src/php/ext/grpc/call.c b/src/php/ext/grpc/call.c index b1ac1b7640..8f5ec24776 100644 --- a/src/php/ext/grpc/call.c +++ b/src/php/ext/grpc/call.c @@ -287,6 +287,8 @@ PHP_METHOD(Call, start_batch) { zval *recv_status; grpc_metadata_array_init(&metadata); grpc_metadata_array_init(&trailing_metadata); + grpc_metadata_array_init(&recv_metadata); + grpc_metadata_array_init(&recv_trailing_metadata); MAKE_STD_ZVAL(result); object_init(result); /* "a" == 1 array */ @@ -458,13 +460,7 @@ PHP_METHOD(Call, start_batch) { } } cleanup: - if (metadata.metadata != NULL) { - gpr_free(metadata.metadata); - } grpc_metadata_array_destroy(&metadata); - if (trailing_metadata.metadata != NULL) { - gpr_free(trailing_metadata.metadata); - } grpc_metadata_array_destroy(&trailing_metadata); grpc_metadata_array_destroy(&recv_metadata); grpc_metadata_array_destroy(&recv_trailing_metadata); diff --git a/src/php/tests/unit_tests/CallTest.php b/src/php/tests/unit_tests/CallTest.php index 8bb0927f21..d361ce0030 100755 --- a/src/php/tests/unit_tests/CallTest.php +++ b/src/php/tests/unit_tests/CallTest.php @@ -36,65 +36,47 @@ class CallTest extends PHPUnit_Framework_TestCase{ static $port; public static function setUpBeforeClass() { - $cq = new Grpc\CompletionQueue(); - self::$server = new Grpc\Server($cq, []); + self::$server = new Grpc\Server([]); self::$port = self::$server->add_http2_port('0.0.0.0:0'); } public function setUp() { - $this->cq = new Grpc\CompletionQueue(); $this->channel = new Grpc\Channel('localhost:' . self::$port, []); $this->call = new Grpc\Call($this->channel, '/foo', Grpc\Timeval::inf_future()); } - /** - * @expectedException LogicException - * @expectedExceptionCode Grpc\CALL_ERROR_INVALID_FLAGS - * @expectedExceptionMessage invoke - */ - public function testInvokeRejectsBadFlags() { - $this->call->invoke($this->cq, 0, 0, 0xDEADBEEF); - } - - /** - * @expectedException LogicException - * @expectedExceptionCode Grpc\CALL_ERROR_NOT_ON_CLIENT - * @expectedExceptionMessage server_accept - */ - public function testServerAcceptFailsCorrectly() { - $this->call->server_accept($this->cq, 0); - } - - /* These test methods with assertTrue(true) at the end just check that the - method calls completed without errors. PHPUnit warns for tests with no - asserts, and this avoids that warning without changing the meaning of the - tests */ - public function testAddEmptyMetadata() { - $this->call->add_metadata([], 0); - /* Dummy assert: Checks that the previous call completed without error */ - $this->assertTrue(true); + $batch = [ + Grpc\OP_SEND_INITIAL_METADATA => [] + ]; + $result = $this->call->start_batch($batch); + $this->assertTrue($result->send_metadata); } public function testAddSingleMetadata() { - $this->call->add_metadata(['key' => ['value']], 0); - /* Dummy assert: Checks that the previous call completed without error */ - $this->assertTrue(true); + $batch = [ + Grpc\OP_SEND_INITIAL_METADATA => ['key' => ['value']] + ]; + $result = $this->call->start_batch($batch); + $this->assertTrue($result->send_metadata); } public function testAddMultiValueMetadata() { - $this->call->add_metadata(['key' => ['value1', 'value2']], 0); - /* Dummy assert: Checks that the previous call completed without error */ - $this->assertTrue(true); + $batch = [ + Grpc\OP_SEND_INITIAL_METADATA => ['key' => ['value1', 'value2']] + ]; + $result = $this->call->start_batch($batch); + $this->assertTrue($result->send_metadata); } public function testAddSingleAndMultiValueMetadata() { - $this->call->add_metadata( - ['key1' => ['value1'], - 'key2' => ['value2', 'value3']], 0); - /* Dummy assert: Checks that the previous call completed without error */ - $this->assertTrue(true); + $batch = [ + Grpc\OP_SEND_INITIAL_METADATA => ['key1' => ['value1'], + 'key2' => ['value2', 'value3']] + ]; + $result = $this->call->start_batch($batch); + $this->assertTrue($result->send_metadata); } } diff --git a/src/php/tests/unit_tests/CompletionQueueTest.php b/src/php/tests/unit_tests/CompletionQueueTest.php deleted file mode 100755 index 76ee61dfe8..0000000000 --- a/src/php/tests/unit_tests/CompletionQueueTest.php +++ /dev/null @@ -1,46 +0,0 @@ -next(Grpc\Timeval::zero()); - $this->assertNull($event); - } - - public function testPluckReturnsNullWithNoCall() { - $cq = new Grpc\CompletionQueue(); - $event = $cq->pluck(0, Grpc\Timeval::zero()); - $this->assertNull($event); - } -} diff --git a/src/php/tests/unit_tests/EndToEndTest.php b/src/php/tests/unit_tests/EndToEndTest.php index 0cbc506c8e..076d449362 100755 --- a/src/php/tests/unit_tests/EndToEndTest.php +++ b/src/php/tests/unit_tests/EndToEndTest.php @@ -33,11 +33,10 @@ */ class EndToEndTest extends PHPUnit_Framework_TestCase{ public function setUp() { - $this->client_queue = new Grpc\CompletionQueue(); - $this->server_queue = new Grpc\CompletionQueue(); $this->server = new Grpc\Server($this->server_queue, []); $port = $this->server->add_http2_port('0.0.0.0:0'); $this->channel = new Grpc\Channel('localhost:' . $port, []); + $this->server->start(); } public function tearDown() { @@ -53,6 +52,33 @@ class EndToEndTest extends PHPUnit_Framework_TestCase{ $call = new Grpc\Call($this->channel, 'dummy_method', $deadline); + + $event = $this->call->start_batch([ + Grpc\OP_SEND_INITIAL_METADATA => [], + Grpc\OP_SEND_CLOSE_FROM_CLIENT => true + ]); + + $this->assertTrue($event->send_metadata); + $this->assertTrue($event->send_close); + + $event = $this->server->request_call(); + $this->assertSame('dummy_method', $event->method); + $server_call = $event->call; + + $event = $server_call->start_batch([ + Grpc\OP_SEND_INITIAL_METADATA => [], + Grpc\OP_SEND_STATUS_FROM_SERVER => [ + 'metadata' => [], + 'code' => Grpc\STATUS_OK, + 'details' => $status_text + ], + Grpc\OP_RECV_CLOSE_ON_SERVER => true + ]); + + $this->assertTrue($event->send_metadata); + $this->assertTrue($event->send_status); + $this->assertFalse($event->cancelled); + $tag = 1; $call->invoke($this->client_queue, $tag, $tag); $server_tag = 2; @@ -64,7 +90,6 @@ class EndToEndTest extends PHPUnit_Framework_TestCase{ $this->assertSame(Grpc\OP_OK, $event->data); // check that a server rpc new was received - $this->server->start(); $this->server->request_call($server_tag); $event = $this->server_queue->next($deadline); $this->assertNotNull($event); -- cgit v1.2.3 From 4eb8bba7fc88a325fa1d1aab0ff4f190891ca79f Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 11 Mar 2015 12:56:50 -0700 Subject: Further updated EndToEndTest --- src/php/ext/grpc/server.c | 4 +- src/php/tests/unit_tests/EndToEndTest.php | 160 +++++++++--------------------- 2 files changed, 50 insertions(+), 114 deletions(-) diff --git a/src/php/ext/grpc/server.c b/src/php/ext/grpc/server.c index 36c0ad384c..6a3f27ae9b 100644 --- a/src/php/ext/grpc/server.c +++ b/src/php/ext/grpc/server.c @@ -182,8 +182,8 @@ PHP_METHOD(Server, request_call) { goto cleanup; } add_property_zval(result, "call", grpc_php_wrap_call(call, true)); - add_property_string(result, "method", details.method, false); - add_property_string(result, "host", details.host, false); + add_property_string(result, "method", details.method, true); + add_property_string(result, "host", details.host, true); add_property_zval(result, "absolute_deadline", grpc_php_wrap_timeval(details.deadline)); add_property_zval(result, "metadata", grpc_parse_metadata_array(&metadata)); diff --git a/src/php/tests/unit_tests/EndToEndTest.php b/src/php/tests/unit_tests/EndToEndTest.php index 076d449362..af7c09ccaf 100755 --- a/src/php/tests/unit_tests/EndToEndTest.php +++ b/src/php/tests/unit_tests/EndToEndTest.php @@ -33,7 +33,7 @@ */ class EndToEndTest extends PHPUnit_Framework_TestCase{ public function setUp() { - $this->server = new Grpc\Server($this->server_queue, []); + $this->server = new Grpc\Server([]); $port = $this->server->add_http2_port('0.0.0.0:0'); $this->channel = new Grpc\Channel('localhost:' . $port, []); $this->server->start(); @@ -53,7 +53,7 @@ class EndToEndTest extends PHPUnit_Framework_TestCase{ 'dummy_method', $deadline); - $event = $this->call->start_batch([ + $event = $call->start_batch([ Grpc\OP_SEND_INITIAL_METADATA => [], Grpc\OP_SEND_CLOSE_FROM_CLIENT => true ]); @@ -79,54 +79,17 @@ class EndToEndTest extends PHPUnit_Framework_TestCase{ $this->assertTrue($event->send_status); $this->assertFalse($event->cancelled); - $tag = 1; - $call->invoke($this->client_queue, $tag, $tag); - $server_tag = 2; - - $call->writes_done($tag); - $event = $this->client_queue->next($deadline); - $this->assertNotNull($event); - $this->assertSame(Grpc\FINISH_ACCEPTED, $event->type); - $this->assertSame(Grpc\OP_OK, $event->data); - - // check that a server rpc new was received - $this->server->request_call($server_tag); - $event = $this->server_queue->next($deadline); - $this->assertNotNull($event); - $this->assertSame(Grpc\SERVER_RPC_NEW, $event->type); - $server_call = $event->call; - $this->assertNotNull($server_call); - $server_call->server_accept($this->server_queue, $server_tag); - - $server_call->server_end_initial_metadata(); - - - // the server sends the status - $server_call->start_write_status(Grpc\STATUS_OK, $status_text, $server_tag); - $event = $this->server_queue->next($deadline); - $this->assertNotNull($event); - $this->assertSame(Grpc\FINISH_ACCEPTED, $event->type); - $this->assertSame(Grpc\OP_OK, $event->data); - - // the client gets CLIENT_METADATA_READ - $event = $this->client_queue->next($deadline); - $this->assertNotNull($event); - $this->assertSame(Grpc\CLIENT_METADATA_READ, $event->type); + $event = $call->start_batch([ + Grpc\OP_RECV_INITIAL_METADATA => true, + Grpc\OP_RECV_STATUS_ON_CLIENT => true, + ]); - // the client gets FINISHED - $event = $this->client_queue->next($deadline); - $this->assertNotNull($event); - $this->assertSame(Grpc\FINISHED, $event->type); - $status = $event->data; + $this->assertSame([], $event->metadata); + $status = $event->status; + $this->assertSame([], $status->metadata); $this->assertSame(Grpc\STATUS_OK, $status->code); $this->assertSame($status_text, $status->details); - // and the server gets FINISHED - $event = $this->server_queue->next($deadline); - $this->assertNotNull($event); - $this->assertSame(Grpc\FINISHED, $event->type); - $status = $event->data; - unset($call); unset($server_call); } @@ -140,79 +103,52 @@ class EndToEndTest extends PHPUnit_Framework_TestCase{ $call = new Grpc\Call($this->channel, 'dummy_method', $deadline); - $tag = 1; - $call->invoke($this->client_queue, $tag, $tag); - $server_tag = 2; + $event = $call->start_batch([ + Grpc\OP_SEND_INITIAL_METADATA => [], + Grpc\OP_SEND_CLOSE_FROM_CLIENT => true, + Grpc\OP_SEND_MESSAGE => $req_text + ]); - // the client writes - $call->start_write($req_text, $tag); - $event = $this->client_queue->next($deadline); - $this->assertNotNull($event); - $this->assertSame(Grpc\WRITE_ACCEPTED, $event->type); + $this->assertTrue($event->send_metadata); + $this->assertTrue($event->send_close); + $this->assertTrue($event->send_message); - // check that a server rpc new was received - $this->server->start(); - $this->server->request_call($server_tag); - $event = $this->server_queue->next($deadline); - $this->assertNotNull($event); - $this->assertSame(Grpc\SERVER_RPC_NEW, $event->type); + $event = $this->server->request_call(); + $this->assertSame('dummy_method', $event->method); $server_call = $event->call; - $this->assertNotNull($server_call); - $server_call->server_accept($this->server_queue, $server_tag); - - $server_call->server_end_initial_metadata(); - - // start the server read - $server_call->start_read($server_tag); - $event = $this->server_queue->next($deadline); - $this->assertNotNull($event); - $this->assertSame(Grpc\READ, $event->type); - $this->assertSame($req_text, $event->data); - - // the server replies - $server_call->start_write($reply_text, $server_tag); - $event = $this->server_queue->next($deadline); - $this->assertNotNull($event); - $this->assertSame(Grpc\WRITE_ACCEPTED, $event->type); - - // the client reads the metadata - $event = $this->client_queue->next($deadline); - $this->assertNotNull($event); - $this->assertSame(Grpc\CLIENT_METADATA_READ, $event->type); - - // the client reads the reply - $call->start_read($tag); - $event = $this->client_queue->next($deadline); - $this->assertNotNull($event); - $this->assertSame(Grpc\READ, $event->type); - $this->assertSame($reply_text, $event->data); - - // the client sends writes done - $call->writes_done($tag); - $event = $this->client_queue->next($deadline); - $this->assertSame(Grpc\FINISH_ACCEPTED, $event->type); - $this->assertSame(Grpc\OP_OK, $event->data); - - // the server sends the status - $server_call->start_write_status(GRPC\STATUS_OK, $status_text, $server_tag); - $event = $this->server_queue->next($deadline); - $this->assertSame(Grpc\FINISH_ACCEPTED, $event->type); - $this->assertSame(Grpc\OP_OK, $event->data); - - // the client gets FINISHED - $event = $this->client_queue->next($deadline); - $this->assertNotNull($event); - $this->assertSame(Grpc\FINISHED, $event->type); - $status = $event->data; + + $event = $server_call->start_batch([ + Grpc\OP_SEND_INITIAL_METADATA => [], + Grpc\OP_SEND_MESSAGE => $reply_text, + Grpc\OP_SEND_STATUS_FROM_SERVER => [ + 'metadata' => [], + 'code' => Grpc\STATUS_OK, + 'details' => $status_text + ], + Grpc\OP_RECV_MESSAGE => true, + Grpc\OP_RECV_CLOSE_ON_SERVER => true, + ]); + + $this->assertTrue($event->send_metadata); + $this->assertTrue($event->send_status); + $this->assertTrue($event->send_message); + $this->assertFalse($event->cancelled); + $this->assertSame($req_text, $event->read); + + $event = $call->start_batch([ + Grpc\OP_RECV_INITIAL_METADATA => true, + Grpc\OP_RECV_MESSAGE => true, + Grpc\OP_RECV_STATUS_ON_CLIENT => true, + ]); + + $this->assertSame([], $event->metadata); + $this->assertSame($reply_text, $event->read); + $status = $event->status; + $this->assertSame([], $status->metadata); $this->assertSame(Grpc\STATUS_OK, $status->code); $this->assertSame($status_text, $status->details); - // and the server gets FINISHED - $event = $this->server_queue->next($deadline); - $this->assertNotNull($event); - $this->assertSame(Grpc\FINISHED, $event->type); - unset($call); unset($server_call); } -- cgit v1.2.3 From 9fe516a679c1de9852c1240b263cf5f91e765241 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 11 Mar 2015 14:47:10 -0700 Subject: EndToEndTest now works --- src/php/ext/grpc/call.c | 34 ++++++++++++++++--------------- src/php/ext/grpc/call.h | 3 ++- src/php/ext/grpc/server.c | 3 ++- src/php/tests/unit_tests/EndToEndTest.php | 11 +++++----- 4 files changed, 27 insertions(+), 24 deletions(-) diff --git a/src/php/ext/grpc/call.c b/src/php/ext/grpc/call.c index 8f5ec24776..1d2e43957f 100644 --- a/src/php/ext/grpc/call.c +++ b/src/php/ext/grpc/call.c @@ -60,18 +60,18 @@ void free_wrapped_grpc_call(void *object TSRMLS_DC) { wrapped_grpc_call *call = (wrapped_grpc_call *)object; grpc_event *event; - if (call->queue != NULL) { - grpc_completion_queue_shutdown(call->queue); - event = grpc_completion_queue_next(call->queue, gpr_inf_future); - while (event != NULL) { - if (event->type == GRPC_QUEUE_SHUTDOWN) { - break; - } + if (call->owned && call->wrapped != NULL) { + if (call->queue != NULL) { + grpc_completion_queue_shutdown(call->queue); event = grpc_completion_queue_next(call->queue, gpr_inf_future); + while (event != NULL) { + if (event->type == GRPC_QUEUE_SHUTDOWN) { + break; + } + event = grpc_completion_queue_next(call->queue, gpr_inf_future); + } + grpc_completion_queue_destroy(call->queue); } - grpc_completion_queue_destroy(call->queue); - } - if (call->owned && call->wrapped != NULL) { grpc_call_destroy(call->wrapped); } efree(call); @@ -98,14 +98,15 @@ zend_object_value create_wrapped_grpc_call(zend_class_entry *class_type /* Wraps a grpc_call struct in a PHP object. Owned indicates whether the struct should be destroyed at the end of the object's lifecycle */ -zval *grpc_php_wrap_call(grpc_call *wrapped, bool owned) { +zval *grpc_php_wrap_call(grpc_call *wrapped, grpc_completion_queue *queue, + bool owned) { zval *call_object; MAKE_STD_ZVAL(call_object); object_init_ex(call_object, grpc_ce_call); wrapped_grpc_call *call = (wrapped_grpc_call *)zend_object_store_get_object(call_object TSRMLS_CC); call->wrapped = wrapped; - call->queue = grpc_completion_queue_create(); + call->queue = queue; return call_object; } @@ -276,7 +277,7 @@ PHP_METHOD(Call, start_batch) { grpc_metadata_array recv_trailing_metadata; grpc_status_code status; char *status_details = NULL; - size_t status_details_capacity; + size_t status_details_capacity = 0; grpc_byte_buffer *message; int cancelled; grpc_call_error error; @@ -406,14 +407,15 @@ PHP_METHOD(Call, start_batch) { ops[op_num].op = (grpc_op_type)index; op_num++; } - error = grpc_call_start_batch(call->wrapped, ops, op_num, NULL); + error = grpc_call_start_batch(call->wrapped, ops, op_num, call->wrapped); if (error != GRPC_CALL_OK) { zend_throw_exception(spl_ce_LogicException, "start_batch was called incorrectly", (long)error TSRMLS_CC); goto cleanup; } - event = grpc_completion_queue_pluck(call->queue, NULL, gpr_inf_future); + event = grpc_completion_queue_pluck(call->queue, call->wrapped, + gpr_inf_future); if (event->data.op_complete != GRPC_OP_OK) { zend_throw_exception(spl_ce_LogicException, "The batch failed for some reason", @@ -449,7 +451,7 @@ PHP_METHOD(Call, start_batch) { add_property_zval(recv_status, "metadata", grpc_parse_metadata_array(&recv_trailing_metadata)); add_property_long(recv_status, "code", status); - add_property_string(recv_status, "details", status_details, false); + add_property_string(recv_status, "details", status_details, true); add_property_zval(result, "status", recv_status); break; case GRPC_OP_RECV_CLOSE_ON_SERVER: diff --git a/src/php/ext/grpc/call.h b/src/php/ext/grpc/call.h index 5ec9a9f8ea..4a32a5c743 100644 --- a/src/php/ext/grpc/call.h +++ b/src/php/ext/grpc/call.h @@ -61,7 +61,8 @@ typedef struct wrapped_grpc_call { void grpc_init_call(TSRMLS_D); /* Creates a Call object that wraps the given grpc_call struct */ -zval *grpc_php_wrap_call(grpc_call *wrapped, bool owned); +zval *grpc_php_wrap_call(grpc_call *wrapped, grpc_completion_queue *queue, + bool owned); /* Creates and returns a PHP associative array of metadata from a C array of * call metadata */ diff --git a/src/php/ext/grpc/server.c b/src/php/ext/grpc/server.c index 6a3f27ae9b..d1362c8b51 100644 --- a/src/php/ext/grpc/server.c +++ b/src/php/ext/grpc/server.c @@ -181,7 +181,8 @@ PHP_METHOD(Server, request_call) { 1 TSRMLS_CC); goto cleanup; } - add_property_zval(result, "call", grpc_php_wrap_call(call, true)); + add_property_zval(result, "call", grpc_php_wrap_call(call, server->queue, + true)); add_property_string(result, "method", details.method, true); add_property_string(result, "host", details.host, true); add_property_zval(result, "absolute_deadline", diff --git a/src/php/tests/unit_tests/EndToEndTest.php b/src/php/tests/unit_tests/EndToEndTest.php index af7c09ccaf..3e165b7213 100755 --- a/src/php/tests/unit_tests/EndToEndTest.php +++ b/src/php/tests/unit_tests/EndToEndTest.php @@ -42,8 +42,6 @@ class EndToEndTest extends PHPUnit_Framework_TestCase{ public function tearDown() { unset($this->channel); unset($this->server); - unset($this->client_queue); - unset($this->server_queue); } public function testSimpleRequestBody() { @@ -63,6 +61,7 @@ class EndToEndTest extends PHPUnit_Framework_TestCase{ $event = $this->server->request_call(); $this->assertSame('dummy_method', $event->method); + $this->assertSame([], $event->metadata); $server_call = $event->call; $event = $server_call->start_batch([ @@ -81,8 +80,8 @@ class EndToEndTest extends PHPUnit_Framework_TestCase{ $event = $call->start_batch([ Grpc\OP_RECV_INITIAL_METADATA => true, - Grpc\OP_RECV_STATUS_ON_CLIENT => true, - ]); + Grpc\OP_RECV_STATUS_ON_CLIENT => true + ]); $this->assertSame([], $event->metadata); $status = $event->status; @@ -134,7 +133,7 @@ class EndToEndTest extends PHPUnit_Framework_TestCase{ $this->assertTrue($event->send_status); $this->assertTrue($event->send_message); $this->assertFalse($event->cancelled); - $this->assertSame($req_text, $event->read); + $this->assertSame($req_text, $event->message); $event = $call->start_batch([ Grpc\OP_RECV_INITIAL_METADATA => true, @@ -143,7 +142,7 @@ class EndToEndTest extends PHPUnit_Framework_TestCase{ ]); $this->assertSame([], $event->metadata); - $this->assertSame($reply_text, $event->read); + $this->assertSame($reply_text, $event->message); $status = $event->status; $this->assertSame([], $status->metadata); $this->assertSame(Grpc\STATUS_OK, $status->code); -- cgit v1.2.3 From f2fe1a8002b0a4fe26ac42955eccc77a2970f87e Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 11 Mar 2015 15:40:19 -0700 Subject: Fixed channel host override handling --- src/php/ext/grpc/channel.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/php/ext/grpc/channel.c b/src/php/ext/grpc/channel.c index e631abacec..47e1525d98 100644 --- a/src/php/ext/grpc/channel.c +++ b/src/php/ext/grpc/channel.c @@ -136,6 +136,9 @@ PHP_METHOD(Channel, __construct) { HashTable *array_hash; zval **creds_obj = NULL; wrapped_grpc_credentials *creds = NULL; + zval **override_obj; + char *override; + int override_len; /* "s|a" == 1 string, 1 optional array */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|a", &target, &target_length, &args_array) == FAILURE) { @@ -143,6 +146,8 @@ PHP_METHOD(Channel, __construct) { "Channel expects a string and an array", 1 TSRMLS_CC); return; } + override = target; + override_len = target_length; if (args_array == NULL) { channel->wrapped = grpc_channel_create(target, NULL); } else { @@ -159,6 +164,19 @@ PHP_METHOD(Channel, __construct) { *creds_obj TSRMLS_CC); zend_hash_del(array_hash, "credentials", 12); } + if (zend_hash_find(array_hash, GRPC_SSL_TARGET_NAME_OVERRIDE_ARG, + sizeof(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG), + (void **)&override_obj) == SUCCESS) { + if (Z_TYPE_PP(override_obj) != IS_STRING) { + zend_throw_exception(spl_ce_InvalidArgumentException, + GRPC_SSL_TARGET_NAME_OVERRIDE_ARG + " must be a string", + 1 TSRMLS_CC); + return; + } + override = Z_STRVAL_PP(override_obj); + override_len = Z_STRLEN_PP(override_obj); + } php_grpc_read_args_array(args_array, &args); if (creds == NULL) { channel->wrapped = grpc_channel_create(target, &args); @@ -169,8 +187,8 @@ PHP_METHOD(Channel, __construct) { } efree(args.args); } - channel->target = ecalloc(target_length + 1, sizeof(char)); - memcpy(channel->target, target, target_length); + channel->target = ecalloc(override_len + 1, sizeof(char)); + memcpy(channel->target, override, override_len); } /** -- cgit v1.2.3 From 1b027f55983b063403498970a5d3f8995bd0d8b5 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 11 Mar 2015 15:41:00 -0700 Subject: Updated final tests to pass --- src/php/ext/grpc/server.c | 6 +- src/php/tests/unit_tests/SecureEndToEndTest.php | 197 ++++++++++-------------- 2 files changed, 82 insertions(+), 121 deletions(-) diff --git a/src/php/ext/grpc/server.c b/src/php/ext/grpc/server.c index 055a7263b9..c4de58e27f 100644 --- a/src/php/ext/grpc/server.c +++ b/src/php/ext/grpc/server.c @@ -107,8 +107,8 @@ PHP_METHOD(Server, __construct) { (wrapped_grpc_server *)zend_object_store_get_object(getThis() TSRMLS_CC); zval *args_array = NULL; grpc_channel_args args; - /* "a" == 1 optional array */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &args_array) == + /* "|a" == 1 optional array */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|a", &args_array) == FAILURE) { zend_throw_exception(spl_ce_InvalidArgumentException, "Server expects an array", @@ -198,7 +198,7 @@ PHP_METHOD(Server, add_secure_http2_port) { int addr_len; zval *creds_obj; /* "sO" == 1 string, 1 object */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &addr, &addr_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sO", &addr, &addr_len, &creds_obj, grpc_ce_server_credentials) == FAILURE) { zend_throw_exception( diff --git a/src/php/tests/unit_tests/SecureEndToEndTest.php b/src/php/tests/unit_tests/SecureEndToEndTest.php index 896afeac49..2d62fe9d5e 100755 --- a/src/php/tests/unit_tests/SecureEndToEndTest.php +++ b/src/php/tests/unit_tests/SecureEndToEndTest.php @@ -33,17 +33,16 @@ */ class SecureEndToEndTest extends PHPUnit_Framework_TestCase{ public function setUp() { - $this->client_queue = new Grpc\CompletionQueue(); - $this->server_queue = new Grpc\CompletionQueue(); $credentials = Grpc\Credentials::createSsl( file_get_contents(dirname(__FILE__) . '/../data/ca.pem')); $server_credentials = Grpc\ServerCredentials::createSsl( null, file_get_contents(dirname(__FILE__) . '/../data/server1.key'), file_get_contents(dirname(__FILE__) . '/../data/server1.pem')); - $this->server = new Grpc\Server($this->server_queue); + $this->server = new Grpc\Server(); $port = $this->server->add_secure_http2_port('0.0.0.0:0', $server_credentials); + $this->server->start(); $this->channel = new Grpc\Channel( 'localhost:' . $port, [ @@ -55,70 +54,58 @@ class SecureEndToEndTest extends PHPUnit_Framework_TestCase{ public function tearDown() { unset($this->channel); unset($this->server); - unset($this->client_queue); - unset($this->server_queue); } public function testSimpleRequestBody() { - $this->server->start(); $deadline = Grpc\Timeval::inf_future(); $status_text = 'xyz'; $call = new Grpc\Call($this->channel, 'dummy_method', $deadline); - $tag = 1; - $call->invoke($this->client_queue, $tag, $tag); - $server_tag = 2; - - $call->writes_done($tag); - $event = $this->client_queue->next($deadline); - $this->assertNotNull($event); - $this->assertSame(Grpc\FINISH_ACCEPTED, $event->type); - $this->assertSame(Grpc\OP_OK, $event->data); - - // check that a server rpc new was received - $this->server->request_call($server_tag); - $event = $this->server_queue->next($deadline); - $this->assertNotNull($event); - $this->assertSame(Grpc\SERVER_RPC_NEW, $event->type); + + $event = $call->start_batch([ + Grpc\OP_SEND_INITIAL_METADATA => [], + Grpc\OP_SEND_CLOSE_FROM_CLIENT => true + ]); + + $this->assertTrue($event->send_metadata); + $this->assertTrue($event->send_close); + + $event = $this->server->request_call(); + $this->assertSame('dummy_method', $event->method); + $this->assertSame([], $event->metadata); $server_call = $event->call; - $this->assertNotNull($server_call); - $server_call->server_accept($this->server_queue, $server_tag); - - $server_call->server_end_initial_metadata(); - - // the server sends the status - $server_call->start_write_status(Grpc\STATUS_OK, $status_text, $server_tag); - $event = $this->server_queue->next($deadline); - $this->assertNotNull($event); - $this->assertSame(Grpc\FINISH_ACCEPTED, $event->type); - $this->assertSame(Grpc\OP_OK, $event->data); - - // the client gets CLIENT_METADATA_READ - $event = $this->client_queue->next($deadline); - $this->assertNotNull($event); - $this->assertSame(Grpc\CLIENT_METADATA_READ, $event->type); - - // the client gets FINISHED - $event = $this->client_queue->next($deadline); - $this->assertNotNull($event); - $this->assertSame(Grpc\FINISHED, $event->type); - $status = $event->data; + + $event = $server_call->start_batch([ + Grpc\OP_SEND_INITIAL_METADATA => [], + Grpc\OP_SEND_STATUS_FROM_SERVER => [ + 'metadata' => [], + 'code' => Grpc\STATUS_OK, + 'details' => $status_text + ], + Grpc\OP_RECV_CLOSE_ON_SERVER => true + ]); + + $this->assertTrue($event->send_metadata); + $this->assertTrue($event->send_status); + $this->assertFalse($event->cancelled); + + $event = $call->start_batch([ + Grpc\OP_RECV_INITIAL_METADATA => true, + Grpc\OP_RECV_STATUS_ON_CLIENT => true + ]); + + $this->assertSame([], $event->metadata); + $status = $event->status; + $this->assertSame([], $status->metadata); $this->assertSame(Grpc\STATUS_OK, $status->code); $this->assertSame($status_text, $status->details); - // and the server gets FINISHED - $event = $this->server_queue->next($deadline); - $this->assertNotNull($event); - $this->assertSame(Grpc\FINISHED, $event->type); - $status = $event->data; - unset($call); unset($server_call); } public function testClientServerFullRequestResponse() { - $this->server->start(); $deadline = Grpc\Timeval::inf_future(); $req_text = 'client_server_full_request_response'; $reply_text = 'reply:client_server_full_request_response'; @@ -127,78 +114,52 @@ class SecureEndToEndTest extends PHPUnit_Framework_TestCase{ $call = new Grpc\Call($this->channel, 'dummy_method', $deadline); - $tag = 1; - $call->invoke($this->client_queue, $tag, $tag); - - $server_tag = 2; - - // the client writes - $call->start_write($req_text, $tag); - $event = $this->client_queue->next($deadline); - $this->assertNotNull($event); - $this->assertSame(Grpc\WRITE_ACCEPTED, $event->type); - - // check that a server rpc new was received - $this->server->request_call($server_tag); - $event = $this->server_queue->next($deadline); - $this->assertNotNull($event); - $this->assertSame(Grpc\SERVER_RPC_NEW, $event->type); + + $event = $call->start_batch([ + Grpc\OP_SEND_INITIAL_METADATA => [], + Grpc\OP_SEND_CLOSE_FROM_CLIENT => true, + Grpc\OP_SEND_MESSAGE => $req_text + ]); + + $this->assertTrue($event->send_metadata); + $this->assertTrue($event->send_close); + $this->assertTrue($event->send_message); + + $event = $this->server->request_call(); + $this->assertSame('dummy_method', $event->method); $server_call = $event->call; - $this->assertNotNull($server_call); - $server_call->server_accept($this->server_queue, $server_tag); - - $server_call->server_end_initial_metadata(); - - // start the server read - $server_call->start_read($server_tag); - $event = $this->server_queue->next($deadline); - $this->assertNotNull($event); - $this->assertSame(Grpc\READ, $event->type); - $this->assertSame($req_text, $event->data); - - // the server replies - $server_call->start_write($reply_text, $server_tag); - $event = $this->server_queue->next($deadline); - $this->assertNotNull($event); - $this->assertSame(Grpc\WRITE_ACCEPTED, $event->type); - - // the client reads the metadata - $event = $this->client_queue->next($deadline); - $this->assertNotNull($event); - $this->assertSame(Grpc\CLIENT_METADATA_READ, $event->type); - - // the client reads the reply - $call->start_read($tag); - $event = $this->client_queue->next($deadline); - $this->assertNotNull($event); - $this->assertSame(Grpc\READ, $event->type); - $this->assertSame($reply_text, $event->data); - - // the client sends writes done - $call->writes_done($tag); - $event = $this->client_queue->next($deadline); - $this->assertSame(Grpc\FINISH_ACCEPTED, $event->type); - $this->assertSame(Grpc\OP_OK, $event->data); - - // the server sends the status - $server_call->start_write_status(GRPC\STATUS_OK, $status_text, $server_tag); - $event = $this->server_queue->next($deadline); - $this->assertSame(Grpc\FINISH_ACCEPTED, $event->type); - $this->assertSame(Grpc\OP_OK, $event->data); - - // the client gets FINISHED - $event = $this->client_queue->next($deadline); - $this->assertNotNull($event); - $this->assertSame(Grpc\FINISHED, $event->type); - $status = $event->data; + + $event = $server_call->start_batch([ + Grpc\OP_SEND_INITIAL_METADATA => [], + Grpc\OP_SEND_MESSAGE => $reply_text, + Grpc\OP_SEND_STATUS_FROM_SERVER => [ + 'metadata' => [], + 'code' => Grpc\STATUS_OK, + 'details' => $status_text + ], + Grpc\OP_RECV_MESSAGE => true, + Grpc\OP_RECV_CLOSE_ON_SERVER => true, + ]); + + $this->assertTrue($event->send_metadata); + $this->assertTrue($event->send_status); + $this->assertTrue($event->send_message); + $this->assertFalse($event->cancelled); + $this->assertSame($req_text, $event->message); + + $event = $call->start_batch([ + Grpc\OP_RECV_INITIAL_METADATA => true, + Grpc\OP_RECV_MESSAGE => true, + Grpc\OP_RECV_STATUS_ON_CLIENT => true, + ]); + + $this->assertSame([], $event->metadata); + $this->assertSame($reply_text, $event->message); + $status = $event->status; + $this->assertSame([], $status->metadata); $this->assertSame(Grpc\STATUS_OK, $status->code); $this->assertSame($status_text, $status->details); - // and the server gets FINISHED - $event = $this->server_queue->next($deadline); - $this->assertNotNull($event); - $this->assertSame(Grpc\FINISHED, $event->type); - unset($call); unset($server_call); } -- cgit v1.2.3 From 73aefecd6f3e9d2148b50cdadbee48e2c1ccd64b Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 11 Mar 2015 16:36:14 -0700 Subject: Updated ActiveCall.php to use batch API --- src/php/lib/Grpc/ActiveCall.php | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/src/php/lib/Grpc/ActiveCall.php b/src/php/lib/Grpc/ActiveCall.php index f0d0d55582..af4dca50d7 100755 --- a/src/php/lib/Grpc/ActiveCall.php +++ b/src/php/lib/Grpc/ActiveCall.php @@ -38,9 +38,7 @@ require_once realpath(dirname(__FILE__) . '/../autoload.php'); * Represents an active call that allows sending and recieving binary data */ class ActiveCall { - private $completion_queue; private $call; - private $flags; private $metadata; /** @@ -48,24 +46,15 @@ class ActiveCall { * @param Channel $channel The channel to communicate on * @param string $method The method to call on the remote server * @param array $metadata Metadata to send with the call, if applicable - * @param long $flags Write flags to use with this call */ public function __construct(Channel $channel, $method, - $metadata = array(), - $flags = 0) { - $this->completion_queue = new CompletionQueue(); + $metadata = array()) { $this->call = new Call($channel, $method, Timeval::inf_future()); - $this->call->add_metadata($metadata, 0); - $this->flags = $flags; - // Invoke the call. - $this->call->invoke($this->completion_queue, - CLIENT_METADATA_READ, - FINISHED, 0); - $metadata_event = $this->completion_queue->pluck(CLIENT_METADATA_READ, - Timeval::inf_future()); - $this->metadata = $metadata_event->data; + $event = $this->call->start_batch([OP_SEND_INITIAL_METADATA => $metadata]); + + $this->metadata = $event->metadata; } /** @@ -87,8 +76,7 @@ class ActiveCall { * @return The next message from the server, or null if there is none. */ public function read() { - $this->call->start_read(READ); - $read_event = $this->completion_queue->pluck(READ, Timeval::inf_future()); + $read_event = $this->call->start_batch([OP_RECV_MESSAGE => true]); return $read_event->data; } @@ -98,16 +86,14 @@ class ActiveCall { * @param ByteBuffer $data The data to write */ public function write($data) { - $this->call->start_write($data, WRITE_ACCEPTED, $this->flags); - $this->completion_queue->pluck(WRITE_ACCEPTED, Timeval::inf_future()); + $this->call->start_batch([OP_SEND_MESSAGE => $data]); } /** * Indicate that no more writes will be sent. */ public function writesDone() { - $this->call->writes_done(FINISH_ACCEPTED); - $this->completion_queue->pluck(FINISH_ACCEPTED, Timeval::inf_future()); + $this->call->start_batch([OP_SEND_CLOSE_FROM_CLIENT => true]); } /** @@ -116,8 +102,7 @@ class ActiveCall { * and array $metadata members */ public function getStatus() { - $status_event = $this->completion_queue->pluck(FINISHED, - Timeval::inf_future()); + $status_event = $this->call->start_batch([RECV_STATUS_ON_CLIENT => true]); return $status_event->data; } } -- cgit v1.2.3 From 7d4ac6e961b40ab2f8d15174d47b1e94973c191d Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 11 Mar 2015 16:36:27 -0700 Subject: Added PHP tests to travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index e43a89e453..c4e9029dac 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,6 +17,7 @@ env: - CONFIG=opt TEST=node - CONFIG=opt TEST=ruby - CONFIG=opt TEST=python + - CONFIG=opt TEST=php - CONFIG=gcov TEST=c - CONFIG=gcov TEST=c++ script: -- cgit v1.2.3 From aa373ba69f3f1fe7d3fa1189d0c14a24f7c3d6b8 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 11 Mar 2015 16:59:02 -0700 Subject: Removed php tests from travis --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c4e9029dac..e43a89e453 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,6 @@ env: - CONFIG=opt TEST=node - CONFIG=opt TEST=ruby - CONFIG=opt TEST=python - - CONFIG=opt TEST=php - CONFIG=gcov TEST=c - CONFIG=gcov TEST=c++ script: -- cgit v1.2.3 From ec7788d94f198f4c9577b8d45c804291a36bf9e2 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 11 Mar 2015 17:10:34 -0700 Subject: Re-added php tests to travis --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e43a89e453..ba2bc75614 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ before_install: - sudo add-apt-repository ppa:yjwong/gflags -y - sudo add-apt-repository ppa:h-rayflood/llvm -y - sudo apt-get update -qq - - sudo apt-get install -qq libgtest-dev libgflags-dev python-virtualenv clang-3.5 + - sudo apt-get install -qq libgtest-dev libgflags-dev python-virtualenv clang-3.5 php5-dev - sudo pip install cpp-coveralls env: global: @@ -17,6 +17,7 @@ env: - CONFIG=opt TEST=node - CONFIG=opt TEST=ruby - CONFIG=opt TEST=python + - CONFIG=opt TEST=php - CONFIG=gcov TEST=c - CONFIG=gcov TEST=c++ script: -- cgit v1.2.3 From 02ea664342675b72e7f2d154ff0ee41c795f5810 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 11 Mar 2015 17:22:50 -0700 Subject: Updated travis's PHP version --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ba2bc75614..634adc86e7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ before_install: - sudo add-apt-repository ppa:yjwong/gflags -y - sudo add-apt-repository ppa:h-rayflood/llvm -y - sudo apt-get update -qq - - sudo apt-get install -qq libgtest-dev libgflags-dev python-virtualenv clang-3.5 php5-dev + - sudo apt-get install -qq libgtest-dev libgflags-dev python-virtualenv clang-3.5 php5-dev php5 - sudo pip install cpp-coveralls env: global: -- cgit v1.2.3 From 77234a5c563b042b1e23f5551144cd02a359077c Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 11 Mar 2015 17:34:51 -0700 Subject: Fixed travis PHP version update --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 634adc86e7..bab36d43c6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,8 +2,10 @@ language: cpp before_install: - sudo add-apt-repository ppa:yjwong/gflags -y - sudo add-apt-repository ppa:h-rayflood/llvm -y + - sudo add-apt-repository ppa:ondrej/php5-5.6 + - sudo apt-get dist-upgrade - sudo apt-get update -qq - - sudo apt-get install -qq libgtest-dev libgflags-dev python-virtualenv clang-3.5 php5-dev php5 + - sudo apt-get install -qq libgtest-dev libgflags-dev python-virtualenv clang-3.5 php5-dev - sudo pip install cpp-coveralls env: global: -- cgit v1.2.3 From 782f38c3a46044d4e69c22da1dd0bd0169bb7077 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 12 Mar 2015 09:14:38 -0700 Subject: Added flag in install script --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index bab36d43c6..ed24923087 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ before_install: - sudo add-apt-repository ppa:yjwong/gflags -y - sudo add-apt-repository ppa:h-rayflood/llvm -y - sudo add-apt-repository ppa:ondrej/php5-5.6 - - sudo apt-get dist-upgrade + - sudo apt-get dist-upgrade -qq - sudo apt-get update -qq - sudo apt-get install -qq libgtest-dev libgflags-dev python-virtualenv clang-3.5 php5-dev - sudo pip install cpp-coveralls -- cgit v1.2.3 From 448a87d7fde006b38ba2e796ab8a5b195896978f Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 12 Mar 2015 10:06:07 -0700 Subject: Fixed another flag in install script --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ed24923087..d1fbb71520 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: cpp before_install: - sudo add-apt-repository ppa:yjwong/gflags -y - sudo add-apt-repository ppa:h-rayflood/llvm -y - - sudo add-apt-repository ppa:ondrej/php5-5.6 + - sudo add-apt-repository ppa:ondrej/php5-5.6 -y - sudo apt-get dist-upgrade -qq - sudo apt-get update -qq - sudo apt-get install -qq libgtest-dev libgflags-dev python-virtualenv clang-3.5 php5-dev -- cgit v1.2.3 From c351ae77f54b18317473899f201f7826d1df3c75 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 12 Mar 2015 10:47:25 -0700 Subject: Reordered install commands for travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d1fbb71520..20d6fe0fb1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,8 @@ before_install: - sudo add-apt-repository ppa:yjwong/gflags -y - sudo add-apt-repository ppa:h-rayflood/llvm -y - sudo add-apt-repository ppa:ondrej/php5-5.6 -y - - sudo apt-get dist-upgrade -qq - sudo apt-get update -qq + - sudo apt-get dist-upgrade -qq - sudo apt-get install -qq libgtest-dev libgflags-dev python-virtualenv clang-3.5 php5-dev - sudo pip install cpp-coveralls env: -- cgit v1.2.3 From 3f101607690f7c670f048a3aaf2c50b06e313bb9 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 11 Mar 2015 16:36:14 -0700 Subject: Updated ActiveCall.php to use batch API --- src/php/lib/Grpc/ActiveCall.php | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/src/php/lib/Grpc/ActiveCall.php b/src/php/lib/Grpc/ActiveCall.php index f0d0d55582..af4dca50d7 100755 --- a/src/php/lib/Grpc/ActiveCall.php +++ b/src/php/lib/Grpc/ActiveCall.php @@ -38,9 +38,7 @@ require_once realpath(dirname(__FILE__) . '/../autoload.php'); * Represents an active call that allows sending and recieving binary data */ class ActiveCall { - private $completion_queue; private $call; - private $flags; private $metadata; /** @@ -48,24 +46,15 @@ class ActiveCall { * @param Channel $channel The channel to communicate on * @param string $method The method to call on the remote server * @param array $metadata Metadata to send with the call, if applicable - * @param long $flags Write flags to use with this call */ public function __construct(Channel $channel, $method, - $metadata = array(), - $flags = 0) { - $this->completion_queue = new CompletionQueue(); + $metadata = array()) { $this->call = new Call($channel, $method, Timeval::inf_future()); - $this->call->add_metadata($metadata, 0); - $this->flags = $flags; - // Invoke the call. - $this->call->invoke($this->completion_queue, - CLIENT_METADATA_READ, - FINISHED, 0); - $metadata_event = $this->completion_queue->pluck(CLIENT_METADATA_READ, - Timeval::inf_future()); - $this->metadata = $metadata_event->data; + $event = $this->call->start_batch([OP_SEND_INITIAL_METADATA => $metadata]); + + $this->metadata = $event->metadata; } /** @@ -87,8 +76,7 @@ class ActiveCall { * @return The next message from the server, or null if there is none. */ public function read() { - $this->call->start_read(READ); - $read_event = $this->completion_queue->pluck(READ, Timeval::inf_future()); + $read_event = $this->call->start_batch([OP_RECV_MESSAGE => true]); return $read_event->data; } @@ -98,16 +86,14 @@ class ActiveCall { * @param ByteBuffer $data The data to write */ public function write($data) { - $this->call->start_write($data, WRITE_ACCEPTED, $this->flags); - $this->completion_queue->pluck(WRITE_ACCEPTED, Timeval::inf_future()); + $this->call->start_batch([OP_SEND_MESSAGE => $data]); } /** * Indicate that no more writes will be sent. */ public function writesDone() { - $this->call->writes_done(FINISH_ACCEPTED); - $this->completion_queue->pluck(FINISH_ACCEPTED, Timeval::inf_future()); + $this->call->start_batch([OP_SEND_CLOSE_FROM_CLIENT => true]); } /** @@ -116,8 +102,7 @@ class ActiveCall { * and array $metadata members */ public function getStatus() { - $status_event = $this->completion_queue->pluck(FINISHED, - Timeval::inf_future()); + $status_event = $this->call->start_batch([RECV_STATUS_ON_CLIENT => true]); return $status_event->data; } } -- cgit v1.2.3 From 45efc4dea128cf2106a0f310324bceddc2ecb85b Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 12 Mar 2015 11:14:47 -0700 Subject: Removed PHP travis tests --- .travis.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 20d6fe0fb1..e43a89e453 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,10 +2,8 @@ language: cpp before_install: - sudo add-apt-repository ppa:yjwong/gflags -y - sudo add-apt-repository ppa:h-rayflood/llvm -y - - sudo add-apt-repository ppa:ondrej/php5-5.6 -y - sudo apt-get update -qq - - sudo apt-get dist-upgrade -qq - - sudo apt-get install -qq libgtest-dev libgflags-dev python-virtualenv clang-3.5 php5-dev + - sudo apt-get install -qq libgtest-dev libgflags-dev python-virtualenv clang-3.5 - sudo pip install cpp-coveralls env: global: @@ -19,7 +17,6 @@ env: - CONFIG=opt TEST=node - CONFIG=opt TEST=ruby - CONFIG=opt TEST=python - - CONFIG=opt TEST=php - CONFIG=gcov TEST=c - CONFIG=gcov TEST=c++ script: -- cgit v1.2.3 From 3bb52151dd4ca829ae827517af3a0fd44e9b0bfb Mon Sep 17 00:00:00 2001 From: Masood Malekghassemi Date: Tue, 17 Mar 2015 21:52:52 -0700 Subject: Make Python package spec indirect This is part of a change to ease internal usage of GRPC. --- Makefile | 46 ++++++++++++++++++++++++--- build.json | 21 +++++++++--- src/compiler/python_generator.cc | 69 ++++++++++++++++++++++++++++++++++------ src/compiler/python_generator.h | 26 ++++++++++++++- src/compiler/python_plugin.cc | 52 ++---------------------------- 5 files changed, 145 insertions(+), 69 deletions(-) diff --git a/Makefile b/Makefile index 8be6c5fd0a..b50834dc01 100644 --- a/Makefile +++ b/Makefile @@ -3493,6 +3493,44 @@ $(OBJDIR)/$(CONFIG)/src/cpp/util/status.o: $(OBJDIR)/$(CONFIG)/src/cpp/util/time.o: +LIBGRPC_PYTHON_PLUGIN_SUPPORT_SRC = \ + src/compiler/python_generator.cc \ + +PUBLIC_HEADERS_CXX += \ + src/compiler/python_generator.h \ + +LIBGRPC_PYTHON_PLUGIN_SUPPORT_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC_PYTHON_PLUGIN_SUPPORT_SRC)))) + +ifeq ($(NO_PROTOBUF),true) + +# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. + +$(LIBDIR)/$(CONFIG)/libgrpc_python_plugin_support.a: protobuf_dep_error + + +else + +$(LIBDIR)/$(CONFIG)/libgrpc_python_plugin_support.a: $(ZLIB_DEP) $(PROTOBUF_DEP) $(LIBGRPC_PYTHON_PLUGIN_SUPPORT_OBJS) + $(E) "[AR] Creating $@" + $(Q) mkdir -p `dirname $@` + $(Q) rm -f $(LIBDIR)/$(CONFIG)/libgrpc_python_plugin_support.a + $(Q) $(AR) rcs $(LIBDIR)/$(CONFIG)/libgrpc_python_plugin_support.a $(LIBGRPC_PYTHON_PLUGIN_SUPPORT_OBJS) +ifeq ($(SYSTEM),Darwin) + $(Q) ranlib $(LIBDIR)/$(CONFIG)/libgrpc_python_plugin_support.a +endif + + + + +endif + +ifneq ($(NO_DEPS),true) +-include $(LIBGRPC_PYTHON_PLUGIN_SUPPORT_OBJS:.o=.dep) +endif + +$(OBJDIR)/$(CONFIG)/src/compiler/python_generator.o: + + LIBPUBSUB_CLIENT_LIB_SRC = \ $(GENDIR)/examples/pubsub/label.pb.cc \ $(GENDIR)/examples/pubsub/empty.pb.cc \ @@ -8048,7 +8086,6 @@ endif GRPC_PYTHON_PLUGIN_SRC = \ - src/compiler/python_generator.cc \ src/compiler/python_plugin.cc \ GRPC_PYTHON_PLUGIN_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GRPC_PYTHON_PLUGIN_SRC)))) @@ -8062,15 +8099,14 @@ $(BINDIR)/$(CONFIG)/grpc_python_plugin: protobuf_dep_error else -$(BINDIR)/$(CONFIG)/grpc_python_plugin: $(PROTOBUF_DEP) $(GRPC_PYTHON_PLUGIN_OBJS) +$(BINDIR)/$(CONFIG)/grpc_python_plugin: $(PROTOBUF_DEP) $(GRPC_PYTHON_PLUGIN_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_python_plugin_support.a $(E) "[HOSTLD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(HOST_LDXX) $(HOST_LDFLAGS) $(GRPC_PYTHON_PLUGIN_OBJS) $(HOST_LDLIBSXX) $(HOST_LDLIBS_PROTOC) $(HOST_LDLIBS) $(HOST_LDLIBS_PROTOC) -o $(BINDIR)/$(CONFIG)/grpc_python_plugin + $(Q) $(HOST_LDXX) $(HOST_LDFLAGS) $(GRPC_PYTHON_PLUGIN_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_python_plugin_support.a $(HOST_LDLIBSXX) $(HOST_LDLIBS_PROTOC) $(HOST_LDLIBS) $(HOST_LDLIBS_PROTOC) -o $(BINDIR)/$(CONFIG)/grpc_python_plugin endif -$(OBJDIR)/$(CONFIG)/src/compiler/python_generator.o: -$(OBJDIR)/$(CONFIG)/src/compiler/python_plugin.o: +$(OBJDIR)/$(CONFIG)/src/compiler/python_plugin.o: $(LIBDIR)/$(CONFIG)/libgrpc_python_plugin_support.a deps_grpc_python_plugin: $(GRPC_PYTHON_PLUGIN_OBJS:.o=.dep) diff --git a/build.json b/build.json index 999e140c5a..08b23ec593 100644 --- a/build.json +++ b/build.json @@ -491,6 +491,19 @@ ], "secure": "no" }, + { + "name": "grpc_python_plugin_support", + "build": "protoc", + "language": "c++", + "public_headers": [ + "src/compiler/python_generator.h" + ], + "src": [ + "src/compiler/python_generator.cc" + ], + "deps": [], + "secure": "no" + }, { "name": "pubsub_client_lib", "build": "private", @@ -1739,14 +1752,12 @@ "name": "grpc_python_plugin", "build": "protoc", "language": "c++", - "headers": [ - "src/compiler/python_generator.h" - ], "src": [ - "src/compiler/python_generator.cc", "src/compiler/python_plugin.cc" ], - "deps": [], + "deps": [ + "grpc_python_plugin_support" + ], "secure": "no" }, { diff --git a/src/compiler/python_generator.cc b/src/compiler/python_generator.cc index e4f85450f5..1ec3772f9f 100644 --- a/src/compiler/python_generator.cc +++ b/src/compiler/python_generator.cc @@ -36,13 +36,18 @@ #include #include #include +#include #include #include +#include +#include #include #include "src/compiler/generator_helpers.h" #include "src/compiler/python_generator.h" +#include #include +#include #include #include #include @@ -53,8 +58,11 @@ using google::protobuf::Descriptor; using google::protobuf::FileDescriptor; using google::protobuf::MethodDescriptor; using google::protobuf::ServiceDescriptor; +using google::protobuf::compiler::GeneratorContext; +using google::protobuf::io::CodedOutputStream; using google::protobuf::io::Printer; using google::protobuf::io::StringOutputStream; +using google::protobuf::io::ZeroCopyOutputStream; using std::initializer_list; using std::make_pair; using std::map; @@ -63,6 +71,41 @@ using std::replace; using std::vector; namespace grpc_python_generator { + +PythonGrpcGenerator::PythonGrpcGenerator(const GeneratorConfiguration& config) + : config_(config) {} + +PythonGrpcGenerator::~PythonGrpcGenerator() {} + +bool PythonGrpcGenerator::Generate( + const FileDescriptor* file, const std::string& parameter, + GeneratorContext* context, std::string* error) const { + // Get output file name. + std::string file_name; + static const int proto_suffix_length = strlen(".proto"); + if (file->name().size() > static_cast(proto_suffix_length) && + file->name().find_last_of(".proto") == file->name().size() - 1) { + file_name = file->name().substr( + 0, file->name().size() - proto_suffix_length) + "_pb2.py"; + } else { + *error = "Invalid proto file name. Proto file must end with .proto"; + return false; + } + + std::unique_ptr output( + context->OpenForInsert(file_name, "module_scope")); + CodedOutputStream coded_out(output.get()); + bool success = false; + std::string code = ""; + tie(success, code) = grpc_python_generator::GetServices(file, config_); + if (success) { + coded_out.WriteRaw(code.data(), code.size()); + return true; + } else { + return false; + } +} + namespace { ////////////////////////////////// // BEGIN FORMATTING BOILERPLATE // @@ -70,7 +113,8 @@ namespace { // Converts an initializer list of the form { key0, value0, key1, value1, ... } // into a map of key* to value*. Is merely a readability helper for later code. -map ListToDict(const initializer_list& values) { +map ListToDict( + const initializer_list& values) { assert(values.size() % 2 == 0); map value_map; auto value_iter = values.begin(); @@ -237,8 +281,10 @@ bool PrintServerFactory(const std::string& package_qualified_service_name, { IndentScope raii_create_server_indent(out); map method_description_constructors; - map> input_message_modules_and_classes; - map> output_message_modules_and_classes; + map> + input_message_modules_and_classes; + map> + output_message_modules_and_classes; for (int i = 0; i < service->method_count(); ++i) { const MethodDescriptor* method = service->method(i); const std::string method_description_constructor = @@ -313,8 +359,10 @@ bool PrintStubFactory(const std::string& package_qualified_service_name, { IndentScope raii_create_server_indent(out); map method_description_constructors; - map> input_message_modules_and_classes; - map> output_message_modules_and_classes; + map> + input_message_modules_and_classes; + map> + output_message_modules_and_classes; for (int i = 0; i < service->method_count(); ++i) { const MethodDescriptor* method = service->method(i); const std::string method_description_constructor = @@ -378,22 +426,25 @@ bool PrintStubFactory(const std::string& package_qualified_service_name, return true; } -bool PrintPreamble(const FileDescriptor* file, Printer* out) { +bool PrintPreamble(const FileDescriptor* file, + const GeneratorConfiguration& config, Printer* out) { out->Print("import abc\n"); - out->Print("from grpc.early_adopter import implementations\n"); + out->Print("from $Package$ import implementations\n", + "Package", config.implementations_package_root); out->Print("from grpc.framework.alpha import utilities\n"); return true; } } // namespace -pair GetServices(const FileDescriptor* file) { +pair GetServices(const FileDescriptor* file, + const GeneratorConfiguration& config) { std::string output; { // Scope the output stream so it closes and finalizes output to the string. StringOutputStream output_stream(&output); Printer out(&output_stream, '$'); - if (!PrintPreamble(file, &out)) { + if (!PrintPreamble(file, config, &out)) { return make_pair(false, ""); } auto package = file->package(); diff --git a/src/compiler/python_generator.h b/src/compiler/python_generator.h index df29ca17e3..67686dbdfe 100644 --- a/src/compiler/python_generator.h +++ b/src/compiler/python_generator.h @@ -37,6 +37,9 @@ #include #include +#include +#include + namespace google { namespace protobuf { class FileDescriptor; @@ -45,7 +48,28 @@ class FileDescriptor; namespace grpc_python_generator { -std::pair GetServices(const google::protobuf::FileDescriptor* file); +// Data pertaining to configuration of the generator with respect to anything +// that may be used internally at Google. +struct GeneratorConfiguration { + std::string implementations_package_root; +}; + +class PythonGrpcGenerator : public google::protobuf::compiler::CodeGenerator { + public: + PythonGrpcGenerator(const GeneratorConfiguration& config); + ~PythonGrpcGenerator(); + + bool Generate(const google::protobuf::FileDescriptor* file, + const std::string& parameter, + google::protobuf::compiler::GeneratorContext* context, + std::string* error) const; + private: + GeneratorConfiguration config_; +}; + +std::pair GetServices( + const google::protobuf::FileDescriptor* file, + const GeneratorConfiguration& config); } // namespace grpc_python_generator diff --git a/src/compiler/python_plugin.cc b/src/compiler/python_plugin.cc index e7d172f7bf..4f59ec9164 100644 --- a/src/compiler/python_plugin.cc +++ b/src/compiler/python_plugin.cc @@ -33,60 +33,14 @@ // Generates a Python gRPC service interface out of Protobuf IDL. -#include -#include -#include -#include - #include "src/compiler/python_generator.h" -#include #include -#include -#include -#include -using google::protobuf::FileDescriptor; -using google::protobuf::compiler::CodeGenerator; -using google::protobuf::compiler::GeneratorContext; using google::protobuf::compiler::PluginMain; -using google::protobuf::io::CodedOutputStream; -using google::protobuf::io::ZeroCopyOutputStream; - -class PythonGrpcGenerator : public CodeGenerator { - public: - PythonGrpcGenerator() {} - ~PythonGrpcGenerator() {} - - bool Generate(const FileDescriptor* file, const std::string& parameter, - GeneratorContext* context, std::string* error) const { - // Get output file name. - std::string file_name; - static const int proto_suffix_length = strlen(".proto"); - if (file->name().size() > static_cast(proto_suffix_length) && - file->name().find_last_of(".proto") == file->name().size() - 1) { - file_name = file->name().substr( - 0, file->name().size() - proto_suffix_length) + "_pb2.py"; - } else { - *error = "Invalid proto file name. Proto file must end with .proto"; - return false; - } - - std::unique_ptr output( - context->OpenForInsert(file_name, "module_scope")); - CodedOutputStream coded_out(output.get()); - bool success = false; - std::string code = ""; - tie(success, code) = grpc_python_generator::GetServices(file); - if (success) { - coded_out.WriteRaw(code.data(), code.size()); - return true; - } else { - return false; - } - } -}; int main(int argc, char* argv[]) { - PythonGrpcGenerator generator; + grpc_python_generator::GeneratorConfiguration config; + config.implementations_package_root = "grpc.early_adopter"; + grpc_python_generator::PythonGrpcGenerator generator(config); return PluginMain(argc, argv, &generator); } -- cgit v1.2.3 From 5cb82b5a7781de1ec512065319962eeb403bc3c4 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 18 Mar 2015 12:15:21 -0700 Subject: Added Node QPS test --- src/node/examples/qps_test.js | 102 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 src/node/examples/qps_test.js diff --git a/src/node/examples/qps_test.js b/src/node/examples/qps_test.js new file mode 100644 index 0000000000..4435da4803 --- /dev/null +++ b/src/node/examples/qps_test.js @@ -0,0 +1,102 @@ +/* + * + * 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. + * + */ + +'use strict'; + +var async = require('async'); +var parseArgs = require('minimist'); + +var grpc = require('..'); +var testProto = grpc.load(__dirname + '/../interop/test.proto').grpc.testing; +var interop_server = require('../interop/interop_server.js'); + +function runTest(concurrent, seconds, callback) { + var testServer = interop_server.getServer(0, false); + testServer.server.listen(); + var client = new testProto.TestService('localhost:' + testServer.port); + + var warmup_num = 100; + + async.waterfall([ + function warmUp(callback) { + var pending = warmup_num; + function startCall() { + client.emptyCall({}, function(err, resp) { + pending--; + if (pending === 0) { + callback(null); + } + }); + } + for (var i = 0; i < warmup_num; i++) { + startCall(); + } + }, function run(callback) { + var running = 0; + var count = 0; + var start = process.hrtime(); + function responseCallback(err, resp) { + if (process.hrtime(start)[0] < seconds) { + count += 1; + client.emptyCall({}, responseCallback); + } else { + running -= 1; + if (running <= 0) { + callback(null, count); + } + } + } + for (var i = 0; i < concurrent; i++) { + running += 1; + client.emptyCall({}, responseCallback); + } + }], function(err, count) { + testServer.server.shutdown(); + callback(err, count); + }); +} + +if (require.main === module) { + var argv = parseArgs(process.argv.slice(2), { + default: {'concurrent': 100, + 'time': 10} + }); + runTest(argv.concurrent, argv.time, function(err, count) { + if (err) { + throw err; + } + console.log('Concurrent calls:', argv.concurrent); + console.log('Time:', argv.time, 'seconds'); + console.log('QPS:', (count/argv.time)); + }); +} -- cgit v1.2.3 From e023e98d9a2513f61a7dbf0555e54da7bbdbdfd1 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 18 Mar 2015 17:17:33 -0700 Subject: Added functions to create generic servers and clients --- src/node/index.js | 8 +++- src/node/src/client.js | 53 +++++++++++++++--------- src/node/src/common.js | 23 +++++++++++ src/node/src/server.js | 96 +++++++++++++++++++++++++------------------ src/node/test/surface_test.js | 2 +- 5 files changed, 119 insertions(+), 63 deletions(-) diff --git a/src/node/index.js b/src/node/index.js index ad3dd96af7..0b768edc6b 100644 --- a/src/node/index.js +++ b/src/node/index.js @@ -56,7 +56,7 @@ function loadObject(value) { }); return result; } else if (value.className === 'Service') { - return client.makeClientConstructor(value); + return client.makeProtobufClientConstructor(value); } else if (value.className === 'Message' || value.className === 'Enum') { return value.build(); } else { @@ -119,7 +119,7 @@ exports.load = load; /** * See docs for server.makeServerConstructor */ -exports.buildServer = server.makeServerConstructor; +exports.buildServer = server.makeProtobufServerConstructor; /** * Status name to code number mapping @@ -141,3 +141,7 @@ exports.Credentials = grpc.Credentials; exports.ServerCredentials = grpc.ServerCredentials; exports.getGoogleAuthDelegate = getGoogleAuthDelegate; + +exports.makeGenericClientConstructor = client.makeClientConstructor; + +exports.makeGenericServerConstructor = server.makeServerConstructor; diff --git a/src/node/src/client.js b/src/node/src/client.js index 54b8dbdc9c..c46f7d0526 100644 --- a/src/node/src/client.js +++ b/src/node/src/client.js @@ -35,9 +35,6 @@ var _ = require('underscore'); -var capitalize = require('underscore.string/capitalize'); -var decapitalize = require('underscore.string/decapitalize'); - var grpc = require('bindings')('grpc.node'); var common = require('./common.js'); @@ -463,13 +460,18 @@ var requester_makers = { }; /** - * Creates a constructor for clients for the given service - * @param {ProtoBuf.Reflect.Service} service The service to generate a client - * for + * Creates a constructor for a client with the given methods. The methods object + * maps method name to an object with the following keys: + * path: The path on the server for accessing the method. For example, for + * protocol buffers, we use "/service_name/method_name" + * requestStream: bool indicating whether the client sends a stream + * resonseStream: bool indicating whether the server sends a stream + * requestSerialize: function to serialize request objects + * responseDeserialize: function to deserialize response objects + * @param {Object} methods An object mapping method names to method attributes * @return {function(string, Object)} New client constructor */ -function makeClientConstructor(service) { - var prefix = '/' + common.fullyQualifiedName(service) + '/'; +function makeClientConstructor(methods) { /** * Create a client with the given methods * @constructor @@ -489,30 +491,41 @@ function makeClientConstructor(service) { this.channel = new grpc.Channel(address, options); } - _.each(service.children, function(method) { + _.each(methods, function(attrs, name) { var method_type; - if (method.requestStream) { - if (method.responseStream) { + if (attrs.requestStream) { + if (attrs.responseStream) { method_type = 'bidi'; } else { method_type = 'client_stream'; } } else { - if (method.responseStream) { + if (attrs.responseStream) { method_type = 'server_stream'; } else { method_type = 'unary'; } } - var serialize = common.serializeCls(method.resolvedRequestType.build()); - var deserialize = common.deserializeCls( - method.resolvedResponseType.build()); - Client.prototype[decapitalize(method.name)] = requester_makers[method_type]( - prefix + capitalize(method.name), serialize, deserialize); - Client.prototype[decapitalize(method.name)].serialize = serialize; - Client.prototype[decapitalize(method.name)].deserialize = deserialize; + var serialize = attrs.requestSerialize; + var deserialize = attrs.responseDeserialize; + Client.prototype[name] = requester_makers[method_type]( + attrs.path, serialize, deserialize); + Client.prototype[name].serialize = serialize; + Client.prototype[name].deserialize = deserialize; }); + return Client; +} + +/** + * Creates a constructor for clients for the given service + * @param {ProtoBuf.Reflect.Service} service The service to generate a client + * for + * @return {function(string, Object)} New client constructor + */ +function makeProtobufClientConstructor(service) { + var method_attrs = common.getProtobufServiceAttrs(service); + var Client = makeClientConstructor(method_attrs); Client.service = service; return Client; @@ -520,6 +533,8 @@ function makeClientConstructor(service) { exports.makeClientConstructor = makeClientConstructor; +exports.makeProtobufClientConstructor = makeProtobufClientConstructor; + /** * See docs for client.status */ diff --git a/src/node/src/common.js b/src/node/src/common.js index eec8f0f987..55a6b13782 100644 --- a/src/node/src/common.js +++ b/src/node/src/common.js @@ -36,6 +36,7 @@ var _ = require('underscore'); var capitalize = require('underscore.string/capitalize'); +var decapitalize = require('underscore.string/decapitalize'); /** * Get a function that deserializes a specific type of protobuf. @@ -109,6 +110,26 @@ function wrapIgnoreNull(func) { }; } +/** + * Return a map from method names to method attributes for the service. + * @param {ProtoBuf.Reflect.Service} service The service to get attributes for + * @return {Object} The attributes map + */ +function getProtobufServiceAttrs(service) { + var prefix = '/' + fullyQualifiedName(service) + '/'; + return _.object(_.map(service.children, function(method) { + return [decapitalize(method.name), { + path: prefix + capitalize(method.name), + requestStream: method.requestStream, + responseStream: method.responseStream, + requestSerialize: serializeCls(method.resolvedRequestType.build()), + requestDeserialize: deserializeCls(method.resolvedRequestType.build()), + responseSerialize: serializeCls(method.resolvedResponseType.build()), + responseDeserialize: deserializeCls(method.resolvedResponseType.build()) + }]; + })); +} + /** * See docs for deserializeCls */ @@ -128,3 +149,5 @@ exports.fullyQualifiedName = fullyQualifiedName; * See docs for wrapIgnoreNull */ exports.wrapIgnoreNull = wrapIgnoreNull; + +exports.getProtobufServiceAttrs = getProtobufServiceAttrs; diff --git a/src/node/src/server.js b/src/node/src/server.js index b72d110666..e214d76dc5 100644 --- a/src/node/src/server.js +++ b/src/node/src/server.js @@ -35,9 +35,6 @@ var _ = require('underscore'); -var capitalize = require('underscore.string/capitalize'); -var decapitalize = require('underscore.string/decapitalize'); - var grpc = require('bindings')('grpc.node'); var common = require('./common'); @@ -532,26 +529,20 @@ Server.prototype.bind = function(port, creds) { }; /** - * Creates a constructor for servers with a service defined by the methods - * object. The methods object has string keys and values of this form: - * {serialize: function, deserialize: function, client_stream: bool, - * server_stream: bool} - * @param {Object} methods Method descriptor for each method the server should - * expose - * @param {string} prefix The prefex to prepend to each method name - * @return {function(Object, Object)} New server constructor + * Create a constructor for servers with services defined by service_attr_map. + * That is an object that maps (namespaced) service names to objects that in + * turn map method names to objects with the following keys: + * path: The path on the server for accessing the method. For example, for + * protocol buffers, we use "/service_name/method_name" + * requestStream: bool indicating whether the client sends a stream + * resonseStream: bool indicating whether the server sends a stream + * requestDeserialize: function to deserialize request objects + * responseSerialize: function to serialize response objects + * @param {Object} service_attr_map An object mapping service names to method + * attribute map objects + * @return {function(Object, function, Object=)} New server constructor */ -function makeServerConstructor(services) { - var qual_names = []; - _.each(services, function(service) { - _.each(service.children, function(method) { - var name = common.fullyQualifiedName(method); - if (_.indexOf(qual_names, name) !== -1) { - throw new Error('Method ' + name + ' exposed by more than one service'); - } - qual_names.push(name); - }); - }); +function makeServerConstructor(service_attr_map) { /** * Create a server with the given handlers for all of the methods. * @constructor @@ -565,41 +556,34 @@ function makeServerConstructor(services) { function SurfaceServer(service_handlers, getMetadata, options) { var server = new Server(getMetadata, options); this.inner_server = server; - _.each(services, function(service) { - var service_name = common.fullyQualifiedName(service); + _.each(service_attr_map, function(service_attrs, service_name) { if (service_handlers[service_name] === undefined) { throw new Error('Handlers for service ' + service_name + ' not provided.'); } - var prefix = '/' + common.fullyQualifiedName(service) + '/'; - _.each(service.children, function(method) { + _.each(service_attrs, function(attrs, name) { var method_type; - if (method.requestStream) { - if (method.responseStream) { + if (attrs.requestStream) { + if (attrs.responseStream) { method_type = 'bidi'; } else { method_type = 'client_stream'; } } else { - if (method.responseStream) { + if (attrs.responseStream) { method_type = 'server_stream'; } else { method_type = 'unary'; } } - if (service_handlers[service_name][decapitalize(method.name)] === - undefined) { - throw new Error('Method handler for ' + - common.fullyQualifiedName(method) + ' not provided.'); + if (service_handlers[service_name][name] === undefined) { + throw new Error('Method handler for ' + attrs.path + + ' not provided.'); } - var serialize = common.serializeCls( - method.resolvedResponseType.build()); - var deserialize = common.deserializeCls( - method.resolvedRequestType.build()); - server.register( - prefix + capitalize(method.name), - service_handlers[service_name][decapitalize(method.name)], - serialize, deserialize, method_type); + var serialize = attrs.responseSerialize; + var deserialize = attrs.requestDeserialize; + server.register(attrs.path, service_handlers[service_name][name], + serialize, deserialize, method_type); }); }, this); } @@ -635,7 +619,37 @@ function makeServerConstructor(services) { return SurfaceServer; } +/** + * Create a constructor for servers that serve the given services. + * @param {Array} services The services that the + * servers will serve + * @return {function(Object, function, Object=)} New server constructor + */ +function makeProtobufServerConstructor(services) { + var qual_names = []; + var service_attr_map = {}; + _.each(services, function(service) { + var service_name = common.fullyQualifiedName(service); + _.each(service.children, function(method) { + var name = common.fullyQualifiedName(method); + if (_.indexOf(qual_names, name) !== -1) { + throw new Error('Method ' + name + ' exposed by more than one service'); + } + qual_names.push(name); + }); + var method_attrs = common.getProtobufServiceAttrs(service); + if (!service_attr_map.hasOwnProperty(service_name)) { + service_attr_map[service_name] = {}; + } + service_attr_map[service_name] = _.extend(service_attr_map[service_name], + method_attrs); + }); + return makeServerConstructor(service_attr_map); +} + /** * See documentation for makeServerConstructor */ exports.makeServerConstructor = makeServerConstructor; + +exports.makeProtobufServerConstructor = makeProtobufServerConstructor; diff --git a/src/node/test/surface_test.js b/src/node/test/surface_test.js index 91d8197bee..6fae483e6c 100644 --- a/src/node/test/surface_test.js +++ b/src/node/test/surface_test.js @@ -89,7 +89,7 @@ describe('Cancelling surface client', function() { } }); var port = server.bind('localhost:0'); - var Client = surface_client.makeClientConstructor(mathService); + var Client = surface_client.makeProtobufClientConstructor(mathService); client = new Client('localhost:' + port); }); after(function() { -- cgit v1.2.3 From 75e2f6d8390ea3b1db408c46cce19b1294219dd3 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Thu, 19 Mar 2015 07:04:38 -0700 Subject: Implementation of generic stub --- Makefile | 7 ++++++ build.json | 2 ++ include/grpc++/generic_stub.h | 4 +++- src/cpp/client/generic_stub.cc | 51 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 src/cpp/client/generic_stub.cc diff --git a/Makefile b/Makefile index 8be6c5fd0a..d9e6d04e3d 100644 --- a/Makefile +++ b/Makefile @@ -3128,6 +3128,7 @@ LIBGRPC++_SRC = \ src/cpp/client/client_unary_call.cc \ src/cpp/client/create_channel.cc \ src/cpp/client/credentials.cc \ + src/cpp/client/generic_stub.cc \ src/cpp/client/insecure_credentials.cc \ src/cpp/client/internal_stub.cc \ src/cpp/common/call.cc \ @@ -3157,6 +3158,7 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/config.h \ include/grpc++/create_channel.h \ include/grpc++/credentials.h \ + include/grpc++/generic_stub.h \ include/grpc++/impl/call.h \ include/grpc++/impl/client_unary_call.h \ include/grpc++/impl/internal_stub.h \ @@ -3215,6 +3217,7 @@ src/cpp/client/client_context.cc: $(OPENSSL_DEP) src/cpp/client/client_unary_call.cc: $(OPENSSL_DEP) src/cpp/client/create_channel.cc: $(OPENSSL_DEP) src/cpp/client/credentials.cc: $(OPENSSL_DEP) +src/cpp/client/generic_stub.cc: $(OPENSSL_DEP) src/cpp/client/insecure_credentials.cc: $(OPENSSL_DEP) src/cpp/client/internal_stub.cc: $(OPENSSL_DEP) src/cpp/common/call.cc: $(OPENSSL_DEP) @@ -3281,6 +3284,7 @@ $(OBJDIR)/$(CONFIG)/src/cpp/client/client_context.o: $(OBJDIR)/$(CONFIG)/src/cpp/client/client_unary_call.o: $(OBJDIR)/$(CONFIG)/src/cpp/client/create_channel.o: $(OBJDIR)/$(CONFIG)/src/cpp/client/credentials.o: +$(OBJDIR)/$(CONFIG)/src/cpp/client/generic_stub.o: $(OBJDIR)/$(CONFIG)/src/cpp/client/insecure_credentials.o: $(OBJDIR)/$(CONFIG)/src/cpp/client/internal_stub.o: $(OBJDIR)/$(CONFIG)/src/cpp/common/call.o: @@ -3372,6 +3376,7 @@ LIBGRPC++_UNSECURE_SRC = \ src/cpp/client/client_unary_call.cc \ src/cpp/client/create_channel.cc \ src/cpp/client/credentials.cc \ + src/cpp/client/generic_stub.cc \ src/cpp/client/insecure_credentials.cc \ src/cpp/client/internal_stub.cc \ src/cpp/common/call.cc \ @@ -3401,6 +3406,7 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/config.h \ include/grpc++/create_channel.h \ include/grpc++/credentials.h \ + include/grpc++/generic_stub.h \ include/grpc++/impl/call.h \ include/grpc++/impl/client_unary_call.h \ include/grpc++/impl/internal_stub.h \ @@ -3474,6 +3480,7 @@ $(OBJDIR)/$(CONFIG)/src/cpp/client/client_context.o: $(OBJDIR)/$(CONFIG)/src/cpp/client/client_unary_call.o: $(OBJDIR)/$(CONFIG)/src/cpp/client/create_channel.o: $(OBJDIR)/$(CONFIG)/src/cpp/client/credentials.o: +$(OBJDIR)/$(CONFIG)/src/cpp/client/generic_stub.o: $(OBJDIR)/$(CONFIG)/src/cpp/client/insecure_credentials.o: $(OBJDIR)/$(CONFIG)/src/cpp/client/internal_stub.o: $(OBJDIR)/$(CONFIG)/src/cpp/common/call.o: diff --git a/build.json b/build.json index 999e140c5a..32bf992892 100644 --- a/build.json +++ b/build.json @@ -22,6 +22,7 @@ "include/grpc++/config.h", "include/grpc++/create_channel.h", "include/grpc++/credentials.h", + "include/grpc++/generic_stub.h", "include/grpc++/impl/call.h", "include/grpc++/impl/client_unary_call.h", "include/grpc++/impl/internal_stub.h", @@ -51,6 +52,7 @@ "src/cpp/client/client_unary_call.cc", "src/cpp/client/create_channel.cc", "src/cpp/client/credentials.cc", + "src/cpp/client/generic_stub.cc", "src/cpp/client/insecure_credentials.cc", "src/cpp/client/internal_stub.cc", "src/cpp/common/call.cc", diff --git a/include/grpc++/generic_stub.h b/include/grpc++/generic_stub.h index 6038d7c66c..25361af0d5 100644 --- a/include/grpc++/generic_stub.h +++ b/include/grpc++/generic_stub.h @@ -39,6 +39,7 @@ namespace grpc { +class CompletionQueue; typedef ClientAsyncReaderWriter GenericClientAsyncReaderWriter; @@ -51,7 +52,8 @@ class GenericStub GRPC_FINAL { // begin a call to a named method std::unique_ptr Call( - ClientContext* context, const grpc::string& method); + ClientContext* context, const grpc::string& method, + CompletionQueue* cq, void* tag); private: std::shared_ptr channel_; diff --git a/src/cpp/client/generic_stub.cc b/src/cpp/client/generic_stub.cc new file mode 100644 index 0000000000..3bf7bdf45f --- /dev/null +++ b/src/cpp/client/generic_stub.cc @@ -0,0 +1,51 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include + +namespace grpc { + +// begin a call to a named method +std::unique_ptr GenericStub::Call( + ClientContext* context, const grpc::string& method, + CompletionQueue* cq, void* tag) { + return std::unique_ptr( + new GenericClientAsyncReaderWriter( + channel_.get(), cq, RpcMethod(method.c_str()), context, tag)); +} + + +} // namespace grpc + -- cgit v1.2.3 From e0f24dc2add401ecf970bff48ae592866d8a6af1 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 19 Mar 2015 11:16:48 -0700 Subject: Added a test for generic client and server constructors --- src/node/test/surface_test.js | 51 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/src/node/test/surface_test.js b/src/node/test/surface_test.js index 6fae483e6c..96b47815e1 100644 --- a/src/node/test/surface_test.js +++ b/src/node/test/surface_test.js @@ -45,6 +45,8 @@ var math_proto = ProtoBuf.loadProtoFile(__dirname + '/../examples/math.proto'); var mathService = math_proto.lookup('math.Math'); +var capitalize = require('underscore.string/capitalize'); + describe('Surface server constructor', function() { it('Should fail with conflicting method names', function() { assert.throws(function() { @@ -75,6 +77,55 @@ describe('Surface server constructor', function() { }, /math.Math/); }); }); +describe('Generic client and server', function() { + function toString(val) { + return val.toString(); + } + function toBuffer(str) { + return new Buffer(str); + } + var string_service_attrs = { + 'capitalize' : { + path: '/string/capitalize', + requestStream: false, + responseStream: false, + requestSerialize: toBuffer, + requestDeserialize: toString, + responseSerialize: toBuffer, + responseDeserialize: toString + } + }; + describe('String client and server', function() { + var client; + var server; + before(function() { + var Server = grpc.makeGenericServerConstructor({ + string: string_service_attrs + }); + server = new Server({ + string: { + capitalize: function(call, callback) { + callback(null, capitalize(call.request)); + } + } + }); + var port = server.bind('localhost:0'); + server.listen(); + var Client = grpc.makeGenericClientConstructor(string_service_attrs); + client = new Client('localhost:' + port); + }); + after(function() { + server.shutdown(); + }); + it('Should respond with a capitalized string', function(done) { + client.capitalize('abc', function(err, response) { + assert.ifError(err); + assert.strictEqual(response, 'Abc'); + done(); + }); + }); + }); +}); describe('Cancelling surface client', function() { var client; var server; -- cgit v1.2.3 From 51f5b917152bf4c704437dfa145d3f090e0267e3 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Thu, 19 Mar 2015 20:18:04 +0100 Subject: Adding missing public files to build.json, and re-generating all project files. --- Makefile | 5 +++++ build.json | 3 +++ vsprojects/vs2013/gpr.vcxproj | 1 + vsprojects/vs2013/gpr.vcxproj.filters | 3 +++ vsprojects/vs2013/gpr_shared.vcxproj | 1 + vsprojects/vs2013/gpr_shared.vcxproj.filters | 3 +++ vsprojects/vs2013/grpc++.vcxproj | 10 ++++++++++ vsprojects/vs2013/grpc++.vcxproj.filters | 21 +++++++++++++++++++++ vsprojects/vs2013/grpc.vcxproj | 1 + vsprojects/vs2013/grpc.vcxproj.filters | 3 +++ vsprojects/vs2013/grpc_shared.vcxproj | 1 + vsprojects/vs2013/grpc_shared.vcxproj.filters | 3 +++ vsprojects/vs2013/grpc_unsecure.vcxproj | 1 + vsprojects/vs2013/grpc_unsecure.vcxproj.filters | 3 +++ 14 files changed, 59 insertions(+) diff --git a/Makefile b/Makefile index 857bde172e..53e396c85d 100644 --- a/Makefile +++ b/Makefile @@ -2331,6 +2331,7 @@ PUBLIC_HEADERS_C += \ include/grpc/support/atm_win32.h \ include/grpc/support/cancellable_platform.h \ include/grpc/support/cmdline.h \ + include/grpc/support/cpu.h \ include/grpc/support/histogram.h \ include/grpc/support/host_port.h \ include/grpc/support/log.h \ @@ -2585,6 +2586,7 @@ PUBLIC_HEADERS_C += \ include/grpc/byte_buffer.h \ include/grpc/byte_buffer_reader.h \ include/grpc/grpc.h \ + include/grpc/grpc_http.h \ include/grpc/status.h \ LIBGRPC_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC_SRC)))) @@ -3066,6 +3068,7 @@ PUBLIC_HEADERS_C += \ include/grpc/byte_buffer.h \ include/grpc/byte_buffer_reader.h \ include/grpc/grpc.h \ + include/grpc/grpc_http.h \ include/grpc/status.h \ LIBGRPC_UNSECURE_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC_UNSECURE_SRC)))) @@ -3239,6 +3242,7 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/config.h \ include/grpc++/create_channel.h \ include/grpc++/credentials.h \ + include/grpc++/generic_stub.h \ include/grpc++/impl/call.h \ include/grpc++/impl/client_unary_call.h \ include/grpc++/impl/internal_stub.h \ @@ -3483,6 +3487,7 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/config.h \ include/grpc++/create_channel.h \ include/grpc++/credentials.h \ + include/grpc++/generic_stub.h \ include/grpc++/impl/call.h \ include/grpc++/impl/client_unary_call.h \ include/grpc++/impl/internal_stub.h \ diff --git a/build.json b/build.json index 999e140c5a..bb39225965 100644 --- a/build.json +++ b/build.json @@ -22,6 +22,7 @@ "include/grpc++/config.h", "include/grpc++/create_channel.h", "include/grpc++/credentials.h", + "include/grpc++/generic_stub.h", "include/grpc++/impl/call.h", "include/grpc++/impl/client_unary_call.h", "include/grpc++/impl/internal_stub.h", @@ -76,6 +77,7 @@ "include/grpc/byte_buffer.h", "include/grpc/byte_buffer_reader.h", "include/grpc/grpc.h", + "include/grpc/grpc_http.h", "include/grpc/status.h" ], "headers": [ @@ -278,6 +280,7 @@ "include/grpc/support/atm_win32.h", "include/grpc/support/cancellable_platform.h", "include/grpc/support/cmdline.h", + "include/grpc/support/cpu.h", "include/grpc/support/histogram.h", "include/grpc/support/host_port.h", "include/grpc/support/log.h", diff --git a/vsprojects/vs2013/gpr.vcxproj b/vsprojects/vs2013/gpr.vcxproj index 3d970079a4..0905b7cfb5 100644 --- a/vsprojects/vs2013/gpr.vcxproj +++ b/vsprojects/vs2013/gpr.vcxproj @@ -85,6 +85,7 @@ + diff --git a/vsprojects/vs2013/gpr.vcxproj.filters b/vsprojects/vs2013/gpr.vcxproj.filters index 9b78c3a390..f6e2b76677 100644 --- a/vsprojects/vs2013/gpr.vcxproj.filters +++ b/vsprojects/vs2013/gpr.vcxproj.filters @@ -123,6 +123,9 @@ include\grpc\support + + include\grpc\support + include\grpc\support diff --git a/vsprojects/vs2013/gpr_shared.vcxproj b/vsprojects/vs2013/gpr_shared.vcxproj index 892490e324..c528890ae1 100644 --- a/vsprojects/vs2013/gpr_shared.vcxproj +++ b/vsprojects/vs2013/gpr_shared.vcxproj @@ -85,6 +85,7 @@ + diff --git a/vsprojects/vs2013/gpr_shared.vcxproj.filters b/vsprojects/vs2013/gpr_shared.vcxproj.filters index 9b78c3a390..f6e2b76677 100644 --- a/vsprojects/vs2013/gpr_shared.vcxproj.filters +++ b/vsprojects/vs2013/gpr_shared.vcxproj.filters @@ -123,6 +123,9 @@ include\grpc\support + + include\grpc\support + include\grpc\support diff --git a/vsprojects/vs2013/grpc++.vcxproj b/vsprojects/vs2013/grpc++.vcxproj index f0a623b79f..6d921e7353 100644 --- a/vsprojects/vs2013/grpc++.vcxproj +++ b/vsprojects/vs2013/grpc++.vcxproj @@ -78,7 +78,9 @@ + + @@ -86,6 +88,7 @@ + @@ -96,6 +99,7 @@ + @@ -136,6 +140,8 @@ + + @@ -148,6 +154,10 @@ + + + + diff --git a/vsprojects/vs2013/grpc++.vcxproj.filters b/vsprojects/vs2013/grpc++.vcxproj.filters index 34ebb170ff..61b3bc537f 100644 --- a/vsprojects/vs2013/grpc++.vcxproj.filters +++ b/vsprojects/vs2013/grpc++.vcxproj.filters @@ -43,6 +43,9 @@ src\cpp\proto + + src\cpp\server + src\cpp\server @@ -61,6 +64,12 @@ src\cpp\server + + src\cpp\util + + + src\cpp\util + src\cpp\util @@ -69,9 +78,15 @@ + + include\grpc++ + include\grpc++ + + include\grpc++ + include\grpc++ @@ -93,6 +108,9 @@ include\grpc++ + + include\grpc++ + include\grpc++\impl @@ -123,6 +141,9 @@ include\grpc++ + + include\grpc++ + include\grpc++ diff --git a/vsprojects/vs2013/grpc.vcxproj b/vsprojects/vs2013/grpc.vcxproj index 9d0bcb3271..51c26384c2 100644 --- a/vsprojects/vs2013/grpc.vcxproj +++ b/vsprojects/vs2013/grpc.vcxproj @@ -82,6 +82,7 @@ + diff --git a/vsprojects/vs2013/grpc.vcxproj.filters b/vsprojects/vs2013/grpc.vcxproj.filters index af38d8de35..152e139dfe 100644 --- a/vsprojects/vs2013/grpc.vcxproj.filters +++ b/vsprojects/vs2013/grpc.vcxproj.filters @@ -363,6 +363,9 @@ include\grpc + + include\grpc + include\grpc diff --git a/vsprojects/vs2013/grpc_shared.vcxproj b/vsprojects/vs2013/grpc_shared.vcxproj index f5575dc3f1..2d1df0cf4f 100644 --- a/vsprojects/vs2013/grpc_shared.vcxproj +++ b/vsprojects/vs2013/grpc_shared.vcxproj @@ -86,6 +86,7 @@ + diff --git a/vsprojects/vs2013/grpc_shared.vcxproj.filters b/vsprojects/vs2013/grpc_shared.vcxproj.filters index af38d8de35..152e139dfe 100644 --- a/vsprojects/vs2013/grpc_shared.vcxproj.filters +++ b/vsprojects/vs2013/grpc_shared.vcxproj.filters @@ -363,6 +363,9 @@ include\grpc + + include\grpc + include\grpc diff --git a/vsprojects/vs2013/grpc_unsecure.vcxproj b/vsprojects/vs2013/grpc_unsecure.vcxproj index ad7bf4762f..7d8d0967af 100644 --- a/vsprojects/vs2013/grpc_unsecure.vcxproj +++ b/vsprojects/vs2013/grpc_unsecure.vcxproj @@ -81,6 +81,7 @@ + diff --git a/vsprojects/vs2013/grpc_unsecure.vcxproj.filters b/vsprojects/vs2013/grpc_unsecure.vcxproj.filters index 205942a450..b5abd6a2f3 100644 --- a/vsprojects/vs2013/grpc_unsecure.vcxproj.filters +++ b/vsprojects/vs2013/grpc_unsecure.vcxproj.filters @@ -300,6 +300,9 @@ include\grpc + + include\grpc + include\grpc -- cgit v1.2.3 From 55420b07bc55748a230ee2e094533e2a0ad4a62e Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Thu, 19 Mar 2015 13:33:55 -0700 Subject: Use protobuf java and nano from Maven Central The protobuf jars are now available from Maven Central. Use them instead of building our own. --- tools/dockerfile/grpc_java_base/Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/dockerfile/grpc_java_base/Dockerfile b/tools/dockerfile/grpc_java_base/Dockerfile index 2ee0a623c7..57b1b90fcd 100644 --- a/tools/dockerfile/grpc_java_base/Dockerfile +++ b/tools/dockerfile/grpc_java_base/Dockerfile @@ -57,8 +57,6 @@ RUN wget -O - https://github.com/google/protobuf/archive/v3.0.0-alpha-2.tar.gz | ./autogen.sh && \ ./configure --prefix=/usr && \ make -j12 && make check && make install && \ - cd java && mvn install && cd .. && \ - cd javanano && mvn install && cd .. && \ rm -r "$(pwd)" # Trigger download of as many Maven and Gradle artifacts as possible. We don't build grpc-java -- cgit v1.2.3 From 993d540e375e067233d8058fa05b2a81c591ba36 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Thu, 19 Mar 2015 13:35:49 -0700 Subject: covert test to use generic stub --- src/cpp/common/call.cc | 1 + test/cpp/end2end/generic_end2end_test.cc | 82 +++++++++++++++++++------------- 2 files changed, 51 insertions(+), 32 deletions(-) diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index ebe7deec70..7119011ec4 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -183,6 +183,7 @@ void CallOpBuffer::AddRecvMessage(grpc::protobuf::Message* message) { void CallOpBuffer::AddRecvMessage(ByteBuffer* message) { recv_message_buffer_ = message; + recv_message_buffer_->Clear(); } void CallOpBuffer::AddClientSendClose() { client_send_close_ = true; } diff --git a/test/cpp/end2end/generic_end2end_test.cc b/test/cpp/end2end/generic_end2end_test.cc index a2faa62865..d46f3edea5 100644 --- a/test/cpp/end2end/generic_end2end_test.cc +++ b/test/cpp/end2end/generic_end2end_test.cc @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -89,6 +90,15 @@ bool ParseFromByteBuffer(ByteBuffer* buffer, grpc::protobuf::Message* message) { return message->ParseFromString(buf); } +std::unique_ptr SerializeToByteBuffer( + grpc::protobuf::Message* message) { + grpc::string buf; + message->SerializeToString(&buf); + gpr_slice s = gpr_slice_from_copied_string(buf.c_str()); + Slice slice(s, Slice::STEAL_REF); + return std::unique_ptr(new ByteBuffer(&slice, 1)); +} + class GenericEnd2endTest : public ::testing::Test { protected: GenericEnd2endTest() : generic_service_("*") {} @@ -118,7 +128,7 @@ class GenericEnd2endTest : public ::testing::Test { void ResetStub() { std::shared_ptr channel = CreateChannel( server_address_.str(), InsecureCredentials(), ChannelArguments()); - stub_ = std::move(grpc::cpp::test::util::TestService::NewStub(channel)); + generic_stub_.reset(new GenericStub(channel)); } void server_ok(int i) { verify_ok(&srv_cq_, i, true); } @@ -127,6 +137,7 @@ class GenericEnd2endTest : public ::testing::Test { void client_fail(int i) { verify_ok(&cli_cq_, i, false); } void SendRpc(int num_rpcs) { + const grpc::string kMethodName("/grpc.cpp.test.util.TestService/Echo"); for (int i = 0; i < num_rpcs; i++) { EchoRequest send_request; EchoRequest recv_request; @@ -139,35 +150,42 @@ class GenericEnd2endTest : public ::testing::Test { GenericServerAsyncReaderWriter stream(&srv_ctx); send_request.set_message("Hello"); - std::unique_ptr > response_reader( - stub_->AsyncEcho(&cli_ctx, send_request, &cli_cq_, tag(1))); + std::unique_ptr call = + generic_stub_->Call(&cli_ctx, kMethodName, &cli_cq_, tag(1)); client_ok(1); + std::unique_ptr send_buffer = + SerializeToByteBuffer(&send_request); + call->Write(*send_buffer, tag(2)); + client_ok(2); + call->WritesDone(tag(3)); + client_ok(3); - generic_service_.RequestCall(&srv_ctx, &stream, &srv_cq_, tag(2)); + generic_service_.RequestCall(&srv_ctx, &stream, &srv_cq_, tag(4)); - verify_ok(generic_service_.completion_queue(), 2, true); + verify_ok(generic_service_.completion_queue(), 4, true); EXPECT_EQ(server_address_.str(), srv_ctx.host()); - EXPECT_EQ("/grpc.cpp.test.util.TestService/Echo", srv_ctx.method()); + EXPECT_EQ(kMethodName, srv_ctx.method()); ByteBuffer recv_buffer; - stream.Read(&recv_buffer, tag(3)); - server_ok(3); + stream.Read(&recv_buffer, tag(5)); + server_ok(5); EXPECT_TRUE(ParseFromByteBuffer(&recv_buffer, &recv_request)); EXPECT_EQ(send_request.message(), recv_request.message()); send_response.set_message(recv_request.message()); - grpc::string buf; - send_response.SerializeToString(&buf); - gpr_slice s = gpr_slice_from_copied_string(buf.c_str()); - Slice slice(s, Slice::STEAL_REF); - ByteBuffer send_buffer(&slice, 1); - stream.Write(send_buffer, tag(4)); - server_ok(4); - - stream.Finish(Status::OK, tag(5)); - server_ok(5); + send_buffer = SerializeToByteBuffer(&send_response); + stream.Write(*send_buffer, tag(6)); + server_ok(6); + + stream.Finish(Status::OK, tag(7)); + server_ok(7); + + recv_buffer.Clear(); + call->Read(&recv_buffer, tag(8)); + client_ok(8); + EXPECT_TRUE(ParseFromByteBuffer(&recv_buffer, &recv_response)); - response_reader->Finish(&recv_response, &recv_status, tag(4)); - client_ok(4); + call->Finish(&recv_status, tag(9)); + client_ok(9); EXPECT_EQ(send_response.message(), recv_response.message()); EXPECT_TRUE(recv_status.IsOk()); @@ -177,6 +195,7 @@ class GenericEnd2endTest : public ::testing::Test { CompletionQueue cli_cq_; CompletionQueue srv_cq_; std::unique_ptr stub_; + std::unique_ptr generic_stub_; std::unique_ptr server_; AsyncGenericService generic_service_; std::ostringstream server_address_; @@ -196,6 +215,7 @@ TEST_F(GenericEnd2endTest, SequentialRpcs) { TEST_F(GenericEnd2endTest, SimpleBidiStreaming) { ResetStub(); + const grpc::string kMethodName("/grpc.cpp.test.util.TestService/BidiStream"); EchoRequest send_request; EchoRequest recv_request; EchoResponse send_response; @@ -206,17 +226,19 @@ TEST_F(GenericEnd2endTest, SimpleBidiStreaming) { GenericServerAsyncReaderWriter srv_stream(&srv_ctx); send_request.set_message("Hello"); - std::unique_ptr > - cli_stream(stub_->AsyncBidiStream(&cli_ctx, &cli_cq_, tag(1))); + std::unique_ptr cli_stream = + generic_stub_->Call(&cli_ctx, kMethodName, &cli_cq_, tag(1)); client_ok(1); generic_service_.RequestCall(&srv_ctx, &srv_stream, &srv_cq_, tag(2)); verify_ok(generic_service_.completion_queue(), 2, true); EXPECT_EQ(server_address_.str(), srv_ctx.host()); - EXPECT_EQ("/grpc.cpp.test.util.TestService/BidiStream", srv_ctx.method()); + EXPECT_EQ(kMethodName, srv_ctx.method()); - cli_stream->Write(send_request, tag(3)); + std::unique_ptr send_buffer = + SerializeToByteBuffer(&send_request); + cli_stream->Write(*send_buffer, tag(3)); client_ok(3); ByteBuffer recv_buffer; @@ -226,22 +248,18 @@ TEST_F(GenericEnd2endTest, SimpleBidiStreaming) { EXPECT_EQ(send_request.message(), recv_request.message()); send_response.set_message(recv_request.message()); - grpc::string buf; - send_response.SerializeToString(&buf); - gpr_slice s = gpr_slice_from_copied_string(buf.c_str()); - Slice slice(s, Slice::STEAL_REF); - ByteBuffer send_buffer(&slice, 1); - srv_stream.Write(send_buffer, tag(5)); + send_buffer = SerializeToByteBuffer(&send_response); + srv_stream.Write(*send_buffer, tag(5)); server_ok(5); - cli_stream->Read(&recv_response, tag(6)); + cli_stream->Read(&recv_buffer, tag(6)); client_ok(6); + EXPECT_TRUE(ParseFromByteBuffer(&recv_buffer, &recv_response)); EXPECT_EQ(send_response.message(), recv_response.message()); cli_stream->WritesDone(tag(7)); client_ok(7); - recv_buffer.Clear(); srv_stream.Read(&recv_buffer, tag(8)); server_fail(8); -- cgit v1.2.3 From 710b6a4ae229024749af341862269c59e776ba17 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Fri, 20 Mar 2015 00:54:10 +0100 Subject: Added a few more missing files and re-generated project files. --- Makefile | 2 ++ build.json | 3 +++ vsprojects/vs2013/gpr.vcxproj | 2 ++ vsprojects/vs2013/gpr.vcxproj.filters | 3 +++ vsprojects/vs2013/gpr_shared.vcxproj | 2 ++ vsprojects/vs2013/gpr_shared.vcxproj.filters | 3 +++ vsprojects/vs2013/grpc.vcxproj | 2 ++ vsprojects/vs2013/grpc.vcxproj.filters | 6 ++++++ vsprojects/vs2013/grpc_shared.vcxproj | 2 ++ vsprojects/vs2013/grpc_shared.vcxproj.filters | 6 ++++++ vsprojects/vs2013/grpc_unsecure.vcxproj | 1 + vsprojects/vs2013/grpc_unsecure.vcxproj.filters | 3 +++ 12 files changed, 35 insertions(+) diff --git a/Makefile b/Makefile index a78887da88..093c2fbe7c 100644 --- a/Makefile +++ b/Makefile @@ -2292,6 +2292,7 @@ LIBGPR_SRC = \ src/core/support/alloc.c \ src/core/support/cancellable.c \ src/core/support/cmdline.c \ + src/core/support/cpu_iphone.c \ src/core/support/cpu_linux.c \ src/core/support/cpu_posix.c \ src/core/support/cpu_windows.c \ @@ -2385,6 +2386,7 @@ endif $(OBJDIR)/$(CONFIG)/src/core/support/alloc.o: $(OBJDIR)/$(CONFIG)/src/core/support/cancellable.o: $(OBJDIR)/$(CONFIG)/src/core/support/cmdline.o: +$(OBJDIR)/$(CONFIG)/src/core/support/cpu_iphone.o: $(OBJDIR)/$(CONFIG)/src/core/support/cpu_linux.o: $(OBJDIR)/$(CONFIG)/src/core/support/cpu_posix.o: $(OBJDIR)/$(CONFIG)/src/core/support/cpu_windows.o: diff --git a/build.json b/build.json index af90cd0339..13057a22a2 100644 --- a/build.json +++ b/build.json @@ -145,6 +145,7 @@ "src/core/surface/init.h", "src/core/surface/server.h", "src/core/surface/surface_trace.h", + "src/core/transport/chttp2/alpn.h", "src/core/transport/chttp2/bin_encoder.h", "src/core/transport/chttp2/frame.h", "src/core/transport/chttp2/frame_data.h", @@ -308,6 +309,7 @@ "src/core/support/alloc.c", "src/core/support/cancellable.c", "src/core/support/cmdline.c", + "src/core/support/cpu_iphone.c", "src/core/support/cpu_linux.c", "src/core/support/cpu_posix.c", "src/core/support/cpu_windows.c", @@ -370,6 +372,7 @@ "src/core/security/base64.h", "src/core/security/credentials.h", "src/core/security/json_token.h", + "src/core/security/secure_endpoint.h", "src/core/security/secure_transport_setup.h", "src/core/security/security_context.h", "src/core/tsi/fake_transport_security.h", diff --git a/vsprojects/vs2013/gpr.vcxproj b/vsprojects/vs2013/gpr.vcxproj index 0905b7cfb5..4b44cc645f 100644 --- a/vsprojects/vs2013/gpr.vcxproj +++ b/vsprojects/vs2013/gpr.vcxproj @@ -116,6 +116,8 @@ + + diff --git a/vsprojects/vs2013/gpr.vcxproj.filters b/vsprojects/vs2013/gpr.vcxproj.filters index f6e2b76677..dffaf1e62d 100644 --- a/vsprojects/vs2013/gpr.vcxproj.filters +++ b/vsprojects/vs2013/gpr.vcxproj.filters @@ -10,6 +10,9 @@ src\core\support + + src\core\support + src\core\support diff --git a/vsprojects/vs2013/gpr_shared.vcxproj b/vsprojects/vs2013/gpr_shared.vcxproj index c528890ae1..85339652ed 100644 --- a/vsprojects/vs2013/gpr_shared.vcxproj +++ b/vsprojects/vs2013/gpr_shared.vcxproj @@ -116,6 +116,8 @@ + + diff --git a/vsprojects/vs2013/gpr_shared.vcxproj.filters b/vsprojects/vs2013/gpr_shared.vcxproj.filters index f6e2b76677..dffaf1e62d 100644 --- a/vsprojects/vs2013/gpr_shared.vcxproj.filters +++ b/vsprojects/vs2013/gpr_shared.vcxproj.filters @@ -10,6 +10,9 @@ src\core\support + + src\core\support + src\core\support diff --git a/vsprojects/vs2013/grpc.vcxproj b/vsprojects/vs2013/grpc.vcxproj index 51c26384c2..754c89985f 100644 --- a/vsprojects/vs2013/grpc.vcxproj +++ b/vsprojects/vs2013/grpc.vcxproj @@ -94,6 +94,7 @@ + @@ -164,6 +165,7 @@ + diff --git a/vsprojects/vs2013/grpc.vcxproj.filters b/vsprojects/vs2013/grpc.vcxproj.filters index 152e139dfe..463a770fb8 100644 --- a/vsprojects/vs2013/grpc.vcxproj.filters +++ b/vsprojects/vs2013/grpc.vcxproj.filters @@ -395,6 +395,9 @@ src\core\security + + src\core\security + src\core\security @@ -605,6 +608,9 @@ src\core\surface + + src\core\transport\chttp2 + src\core\transport\chttp2 diff --git a/vsprojects/vs2013/grpc_shared.vcxproj b/vsprojects/vs2013/grpc_shared.vcxproj index 2d1df0cf4f..927d2051a2 100644 --- a/vsprojects/vs2013/grpc_shared.vcxproj +++ b/vsprojects/vs2013/grpc_shared.vcxproj @@ -98,6 +98,7 @@ + @@ -168,6 +169,7 @@ + diff --git a/vsprojects/vs2013/grpc_shared.vcxproj.filters b/vsprojects/vs2013/grpc_shared.vcxproj.filters index 152e139dfe..463a770fb8 100644 --- a/vsprojects/vs2013/grpc_shared.vcxproj.filters +++ b/vsprojects/vs2013/grpc_shared.vcxproj.filters @@ -395,6 +395,9 @@ src\core\security + + src\core\security + src\core\security @@ -605,6 +608,9 @@ src\core\surface + + src\core\transport\chttp2 + src\core\transport\chttp2 diff --git a/vsprojects/vs2013/grpc_unsecure.vcxproj b/vsprojects/vs2013/grpc_unsecure.vcxproj index 7d8d0967af..e1c1bc890b 100644 --- a/vsprojects/vs2013/grpc_unsecure.vcxproj +++ b/vsprojects/vs2013/grpc_unsecure.vcxproj @@ -149,6 +149,7 @@ + diff --git a/vsprojects/vs2013/grpc_unsecure.vcxproj.filters b/vsprojects/vs2013/grpc_unsecure.vcxproj.filters index b5abd6a2f3..fe966237cb 100644 --- a/vsprojects/vs2013/grpc_unsecure.vcxproj.filters +++ b/vsprojects/vs2013/grpc_unsecure.vcxproj.filters @@ -500,6 +500,9 @@ src\core\surface + + src\core\transport\chttp2 + src\core\transport\chttp2 -- cgit v1.2.3 From 90da75ed2d0b037500d92150f3ac8c238fb0b673 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Fri, 20 Mar 2015 10:00:12 -0700 Subject: Fixed Compute Engine Auth username check --- src/node/interop/interop_client.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/node/interop/interop_client.js b/src/node/interop/interop_client.js index 8060baf827..77804cf595 100644 --- a/src/node/interop/interop_client.js +++ b/src/node/interop/interop_client.js @@ -35,6 +35,7 @@ var fs = require('fs'); var path = require('path'); +var _ = require('underscore'); var grpc = require('..'); var testProto = grpc.load(__dirname + '/test.proto').grpc.testing; var GoogleAuth = require('google-auth-library'); @@ -45,6 +46,8 @@ var AUTH_SCOPE = 'https://www.googleapis.com/auth/xapi.zoo'; var AUTH_SCOPE_RESPONSE = 'xapi.zoo'; var AUTH_USER = ('155450119199-3psnrh1sdr3d8cpj1v46naggf81mhdnk' + '@developer.gserviceaccount.com'); +var COMPUTE_ENGINE_USER = ('155450119199-r5aaqa2vqoa9g5mv2m6s3m1l293rlmel' + + '@developer.gserviceaccount.com'); /** * Create a buffer filled with size zeroes @@ -265,11 +268,12 @@ function cancelAfterFirstResponse(client, done) { /** * Run one of the authentication tests. + * @param {string} expected_user The expected username in the response * @param {Client} client The client to test against * @param {function} done Callback to call when the test is completed. Included * primarily for use with mocha */ -function authTest(client, done) { +function authTest(expected_user, client, done) { (new GoogleAuth()).getApplicationDefault(function(err, credential) { assert.ifError(err); if (credential.createScopedRequired()) { @@ -290,7 +294,7 @@ function authTest(client, done) { assert.strictEqual(resp.payload.type, testProto.PayloadType.COMPRESSABLE); assert.strictEqual(resp.payload.body.limit - resp.payload.body.offset, 314159); - assert.strictEqual(resp.username, AUTH_USER); + assert.strictEqual(resp.username, expected_user); assert.strictEqual(resp.oauth_scope, AUTH_SCOPE_RESPONSE); }); call.on('status', function(status) { @@ -314,8 +318,8 @@ var test_cases = { empty_stream: emptyStream, cancel_after_begin: cancelAfterBegin, cancel_after_first_response: cancelAfterFirstResponse, - compute_engine_creds: authTest, - service_account_creds: authTest + compute_engine_creds: _.partial(authTest, AUTH_USER), + service_account_creds: _.partial(authTest, COMPUTE_ENGINE_USER) }; /** -- cgit v1.2.3 From b7b965c842c4cd238b54a1c8e00fba3edb6a3dc7 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Fri, 20 Mar 2015 15:27:51 -0700 Subject: Make Next free of time_point to timespec conversion --- include/grpc++/completion_queue.h | 7 ++++--- src/cpp/common/completion_queue.cc | 17 ++++++++++------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/include/grpc++/completion_queue.h b/include/grpc++/completion_queue.h index f4619a1060..e6a8c6fe55 100644 --- a/include/grpc++/completion_queue.h +++ b/include/grpc++/completion_queue.h @@ -36,6 +36,7 @@ #include #include +#include struct grpc_completion_queue; @@ -88,9 +89,7 @@ class CompletionQueue { // Returns false if the queue is ready for destruction, true if event bool Next(void** tag, bool* ok) { - return ( - AsyncNext(tag, ok, (std::chrono::system_clock::time_point::max)()) != - SHUTDOWN); + return (AsyncNextInternal(tag, ok, gpr_inf_future) != SHUTDOWN); } // Shutdown has to be called, and the CompletionQueue can only be @@ -122,6 +121,8 @@ class CompletionQueue { const grpc::protobuf::Message& request, grpc::protobuf::Message* result); + NextStatus AsyncNextInternal(void** tag, bool* ok, gpr_timespec deadline); + // Wraps grpc_completion_queue_pluck. // Cannot be mixed with calls to Next(). bool Pluck(CompletionQueueTag* tag); diff --git a/src/cpp/common/completion_queue.cc b/src/cpp/common/completion_queue.cc index fede2da016..cea2d24831 100644 --- a/src/cpp/common/completion_queue.cc +++ b/src/cpp/common/completion_queue.cc @@ -36,7 +36,6 @@ #include #include -#include #include "src/cpp/util/time.h" namespace grpc { @@ -57,15 +56,12 @@ class EventDeleter { } }; -CompletionQueue::NextStatus -CompletionQueue::AsyncNext(void** tag, bool* ok, - std::chrono::system_clock::time_point deadline) { +CompletionQueue::NextStatus CompletionQueue::AsyncNextInternal( + void** tag, bool* ok, gpr_timespec deadline) { std::unique_ptr ev; - gpr_timespec gpr_deadline; - Timepoint2Timespec(deadline, &gpr_deadline); for (;;) { - ev.reset(grpc_completion_queue_next(cq_, gpr_deadline)); + ev.reset(grpc_completion_queue_next(cq_, deadline)); if (!ev) { /* got a NULL back because deadline passed */ return TIMEOUT; } @@ -81,6 +77,13 @@ CompletionQueue::AsyncNext(void** tag, bool* ok, } } +CompletionQueue::NextStatus CompletionQueue::AsyncNext( + void** tag, bool* ok, std::chrono::system_clock::time_point deadline) { + gpr_timespec gpr_deadline; + Timepoint2Timespec(deadline, &gpr_deadline); + return AsyncNextInternal(tag, ok, gpr_deadline); +} + bool CompletionQueue::Pluck(CompletionQueueTag* tag) { std::unique_ptr ev; -- cgit v1.2.3 From 65c803b083a576acbccde803a3fed0ebc21ae83d Mon Sep 17 00:00:00 2001 From: Masood Malekghassemi Date: Fri, 20 Mar 2015 06:48:47 -0700 Subject: Sanitize Python plugin --- src/compiler/python_generator.cc | 119 +++++++++++++++++++-------------------- src/compiler/python_generator.h | 26 +++------ src/compiler/python_plugin.cc | 6 +- 3 files changed, 68 insertions(+), 83 deletions(-) diff --git a/src/compiler/python_generator.cc b/src/compiler/python_generator.cc index 1ec3772f9f..c2d4cda31a 100644 --- a/src/compiler/python_generator.cc +++ b/src/compiler/python_generator.cc @@ -39,30 +39,25 @@ #include #include #include -#include #include #include +#include "grpc++/config.h" +#include "src/compiler/config.h" #include "src/compiler/generator_helpers.h" #include "src/compiler/python_generator.h" -#include -#include -#include -#include -#include -#include using grpc_generator::StringReplace; using grpc_generator::StripProto; -using google::protobuf::Descriptor; -using google::protobuf::FileDescriptor; -using google::protobuf::MethodDescriptor; -using google::protobuf::ServiceDescriptor; -using google::protobuf::compiler::GeneratorContext; -using google::protobuf::io::CodedOutputStream; -using google::protobuf::io::Printer; -using google::protobuf::io::StringOutputStream; -using google::protobuf::io::ZeroCopyOutputStream; +using grpc::protobuf::Descriptor; +using grpc::protobuf::FileDescriptor; +using grpc::protobuf::MethodDescriptor; +using grpc::protobuf::ServiceDescriptor; +using grpc::protobuf::compiler::GeneratorContext; +using grpc::protobuf::io::CodedOutputStream; +using grpc::protobuf::io::Printer; +using grpc::protobuf::io::StringOutputStream; +using grpc::protobuf::io::ZeroCopyOutputStream; using std::initializer_list; using std::make_pair; using std::map; @@ -78,10 +73,10 @@ PythonGrpcGenerator::PythonGrpcGenerator(const GeneratorConfiguration& config) PythonGrpcGenerator::~PythonGrpcGenerator() {} bool PythonGrpcGenerator::Generate( - const FileDescriptor* file, const std::string& parameter, - GeneratorContext* context, std::string* error) const { + const FileDescriptor* file, const grpc::string& parameter, + GeneratorContext* context, grpc::string* error) const { // Get output file name. - std::string file_name; + grpc::string file_name; static const int proto_suffix_length = strlen(".proto"); if (file->name().size() > static_cast(proto_suffix_length) && file->name().find_last_of(".proto") == file->name().size() - 1) { @@ -96,7 +91,7 @@ bool PythonGrpcGenerator::Generate( context->OpenForInsert(file_name, "module_scope")); CodedOutputStream coded_out(output.get()); bool success = false; - std::string code = ""; + grpc::string code = ""; tie(success, code) = grpc_python_generator::GetServices(file, config_); if (success) { coded_out.WriteRaw(code.data(), code.size()); @@ -113,15 +108,15 @@ namespace { // Converts an initializer list of the form { key0, value0, key1, value1, ... } // into a map of key* to value*. Is merely a readability helper for later code. -map ListToDict( - const initializer_list& values) { +map ListToDict( + const initializer_list& values) { assert(values.size() % 2 == 0); - map value_map; + map value_map; auto value_iter = values.begin(); for (unsigned i = 0; i < values.size()/2; ++i) { - std::string key = *value_iter; + grpc::string key = *value_iter; ++value_iter; - std::string value = *value_iter; + grpc::string value = *value_iter; value_map[key] = value; ++value_iter; } @@ -155,8 +150,8 @@ class IndentScope { bool PrintServicer(const ServiceDescriptor* service, Printer* out) { - std::string doc = ""; - map dict = ListToDict({ + grpc::string doc = ""; + map dict = ListToDict({ "Service", service->name(), "Documentation", doc, }); @@ -167,7 +162,7 @@ bool PrintServicer(const ServiceDescriptor* service, out->Print("__metaclass__ = abc.ABCMeta\n"); for (int i = 0; i < service->method_count(); ++i) { auto meth = service->method(i); - std::string arg_name = meth->client_streaming() ? + grpc::string arg_name = meth->client_streaming() ? "request_iterator" : "request"; out->Print("@abc.abstractmethod\n"); out->Print("def $Method$(self, $ArgName$, context):\n", @@ -182,8 +177,8 @@ bool PrintServicer(const ServiceDescriptor* service, } bool PrintServer(const ServiceDescriptor* service, Printer* out) { - std::string doc = ""; - map dict = ListToDict({ + grpc::string doc = ""; + map dict = ListToDict({ "Service", service->name(), "Documentation", doc, }); @@ -211,8 +206,8 @@ bool PrintServer(const ServiceDescriptor* service, Printer* out) { bool PrintStub(const ServiceDescriptor* service, Printer* out) { - std::string doc = ""; - map dict = ListToDict({ + grpc::string doc = ""; + map dict = ListToDict({ "Service", service->name(), "Documentation", doc, }); @@ -223,7 +218,7 @@ bool PrintStub(const ServiceDescriptor* service, out->Print("__metaclass__ = abc.ABCMeta\n"); for (int i = 0; i < service->method_count(); ++i) { const MethodDescriptor* meth = service->method(i); - std::string arg_name = meth->client_streaming() ? + grpc::string arg_name = meth->client_streaming() ? "request_iterator" : "request"; auto methdict = ListToDict({"Method", meth->name(), "ArgName", arg_name}); out->Print("@abc.abstractmethod\n"); @@ -240,29 +235,29 @@ bool PrintStub(const ServiceDescriptor* service, // TODO(protobuf team): Export `ModuleName` from protobuf's // `src/google/protobuf/compiler/python/python_generator.cc` file. -std::string ModuleName(const std::string& filename) { - std::string basename = StripProto(filename); +grpc::string ModuleName(const grpc::string& filename) { + grpc::string basename = StripProto(filename); basename = StringReplace(basename, "-", "_"); basename = StringReplace(basename, "/", "."); return basename + "_pb2"; } bool GetModuleAndMessagePath(const Descriptor* type, - pair* out) { + pair* out) { const Descriptor* path_elem_type = type; vector message_path; do { message_path.push_back(path_elem_type); path_elem_type = path_elem_type->containing_type(); } while (path_elem_type != nullptr); - std::string file_name = type->file()->name(); + grpc::string file_name = type->file()->name(); static const int proto_suffix_length = strlen(".proto"); if (!(file_name.size() > static_cast(proto_suffix_length) && file_name.find_last_of(".proto") == file_name.size() - 1)) { return false; } - std::string module = ModuleName(file_name); - std::string message_type; + grpc::string module = ModuleName(file_name); + grpc::string message_type; for (auto path_iter = message_path.rbegin(); path_iter != message_path.rend(); ++path_iter) { message_type += (*path_iter)->name() + "."; @@ -273,30 +268,30 @@ bool GetModuleAndMessagePath(const Descriptor* type, return true; } -bool PrintServerFactory(const std::string& package_qualified_service_name, +bool PrintServerFactory(const grpc::string& package_qualified_service_name, const ServiceDescriptor* service, Printer* out) { out->Print("def early_adopter_create_$Service$_server(servicer, port, " "root_certificates, key_chain_pairs):\n", "Service", service->name()); { IndentScope raii_create_server_indent(out); - map method_description_constructors; - map> + map method_description_constructors; + map> input_message_modules_and_classes; - map> + map> output_message_modules_and_classes; for (int i = 0; i < service->method_count(); ++i) { const MethodDescriptor* method = service->method(i); - const std::string method_description_constructor = - std::string(method->client_streaming() ? "stream_" : "unary_") + - std::string(method->server_streaming() ? "stream_" : "unary_") + + const grpc::string method_description_constructor = + grpc::string(method->client_streaming() ? "stream_" : "unary_") + + grpc::string(method->server_streaming() ? "stream_" : "unary_") + "service_description"; - pair input_message_module_and_class; + pair input_message_module_and_class; if (!GetModuleAndMessagePath(method->input_type(), &input_message_module_and_class)) { return false; } - pair output_message_module_and_class; + pair output_message_module_and_class; if (!GetModuleAndMessagePath(method->output_type(), &output_message_module_and_class)) { return false; @@ -317,7 +312,7 @@ bool PrintServerFactory(const std::string& package_qualified_service_name, for (auto& name_and_description_constructor : method_description_constructors) { IndentScope raii_descriptions_indent(out); - const std::string method_name = name_and_description_constructor.first; + const grpc::string method_name = name_and_description_constructor.first; auto input_message_module_and_class = input_message_modules_and_classes.find(method_name); auto output_message_module_and_class = @@ -350,31 +345,31 @@ bool PrintServerFactory(const std::string& package_qualified_service_name, return true; } -bool PrintStubFactory(const std::string& package_qualified_service_name, +bool PrintStubFactory(const grpc::string& package_qualified_service_name, const ServiceDescriptor* service, Printer* out) { - map dict = ListToDict({ + map dict = ListToDict({ "Service", service->name(), }); out->Print(dict, "def early_adopter_create_$Service$_stub(host, port):\n"); { IndentScope raii_create_server_indent(out); - map method_description_constructors; - map> + map method_description_constructors; + map> input_message_modules_and_classes; - map> + map> output_message_modules_and_classes; for (int i = 0; i < service->method_count(); ++i) { const MethodDescriptor* method = service->method(i); - const std::string method_description_constructor = - std::string(method->client_streaming() ? "stream_" : "unary_") + - std::string(method->server_streaming() ? "stream_" : "unary_") + + const grpc::string method_description_constructor = + grpc::string(method->client_streaming() ? "stream_" : "unary_") + + grpc::string(method->server_streaming() ? "stream_" : "unary_") + "invocation_description"; - pair input_message_module_and_class; + pair input_message_module_and_class; if (!GetModuleAndMessagePath(method->input_type(), &input_message_module_and_class)) { return false; } - pair output_message_module_and_class; + pair output_message_module_and_class; if (!GetModuleAndMessagePath(method->output_type(), &output_message_module_and_class)) { return false; @@ -395,7 +390,7 @@ bool PrintStubFactory(const std::string& package_qualified_service_name, for (auto& name_and_description_constructor : method_description_constructors) { IndentScope raii_descriptions_indent(out); - const std::string method_name = name_and_description_constructor.first; + const grpc::string method_name = name_and_description_constructor.first; auto input_message_module_and_class = input_message_modules_and_classes.find(method_name); auto output_message_module_and_class = @@ -437,9 +432,9 @@ bool PrintPreamble(const FileDescriptor* file, } // namespace -pair GetServices(const FileDescriptor* file, +pair GetServices(const FileDescriptor* file, const GeneratorConfiguration& config) { - std::string output; + grpc::string output; { // Scope the output stream so it closes and finalizes output to the string. StringOutputStream output_stream(&output); diff --git a/src/compiler/python_generator.h b/src/compiler/python_generator.h index 67686dbdfe..b47f3c1243 100644 --- a/src/compiler/python_generator.h +++ b/src/compiler/python_generator.h @@ -34,41 +34,33 @@ #ifndef GRPC_INTERNAL_COMPILER_PYTHON_GENERATOR_H #define GRPC_INTERNAL_COMPILER_PYTHON_GENERATOR_H -#include #include -#include -#include - -namespace google { -namespace protobuf { -class FileDescriptor; -} // namespace protobuf -} // namespace google +#include "src/compiler/config.h" namespace grpc_python_generator { // Data pertaining to configuration of the generator with respect to anything // that may be used internally at Google. struct GeneratorConfiguration { - std::string implementations_package_root; + grpc::string implementations_package_root; }; -class PythonGrpcGenerator : public google::protobuf::compiler::CodeGenerator { +class PythonGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { public: PythonGrpcGenerator(const GeneratorConfiguration& config); ~PythonGrpcGenerator(); - bool Generate(const google::protobuf::FileDescriptor* file, - const std::string& parameter, - google::protobuf::compiler::GeneratorContext* context, - std::string* error) const; + bool Generate(const grpc::protobuf::FileDescriptor* file, + const grpc::string& parameter, + grpc::protobuf::compiler::GeneratorContext* context, + grpc::string* error) const; private: GeneratorConfiguration config_; }; -std::pair GetServices( - const google::protobuf::FileDescriptor* file, +std::pair GetServices( + const grpc::protobuf::FileDescriptor* file, const GeneratorConfiguration& config); } // namespace grpc_python_generator diff --git a/src/compiler/python_plugin.cc b/src/compiler/python_plugin.cc index 4f59ec9164..d1f49442da 100644 --- a/src/compiler/python_plugin.cc +++ b/src/compiler/python_plugin.cc @@ -33,14 +33,12 @@ // Generates a Python gRPC service interface out of Protobuf IDL. +#include "src/compiler/config.h" #include "src/compiler/python_generator.h" -#include - -using google::protobuf::compiler::PluginMain; int main(int argc, char* argv[]) { grpc_python_generator::GeneratorConfiguration config; config.implementations_package_root = "grpc.early_adopter"; grpc_python_generator::PythonGrpcGenerator generator(config); - return PluginMain(argc, argv, &generator); + return grpc::protobuf::compiler::PluginMain(argc, argv, &generator); } -- cgit v1.2.3 From 8ca92d6ef117978f938ae349a38e202377f698cf Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Sat, 21 Mar 2015 01:11:23 +0100 Subject: Upgrading to OpenSSL 1.0.2a - https://www.openssl.org/news/secadv_20150319.txt We'll have to be extra careful when reviewing future pull requests that people aren't reverting that one by accident. It's going to be a common issue. --- third_party/openssl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/openssl b/third_party/openssl index 4ac0329582..3df69d3aef 160000 --- a/third_party/openssl +++ b/third_party/openssl @@ -1 +1 @@ -Subproject commit 4ac0329582829f5378d8078c8d314ad37db87736 +Subproject commit 3df69d3aefde7671053d4e3c242b228e5d79c83f -- cgit v1.2.3 From cdb2a6e071dd57c1cf6f3658d3954bf959519be5 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Fri, 20 Mar 2015 23:55:04 -0700 Subject: Protect on some overflow scenarios, add a test and build/run the test --- Makefile | 47 +++++++++++++++++++++++++++++++++++++++++++++- build.json | 15 +++++++++++++++ src/cpp/util/time.cc | 6 +++++- test/cpp/util/time_test.cc | 15 ++++++++++++++- tools/run_tests/tests.json | 5 +++++ 5 files changed, 85 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 093c2fbe7c..0742994982 100644 --- a/Makefile +++ b/Makefile @@ -617,6 +617,7 @@ transport_security_test: $(BINDIR)/$(CONFIG)/transport_security_test async_end2end_test: $(BINDIR)/$(CONFIG)/async_end2end_test channel_arguments_test: $(BINDIR)/$(CONFIG)/channel_arguments_test credentials_test: $(BINDIR)/$(CONFIG)/credentials_test +cxx_time_test: $(BINDIR)/$(CONFIG)/cxx_time_test end2end_test: $(BINDIR)/$(CONFIG)/end2end_test generic_end2end_test: $(BINDIR)/$(CONFIG)/generic_end2end_test grpc_cpp_plugin: $(BINDIR)/$(CONFIG)/grpc_cpp_plugin @@ -1069,7 +1070,7 @@ buildtests: buildtests_c buildtests_cxx buildtests_c: privatelibs_c $(BINDIR)/$(CONFIG)/alarm_heap_test $(BINDIR)/$(CONFIG)/alarm_list_test $(BINDIR)/$(CONFIG)/alarm_test $(BINDIR)/$(CONFIG)/alpn_test $(BINDIR)/$(CONFIG)/bin_encoder_test $(BINDIR)/$(CONFIG)/census_hash_table_test $(BINDIR)/$(CONFIG)/census_statistics_multiple_writers_circular_buffer_test $(BINDIR)/$(CONFIG)/census_statistics_multiple_writers_test $(BINDIR)/$(CONFIG)/census_statistics_performance_test $(BINDIR)/$(CONFIG)/census_statistics_quick_test $(BINDIR)/$(CONFIG)/census_statistics_small_log_test $(BINDIR)/$(CONFIG)/census_stub_test $(BINDIR)/$(CONFIG)/census_window_stats_test $(BINDIR)/$(CONFIG)/chttp2_status_conversion_test $(BINDIR)/$(CONFIG)/chttp2_stream_encoder_test $(BINDIR)/$(CONFIG)/chttp2_stream_map_test $(BINDIR)/$(CONFIG)/chttp2_transport_end2end_test $(BINDIR)/$(CONFIG)/dualstack_socket_test $(BINDIR)/$(CONFIG)/echo_client $(BINDIR)/$(CONFIG)/echo_server $(BINDIR)/$(CONFIG)/echo_test $(BINDIR)/$(CONFIG)/fd_posix_test $(BINDIR)/$(CONFIG)/fling_client $(BINDIR)/$(CONFIG)/fling_server $(BINDIR)/$(CONFIG)/fling_stream_test $(BINDIR)/$(CONFIG)/fling_test $(BINDIR)/$(CONFIG)/gpr_cancellable_test $(BINDIR)/$(CONFIG)/gpr_cmdline_test $(BINDIR)/$(CONFIG)/gpr_env_test $(BINDIR)/$(CONFIG)/gpr_file_test $(BINDIR)/$(CONFIG)/gpr_histogram_test $(BINDIR)/$(CONFIG)/gpr_host_port_test $(BINDIR)/$(CONFIG)/gpr_log_test $(BINDIR)/$(CONFIG)/gpr_slice_buffer_test $(BINDIR)/$(CONFIG)/gpr_slice_test $(BINDIR)/$(CONFIG)/gpr_string_test $(BINDIR)/$(CONFIG)/gpr_sync_test $(BINDIR)/$(CONFIG)/gpr_thd_test $(BINDIR)/$(CONFIG)/gpr_time_test $(BINDIR)/$(CONFIG)/gpr_useful_test $(BINDIR)/$(CONFIG)/grpc_base64_test $(BINDIR)/$(CONFIG)/grpc_byte_buffer_reader_test $(BINDIR)/$(CONFIG)/grpc_channel_stack_test $(BINDIR)/$(CONFIG)/grpc_completion_queue_test $(BINDIR)/$(CONFIG)/grpc_credentials_test $(BINDIR)/$(CONFIG)/grpc_json_token_test $(BINDIR)/$(CONFIG)/grpc_stream_op_test $(BINDIR)/$(CONFIG)/hpack_parser_test $(BINDIR)/$(CONFIG)/hpack_table_test $(BINDIR)/$(CONFIG)/httpcli_format_request_test $(BINDIR)/$(CONFIG)/httpcli_parser_test $(BINDIR)/$(CONFIG)/httpcli_test $(BINDIR)/$(CONFIG)/json_rewrite $(BINDIR)/$(CONFIG)/json_rewrite_test $(BINDIR)/$(CONFIG)/json_test $(BINDIR)/$(CONFIG)/lame_client_test $(BINDIR)/$(CONFIG)/message_compress_test $(BINDIR)/$(CONFIG)/metadata_buffer_test $(BINDIR)/$(CONFIG)/multi_init_test $(BINDIR)/$(CONFIG)/murmur_hash_test $(BINDIR)/$(CONFIG)/no_server_test $(BINDIR)/$(CONFIG)/poll_kick_posix_test $(BINDIR)/$(CONFIG)/resolve_address_test $(BINDIR)/$(CONFIG)/secure_endpoint_test $(BINDIR)/$(CONFIG)/sockaddr_utils_test $(BINDIR)/$(CONFIG)/tcp_client_posix_test $(BINDIR)/$(CONFIG)/tcp_posix_test $(BINDIR)/$(CONFIG)/tcp_server_posix_test $(BINDIR)/$(CONFIG)/time_averaged_stats_test $(BINDIR)/$(CONFIG)/time_test $(BINDIR)/$(CONFIG)/timeout_encoding_test $(BINDIR)/$(CONFIG)/transport_metadata_test $(BINDIR)/$(CONFIG)/transport_security_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_no_op_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_thread_stress_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_writes_done_hangs_with_pending_read_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_accept_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_accept_and_writes_closed_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_before_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_in_a_vacuum_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_census_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_disappearing_server_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_early_server_shutdown_finishes_inflight_calls_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_early_server_shutdown_finishes_tags_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_graceful_server_shutdown_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_invoke_large_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_max_concurrent_streams_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_no_op_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_ping_pong_streaming_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_binary_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_trailing_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_with_large_metadata_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_simple_delayed_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_thread_stress_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_writes_done_hangs_with_pending_read_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_no_op_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_thread_stress_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_writes_done_hangs_with_pending_read_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_accept_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_accept_and_writes_closed_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_before_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_in_a_vacuum_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_census_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_disappearing_server_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_inflight_calls_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_tags_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_graceful_server_shutdown_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_invoke_large_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_max_concurrent_streams_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_no_op_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_ping_pong_streaming_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_binary_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_trailing_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_large_metadata_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_delayed_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_thread_stress_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_writes_done_hangs_with_pending_read_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_no_op_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_thread_stress_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_writes_done_hangs_with_pending_read_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_accept_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_accept_and_writes_closed_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_before_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_in_a_vacuum_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_census_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_disappearing_server_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_early_server_shutdown_finishes_inflight_calls_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_early_server_shutdown_finishes_tags_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_graceful_server_shutdown_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_invoke_large_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_max_concurrent_streams_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_no_op_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_ping_pong_streaming_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_binary_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_trailing_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_with_large_metadata_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_delayed_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_thread_stress_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_writes_done_hangs_with_pending_read_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_no_op_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_thread_stress_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_writes_done_hangs_with_pending_read_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_accept_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_accept_and_writes_closed_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_before_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_in_a_vacuum_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_census_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_disappearing_server_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_early_server_shutdown_finishes_inflight_calls_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_early_server_shutdown_finishes_tags_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_graceful_server_shutdown_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_invoke_large_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_max_concurrent_streams_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_no_op_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_ping_pong_streaming_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_binary_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_trailing_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_large_metadata_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_delayed_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_thread_stress_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_writes_done_hangs_with_pending_read_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_no_op_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_thread_stress_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_writes_done_hangs_with_pending_read_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_and_writes_closed_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_before_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_in_a_vacuum_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_census_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_disappearing_server_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_early_server_shutdown_finishes_inflight_calls_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_early_server_shutdown_finishes_tags_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_graceful_server_shutdown_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_invoke_large_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_max_concurrent_streams_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_no_op_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_ping_pong_streaming_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_binary_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_trailing_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_large_metadata_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_delayed_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_thread_stress_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_writes_done_hangs_with_pending_read_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_no_op_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_thread_stress_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_writes_done_hangs_with_pending_read_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_and_writes_closed_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_before_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_in_a_vacuum_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_census_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_disappearing_server_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_inflight_calls_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_tags_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_graceful_server_shutdown_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_invoke_large_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_max_concurrent_streams_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_no_op_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_ping_pong_streaming_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_binary_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_large_metadata_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_delayed_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_thread_stress_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_writes_done_hangs_with_pending_read_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_no_op_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_thread_stress_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_writes_done_hangs_with_pending_read_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_and_writes_closed_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_before_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_in_a_vacuum_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_census_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_disappearing_server_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_inflight_calls_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_tags_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_graceful_server_shutdown_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_invoke_large_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_max_concurrent_streams_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_no_op_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_ping_pong_streaming_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_binary_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_large_metadata_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_delayed_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_thread_stress_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_writes_done_hangs_with_pending_read_legacy_test -buildtests_cxx: privatelibs_cxx $(BINDIR)/$(CONFIG)/async_end2end_test $(BINDIR)/$(CONFIG)/channel_arguments_test $(BINDIR)/$(CONFIG)/credentials_test $(BINDIR)/$(CONFIG)/end2end_test $(BINDIR)/$(CONFIG)/generic_end2end_test $(BINDIR)/$(CONFIG)/interop_client $(BINDIR)/$(CONFIG)/interop_server $(BINDIR)/$(CONFIG)/interop_test $(BINDIR)/$(CONFIG)/pubsub_client $(BINDIR)/$(CONFIG)/pubsub_publisher_test $(BINDIR)/$(CONFIG)/pubsub_subscriber_test $(BINDIR)/$(CONFIG)/qps_driver $(BINDIR)/$(CONFIG)/qps_worker $(BINDIR)/$(CONFIG)/status_test $(BINDIR)/$(CONFIG)/thread_pool_test +buildtests_cxx: privatelibs_cxx $(BINDIR)/$(CONFIG)/async_end2end_test $(BINDIR)/$(CONFIG)/channel_arguments_test $(BINDIR)/$(CONFIG)/credentials_test $(BINDIR)/$(CONFIG)/cxx_time_test $(BINDIR)/$(CONFIG)/end2end_test $(BINDIR)/$(CONFIG)/generic_end2end_test $(BINDIR)/$(CONFIG)/interop_client $(BINDIR)/$(CONFIG)/interop_server $(BINDIR)/$(CONFIG)/interop_test $(BINDIR)/$(CONFIG)/pubsub_client $(BINDIR)/$(CONFIG)/pubsub_publisher_test $(BINDIR)/$(CONFIG)/pubsub_subscriber_test $(BINDIR)/$(CONFIG)/qps_driver $(BINDIR)/$(CONFIG)/qps_worker $(BINDIR)/$(CONFIG)/status_test $(BINDIR)/$(CONFIG)/thread_pool_test test: test_c test_cxx @@ -1903,6 +1904,8 @@ test_cxx: buildtests_cxx $(Q) $(BINDIR)/$(CONFIG)/channel_arguments_test || ( echo test channel_arguments_test failed ; exit 1 ) $(E) "[RUN] Testing credentials_test" $(Q) $(BINDIR)/$(CONFIG)/credentials_test || ( echo test credentials_test failed ; exit 1 ) + $(E) "[RUN] Testing cxx_time_test" + $(Q) $(BINDIR)/$(CONFIG)/cxx_time_test || ( echo test cxx_time_test failed ; exit 1 ) $(E) "[RUN] Testing end2end_test" $(Q) $(BINDIR)/$(CONFIG)/end2end_test || ( echo test end2end_test failed ; exit 1 ) $(E) "[RUN] Testing generic_end2end_test" @@ -8058,6 +8061,48 @@ endif endif +CXX_TIME_TEST_SRC = \ + test/cpp/util/time_test.cc \ + +CXX_TIME_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(CXX_TIME_TEST_SRC)))) + +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL with ALPN. + +$(BINDIR)/$(CONFIG)/cxx_time_test: openssl_dep_error + +else + + +ifeq ($(NO_PROTOBUF),true) + +# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. + +$(BINDIR)/$(CONFIG)/cxx_time_test: protobuf_dep_error + +else + +$(BINDIR)/$(CONFIG)/cxx_time_test: $(PROTOBUF_DEP) $(CXX_TIME_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LDXX) $(LDFLAGS) $(CXX_TIME_TEST_OBJS) $(GTEST_LIB) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/cxx_time_test + +endif + +endif + +$(OBJDIR)/$(CONFIG)/test/cpp/util/time_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + +deps_cxx_time_test: $(CXX_TIME_TEST_OBJS:.o=.dep) + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(CXX_TIME_TEST_OBJS:.o=.dep) +endif +endif + + END2END_TEST_SRC = \ test/cpp/end2end/end2end_test.cc \ diff --git a/build.json b/build.json index 13057a22a2..a46866263f 100644 --- a/build.json +++ b/build.json @@ -1707,6 +1707,21 @@ "gpr" ] }, + { + "name": "cxx_time_test", + "build": "test", + "language": "c++", + "src": [ + "test/cpp/util/time_test.cc" + ], + "deps": [ + "grpc_test_util", + "grpc++", + "grpc", + "gpr_test_util", + "gpr" + ] + }, { "name": "end2end_test", "build": "test", diff --git a/src/cpp/util/time.cc b/src/cpp/util/time.cc index 44d2283e76..059ea72abf 100644 --- a/src/cpp/util/time.cc +++ b/src/cpp/util/time.cc @@ -42,11 +42,15 @@ using std::chrono::system_clock; namespace grpc { -// TODO(yangg) prevent potential overflow. void Timepoint2Timespec(const system_clock::time_point& from, gpr_timespec* to) { system_clock::duration deadline = from.time_since_epoch(); seconds secs = duration_cast(deadline); + if (from == system_clock::time_point::max() || + secs.count() >= gpr_inf_future.tv_sec || secs.count() < 0) { + *to = gpr_inf_future; + return; + } nanoseconds nsecs = duration_cast(deadline - secs); to->tv_sec = secs.count(); to->tv_nsec = nsecs.count(); diff --git a/test/cpp/util/time_test.cc b/test/cpp/util/time_test.cc index 2e17add67f..4641fdb4da 100644 --- a/test/cpp/util/time_test.cc +++ b/test/cpp/util/time_test.cc @@ -61,11 +61,24 @@ TEST_F(TimeTest, AbsolutePointTest) { EXPECT_TRUE(tp == tp_converted_2); } -// gpr_inf_future is treated specially and mapped to time_point::max() +// gpr_inf_future is treated specially and mapped to/from time_point::max() TEST_F(TimeTest, InfFuture) { EXPECT_EQ(system_clock::time_point::max(), Timespec2Timepoint(gpr_inf_future)); + gpr_timespec from_time_point_max; + Timepoint2Timespec(system_clock::time_point::max(), &from_time_point_max); + EXPECT_EQ(0, gpr_time_cmp(gpr_inf_future, from_time_point_max)); + // This will cause an overflow + Timepoint2Timespec( + std::chrono::time_point::max(), + &from_time_point_max); + EXPECT_EQ(0, gpr_time_cmp(gpr_inf_future, from_time_point_max)); } } // namespace } // namespace grpc + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json index 355d5735cd..0150fd4a5d 100644 --- a/tools/run_tests/tests.json +++ b/tools/run_tests/tests.json @@ -351,6 +351,11 @@ "language": "c++", "name": "credentials_test" }, + { + "flaky": false, + "language": "c++", + "name": "cxx_time_test" + }, { "flaky": false, "language": "c++", -- cgit v1.2.3 From 8c8588c7dc047ee509c7367f61ba0c5f00cb61d1 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Sun, 22 Mar 2015 12:39:10 -0700 Subject: Remove dead members of server context --- include/grpc++/server_context.h | 3 --- src/cpp/server/server_context.cc | 6 ------ 2 files changed, 9 deletions(-) diff --git a/include/grpc++/server_context.h b/include/grpc++/server_context.h index 9e3b80c641..36cbae87a0 100644 --- a/include/grpc++/server_context.h +++ b/include/grpc++/server_context.h @@ -78,8 +78,6 @@ class ServerContext { void AddInitialMetadata(const grpc::string& key, const grpc::string& value); void AddTrailingMetadata(const grpc::string& key, const grpc::string& value); - bool IsCancelled(); - const std::multimap& client_metadata() { return client_metadata_; } @@ -112,7 +110,6 @@ class ServerContext { std::chrono::system_clock::time_point deadline_; grpc_call* call_; - CompletionQueue* cq_; bool sent_initial_metadata_; std::multimap client_metadata_; std::multimap initial_metadata_; diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index bb3c2d1405..435a060be5 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -94,7 +94,6 @@ bool ServerContext::CompletionOp::FinalizeResult(void** tag, bool* status) { ServerContext::ServerContext() : completion_op_(nullptr), call_(nullptr), - cq_(nullptr), sent_initial_metadata_(false) {} ServerContext::ServerContext(gpr_timespec deadline, grpc_metadata* metadata, @@ -102,7 +101,6 @@ ServerContext::ServerContext(gpr_timespec deadline, grpc_metadata* metadata, : completion_op_(nullptr), deadline_(Timespec2Timepoint(deadline)), call_(nullptr), - cq_(nullptr), sent_initial_metadata_(false) { for (size_t i = 0; i < metadata_count; i++) { client_metadata_.insert(std::make_pair( @@ -137,8 +135,4 @@ void ServerContext::AddTrailingMetadata(const grpc::string& key, trailing_metadata_.insert(std::make_pair(key, value)); } -bool ServerContext::IsCancelled() { - return completion_op_ && completion_op_->CheckCancelled(cq_); -} - } // namespace grpc -- cgit v1.2.3 From 1205f6f534412f3e2deb88b86f66ae58b07aab8a Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Sun, 22 Mar 2015 15:18:14 -0700 Subject: Set cq_ on servercontext --- src/cpp/server/server.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index 5a4ca6915a..9dbf3392d8 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -107,6 +107,7 @@ class Server::SyncRequest GRPC_FINAL : public CompletionQueueTag { request_payload_(mrd->request_payload_), method_(mrd->method_) { ctx_.call_ = mrd->call_; + ctx_.cq_ = &cq_; GPR_ASSERT(mrd->in_flight_); mrd->in_flight_ = false; mrd->request_metadata_.count = 0; @@ -364,6 +365,7 @@ class Server::AsyncRequest GRPC_FINAL : public CompletionQueueTag { } } ctx->call_ = call_; + ctx->cq_ = cq_; Call call(call_, server_, cq_); if (orig_status && call_) { ctx->BeginCompletionOp(&call); -- cgit v1.2.3 From 8931cc1dd5de85c3c4b4a348b31321a902a57670 Mon Sep 17 00:00:00 2001 From: Julien Boeuf Date: Mon, 23 Mar 2015 09:59:57 -0700 Subject: Adding a test to check the openssl version we are using. --- test/core/tsi/transport_security_test.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/core/tsi/transport_security_test.c b/test/core/tsi/transport_security_test.c index c5882af966..d591e43faa 100644 --- a/test/core/tsi/transport_security_test.c +++ b/test/core/tsi/transport_security_test.c @@ -39,10 +39,15 @@ #include #include +#include + #include "src/core/support/string.h" #include "src/core/tsi/ssl_transport_security.h" #include "test/core/util/test_config.h" +/* Currently points to 1.0.2a. */ +#define GRPC_MIN_OPENSSL_VERSION_NUMBER 0x1000201fL + typedef struct { /* 1 if success, 0 if failure. */ int expected; @@ -296,8 +301,13 @@ static void test_peer_matches_name(void) { } } +static void test_openssl_version(void) { + GPR_ASSERT(OPENSSL_VERSION_NUMBER >= GRPC_MIN_OPENSSL_VERSION_NUMBER); +} + int main(int argc, char **argv) { grpc_test_init(argc, argv); test_peer_matches_name(); + test_openssl_version(); return 0; } -- cgit v1.2.3 From 46f65239cf5bb55c106558196b9f293188746ef7 Mon Sep 17 00:00:00 2001 From: vjpai Date: Mon, 23 Mar 2015 10:10:27 -0700 Subject: Added streaming C++ tests for sync and sync cases --- test/cpp/qps/client.h | 16 ++-- test/cpp/qps/client_async.cc | 173 ++++++++++++++++++++++++++++++++++++++----- test/cpp/qps/client_sync.cc | 70 ++++++++++++++--- test/cpp/qps/qpstest.proto | 78 ++++--------------- test/cpp/qps/server.cc | 2 +- test/cpp/qps/server_async.cc | 126 ++++++++++++++++++++++++++----- test/cpp/qps/server_sync.cc | 19 ++++- test/cpp/qps/worker.cc | 7 +- 8 files changed, 369 insertions(+), 122 deletions(-) diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h index 221fb30fc5..cae7f44537 100644 --- a/test/cpp/qps/client.h +++ b/test/cpp/qps/client.h @@ -115,12 +115,12 @@ class Client { impl_([this, idx, client]() { for (;;) { // run the loop body - client->ThreadFunc(&histogram_, idx); + client->ThreadFunc(&histogram_, idx); // lock, see if we're done std::lock_guard g(mu_); - if (done_) return; - // also check if we're marking, and swap out the histogram if so - if (new_) { + if (done_) {return;} + // check if we're marking, swap out the histogram if so + if (new_) { new_->Swap(&histogram_); new_ = nullptr; cv_.notify_one(); @@ -164,8 +164,12 @@ class Client { std::unique_ptr timer_; }; -std::unique_ptr CreateSynchronousClient(const ClientConfig& args); -std::unique_ptr CreateAsyncClient(const ClientConfig& args); +std::unique_ptr + CreateSynchronousUnaryClient(const ClientConfig& args); +std::unique_ptr + CreateSynchronousStreamingClient(const ClientConfig& args); +std::unique_ptr CreateAsyncUnaryClient(const ClientConfig& args); +std::unique_ptr CreateAsyncStreamingClient(const ClientConfig& args); } // namespace testing } // namespace grpc diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc index c6535bebf8..30317d11e1 100644 --- a/test/cpp/qps/client_async.cc +++ b/test/cpp/qps/client_async.cc @@ -46,6 +46,7 @@ #include #include #include +#include #include "test/core/util/grpc_profiler.h" #include "test/cpp/util/create_test_channel.h" #include "test/cpp/qps/qpstest.pb.h" @@ -59,13 +60,13 @@ class ClientRpcContext { public: ClientRpcContext() {} virtual ~ClientRpcContext() {} - virtual bool RunNextState() = 0; // do next state, return false if steps done + // next state, return false if done. Collect stats when appropriate + virtual bool RunNextState(bool, Histogram *hist) = 0; virtual void StartNewClone() = 0; static void *tag(ClientRpcContext *c) { return reinterpret_cast(c); } static ClientRpcContext *detag(void *t) { return reinterpret_cast(t); } - virtual void report_stats(Histogram *hist) = 0; }; template @@ -89,9 +90,12 @@ class ClientRpcContextUnaryImpl : public ClientRpcContext { response_reader_( start_req(stub_, &context_, req_, ClientRpcContext::tag(this))) {} ~ClientRpcContextUnaryImpl() GRPC_OVERRIDE {} - bool RunNextState() GRPC_OVERRIDE { return (this->*next_state_)(); } - void report_stats(Histogram *hist) GRPC_OVERRIDE { - hist->Add((Timer::Now() - start_) * 1e9); + bool RunNextState(bool ok, Histogram *hist) GRPC_OVERRIDE { + bool ret = (this->*next_state_)(ok); + if (!ret) { + hist->Add((Timer::Now() - start_) * 1e9); + } + return ret; } void StartNewClone() GRPC_OVERRIDE { @@ -99,16 +103,16 @@ class ClientRpcContextUnaryImpl : public ClientRpcContext { } private: - bool ReqSent() { + bool ReqSent(bool) { next_state_ = &ClientRpcContextUnaryImpl::RespDone; response_reader_->Finish(&response_, &status_, ClientRpcContext::tag(this)); return true; } - bool RespDone() { + bool RespDone(bool) { next_state_ = &ClientRpcContextUnaryImpl::DoCallBack; return false; } - bool DoCallBack() { + bool DoCallBack(bool) { callback_(status_, &response_); return false; } @@ -116,7 +120,7 @@ class ClientRpcContextUnaryImpl : public ClientRpcContext { TestService::Stub *stub_; RequestType req_; ResponseType response_; - bool (ClientRpcContextUnaryImpl::*next_state_)(); + bool (ClientRpcContextUnaryImpl::*next_state_)(bool); std::function callback_; std::function>( TestService::Stub *, grpc::ClientContext *, const RequestType &, void *)> @@ -127,9 +131,9 @@ class ClientRpcContextUnaryImpl : public ClientRpcContext { response_reader_; }; -class AsyncClient GRPC_FINAL : public Client { +class AsyncUnaryClient GRPC_FINAL : public Client { public: - explicit AsyncClient(const ClientConfig &config) : Client(config) { + explicit AsyncUnaryClient(const ClientConfig &config) : Client(config) { for (int i = 0; i < config.async_client_threads(); i++) { cli_cqs_.emplace_back(new CompletionQueue); } @@ -162,7 +166,7 @@ class AsyncClient GRPC_FINAL : public Client { StartThreads(config.async_client_threads()); } - ~AsyncClient() GRPC_OVERRIDE { + ~AsyncUnaryClient() GRPC_OVERRIDE { EndThreads(); for (auto &cq : cli_cqs_) { @@ -181,10 +185,9 @@ class AsyncClient GRPC_FINAL : public Client { cli_cqs_[thread_idx]->Next(&got_tag, &ok); ClientRpcContext *ctx = ClientRpcContext::detag(got_tag); - if (ctx->RunNextState() == false) { + if (ctx->RunNextState(ok, histogram) == false) { // call the callback and then delete it - ctx->report_stats(histogram); - ctx->RunNextState(); + ctx->RunNextState(ok, histogram); ctx->StartNewClone(); delete ctx; } @@ -193,8 +196,144 @@ class AsyncClient GRPC_FINAL : public Client { std::vector> cli_cqs_; }; -std::unique_ptr CreateAsyncClient(const ClientConfig &args) { - return std::unique_ptr(new AsyncClient(args)); +template +class ClientRpcContextStreamingImpl : public ClientRpcContext { + public: + ClientRpcContextStreamingImpl( + TestService::Stub *stub, const RequestType &req, + std::function< + std::unique_ptr>( + TestService::Stub *, grpc::ClientContext *, void *)> start_req, + std::function on_done) + : context_(), + stub_(stub), + req_(req), + response_(), + next_state_(&ClientRpcContextStreamingImpl::ReqSent), + callback_(on_done), + start_req_(start_req), + start_(Timer::Now()), + stream_(start_req_(stub_, &context_, ClientRpcContext::tag(this))) {} + ~ClientRpcContextStreamingImpl() GRPC_OVERRIDE {} + bool RunNextState(bool ok, Histogram *hist) GRPC_OVERRIDE { + return (this->*next_state_)(ok, hist); + } + void StartNewClone() GRPC_OVERRIDE { + new ClientRpcContextStreamingImpl(stub_, req_, start_req_, callback_); + } + + private: + bool ReqSent(bool ok, Histogram *) { + return StartWrite(ok); + } + bool StartWrite(bool ok) { + if (!ok) { + return(false); + } + start_ = Timer::Now(); + next_state_ = &ClientRpcContextStreamingImpl::WriteDone; + stream_->Write(req_, ClientRpcContext::tag(this)); + return true; + } + bool WriteDone(bool ok, Histogram *) { + if (!ok) { + return(false); + } + next_state_ = &ClientRpcContextStreamingImpl::ReadDone; + stream_->Read(&response_, ClientRpcContext::tag(this)); + return true; + } + bool ReadDone(bool ok, Histogram *hist) { + hist->Add((Timer::Now() - start_) * 1e9); + return StartWrite(ok); + } + grpc::ClientContext context_; + TestService::Stub *stub_; + RequestType req_; + ResponseType response_; + bool (ClientRpcContextStreamingImpl::*next_state_)(bool, Histogram *); + std::function callback_; + std::function>( + TestService::Stub *, grpc::ClientContext *, void *)> start_req_; + grpc::Status status_; + double start_; + std::unique_ptr> + stream_; +}; + +class AsyncStreamingClient GRPC_FINAL : public Client { + public: + explicit AsyncStreamingClient(const ClientConfig &config) : Client(config) { + for (int i = 0; i < config.async_client_threads(); i++) { + cli_cqs_.emplace_back(new CompletionQueue); + } + + auto payload_size = config.payload_size(); + auto check_done = [payload_size](grpc::Status s, SimpleResponse *response) { + GPR_ASSERT(s.IsOk() && (response->payload().type() == + grpc::testing::PayloadType::COMPRESSABLE) && + (response->payload().body().length() == + static_cast(payload_size))); + }; + + int t = 0; + for (int i = 0; i < config.outstanding_rpcs_per_channel(); i++) { + for (auto &channel : channels_) { + auto *cq = cli_cqs_[t].get(); + t = (t + 1) % cli_cqs_.size(); + auto start_req = [cq](TestService::Stub *stub, grpc::ClientContext *ctx, + void *tag) { + auto stream = stub->AsyncStreamingCall(ctx, cq, tag); + return stream; + }; + + TestService::Stub *stub = channel.get_stub(); + const SimpleRequest &request = request_; + new ClientRpcContextStreamingImpl( + stub, request, start_req, check_done); + } + } + + StartThreads(config.async_client_threads()); + } + + ~AsyncStreamingClient() GRPC_OVERRIDE { + EndThreads(); + + for (auto &cq : cli_cqs_) { + cq->Shutdown(); + void *got_tag; + bool ok; + while (cq->Next(&got_tag, &ok)) { + delete ClientRpcContext::detag(got_tag); + } + } + } + + void ThreadFunc(Histogram *histogram, size_t thread_idx) GRPC_OVERRIDE { + void *got_tag; + bool ok; + cli_cqs_[thread_idx]->Next(&got_tag, &ok); + + ClientRpcContext *ctx = ClientRpcContext::detag(got_tag); + if (ctx->RunNextState(ok, histogram) == false) { + // call the callback and then delete it + ctx->RunNextState(ok, histogram); + ctx->StartNewClone(); + delete ctx; + } + } + + std::vector> cli_cqs_; +}; + +std::unique_ptr CreateAsyncUnaryClient(const ClientConfig &args) { + return std::unique_ptr(new AsyncUnaryClient(args)); +} +std::unique_ptr CreateAsyncStreamingClient(const ClientConfig &args) { + return std::unique_ptr(new AsyncStreamingClient(args)); } } // namespace testing diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc index 7bb7231c6f..1e14aa85c5 100644 --- a/test/cpp/qps/client_sync.cc +++ b/test/cpp/qps/client_sync.cc @@ -48,9 +48,11 @@ #include #include #include -#include #include #include +#include +#include +#include #include "test/core/util/grpc_profiler.h" #include "test/cpp/util/create_test_channel.h" #include "test/cpp/qps/client.h" @@ -61,18 +63,28 @@ namespace grpc { namespace testing { -class SynchronousClient GRPC_FINAL : public Client { +class SynchronousClient : public Client { public: SynchronousClient(const ClientConfig& config) : Client(config) { - size_t num_threads = - config.outstanding_rpcs_per_channel() * config.client_channels(); - responses_.resize(num_threads); - StartThreads(num_threads); + num_threads_ = + config.outstanding_rpcs_per_channel() * config.client_channels(); + responses_.resize(num_threads_); } - ~SynchronousClient() { EndThreads(); } + virtual ~SynchronousClient() { EndThreads(); } + + protected: + size_t num_threads_; + std::vector responses_; +}; - void ThreadFunc(Histogram* histogram, size_t thread_idx) { +class SynchronousUnaryClient GRPC_FINAL : public SynchronousClient { + public: + SynchronousUnaryClient(const ClientConfig& config): + SynchronousClient(config) {StartThreads(num_threads_);} + ~SynchronousUnaryClient() {} + + void ThreadFunc(Histogram* histogram, size_t thread_idx) GRPC_OVERRIDE { auto* stub = channels_[thread_idx % channels_.size()].get_stub(); double start = Timer::Now(); grpc::ClientContext context; @@ -80,13 +92,47 @@ class SynchronousClient GRPC_FINAL : public Client { stub->UnaryCall(&context, request_, &responses_[thread_idx]); histogram->Add((Timer::Now() - start) * 1e9); } +}; - private: - std::vector responses_; +class SynchronousStreamingClient GRPC_FINAL : public SynchronousClient { + public: + SynchronousStreamingClient(const ClientConfig& config): + SynchronousClient(config) { + for (size_t thread_idx=0;thread_idxStreamingCall(&context_); + } + StartThreads(num_threads_); + } + ~SynchronousStreamingClient() { + if (stream_) { + SimpleResponse response; + stream_->WritesDone(); + EXPECT_FALSE(stream_->Read(&response)); + + Status s = stream_->Finish(); + EXPECT_TRUE(s.IsOk()); + } + } + + void ThreadFunc(Histogram* histogram, size_t thread_idx) GRPC_OVERRIDE { + double start = Timer::Now(); + EXPECT_TRUE(stream_->Write(request_)); + EXPECT_TRUE(stream_->Read(&responses_[thread_idx])); + histogram->Add((Timer::Now() - start) * 1e9); + } + private: + grpc::ClientContext context_; + std::unique_ptr> stream_; }; -std::unique_ptr CreateSynchronousClient(const ClientConfig& config) { - return std::unique_ptr(new SynchronousClient(config)); +std::unique_ptr +CreateSynchronousUnaryClient(const ClientConfig& config) { + return std::unique_ptr(new SynchronousUnaryClient(config)); +} +std::unique_ptr +CreateSynchronousStreamingClient(const ClientConfig& config) { + return std::unique_ptr(new SynchronousStreamingClient(config)); } } // namespace testing diff --git a/test/cpp/qps/qpstest.proto b/test/cpp/qps/qpstest.proto index 6a7170bf58..70cc926f16 100644 --- a/test/cpp/qps/qpstest.proto +++ b/test/cpp/qps/qpstest.proto @@ -87,15 +87,21 @@ enum ServerType { ASYNC_SERVER = 2; } +enum TestType { + UNARY_TEST = 1; + STREAMING_TEST = 2; +} + message ClientConfig { repeated string server_targets = 1; required ClientType client_type = 2; - required bool enable_ssl = 3; + optional bool enable_ssl = 3 [default=false]; required int32 outstanding_rpcs_per_channel = 4; required int32 client_channels = 5; required int32 payload_size = 6; // only for async client: optional int32 async_client_threads = 7; + optional TestType test_type = 8 [default=UNARY_TEST]; } // Request current stats @@ -121,8 +127,8 @@ message ClientStatus { message ServerConfig { required ServerType server_type = 1; - required int32 threads = 2; - required bool enable_ssl = 3; + optional int32 threads = 2 [default=1]; + optional bool enable_ssl = 3 [default=false]; } message ServerArgs { @@ -144,7 +150,7 @@ message SimpleRequest { // Desired payload size in the response from the server. // If response_type is COMPRESSABLE, this denotes the size before compression. - optional int32 response_size = 2; + optional int32 response_size = 2 [default=0]; // Optional input payload sent along with the request. optional Payload payload = 3; @@ -154,72 +160,14 @@ message SimpleResponse { optional Payload payload = 1; } -message StreamingInputCallRequest { - // Optional input payload sent along with the request. - optional Payload payload = 1; - - // Not expecting any payload from the response. -} - -message StreamingInputCallResponse { - // Aggregated size of payloads received from the client. - optional int32 aggregated_payload_size = 1; -} - -message ResponseParameters { - // Desired payload sizes in responses from the server. - // If response_type is COMPRESSABLE, this denotes the size before compression. - required int32 size = 1; - - // Desired interval between consecutive responses in the response stream in - // microseconds. - required int32 interval_us = 2; -} - -message StreamingOutputCallRequest { - // Desired payload type in the response from the server. - // If response_type is RANDOM, the payload from each response in the stream - // might be of different types. This is to simulate a mixed type of payload - // stream. - optional PayloadType response_type = 1 [default=COMPRESSABLE]; - - repeated ResponseParameters response_parameters = 2; - - // Optional input payload sent along with the request. - optional Payload payload = 3; -} - -message StreamingOutputCallResponse { - optional Payload payload = 1; -} - service TestService { // One request followed by one response. // The server returns the client payload as-is. rpc UnaryCall(SimpleRequest) returns (SimpleResponse); - // One request followed by a sequence of responses (streamed download). - // The server returns the payload with client desired type and sizes. - rpc StreamingOutputCall(StreamingOutputCallRequest) - returns (stream StreamingOutputCallResponse); - - // A sequence of requests followed by one response (streamed upload). - // The server returns the aggregated size of client payload as the result. - rpc StreamingInputCall(stream StreamingInputCallRequest) - returns (StreamingInputCallResponse); - - // A sequence of requests with each request served by the server immediately. - // As one request could lead to multiple responses, this interface - // demonstrates the idea of full duplexing. - rpc FullDuplexCall(stream StreamingOutputCallRequest) - returns (stream StreamingOutputCallResponse); - - // A sequence of requests followed by a sequence of responses. - // The server buffers all the client requests and then serves them in order. A - // stream of responses are returned to the client when the server starts with - // first request. - rpc HalfDuplexCall(stream StreamingOutputCallRequest) - returns (stream StreamingOutputCallResponse); + // One request followed by one response. + // The server returns the client payload as-is. + rpc StreamingCall(stream SimpleRequest) returns (stream SimpleResponse); } service Worker { diff --git a/test/cpp/qps/server.cc b/test/cpp/qps/server.cc index 005f0f9c5e..c6c6c9543d 100644 --- a/test/cpp/qps/server.cc +++ b/test/cpp/qps/server.cc @@ -115,7 +115,7 @@ class TestServiceImpl GRPC_FINAL : public TestService::Service { } Status UnaryCall(ServerContext* context, const SimpleRequest* request, SimpleResponse* response) { - if (request->has_response_size() && request->response_size() > 0) { + if (request->response_size() > 0) { if (!SetPayload(request->response_type(), request->response_size(), response->mutable_payload())) { return Status(grpc::StatusCode::INTERNAL, "Error creating payload."); diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc index 19778e5a7c..4312f597b2 100644 --- a/test/cpp/qps/server_async.cc +++ b/test/cpp/qps/server_async.cc @@ -48,6 +48,7 @@ #include #include #include +#include #include #include "src/cpp/server/thread_pool.h" #include "test/core/util/grpc_profiler.h" @@ -78,10 +79,16 @@ class AsyncQpsServerTest : public Server { using namespace std::placeholders; request_unary_ = std::bind(&TestService::AsyncService::RequestUnaryCall, &async_service_, _1, _2, _3, &srv_cq_, _4); + request_streaming_ = + std::bind(&TestService::AsyncService::RequestStreamingCall, + &async_service_, _1, _2, &srv_cq_, _3); for (int i = 0; i < 100; i++) { contexts_.push_front( new ServerRpcContextUnaryImpl( - request_unary_, UnaryCall)); + request_unary_, ProcessRPC)); + contexts_.push_front( + new ServerRpcContextStreamingImpl( + request_streaming_, ProcessRPC)); } for (int i = 0; i < config.threads(); i++) { threads_.push_back(std::thread([=]() { @@ -89,14 +96,12 @@ class AsyncQpsServerTest : public Server { bool ok; void *got_tag; while (srv_cq_.Next(&got_tag, &ok)) { - if (ok) { - ServerRpcContext *ctx = detag(got_tag); - // The tag is a pointer to an RPC context to invoke - if (ctx->RunNextState() == false) { - // this RPC context is done, so refresh it - ctx->Reset(); - } - } + ServerRpcContext *ctx = detag(got_tag); + // The tag is a pointer to an RPC context to invoke + if (ctx->RunNextState(ok) == false) { + // this RPC context is done, so refresh it + ctx->Reset(); + } } return; })); @@ -119,7 +124,7 @@ class AsyncQpsServerTest : public Server { public: ServerRpcContext() {} virtual ~ServerRpcContext(){}; - virtual bool RunNextState() = 0; // do next state, return false if all done + virtual bool RunNextState(bool) = 0; // next state, return false if done virtual void Reset() = 0; // start this back at a clean state }; static void *tag(ServerRpcContext *func) { @@ -130,7 +135,7 @@ class AsyncQpsServerTest : public Server { } template - class ServerRpcContextUnaryImpl : public ServerRpcContext { + class ServerRpcContextUnaryImpl GRPC_FINAL : public ServerRpcContext { public: ServerRpcContextUnaryImpl( std::function*next_state_)(); } + bool RunNextState(bool ok) GRPC_OVERRIDE {return (this->*next_state_)(ok);} void Reset() GRPC_OVERRIDE { srv_ctx_ = ServerContext(); req_ = RequestType(); @@ -160,8 +165,11 @@ class AsyncQpsServerTest : public Server { } private: - bool finisher() { return false; } - bool invoker() { + bool finisher(bool) { return false; } + bool invoker(bool ok) { + if (!ok) + return false; + ResponseType response; // Call the RPC processing function @@ -174,7 +182,7 @@ class AsyncQpsServerTest : public Server { } ServerContext srv_ctx_; RequestType req_; - bool (ServerRpcContextUnaryImpl::*next_state_)(); + bool (ServerRpcContextUnaryImpl::*next_state_)(bool); std::function *, void *)> request_method_; @@ -183,9 +191,88 @@ class AsyncQpsServerTest : public Server { grpc::ServerAsyncResponseWriter response_writer_; }; - static Status UnaryCall(const SimpleRequest *request, - SimpleResponse *response) { - if (request->has_response_size() && request->response_size() > 0) { + template + class ServerRpcContextStreamingImpl GRPC_FINAL : public ServerRpcContext { + public: + ServerRpcContextStreamingImpl( + std::function *, void *)> request_method, + std::function + invoke_method) + : next_state_(&ServerRpcContextStreamingImpl::request_done), + request_method_(request_method), + invoke_method_(invoke_method), + stream_(&srv_ctx_) { + request_method_(&srv_ctx_, &stream_, AsyncQpsServerTest::tag(this)); + } + ~ServerRpcContextStreamingImpl() GRPC_OVERRIDE { + } + bool RunNextState(bool ok) GRPC_OVERRIDE {return (this->*next_state_)(ok);} + void Reset() GRPC_OVERRIDE { + srv_ctx_ = ServerContext(); + req_ = RequestType(); + stream_ = grpc::ServerAsyncReaderWriter(&srv_ctx_); + + // Then request the method + next_state_ = &ServerRpcContextStreamingImpl::request_done; + request_method_(&srv_ctx_, &stream_, AsyncQpsServerTest::tag(this)); + } + + private: + bool request_done(bool ok) { + if (!ok) + return false; + stream_.Read(&req_, AsyncQpsServerTest::tag(this)); + next_state_ = &ServerRpcContextStreamingImpl::read_done; + return true; + } + + bool read_done(bool ok) { + if (ok) { + // invoke the method + ResponseType response; + // Call the RPC processing function + grpc::Status status = invoke_method_(&req_, &response); + // initiate the write + stream_.Write(response, AsyncQpsServerTest::tag(this)); + next_state_ = &ServerRpcContextStreamingImpl::write_done; + } else { // client has sent writes done + // finish the stream + stream_.Finish(Status::OK, AsyncQpsServerTest::tag(this)); + next_state_ = &ServerRpcContextStreamingImpl::finish_done; + } + return true; + } + bool write_done(bool ok) { + // now go back and get another streaming read! + if (ok) { + stream_.Read(&req_, AsyncQpsServerTest::tag(this)); + next_state_ = &ServerRpcContextStreamingImpl::read_done; + } + else { + stream_.Finish(Status::OK, AsyncQpsServerTest::tag(this)); + next_state_ = &ServerRpcContextStreamingImpl::finish_done; + } + return true; + } + bool finish_done(bool ok) {return false; /* reset the context */ } + + ServerContext srv_ctx_; + RequestType req_; + bool (ServerRpcContextStreamingImpl::*next_state_)(bool); + std::function *, void *)> request_method_; + std::function + invoke_method_; + grpc::ServerAsyncReaderWriter stream_; + }; + + static Status ProcessRPC(const SimpleRequest *request, + SimpleResponse *response) { + if (request->response_size() > 0) { if (!SetPayload(request->response_type(), request->response_size(), response->mutable_payload())) { return Status(grpc::StatusCode::INTERNAL, "Error creating payload."); @@ -200,6 +287,9 @@ class AsyncQpsServerTest : public Server { std::function *, void *)> request_unary_; + std::function *, void *)> + request_streaming_; std::forward_list contexts_; }; diff --git a/test/cpp/qps/server_sync.cc b/test/cpp/qps/server_sync.cc index 5c6541989c..1dbdd64a34 100644 --- a/test/cpp/qps/server_sync.cc +++ b/test/cpp/qps/server_sync.cc @@ -62,7 +62,7 @@ class TestServiceImpl GRPC_FINAL : public TestService::Service { public: Status UnaryCall(ServerContext* context, const SimpleRequest* request, SimpleResponse* response) GRPC_OVERRIDE { - if (request->has_response_size() && request->response_size() > 0) { + if (request->response_size() > 0) { if (!Server::SetPayload(request->response_type(), request->response_size(), response->mutable_payload())) { @@ -71,6 +71,23 @@ class TestServiceImpl GRPC_FINAL : public TestService::Service { } return Status::OK; } + Status StreamingCall(ServerContext *context, + ServerReaderWriter* + stream) GRPC_OVERRIDE { + SimpleRequest request; + while (stream->Read(&request)) { + SimpleResponse response; + if (request.response_size() > 0) { + if (!Server::SetPayload(request.response_type(), + request.response_size(), + response.mutable_payload())) { + return Status(grpc::StatusCode::INTERNAL, "Error creating payload."); + } + } + stream->Write(response); + } + return Status::OK; + } }; class SynchronousServer GRPC_FINAL : public grpc::testing::Server { diff --git a/test/cpp/qps/worker.cc b/test/cpp/qps/worker.cc index faabfd1147..4c8c7cfea9 100644 --- a/test/cpp/qps/worker.cc +++ b/test/cpp/qps/worker.cc @@ -77,9 +77,12 @@ namespace testing { std::unique_ptr CreateClient(const ClientConfig& config) { switch (config.client_type()) { case ClientType::SYNCHRONOUS_CLIENT: - return CreateSynchronousClient(config); + return (config.test_type() == TestType::UNARY_TEST) ? + CreateSynchronousUnaryClient(config) : + CreateSynchronousStreamingClient(config); case ClientType::ASYNC_CLIENT: - return CreateAsyncClient(config); + return (config.test_type() == TestType::UNARY_TEST) ? + CreateAsyncUnaryClient(config) : CreateAsyncStreamingClient(config); } abort(); } -- cgit v1.2.3 From 653803e3109c38fa54a21ee7e93cdf4b42482bd1 Mon Sep 17 00:00:00 2001 From: vjpai Date: Mon, 23 Mar 2015 10:19:12 -0700 Subject: Make RPC type configurable --- test/cpp/qps/qps_driver.cc | 7 +++++++ test/cpp/qps/qpstest.proto | 8 ++++---- test/cpp/qps/worker.cc | 4 ++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/test/cpp/qps/qps_driver.cc b/test/cpp/qps/qps_driver.cc index bf51e7408e..764fe136a8 100644 --- a/test/cpp/qps/qps_driver.cc +++ b/test/cpp/qps/qps_driver.cc @@ -42,6 +42,8 @@ DEFINE_int32(num_servers, 1, "Number of server binaries"); // Common config DEFINE_bool(enable_ssl, false, "Use SSL"); +DEFINE_string(rpc_type, "UNARY_TEST", + "Type of RPC: UNARY_TEST or STREAMING_TEST"); // Server config DEFINE_int32(server_threads, 1, "Number of server threads"); @@ -59,6 +61,7 @@ using grpc::testing::ClientConfig; using grpc::testing::ServerConfig; using grpc::testing::ClientType; using grpc::testing::ServerType; +using grpc::testing::RpcType; using grpc::testing::ResourceUsage; using grpc::testing::sum; @@ -73,6 +76,9 @@ int main(int argc, char **argv) { grpc_init(); ParseCommandLineFlags(&argc, &argv, true); + RpcType rpc_type; + RpcType_Parse(FLAGS_rpc_type, &rpc_type); + ClientType client_type; ServerType server_type; GPR_ASSERT(ClientType_Parse(FLAGS_client_type, &client_type)); @@ -86,6 +92,7 @@ int main(int argc, char **argv) { client_config.set_client_channels(FLAGS_client_channels); client_config.set_payload_size(FLAGS_payload_size); client_config.set_async_client_threads(FLAGS_async_client_threads); + client_config.set_rpc_type(rpc_type); ServerConfig server_config; server_config.set_server_type(server_type); diff --git a/test/cpp/qps/qpstest.proto b/test/cpp/qps/qpstest.proto index 70cc926f16..1553ef5f07 100644 --- a/test/cpp/qps/qpstest.proto +++ b/test/cpp/qps/qpstest.proto @@ -87,9 +87,9 @@ enum ServerType { ASYNC_SERVER = 2; } -enum TestType { - UNARY_TEST = 1; - STREAMING_TEST = 2; +enum RpcType { + UNARY = 1; + STREAMING = 2; } message ClientConfig { @@ -101,7 +101,7 @@ message ClientConfig { required int32 payload_size = 6; // only for async client: optional int32 async_client_threads = 7; - optional TestType test_type = 8 [default=UNARY_TEST]; + optional RpcType rpc_type = 8 [default=UNARY]; } // Request current stats diff --git a/test/cpp/qps/worker.cc b/test/cpp/qps/worker.cc index 4c8c7cfea9..afe3ce9086 100644 --- a/test/cpp/qps/worker.cc +++ b/test/cpp/qps/worker.cc @@ -77,11 +77,11 @@ namespace testing { std::unique_ptr CreateClient(const ClientConfig& config) { switch (config.client_type()) { case ClientType::SYNCHRONOUS_CLIENT: - return (config.test_type() == TestType::UNARY_TEST) ? + return (config.rpc_type() == RpcType::UNARY) ? CreateSynchronousUnaryClient(config) : CreateSynchronousStreamingClient(config); case ClientType::ASYNC_CLIENT: - return (config.test_type() == TestType::UNARY_TEST) ? + return (config.rpc_type() == RpcType::UNARY) ? CreateAsyncUnaryClient(config) : CreateAsyncStreamingClient(config); } abort(); -- cgit v1.2.3 From 94c5e7135b74a7f5ddb578f7482bb3f09efbe81c Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Mon, 23 Mar 2015 10:46:05 -0700 Subject: Added a comment to server.js --- src/node/src/server.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/node/src/server.js b/src/node/src/server.js index e214d76dc5..8a26a43606 100644 --- a/src/node/src/server.js +++ b/src/node/src/server.js @@ -652,4 +652,7 @@ function makeProtobufServerConstructor(services) { */ exports.makeServerConstructor = makeServerConstructor; +/** + * See documentation for makeProtobufServerConstructor + */ exports.makeProtobufServerConstructor = makeProtobufServerConstructor; -- cgit v1.2.3 From c5b397927cfa7dc131dd06d95f91e9c76d869909 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Mon, 23 Mar 2015 10:46:37 -0700 Subject: test return value of rpc parse --- test/cpp/qps/qps_driver.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/cpp/qps/qps_driver.cc b/test/cpp/qps/qps_driver.cc index 764fe136a8..f531094c77 100644 --- a/test/cpp/qps/qps_driver.cc +++ b/test/cpp/qps/qps_driver.cc @@ -42,8 +42,7 @@ DEFINE_int32(num_servers, 1, "Number of server binaries"); // Common config DEFINE_bool(enable_ssl, false, "Use SSL"); -DEFINE_string(rpc_type, "UNARY_TEST", - "Type of RPC: UNARY_TEST or STREAMING_TEST"); +DEFINE_string(rpc_type, "UNARY", "Type of RPC: UNARY or STREAMING"); // Server config DEFINE_int32(server_threads, 1, "Number of server threads"); @@ -77,7 +76,7 @@ int main(int argc, char **argv) { ParseCommandLineFlags(&argc, &argv, true); RpcType rpc_type; - RpcType_Parse(FLAGS_rpc_type, &rpc_type); + GPR_ASSERT(RpcType_Parse(FLAGS_rpc_type, &rpc_type)); ClientType client_type; ServerType server_type; -- cgit v1.2.3 From b0823fd71500676f289741fcca9c8d47812b920f Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Mon, 23 Mar 2015 11:18:50 -0700 Subject: Added requested comments --- src/node/examples/qps_test.js | 98 +++++++++++++++++++++++++++++-------------- 1 file changed, 66 insertions(+), 32 deletions(-) diff --git a/src/node/examples/qps_test.js b/src/node/examples/qps_test.js index 4435da4803..00293b464a 100644 --- a/src/node/examples/qps_test.js +++ b/src/node/examples/qps_test.js @@ -31,6 +31,14 @@ * */ +/** + * This script runs a QPS test. It sends requests for a specified length of time + * with a specified number pending at any one time. It then outputs the measured + * QPS. Usage: + * node qps_test.js [--concurrent=count] [--time=seconds] + * concurrent defaults to 100 and time defaults to 10 + */ + 'use strict'; var async = require('async'); @@ -40,47 +48,73 @@ var grpc = require('..'); var testProto = grpc.load(__dirname + '/../interop/test.proto').grpc.testing; var interop_server = require('../interop/interop_server.js'); -function runTest(concurrent, seconds, callback) { +/** + * Runs the QPS test. Sends requests constantly for the given number of seconds, + * and keeps concurrent_calls requests pending at all times. When the test ends, + * the callback is called with the number of calls that completed within the + * time limit. + * @param {number} concurrent_calls The number of calls to have pending + * simultaneously + * @param {number} seconds The number of seconds to run the test for + * @param {function(Error, number)} callback Callback for test completion + */ +function runTest(concurrent_calls, seconds, callback) { var testServer = interop_server.getServer(0, false); testServer.server.listen(); var client = new testProto.TestService('localhost:' + testServer.port); var warmup_num = 100; - async.waterfall([ - function warmUp(callback) { - var pending = warmup_num; - function startCall() { - client.emptyCall({}, function(err, resp) { - pending--; - if (pending === 0) { - callback(null); - } - }); - } - for (var i = 0; i < warmup_num; i++) { - startCall(); - } - }, function run(callback) { - var running = 0; - var count = 0; - var start = process.hrtime(); - function responseCallback(err, resp) { - if (process.hrtime(start)[0] < seconds) { - count += 1; - client.emptyCall({}, responseCallback); - } else { - running -= 1; - if (running <= 0) { - callback(null, count); - } + /** + * Warms up the client to avoid counting startup time in the test result + * @param {function(Error)} callback Called when warmup is complete + */ + function warmUp(callback) { + var pending = warmup_num; + function startCall() { + client.emptyCall({}, function(err, resp) { + if (err) { + callback(err); + return; } - } - for (var i = 0; i < concurrent; i++) { - running += 1; + pending--; + if (pending === 0) { + callback(null); + } + }); + } + for (var i = 0; i < warmup_num; i++) { + startCall(); + } + } + /** + * Run the QPS test. Starts concurrent_calls requests, then starts a new + * request whenever one completes until time runs out. + * @param {function(Error, number)} callback Called when the test is complete. + * The second argument is the number of calls that finished within the + * time limit + */ + function run(callback) { + var running = 0; + var count = 0; + var start = process.hrtime(); + function responseCallback(err, resp) { + if (process.hrtime(start)[0] < seconds) { + count += 1; client.emptyCall({}, responseCallback); + } else { + running -= 1; + if (running <= 0) { + callback(null, count); + } } - }], function(err, count) { + } + for (var i = 0; i < concurrent_calls; i++) { + running += 1; + client.emptyCall({}, responseCallback); + } + } + async.waterfall([warmUp, run], function(err, count) { testServer.server.shutdown(); callback(err, count); }); -- cgit v1.2.3 From 77e2fb0f9521fd41f4e0ed3fc0d7dc5e9e4208ba Mon Sep 17 00:00:00 2001 From: Tim Emiola Date: Thu, 19 Mar 2015 23:10:10 -0700 Subject: Corrects the handling of metadata when the optional deadline is specified --- src/ruby/lib/grpc/generic/service.rb | 19 ++++++++------- src/ruby/spec/generic/rpc_server_spec.rb | 42 +++++++++++++++++++++++++++++--- 2 files changed, 48 insertions(+), 13 deletions(-) diff --git a/src/ruby/lib/grpc/generic/service.rb b/src/ruby/lib/grpc/generic/service.rb index 6ea0831a2e..d128c3490d 100644 --- a/src/ruby/lib/grpc/generic/service.rb +++ b/src/ruby/lib/grpc/generic/service.rb @@ -176,25 +176,26 @@ module GRPC unmarshal = desc.unmarshal_proc(:output) route = "/#{route_prefix}/#{name}" if desc.request_response? - define_method(mth_name) do |req, deadline = nil| + define_method(mth_name) do |req, deadline = nil, **kw| logger.debug("calling #{@host}:#{route}") - request_response(route, req, marshal, unmarshal, deadline) + request_response(route, req, marshal, unmarshal, deadline, **kw) end elsif desc.client_streamer? - define_method(mth_name) do |reqs, deadline = nil| + define_method(mth_name) do |reqs, deadline = nil, **kw| logger.debug("calling #{@host}:#{route}") - client_streamer(route, reqs, marshal, unmarshal, deadline) + client_streamer(route, reqs, marshal, unmarshal, deadline, **kw) end elsif desc.server_streamer? - define_method(mth_name) do |req, deadline = nil, &blk| + define_method(mth_name) do |req, deadline = nil, **kw, &blk| logger.debug("calling #{@host}:#{route}") - server_streamer(route, req, marshal, unmarshal, deadline, + server_streamer(route, req, marshal, unmarshal, deadline, **kw, &blk) end else # is a bidi_stream - define_method(mth_name) do |reqs, deadline = nil, &blk| + define_method(mth_name) do |reqs, deadline = nil, **kw, &blk| logger.debug("calling #{@host}:#{route}") - bidi_streamer(route, reqs, marshal, unmarshal, deadline, &blk) + bidi_streamer(route, reqs, marshal, unmarshal, deadline, **kw, + &blk) end end end @@ -202,7 +203,7 @@ module GRPC end # Asserts that the appropriate methods are defined for each added rpc - # spec. Is intended to aid verifying that server classes are correctly + # spec. Is intended to aid verifying that serve2Ar classes are correctly # implemented. def assert_rpc_descs_have_methods rpc_descs.each_pair do |m, spec| diff --git a/src/ruby/spec/generic/rpc_server_spec.rb b/src/ruby/spec/generic/rpc_server_spec.rb index f3b89b5895..34e5cdcd04 100644 --- a/src/ruby/spec/generic/rpc_server_spec.rb +++ b/src/ruby/spec/generic/rpc_server_spec.rb @@ -81,14 +81,17 @@ EchoStub = EchoService.rpc_stub_class class SlowService include GRPC::GenericService rpc :an_rpc, EchoMsg, EchoMsg + attr_reader :received_md, :delay def initialize(_default_var = 'ignored') + @delay = 0.25 + @received_md = [] end - def an_rpc(req, _call) - delay = 0.25 - logger.info("starting a slow #{delay} rpc") - sleep delay + def an_rpc(req, call) + logger.info("starting a slow #{@delay} rpc") + sleep @delay + @received_md << call.metadata unless call.metadata.nil? req # send back the req as the response end end @@ -354,6 +357,37 @@ describe GRPC::RpcServer do t.join end + it 'should receive metadata when a deadline is specified', server: true do + service = SlowService.new + @srv.handle(service) + t = Thread.new { @srv.run } + @srv.wait_till_running + req = EchoMsg.new + stub = SlowStub.new(@host, **@client_opts) + deadline = service.delay + 0.5 # wait for long enough + expect(stub.an_rpc(req, deadline, k1: 'v1', k2: 'v2')).to be_a(EchoMsg) + wanted_md = [{ 'k1' => 'v1', 'k2' => 'v2' }] + expect(service.received_md).to eq(wanted_md) + @srv.stop + t.join + end + + it 'should not receive metadata if the client times out', server: true do + service = SlowService.new + @srv.handle(service) + t = Thread.new { @srv.run } + @srv.wait_till_running + req = EchoMsg.new + stub = SlowStub.new(@host, **@client_opts) + deadline = 0.1 # too short for SlowService to respond + blk = proc { stub.an_rpc(req, deadline, k1: 'v1', k2: 'v2') } + expect(&blk).to raise_error GRPC::BadStatus + wanted_md = [] + expect(service.received_md).to eq(wanted_md) + @srv.stop + t.join + end + it 'should receive updated metadata', server: true do service = EchoService.new @srv.handle(service) -- cgit v1.2.3 From 601869bb1a86115b5042e33051adb15cea07e122 Mon Sep 17 00:00:00 2001 From: Tim Emiola Date: Mon, 23 Mar 2015 12:31:55 -0700 Subject: Enables some incorrectly disabled tests --- src/ruby/lib/grpc/generic/service.rb | 2 +- src/ruby/spec/generic/active_call_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ruby/lib/grpc/generic/service.rb b/src/ruby/lib/grpc/generic/service.rb index d128c3490d..69076b4c6e 100644 --- a/src/ruby/lib/grpc/generic/service.rb +++ b/src/ruby/lib/grpc/generic/service.rb @@ -203,7 +203,7 @@ module GRPC end # Asserts that the appropriate methods are defined for each added rpc - # spec. Is intended to aid verifying that serve2Ar classes are correctly + # spec. Is intended to aid verifying that server classes are correctly # implemented. def assert_rpc_descs_have_methods rpc_descs.each_pair do |m, spec| diff --git a/src/ruby/spec/generic/active_call_spec.rb b/src/ruby/spec/generic/active_call_spec.rb index 8914225b55..96e07cacb4 100644 --- a/src/ruby/spec/generic/active_call_spec.rb +++ b/src/ruby/spec/generic/active_call_spec.rb @@ -67,7 +67,7 @@ describe GRPC::ActiveCall do end describe '#multi_req_view' do - xit 'exposes a fixed subset of the ActiveCall methods' do + it 'exposes a fixed subset of the ActiveCall methods' do want = %w(cancelled, deadline, each_remote_read, metadata, shutdown) v = @client_call.multi_req_view want.each do |w| @@ -77,7 +77,7 @@ describe GRPC::ActiveCall do end describe '#single_req_view' do - xit 'exposes a fixed subset of the ActiveCall methods' do + it 'exposes a fixed subset of the ActiveCall methods' do want = %w(cancelled, deadline, metadata, shutdown) v = @client_call.single_req_view want.each do |w| -- cgit v1.2.3 From 55bb5bdf803ffcb6e643d35611af4938ee29fd1c Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Mon, 23 Mar 2015 12:44:09 -0700 Subject: No need to do an extra read --- test/cpp/qps/client_sync.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc index 1e14aa85c5..e4ee45a72d 100644 --- a/test/cpp/qps/client_sync.cc +++ b/test/cpp/qps/client_sync.cc @@ -108,13 +108,10 @@ class SynchronousStreamingClient GRPC_FINAL : public SynchronousClient { if (stream_) { SimpleResponse response; stream_->WritesDone(); - EXPECT_FALSE(stream_->Read(&response)); - - Status s = stream_->Finish(); - EXPECT_TRUE(s.IsOk()); + EXPECT_TRUE(stream_->Finish().IsOk()); } } - + void ThreadFunc(Histogram* histogram, size_t thread_idx) GRPC_OVERRIDE { double start = Timer::Now(); EXPECT_TRUE(stream_->Write(request_)); @@ -123,7 +120,8 @@ class SynchronousStreamingClient GRPC_FINAL : public SynchronousClient { } private: grpc::ClientContext context_; - std::unique_ptr> stream_; + std::unique_ptr> stream_; }; std::unique_ptr -- cgit v1.2.3 From 8ad32091e6e23768a1fe2d466638ef4ab59a9e9e Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Mon, 23 Mar 2015 12:44:28 -0700 Subject: Make sure that nothing gets added to cq after shutdown --- test/cpp/qps/server_async.cc | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc index 4312f597b2..5a27fff09a 100644 --- a/test/cpp/qps/server_async.cc +++ b/test/cpp/qps/server_async.cc @@ -33,6 +33,7 @@ #include #include +#include #include #include #include @@ -64,7 +65,8 @@ namespace testing { class AsyncQpsServerTest : public Server { public: AsyncQpsServerTest(const ServerConfig &config, int port) - : srv_cq_(), async_service_(&srv_cq_), server_(nullptr) { + : srv_cq_(), async_service_(&srv_cq_), server_(nullptr), + shutdown_(false) { char *server_address = NULL; gpr_join_host_port(&server_address, "::", port); @@ -100,7 +102,9 @@ class AsyncQpsServerTest : public Server { // The tag is a pointer to an RPC context to invoke if (ctx->RunNextState(ok) == false) { // this RPC context is done, so refresh it - ctx->Reset(); + std::lock_guard g(shutdown_mutex_); + if (!shutdown_) + ctx->Reset(); } } return; @@ -109,7 +113,11 @@ class AsyncQpsServerTest : public Server { } ~AsyncQpsServerTest() { server_->Shutdown(); - srv_cq_.Shutdown(); + { + std::lock_guard g(shutdown_mutex_); + shutdown_ = true; + srv_cq_.Shutdown(); + } for (auto &thr : threads_) { thr.join(); } @@ -195,7 +203,7 @@ class AsyncQpsServerTest : public Server { class ServerRpcContextStreamingImpl GRPC_FINAL : public ServerRpcContext { public: ServerRpcContextStreamingImpl( - std::function *, void *)> request_method, std::function @@ -228,7 +236,7 @@ class AsyncQpsServerTest : public Server { next_state_ = &ServerRpcContextStreamingImpl::read_done; return true; } - + bool read_done(bool ok) { if (ok) { // invoke the method @@ -291,6 +299,9 @@ class AsyncQpsServerTest : public Server { SimpleResponse,SimpleRequest> *, void *)> request_streaming_; std::forward_list contexts_; + + std::mutex shutdown_mutex_; + bool shutdown_; }; std::unique_ptr CreateAsyncServer(const ServerConfig &config, -- cgit v1.2.3 From fa6ea8536d542d8e65a153fd97e9ead38922ed9c Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Mon, 23 Mar 2015 13:51:50 -0700 Subject: Revert "Remove dead members of server context" This reverts commit 8c8588c7dc047ee509c7367f61ba0c5f00cb61d1. --- include/grpc++/server_context.h | 3 +++ src/cpp/server/server_context.cc | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/include/grpc++/server_context.h b/include/grpc++/server_context.h index 36cbae87a0..9e3b80c641 100644 --- a/include/grpc++/server_context.h +++ b/include/grpc++/server_context.h @@ -78,6 +78,8 @@ class ServerContext { void AddInitialMetadata(const grpc::string& key, const grpc::string& value); void AddTrailingMetadata(const grpc::string& key, const grpc::string& value); + bool IsCancelled(); + const std::multimap& client_metadata() { return client_metadata_; } @@ -110,6 +112,7 @@ class ServerContext { std::chrono::system_clock::time_point deadline_; grpc_call* call_; + CompletionQueue* cq_; bool sent_initial_metadata_; std::multimap client_metadata_; std::multimap initial_metadata_; diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index 435a060be5..bb3c2d1405 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -94,6 +94,7 @@ bool ServerContext::CompletionOp::FinalizeResult(void** tag, bool* status) { ServerContext::ServerContext() : completion_op_(nullptr), call_(nullptr), + cq_(nullptr), sent_initial_metadata_(false) {} ServerContext::ServerContext(gpr_timespec deadline, grpc_metadata* metadata, @@ -101,6 +102,7 @@ ServerContext::ServerContext(gpr_timespec deadline, grpc_metadata* metadata, : completion_op_(nullptr), deadline_(Timespec2Timepoint(deadline)), call_(nullptr), + cq_(nullptr), sent_initial_metadata_(false) { for (size_t i = 0; i < metadata_count; i++) { client_metadata_.insert(std::make_pair( @@ -135,4 +137,8 @@ void ServerContext::AddTrailingMetadata(const grpc::string& key, trailing_metadata_.insert(std::make_pair(key, value)); } +bool ServerContext::IsCancelled() { + return completion_op_ && completion_op_->CheckCancelled(cq_); +} + } // namespace grpc -- cgit v1.2.3 From 6266b9341ce5f88ff4c888a87d682bc1b9ac706e Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Mon, 23 Mar 2015 14:38:18 -0700 Subject: Sweep different parameter sets in a single shell script. --- test/cpp/qps/qps-sweep.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 test/cpp/qps/qps-sweep.sh diff --git a/test/cpp/qps/qps-sweep.sh b/test/cpp/qps/qps-sweep.sh new file mode 100755 index 0000000000..7bc6eade2c --- /dev/null +++ b/test/cpp/qps/qps-sweep.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +if [ x"$QPS_WORKERS" == x ]; then + echo Error: Must set QPS_WORKERS variable in form \ + "host:port,host:port,..." 1>&2 + exit 1 +fi + +bins=`find . .. ../.. ../../.. -name bins | head -1` + +for channels in 1 2 4 8 +do + for client in SYNCHRONOUS_CLIENT ASYNC_CLIENT + do + for server in SYNCHRONOUS_SERVER ASYNC_SERVER + do + for rpc in UNARY STREAMING + do + echo "Test $rpc $client $server , $channels channels" + "$bins"/opt/qps_driver --rpc_type=$rpc \ + --client_type=$client --server_type=$server + done + done + done +done -- cgit v1.2.3 From 8703f4d0c2a9f1cc45f7ebc4f01bd4cafb8fc865 Mon Sep 17 00:00:00 2001 From: Nicolas Noble Date: Mon, 23 Mar 2015 13:52:18 -0700 Subject: Various Windows fixes. -) Introduce a wait-loop with a 100ms delay on iomgr shutdown, so that background threads have the chance to place last minute callbacks without having to stall for the whole 10 seconds deadline. -) io completion ports will get notifications on socket shutdowns, so we need to delay their deletions for after we get a notification for them. -) we need to keep some sense of how many orphan sockets are in, so we can properly collect them - let's not shutdown the iocp loop until after all orphans have been collected. --- src/core/iomgr/iocp_windows.c | 34 ++++++++++++++++++++++++---------- src/core/iomgr/iocp_windows.h | 1 + src/core/iomgr/iomgr.c | 11 ++++++++++- src/core/iomgr/socket_windows.c | 7 ++++++- src/core/iomgr/socket_windows.h | 6 ++++-- 5 files changed, 45 insertions(+), 14 deletions(-) diff --git a/src/core/iomgr/iocp_windows.c b/src/core/iomgr/iocp_windows.c index 8b019e8049..aec626509a 100644 --- a/src/core/iomgr/iocp_windows.c +++ b/src/core/iomgr/iocp_windows.c @@ -52,10 +52,11 @@ static OVERLAPPED g_iocp_custom_overlap; static gpr_event g_shutdown_iocp; static gpr_event g_iocp_done; +static gpr_atm g_orphans = 0; static HANDLE g_iocp; -static int do_iocp_work() { +static void do_iocp_work() { BOOL success; DWORD bytes = 0; DWORD flags = 0; @@ -71,14 +72,14 @@ static int do_iocp_work() { gpr_time_to_millis(wait_time)); if (!success && !overlapped) { /* The deadline got attained. */ - return 0; + return; } GPR_ASSERT(completion_key && overlapped); if (overlapped == &g_iocp_custom_overlap) { if (completion_key == (ULONG_PTR) &g_iocp_kick_token) { /* We were awoken from a kick. */ gpr_log(GPR_DEBUG, "do_iocp_work - got a kick"); - return 1; + return; } gpr_log(GPR_ERROR, "Unknown custom completion key."); abort(); @@ -97,8 +98,13 @@ static int do_iocp_work() { } success = WSAGetOverlappedResult(socket->socket, &info->overlapped, &bytes, FALSE, &flags); - gpr_log(GPR_DEBUG, "bytes: %u, flags: %u - op %s", bytes, flags, - success ? "succeeded" : "failed"); + gpr_log(GPR_DEBUG, "bytes: %u, flags: %u - op %s %s", bytes, flags, + success ? "succeeded" : "failed", socket->orphan ? "orphan" : ""); + if (socket->orphan) { + grpc_winsocket_destroy(socket); + gpr_atm_full_fetch_add(&g_orphans, -1); + return; + } info->bytes_transfered = bytes; info->wsa_error = success ? 0 : WSAGetLastError(); GPR_ASSERT(overlapped == &info->overlapped); @@ -113,12 +119,10 @@ static int do_iocp_work() { } gpr_mu_unlock(&socket->state_mu); if (f) f(opaque, 1); - - return 1; } static void iocp_loop(void *p) { - while (!gpr_event_get(&g_shutdown_iocp)) { + while (gpr_atm_acq_load(&g_orphans) || !gpr_event_get(&g_shutdown_iocp)) { grpc_maybe_call_delayed_callbacks(NULL, 1); do_iocp_work(); } @@ -138,13 +142,19 @@ void grpc_iocp_init(void) { gpr_thd_new(&id, iocp_loop, NULL, NULL); } -void grpc_iocp_shutdown(void) { +void grpc_iocp_kick(void) { BOOL success; - gpr_event_set(&g_shutdown_iocp, (void *)1); + success = PostQueuedCompletionStatus(g_iocp, 0, (ULONG_PTR) &g_iocp_kick_token, &g_iocp_custom_overlap); GPR_ASSERT(success); +} + +void grpc_iocp_shutdown(void) { + BOOL success; + gpr_event_set(&g_shutdown_iocp, (void *)1); + grpc_iocp_kick(); gpr_event_wait(&g_iocp_done, gpr_inf_future); success = CloseHandle(g_iocp); GPR_ASSERT(success); @@ -166,6 +176,10 @@ void grpc_iocp_add_socket(grpc_winsocket *socket) { GPR_ASSERT(ret == g_iocp); } +void grpc_iocp_socket_orphan(grpc_winsocket *socket) { + gpr_atm_full_fetch_add(&g_orphans, 1); +} + static void socket_notify_on_iocp(grpc_winsocket *socket, void(*cb)(void *, int), void *opaque, grpc_winsocket_callback_info *info) { diff --git a/src/core/iomgr/iocp_windows.h b/src/core/iomgr/iocp_windows.h index 33133193a1..fa3f5eee10 100644 --- a/src/core/iomgr/iocp_windows.h +++ b/src/core/iomgr/iocp_windows.h @@ -42,6 +42,7 @@ void grpc_iocp_init(void); void grpc_iocp_shutdown(void); void grpc_iocp_add_socket(grpc_winsocket *); +void grpc_iocp_socket_orphan(grpc_winsocket *); void grpc_socket_notify_on_write(grpc_winsocket *, void(*cb)(void *, int success), void *opaque); diff --git a/src/core/iomgr/iomgr.c b/src/core/iomgr/iomgr.c index 058685b295..d0e6706fbd 100644 --- a/src/core/iomgr/iomgr.c +++ b/src/core/iomgr/iomgr.c @@ -117,7 +117,16 @@ void grpc_iomgr_shutdown(void) { gpr_mu_lock(&g_mu); } if (g_refs) { - if (gpr_cv_wait(&g_rcv, &g_mu, shutdown_deadline) && g_cbs_head == NULL) { + int timeout = 0; + gpr_timespec short_deadline = gpr_time_add(gpr_now(), + gpr_time_from_millis(100)); + while (gpr_cv_wait(&g_rcv, &g_mu, short_deadline) && g_cbs_head == NULL) { + if (gpr_time_cmp(gpr_now(), shutdown_deadline) > 0) { + timeout = 1; + break; + } + } + if (timeout) { gpr_log(GPR_DEBUG, "Failed to free %d iomgr objects before shutdown deadline: " "memory leaks are likely", diff --git a/src/core/iomgr/socket_windows.c b/src/core/iomgr/socket_windows.c index 99f38b0e03..22dad41783 100644 --- a/src/core/iomgr/socket_windows.c +++ b/src/core/iomgr/socket_windows.c @@ -55,7 +55,7 @@ grpc_winsocket *grpc_winsocket_create(SOCKET socket) { return r; } -void shutdown_op(grpc_winsocket_callback_info *info) { +static void shutdown_op(grpc_winsocket_callback_info *info) { if (!info->cb) return; grpc_iomgr_add_delayed_callback(info->cb, info->opaque, 0); } @@ -68,8 +68,13 @@ void grpc_winsocket_shutdown(grpc_winsocket *socket) { void grpc_winsocket_orphan(grpc_winsocket *socket) { gpr_log(GPR_DEBUG, "grpc_winsocket_orphan"); + grpc_iocp_socket_orphan(socket); + socket->orphan = 1; grpc_iomgr_unref(); closesocket(socket->socket); +} + +void grpc_winsocket_destroy(grpc_winsocket *socket) { gpr_mu_destroy(&socket->state_mu); gpr_free(socket); } diff --git a/src/core/iomgr/socket_windows.h b/src/core/iomgr/socket_windows.h index d4776ab10f..cbae91692c 100644 --- a/src/core/iomgr/socket_windows.h +++ b/src/core/iomgr/socket_windows.h @@ -57,12 +57,13 @@ typedef struct grpc_winsocket_callback_info { typedef struct grpc_winsocket { SOCKET socket; - int added_to_iocp; - grpc_winsocket_callback_info write_info; grpc_winsocket_callback_info read_info; gpr_mu state_mu; + + int added_to_iocp; + int orphan; } grpc_winsocket; /* Create a wrapped windows handle. @@ -71,5 +72,6 @@ grpc_winsocket *grpc_winsocket_create(SOCKET socket); void grpc_winsocket_shutdown(grpc_winsocket *socket); void grpc_winsocket_orphan(grpc_winsocket *socket); +void grpc_winsocket_destroy(grpc_winsocket *socket); #endif /* GRPC_INTERNAL_CORE_IOMGR_SOCKET_WINDOWS_H */ -- cgit v1.2.3 From 375a82b35c24952f35a728e5ea4d54dced982977 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Tue, 24 Mar 2015 02:33:18 +0100 Subject: Adding the ability to specify a service namespace on protoc's command line. Usage example: protoc ... --grpc_out=services_namespace=xyz:./path/to/output/dir ... This is difficult to add a test for this without significantly changing all of the examples, or the build system. However this has been successfully tested locally. --- src/compiler/cpp_generator.cc | 122 +++++++++++++++++++++++---------------- src/compiler/cpp_generator.h | 17 ++++-- src/compiler/cpp_plugin.cc | 25 ++++++-- src/compiler/generator_helpers.h | 20 +++++++ 4 files changed, 125 insertions(+), 59 deletions(-) diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index d5004624d4..0a84c73520 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -111,7 +111,8 @@ bool HasBidiStreaming(const grpc::protobuf::FileDescriptor *file) { } } // namespace -grpc::string GetHeaderIncludes(const grpc::protobuf::FileDescriptor *file) { +grpc::string GetHeaderIncludes(const grpc::protobuf::FileDescriptor *file, + const Parameters ¶ms) { grpc::string temp = "#include \n" "#include \n" @@ -158,7 +159,7 @@ grpc::string GetHeaderIncludes(const grpc::protobuf::FileDescriptor *file) { return temp; } -grpc::string GetSourceIncludes() { +grpc::string GetSourceIncludes(const Parameters ¶m) { return "#include \n" "#include \n" "#include \n" @@ -353,16 +354,27 @@ void PrintHeaderService(grpc::protobuf::io::Printer *printer, printer->Print("};\n"); } -grpc::string GetHeaderServices(const grpc::protobuf::FileDescriptor *file) { +grpc::string GetHeaderServices(const grpc::protobuf::FileDescriptor *file, + const Parameters ¶ms) { grpc::string output; grpc::protobuf::io::StringOutputStream output_stream(&output); grpc::protobuf::io::Printer printer(&output_stream, '$'); std::map vars; + if (!params.services_namespace.empty()) { + vars["services_namespace"] = params.services_namespace; + printer.Print(vars, "\nnamespace $services_namespace$ {\n\n"); + } + for (int i = 0; i < file->service_count(); ++i) { PrintHeaderService(&printer, file->service(i), &vars); printer.Print("\n"); } + + if (!params.services_namespace.empty()) { + printer.Print(vars, "} // namespace $services_namespace$\n\n"); + } + return output; } @@ -376,18 +388,18 @@ void PrintSourceClientMethod(grpc::protobuf::io::Printer *printer, grpc_cpp_generator::ClassName(method->output_type(), true); if (NoStreaming(method)) { printer->Print(*vars, - "::grpc::Status $Service$::Stub::$Method$(" + "::grpc::Status $ns$$Service$::Stub::$Method$(" "::grpc::ClientContext* context, " "const $Request$& request, $Response$* response) {\n"); printer->Print(*vars, " return ::grpc::BlockingUnaryCall(channel()," - "::grpc::RpcMethod($Service$_method_names[$Idx$]), " + "::grpc::RpcMethod($prefix$$Service$_method_names[$Idx$]), " "context, request, response);\n" "}\n\n"); printer->Print( *vars, "std::unique_ptr< ::grpc::ClientAsyncResponseReader< $Response$>> " - "$Service$::Stub::Async$Method$(::grpc::ClientContext* context, " + "$ns$$Service$::Stub::Async$Method$(::grpc::ClientContext* context, " "const $Request$& request, " "::grpc::CompletionQueue* cq, void* tag) {\n"); printer->Print(*vars, @@ -395,32 +407,32 @@ void PrintSourceClientMethod(grpc::protobuf::io::Printer *printer, "::grpc::ClientAsyncResponseReader< $Response$>>(new " "::grpc::ClientAsyncResponseReader< $Response$>(" "channel(), cq, " - "::grpc::RpcMethod($Service$_method_names[$Idx$]), " + "::grpc::RpcMethod($prefix$$Service$_method_names[$Idx$]), " "context, request, tag));\n" "}\n\n"); } else if (ClientOnlyStreaming(method)) { printer->Print(*vars, "std::unique_ptr< ::grpc::ClientWriter< $Request$>> " - "$Service$::Stub::$Method$(" + "$ns$$Service$::Stub::$Method$(" "::grpc::ClientContext* context, $Response$* response) {\n"); printer->Print(*vars, " return std::unique_ptr< ::grpc::ClientWriter< " "$Request$>>(new ::grpc::ClientWriter< $Request$>(" "channel()," - "::grpc::RpcMethod($Service$_method_names[$Idx$], " + "::grpc::RpcMethod($prefix$$Service$_method_names[$Idx$], " "::grpc::RpcMethod::RpcType::CLIENT_STREAMING), " "context, response));\n" "}\n\n"); printer->Print(*vars, "std::unique_ptr< ::grpc::ClientAsyncWriter< $Request$>> " - "$Service$::Stub::Async$Method$(" + "$ns$$Service$::Stub::Async$Method$(" "::grpc::ClientContext* context, $Response$* response, " "::grpc::CompletionQueue* cq, void* tag) {\n"); printer->Print(*vars, " return std::unique_ptr< ::grpc::ClientAsyncWriter< " "$Request$>>(new ::grpc::ClientAsyncWriter< $Request$>(" "channel(), cq, " - "::grpc::RpcMethod($Service$_method_names[$Idx$], " + "::grpc::RpcMethod($prefix$$Service$_method_names[$Idx$], " "::grpc::RpcMethod::RpcType::CLIENT_STREAMING), " "context, response, tag));\n" "}\n\n"); @@ -428,26 +440,26 @@ void PrintSourceClientMethod(grpc::protobuf::io::Printer *printer, printer->Print( *vars, "std::unique_ptr< ::grpc::ClientReader< $Response$>> " - "$Service$::Stub::$Method$(" + "$ns$$Service$::Stub::$Method$(" "::grpc::ClientContext* context, const $Request$& request) {\n"); printer->Print(*vars, " return std::unique_ptr< ::grpc::ClientReader< " "$Response$>>(new ::grpc::ClientReader< $Response$>(" "channel()," - "::grpc::RpcMethod($Service$_method_names[$Idx$], " + "::grpc::RpcMethod($prefix$$Service$_method_names[$Idx$], " "::grpc::RpcMethod::RpcType::SERVER_STREAMING), " "context, request));\n" "}\n\n"); printer->Print(*vars, "std::unique_ptr< ::grpc::ClientAsyncReader< $Response$>> " - "$Service$::Stub::Async$Method$(" + "$ns$$Service$::Stub::Async$Method$(" "::grpc::ClientContext* context, const $Request$& request, " "::grpc::CompletionQueue* cq, void* tag) {\n"); printer->Print(*vars, " return std::unique_ptr< ::grpc::ClientAsyncReader< " "$Response$>>(new ::grpc::ClientAsyncReader< $Response$>(" "channel(), cq, " - "::grpc::RpcMethod($Service$_method_names[$Idx$], " + "::grpc::RpcMethod($prefix$$Service$_method_names[$Idx$], " "::grpc::RpcMethod::RpcType::SERVER_STREAMING), " "context, request, tag));\n" "}\n\n"); @@ -455,27 +467,27 @@ void PrintSourceClientMethod(grpc::protobuf::io::Printer *printer, printer->Print( *vars, "std::unique_ptr< ::grpc::ClientReaderWriter< $Request$, $Response$>> " - "$Service$::Stub::$Method$(::grpc::ClientContext* context) {\n"); + "$ns$$Service$::Stub::$Method$(::grpc::ClientContext* context) {\n"); printer->Print(*vars, " return std::unique_ptr< ::grpc::ClientReaderWriter< " "$Request$, $Response$>>(new ::grpc::ClientReaderWriter< " "$Request$, $Response$>(" "channel()," - "::grpc::RpcMethod($Service$_method_names[$Idx$], " + "::grpc::RpcMethod($prefix$$Service$_method_names[$Idx$], " "::grpc::RpcMethod::RpcType::BIDI_STREAMING), " "context));\n" "}\n\n"); printer->Print(*vars, "std::unique_ptr< ::grpc::ClientAsyncReaderWriter< " "$Request$, $Response$>> " - "$Service$::Stub::Async$Method$(::grpc::ClientContext* context, " + "$ns$$Service$::Stub::Async$Method$(::grpc::ClientContext* context, " "::grpc::CompletionQueue* cq, void* tag) {\n"); printer->Print(*vars, " return std::unique_ptr< ::grpc::ClientAsyncReaderWriter< " "$Request$, $Response$>>(new " "::grpc::ClientAsyncReaderWriter< $Request$, $Response$>(" "channel(), cq, " - "::grpc::RpcMethod($Service$_method_names[$Idx$], " + "::grpc::RpcMethod($prefix$$Service$_method_names[$Idx$], " "::grpc::RpcMethod::RpcType::BIDI_STREAMING), " "context, tag));\n" "}\n\n"); @@ -492,7 +504,7 @@ void PrintSourceServerMethod(grpc::protobuf::io::Printer *printer, grpc_cpp_generator::ClassName(method->output_type(), true); if (NoStreaming(method)) { printer->Print(*vars, - "::grpc::Status $Service$::Service::$Method$(" + "::grpc::Status $ns$$Service$::Service::$Method$(" "::grpc::ServerContext* context, " "const $Request$* request, $Response$* response) {\n"); printer->Print( @@ -501,7 +513,7 @@ void PrintSourceServerMethod(grpc::protobuf::io::Printer *printer, printer->Print("}\n\n"); } else if (ClientOnlyStreaming(method)) { printer->Print(*vars, - "::grpc::Status $Service$::Service::$Method$(" + "::grpc::Status $ns$$Service$::Service::$Method$(" "::grpc::ServerContext* context, " "::grpc::ServerReader< $Request$>* reader, " "$Response$* response) {\n"); @@ -511,7 +523,7 @@ void PrintSourceServerMethod(grpc::protobuf::io::Printer *printer, printer->Print("}\n\n"); } else if (ServerOnlyStreaming(method)) { printer->Print(*vars, - "::grpc::Status $Service$::Service::$Method$(" + "::grpc::Status $ns$$Service$::Service::$Method$(" "::grpc::ServerContext* context, " "const $Request$* request, " "::grpc::ServerWriter< $Response$>* writer) {\n"); @@ -521,7 +533,7 @@ void PrintSourceServerMethod(grpc::protobuf::io::Printer *printer, printer->Print("}\n\n"); } else if (BidiStreaming(method)) { printer->Print(*vars, - "::grpc::Status $Service$::Service::$Method$(" + "::grpc::Status $ns$$Service$::Service::$Method$(" "::grpc::ServerContext* context, " "::grpc::ServerReaderWriter< $Response$, $Request$>* " "stream) {\n"); @@ -543,7 +555,7 @@ void PrintSourceServerAsyncMethod( grpc_cpp_generator::ClassName(method->output_type(), true); if (NoStreaming(method)) { printer->Print(*vars, - "void $Service$::AsyncService::Request$Method$(" + "void $ns$$Service$::AsyncService::Request$Method$(" "::grpc::ServerContext* context, " "$Request$* request, " "::grpc::ServerAsyncResponseWriter< $Response$>* response, " @@ -554,7 +566,7 @@ void PrintSourceServerAsyncMethod( printer->Print("}\n\n"); } else if (ClientOnlyStreaming(method)) { printer->Print(*vars, - "void $Service$::AsyncService::Request$Method$(" + "void $ns$$Service$::AsyncService::Request$Method$(" "::grpc::ServerContext* context, " "::grpc::ServerAsyncReader< $Response$, $Request$>* reader, " "::grpc::CompletionQueue* cq, void* tag) {\n"); @@ -564,7 +576,7 @@ void PrintSourceServerAsyncMethod( printer->Print("}\n\n"); } else if (ServerOnlyStreaming(method)) { printer->Print(*vars, - "void $Service$::AsyncService::Request$Method$(" + "void $ns$$Service$::AsyncService::Request$Method$(" "::grpc::ServerContext* context, " "$Request$* request, " "::grpc::ServerAsyncWriter< $Response$>* writer, " @@ -576,7 +588,7 @@ void PrintSourceServerAsyncMethod( } else if (BidiStreaming(method)) { printer->Print( *vars, - "void $Service$::AsyncService::Request$Method$(" + "void $ns$$Service$::AsyncService::Request$Method$(" "::grpc::ServerContext* context, " "::grpc::ServerAsyncReaderWriter< $Response$, $Request$>* stream, " "::grpc::CompletionQueue* cq, void *tag) {\n"); @@ -592,7 +604,7 @@ void PrintSourceService(grpc::protobuf::io::Printer *printer, std::map *vars) { (*vars)["Service"] = service->name(); - printer->Print(*vars, "static const char* $Service$_method_names[] = {\n"); + printer->Print(*vars, "static const char* $prefix$$Service$_method_names[] = {\n"); for (int i = 0; i < service->method_count(); ++i) { (*vars)["Method"] = service->method(i)->name(); printer->Print(*vars, " \"/$Package$$Service$/$Method$\",\n"); @@ -601,9 +613,9 @@ void PrintSourceService(grpc::protobuf::io::Printer *printer, printer->Print( *vars, - "std::unique_ptr< $Service$::Stub> $Service$::NewStub(" + "std::unique_ptr< $ns$$Service$::Stub> $ns$$Service$::NewStub(" "const std::shared_ptr< ::grpc::ChannelInterface>& channel) {\n" - " std::unique_ptr< $Service$::Stub> stub(new $Service$::Stub());\n" + " std::unique_ptr< $ns$$Service$::Stub> stub(new $ns$$Service$::Stub());\n" " stub->set_channel(channel);\n" " return stub;\n" "}\n\n"); @@ -615,12 +627,12 @@ void PrintSourceService(grpc::protobuf::io::Printer *printer, (*vars)["MethodCount"] = as_string(service->method_count()); printer->Print( *vars, - "$Service$::AsyncService::AsyncService(::grpc::CompletionQueue* cq) : " - "::grpc::AsynchronousService(cq, $Service$_method_names, $MethodCount$) " + "$ns$$Service$::AsyncService::AsyncService(::grpc::CompletionQueue* cq) : " + "::grpc::AsynchronousService(cq, $prefix$$Service$_method_names, $MethodCount$) " "{}\n\n"); printer->Print(*vars, - "$Service$::Service::~Service() {\n" + "$ns$$Service$::Service::~Service() {\n" " delete service_;\n" "}\n\n"); for (int i = 0; i < service->method_count(); ++i) { @@ -629,7 +641,7 @@ void PrintSourceService(grpc::protobuf::io::Printer *printer, PrintSourceServerAsyncMethod(printer, service->method(i), vars); } printer->Print(*vars, - "::grpc::RpcService* $Service$::Service::service() {\n"); + "::grpc::RpcService* $ns$$Service$::Service::service() {\n"); printer->Indent(); printer->Print( "if (service_ != nullptr) {\n" @@ -648,52 +660,52 @@ void PrintSourceService(grpc::protobuf::io::Printer *printer, printer->Print( *vars, "service_->AddMethod(new ::grpc::RpcServiceMethod(\n" - " $Service$_method_names[$Idx$],\n" + " $prefix$$Service$_method_names[$Idx$],\n" " ::grpc::RpcMethod::NORMAL_RPC,\n" - " new ::grpc::RpcMethodHandler< $Service$::Service, $Request$, " + " new ::grpc::RpcMethodHandler< $ns$$Service$::Service, $Request$, " "$Response$>(\n" - " std::function< ::grpc::Status($Service$::Service*, " + " std::function< ::grpc::Status($ns$$Service$::Service*, " "::grpc::ServerContext*, const $Request$*, $Response$*)>(" - "&$Service$::Service::$Method$), this),\n" + "&$ns$$Service$::Service::$Method$), this),\n" " new $Request$, new $Response$));\n"); } else if (ClientOnlyStreaming(method)) { printer->Print( *vars, "service_->AddMethod(new ::grpc::RpcServiceMethod(\n" - " $Service$_method_names[$Idx$],\n" + " $prefix$$Service$_method_names[$Idx$],\n" " ::grpc::RpcMethod::CLIENT_STREAMING,\n" " new ::grpc::ClientStreamingHandler< " - "$Service$::Service, $Request$, $Response$>(\n" - " std::function< ::grpc::Status($Service$::Service*, " + "$ns$$Service$::Service, $Request$, $Response$>(\n" + " std::function< ::grpc::Status($ns$$Service$::Service*, " "::grpc::ServerContext*, " "::grpc::ServerReader< $Request$>*, $Response$*)>(" - "&$Service$::Service::$Method$), this),\n" + "&$ns$$Service$::Service::$Method$), this),\n" " new $Request$, new $Response$));\n"); } else if (ServerOnlyStreaming(method)) { printer->Print( *vars, "service_->AddMethod(new ::grpc::RpcServiceMethod(\n" - " $Service$_method_names[$Idx$],\n" + " $prefix$$Service$_method_names[$Idx$],\n" " ::grpc::RpcMethod::SERVER_STREAMING,\n" " new ::grpc::ServerStreamingHandler< " - "$Service$::Service, $Request$, $Response$>(\n" - " std::function< ::grpc::Status($Service$::Service*, " + "$ns$$Service$::Service, $Request$, $Response$>(\n" + " std::function< ::grpc::Status($ns$$Service$::Service*, " "::grpc::ServerContext*, " "const $Request$*, ::grpc::ServerWriter< $Response$>*)>(" - "&$Service$::Service::$Method$), this),\n" + "&$ns$$Service$::Service::$Method$), this),\n" " new $Request$, new $Response$));\n"); } else if (BidiStreaming(method)) { printer->Print( *vars, "service_->AddMethod(new ::grpc::RpcServiceMethod(\n" - " $Service$_method_names[$Idx$],\n" + " $prefix$$Service$_method_names[$Idx$],\n" " ::grpc::RpcMethod::BIDI_STREAMING,\n" " new ::grpc::BidiStreamingHandler< " - "$Service$::Service, $Request$, $Response$>(\n" - " std::function< ::grpc::Status($Service$::Service*, " + "$ns$$Service$::Service, $Request$, $Response$>(\n" + " std::function< ::grpc::Status($ns$$Service$::Service*, " "::grpc::ServerContext*, " "::grpc::ServerReaderWriter< $Response$, $Request$>*)>(" - "&$Service$::Service::$Method$), this),\n" + "&$ns$$Service$::Service::$Method$), this),\n" " new $Request$, new $Response$));\n"); } } @@ -702,7 +714,8 @@ void PrintSourceService(grpc::protobuf::io::Printer *printer, printer->Print("}\n\n"); } -grpc::string GetSourceServices(const grpc::protobuf::FileDescriptor *file) { +grpc::string GetSourceServices(const grpc::protobuf::FileDescriptor *file, + const Parameters ¶ms) { grpc::string output; grpc::protobuf::io::StringOutputStream output_stream(&output); grpc::protobuf::io::Printer printer(&output_stream, '$'); @@ -713,6 +726,13 @@ grpc::string GetSourceServices(const grpc::protobuf::FileDescriptor *file) { if (!file->package().empty()) { vars["Package"].append("."); } + if (!params.services_namespace.empty()) { + vars["ns"] = params.services_namespace + "::"; + vars["prefix"] = params.services_namespace; + } else { + vars["ns"] = ""; + vars["prefix"] = ""; + } for (int i = 0; i < file->service_count(); ++i) { PrintSourceService(&printer, file->service(i), &vars); diff --git a/src/compiler/cpp_generator.h b/src/compiler/cpp_generator.h index 2ecdb5c47e..04ad71c067 100644 --- a/src/compiler/cpp_generator.h +++ b/src/compiler/cpp_generator.h @@ -38,17 +38,26 @@ namespace grpc_cpp_generator { +// Contains all the parameters that are parsed from the command line. +struct Parameters { + // Puts the service into a namespace + grpc::string services_namespace; +}; + // Return the includes needed for generated header file. -grpc::string GetHeaderIncludes(const grpc::protobuf::FileDescriptor *file); +grpc::string GetHeaderIncludes(const grpc::protobuf::FileDescriptor *file, + const Parameters ¶ms); // Return the includes needed for generated source file. -grpc::string GetSourceIncludes(); +grpc::string GetSourceIncludes(const Parameters ¶ms); // Return the services for generated header file. -grpc::string GetHeaderServices(const grpc::protobuf::FileDescriptor *file); +grpc::string GetHeaderServices(const grpc::protobuf::FileDescriptor *file, + const Parameters ¶ms); // Return the services for generated source file. -grpc::string GetSourceServices(const grpc::protobuf::FileDescriptor *file); +grpc::string GetSourceServices(const grpc::protobuf::FileDescriptor *file, + const Parameters ¶ms); } // namespace grpc_cpp_generator diff --git a/src/compiler/cpp_plugin.cc b/src/compiler/cpp_plugin.cc index 5b83aa85cf..534abdeed0 100644 --- a/src/compiler/cpp_plugin.cc +++ b/src/compiler/cpp_plugin.cc @@ -58,18 +58,35 @@ class CppGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { return false; } + grpc_cpp_generator::Parameters generator_parameters; + + if (!parameter.empty()) { + std::vector parameters_list = + grpc_generator::tokenize(parameter, ","); + for (auto ¶meter_string: parameters_list) { + std::vector param = + grpc_generator::tokenize(parameter_string, "="); + if (param[0] == "services_namespace") { + generator_parameters.services_namespace = param[1]; + } else { + *error = grpc::string("Unknown parameter: ") + parameter_string; + return false; + } + } + } + grpc::string file_name = grpc_generator::StripProto(file->name()); // Generate .pb.h Insert(context, file_name + ".pb.h", "includes", - grpc_cpp_generator::GetHeaderIncludes(file)); + grpc_cpp_generator::GetHeaderIncludes(file, generator_parameters)); Insert(context, file_name + ".pb.h", "namespace_scope", - grpc_cpp_generator::GetHeaderServices(file)); + grpc_cpp_generator::GetHeaderServices(file, generator_parameters)); // Generate .pb.cc Insert(context, file_name + ".pb.cc", "includes", - grpc_cpp_generator::GetSourceIncludes()); + grpc_cpp_generator::GetSourceIncludes(generator_parameters)); Insert(context, file_name + ".pb.cc", "namespace_scope", - grpc_cpp_generator::GetSourceServices(file)); + grpc_cpp_generator::GetSourceServices(file, generator_parameters)); return true; } diff --git a/src/compiler/generator_helpers.h b/src/compiler/generator_helpers.h index 1e6727dd4c..30857891c7 100644 --- a/src/compiler/generator_helpers.h +++ b/src/compiler/generator_helpers.h @@ -75,6 +75,26 @@ inline grpc::string StringReplace(grpc::string str, const grpc::string &from, return str; } +inline std::vector tokenize(const grpc::string &input, + const grpc::string &delimiters) { + std::vector tokens; + size_t pos, last_pos = 0; + + for (;;) { + bool done = false; + pos = input.find_first_of(delimiters, last_pos); + if (pos == grpc::string::npos) { + done = true; + pos = input.length(); + } + + tokens.push_back(input.substr(last_pos, pos - last_pos)); + if (done) return tokens; + + last_pos = pos + 1; + } +} + } // namespace grpc_generator #endif // GRPC_INTERNAL_COMPILER_GENERATOR_HELPERS_H -- cgit v1.2.3 From f3770c38b760b71ec24d97de44276b8e6a2e6007 Mon Sep 17 00:00:00 2001 From: Tim Emiola Date: Thu, 19 Mar 2015 23:27:29 -0700 Subject: Renables the test checking the server can send the initial bidi message --- src/ruby/spec/generic/client_stub_spec.rb | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/ruby/spec/generic/client_stub_spec.rb b/src/ruby/spec/generic/client_stub_spec.rb index 73f2d37e30..0c98fc40d9 100644 --- a/src/ruby/spec/generic/client_stub_spec.rb +++ b/src/ruby/spec/generic/client_stub_spec.rb @@ -384,13 +384,7 @@ describe 'ClientStub' do th.join end - # disabled because an unresolved wire-protocol implementation feature - # - # - servers should be able initiate messaging, however, as it stand - # servers don't know if all the client metadata has been sent until - # they receive a message from the client. Without receiving all the - # metadata, the server does not accept the call, so this test hangs. - xit 'supports a server-initiated ping pong', bidi: true do + it 'supports a server-initiated ping pong', bidi: true do server_port = create_test_server host = "localhost:#{server_port}" th = run_bidi_streamer_echo_ping_pong(@sent_msgs, @pass, false) -- cgit v1.2.3 From 478568e7c9566598445410a8a112eaa02289dc23 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Mon, 23 Mar 2015 22:09:22 -0700 Subject: Use grpc:: counterparts in ruby code generator --- src/compiler/ruby_generator.cc | 48 ++++++++++++++----------------- src/compiler/ruby_generator.h | 10 ++----- src/compiler/ruby_generator_helpers-inl.h | 12 ++++---- src/compiler/ruby_generator_map-inl.h | 13 +++++---- src/compiler/ruby_generator_string-inl.h | 43 +++++++++++++-------------- src/compiler/ruby_plugin.cc | 30 +++++++------------ 6 files changed, 69 insertions(+), 87 deletions(-) diff --git a/src/compiler/ruby_generator.cc b/src/compiler/ruby_generator.cc index 32b6a8d8e4..a0bb92848b 100644 --- a/src/compiler/ruby_generator.cc +++ b/src/compiler/ruby_generator.cc @@ -32,24 +32,20 @@ */ #include -#include #include #include +#include "src/compiler/config.h" #include "src/compiler/ruby_generator.h" #include "src/compiler/ruby_generator_helpers-inl.h" #include "src/compiler/ruby_generator_map-inl.h" #include "src/compiler/ruby_generator_string-inl.h" -#include -#include -#include -#include - -using google::protobuf::FileDescriptor; -using google::protobuf::ServiceDescriptor; -using google::protobuf::MethodDescriptor; -using google::protobuf::io::Printer; -using google::protobuf::io::StringOutputStream; + +using grpc::protobuf::FileDescriptor; +using grpc::protobuf::ServiceDescriptor; +using grpc::protobuf::MethodDescriptor; +using grpc::protobuf::io::Printer; +using grpc::protobuf::io::StringOutputStream; using std::map; using std::vector; @@ -57,38 +53,38 @@ namespace grpc_ruby_generator { namespace { // Prints out the method using the ruby gRPC DSL. -void PrintMethod(const MethodDescriptor *method, const std::string &package, +void PrintMethod(const MethodDescriptor *method, const grpc::string &package, Printer *out) { - std::string input_type = RubyTypeOf(method->input_type()->name(), package); + grpc::string input_type = RubyTypeOf(method->input_type()->name(), package); if (method->client_streaming()) { input_type = "stream(" + input_type + ")"; } - std::string output_type = RubyTypeOf(method->output_type()->name(), package); + grpc::string output_type = RubyTypeOf(method->output_type()->name(), package); if (method->server_streaming()) { output_type = "stream(" + output_type + ")"; } - std::map method_vars = + std::map method_vars = ListToDict({"mth.name", method->name(), "input.type", input_type, "output.type", output_type, }); out->Print(method_vars, "rpc :$mth.name$, $input.type$, $output.type$\n"); } // Prints out the service using the ruby gRPC DSL. -void PrintService(const ServiceDescriptor *service, const std::string &package, +void PrintService(const ServiceDescriptor *service, const grpc::string &package, Printer *out) { if (service->method_count() == 0) { return; } // Begin the service module - std::map module_vars = + std::map module_vars = ListToDict({"module.name", CapitalizeFirst(service->name()), }); out->Print(module_vars, "module $module.name$\n"); out->Indent(); // TODO(temiola): add documentation - std::string doc = "TODO: add proto service documentation here"; - std::map template_vars = + grpc::string doc = "TODO: add proto service documentation here"; + std::map template_vars = ListToDict({"Documentation", doc, }); out->Print("\n"); out->Print(template_vars, "# $Documentation$\n"); @@ -101,7 +97,7 @@ void PrintService(const ServiceDescriptor *service, const std::string &package, out->Print("\n"); out->Print("self.marshal_class_method = :encode\n"); out->Print("self.unmarshal_class_method = :decode\n"); - std::map pkg_vars = + std::map pkg_vars = ListToDict({"service.name", service->name(), "pkg.name", package, }); out->Print(pkg_vars, "self.service_name = '$pkg.name$.$service.name$'\n"); out->Print("\n"); @@ -121,8 +117,8 @@ void PrintService(const ServiceDescriptor *service, const std::string &package, } // namespace -std::string GetServices(const FileDescriptor *file) { - std::string output; +grpc::string GetServices(const FileDescriptor *file) { + grpc::string output; StringOutputStream output_stream(&output); Printer out(&output_stream, '$'); @@ -133,7 +129,7 @@ std::string GetServices(const FileDescriptor *file) { } // Write out a file header. - std::map header_comment_vars = ListToDict( + std::map header_comment_vars = ListToDict( {"file.name", file->name(), "file.package", file->package(), }); out.Print("# Generated by the protocol buffer compiler. DO NOT EDIT!\n"); out.Print(header_comment_vars, @@ -144,15 +140,15 @@ std::string GetServices(const FileDescriptor *file) { // Write out require statemment to import the separately generated file // that defines the messages used by the service. This is generated by the // main ruby plugin. - std::map dep_vars = + std::map dep_vars = ListToDict({"dep.name", MessagesRequireName(file), }); out.Print(dep_vars, "require '$dep.name$'\n"); // Write out services within the modules out.Print("\n"); - std::vector modules = Split(file->package(), '.'); + std::vector modules = Split(file->package(), '.'); for (size_t i = 0; i < modules.size(); ++i) { - std::map module_vars = + std::map module_vars = ListToDict({"module.name", CapitalizeFirst(modules[i]), }); out.Print(module_vars, "module $module.name$\n"); out.Indent(); diff --git a/src/compiler/ruby_generator.h b/src/compiler/ruby_generator.h index 4dd38e0c27..a2ab36d4d9 100644 --- a/src/compiler/ruby_generator.h +++ b/src/compiler/ruby_generator.h @@ -34,17 +34,11 @@ #ifndef GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_H #define GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_H -#include - -namespace google { -namespace protobuf { -class FileDescriptor; -} // namespace protobuf -} // namespace google +#include "src/compiler/config.h" namespace grpc_ruby_generator { -std::string GetServices(const google::protobuf::FileDescriptor *file); +grpc::string GetServices(const grpc::protobuf::FileDescriptor *file); } // namespace grpc_ruby_generator diff --git a/src/compiler/ruby_generator_helpers-inl.h b/src/compiler/ruby_generator_helpers-inl.h index f3a087b3f8..9da7cab3c7 100644 --- a/src/compiler/ruby_generator_helpers-inl.h +++ b/src/compiler/ruby_generator_helpers-inl.h @@ -34,15 +34,13 @@ #ifndef GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_HELPERS_INL_H #define GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_HELPERS_INL_H -#include - -#include +#include "src/compiler/config.h" #include "src/compiler/ruby_generator_string-inl.h" namespace grpc_ruby_generator { -inline bool ServicesFilename(const google::protobuf::FileDescriptor *file, - std::string *file_name_or_error) { +inline bool ServicesFilename(const grpc::protobuf::FileDescriptor *file, + grpc::string *file_name_or_error) { // Get output file name. static const unsigned proto_suffix_length = 6; // length of ".proto" if (file->name().size() > proto_suffix_length && @@ -57,8 +55,8 @@ inline bool ServicesFilename(const google::protobuf::FileDescriptor *file, } } -inline std::string MessagesRequireName( - const google::protobuf::FileDescriptor *file) { +inline grpc::string MessagesRequireName( + const grpc::protobuf::FileDescriptor *file) { return Replace(file->name(), ".proto", ""); } diff --git a/src/compiler/ruby_generator_map-inl.h b/src/compiler/ruby_generator_map-inl.h index f902b6d98f..6b87774f21 100644 --- a/src/compiler/ruby_generator_map-inl.h +++ b/src/compiler/ruby_generator_map-inl.h @@ -34,11 +34,12 @@ #ifndef GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_MAP_INL_H #define GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_MAP_INL_H +#include "src/compiler/config.h" + #include #include #include #include // NOLINT -#include #include using std::initializer_list; @@ -49,18 +50,18 @@ namespace grpc_ruby_generator { // Converts an initializer list of the form { key0, value0, key1, value1, ... } // into a map of key* to value*. Is merely a readability helper for later code. -inline std::map ListToDict( - const initializer_list &values) { +inline std::map ListToDict( + const initializer_list &values) { if (values.size() % 2 != 0) { std::cerr << "Not every 'key' has a value in `values`." << std::endl; } - std::map value_map; + std::map value_map; auto value_iter = values.begin(); for (unsigned i = 0; i < values.size() / 2; ++i) { - std::string key = *value_iter; + grpc::string key = *value_iter; ++value_iter; - std::string value = *value_iter; + grpc::string value = *value_iter; value_map[key] = value; ++value_iter; } diff --git a/src/compiler/ruby_generator_string-inl.h b/src/compiler/ruby_generator_string-inl.h index bdd314c16e..8da3a88da2 100644 --- a/src/compiler/ruby_generator_string-inl.h +++ b/src/compiler/ruby_generator_string-inl.h @@ -34,8 +34,9 @@ #ifndef GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_STRING_INL_H #define GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_STRING_INL_H +#include "src/compiler/config.h" + #include -#include #include #include @@ -45,10 +46,10 @@ using std::transform; namespace grpc_ruby_generator { // Split splits a string using char into elems. -inline std::vector &Split(const std::string &s, char delim, - std::vector *elems) { +inline std::vector &Split(const grpc::string &s, char delim, + std::vector *elems) { std::stringstream ss(s); - std::string item; + grpc::string item; while (getline(ss, item, delim)) { elems->push_back(item); } @@ -56,17 +57,17 @@ inline std::vector &Split(const std::string &s, char delim, } // Split splits a string using char, returning the result in a vector. -inline std::vector Split(const std::string &s, char delim) { - std::vector elems; +inline std::vector Split(const grpc::string &s, char delim) { + std::vector elems; Split(s, delim, &elems); return elems; } // Replace replaces from with to in s. -inline std::string Replace(std::string s, const std::string &from, - const std::string &to) { +inline grpc::string Replace(grpc::string s, const grpc::string &from, + const grpc::string &to) { size_t start_pos = s.find(from); - if (start_pos == std::string::npos) { + if (start_pos == grpc::string::npos) { return s; } s.replace(start_pos, from.length(), to); @@ -74,10 +75,10 @@ inline std::string Replace(std::string s, const std::string &from, } // ReplaceAll replaces all instances of search with replace in s. -inline std::string ReplaceAll(std::string s, const std::string &search, - const std::string &replace) { +inline grpc::string ReplaceAll(grpc::string s, const grpc::string &search, + const grpc::string &replace) { size_t pos = 0; - while ((pos = s.find(search, pos)) != std::string::npos) { + while ((pos = s.find(search, pos)) != grpc::string::npos) { s.replace(pos, search.length(), replace); pos += replace.length(); } @@ -85,10 +86,10 @@ inline std::string ReplaceAll(std::string s, const std::string &search, } // ReplacePrefix replaces from with to in s if search is a prefix of s. -inline bool ReplacePrefix(std::string *s, const std::string &from, - const std::string &to) { +inline bool ReplacePrefix(grpc::string *s, const grpc::string &from, + const grpc::string &to) { size_t start_pos = s->find(from); - if (start_pos == std::string::npos || start_pos != 0) { + if (start_pos == grpc::string::npos || start_pos != 0) { return false; } s->replace(start_pos, from.length(), to); @@ -96,7 +97,7 @@ inline bool ReplacePrefix(std::string *s, const std::string &from, } // CapitalizeFirst capitalizes the first char in a string. -inline std::string CapitalizeFirst(std::string s) { +inline grpc::string CapitalizeFirst(grpc::string s) { if (s.empty()) { return s; } @@ -105,15 +106,15 @@ inline std::string CapitalizeFirst(std::string s) { } // RubyTypeOf updates a proto type to the required ruby equivalent. -inline std::string RubyTypeOf(const std::string &a_type, - const std::string &package) { - std::string res(a_type); +inline grpc::string RubyTypeOf(const grpc::string &a_type, + const grpc::string &package) { + grpc::string res(a_type); ReplacePrefix(&res, package, ""); // remove the leading package if present ReplacePrefix(&res, ".", ""); // remove the leading . (no package) - if (res.find('.') == std::string::npos) { + if (res.find('.') == grpc::string::npos) { return res; } else { - std::vector prefixes_and_type = Split(res, '.'); + std::vector prefixes_and_type = Split(res, '.'); for (unsigned int i = 0; i < prefixes_and_type.size(); ++i) { if (i != 0) { res += "::"; // switch '.' to the ruby module delim diff --git a/src/compiler/ruby_plugin.cc b/src/compiler/ruby_plugin.cc index 4a6e9f7a5d..bd10d46e9c 100644 --- a/src/compiler/ruby_plugin.cc +++ b/src/compiler/ruby_plugin.cc @@ -32,43 +32,35 @@ */ // Generates Ruby gRPC service interface out of Protobuf IDL. -// -// This is a Proto2 compiler plugin. See net/proto2/compiler/proto/plugin.proto -// and net/proto2/compiler/public/plugin.h for more information on plugins. #include -#include +#include "src/compiler/config.h" #include "src/compiler/ruby_generator.h" #include "src/compiler/ruby_generator_helpers-inl.h" -#include -#include -#include -#include -#include -class RubyGrpcGenerator : public google::protobuf::compiler::CodeGenerator { +class RubyGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { public: RubyGrpcGenerator() {} ~RubyGrpcGenerator() {} - bool Generate(const google::protobuf::FileDescriptor *file, - const std::string ¶meter, - google::protobuf::compiler::GeneratorContext *context, - std::string *error) const { - std::string code = grpc_ruby_generator::GetServices(file); + bool Generate(const grpc::protobuf::FileDescriptor *file, + const grpc::string ¶meter, + grpc::protobuf::compiler::GeneratorContext *context, + grpc::string *error) const { + grpc::string code = grpc_ruby_generator::GetServices(file); if (code.size() == 0) { return true; // don't generate a file if there are no services } // Get output file name. - std::string file_name; + grpc::string file_name; if (!grpc_ruby_generator::ServicesFilename(file, &file_name)) { return false; } - std::unique_ptr output( + std::unique_ptr output( context->Open(file_name)); - google::protobuf::io::CodedOutputStream coded_out(output.get()); + grpc::protobuf::io::CodedOutputStream coded_out(output.get()); coded_out.WriteRaw(code.data(), code.size()); return true; } @@ -76,5 +68,5 @@ class RubyGrpcGenerator : public google::protobuf::compiler::CodeGenerator { int main(int argc, char *argv[]) { RubyGrpcGenerator generator; - return google::protobuf::compiler::PluginMain(argc, argv, &generator); + return grpc::protobuf::compiler::PluginMain(argc, argv, &generator); } -- cgit v1.2.3 From f20d76097266e6a708ad1b6d4d1cb45b1c5b581c Mon Sep 17 00:00:00 2001 From: Tim Emiola Date: Tue, 24 Mar 2015 08:11:47 -0700 Subject: Updates the Rakefile - simplify the test suite namespace - fix bug in test suite setup where wrappper tests were run twice - removes unnecessary descs - add bunder's gem tasks for release and installation --- src/ruby/Rakefile | 53 +++++++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/src/ruby/Rakefile b/src/ruby/Rakefile index b27305d16c..afb354e922 100755 --- a/src/ruby/Rakefile +++ b/src/ruby/Rakefile @@ -2,14 +2,17 @@ require 'rake/extensiontask' require 'rspec/core/rake_task' require 'rubocop/rake_task' +require 'bundler/gem_tasks' -desc 'Run Rubocop to check for style violations' +# Add rubocop style checking tasks RuboCop::RakeTask.new +# Add the extension compiler task Rake::ExtensionTask.new 'grpc' do |ext| ext.lib_dir = File.join('lib', 'grpc') end +# Define the test suites SPEC_SUITES = [ { id: :wrapper, title: 'wrapper layer', files: %w(spec/*.rb) }, { id: :idiomatic, title: 'idiomatic layer', dir: %w(spec/generic), @@ -19,36 +22,34 @@ SPEC_SUITES = [ { id: :server, title: 'rpc server thread tests', dir: %w(spec/generic), tag: 'server' } ] +namespace :suite do + SPEC_SUITES.each do |suite| + desc "Run all specs in the #{suite[:title]} spec suite" + RSpec::Core::RakeTask.new(suite[:id]) do |t| + spec_files = [] + suite[:files].each { |f| spec_files += Dir[f] } if suite[:files] + + if suite[:dir] + suite[:dir].each { |f| spec_files += Dir["#{f}/**/*_spec.rb"] } + end + helper = 'spec/spec_helper.rb' + spec_files << helper unless spec_files.include?(helper) -desc 'Run all RSpec tests' -namespace :spec do - namespace :suite do - SPEC_SUITES.each do |suite| - desc "Run all specs in #{suite[:title]} spec suite" - RSpec::Core::RakeTask.new(suite[:id]) do |t| - spec_files = [] - suite[:files].each { |f| spec_files += Dir[f] } if suite[:files] - - if suite[:dirs] - suite[:dirs].each { |f| spec_files += Dir["#{f}/**/*_spec.rb"] } - end - - t.pattern = spec_files - t.rspec_opts = "--tag #{suite[:tag]}" if suite[:tag] - if suite[:tags] - t.rspec_opts = suite[:tags].map { |x| "--tag #{x}" }.join(' ') - end + t.pattern = spec_files + t.rspec_opts = "--tag #{suite[:tag]}" if suite[:tag] + if suite[:tags] + t.rspec_opts = suite[:tags].map { |x| "--tag #{x}" }.join(' ') end end end end -desc 'Compiles the extension then runs all the tests' -task :all +# Define dependencies between the suites. +task 'suite:wrapper' => [:compile, :rubocop] +task 'suite:idiomatic' => 'suite:wrapper' +task 'suite:bidi' => 'suite:wrapper' +task 'suite:server' => 'suite:wrapper' +desc 'Compiles the gRPC extension then runs all the tests' +task all: ['suite:idiomatic', 'suite:bidi', 'suite:server'] task default: :all -task 'spec:suite:wrapper' => [:compile, :rubocop] -task 'spec:suite:idiomatic' => 'spec:suite:wrapper' -task 'spec:suite:bidi' => 'spec:suite:wrapper' -task 'spec:suite:server' => 'spec:suite:wrapper' -task all: ['spec:suite:idiomatic', 'spec:suite:bidi', 'spec:suite:server'] -- cgit v1.2.3 From 5c4ff03d0d1d02d353c0922d1cf07b173d0f5807 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Wed, 25 Mar 2015 00:57:51 +0900 Subject: Fix server crash if host header field is translated to :authority Previously we missed the fact that we have to increment reference count when passing grpc_mdstr to grpc_mdelem_from_metadata_strings, which leads to crash. This commit fixes this issue. --- src/core/channel/http_server_filter.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/channel/http_server_filter.c b/src/core/channel/http_server_filter.c index f565cbf3ae..9da8b333ca 100644 --- a/src/core/channel/http_server_filter.c +++ b/src/core/channel/http_server_filter.c @@ -189,7 +189,8 @@ static void call_op(grpc_call_element *elem, grpc_call_element *from_elem, /* translate host to :authority since :authority may be omitted */ grpc_mdelem *authority = grpc_mdelem_from_metadata_strings( - channeld->mdctx, channeld->authority_key, op->data.metadata->value); + channeld->mdctx, grpc_mdstr_ref(channeld->authority_key), + grpc_mdstr_ref(op->data.metadata->value)); grpc_mdelem_unref(op->data.metadata); op->data.metadata = authority; /* pass the event up */ -- cgit v1.2.3 From 9c4425a4d5302f567075ca08a18c7bfbcfde6458 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 24 Mar 2015 09:43:41 -0700 Subject: Added comments to new functions in call.c --- src/php/ext/grpc/call.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/php/ext/grpc/call.c b/src/php/ext/grpc/call.c index 08f4f2b1eb..d0e324e2cc 100644 --- a/src/php/ext/grpc/call.c +++ b/src/php/ext/grpc/call.c @@ -112,6 +112,8 @@ zval *grpc_php_wrap_call(grpc_call *wrapped, grpc_completion_queue *queue, return call_object; } +/* Creates and returns a PHP array object with the data in a + * grpc_metadata_array. Returns NULL on failure */ zval *grpc_parse_metadata_array(grpc_metadata_array *metadata_array) { int count = metadata_array->count; grpc_metadata *elements = metadata_array->metadata; @@ -155,6 +157,8 @@ zval *grpc_parse_metadata_array(grpc_metadata_array *metadata_array) { return array; } +/* Populates a grpc_metadata_array with the data in a PHP array object. + Returns true on success and false on failure */ bool create_metadata_array(zval *array, grpc_metadata_array *metadata) { zval **inner_array; zval **value; -- cgit v1.2.3 From 82dd80abc6fffab0f0bcff406dbd0750a6a45b37 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Tue, 24 Mar 2015 10:36:08 -0700 Subject: Elminate range-based fors and work around some other limitations in older compilers --- src/compiler/python_generator.cc | 22 +++++++++------ src/cpp/common/call.cc | 2 +- src/cpp/server/secure_server_credentials.cc | 9 ++++-- src/cpp/server/server.cc | 4 +-- src/cpp/server/server_builder.cc | 18 ++++++------ src/cpp/server/thread_pool.cc | 4 +-- test/cpp/end2end/generic_end2end_test.cc | 4 +-- test/cpp/qps/client_async.cc | 11 ++++---- test/cpp/qps/driver.cc | 44 ++++++++++++++--------------- test/cpp/qps/server_async.cc | 4 +-- test/cpp/qps/stats.h | 4 +-- 11 files changed, 69 insertions(+), 57 deletions(-) diff --git a/src/compiler/python_generator.cc b/src/compiler/python_generator.cc index c2d4cda31a..748417e477 100644 --- a/src/compiler/python_generator.cc +++ b/src/compiler/python_generator.cc @@ -309,17 +309,20 @@ bool PrintServerFactory(const grpc::string& package_qualified_service_name, make_pair(method->name(), output_message_module_and_class)); } out->Print("method_service_descriptions = {\n"); - for (auto& name_and_description_constructor : - method_description_constructors) { + for (auto name_and_description_constructor = + method_description_constructors.begin(); + name_and_description_constructor != + method_description_constructors.end(); + name_and_description_constructor++) { IndentScope raii_descriptions_indent(out); - const grpc::string method_name = name_and_description_constructor.first; + const grpc::string method_name = name_and_description_constructor->first; auto input_message_module_and_class = input_message_modules_and_classes.find(method_name); auto output_message_module_and_class = output_message_modules_and_classes.find(method_name); out->Print("\"$Method$\": utilities.$Constructor$(\n", "Method", method_name, "Constructor", - name_and_description_constructor.second); + name_and_description_constructor->second); { IndentScope raii_description_arguments_indent(out); out->Print("servicer.$Method$,\n", "Method", method_name); @@ -387,17 +390,20 @@ bool PrintStubFactory(const grpc::string& package_qualified_service_name, make_pair(method->name(), output_message_module_and_class)); } out->Print("method_invocation_descriptions = {\n"); - for (auto& name_and_description_constructor : - method_description_constructors) { + for (auto name_and_description_constructor = + method_description_constructors.begin(); + name_and_description_constructor != + method_description_constructors.end(); + name_and_description_constructor++) { IndentScope raii_descriptions_indent(out); - const grpc::string method_name = name_and_description_constructor.first; + const grpc::string method_name = name_and_description_constructor->first; auto input_message_module_and_class = input_message_modules_and_classes.find(method_name); auto output_message_module_and_class = output_message_modules_and_classes.find(method_name); out->Print("\"$Method$\": utilities.$Constructor$(\n", "Method", method_name, "Constructor", - name_and_description_constructor.second); + name_and_description_constructor->second); { IndentScope raii_description_arguments_indent(out); out->Print( diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index 5c26a1ad7c..311e0d01b0 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -148,7 +148,7 @@ void FillMetadataMap(grpc_metadata_array* arr, // TODO(yangg) handle duplicates? metadata->insert(std::pair( arr->metadata[i].key, - {arr->metadata[i].value, arr->metadata[i].value_length})); + grpc::string(arr->metadata[i].value, arr->metadata[i].value_length))); } grpc_metadata_array_destroy(arr); grpc_metadata_array_init(arr); diff --git a/src/cpp/server/secure_server_credentials.cc b/src/cpp/server/secure_server_credentials.cc index 88f7a9b1a9..49d69a3fb9 100644 --- a/src/cpp/server/secure_server_credentials.cc +++ b/src/cpp/server/secure_server_credentials.cc @@ -59,9 +59,12 @@ class SecureServerCredentials GRPC_FINAL : public ServerCredentials { std::shared_ptr SslServerCredentials( const SslServerCredentialsOptions& options) { std::vector pem_key_cert_pairs; - for (const auto& key_cert_pair : options.pem_key_cert_pairs) { - pem_key_cert_pairs.push_back( - {key_cert_pair.private_key.c_str(), key_cert_pair.cert_chain.c_str()}); + for (auto key_cert_pair = options.pem_key_cert_pairs.begin(); + key_cert_pair != options.pem_key_cert_pairs.end(); + key_cert_pair++) { + grpc_ssl_pem_key_cert_pair p = {key_cert_pair->private_key.c_str(), + key_cert_pair->cert_chain.c_str()}; + pem_key_cert_pairs.push_back(p); } grpc_server_credentials* c_creds = grpc_ssl_server_credentials_create( options.pem_root_certs.empty() ? nullptr : options.pem_root_certs.c_str(), diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index 5a4ca6915a..8e6a6cf40a 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -247,8 +247,8 @@ bool Server::Start() { // Start processing rpcs. if (!sync_methods_.empty()) { - for (auto& m : sync_methods_) { - m.Request(server_); + for (auto m = sync_methods_.begin(); m != sync_methods_.end(); m++) { + m->Request(server_); } ScheduleCallback(); diff --git a/src/cpp/server/server_builder.cc b/src/cpp/server/server_builder.cc index 58bf9d937f..c5e115f396 100644 --- a/src/cpp/server/server_builder.cc +++ b/src/cpp/server/server_builder.cc @@ -86,24 +86,26 @@ std::unique_ptr ServerBuilder::BuildAndStart() { thread_pool_owned = true; } std::unique_ptr server(new Server(thread_pool_, thread_pool_owned)); - for (auto* service : services_) { - if (!server->RegisterService(service)) { + for (auto service = services_.begin(); service != services_.end(); + service++) { + if (!server->RegisterService(*service)) { return nullptr; } } - for (auto* service : async_services_) { - if (!server->RegisterAsyncService(service)) { + for (auto service = async_services_.begin(); + service != async_services_.end(); service++) { + if (!server->RegisterAsyncService(*service)) { return nullptr; } } if (generic_service_) { server->RegisterAsyncGenericService(generic_service_); } - for (auto& port : ports_) { - int r = server->AddListeningPort(port.addr, port.creds.get()); + for (auto port = ports_.begin(); port != ports_.end(); port++) { + int r = server->AddListeningPort(port->addr, port->creds.get()); if (!r) return nullptr; - if (port.selected_port != nullptr) { - *port.selected_port = r; + if (port->selected_port != nullptr) { + *port->selected_port = r; } } if (!server->Start()) { diff --git a/src/cpp/server/thread_pool.cc b/src/cpp/server/thread_pool.cc index d3013b806c..2c0f4da812 100644 --- a/src/cpp/server/thread_pool.cc +++ b/src/cpp/server/thread_pool.cc @@ -66,8 +66,8 @@ ThreadPool::~ThreadPool() { shutdown_ = true; cv_.notify_all(); } - for (auto& t : threads_) { - t.join(); + for (auto t = threads_.begin(); t != threads_.end(); t++) { + t->join(); } } diff --git a/test/cpp/end2end/generic_end2end_test.cc b/test/cpp/end2end/generic_end2end_test.cc index 711f1b9540..11998a7cb7 100644 --- a/test/cpp/end2end/generic_end2end_test.cc +++ b/test/cpp/end2end/generic_end2end_test.cc @@ -83,8 +83,8 @@ bool ParseFromByteBuffer(ByteBuffer* buffer, grpc::protobuf::Message* message) { buffer->Dump(&slices); grpc::string buf; buf.reserve(buffer->Length()); - for (const Slice& s : slices) { - buf.append(reinterpret_cast(s.begin()), s.size()); + for (auto s = slices.begin(); s != slices.end(); s++) { + buf.append(reinterpret_cast(s->begin()), s->size()); } return message->ParseFromString(buf); } diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc index 526f37a1fd..f995a63f49 100644 --- a/test/cpp/qps/client_async.cc +++ b/test/cpp/qps/client_async.cc @@ -144,7 +144,8 @@ class AsyncClient GRPC_FINAL : public Client { int t = 0; for (int i = 0; i < config.outstanding_rpcs_per_channel(); i++) { - for (auto& channel : channels_) { + for (auto channel = channels_.begin(); channel != channels_.end(); + channel++) { auto* cq = cli_cqs_[t].get(); t = (t + 1) % cli_cqs_.size(); auto start_req = [cq](TestService::Stub* stub, grpc::ClientContext* ctx, @@ -152,7 +153,7 @@ class AsyncClient GRPC_FINAL : public Client { return stub->AsyncUnaryCall(ctx, request, cq, tag); }; - TestService::Stub* stub = channel.get_stub(); + TestService::Stub* stub = channel->get_stub(); const SimpleRequest& request = request_; new ClientRpcContextUnaryImpl( stub, request, start_req, check_done); @@ -165,11 +166,11 @@ class AsyncClient GRPC_FINAL : public Client { ~AsyncClient() GRPC_OVERRIDE { EndThreads(); - for (auto& cq : cli_cqs_) { - cq->Shutdown(); + for (auto cq = cli_cqs_.begin(); cq != cli_cqs_.end(); cq++) { + (*cq)->Shutdown(); void* got_tag; bool ok; - while (cq->Next(&got_tag, &ok)) { + while ((*cq)->Next(&got_tag, &ok)) { delete ClientRpcContext::detag(got_tag); } } diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc index d29ca1de94..64a53496ae 100644 --- a/test/cpp/qps/driver.cc +++ b/test/cpp/qps/driver.cc @@ -154,19 +154,19 @@ ScenarioResult RunScenario(const ClientConfig& initial_client_config, server_mark.mutable_mark(); ClientArgs client_mark; client_mark.mutable_mark(); - for (auto& server : servers) { - GPR_ASSERT(server.stream->Write(server_mark)); + for (auto server = servers.begin(); server != servers.end(); server++) { + GPR_ASSERT(server->stream->Write(server_mark)); } - for (auto& client : clients) { - GPR_ASSERT(client.stream->Write(client_mark)); + for (auto client = clients.begin(); client != clients.end(); client++) { + GPR_ASSERT(client->stream->Write(client_mark)); } ServerStatus server_status; ClientStatus client_status; - for (auto& server : servers) { - GPR_ASSERT(server.stream->Read(&server_status)); + for (auto server = servers.begin(); server != servers.end(); server++) { + GPR_ASSERT(server->stream->Read(&server_status)); } - for (auto& client : clients) { - GPR_ASSERT(client.stream->Read(&client_status)); + for (auto client = clients.begin(); client != clients.end(); client++) { + GPR_ASSERT(client->stream->Read(&client_status)); } // Wait some time @@ -176,33 +176,33 @@ ScenarioResult RunScenario(const ClientConfig& initial_client_config, // Finish a run ScenarioResult result; gpr_log(GPR_INFO, "Finishing"); - for (auto& server : servers) { - GPR_ASSERT(server.stream->Write(server_mark)); + for (auto server = servers.begin(); server != servers.end(); server++) { + GPR_ASSERT(server->stream->Write(server_mark)); } - for (auto& client : clients) { - GPR_ASSERT(client.stream->Write(client_mark)); + for (auto client = clients.begin(); client != clients.end(); client++) { + GPR_ASSERT(client->stream->Write(client_mark)); } - for (auto& server : servers) { - GPR_ASSERT(server.stream->Read(&server_status)); + for (auto server = servers.begin(); server != servers.end(); server++) { + GPR_ASSERT(server->stream->Read(&server_status)); const auto& stats = server_status.stats(); result.server_resources.push_back(ResourceUsage{ stats.time_elapsed(), stats.time_user(), stats.time_system()}); } - for (auto& client : clients) { - GPR_ASSERT(client.stream->Read(&client_status)); + for (auto client = clients.begin(); client != clients.end(); client++) { + GPR_ASSERT(client->stream->Read(&client_status)); const auto& stats = client_status.stats(); result.latencies.MergeProto(stats.latencies()); result.client_resources.push_back(ResourceUsage{ stats.time_elapsed(), stats.time_user(), stats.time_system()}); } - for (auto& client : clients) { - GPR_ASSERT(client.stream->WritesDone()); - GPR_ASSERT(client.stream->Finish().IsOk()); + for (auto client = clients.begin(); client != clients.end(); client++) { + GPR_ASSERT(client->stream->WritesDone()); + GPR_ASSERT(client->stream->Finish().IsOk()); } - for (auto& server : servers) { - GPR_ASSERT(server.stream->WritesDone()); - GPR_ASSERT(server.stream->Finish().IsOk()); + for (auto server = servers.begin(); server != servers.end(); server++) { + GPR_ASSERT(server->stream->WritesDone()); + GPR_ASSERT(server->stream->Finish().IsOk()); } return result; } diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc index 586b6e7abe..7b81bd35a2 100644 --- a/test/cpp/qps/server_async.cc +++ b/test/cpp/qps/server_async.cc @@ -105,8 +105,8 @@ class AsyncQpsServerTest : public Server { ~AsyncQpsServerTest() { server_->Shutdown(); srv_cq_.Shutdown(); - for (auto& thr : threads_) { - thr.join(); + for (auto thr = threads_.begin(); thr != threads_.end(); thr++) { + thr->join(); } while (!contexts_.empty()) { delete contexts_.front(); diff --git a/test/cpp/qps/stats.h b/test/cpp/qps/stats.h index ca59390ad7..82dc03e3da 100644 --- a/test/cpp/qps/stats.h +++ b/test/cpp/qps/stats.h @@ -43,8 +43,8 @@ namespace testing { template double sum(const T& container, F functor) { double r = 0; - for (auto v : container) { - r += functor(v); + for (auto v = container.begin(); v != container.end(); v++) { + r += functor(*v); } return r; } -- cgit v1.2.3 From 652b7e983b45be22ec7f887e7f90d536cec994c2 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Tue, 24 Mar 2015 10:38:18 -0700 Subject: Revert "Remove dead members of server context" This reverts commit 8c8588c7dc047ee509c7367f61ba0c5f00cb61d1. --- include/grpc++/server_context.h | 3 +++ src/cpp/server/server_context.cc | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/include/grpc++/server_context.h b/include/grpc++/server_context.h index 36cbae87a0..9e3b80c641 100644 --- a/include/grpc++/server_context.h +++ b/include/grpc++/server_context.h @@ -78,6 +78,8 @@ class ServerContext { void AddInitialMetadata(const grpc::string& key, const grpc::string& value); void AddTrailingMetadata(const grpc::string& key, const grpc::string& value); + bool IsCancelled(); + const std::multimap& client_metadata() { return client_metadata_; } @@ -110,6 +112,7 @@ class ServerContext { std::chrono::system_clock::time_point deadline_; grpc_call* call_; + CompletionQueue* cq_; bool sent_initial_metadata_; std::multimap client_metadata_; std::multimap initial_metadata_; diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index 435a060be5..bb3c2d1405 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -94,6 +94,7 @@ bool ServerContext::CompletionOp::FinalizeResult(void** tag, bool* status) { ServerContext::ServerContext() : completion_op_(nullptr), call_(nullptr), + cq_(nullptr), sent_initial_metadata_(false) {} ServerContext::ServerContext(gpr_timespec deadline, grpc_metadata* metadata, @@ -101,6 +102,7 @@ ServerContext::ServerContext(gpr_timespec deadline, grpc_metadata* metadata, : completion_op_(nullptr), deadline_(Timespec2Timepoint(deadline)), call_(nullptr), + cq_(nullptr), sent_initial_metadata_(false) { for (size_t i = 0; i < metadata_count; i++) { client_metadata_.insert(std::make_pair( @@ -135,4 +137,8 @@ void ServerContext::AddTrailingMetadata(const grpc::string& key, trailing_metadata_.insert(std::make_pair(key, value)); } +bool ServerContext::IsCancelled() { + return completion_op_ && completion_op_->CheckCancelled(cq_); +} + } // namespace grpc -- cgit v1.2.3 From 8dafd52cea3daace6c0f9ae40a07f8782a86379e Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Tue, 24 Mar 2015 11:36:17 -0700 Subject: Revert "Remove dead members of server context" This reverts commit 8c8588c7dc047ee509c7367f61ba0c5f00cb61d1. --- include/grpc++/server_context.h | 3 +++ src/cpp/server/server_context.cc | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/include/grpc++/server_context.h b/include/grpc++/server_context.h index 36cbae87a0..9e3b80c641 100644 --- a/include/grpc++/server_context.h +++ b/include/grpc++/server_context.h @@ -78,6 +78,8 @@ class ServerContext { void AddInitialMetadata(const grpc::string& key, const grpc::string& value); void AddTrailingMetadata(const grpc::string& key, const grpc::string& value); + bool IsCancelled(); + const std::multimap& client_metadata() { return client_metadata_; } @@ -110,6 +112,7 @@ class ServerContext { std::chrono::system_clock::time_point deadline_; grpc_call* call_; + CompletionQueue* cq_; bool sent_initial_metadata_; std::multimap client_metadata_; std::multimap initial_metadata_; diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index 435a060be5..bb3c2d1405 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -94,6 +94,7 @@ bool ServerContext::CompletionOp::FinalizeResult(void** tag, bool* status) { ServerContext::ServerContext() : completion_op_(nullptr), call_(nullptr), + cq_(nullptr), sent_initial_metadata_(false) {} ServerContext::ServerContext(gpr_timespec deadline, grpc_metadata* metadata, @@ -101,6 +102,7 @@ ServerContext::ServerContext(gpr_timespec deadline, grpc_metadata* metadata, : completion_op_(nullptr), deadline_(Timespec2Timepoint(deadline)), call_(nullptr), + cq_(nullptr), sent_initial_metadata_(false) { for (size_t i = 0; i < metadata_count; i++) { client_metadata_.insert(std::make_pair( @@ -135,4 +137,8 @@ void ServerContext::AddTrailingMetadata(const grpc::string& key, trailing_metadata_.insert(std::make_pair(key, value)); } +bool ServerContext::IsCancelled() { + return completion_op_ && completion_op_->CheckCancelled(cq_); +} + } // namespace grpc -- cgit v1.2.3 From 4cba0ca39c9f979b231d1e64c3ef3aa3104bf1ca Mon Sep 17 00:00:00 2001 From: vjpai Date: Tue, 24 Mar 2015 18:01:37 -0700 Subject: Allow nullptr to be passed in if user doesn't care about tag for next,asyncnext --- src/cpp/common/completion_queue.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/cpp/common/completion_queue.cc b/src/cpp/common/completion_queue.cc index cea2d24831..7cea0185ec 100644 --- a/src/cpp/common/completion_queue.cc +++ b/src/cpp/common/completion_queue.cc @@ -59,10 +59,14 @@ class EventDeleter { CompletionQueue::NextStatus CompletionQueue::AsyncNextInternal( void** tag, bool* ok, gpr_timespec deadline) { std::unique_ptr ev; + void *dummy; + + if (tag == nullptr) // If user doesn't care + tag = &dummy; // Need to pass down something for (;;) { ev.reset(grpc_completion_queue_next(cq_, deadline)); - if (!ev) { /* got a NULL back because deadline passed */ + if (!ev) { // got a NULL back because deadline passed return TIMEOUT; } if (ev->type == GRPC_QUEUE_SHUTDOWN) { -- cgit v1.2.3 From 685e4d958a2da154e01b415ef4ecb3378556d9ac Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 24 Mar 2015 18:28:28 -0700 Subject: Fixed errors in ActiveCall --- src/php/lib/Grpc/ActiveCall.php | 8 +++++--- third_party/openssl | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/php/lib/Grpc/ActiveCall.php b/src/php/lib/Grpc/ActiveCall.php index af4dca50d7..9e048ae03b 100755 --- a/src/php/lib/Grpc/ActiveCall.php +++ b/src/php/lib/Grpc/ActiveCall.php @@ -77,7 +77,7 @@ class ActiveCall { */ public function read() { $read_event = $this->call->start_batch([OP_RECV_MESSAGE => true]); - return $read_event->data; + return $read_event->message; } /** @@ -102,7 +102,9 @@ class ActiveCall { * and array $metadata members */ public function getStatus() { - $status_event = $this->call->start_batch([RECV_STATUS_ON_CLIENT => true]); - return $status_event->data; + $status_event = $this->call->start_batch([ + OP_RECV_STATUS_ON_CLIENT => true + ]); + return $status_event->status; } } diff --git a/third_party/openssl b/third_party/openssl index 3df69d3aef..4ac0329582 160000 --- a/third_party/openssl +++ b/third_party/openssl @@ -1 +1 @@ -Subproject commit 3df69d3aefde7671053d4e3c242b228e5d79c83f +Subproject commit 4ac0329582829f5378d8078c8d314ad37db87736 -- cgit v1.2.3 From 2f223460b0d65c3069165f6c5249f98cb9fda56a Mon Sep 17 00:00:00 2001 From: Julien Boeuf Date: Tue, 24 Mar 2015 22:10:16 -0700 Subject: Fixing errors found by clang static analysis. --- src/core/tsi/ssl_transport_security.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/tsi/ssl_transport_security.c b/src/core/tsi/ssl_transport_security.c index 33645ca8b8..018ddc4456 100644 --- a/src/core/tsi/ssl_transport_security.c +++ b/src/core/tsi/ssl_transport_security.c @@ -567,7 +567,8 @@ static tsi_result populate_ssl_context( EC_KEY* ecdh = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); if (!SSL_CTX_set_tmp_ecdh(context, ecdh)) { gpr_log(GPR_ERROR, "Could not set ephemeral ECDH key."); - result = TSI_INTERNAL_ERROR; + EC_KEY_free(ecdh); + return TSI_INTERNAL_ERROR; } SSL_CTX_set_options(context, SSL_OP_SINGLE_ECDH_USE); EC_KEY_free(ecdh); @@ -604,6 +605,7 @@ static tsi_result build_alpn_protocol_name_list( unsigned char* current; *protocol_name_list = NULL; *protocol_name_list_length = 0; + if (num_alpn_protocols == 0) return TSI_INVALID_ARGUMENT; for (i = 0; i < num_alpn_protocols; i++) { if (alpn_protocols_lengths[i] == 0) { gpr_log(GPR_ERROR, "Invalid 0-length protocol name."); -- cgit v1.2.3 From b8b3e01c4bd4e2bbe0bfec3be58b40c7329c5b4f Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Wed, 25 Mar 2015 04:26:40 +0100 Subject: Adding Dockerfile for grpc/scan-build. This can be simply used that way: docker run -p 8182:8181 grpc/scan-build This will grab grpc's latest github code, compile it through clang's scan-build tool (http://clang-analyzer.llvm.org/scan-build.html) and output the result on stdout. This will also start an HTTP server on port 8182 on your machine, displaying the report nicely. As a nice side-effect, this will also produce scan reports for openssl and protobuf. The server can be then stopped this way: docker ps -l # figure out the container-id docker kill container-id --- tools/dockerfile/grpc_scan_build/Dockerfile | 47 +++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 tools/dockerfile/grpc_scan_build/Dockerfile diff --git a/tools/dockerfile/grpc_scan_build/Dockerfile b/tools/dockerfile/grpc_scan_build/Dockerfile new file mode 100644 index 0000000000..9f263849c9 --- /dev/null +++ b/tools/dockerfile/grpc_scan_build/Dockerfile @@ -0,0 +1,47 @@ +# 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. + +FROM grpc/clang:latest + +RUN apt-get update && apt-get install -y \ + autoconf \ + libtool \ + libgflags-dev \ + libgtest-dev \ + && apt-get clean + +RUN git clone --recursive https://github.com/grpc/grpc.git + +EXPOSE 8181 + +CMD \ + (cd grpc ; git pull) && \ + (cd grpc ; git submodule update --init --recursive) && \ + llvm/tools/clang/tools/scan-build/scan-build -o /tmp/grpc --use-analyzer=/usr/local/bin/clang make -C grpc buildtests && \ + llvm/tools/clang/tools/scan-view/scan-view /tmp/grpc/`ls /tmp/grpc` --host 0.0.0.0 --no-browser --allow-all-hosts -- cgit v1.2.3 From df9f764bf873e1484b6ca60e4ca0207d3117cd06 Mon Sep 17 00:00:00 2001 From: vjpai Date: Tue, 24 Mar 2015 22:54:39 -0700 Subject: Revert "Allow nullptr to be passed in if user doesn't care about tag" This reverts commit 4cba0ca39c9f979b231d1e64c3ef3aa3104bf1ca. --- src/cpp/common/completion_queue.cc | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/cpp/common/completion_queue.cc b/src/cpp/common/completion_queue.cc index 7cea0185ec..cea2d24831 100644 --- a/src/cpp/common/completion_queue.cc +++ b/src/cpp/common/completion_queue.cc @@ -59,14 +59,10 @@ class EventDeleter { CompletionQueue::NextStatus CompletionQueue::AsyncNextInternal( void** tag, bool* ok, gpr_timespec deadline) { std::unique_ptr ev; - void *dummy; - - if (tag == nullptr) // If user doesn't care - tag = &dummy; // Need to pass down something for (;;) { ev.reset(grpc_completion_queue_next(cq_, deadline)); - if (!ev) { // got a NULL back because deadline passed + if (!ev) { /* got a NULL back because deadline passed */ return TIMEOUT; } if (ev->type == GRPC_QUEUE_SHUTDOWN) { -- cgit v1.2.3 From a5e20d35c9025aa10592d0ccfb8c2071ee372c3a Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Wed, 25 Mar 2015 09:55:20 -0700 Subject: a stub of the cli tool --- Makefile | 45 ++++++++++++++++++++- build.json | 17 ++++++++ test/cpp/util/grpc_cli.cc | 100 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 161 insertions(+), 1 deletion(-) create mode 100644 test/cpp/util/grpc_cli.cc diff --git a/Makefile b/Makefile index d9e6d04e3d..5d80abe10e 100644 --- a/Makefile +++ b/Makefile @@ -557,6 +557,7 @@ channel_arguments_test: $(BINDIR)/$(CONFIG)/channel_arguments_test credentials_test: $(BINDIR)/$(CONFIG)/credentials_test end2end_test: $(BINDIR)/$(CONFIG)/end2end_test generic_end2end_test: $(BINDIR)/$(CONFIG)/generic_end2end_test +grpc_cli: $(BINDIR)/$(CONFIG)/grpc_cli grpc_cpp_plugin: $(BINDIR)/$(CONFIG)/grpc_cpp_plugin grpc_python_plugin: $(BINDIR)/$(CONFIG)/grpc_python_plugin grpc_ruby_plugin: $(BINDIR)/$(CONFIG)/grpc_ruby_plugin @@ -987,7 +988,7 @@ buildtests: buildtests_c buildtests_cxx buildtests_c: privatelibs_c $(BINDIR)/$(CONFIG)/alarm_heap_test $(BINDIR)/$(CONFIG)/alarm_list_test $(BINDIR)/$(CONFIG)/alarm_test $(BINDIR)/$(CONFIG)/alpn_test $(BINDIR)/$(CONFIG)/bin_encoder_test $(BINDIR)/$(CONFIG)/census_hash_table_test $(BINDIR)/$(CONFIG)/census_statistics_multiple_writers_circular_buffer_test $(BINDIR)/$(CONFIG)/census_statistics_multiple_writers_test $(BINDIR)/$(CONFIG)/census_statistics_performance_test $(BINDIR)/$(CONFIG)/census_statistics_quick_test $(BINDIR)/$(CONFIG)/census_statistics_small_log_test $(BINDIR)/$(CONFIG)/census_stub_test $(BINDIR)/$(CONFIG)/census_window_stats_test $(BINDIR)/$(CONFIG)/chttp2_status_conversion_test $(BINDIR)/$(CONFIG)/chttp2_stream_encoder_test $(BINDIR)/$(CONFIG)/chttp2_stream_map_test $(BINDIR)/$(CONFIG)/chttp2_transport_end2end_test $(BINDIR)/$(CONFIG)/dualstack_socket_test $(BINDIR)/$(CONFIG)/echo_client $(BINDIR)/$(CONFIG)/echo_server $(BINDIR)/$(CONFIG)/echo_test $(BINDIR)/$(CONFIG)/fd_posix_test $(BINDIR)/$(CONFIG)/fling_client $(BINDIR)/$(CONFIG)/fling_server $(BINDIR)/$(CONFIG)/fling_stream_test $(BINDIR)/$(CONFIG)/fling_test $(BINDIR)/$(CONFIG)/gpr_cancellable_test $(BINDIR)/$(CONFIG)/gpr_cmdline_test $(BINDIR)/$(CONFIG)/gpr_env_test $(BINDIR)/$(CONFIG)/gpr_file_test $(BINDIR)/$(CONFIG)/gpr_histogram_test $(BINDIR)/$(CONFIG)/gpr_host_port_test $(BINDIR)/$(CONFIG)/gpr_log_test $(BINDIR)/$(CONFIG)/gpr_slice_buffer_test $(BINDIR)/$(CONFIG)/gpr_slice_test $(BINDIR)/$(CONFIG)/gpr_string_test $(BINDIR)/$(CONFIG)/gpr_sync_test $(BINDIR)/$(CONFIG)/gpr_thd_test $(BINDIR)/$(CONFIG)/gpr_time_test $(BINDIR)/$(CONFIG)/gpr_useful_test $(BINDIR)/$(CONFIG)/grpc_base64_test $(BINDIR)/$(CONFIG)/grpc_byte_buffer_reader_test $(BINDIR)/$(CONFIG)/grpc_channel_stack_test $(BINDIR)/$(CONFIG)/grpc_completion_queue_test $(BINDIR)/$(CONFIG)/grpc_credentials_test $(BINDIR)/$(CONFIG)/grpc_json_token_test $(BINDIR)/$(CONFIG)/grpc_stream_op_test $(BINDIR)/$(CONFIG)/hpack_parser_test $(BINDIR)/$(CONFIG)/hpack_table_test $(BINDIR)/$(CONFIG)/httpcli_format_request_test $(BINDIR)/$(CONFIG)/httpcli_parser_test $(BINDIR)/$(CONFIG)/httpcli_test $(BINDIR)/$(CONFIG)/json_rewrite $(BINDIR)/$(CONFIG)/json_rewrite_test $(BINDIR)/$(CONFIG)/json_test $(BINDIR)/$(CONFIG)/lame_client_test $(BINDIR)/$(CONFIG)/message_compress_test $(BINDIR)/$(CONFIG)/metadata_buffer_test $(BINDIR)/$(CONFIG)/multi_init_test $(BINDIR)/$(CONFIG)/murmur_hash_test $(BINDIR)/$(CONFIG)/no_server_test $(BINDIR)/$(CONFIG)/poll_kick_posix_test $(BINDIR)/$(CONFIG)/resolve_address_test $(BINDIR)/$(CONFIG)/secure_endpoint_test $(BINDIR)/$(CONFIG)/sockaddr_utils_test $(BINDIR)/$(CONFIG)/tcp_client_posix_test $(BINDIR)/$(CONFIG)/tcp_posix_test $(BINDIR)/$(CONFIG)/tcp_server_posix_test $(BINDIR)/$(CONFIG)/time_averaged_stats_test $(BINDIR)/$(CONFIG)/time_test $(BINDIR)/$(CONFIG)/timeout_encoding_test $(BINDIR)/$(CONFIG)/transport_metadata_test $(BINDIR)/$(CONFIG)/transport_security_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_no_op_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_thread_stress_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_writes_done_hangs_with_pending_read_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_accept_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_accept_and_writes_closed_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_before_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_in_a_vacuum_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_census_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_disappearing_server_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_early_server_shutdown_finishes_inflight_calls_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_early_server_shutdown_finishes_tags_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_graceful_server_shutdown_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_invoke_large_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_max_concurrent_streams_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_no_op_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_ping_pong_streaming_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_binary_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_trailing_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_with_large_metadata_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_simple_delayed_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_thread_stress_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_writes_done_hangs_with_pending_read_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_no_op_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_thread_stress_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_writes_done_hangs_with_pending_read_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_accept_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_accept_and_writes_closed_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_before_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_in_a_vacuum_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_census_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_disappearing_server_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_inflight_calls_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_tags_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_graceful_server_shutdown_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_invoke_large_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_max_concurrent_streams_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_no_op_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_ping_pong_streaming_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_binary_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_trailing_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_large_metadata_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_delayed_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_thread_stress_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_writes_done_hangs_with_pending_read_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_no_op_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_thread_stress_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_writes_done_hangs_with_pending_read_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_accept_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_accept_and_writes_closed_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_before_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_in_a_vacuum_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_census_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_disappearing_server_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_early_server_shutdown_finishes_inflight_calls_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_early_server_shutdown_finishes_tags_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_graceful_server_shutdown_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_invoke_large_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_max_concurrent_streams_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_no_op_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_ping_pong_streaming_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_binary_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_trailing_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_with_large_metadata_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_delayed_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_thread_stress_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_writes_done_hangs_with_pending_read_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_no_op_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_thread_stress_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_writes_done_hangs_with_pending_read_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_accept_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_accept_and_writes_closed_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_before_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_in_a_vacuum_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_census_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_disappearing_server_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_early_server_shutdown_finishes_inflight_calls_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_early_server_shutdown_finishes_tags_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_graceful_server_shutdown_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_invoke_large_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_max_concurrent_streams_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_no_op_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_ping_pong_streaming_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_binary_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_trailing_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_large_metadata_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_delayed_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_thread_stress_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_writes_done_hangs_with_pending_read_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_no_op_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_thread_stress_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_writes_done_hangs_with_pending_read_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_and_writes_closed_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_before_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_in_a_vacuum_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_census_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_disappearing_server_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_early_server_shutdown_finishes_inflight_calls_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_early_server_shutdown_finishes_tags_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_graceful_server_shutdown_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_invoke_large_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_max_concurrent_streams_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_no_op_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_ping_pong_streaming_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_binary_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_trailing_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_large_metadata_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_delayed_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_thread_stress_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_writes_done_hangs_with_pending_read_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_no_op_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_thread_stress_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_writes_done_hangs_with_pending_read_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_and_writes_closed_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_before_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_in_a_vacuum_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_census_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_disappearing_server_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_inflight_calls_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_tags_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_graceful_server_shutdown_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_invoke_large_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_max_concurrent_streams_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_no_op_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_ping_pong_streaming_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_binary_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_large_metadata_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_delayed_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_thread_stress_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_writes_done_hangs_with_pending_read_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_no_op_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_thread_stress_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_writes_done_hangs_with_pending_read_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_and_writes_closed_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_before_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_in_a_vacuum_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_census_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_disappearing_server_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_inflight_calls_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_tags_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_graceful_server_shutdown_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_invoke_large_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_max_concurrent_streams_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_no_op_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_ping_pong_streaming_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_binary_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_large_metadata_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_delayed_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_thread_stress_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_writes_done_hangs_with_pending_read_legacy_test -buildtests_cxx: privatelibs_cxx $(BINDIR)/$(CONFIG)/async_end2end_test $(BINDIR)/$(CONFIG)/channel_arguments_test $(BINDIR)/$(CONFIG)/credentials_test $(BINDIR)/$(CONFIG)/end2end_test $(BINDIR)/$(CONFIG)/generic_end2end_test $(BINDIR)/$(CONFIG)/interop_client $(BINDIR)/$(CONFIG)/interop_server $(BINDIR)/$(CONFIG)/interop_test $(BINDIR)/$(CONFIG)/pubsub_client $(BINDIR)/$(CONFIG)/pubsub_publisher_test $(BINDIR)/$(CONFIG)/pubsub_subscriber_test $(BINDIR)/$(CONFIG)/qps_driver $(BINDIR)/$(CONFIG)/qps_worker $(BINDIR)/$(CONFIG)/status_test $(BINDIR)/$(CONFIG)/thread_pool_test +buildtests_cxx: privatelibs_cxx $(BINDIR)/$(CONFIG)/async_end2end_test $(BINDIR)/$(CONFIG)/channel_arguments_test $(BINDIR)/$(CONFIG)/credentials_test $(BINDIR)/$(CONFIG)/end2end_test $(BINDIR)/$(CONFIG)/generic_end2end_test $(BINDIR)/$(CONFIG)/grpc_cli $(BINDIR)/$(CONFIG)/interop_client $(BINDIR)/$(CONFIG)/interop_server $(BINDIR)/$(CONFIG)/interop_test $(BINDIR)/$(CONFIG)/pubsub_client $(BINDIR)/$(CONFIG)/pubsub_publisher_test $(BINDIR)/$(CONFIG)/pubsub_subscriber_test $(BINDIR)/$(CONFIG)/qps_driver $(BINDIR)/$(CONFIG)/qps_worker $(BINDIR)/$(CONFIG)/status_test $(BINDIR)/$(CONFIG)/thread_pool_test test: test_c test_cxx @@ -8022,6 +8023,48 @@ endif endif +GRPC_CLI_SRC = \ + test/cpp/util/grpc_cli.cc \ + +GRPC_CLI_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GRPC_CLI_SRC)))) + +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL with ALPN. + +$(BINDIR)/$(CONFIG)/grpc_cli: openssl_dep_error + +else + + +ifeq ($(NO_PROTOBUF),true) + +# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. + +$(BINDIR)/$(CONFIG)/grpc_cli: protobuf_dep_error + +else + +$(BINDIR)/$(CONFIG)/grpc_cli: $(PROTOBUF_DEP) $(GRPC_CLI_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LDXX) $(LDFLAGS) $(GRPC_CLI_OBJS) $(GTEST_LIB) $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/grpc_cli + +endif + +endif + +$(OBJDIR)/$(CONFIG)/test/cpp/util/grpc_cli.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + +deps_grpc_cli: $(GRPC_CLI_OBJS:.o=.dep) + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(GRPC_CLI_OBJS:.o=.dep) +endif +endif + + GRPC_CPP_PLUGIN_SRC = \ src/compiler/cpp_generator.cc \ src/compiler/cpp_plugin.cc \ diff --git a/build.json b/build.json index 32bf992892..21d0ac256f 100644 --- a/build.json +++ b/build.json @@ -1722,6 +1722,23 @@ "gpr" ] }, + { + "name": "grpc_cli", + "build": "test", + "run": false, + "language": "c++", + "src": [ + "test/cpp/util/grpc_cli.cc" + ], + "deps": [ + "grpc++_test_util", + "grpc_test_util", + "grpc++", + "grpc", + "gpr_test_util", + "gpr" + ] + }, { "name": "grpc_cpp_plugin", "build": "protoc", diff --git a/test/cpp/util/grpc_cli.cc b/test/cpp/util/grpc_cli.cc new file mode 100644 index 0000000000..ae012c2560 --- /dev/null +++ b/test/cpp/util/grpc_cli.cc @@ -0,0 +1,100 @@ +/* + * + * 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 +#include +#include + +#include "test/cpp/util/create_test_channel.h" +#include "src/cpp/util/time.h" +#include "src/cpp/server/thread_pool.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "test/core/util/port.h" + +#include +#include +#include + +// In some distros, gflags is in the namespace google, and in some others, +// in gflags. This hack is enabling us to find both. +namespace google { } +namespace gflags { } +using namespace google; +using namespace gflags; + +using std::chrono::system_clock; + +// DEFINE_bool(enable_ssl, true, "Whether to use ssl/tls."); + +void Call() {} + +int main(int argc, char** argv) { + grpc_init(); + + ParseCommandLineFlags(&argc, &argv, true); + + if (argc < grpc::string(argv[1]) != "call") { + std::cout << "Usage: grpc_cli call server_host:port full_method_string\n" + << "Example: grpc_cli call service.googleapis.com " + << "/grpc.cpp.test.util.TestService/Echo " << std::endl; + } + grpc::string server_address(argv[2]); + grpc::string method(argv[3]); + std::cout << "connecting to " << server_address << std::endl; + std::cout << "method is " << method << std::endl; + + std::unique_ptr creds = grpc::GoogleDefaultCredentials(); + std::shared_ptr channel = + grpc::CreateChannel(server_address, creds, grpc::ChannelArguments()); + + // Parse argument + Call(); + + channel.reset(); + grpc_shutdown(); + return 0; +} + + + -- cgit v1.2.3 From 16c78c922c4f43a3392b635e5d1a78dd14e285ea Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Wed, 25 Mar 2015 10:36:16 -0700 Subject: Clean up unneeded includes and remove shutdown protobuf library --- examples/pubsub/publisher_test.cc | 2 -- examples/pubsub/subscriber_test.cc | 2 -- src/cpp/client/insecure_credentials.cc | 2 -- src/cpp/client/secure_credentials.cc | 2 -- test/cpp/end2end/async_end2end_test.cc | 1 - test/cpp/end2end/end2end_test.cc | 1 - test/cpp/end2end/generic_end2end_test.cc | 1 - 7 files changed, 11 deletions(-) diff --git a/examples/pubsub/publisher_test.cc b/examples/pubsub/publisher_test.cc index 62442c7384..163f535d94 100644 --- a/examples/pubsub/publisher_test.cc +++ b/examples/pubsub/publisher_test.cc @@ -31,8 +31,6 @@ * */ -#include - #include #include #include diff --git a/examples/pubsub/subscriber_test.cc b/examples/pubsub/subscriber_test.cc index b8dd1f9486..2b689d275e 100644 --- a/examples/pubsub/subscriber_test.cc +++ b/examples/pubsub/subscriber_test.cc @@ -31,8 +31,6 @@ * */ -#include - #include #include #include diff --git a/src/cpp/client/insecure_credentials.cc b/src/cpp/client/insecure_credentials.cc index f3ca430bd4..8945b038de 100644 --- a/src/cpp/client/insecure_credentials.cc +++ b/src/cpp/client/insecure_credentials.cc @@ -31,8 +31,6 @@ * */ -#include - #include #include diff --git a/src/cpp/client/secure_credentials.cc b/src/cpp/client/secure_credentials.cc index e3c6637623..d6f9acc675 100644 --- a/src/cpp/client/secure_credentials.cc +++ b/src/cpp/client/secure_credentials.cc @@ -31,8 +31,6 @@ * */ -#include - #include #include diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index 4c71831dec..233c5b13a7 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -595,6 +595,5 @@ int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); int result = RUN_ALL_TESTS(); grpc_shutdown(); - google::protobuf::ShutdownProtobufLibrary(); return result; } diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index 41c2669533..e2649c2826 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -432,6 +432,5 @@ int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); int result = RUN_ALL_TESTS(); grpc_shutdown(); - google::protobuf::ShutdownProtobufLibrary(); return result; } diff --git a/test/cpp/end2end/generic_end2end_test.cc b/test/cpp/end2end/generic_end2end_test.cc index 711f1b9540..a60103e9f8 100644 --- a/test/cpp/end2end/generic_end2end_test.cc +++ b/test/cpp/end2end/generic_end2end_test.cc @@ -265,6 +265,5 @@ int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); int result = RUN_ALL_TESTS(); grpc_shutdown(); - google::protobuf::ShutdownProtobufLibrary(); return result; } -- cgit v1.2.3 From 884ed08e59cc08bf6c95b109d7e1425dc4501ec5 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Wed, 25 Mar 2015 10:45:23 -0700 Subject: clang-format c++ code under examples --- examples/pubsub/main.cc | 44 +++++++++++++++++++------------------- examples/pubsub/publisher.cc | 7 ++---- examples/pubsub/publisher_test.cc | 29 +++++++++++++------------ examples/pubsub/subscriber.cc | 7 ++---- examples/pubsub/subscriber_test.cc | 17 +++++++-------- 5 files changed, 49 insertions(+), 55 deletions(-) diff --git a/examples/pubsub/main.cc b/examples/pubsub/main.cc index 6f7737e247..cc5076f0a5 100644 --- a/examples/pubsub/main.cc +++ b/examples/pubsub/main.cc @@ -51,14 +51,14 @@ #include "examples/pubsub/subscriber.h" DEFINE_int32(server_port, 443, "Server port."); -DEFINE_string(server_host, - "pubsub-staging.googleapis.com", "Server host to connect to"); +DEFINE_string(server_host, "pubsub-staging.googleapis.com", + "Server host to connect to"); DEFINE_string(project_id, "", "GCE project id such as stoked-keyword-656"); // In some distros, gflags is in the namespace google, and in some others, // in gflags. This hack is enabling us to find both. -namespace google { } -namespace gflags { } +namespace google {} +namespace gflags {} using namespace google; using namespace gflags; @@ -92,32 +92,32 @@ int main(int argc, char** argv) { grpc::string topic = ss.str(); ss.str(""); - ss << FLAGS_project_id << "/" << kSubscriptionName; + ss << FLAGS_project_id << "/" << kSubscriptionName; grpc::string subscription_name = ss.str(); // Clean up test topic and subcription if they exist before. grpc::string subscription_topic; - if (subscriber.GetSubscription( - subscription_name, &subscription_topic).IsOk()) { + if (subscriber.GetSubscription(subscription_name, &subscription_topic) + .IsOk()) { subscriber.DeleteSubscription(subscription_name); } if (publisher.GetTopic(topic).IsOk()) publisher.DeleteTopic(topic); grpc::Status s = publisher.CreateTopic(topic); - gpr_log(GPR_INFO, "Create topic returns code %d, %s", - s.code(), s.details().c_str()); + gpr_log(GPR_INFO, "Create topic returns code %d, %s", s.code(), + s.details().c_str()); GPR_ASSERT(s.IsOk()); s = publisher.GetTopic(topic); - gpr_log(GPR_INFO, "Get topic returns code %d, %s", - s.code(), s.details().c_str()); + gpr_log(GPR_INFO, "Get topic returns code %d, %s", s.code(), + s.details().c_str()); GPR_ASSERT(s.IsOk()); std::vector topics; s = publisher.ListTopics(FLAGS_project_id, &topics); - gpr_log(GPR_INFO, "List topic returns code %d, %s", - s.code(), s.details().c_str()); + gpr_log(GPR_INFO, "List topic returns code %d, %s", s.code(), + s.details().c_str()); bool topic_found = false; for (unsigned int i = 0; i < topics.size(); i++) { if (topics[i] == topic) topic_found = true; @@ -127,27 +127,27 @@ int main(int argc, char** argv) { GPR_ASSERT(topic_found); s = subscriber.CreateSubscription(topic, subscription_name); - gpr_log(GPR_INFO, "create subscrption returns code %d, %s", - s.code(), s.details().c_str()); + gpr_log(GPR_INFO, "create subscrption returns code %d, %s", s.code(), + s.details().c_str()); GPR_ASSERT(s.IsOk()); s = publisher.Publish(topic, kMessageData); - gpr_log(GPR_INFO, "Publish %s returns code %d, %s", - kMessageData, s.code(), s.details().c_str()); + gpr_log(GPR_INFO, "Publish %s returns code %d, %s", kMessageData, s.code(), + s.details().c_str()); GPR_ASSERT(s.IsOk()); grpc::string data; s = subscriber.Pull(subscription_name, &data); gpr_log(GPR_INFO, "Pull %s", data.c_str()); - s = subscriber.DeleteSubscription(subscription_name); - gpr_log(GPR_INFO, "Delete subscription returns code %d, %s", - s.code(), s.details().c_str()); + s = subscriber.DeleteSubscription(subscription_name); + gpr_log(GPR_INFO, "Delete subscription returns code %d, %s", s.code(), + s.details().c_str()); GPR_ASSERT(s.IsOk()); s = publisher.DeleteTopic(topic); - gpr_log(GPR_INFO, "Delete topic returns code %d, %s", - s.code(), s.details().c_str()); + gpr_log(GPR_INFO, "Delete topic returns code %d, %s", s.code(), + s.details().c_str()); GPR_ASSERT(s.IsOk()); subscriber.Shutdown(); diff --git a/examples/pubsub/publisher.cc b/examples/pubsub/publisher.cc index 308f9a77e5..458050af73 100644 --- a/examples/pubsub/publisher.cc +++ b/examples/pubsub/publisher.cc @@ -51,12 +51,9 @@ namespace examples { namespace pubsub { Publisher::Publisher(std::shared_ptr channel) - : stub_(PublisherService::NewStub(channel)) { -} + : stub_(PublisherService::NewStub(channel)) {} -void Publisher::Shutdown() { - stub_.reset(); -} +void Publisher::Shutdown() { stub_.reset(); } Status Publisher::CreateTopic(const grpc::string& topic) { Topic request; diff --git a/examples/pubsub/publisher_test.cc b/examples/pubsub/publisher_test.cc index 163f535d94..ac4921283f 100644 --- a/examples/pubsub/publisher_test.cc +++ b/examples/pubsub/publisher_test.cc @@ -82,20 +82,19 @@ class PublisherServiceImpl : public tech::pubsub::PublisherService::Service { Status ListTopics( ServerContext* context, const ::tech::pubsub::ListTopicsRequest* request, ::tech::pubsub::ListTopicsResponse* response) GRPC_OVERRIDE { - std::ostringstream ss; - ss << "cloud.googleapis.com/project in (/projects/" << kProjectId << ")"; - EXPECT_EQ(request->query(), ss.str()); - response->add_topic()->set_name(kTopic); - return Status::OK; - } - - Status DeleteTopic(ServerContext* context, - const ::tech::pubsub::DeleteTopicRequest* request, - ::proto2::Empty* response) GRPC_OVERRIDE { - EXPECT_EQ(request->topic(), kTopic); + std::ostringstream ss; + ss << "cloud.googleapis.com/project in (/projects/" << kProjectId << ")"; + EXPECT_EQ(request->query(), ss.str()); + response->add_topic()->set_name(kTopic); return Status::OK; - } + } + Status DeleteTopic(ServerContext* context, + const ::tech::pubsub::DeleteTopicRequest* request, + ::proto2::Empty* response) GRPC_OVERRIDE { + EXPECT_EQ(request->topic(), kTopic); + return Status::OK; + } }; class PublisherTest : public ::testing::Test { @@ -105,11 +104,13 @@ class PublisherTest : public ::testing::Test { int port = grpc_pick_unused_port_or_die(); server_address_ << "localhost:" << port; ServerBuilder builder; - builder.AddListeningPort(server_address_.str(), grpc::InsecureServerCredentials()); + builder.AddListeningPort(server_address_.str(), + grpc::InsecureServerCredentials()); builder.RegisterService(&service_); server_ = builder.BuildAndStart(); - channel_ = CreateChannel(server_address_.str(), grpc::InsecureCredentials(), ChannelArguments()); + channel_ = CreateChannel(server_address_.str(), grpc::InsecureCredentials(), + ChannelArguments()); publisher_.reset(new grpc::examples::pubsub::Publisher(channel_)); } diff --git a/examples/pubsub/subscriber.cc b/examples/pubsub/subscriber.cc index 29f6635b7c..d9e0292ba0 100644 --- a/examples/pubsub/subscriber.cc +++ b/examples/pubsub/subscriber.cc @@ -49,12 +49,9 @@ namespace examples { namespace pubsub { Subscriber::Subscriber(std::shared_ptr channel) - : stub_(SubscriberService::NewStub(channel)) { -} + : stub_(SubscriberService::NewStub(channel)) {} -void Subscriber::Shutdown() { - stub_.reset(); -} +void Subscriber::Shutdown() { stub_.reset(); } Status Subscriber::CreateSubscription(const grpc::string& topic, const grpc::string& name) { diff --git a/examples/pubsub/subscriber_test.cc b/examples/pubsub/subscriber_test.cc index 2b689d275e..9ab60ed6a7 100644 --- a/examples/pubsub/subscriber_test.cc +++ b/examples/pubsub/subscriber_test.cc @@ -93,7 +93,6 @@ class SubscriberServiceImpl : public tech::pubsub::SubscriberService::Service { proto2::Empty* response) GRPC_OVERRIDE { return Status::OK; } - }; class SubscriberTest : public ::testing::Test { @@ -103,11 +102,13 @@ class SubscriberTest : public ::testing::Test { int port = grpc_pick_unused_port_or_die(); server_address_ << "localhost:" << port; ServerBuilder builder; - builder.AddListeningPort(server_address_.str(), grpc::InsecureServerCredentials()); + builder.AddListeningPort(server_address_.str(), + grpc::InsecureServerCredentials()); builder.RegisterService(&service_); server_ = builder.BuildAndStart(); - channel_ = CreateChannel(server_address_.str(), grpc::InsecureCredentials(), ChannelArguments()); + channel_ = CreateChannel(server_address_.str(), grpc::InsecureCredentials(), + ChannelArguments()); subscriber_.reset(new grpc::examples::pubsub::Subscriber(channel_)); } @@ -127,17 +128,15 @@ class SubscriberTest : public ::testing::Test { }; TEST_F(SubscriberTest, TestSubscriber) { - EXPECT_TRUE(subscriber_->CreateSubscription(kTopic, - kSubscriptionName).IsOk()); + EXPECT_TRUE( + subscriber_->CreateSubscription(kTopic, kSubscriptionName).IsOk()); grpc::string topic; - EXPECT_TRUE(subscriber_->GetSubscription(kSubscriptionName, - &topic).IsOk()); + EXPECT_TRUE(subscriber_->GetSubscription(kSubscriptionName, &topic).IsOk()); EXPECT_EQ(topic, kTopic); grpc::string data; - EXPECT_TRUE(subscriber_->Pull(kSubscriptionName, - &data).IsOk()); + EXPECT_TRUE(subscriber_->Pull(kSubscriptionName, &data).IsOk()); EXPECT_TRUE(subscriber_->DeleteSubscription(kSubscriptionName).IsOk()); } -- cgit v1.2.3 From c1da8f20ea050eb11f9169791aa3a789d38b6dd5 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 25 Mar 2015 11:33:05 -0700 Subject: Made necessary changes to get interop tests working --- src/php/ext/grpc/byte_buffer.c | 5 +++++ src/php/ext/grpc/call.c | 21 ++++++++++++++++++--- src/php/tests/interop/interop_client.php | 7 +++++-- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/php/ext/grpc/byte_buffer.c b/src/php/ext/grpc/byte_buffer.c index 1ced1bf3f0..9f122d6da6 100644 --- a/src/php/ext/grpc/byte_buffer.c +++ b/src/php/ext/grpc/byte_buffer.c @@ -57,6 +57,11 @@ grpc_byte_buffer *string_to_byte_buffer(char *string, size_t length) { void byte_buffer_to_string(grpc_byte_buffer *buffer, char **out_string, size_t *out_length) { + if (buffer == NULL) { + *out_string = NULL; + *out_length = 0; + return; + } size_t length = grpc_byte_buffer_length(buffer); char *string = ecalloc(length + 1, sizeof(char)); size_t offset = 0; diff --git a/src/php/ext/grpc/call.c b/src/php/ext/grpc/call.c index d0e324e2cc..ba1b2a407d 100644 --- a/src/php/ext/grpc/call.c +++ b/src/php/ext/grpc/call.c @@ -448,8 +448,12 @@ PHP_METHOD(Call, start_batch) { break; case GRPC_OP_RECV_MESSAGE: byte_buffer_to_string(message, &message_str, &message_len); - add_property_stringl(result, "message", message_str, message_len, - false); + if (message_str == NULL) { + add_property_null(result, "message"); + } else { + add_property_stringl(result, "message", message_str, message_len, + false); + } break; case GRPC_OP_RECV_STATUS_ON_CLIENT: MAKE_STD_ZVAL(recv_status); @@ -478,9 +482,20 @@ cleanup: RETURN_DESTROY_ZVAL(result); } +/** + * Cancel the call. This will cause the call to end with STATUS_CANCELLED if it + * has not already ended with another status. + */ +PHP_METHOD(Call, cancel) { + wrapped_grpc_call *call = + (wrapped_grpc_call *)zend_object_store_get_object(getThis() TSRMLS_CC); + grpc_call_cancel(call->wrapped); +} + static zend_function_entry call_methods[] = { PHP_ME(Call, __construct, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR) - PHP_ME(Call, start_batch, NULL, ZEND_ACC_PUBLIC) PHP_FE_END}; + PHP_ME(Call, start_batch, NULL, ZEND_ACC_PUBLIC) + PHP_ME(Call, cancel, NULL, ZEND_ACC_PUBLIC) PHP_FE_END}; void grpc_init_call(TSRMLS_D) { zend_class_entry ce; diff --git a/src/php/tests/interop/interop_client.php b/src/php/tests/interop/interop_client.php index 82ca438169..7ee089e241 100755 --- a/src/php/tests/interop/interop_client.php +++ b/src/php/tests/interop/interop_client.php @@ -132,8 +132,6 @@ function serverStreaming($stub) { } $call = $stub->StreamingOutputCall($request); - hardAssert($call->getStatus()->code === Grpc\STATUS_OK, - 'Call did not complete successfully'); $i = 0; foreach($call->responses() as $value) { hardAssert($i < 4, 'Too many responses'); @@ -142,7 +140,10 @@ function serverStreaming($stub) { 'Payload ' . $i . ' had the wrong type'); hardAssert(strlen($payload->getBody()) === $sizes[$i], 'Response ' . $i . ' had the wrong length'); + $i += 1; } + hardAssert($call->getStatus()->code === Grpc\STATUS_OK, + 'Call did not complete successfully'); } /** @@ -240,4 +241,6 @@ switch($args['test_case']) { break; case 'cancel_after_first_response': cancelAfterFirstResponse($stub); + default: + exit(1); } -- cgit v1.2.3 From 11f64fb34904914a85e7321c11cc477af1536a7b Mon Sep 17 00:00:00 2001 From: vjpai Date: Wed, 25 Mar 2015 14:23:59 -0700 Subject: Make a fake version of nullptr to satisfy old compilers --- include/grpc++/config.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/grpc++/config.h b/include/grpc++/config.h index 35bf507364..e10f00fb63 100644 --- a/include/grpc++/config.h +++ b/include/grpc++/config.h @@ -65,6 +65,26 @@ ::google::protobuf::io::ZeroCopyInputStream #endif +#ifdef __GNUC__ +#if (__GNUC__ * 100 + __GNUC_MINOR__ < 406) +#define GRPC_NO_NULLPTR +#endif +#endif + +#ifdef GRPC_NO_NULLPTR +#include +const class { +public: + template operator T*() const {return static_cast(0);} + template operator std::unique_ptr() const { + return std::unique_ptr(static_cast(0)); + } + operator bool() const {return false;} +private: + void operator&() const = delete; +} nullptr = {}; +#endif + namespace grpc { typedef GRPC_CUSTOM_STRING string; -- cgit v1.2.3 From 3ff350cf96676f2c32c6913aceeabf84a15f3715 Mon Sep 17 00:00:00 2001 From: vjpai Date: Wed, 25 Mar 2015 14:28:41 -0700 Subject: Make a fake version of nullptr to work with old compilers --- include/grpc++/config.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/grpc++/config.h b/include/grpc++/config.h index 35bf507364..e10f00fb63 100644 --- a/include/grpc++/config.h +++ b/include/grpc++/config.h @@ -65,6 +65,26 @@ ::google::protobuf::io::ZeroCopyInputStream #endif +#ifdef __GNUC__ +#if (__GNUC__ * 100 + __GNUC_MINOR__ < 406) +#define GRPC_NO_NULLPTR +#endif +#endif + +#ifdef GRPC_NO_NULLPTR +#include +const class { +public: + template operator T*() const {return static_cast(0);} + template operator std::unique_ptr() const { + return std::unique_ptr(static_cast(0)); + } + operator bool() const {return false;} +private: + void operator&() const = delete; +} nullptr = {}; +#endif + namespace grpc { typedef GRPC_CUSTOM_STRING string; -- cgit v1.2.3 From 5d5b1d8c8ec4c578f72a12f5b81f705764cdf804 Mon Sep 17 00:00:00 2001 From: vjpai Date: Wed, 25 Mar 2015 14:32:30 -0700 Subject: Remove lambda expression to support older compilers --- src/cpp/server/thread_pool.cc | 41 +++++++++++++++++++++-------------------- src/cpp/server/thread_pool.h | 2 ++ 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/src/cpp/server/thread_pool.cc b/src/cpp/server/thread_pool.cc index d3013b806c..10dceec836 100644 --- a/src/cpp/server/thread_pool.cc +++ b/src/cpp/server/thread_pool.cc @@ -35,28 +35,29 @@ namespace grpc { +#ifdef __GNUC__ +#if (__GNUC__ * 100 + __GNUC_MINOR__ < 406) +#define GRPC_NO_NULLPTR +#endif +#endif + +#ifdef GRPC_NO_NULLPTR +#include +const class { +public: + template operator T*() const {return static_cast(0);} + template operator std::unique_ptr() const { + return std::unique_ptr(static_cast(0)); + } + operator bool() const {return false;} +private: + void operator&() const = delete; +} nullptr = {}; +#endif + ThreadPool::ThreadPool(int num_threads) : shutdown_(false) { for (int i = 0; i < num_threads; i++) { - threads_.push_back(std::thread([this]() { - for (;;) { - // Wait until work is available or we are shutting down. - auto have_work = [this]() { return shutdown_ || !callbacks_.empty(); }; - std::unique_lock lock(mu_); - if (!have_work()) { - cv_.wait(lock, have_work); - } - // Drain callbacks before considering shutdown to ensure all work - // gets completed. - if (!callbacks_.empty()) { - auto cb = callbacks_.front(); - callbacks_.pop(); - lock.unlock(); - cb(); - } else if (shutdown_) { - return; - } - } - })); + threads_.push_back(std::thread(&ThreadPool::ThreadFunc, this)); } } diff --git a/src/cpp/server/thread_pool.h b/src/cpp/server/thread_pool.h index 6225d82a0b..41e2009ff1 100644 --- a/src/cpp/server/thread_pool.h +++ b/src/cpp/server/thread_pool.h @@ -58,6 +58,8 @@ class ThreadPool GRPC_FINAL : public ThreadPoolInterface { bool shutdown_; std::queue> callbacks_; std::vector threads_; + + void ThreadFunc(); }; } // namespace grpc -- cgit v1.2.3 From 335b97df8c610e99befea20ef67ce2f8866eef24 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Wed, 25 Mar 2015 14:44:01 -0700 Subject: Revert "Remove lambda expression to support older compilers" This reverts commit 5d5b1d8c8ec4c578f72a12f5b81f705764cdf804. --- src/cpp/server/thread_pool.cc | 41 ++++++++++++++++++++--------------------- src/cpp/server/thread_pool.h | 2 -- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/src/cpp/server/thread_pool.cc b/src/cpp/server/thread_pool.cc index 10dceec836..d3013b806c 100644 --- a/src/cpp/server/thread_pool.cc +++ b/src/cpp/server/thread_pool.cc @@ -35,29 +35,28 @@ namespace grpc { -#ifdef __GNUC__ -#if (__GNUC__ * 100 + __GNUC_MINOR__ < 406) -#define GRPC_NO_NULLPTR -#endif -#endif - -#ifdef GRPC_NO_NULLPTR -#include -const class { -public: - template operator T*() const {return static_cast(0);} - template operator std::unique_ptr() const { - return std::unique_ptr(static_cast(0)); - } - operator bool() const {return false;} -private: - void operator&() const = delete; -} nullptr = {}; -#endif - ThreadPool::ThreadPool(int num_threads) : shutdown_(false) { for (int i = 0; i < num_threads; i++) { - threads_.push_back(std::thread(&ThreadPool::ThreadFunc, this)); + threads_.push_back(std::thread([this]() { + for (;;) { + // Wait until work is available or we are shutting down. + auto have_work = [this]() { return shutdown_ || !callbacks_.empty(); }; + std::unique_lock lock(mu_); + if (!have_work()) { + cv_.wait(lock, have_work); + } + // Drain callbacks before considering shutdown to ensure all work + // gets completed. + if (!callbacks_.empty()) { + auto cb = callbacks_.front(); + callbacks_.pop(); + lock.unlock(); + cb(); + } else if (shutdown_) { + return; + } + } + })); } } diff --git a/src/cpp/server/thread_pool.h b/src/cpp/server/thread_pool.h index 41e2009ff1..6225d82a0b 100644 --- a/src/cpp/server/thread_pool.h +++ b/src/cpp/server/thread_pool.h @@ -58,8 +58,6 @@ class ThreadPool GRPC_FINAL : public ThreadPoolInterface { bool shutdown_; std::queue> callbacks_; std::vector threads_; - - void ThreadFunc(); }; } // namespace grpc -- cgit v1.2.3 From f731d68fefe35ea8630c472e453ad640e5043ede Mon Sep 17 00:00:00 2001 From: vjpai Date: Wed, 25 Mar 2015 14:55:25 -0700 Subject: Avoid a problem when clang pretends to be GNUC --- include/grpc++/config.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/grpc++/config.h b/include/grpc++/config.h index e10f00fb63..8ef5d71bfa 100644 --- a/include/grpc++/config.h +++ b/include/grpc++/config.h @@ -65,11 +65,13 @@ ::google::protobuf::io::ZeroCopyInputStream #endif +#ifndef __clang__ #ifdef __GNUC__ #if (__GNUC__ * 100 + __GNUC_MINOR__ < 406) #define GRPC_NO_NULLPTR #endif #endif +#endif #ifdef GRPC_NO_NULLPTR #include -- cgit v1.2.3 From d5933b6184f5c32a6c83ac3eefa255b917e31e76 Mon Sep 17 00:00:00 2001 From: vjpai Date: Wed, 25 Mar 2015 14:55:56 -0700 Subject: Remove lambda expression being used in grpc C++ library --- src/cpp/server/thread_pool.cc | 41 +++++++++++++++++++++-------------------- src/cpp/server/thread_pool.h | 2 ++ 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/src/cpp/server/thread_pool.cc b/src/cpp/server/thread_pool.cc index d3013b806c..3eb172a3a6 100644 --- a/src/cpp/server/thread_pool.cc +++ b/src/cpp/server/thread_pool.cc @@ -35,28 +35,29 @@ namespace grpc { +void ThreadPool::ThreadFunc() { + for (;;) { + // Wait until work is available or we are shutting down. + std::unique_lock lock(mu_); + if (!shutdown_ && callbacks_.empty()) { + cv_.wait(lock); + } + // Drain callbacks before considering shutdown to ensure all work + // gets completed. + if (!callbacks_.empty()) { + auto cb = callbacks_.front(); + callbacks_.pop(); + lock.unlock(); + cb(); + } else if (shutdown_) { + return; + } + } +} + ThreadPool::ThreadPool(int num_threads) : shutdown_(false) { for (int i = 0; i < num_threads; i++) { - threads_.push_back(std::thread([this]() { - for (;;) { - // Wait until work is available or we are shutting down. - auto have_work = [this]() { return shutdown_ || !callbacks_.empty(); }; - std::unique_lock lock(mu_); - if (!have_work()) { - cv_.wait(lock, have_work); - } - // Drain callbacks before considering shutdown to ensure all work - // gets completed. - if (!callbacks_.empty()) { - auto cb = callbacks_.front(); - callbacks_.pop(); - lock.unlock(); - cb(); - } else if (shutdown_) { - return; - } - } - })); + threads_.push_back(std::thread(&ThreadPool::ThreadFunc, this)); } } diff --git a/src/cpp/server/thread_pool.h b/src/cpp/server/thread_pool.h index 6225d82a0b..41e2009ff1 100644 --- a/src/cpp/server/thread_pool.h +++ b/src/cpp/server/thread_pool.h @@ -58,6 +58,8 @@ class ThreadPool GRPC_FINAL : public ThreadPoolInterface { bool shutdown_; std::queue> callbacks_; std::vector threads_; + + void ThreadFunc(); }; } // namespace grpc -- cgit v1.2.3 From 1e475147928f2ee2d97c748df2adc3c3fcabebdc Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Wed, 25 Mar 2015 23:35:09 +0100 Subject: Removing range-based for loop. --- src/compiler/cpp_plugin.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/compiler/cpp_plugin.cc b/src/compiler/cpp_plugin.cc index 534abdeed0..57f25a1f75 100644 --- a/src/compiler/cpp_plugin.cc +++ b/src/compiler/cpp_plugin.cc @@ -63,13 +63,15 @@ class CppGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { if (!parameter.empty()) { std::vector parameters_list = grpc_generator::tokenize(parameter, ","); - for (auto ¶meter_string: parameters_list) { + for (auto parameter_string = parameters_list.begin(); + parameter_string != parameters_list.end(); + parameter_string++) { std::vector param = - grpc_generator::tokenize(parameter_string, "="); + grpc_generator::tokenize(*parameter_string, "="); if (param[0] == "services_namespace") { generator_parameters.services_namespace = param[1]; } else { - *error = grpc::string("Unknown parameter: ") + parameter_string; + *error = grpc::string("Unknown parameter: ") + *parameter_string; return false; } } -- cgit v1.2.3 From 714cf6982ad1073a6377f6ced625122cb5a1872c Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Thu, 26 Mar 2015 00:20:13 +0100 Subject: Moving all of the codegens into a temporary static library. This will allow us to re-use code generators in other kind of protoc plugins. --- Makefile | 50 +++++++++++++++++++++++++++++--------------------- build.json | 32 ++++++++++++++++++++------------ 2 files changed, 49 insertions(+), 33 deletions(-) diff --git a/Makefile b/Makefile index 0742994982..700b56adaa 100644 --- a/Makefile +++ b/Makefile @@ -3585,30 +3585,40 @@ $(OBJDIR)/$(CONFIG)/src/cpp/util/status.o: $(OBJDIR)/$(CONFIG)/src/cpp/util/time.o: -LIBGRPC_PYTHON_PLUGIN_SUPPORT_SRC = \ +LIBGRPC_PLUGIN_SUPPORT_SRC = \ + src/compiler/cpp_generator.cc \ src/compiler/python_generator.cc \ + src/compiler/ruby_generator.cc \ PUBLIC_HEADERS_CXX += \ + src/compiler/config.h \ + src/compiler/cpp_generator.h \ + src/compiler/cpp_generator_helpers.h \ + src/compiler/generator_helpers.h \ src/compiler/python_generator.h \ + src/compiler/ruby_generator.h \ + src/compiler/ruby_generator_helpers-inl.h \ + src/compiler/ruby_generator_map-inl.h \ + src/compiler/ruby_generator_string-inl.h \ -LIBGRPC_PYTHON_PLUGIN_SUPPORT_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC_PYTHON_PLUGIN_SUPPORT_SRC)))) +LIBGRPC_PLUGIN_SUPPORT_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC_PLUGIN_SUPPORT_SRC)))) ifeq ($(NO_PROTOBUF),true) # You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. -$(LIBDIR)/$(CONFIG)/libgrpc_python_plugin_support.a: protobuf_dep_error +$(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a: protobuf_dep_error else -$(LIBDIR)/$(CONFIG)/libgrpc_python_plugin_support.a: $(ZLIB_DEP) $(PROTOBUF_DEP) $(LIBGRPC_PYTHON_PLUGIN_SUPPORT_OBJS) +$(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a: $(ZLIB_DEP) $(PROTOBUF_DEP) $(LIBGRPC_PLUGIN_SUPPORT_OBJS) $(E) "[AR] Creating $@" $(Q) mkdir -p `dirname $@` - $(Q) rm -f $(LIBDIR)/$(CONFIG)/libgrpc_python_plugin_support.a - $(Q) $(AR) rcs $(LIBDIR)/$(CONFIG)/libgrpc_python_plugin_support.a $(LIBGRPC_PYTHON_PLUGIN_SUPPORT_OBJS) + $(Q) rm -f $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a + $(Q) $(AR) rcs $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a $(LIBGRPC_PLUGIN_SUPPORT_OBJS) ifeq ($(SYSTEM),Darwin) - $(Q) ranlib $(LIBDIR)/$(CONFIG)/libgrpc_python_plugin_support.a + $(Q) ranlib $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a endif @@ -3617,10 +3627,12 @@ endif endif ifneq ($(NO_DEPS),true) --include $(LIBGRPC_PYTHON_PLUGIN_SUPPORT_OBJS:.o=.dep) +-include $(LIBGRPC_PLUGIN_SUPPORT_OBJS:.o=.dep) endif +$(OBJDIR)/$(CONFIG)/src/compiler/cpp_generator.o: $(OBJDIR)/$(CONFIG)/src/compiler/python_generator.o: +$(OBJDIR)/$(CONFIG)/src/compiler/ruby_generator.o: LIBPUBSUB_CLIENT_LIB_SRC = \ @@ -8188,7 +8200,6 @@ endif GRPC_CPP_PLUGIN_SRC = \ - src/compiler/cpp_generator.cc \ src/compiler/cpp_plugin.cc \ GRPC_CPP_PLUGIN_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GRPC_CPP_PLUGIN_SRC)))) @@ -8202,15 +8213,14 @@ $(BINDIR)/$(CONFIG)/grpc_cpp_plugin: protobuf_dep_error else -$(BINDIR)/$(CONFIG)/grpc_cpp_plugin: $(PROTOBUF_DEP) $(GRPC_CPP_PLUGIN_OBJS) +$(BINDIR)/$(CONFIG)/grpc_cpp_plugin: $(PROTOBUF_DEP) $(GRPC_CPP_PLUGIN_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a $(E) "[HOSTLD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(HOST_LDXX) $(HOST_LDFLAGS) $(GRPC_CPP_PLUGIN_OBJS) $(HOST_LDLIBSXX) $(HOST_LDLIBS_PROTOC) $(HOST_LDLIBS) $(HOST_LDLIBS_PROTOC) -o $(BINDIR)/$(CONFIG)/grpc_cpp_plugin + $(Q) $(HOST_LDXX) $(HOST_LDFLAGS) $(GRPC_CPP_PLUGIN_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a $(HOST_LDLIBSXX) $(HOST_LDLIBS_PROTOC) $(HOST_LDLIBS) $(HOST_LDLIBS_PROTOC) -o $(BINDIR)/$(CONFIG)/grpc_cpp_plugin endif -$(OBJDIR)/$(CONFIG)/src/compiler/cpp_generator.o: -$(OBJDIR)/$(CONFIG)/src/compiler/cpp_plugin.o: +$(OBJDIR)/$(CONFIG)/src/compiler/cpp_plugin.o: $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a deps_grpc_cpp_plugin: $(GRPC_CPP_PLUGIN_OBJS:.o=.dep) @@ -8233,14 +8243,14 @@ $(BINDIR)/$(CONFIG)/grpc_python_plugin: protobuf_dep_error else -$(BINDIR)/$(CONFIG)/grpc_python_plugin: $(PROTOBUF_DEP) $(GRPC_PYTHON_PLUGIN_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_python_plugin_support.a +$(BINDIR)/$(CONFIG)/grpc_python_plugin: $(PROTOBUF_DEP) $(GRPC_PYTHON_PLUGIN_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a $(E) "[HOSTLD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(HOST_LDXX) $(HOST_LDFLAGS) $(GRPC_PYTHON_PLUGIN_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_python_plugin_support.a $(HOST_LDLIBSXX) $(HOST_LDLIBS_PROTOC) $(HOST_LDLIBS) $(HOST_LDLIBS_PROTOC) -o $(BINDIR)/$(CONFIG)/grpc_python_plugin + $(Q) $(HOST_LDXX) $(HOST_LDFLAGS) $(GRPC_PYTHON_PLUGIN_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a $(HOST_LDLIBSXX) $(HOST_LDLIBS_PROTOC) $(HOST_LDLIBS) $(HOST_LDLIBS_PROTOC) -o $(BINDIR)/$(CONFIG)/grpc_python_plugin endif -$(OBJDIR)/$(CONFIG)/src/compiler/python_plugin.o: $(LIBDIR)/$(CONFIG)/libgrpc_python_plugin_support.a +$(OBJDIR)/$(CONFIG)/src/compiler/python_plugin.o: $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a deps_grpc_python_plugin: $(GRPC_PYTHON_PLUGIN_OBJS:.o=.dep) @@ -8250,7 +8260,6 @@ endif GRPC_RUBY_PLUGIN_SRC = \ - src/compiler/ruby_generator.cc \ src/compiler/ruby_plugin.cc \ GRPC_RUBY_PLUGIN_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GRPC_RUBY_PLUGIN_SRC)))) @@ -8264,15 +8273,14 @@ $(BINDIR)/$(CONFIG)/grpc_ruby_plugin: protobuf_dep_error else -$(BINDIR)/$(CONFIG)/grpc_ruby_plugin: $(PROTOBUF_DEP) $(GRPC_RUBY_PLUGIN_OBJS) +$(BINDIR)/$(CONFIG)/grpc_ruby_plugin: $(PROTOBUF_DEP) $(GRPC_RUBY_PLUGIN_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a $(E) "[HOSTLD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(HOST_LDXX) $(HOST_LDFLAGS) $(GRPC_RUBY_PLUGIN_OBJS) $(HOST_LDLIBSXX) $(HOST_LDLIBS_PROTOC) $(HOST_LDLIBS) $(HOST_LDLIBS_PROTOC) -o $(BINDIR)/$(CONFIG)/grpc_ruby_plugin + $(Q) $(HOST_LDXX) $(HOST_LDFLAGS) $(GRPC_RUBY_PLUGIN_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a $(HOST_LDLIBSXX) $(HOST_LDLIBS_PROTOC) $(HOST_LDLIBS) $(HOST_LDLIBS_PROTOC) -o $(BINDIR)/$(CONFIG)/grpc_ruby_plugin endif -$(OBJDIR)/$(CONFIG)/src/compiler/ruby_generator.o: -$(OBJDIR)/$(CONFIG)/src/compiler/ruby_plugin.o: +$(OBJDIR)/$(CONFIG)/src/compiler/ruby_plugin.o: $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a deps_grpc_ruby_plugin: $(GRPC_RUBY_PLUGIN_OBJS:.o=.dep) diff --git a/build.json b/build.json index a46866263f..2b56dc6e87 100644 --- a/build.json +++ b/build.json @@ -498,14 +498,24 @@ "secure": "no" }, { - "name": "grpc_python_plugin_support", + "name": "grpc_plugin_support", "build": "protoc", "language": "c++", "public_headers": [ - "src/compiler/python_generator.h" + "src/compiler/config.h", + "src/compiler/cpp_generator.h", + "src/compiler/cpp_generator_helpers.h", + "src/compiler/generator_helpers.h", + "src/compiler/python_generator.h", + "src/compiler/ruby_generator.h", + "src/compiler/ruby_generator_helpers-inl.h", + "src/compiler/ruby_generator_map-inl.h", + "src/compiler/ruby_generator_string-inl.h" ], "src": [ - "src/compiler/python_generator.cc" + "src/compiler/cpp_generator.cc", + "src/compiler/python_generator.cc", + "src/compiler/ruby_generator.cc" ], "deps": [], "secure": "no" @@ -1758,15 +1768,12 @@ "name": "grpc_cpp_plugin", "build": "protoc", "language": "c++", - "headers": [ - "src/compiler/cpp_generator.h", - "src/compiler/cpp_generator_helpers.h" - ], "src": [ - "src/compiler/cpp_generator.cc", "src/compiler/cpp_plugin.cc" ], - "deps": [], + "deps": [ + "grpc_plugin_support" + ], "secure": "no" }, { @@ -1777,7 +1784,7 @@ "src/compiler/python_plugin.cc" ], "deps": [ - "grpc_python_plugin_support" + "grpc_plugin_support" ], "secure": "no" }, @@ -1786,10 +1793,11 @@ "build": "protoc", "language": "c++", "src": [ - "src/compiler/ruby_generator.cc", "src/compiler/ruby_plugin.cc" ], - "deps": [], + "deps": [ + "grpc_plugin_support" + ], "secure": "no" }, { -- cgit v1.2.3 From fd2b09329b4f6e7865d874b29a2469461b46ae67 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Thu, 26 Mar 2015 00:26:29 +0100 Subject: Adding a simple 'buildonly' test. --- .travis.yml | 3 +++ tools/run_tests/run_tests.py | 21 ++++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e43a89e453..165f8923c0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,9 +19,12 @@ env: - CONFIG=opt TEST=python - CONFIG=gcov TEST=c - CONFIG=gcov TEST=c++ + - USE_GCC=4.4 CONFIG=opt TEST=build + - USE_GCC=4.5 CONFIG=opt TEST=build script: - rvm use $RUBY_VERSION - gem install bundler + - if [ ! -z "$USE_GCC" ] ; then export CC=gcc-$USE_GCC ; export CXX=g++-$USE_GCC ; fi - ./tools/run_tests/run_tests.py -l $TEST -t -j 16 -c $CONFIG -s 4.0 after_success: - if [ "$CONFIG" = "gcov" ] ; then coveralls --exclude third_party --exclude gens -b. --gcov-options '\-p' ; fi diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index a132ef4541..3cf6ddf262 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -224,6 +224,24 @@ class CSharpLanguage(object): def __str__(self): return 'csharp' +class Build(object): + + def test_specs(self, config, travis): + return [] + + def make_targets(self): + return ['all'] + + def build_steps(self): + return [] + + def supports_multi_config(self): + return True + + def __str__(self): + return self.make_target + + # different configurations we can run under _CONFIGS = { 'dbg': SimpleConfig('dbg'), @@ -248,7 +266,8 @@ _LANGUAGES = { 'php': PhpLanguage(), 'python': PythonLanguage(), 'ruby': RubyLanguage(), - 'csharp': CSharpLanguage() + 'csharp': CSharpLanguage(), + 'build': Build(), } # parse command line -- cgit v1.2.3 From d07a278ef4531f26c547ea822507b2a24e07a585 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 26 Mar 2015 10:07:15 -0700 Subject: Started adding support for trailing metadata --- src/node/src/client.js | 4 +- src/node/src/server.js | 43 +++++++++++++--- src/node/test/surface_test.js | 115 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 152 insertions(+), 10 deletions(-) diff --git a/src/node/src/client.js b/src/node/src/client.js index c46f7d0526..fad369c2f8 100644 --- a/src/node/src/client.js +++ b/src/node/src/client.js @@ -241,13 +241,13 @@ function makeUnaryRequestFunction(method, serialize, deserialize) { callback(err); return; } + emitter.emit('status', response.status); if (response.status.code !== grpc.status.OK) { var error = new Error(response.status.details); error.code = response.status.code; callback(error); return; } - emitter.emit('status', response.status); emitter.emit('metadata', response.metadata); callback(null, deserialize(response.read)); }); @@ -312,13 +312,13 @@ function makeClientStreamRequestFunction(method, serialize, deserialize) { callback(err); return; } + stream.emit('status', response.status); if (response.status.code !== grpc.status.OK) { var error = new Error(response.status.details); error.code = response.status.code; callback(error); return; } - stream.emit('status', response.status); callback(null, deserialize(response.read)); }); }); diff --git a/src/node/src/server.js b/src/node/src/server.js index 8a26a43606..05de16294d 100644 --- a/src/node/src/server.js +++ b/src/node/src/server.js @@ -70,6 +70,9 @@ function handleError(call, error) { status.details = error.details; } } + if (error.hasOwnProperty('metadata')) { + status.metadata = error.metadata; + } var error_batch = {}; error_batch[grpc.opType.SEND_STATUS_FROM_SERVER] = status; call.startBatch(error_batch, function(){}); @@ -102,15 +105,20 @@ function waitForCancel(call, emitter) { * @param {*} value The value to respond with * @param {function(*):Buffer=} serialize Serialization function for the * response + * @param {Object=} metadata Optional trailing metadata to send with status */ -function sendUnaryResponse(call, value, serialize) { +function sendUnaryResponse(call, value, serialize, metadata) { var end_batch = {}; - end_batch[grpc.opType.SEND_MESSAGE] = serialize(value); - end_batch[grpc.opType.SEND_STATUS_FROM_SERVER] = { + var status = { code: grpc.status.OK, details: 'OK', metadata: {} }; + if (metadata) { + status.metadata = metadata; + } + end_batch[grpc.opType.SEND_MESSAGE] = serialize(value); + end_batch[grpc.opType.SEND_STATUS_FROM_SERVER] = status; call.startBatch(end_batch, function (){}); } @@ -143,6 +151,7 @@ function setUpWritable(stream, serialize) { function setStatus(err) { var code = grpc.status.INTERNAL; var details = 'Unknown Error'; + var metadata = {}; if (err.hasOwnProperty('message')) { details = err.message; } @@ -152,7 +161,10 @@ function setUpWritable(stream, serialize) { details = err.details; } } - stream.status = {code: code, details: details, metadata: {}}; + if (err.hasOwnProperty('metadata')) { + metadata = err.metadata; + } + stream.status = {code: code, details: details, metadata: metadata}; } /** * Terminate the call. This includes indicating that reads are done, draining @@ -166,6 +178,17 @@ function setUpWritable(stream, serialize) { stream.end(); } stream.on('error', terminateCall); + /** + * Override of Writable#end method that allows for sending metadata with a + * success status. + * @param {Object=} metadata Metadata to send with the status + */ + stream.end = function(metadata) { + if (metadata) { + stream.status.metadata = metadata; + } + Writable.prototype.end.call(this); + }; } /** @@ -335,11 +358,13 @@ function handleUnary(call, handler, metadata) { if (emitter.cancelled) { return; } - handler.func(emitter, function sendUnaryData(err, value) { + handler.func(emitter, function sendUnaryData(err, value, trailer) { if (err) { + err.metadata = trailer; handleError(call, err); + } else { + sendUnaryResponse(call, value, handler.serialize, trailer); } - sendUnaryResponse(call, value, handler.serialize); }); }); } @@ -378,12 +403,14 @@ function handleClientStreaming(call, handler, metadata) { var metadata_batch = {}; metadata_batch[grpc.opType.SEND_INITIAL_METADATA] = metadata; call.startBatch(metadata_batch, function() {}); - handler.func(stream, function(err, value) { + handler.func(stream, function(err, value, trailer) { stream.terminate(); if (err) { + err.metadata = trailer; handleError(call, err); + } else { + sendUnaryResponse(call, value, handler.serialize, trailer); } - sendUnaryResponse(call, value, handler.serialize); }); } diff --git a/src/node/test/surface_test.js b/src/node/test/surface_test.js index 96b47815e1..61bce56e74 100644 --- a/src/node/test/surface_test.js +++ b/src/node/test/surface_test.js @@ -126,6 +126,121 @@ describe('Generic client and server', function() { }); }); }); +describe.only('Trailing metadata', function() { + var client; + var server; + before(function() { + var test_proto = ProtoBuf.loadProtoFile(__dirname + '/test_service.proto'); + var test_service = test_proto.lookup('TestService'); + var Server = grpc.buildServer([test_service]); + server = new Server({ + TestService: { + unary: function(call, cb) { + var req = call.request; + if (req.error) { + cb(new Error('Requested error'), null, {metadata: ['yes']}); + } else { + cb(null, {count: 1}, {metadata: ['yes']}); + } + }, + clientStream: function(stream, cb){ + var count = 0; + stream.on('data', function(data) { + if (data.error) { + cb(new Error('Requested error'), null, {metadata: ['yes']}); + } else { + count += 1; + } + }); + stream.on('end', function() { + cb(null, {count: count}, {metadata: ['yes']}); + }); + }, + serverStream: function(stream) { + var req = stream.request; + if (req.error) { + var err = new Error('Requested error'); + err.metadata = {metadata: ['yes']}; + stream.emit(err); + } else { + for (var i = 0; i < 5; i++) { + stream.write({count: i}); + } + stream.end({metadata: ['yes']}); + } + }, + bidiStream: function(stream) { + var count = 0; + stream.on('data', function(data) { + if (data.error) { + var err = new Error('Requested error'); + err.metadata = { + metadata: 'yes', + count: '' + count + }; + stream.emit('error', err); + } else { + stream.write({count: count}); + count += 1; + } + }); + stream.on('end', function() { + stream.end({metadata: ['yes']}); + }); + } + } + }); + var port = server.bind('localhost:0'); + var Client = surface_client.makeProtobufClientConstructor(test_service); + client = new Client('localhost:' + port); + server.listen(); + }); + after(function() { + server.shutdown(); + }); + it('when a unary call succeeds', function(done) { + var call = client.unary({error: false}, function(err, data) { + assert.ifError(err); + }); + call.on('status', function(status) { + assert.deepEqual(status.metadata.metadata, ['yes']); + done(); + }); + }); + it('when a unary call fails', function(done) { + var call = client.unary({error: true}, function(err, data) { + assert(err); + }); + call.on('status', function(status) { + assert.deepEqual(status.metadata.metadata, ['yes']); + done(); + }); + }); + it('when a client stream call succeeds', function(done) { + var call = client.clientStream(function(err, data) { + assert.ifError(err); + }); + call.write({error: false}); + call.write({error: false}); + call.end(); + call.on('status', function(status) { + assert.deepEqual(status.metadata.metadata, ['yes']); + done(); + }); + }); + it('when a client stream call fails', function(done) { + var call = client.clientStream(function(err, data) { + assert(err); + }); + call.write({error: false}); + call.write({error: true}); + call.end(); + call.on('status', function(status) { + assert.deepEqual(status.metadata.metadata, ['yes']); + done(); + }); + }); +}); describe('Cancelling surface client', function() { var client; var server; -- cgit v1.2.3 From bef9cbc7dc315450fe15d4b80b6ba34a0822ff2e Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Thu, 26 Mar 2015 11:02:06 -0700 Subject: Eliminate range-based fors --- test/cpp/qps/client_async.cc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc index e4e7e73762..590d56d8d0 100644 --- a/test/cpp/qps/client_async.cc +++ b/test/cpp/qps/client_async.cc @@ -281,16 +281,17 @@ class AsyncStreamingClient GRPC_FINAL : public Client { int t = 0; for (int i = 0; i < config.outstanding_rpcs_per_channel(); i++) { - for (auto &channel : channels_) { - auto *cq = cli_cqs_[t].get(); + for (auto channel = channels_.begin(); channel != channels_.end(); + channel++) { + auto* cq = cli_cqs_[t].get(); t = (t + 1) % cli_cqs_.size(); auto start_req = [cq](TestService::Stub *stub, grpc::ClientContext *ctx, void *tag) { auto stream = stub->AsyncStreamingCall(ctx, cq, tag); - return stream; + return stream; }; - TestService::Stub *stub = channel.get_stub(); + TestService::Stub *stub = channel->get_stub(); const SimpleRequest &request = request_; new ClientRpcContextStreamingImpl( stub, request, start_req, check_done); @@ -303,11 +304,11 @@ class AsyncStreamingClient GRPC_FINAL : public Client { ~AsyncStreamingClient() GRPC_OVERRIDE { EndThreads(); - for (auto &cq : cli_cqs_) { - cq->Shutdown(); + for (auto cq = cli_cqs_.begin(); cq != cli_cqs_.end(); cq++) { + (*cq)->Shutdown(); void *got_tag; bool ok; - while (cq->Next(&got_tag, &ok)) { + while ((*cq)->Next(&got_tag, &ok)) { delete ClientRpcContext::detag(got_tag); } } -- cgit v1.2.3 From 9140a068b57ef3319846ec22a68cb6eeb3540abc Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 26 Mar 2015 11:27:58 -0700 Subject: Replaced existing PHP files with more batch-based implementation --- src/php/lib/Grpc/AbstractCall.php | 79 +++++++++++++++ src/php/lib/Grpc/AbstractSurfaceActiveCall.php | 98 ------------------ src/php/lib/Grpc/ActiveCall.php | 110 --------------------- src/php/lib/Grpc/BaseStub.php | 31 +++--- src/php/lib/Grpc/BidiStreamingCall.php | 89 +++++++++++++++++ .../lib/Grpc/BidiStreamingSurfaceActiveCall.php | 75 -------------- src/php/lib/Grpc/ClientStreamingCall.php | 68 +++++++++++++ .../lib/Grpc/ClientStreamingSurfaceActiveCall.php | 71 ------------- src/php/lib/Grpc/ServerStreamingCall.php | 79 +++++++++++++++ .../lib/Grpc/ServerStreamingSurfaceActiveCall.php | 74 -------------- src/php/lib/Grpc/SimpleSurfaceActiveCall.php | 71 ------------- src/php/lib/Grpc/UnaryCall.php | 67 +++++++++++++ 12 files changed, 394 insertions(+), 518 deletions(-) create mode 100644 src/php/lib/Grpc/AbstractCall.php delete mode 100755 src/php/lib/Grpc/AbstractSurfaceActiveCall.php delete mode 100755 src/php/lib/Grpc/ActiveCall.php create mode 100644 src/php/lib/Grpc/BidiStreamingCall.php delete mode 100755 src/php/lib/Grpc/BidiStreamingSurfaceActiveCall.php create mode 100644 src/php/lib/Grpc/ClientStreamingCall.php delete mode 100755 src/php/lib/Grpc/ClientStreamingSurfaceActiveCall.php create mode 100644 src/php/lib/Grpc/ServerStreamingCall.php delete mode 100755 src/php/lib/Grpc/ServerStreamingSurfaceActiveCall.php delete mode 100755 src/php/lib/Grpc/SimpleSurfaceActiveCall.php create mode 100644 src/php/lib/Grpc/UnaryCall.php diff --git a/src/php/lib/Grpc/AbstractCall.php b/src/php/lib/Grpc/AbstractCall.php new file mode 100644 index 0000000000..b813d16470 --- /dev/null +++ b/src/php/lib/Grpc/AbstractCall.php @@ -0,0 +1,79 @@ +call = new Call($channel, $method, Timeval::inf_future()); + $this->deserialize = $deserialize; + } + + /** + * @return The metadata sent by the server. + */ + public function getMetadata() { + return $this->metadata; + } + + /** + * Cancels the call + */ + public function cancel() { + $this->call->cancel(); + } + + /** + * Deserialize a response value to an object. + * @param string $value The binary value to deserialize + * @return The deserialized value + */ + protected function deserializeResponse($value) { + if ($value === null) { + return null; + } + return call_user_func($this->deserialize, $value); + } +} \ No newline at end of file diff --git a/src/php/lib/Grpc/AbstractSurfaceActiveCall.php b/src/php/lib/Grpc/AbstractSurfaceActiveCall.php deleted file mode 100755 index 9d0af090ce..0000000000 --- a/src/php/lib/Grpc/AbstractSurfaceActiveCall.php +++ /dev/null @@ -1,98 +0,0 @@ -active_call = new ActiveCall($channel, $method, $metadata, $flags); - $this->deserialize = $deserialize; - } - - /** - * @return The metadata sent by the server - */ - public function getMetadata() { - return $this->metadata(); - } - - /** - * Cancels the call - */ - public function cancel() { - $this->active_call->cancel(); - } - - protected function _read() { - $response = $this->active_call->read(); - if ($response === null) { - return null; - } - return call_user_func($this->deserialize, $response); - } - - protected function _write($value) { - return $this->active_call->write($value->serialize()); - } - - protected function _writesDone() { - $this->active_call->writesDone(); - } - - protected function _getStatus() { - return $this->active_call->getStatus(); - } -} diff --git a/src/php/lib/Grpc/ActiveCall.php b/src/php/lib/Grpc/ActiveCall.php deleted file mode 100755 index 9e048ae03b..0000000000 --- a/src/php/lib/Grpc/ActiveCall.php +++ /dev/null @@ -1,110 +0,0 @@ -call = new Call($channel, $method, Timeval::inf_future()); - - $event = $this->call->start_batch([OP_SEND_INITIAL_METADATA => $metadata]); - - $this->metadata = $event->metadata; - } - - /** - * @return The metadata sent by the server. - */ - public function getMetadata() { - return $this->metadata; - } - - /** - * Cancels the call - */ - public function cancel() { - $this->call->cancel(); - } - - /** - * Read a single message from the server. - * @return The next message from the server, or null if there is none. - */ - public function read() { - $read_event = $this->call->start_batch([OP_RECV_MESSAGE => true]); - return $read_event->message; - } - - /** - * Write a single message to the server. This cannot be called after - * writesDone is called. - * @param ByteBuffer $data The data to write - */ - public function write($data) { - $this->call->start_batch([OP_SEND_MESSAGE => $data]); - } - - /** - * Indicate that no more writes will be sent. - */ - public function writesDone() { - $this->call->start_batch([OP_SEND_CLOSE_FROM_CLIENT => true]); - } - - /** - * Wait for the server to send the status, and return it. - * @return object The status object, with integer $code, string $details, - * and array $metadata members - */ - public function getStatus() { - $status_event = $this->call->start_batch([ - OP_RECV_STATUS_ON_CLIENT => true - ]); - return $status_event->status; - } -} diff --git a/src/php/lib/Grpc/BaseStub.php b/src/php/lib/Grpc/BaseStub.php index fde055a3b3..9bc1711110 100755 --- a/src/php/lib/Grpc/BaseStub.php +++ b/src/php/lib/Grpc/BaseStub.php @@ -69,11 +69,9 @@ class BaseStub { $argument, callable $deserialize, $metadata = array()) { - return new SimpleSurfaceActiveCall($this->channel, - $method, - $deserialize, - $argument, - $metadata); + $call = new UnaryCall($this->channel, $method, $deserialize); + $call->start($argument, $metadata); + return $call; } /** @@ -91,11 +89,9 @@ class BaseStub { $arguments, callable $deserialize, $metadata = array()) { - return new ClientStreamingSurfaceActiveCall($this->channel, - $method, - $deserialize, - $arguments, - $metadata); + $call = new ClientStreamingCall($this->channel, $method, $deserialize); + $call->start($arguments, $metadata); + return $call; } /** @@ -112,11 +108,9 @@ class BaseStub { $argument, callable $deserialize, $metadata = array()) { - return new ServerStreamingSurfaceActiveCall($this->channel, - $method, - $deserialize, - $argument, - $metadata); + $call = new ServerStreamingCall($this->channel, $method, $deserialize); + $call->start($argument, $metadata); + return $call; } /** @@ -130,9 +124,8 @@ class BaseStub { public function _bidiRequest($method, callable $deserialize, $metadata = array()) { - return new BidiStreamingSurfaceActiveCall($this->channel, - $method, - $deserialize, - $metadata); + $call = new BidiStreamingCall($this->channel, $method, $deserialize); + $call->start($metadata); + return $call; } } diff --git a/src/php/lib/Grpc/BidiStreamingCall.php b/src/php/lib/Grpc/BidiStreamingCall.php new file mode 100644 index 0000000000..0d3dd629f2 --- /dev/null +++ b/src/php/lib/Grpc/BidiStreamingCall.php @@ -0,0 +1,89 @@ +call->start_batch([ + OP_SEND_INITIAL_METADATA => $metadata, + OP_RECV_INITIAL_METADATA => true]); + $this->metadata = $event->metadata; + } + + /** + * Reads the next value from the server. + * @return The next value from the server, or null if there is none + */ + public function read() { + $read_event = $this->call->start_batch([OP_RECV_MESSAGE => true]); + return $this->deserializeResponse($read_event->message); + } + + /** + * Write a single message to the server. This cannot be called after + * writesDone is called. + * @param ByteBuffer $data The data to write + */ + public function write($data) { + $this->call->start_batch([OP_SEND_MESSAGE => $data->serialize()]); + } + + /** + * Indicate that no more writes will be sent. + */ + public function writesDone() { + $this->call->start_batch([OP_SEND_CLOSE_FROM_CLIENT => true]); + } + + /** + * Wait for the server to send the status, and return it. + * @return object The status object, with integer $code, string $details, + * and array $metadata members + */ + public function getStatus() { + $status_event = $this->call->start_batch([ + OP_RECV_STATUS_ON_CLIENT => true + ]); + return $status_event->status; + } +} \ No newline at end of file diff --git a/src/php/lib/Grpc/BidiStreamingSurfaceActiveCall.php b/src/php/lib/Grpc/BidiStreamingSurfaceActiveCall.php deleted file mode 100755 index 0459f21e27..0000000000 --- a/src/php/lib/Grpc/BidiStreamingSurfaceActiveCall.php +++ /dev/null @@ -1,75 +0,0 @@ -_read(); - } - - /** - * Writes a single message to the server. This cannot be called after - * writesDone is called. - * @param $value The message to send - */ - public function write($value) { - $this->_write($value); - } - - /** - * Indicate that no more writes will be sent - */ - public function writesDone() { - $this->_writesDone(); - } - - /** - * Wait for the server to send the status, and return it. - * @return object The status object, with integer $code and string $details - * members - */ - public function getStatus() { - return $this->_getStatus(); - } -} diff --git a/src/php/lib/Grpc/ClientStreamingCall.php b/src/php/lib/Grpc/ClientStreamingCall.php new file mode 100644 index 0000000000..4b3abcbdec --- /dev/null +++ b/src/php/lib/Grpc/ClientStreamingCall.php @@ -0,0 +1,68 @@ +call->start_batch([ + OP_SEND_INITIAL_METADATA => $metadata, + OP_RECV_INITIAL_METADATA => true]); + $this->metadata = $event->metadata; + foreach($arg_iter as $arg) { + $this->call->start_batch([OP_SEND_MESSAGE => $arg->serialize()]); + } + $this->call->start_batch([OP_SEND_CLOSE_FROM_CLIENT => true]); + } + + /** + * Wait for the server to respond with data and a status + * @return [response data, status] + */ + public function wait() { + $event = $this->call->start_batch([ + OP_RECV_MESSAGE => true, + OP_RECV_STATUS_ON_CLIENT => true]); + return array($this->deserializeResponse($event->message), $event->status); + } +} \ No newline at end of file diff --git a/src/php/lib/Grpc/ClientStreamingSurfaceActiveCall.php b/src/php/lib/Grpc/ClientStreamingSurfaceActiveCall.php deleted file mode 100755 index d33f09fbe4..0000000000 --- a/src/php/lib/Grpc/ClientStreamingSurfaceActiveCall.php +++ /dev/null @@ -1,71 +0,0 @@ -_write($arg); - } - $this->_writesDone(); - } - - /** - * Wait for the server to respond with data and a status - * @return [response data, status] - */ - public function wait() { - $response = $this->_read(); - $status = $this->_getStatus(); - return array($response, $status); - } -} diff --git a/src/php/lib/Grpc/ServerStreamingCall.php b/src/php/lib/Grpc/ServerStreamingCall.php new file mode 100644 index 0000000000..7458f28bcb --- /dev/null +++ b/src/php/lib/Grpc/ServerStreamingCall.php @@ -0,0 +1,79 @@ +call->start_batch([ + OP_SEND_INITIAL_METADATA => $metadata, + OP_RECV_INITIAL_METADATA => true, + OP_SEND_MESSAGE => $arg->serialize(), + OP_SEND_CLOSE_FROM_CLIENT => true]); + $this->metadata = $event->metadata; + } + + /** + * @return An iterator of response values + */ + public function responses() { + $response = $this->call->start_batch([OP_RECV_MESSAGE => true])->message; + while($response !== null) { + yield $this->deserializeResponse($response); + $response = $this->call->start_batch([OP_RECV_MESSAGE => true])->message; + } + } + + /** + * Wait for the server to send the status, and return it. + * @return object The status object, with integer $code, string $details, + * and array $metadata members + */ + public function getStatus() { + $status_event = $this->call->start_batch([ + OP_RECV_STATUS_ON_CLIENT => true + ]); + return $status_event->status; + } +} \ No newline at end of file diff --git a/src/php/lib/Grpc/ServerStreamingSurfaceActiveCall.php b/src/php/lib/Grpc/ServerStreamingSurfaceActiveCall.php deleted file mode 100755 index fd08e86e51..0000000000 --- a/src/php/lib/Grpc/ServerStreamingSurfaceActiveCall.php +++ /dev/null @@ -1,74 +0,0 @@ -_write($arg); - $this->_writesDone(); - } - - /** - * @return An iterator of response values - */ - public function responses() { - while(($response = $this->_read()) !== null) { - yield $response; - } - } - - public function getStatus() { - return $this->_getStatus(); - } -} diff --git a/src/php/lib/Grpc/SimpleSurfaceActiveCall.php b/src/php/lib/Grpc/SimpleSurfaceActiveCall.php deleted file mode 100755 index ba82f5704f..0000000000 --- a/src/php/lib/Grpc/SimpleSurfaceActiveCall.php +++ /dev/null @@ -1,71 +0,0 @@ -_write($arg); - $this->_writesDone(); - } - - /** - * Wait for the server to respond with data and a status - * @return [response data, status] - */ - public function wait() { - $response = $this->_read(); - $status = $this->_getStatus(); - return array($response, $status); - } -} diff --git a/src/php/lib/Grpc/UnaryCall.php b/src/php/lib/Grpc/UnaryCall.php new file mode 100644 index 0000000000..bbf9cfb588 --- /dev/null +++ b/src/php/lib/Grpc/UnaryCall.php @@ -0,0 +1,67 @@ +call->start_batch([ + OP_SEND_INITIAL_METADATA => $metadata, + OP_RECV_INITIAL_METADATA => true, + OP_SEND_MESSAGE => $arg->serialize(), + OP_SEND_CLOSE_FROM_CLIENT => true]); + $this->metadata = $event->metadata; + } + + /** + * Wait for the server to respond with data and a status + * @return [response data, status] + */ + public function wait() { + $event = $this->call->start_batch([ + OP_RECV_MESSAGE => true, + OP_RECV_STATUS_ON_CLIENT => true]); + return array($this->deserializeResponse($event->message), $event->status); + } +} \ No newline at end of file -- cgit v1.2.3 From 4bcab68012662b0cd63abb769f3e309604d1fb91 Mon Sep 17 00:00:00 2001 From: vjpai Date: Thu, 26 Mar 2015 13:21:24 -0700 Subject: Include the config.h file to make sure that nullptr is covered --- test/cpp/qps/timer.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/test/cpp/qps/timer.cc b/test/cpp/qps/timer.cc index 3c1342041c..d1b6bc1e55 100644 --- a/test/cpp/qps/timer.cc +++ b/test/cpp/qps/timer.cc @@ -36,6 +36,7 @@ #include #include #include +#include Timer::Timer() : start_(Sample()) {} -- cgit v1.2.3 From 92a928fa6846362c102d9628ce0453c6229fb9be Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Thu, 26 Mar 2015 16:30:22 -0400 Subject: Make string construction explicit as implicit conversion doesn't work in 4.4 --- test/cpp/end2end/async_end2end_test.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index 233c5b13a7..9938fcf12e 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -532,15 +532,19 @@ TEST_F(AsyncEnd2endTest, MetadataRpc) { send_request.set_message("Hello"); std::pair meta1("key1", "val1"); std::pair meta2( - "key2-bin", {"\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc", 13}); + "key2-bin", + grpc::string("\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc", + 13)); std::pair meta3("key3", "val3"); std::pair meta6( "key4-bin", - {"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d", 14}); + grpc::string("\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d", + 14)); std::pair meta5("key5", "val5"); std::pair meta4( "key6-bin", - {"\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee", 15}); + grpc::string("\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee", + 15)); cli_ctx.AddMetadata(meta1.first, meta1.second); cli_ctx.AddMetadata(meta2.first, meta2.second); -- cgit v1.2.3 From 6130809a8bc792c952cb15f4931634cc47b35219 Mon Sep 17 00:00:00 2001 From: vjpai Date: Thu, 26 Mar 2015 17:12:17 -0400 Subject: Work around a compiler limitation caused by inability to properly handle vectors created from initializer list --- test/cpp/interop/server.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/cpp/interop/server.cc b/test/cpp/interop/server.cc index eceb600d4c..780a7370ac 100644 --- a/test/cpp/interop/server.cc +++ b/test/cpp/interop/server.cc @@ -213,8 +213,11 @@ void RunServer() { builder.RegisterService(&service); std::shared_ptr creds = grpc::InsecureServerCredentials(); if (FLAGS_enable_ssl) { - SslServerCredentialsOptions ssl_opts = { - "", {{test_server1_key, test_server1_cert}}}; + SslServerCredentialsOptions::PemKeyCertPair pkcp = {test_server1_key, + test_server1_cert}; + SslServerCredentialsOptions ssl_opts; + ssl_opts.pem_root_certs = ""; + ssl_opts.pem_key_cert_pairs.push_back(pkcp); creds = grpc::SslServerCredentials(ssl_opts); } builder.AddListeningPort(server_address.str(), creds); -- cgit v1.2.3 From eb21bdd1701cc769145d7bac63b1136f313218a1 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 26 Mar 2015 15:19:54 -0700 Subject: Finished adding trailing metadata tests --- src/node/test/surface_test.js | 56 ++++++++++++++++++++++++++++++++++++---- src/node/test/test_service.proto | 52 +++++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+), 5 deletions(-) create mode 100644 src/node/test/test_service.proto diff --git a/src/node/test/surface_test.js b/src/node/test/surface_test.js index 61bce56e74..d6e480521b 100644 --- a/src/node/test/surface_test.js +++ b/src/node/test/surface_test.js @@ -126,7 +126,7 @@ describe('Generic client and server', function() { }); }); }); -describe.only('Trailing metadata', function() { +describe('Trailing metadata', function() { var client; var server; before(function() { @@ -145,15 +145,19 @@ describe.only('Trailing metadata', function() { }, clientStream: function(stream, cb){ var count = 0; + var errored; stream.on('data', function(data) { if (data.error) { + errored = true; cb(new Error('Requested error'), null, {metadata: ['yes']}); } else { count += 1; } }); stream.on('end', function() { - cb(null, {count: count}, {metadata: ['yes']}); + if (!errored) { + cb(null, {count: count}, {metadata: ['yes']}); + } }); }, serverStream: function(stream) { @@ -161,7 +165,7 @@ describe.only('Trailing metadata', function() { if (req.error) { var err = new Error('Requested error'); err.metadata = {metadata: ['yes']}; - stream.emit(err); + stream.emit('error', err); } else { for (var i = 0; i < 5; i++) { stream.write({count: i}); @@ -175,8 +179,8 @@ describe.only('Trailing metadata', function() { if (data.error) { var err = new Error('Requested error'); err.metadata = { - metadata: 'yes', - count: '' + count + metadata: ['yes'], + count: ['' + count] }; stream.emit('error', err); } else { @@ -240,6 +244,48 @@ describe.only('Trailing metadata', function() { done(); }); }); + it('when a server stream call succeeds', function(done) { + var call = client.serverStream({error: false}); + call.on('data', function(){}); + call.on('status', function(status) { + assert.strictEqual(status.code, grpc.status.OK); + assert.deepEqual(status.metadata.metadata, ['yes']); + done(); + }); + }); + it('when a server stream call fails', function(done) { + var call = client.serverStream({error: true}); + call.on('data', function(){}); + call.on('status', function(status) { + assert.notStrictEqual(status.code, grpc.status.OK); + assert.deepEqual(status.metadata.metadata, ['yes']); + done(); + }); + }); + it('when a bidi stream succeeds', function(done) { + var call = client.bidiStream(); + call.write({error: false}); + call.write({error: false}); + call.end(); + call.on('data', function(){}); + call.on('status', function(status) { + assert.strictEqual(status.code, grpc.status.OK); + assert.deepEqual(status.metadata.metadata, ['yes']); + done(); + }); + }); + it('when a bidi stream fails', function(done) { + var call = client.bidiStream(); + call.write({error: false}); + call.write({error: true}); + call.end(); + call.on('data', function(){}); + call.on('status', function(status) { + assert.notStrictEqual(status.code, grpc.status.OK); + assert.deepEqual(status.metadata.metadata, ['yes']); + done(); + }); + }); }); describe('Cancelling surface client', function() { var client; diff --git a/src/node/test/test_service.proto b/src/node/test/test_service.proto new file mode 100644 index 0000000000..9ba3a686f2 --- /dev/null +++ b/src/node/test/test_service.proto @@ -0,0 +1,52 @@ +// 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. + +syntax = "proto3"; + +message Request { + optional bool error = 1; +} + +message Response { + optional int32 count = 1; +} + +service TestService { + rpc Unary (Request) returns (Response) { + } + + rpc ClientStream (stream Request) returns (Response) { + } + + rpc ServerStream (Request) returns (stream Response) { + } + + rpc BidiStream (stream Request) returns (stream Response) { + } +} \ No newline at end of file -- cgit v1.2.3 From 65c5efb4096395c576dafce810c45d910810af29 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Fri, 27 Mar 2015 01:29:22 +0100 Subject: Private headers shouldn't be public... --- Makefile | 10 ---------- build.json | 2 +- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 308796a9e8..44a20e6806 100644 --- a/Makefile +++ b/Makefile @@ -3595,16 +3595,6 @@ LIBGRPC_PLUGIN_SUPPORT_SRC = \ src/compiler/python_generator.cc \ src/compiler/ruby_generator.cc \ -PUBLIC_HEADERS_CXX += \ - src/compiler/config.h \ - src/compiler/cpp_generator.h \ - src/compiler/cpp_generator_helpers.h \ - src/compiler/generator_helpers.h \ - src/compiler/python_generator.h \ - src/compiler/ruby_generator.h \ - src/compiler/ruby_generator_helpers-inl.h \ - src/compiler/ruby_generator_map-inl.h \ - src/compiler/ruby_generator_string-inl.h \ LIBGRPC_PLUGIN_SUPPORT_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC_PLUGIN_SUPPORT_SRC)))) diff --git a/build.json b/build.json index 0d53bd6031..2fa2ac9cdd 100644 --- a/build.json +++ b/build.json @@ -502,7 +502,7 @@ "name": "grpc_plugin_support", "build": "protoc", "language": "c++", - "public_headers": [ + "headers": [ "src/compiler/config.h", "src/compiler/cpp_generator.h", "src/compiler/cpp_generator_helpers.h", -- cgit v1.2.3 From d48a969d3bd4bd977a771f7b059322d815c3e95e Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Fri, 27 Mar 2015 02:06:44 +0100 Subject: Small compiler optimization. --- src/compiler/cpp_plugin.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/compiler/cpp_plugin.cc b/src/compiler/cpp_plugin.cc index 57f25a1f75..acbe128213 100644 --- a/src/compiler/cpp_plugin.cc +++ b/src/compiler/cpp_plugin.cc @@ -58,6 +58,11 @@ class CppGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { return false; } + if (file->service_count() == 0) { + // No services. Do nothing. + return true; + } + grpc_cpp_generator::Parameters generator_parameters; if (!parameter.empty()) { -- cgit v1.2.3 From e0eda5fc5cefd28328f96b25452e544fd2195a08 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 26 Mar 2015 18:42:10 -0700 Subject: Fixed proto syntax --- src/node/test/test_service.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node/test/test_service.proto b/src/node/test/test_service.proto index 9ba3a686f2..5d3d891841 100644 --- a/src/node/test/test_service.proto +++ b/src/node/test/test_service.proto @@ -27,7 +27,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -syntax = "proto3"; +syntax = "proto2"; message Request { optional bool error = 1; -- cgit v1.2.3 From ced2b89f55c252e6235a2c19cf17273fbe10bfef Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Thu, 26 Mar 2015 22:59:54 -0700 Subject: Finish grpc_cli --- test/cpp/util/grpc_cli.cc | 149 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 120 insertions(+), 29 deletions(-) diff --git a/test/cpp/util/grpc_cli.cc b/test/cpp/util/grpc_cli.cc index ae012c2560..0e1eab1677 100644 --- a/test/cpp/util/grpc_cli.cc +++ b/test/cpp/util/grpc_cli.cc @@ -31,70 +31,161 @@ * */ -#include +/* + A command line tool to talk to any grpc server. + Example of talking to grpc interop server: + 1. Prepare request binary file: + a. create a text file input.txt, containing the following: + response_size: 10 + payload: { + body: "hello world" + } + b. under grpc/ run + protoc --proto_path=test/cpp/interop/ \ + --encode=grpc.testing.SimpleRequest test/cpp/interop/messages.proto \ + < input.txt > input.bin + 2. Start a server + make interop_server && bins/opt/interop_server --port=50051 + 3. Run the tool + make grpc_cli && bins/opt/grpc_cli call localhost:50051 \ + /grpc.testing.TestService/UnaryCall --enable_ssl=false \ + --input_binary_file=input.bin --output_binary_file=output.bin + 4. Decode response + protoc --proto_path=test/cpp/interop/ \ + --decode=grpc.testing.SimpleResponse test/cpp/interop/messages.proto \ + < output.bin > output.txt + 5. Now the text form of response should be in output.txt +*/ + +#include #include -#include +#include -#include "test/cpp/util/create_test_channel.h" -#include "src/cpp/util/time.h" -#include "src/cpp/server/thread_pool.h" #include +#include #include #include #include #include #include -#include -#include -#include -#include +#include #include #include -#include "test/core/util/port.h" #include -#include -#include +#include +#include // In some distros, gflags is in the namespace google, and in some others, // in gflags. This hack is enabling us to find both. -namespace google { } -namespace gflags { } +namespace google {} +namespace gflags {} using namespace google; using namespace gflags; -using std::chrono::system_clock; - -// DEFINE_bool(enable_ssl, true, "Whether to use ssl/tls."); - -void Call() {} +DEFINE_bool(enable_ssl, true, "Whether to use ssl/tls."); +DEFINE_bool(use_auth, false, "Whether to create default google credentials."); +DEFINE_string(input_binary_file, "", + "Path to input file containing serialized request."); +DEFINE_string(output_binary_file, "output.bin", + "Path to output file to write serialized response."); + +void* tag(int i) { return (void*)(gpr_intptr) i; } + +void Call(std::shared_ptr channel, + const grpc::string& method) { + std::unique_ptr stub(new grpc::GenericStub(channel)); + grpc::ClientContext ctx; + grpc::CompletionQueue cq; + std::unique_ptr call( + stub->Call(&ctx, method, &cq, tag(1))); + void* got_tag; + bool ok; + cq.Next(&got_tag, &ok); + GPR_ASSERT(ok); + + std::ifstream input_file(FLAGS_input_binary_file, + std::ios::in | std::ios::binary); + std::stringstream input_stream; + input_stream << input_file.rdbuf(); + + gpr_slice s = gpr_slice_from_copied_string(input_stream.str().c_str()); + grpc::Slice req_slice(s, grpc::Slice::STEAL_REF); + grpc::ByteBuffer request(&req_slice, 1); + call->Write(request, tag(2)); + cq.Next(&got_tag, &ok); + GPR_ASSERT(ok); + call->WritesDone(tag(3)); + cq.Next(&got_tag, &ok); + GPR_ASSERT(ok); + grpc::ByteBuffer recv_buffer; + call->Read(&recv_buffer, tag(4)); + cq.Next(&got_tag, &ok); + if (!ok) { + std::cout << "Failed to read response." << std::endl; + return; + } + grpc::Status status; + call->Finish(&status, tag(5)); + cq.Next(&got_tag, &ok); + GPR_ASSERT(ok); + + if (status.IsOk()) { + std::cout << "RPC finished with OK status." << std::endl; + std::vector slices; + recv_buffer.Dump(&slices); + + std::ofstream output_file(FLAGS_output_binary_file, + std::ios::trunc | std::ios::binary); + for (size_t i = 0; i < slices.size(); i++) { + output_file.write(reinterpret_cast(slices[i].begin()), + slices[i].size()); + } + } else { + std::cout << "RPC finished with status code " << status.code() + << " details: " << status.details() << std::endl; + } +} int main(int argc, char** argv) { grpc_init(); ParseCommandLineFlags(&argc, &argv, true); - if (argc < grpc::string(argv[1]) != "call") { + if (argc < 4 || grpc::string(argv[1]) != "call") { std::cout << "Usage: grpc_cli call server_host:port full_method_string\n" << "Example: grpc_cli call service.googleapis.com " - << "/grpc.cpp.test.util.TestService/Echo " << std::endl; + << "/grpc.testing.TestService/UnaryCall " + << "--input_binary_file=input.bin --output_binary_file=output.bin" + << std::endl; } grpc::string server_address(argv[2]); - grpc::string method(argv[3]); + + if (FLAGS_input_binary_file.empty()) { + std::cout << "Missing --input_binary_file for serialized request." + << std::endl; + return 1; + } std::cout << "connecting to " << server_address << std::endl; - std::cout << "method is " << method << std::endl; - std::unique_ptr creds = grpc::GoogleDefaultCredentials(); + // TODO(yangg) basic check of method string + + std::unique_ptr creds; + if (!FLAGS_enable_ssl) { + creds = grpc::InsecureCredentials(); + } else { + if (FLAGS_use_auth) { + creds = grpc::GoogleDefaultCredentials(); + } else { + creds = grpc::SslCredentials(grpc::SslCredentialsOptions()); + } + } std::shared_ptr channel = grpc::CreateChannel(server_address, creds, grpc::ChannelArguments()); - // Parse argument - Call(); + Call(channel, method); channel.reset(); grpc_shutdown(); return 0; } - - - -- cgit v1.2.3 From 166f9d00cec5f74ef996dd3fec7025f2b031275c Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Thu, 26 Mar 2015 23:06:45 -0700 Subject: add back mis-deleted method string --- test/cpp/util/grpc_cli.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/test/cpp/util/grpc_cli.cc b/test/cpp/util/grpc_cli.cc index 0e1eab1677..8e001cc0f5 100644 --- a/test/cpp/util/grpc_cli.cc +++ b/test/cpp/util/grpc_cli.cc @@ -160,6 +160,7 @@ int main(int argc, char** argv) { << std::endl; } grpc::string server_address(argv[2]); + grpc::string method(argv[3]); if (FLAGS_input_binary_file.empty()) { std::cout << "Missing --input_binary_file for serialized request." -- cgit v1.2.3 From 92e86f946fcda636edf27e1c88e0517f4d6b7643 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Fri, 27 Mar 2015 12:02:34 -0700 Subject: Updated php_base Dockerfile to install PHP instead of compiling it --- tools/dockerfile/grpc_php/Dockerfile | 2 ++ tools/dockerfile/grpc_php_base/Dockerfile | 26 +++++++------------------- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/tools/dockerfile/grpc_php/Dockerfile b/tools/dockerfile/grpc_php/Dockerfile index 100d7b3bdb..e84455fc94 100644 --- a/tools/dockerfile/grpc_php/Dockerfile +++ b/tools/dockerfile/grpc_php/Dockerfile @@ -45,3 +45,5 @@ RUN cd /var/local/git/grpc/src/php/ext/grpc && git pull && phpize RUN cd /var/local/git/grpc/src/php/ext/grpc \ && ./configure \ && make + +RUN cd /var/local/git/grpc/src/php && ./bin/run_tests.sh \ No newline at end of file diff --git a/tools/dockerfile/grpc_php_base/Dockerfile b/tools/dockerfile/grpc_php_base/Dockerfile index cc874fd7c5..2fa0e0636b 100644 --- a/tools/dockerfile/grpc_php_base/Dockerfile +++ b/tools/dockerfile/grpc_php_base/Dockerfile @@ -50,45 +50,33 @@ RUN apt-get update && apt-get install -y \ libsqlite3-dev \ libssl-dev \ libtool \ + libxml2 \ libyaml-dev \ make \ patch \ procps \ -# TODO(mlumish): Uncomment these lines when building against them works -# php5-common \ -# php5-cli \ -# php5-dev \ -# php-pear \ + php5-common \ + php5-cli \ + php5-dev \ + php-pear \ pkg-config \ procps \ + ruby-full \ sqlite3 \ zlib1g-dev # Install the version of PHP gRPC is tested against ENV DEBIAN_FRONTEND noniteractive -RUN apt-get update && apt-get install -y libxml2 libxml2-dev # used by PHP -RUN cd /var/local \ - && curl -o php-5.5.17.tar.gz http://php.net/distributions/php-5.5.17.tar.gz \ - && tar -xf php-5.5.17.tar.gz \ - && cd php-5.5.17 \ - && ./configure --with-zlib=/usr --with-libxml-dir=ext/libxml \ - && make -j12 && make install # Download the patched PHP protobuf so that PHP gRPC clients can be generated # from proto3 schemas. RUN git clone https://github.com/murgatroid99/Protobuf-PHP.git /var/local/git/protobuf-php -# Install ruby (via RVM) as ruby tools are dependencies for building Protobuf -# PHP extensions. -RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3 # Needed for RVM -RUN \curl -sSL https://get.rvm.io | bash -s stable --ruby -ENV PATH /usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin - # ronn: a ruby tool used to convert markdown to man pages, used during the # install of Protobuf extensions # # rake: a ruby version of make used to build the PHP Protobuf extension -RUN rvm all do gem install ronn rake +RUN gem install ronn rake # Get the source from GitHub, this gets the protobuf library as well RUN git clone https://github.com/grpc/grpc.git /var/local/git/grpc -- cgit v1.2.3 From d081a22368dc2981017cd4550d4fe411965b144c Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Fri, 27 Mar 2015 12:36:34 -0700 Subject: Removed ruby installation change --- tools/dockerfile/grpc_php_base/Dockerfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/dockerfile/grpc_php_base/Dockerfile b/tools/dockerfile/grpc_php_base/Dockerfile index 2fa0e0636b..c58cccba74 100644 --- a/tools/dockerfile/grpc_php_base/Dockerfile +++ b/tools/dockerfile/grpc_php_base/Dockerfile @@ -61,7 +61,6 @@ RUN apt-get update && apt-get install -y \ php-pear \ pkg-config \ procps \ - ruby-full \ sqlite3 \ zlib1g-dev @@ -72,11 +71,17 @@ ENV DEBIAN_FRONTEND noniteractive # from proto3 schemas. RUN git clone https://github.com/murgatroid99/Protobuf-PHP.git /var/local/git/protobuf-php +# Install ruby (via RVM) as ruby tools are dependencies for building Protobuf +# PHP extensions. +RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3 # Needed for RVM +RUN \curl -sSL https://get.rvm.io | bash -s stable --ruby +ENV PATH /usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + # ronn: a ruby tool used to convert markdown to man pages, used during the # install of Protobuf extensions # # rake: a ruby version of make used to build the PHP Protobuf extension -RUN gem install ronn rake +RUN rvm all do gem install ronn rake # Get the source from GitHub, this gets the protobuf library as well RUN git clone https://github.com/grpc/grpc.git /var/local/git/grpc -- cgit v1.2.3 From d506d55a0847e1cdf0df7f14911736adcc10f680 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Fri, 27 Mar 2015 13:15:36 -0700 Subject: Added composer file to PHP library --- src/php/composer.json | 15 +++++++++++++++ src/php/composer.lock | 19 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 src/php/composer.json create mode 100644 src/php/composer.lock diff --git a/src/php/composer.json b/src/php/composer.json new file mode 100644 index 0000000000..dca61a9889 --- /dev/null +++ b/src/php/composer.json @@ -0,0 +1,15 @@ +{ + "name": "grpc/grpc", + "description": "gRPC library for PHP", + "version": "0.2.0", + "homepage": "http://grpc.io", + "license": "BSD-3-Clause", + "require": { + "php": ">=5.5.0" + }, + "autoload": { + "psr-4": { + "Grpc\\": "lib/Grpc/" + } + } +} diff --git a/src/php/composer.lock b/src/php/composer.lock new file mode 100644 index 0000000000..47fc70fd2d --- /dev/null +++ b/src/php/composer.lock @@ -0,0 +1,19 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "65467a098f5fd8b8fe5f7f6e10226f8a", + "packages": [], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=5.5.0" + }, + "platform-dev": [] +} -- cgit v1.2.3 From b2a6d01974dad8053f6f7bd1ce7c055e8672bf97 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Fri, 27 Mar 2015 13:15:58 -0700 Subject: Replaced existing autoloader with one generated by composer --- src/php/lib/Grpc/AbstractCall.php | 2 +- src/php/lib/Grpc/BaseStub.php | 2 +- src/php/lib/Grpc/BidiStreamingCall.php | 2 +- src/php/lib/Grpc/ClientStreamingCall.php | 2 +- src/php/lib/Grpc/ServerStreamingCall.php | 2 +- src/php/lib/Grpc/UnaryCall.php | 2 +- src/php/lib/autoload.php | 53 ---------------------- src/php/tests/generated_code/GeneratedCodeTest.php | 2 +- src/php/tests/interop/interop_client.php | 2 +- 9 files changed, 8 insertions(+), 61 deletions(-) delete mode 100755 src/php/lib/autoload.php diff --git a/src/php/lib/Grpc/AbstractCall.php b/src/php/lib/Grpc/AbstractCall.php index b813d16470..d7c3263040 100644 --- a/src/php/lib/Grpc/AbstractCall.php +++ b/src/php/lib/Grpc/AbstractCall.php @@ -33,7 +33,7 @@ */ namespace Grpc; -require_once realpath(dirname(__FILE__) . '/../autoload.php'); +require_once realpath(dirname(__FILE__) . '/../../vendor/autoload.php'); abstract class AbstractCall { diff --git a/src/php/lib/Grpc/BaseStub.php b/src/php/lib/Grpc/BaseStub.php index 9bc1711110..83e992ae70 100755 --- a/src/php/lib/Grpc/BaseStub.php +++ b/src/php/lib/Grpc/BaseStub.php @@ -32,7 +32,7 @@ * */ namespace Grpc; -require_once realpath(dirname(__FILE__) . '/../autoload.php'); +require_once realpath(dirname(__FILE__) . '/../../vendor/autoload.php'); /** * Base class for generated client stubs. Stub methods are expected to call diff --git a/src/php/lib/Grpc/BidiStreamingCall.php b/src/php/lib/Grpc/BidiStreamingCall.php index 0d3dd629f2..d45fd21510 100644 --- a/src/php/lib/Grpc/BidiStreamingCall.php +++ b/src/php/lib/Grpc/BidiStreamingCall.php @@ -32,7 +32,7 @@ * */ namespace Grpc; -require_once realpath(dirname(__FILE__) . '/../autoload.php'); +require_once realpath(dirname(__FILE__) . '/../../vendor/autoload.php'); /** * Represents an active call that allows for sending and recieving messages in diff --git a/src/php/lib/Grpc/ClientStreamingCall.php b/src/php/lib/Grpc/ClientStreamingCall.php index 4b3abcbdec..17c85b4c2b 100644 --- a/src/php/lib/Grpc/ClientStreamingCall.php +++ b/src/php/lib/Grpc/ClientStreamingCall.php @@ -32,7 +32,7 @@ * */ namespace Grpc; -require_once realpath(dirname(__FILE__) . '/../autoload.php'); +require_once realpath(dirname(__FILE__) . '/../../vendor/autoload.php'); /** * Represents an active call that sends a stream of messages and then gets a diff --git a/src/php/lib/Grpc/ServerStreamingCall.php b/src/php/lib/Grpc/ServerStreamingCall.php index 7458f28bcb..ac5e02eb53 100644 --- a/src/php/lib/Grpc/ServerStreamingCall.php +++ b/src/php/lib/Grpc/ServerStreamingCall.php @@ -33,7 +33,7 @@ */ namespace Grpc; -require_once realpath(dirname(__FILE__) . '/../autoload.php'); +require_once realpath(dirname(__FILE__) . '/../../vendor/autoload.php'); /** * Represents an active call that sends a single message and then gets a stream diff --git a/src/php/lib/Grpc/UnaryCall.php b/src/php/lib/Grpc/UnaryCall.php index bbf9cfb588..14c024085c 100644 --- a/src/php/lib/Grpc/UnaryCall.php +++ b/src/php/lib/Grpc/UnaryCall.php @@ -33,7 +33,7 @@ */ namespace Grpc; -require_once realpath(dirname(__FILE__) . '/../autoload.php'); +require_once realpath(dirname(__FILE__) . '/../../vendor/autoload.php'); /** * Represents an active call that sends a single message and then gets a single diff --git a/src/php/lib/autoload.php b/src/php/lib/autoload.php deleted file mode 100755 index 42eb33d65b..0000000000 --- a/src/php/lib/autoload.php +++ /dev/null @@ -1,53 +0,0 @@ - Date: Fri, 27 Mar 2015 13:20:59 -0700 Subject: Refactor and add a unit test --- Makefile | 50 +++++++++++++++- build.json | 17 ++++++ test/cpp/util/cli_call.cc | 106 +++++++++++++++++++++++++++++++++ test/cpp/util/cli_call.h | 53 +++++++++++++++++ test/cpp/util/cli_call_test.cc | 131 +++++++++++++++++++++++++++++++++++++++++ test/cpp/util/grpc_cli.cc | 79 ++++--------------------- tools/run_tests/tests.json | 5 ++ 7 files changed, 374 insertions(+), 67 deletions(-) create mode 100644 test/cpp/util/cli_call.cc create mode 100644 test/cpp/util/cli_call.h create mode 100644 test/cpp/util/cli_call_test.cc diff --git a/Makefile b/Makefile index b2f741be8c..0b2fe0701d 100644 --- a/Makefile +++ b/Makefile @@ -616,6 +616,7 @@ transport_metadata_test: $(BINDIR)/$(CONFIG)/transport_metadata_test transport_security_test: $(BINDIR)/$(CONFIG)/transport_security_test async_end2end_test: $(BINDIR)/$(CONFIG)/async_end2end_test channel_arguments_test: $(BINDIR)/$(CONFIG)/channel_arguments_test +cli_call_test: $(BINDIR)/$(CONFIG)/cli_call_test credentials_test: $(BINDIR)/$(CONFIG)/credentials_test cxx_time_test: $(BINDIR)/$(CONFIG)/cxx_time_test end2end_test: $(BINDIR)/$(CONFIG)/end2end_test @@ -1071,7 +1072,7 @@ buildtests: buildtests_c buildtests_cxx buildtests_c: privatelibs_c $(BINDIR)/$(CONFIG)/alarm_heap_test $(BINDIR)/$(CONFIG)/alarm_list_test $(BINDIR)/$(CONFIG)/alarm_test $(BINDIR)/$(CONFIG)/alpn_test $(BINDIR)/$(CONFIG)/bin_encoder_test $(BINDIR)/$(CONFIG)/census_hash_table_test $(BINDIR)/$(CONFIG)/census_statistics_multiple_writers_circular_buffer_test $(BINDIR)/$(CONFIG)/census_statistics_multiple_writers_test $(BINDIR)/$(CONFIG)/census_statistics_performance_test $(BINDIR)/$(CONFIG)/census_statistics_quick_test $(BINDIR)/$(CONFIG)/census_statistics_small_log_test $(BINDIR)/$(CONFIG)/census_stub_test $(BINDIR)/$(CONFIG)/census_window_stats_test $(BINDIR)/$(CONFIG)/chttp2_status_conversion_test $(BINDIR)/$(CONFIG)/chttp2_stream_encoder_test $(BINDIR)/$(CONFIG)/chttp2_stream_map_test $(BINDIR)/$(CONFIG)/chttp2_transport_end2end_test $(BINDIR)/$(CONFIG)/dualstack_socket_test $(BINDIR)/$(CONFIG)/echo_client $(BINDIR)/$(CONFIG)/echo_server $(BINDIR)/$(CONFIG)/echo_test $(BINDIR)/$(CONFIG)/fd_posix_test $(BINDIR)/$(CONFIG)/fling_client $(BINDIR)/$(CONFIG)/fling_server $(BINDIR)/$(CONFIG)/fling_stream_test $(BINDIR)/$(CONFIG)/fling_test $(BINDIR)/$(CONFIG)/gpr_cancellable_test $(BINDIR)/$(CONFIG)/gpr_cmdline_test $(BINDIR)/$(CONFIG)/gpr_env_test $(BINDIR)/$(CONFIG)/gpr_file_test $(BINDIR)/$(CONFIG)/gpr_histogram_test $(BINDIR)/$(CONFIG)/gpr_host_port_test $(BINDIR)/$(CONFIG)/gpr_log_test $(BINDIR)/$(CONFIG)/gpr_slice_buffer_test $(BINDIR)/$(CONFIG)/gpr_slice_test $(BINDIR)/$(CONFIG)/gpr_string_test $(BINDIR)/$(CONFIG)/gpr_sync_test $(BINDIR)/$(CONFIG)/gpr_thd_test $(BINDIR)/$(CONFIG)/gpr_time_test $(BINDIR)/$(CONFIG)/gpr_useful_test $(BINDIR)/$(CONFIG)/grpc_base64_test $(BINDIR)/$(CONFIG)/grpc_byte_buffer_reader_test $(BINDIR)/$(CONFIG)/grpc_channel_stack_test $(BINDIR)/$(CONFIG)/grpc_completion_queue_test $(BINDIR)/$(CONFIG)/grpc_credentials_test $(BINDIR)/$(CONFIG)/grpc_json_token_test $(BINDIR)/$(CONFIG)/grpc_stream_op_test $(BINDIR)/$(CONFIG)/hpack_parser_test $(BINDIR)/$(CONFIG)/hpack_table_test $(BINDIR)/$(CONFIG)/httpcli_format_request_test $(BINDIR)/$(CONFIG)/httpcli_parser_test $(BINDIR)/$(CONFIG)/httpcli_test $(BINDIR)/$(CONFIG)/json_rewrite $(BINDIR)/$(CONFIG)/json_rewrite_test $(BINDIR)/$(CONFIG)/json_test $(BINDIR)/$(CONFIG)/lame_client_test $(BINDIR)/$(CONFIG)/message_compress_test $(BINDIR)/$(CONFIG)/metadata_buffer_test $(BINDIR)/$(CONFIG)/multi_init_test $(BINDIR)/$(CONFIG)/murmur_hash_test $(BINDIR)/$(CONFIG)/no_server_test $(BINDIR)/$(CONFIG)/poll_kick_posix_test $(BINDIR)/$(CONFIG)/resolve_address_test $(BINDIR)/$(CONFIG)/secure_endpoint_test $(BINDIR)/$(CONFIG)/sockaddr_utils_test $(BINDIR)/$(CONFIG)/tcp_client_posix_test $(BINDIR)/$(CONFIG)/tcp_posix_test $(BINDIR)/$(CONFIG)/tcp_server_posix_test $(BINDIR)/$(CONFIG)/time_averaged_stats_test $(BINDIR)/$(CONFIG)/time_test $(BINDIR)/$(CONFIG)/timeout_encoding_test $(BINDIR)/$(CONFIG)/transport_metadata_test $(BINDIR)/$(CONFIG)/transport_security_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_no_op_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_thread_stress_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_writes_done_hangs_with_pending_read_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_accept_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_accept_and_writes_closed_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_before_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_in_a_vacuum_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_census_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_disappearing_server_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_early_server_shutdown_finishes_inflight_calls_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_early_server_shutdown_finishes_tags_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_graceful_server_shutdown_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_invoke_large_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_max_concurrent_streams_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_no_op_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_ping_pong_streaming_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_binary_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_trailing_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_with_large_metadata_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_simple_delayed_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_thread_stress_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_writes_done_hangs_with_pending_read_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_no_op_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_thread_stress_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_writes_done_hangs_with_pending_read_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_accept_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_accept_and_writes_closed_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_before_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_in_a_vacuum_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_census_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_disappearing_server_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_inflight_calls_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_tags_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_graceful_server_shutdown_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_invoke_large_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_max_concurrent_streams_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_no_op_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_ping_pong_streaming_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_binary_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_trailing_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_large_metadata_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_delayed_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_thread_stress_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_writes_done_hangs_with_pending_read_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_no_op_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_thread_stress_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_writes_done_hangs_with_pending_read_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_accept_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_accept_and_writes_closed_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_before_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_in_a_vacuum_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_census_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_disappearing_server_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_early_server_shutdown_finishes_inflight_calls_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_early_server_shutdown_finishes_tags_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_graceful_server_shutdown_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_invoke_large_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_max_concurrent_streams_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_no_op_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_ping_pong_streaming_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_binary_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_trailing_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_with_large_metadata_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_delayed_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_thread_stress_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_writes_done_hangs_with_pending_read_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_no_op_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_thread_stress_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_writes_done_hangs_with_pending_read_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_accept_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_accept_and_writes_closed_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_before_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_in_a_vacuum_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_census_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_disappearing_server_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_early_server_shutdown_finishes_inflight_calls_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_early_server_shutdown_finishes_tags_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_graceful_server_shutdown_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_invoke_large_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_max_concurrent_streams_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_no_op_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_ping_pong_streaming_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_binary_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_trailing_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_large_metadata_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_delayed_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_thread_stress_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_writes_done_hangs_with_pending_read_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_no_op_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_thread_stress_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_writes_done_hangs_with_pending_read_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_and_writes_closed_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_before_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_in_a_vacuum_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_census_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_disappearing_server_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_early_server_shutdown_finishes_inflight_calls_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_early_server_shutdown_finishes_tags_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_graceful_server_shutdown_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_invoke_large_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_max_concurrent_streams_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_no_op_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_ping_pong_streaming_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_binary_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_trailing_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_large_metadata_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_delayed_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_thread_stress_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_writes_done_hangs_with_pending_read_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_no_op_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_thread_stress_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_writes_done_hangs_with_pending_read_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_and_writes_closed_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_before_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_in_a_vacuum_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_census_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_disappearing_server_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_inflight_calls_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_tags_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_graceful_server_shutdown_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_invoke_large_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_max_concurrent_streams_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_no_op_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_ping_pong_streaming_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_binary_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_large_metadata_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_delayed_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_thread_stress_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_writes_done_hangs_with_pending_read_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_no_op_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_thread_stress_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_writes_done_hangs_with_pending_read_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_and_writes_closed_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_before_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_in_a_vacuum_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_census_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_disappearing_server_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_inflight_calls_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_tags_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_graceful_server_shutdown_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_invoke_large_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_max_concurrent_streams_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_no_op_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_ping_pong_streaming_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_binary_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_large_metadata_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_delayed_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_thread_stress_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_writes_done_hangs_with_pending_read_legacy_test -buildtests_cxx: privatelibs_cxx $(BINDIR)/$(CONFIG)/async_end2end_test $(BINDIR)/$(CONFIG)/channel_arguments_test $(BINDIR)/$(CONFIG)/credentials_test $(BINDIR)/$(CONFIG)/cxx_time_test $(BINDIR)/$(CONFIG)/end2end_test $(BINDIR)/$(CONFIG)/generic_end2end_test $(BINDIR)/$(CONFIG)/grpc_cli $(BINDIR)/$(CONFIG)/interop_client $(BINDIR)/$(CONFIG)/interop_server $(BINDIR)/$(CONFIG)/interop_test $(BINDIR)/$(CONFIG)/pubsub_client $(BINDIR)/$(CONFIG)/pubsub_publisher_test $(BINDIR)/$(CONFIG)/pubsub_subscriber_test $(BINDIR)/$(CONFIG)/qps_driver $(BINDIR)/$(CONFIG)/qps_worker $(BINDIR)/$(CONFIG)/status_test $(BINDIR)/$(CONFIG)/thread_pool_test +buildtests_cxx: privatelibs_cxx $(BINDIR)/$(CONFIG)/async_end2end_test $(BINDIR)/$(CONFIG)/channel_arguments_test $(BINDIR)/$(CONFIG)/cli_call_test $(BINDIR)/$(CONFIG)/credentials_test $(BINDIR)/$(CONFIG)/cxx_time_test $(BINDIR)/$(CONFIG)/end2end_test $(BINDIR)/$(CONFIG)/generic_end2end_test $(BINDIR)/$(CONFIG)/grpc_cli $(BINDIR)/$(CONFIG)/interop_client $(BINDIR)/$(CONFIG)/interop_server $(BINDIR)/$(CONFIG)/interop_test $(BINDIR)/$(CONFIG)/pubsub_client $(BINDIR)/$(CONFIG)/pubsub_publisher_test $(BINDIR)/$(CONFIG)/pubsub_subscriber_test $(BINDIR)/$(CONFIG)/qps_driver $(BINDIR)/$(CONFIG)/qps_worker $(BINDIR)/$(CONFIG)/status_test $(BINDIR)/$(CONFIG)/thread_pool_test test: test_c test_cxx @@ -1903,6 +1904,8 @@ test_cxx: buildtests_cxx $(Q) $(BINDIR)/$(CONFIG)/async_end2end_test || ( echo test async_end2end_test failed ; exit 1 ) $(E) "[RUN] Testing channel_arguments_test" $(Q) $(BINDIR)/$(CONFIG)/channel_arguments_test || ( echo test channel_arguments_test failed ; exit 1 ) + $(E) "[RUN] Testing cli_call_test" + $(Q) $(BINDIR)/$(CONFIG)/cli_call_test || ( echo test cli_call_test failed ; exit 1 ) $(E) "[RUN] Testing credentials_test" $(Q) $(BINDIR)/$(CONFIG)/credentials_test || ( echo test credentials_test failed ; exit 1 ) $(E) "[RUN] Testing cxx_time_test" @@ -3404,6 +3407,7 @@ LIBGRPC++_TEST_UTIL_SRC = \ $(GENDIR)/test/cpp/util/messages.pb.cc \ $(GENDIR)/test/cpp/util/echo.pb.cc \ $(GENDIR)/test/cpp/util/echo_duplicate.pb.cc \ + test/cpp/util/cli_call.cc \ test/cpp/util/create_test_channel.cc \ @@ -3434,6 +3438,7 @@ ifneq ($(OPENSSL_DEP),) test/cpp/util/messages.proto: $(OPENSSL_DEP) test/cpp/util/echo.proto: $(OPENSSL_DEP) test/cpp/util/echo_duplicate.proto: $(OPENSSL_DEP) +test/cpp/util/cli_call.cc: $(OPENSSL_DEP) test/cpp/util/create_test_channel.cc: $(OPENSSL_DEP) endif @@ -3462,6 +3467,7 @@ endif +$(OBJDIR)/$(CONFIG)/test/cpp/util/cli_call.o: $(GENDIR)/test/cpp/util/messages.pb.cc $(GENDIR)/test/cpp/util/echo.pb.cc $(GENDIR)/test/cpp/util/echo_duplicate.pb.cc $(OBJDIR)/$(CONFIG)/test/cpp/util/create_test_channel.o: $(GENDIR)/test/cpp/util/messages.pb.cc $(GENDIR)/test/cpp/util/echo.pb.cc $(GENDIR)/test/cpp/util/echo_duplicate.pb.cc @@ -8032,6 +8038,48 @@ endif endif +CLI_CALL_TEST_SRC = \ + test/cpp/util/cli_call_test.cc \ + +CLI_CALL_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(CLI_CALL_TEST_SRC)))) + +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL with ALPN. + +$(BINDIR)/$(CONFIG)/cli_call_test: openssl_dep_error + +else + + +ifeq ($(NO_PROTOBUF),true) + +# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. + +$(BINDIR)/$(CONFIG)/cli_call_test: protobuf_dep_error + +else + +$(BINDIR)/$(CONFIG)/cli_call_test: $(PROTOBUF_DEP) $(CLI_CALL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LDXX) $(LDFLAGS) $(CLI_CALL_TEST_OBJS) $(GTEST_LIB) $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/cli_call_test + +endif + +endif + +$(OBJDIR)/$(CONFIG)/test/cpp/util/cli_call_test.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + +deps_cli_call_test: $(CLI_CALL_TEST_OBJS:.o=.dep) + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(CLI_CALL_TEST_OBJS:.o=.dep) +endif +endif + + CREDENTIALS_TEST_SRC = \ test/cpp/client/credentials_test.cc \ diff --git a/build.json b/build.json index c2b0715166..9e9a1cec67 100644 --- a/build.json +++ b/build.json @@ -482,6 +482,7 @@ "test/cpp/util/messages.proto", "test/cpp/util/echo.proto", "test/cpp/util/echo_duplicate.proto", + "test/cpp/util/cli_call.cc", "test/cpp/util/create_test_channel.cc" ] }, @@ -1706,6 +1707,22 @@ "gpr" ] }, + { + "name": "cli_call_test", + "build": "test", + "language": "c++", + "src": [ + "test/cpp/util/cli_call_test.cc" + ], + "deps": [ + "grpc++_test_util", + "grpc_test_util", + "grpc++", + "grpc", + "gpr_test_util", + "gpr" + ] + }, { "name": "credentials_test", "build": "test", diff --git a/test/cpp/util/cli_call.cc b/test/cpp/util/cli_call.cc new file mode 100644 index 0000000000..eb67b8d314 --- /dev/null +++ b/test/cpp/util/cli_call.cc @@ -0,0 +1,106 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "test/cpp/util/cli_call.h" + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace grpc { +namespace testing { +namespace { +void* tag(int i) { return (void*)(gpr_intptr) i; } +} // namespace + +void CliCall::Call(std::shared_ptr channel, + const grpc::string& method, const grpc::string& request, + grpc::string* response) { + std::unique_ptr stub(new grpc::GenericStub(channel)); + grpc::ClientContext ctx; + grpc::CompletionQueue cq; + std::unique_ptr call( + stub->Call(&ctx, method, &cq, tag(1))); + void* got_tag; + bool ok; + cq.Next(&got_tag, &ok); + GPR_ASSERT(ok); + + gpr_slice s = gpr_slice_from_copied_string(request.c_str()); + grpc::Slice req_slice(s, grpc::Slice::STEAL_REF); + grpc::ByteBuffer send_buffer(&req_slice, 1); + call->Write(send_buffer, tag(2)); + cq.Next(&got_tag, &ok); + GPR_ASSERT(ok); + call->WritesDone(tag(3)); + cq.Next(&got_tag, &ok); + GPR_ASSERT(ok); + grpc::ByteBuffer recv_buffer; + call->Read(&recv_buffer, tag(4)); + cq.Next(&got_tag, &ok); + if (!ok) { + std::cout << "Failed to read response." << std::endl; + return; + } + grpc::Status status; + call->Finish(&status, tag(5)); + cq.Next(&got_tag, &ok); + GPR_ASSERT(ok); + + if (status.IsOk()) { + std::cout << "RPC finished with OK status." << std::endl; + std::vector slices; + recv_buffer.Dump(&slices); + + response->clear(); + for (size_t i = 0; i < slices.size(); i++) { + response->append(reinterpret_cast(slices[i].begin()), + slices[i].size()); + } + } else { + std::cout << "RPC finished with status code " << status.code() + << " details: " << status.details() << std::endl; + } +} + +} // namespace testing +} // namespace grpc diff --git a/test/cpp/util/cli_call.h b/test/cpp/util/cli_call.h new file mode 100644 index 0000000000..7be8bb63c4 --- /dev/null +++ b/test/cpp/util/cli_call.h @@ -0,0 +1,53 @@ +/* + * + * 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. + * + */ + +#ifndef GRPC_TEST_CPP_UTIL_CLI_CALL_H +#define GRPC_TEST_CPP_UTIL_CLI_CALL_H + +#include +#include + +namespace grpc { +namespace testing { + +class CliCall GRPC_FINAL { + public: + static void Call(std::shared_ptr channel, + const grpc::string& method, const grpc::string& request, + grpc::string* response); +}; + +} // namespace testing +} // namespace grpc + +#endif // GRPC_TEST_CPP_UTIL_CLI_CALL_H diff --git a/test/cpp/util/cli_call_test.cc b/test/cpp/util/cli_call_test.cc new file mode 100644 index 0000000000..91fc40c31f --- /dev/null +++ b/test/cpp/util/cli_call_test.cc @@ -0,0 +1,131 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "test/core/util/test_config.h" +#include "test/cpp/util/cli_call.h" +#include "test/cpp/util/echo.pb.h" +#include "src/cpp/server/thread_pool.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "test/core/util/port.h" +#include + +#include + +using grpc::cpp::test::util::EchoRequest; +using grpc::cpp::test::util::EchoResponse; + +namespace grpc { +namespace testing { + +class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service { + public: + Status Echo(ServerContext* context, const EchoRequest* request, + EchoResponse* response) GRPC_OVERRIDE { + response->set_message(request->message()); + return Status::OK; + } +}; + +class CliCallTest : public ::testing::Test { + protected: + CliCallTest() : thread_pool_(2) {} + + void SetUp() GRPC_OVERRIDE { + int port = grpc_pick_unused_port_or_die(); + server_address_ << "localhost:" << port; + // Setup server + ServerBuilder builder; + builder.AddListeningPort(server_address_.str(), + InsecureServerCredentials()); + builder.RegisterService(&service_); + builder.SetThreadPool(&thread_pool_); + server_ = builder.BuildAndStart(); + } + + void TearDown() GRPC_OVERRIDE { server_->Shutdown(); } + + void ResetStub() { + channel_ = CreateChannel(server_address_.str(), InsecureCredentials(), + ChannelArguments()); + stub_ = std::move(grpc::cpp::test::util::TestService::NewStub(channel_)); + } + + std::shared_ptr channel_; + std::unique_ptr stub_; + std::unique_ptr server_; + std::ostringstream server_address_; + TestServiceImpl service_; + ThreadPool thread_pool_; +}; + +// Send a rpc with a normal stub and then a CliCall. Verify they match. +TEST_F(CliCallTest, SimpleRpc) { + ResetStub(); + // Normal stub. + EchoRequest request; + EchoResponse response; + request.set_message("Hello"); + + ClientContext context; + Status s = stub_->Echo(&context, request, &response); + EXPECT_EQ(response.message(), request.message()); + EXPECT_TRUE(s.IsOk()); + + const grpc::string kMethod("/grpc.cpp.test.util.TestService/Echo"); + grpc::string request_bin, response_bin, expected_response_bin; + EXPECT_TRUE(request.SerializeToString(&request_bin)); + EXPECT_TRUE(response.SerializeToString(&expected_response_bin)); + CliCall::Call(channel_, kMethod, request_bin, &response_bin); + EXPECT_EQ(expected_response_bin, response_bin); +} + +} // namespace testing +} // namespace grpc + +int main(int argc, char** argv) { + grpc_test_init(argc, argv); + grpc_init(); + ::testing::InitGoogleTest(&argc, argv); + int result = RUN_ALL_TESTS(); + grpc_shutdown(); + return result; +} diff --git a/test/cpp/util/grpc_cli.cc b/test/cpp/util/grpc_cli.cc index 8e001cc0f5..f2271d9365 100644 --- a/test/cpp/util/grpc_cli.cc +++ b/test/cpp/util/grpc_cli.cc @@ -62,19 +62,13 @@ #include #include -#include +#include "test/cpp/util/cli_call.h" #include #include -#include #include #include -#include -#include -#include #include -#include -#include // In some distros, gflags is in the namespace google, and in some others, // in gflags. This hack is enabling us to find both. @@ -90,63 +84,6 @@ DEFINE_string(input_binary_file, "", DEFINE_string(output_binary_file, "output.bin", "Path to output file to write serialized response."); -void* tag(int i) { return (void*)(gpr_intptr) i; } - -void Call(std::shared_ptr channel, - const grpc::string& method) { - std::unique_ptr stub(new grpc::GenericStub(channel)); - grpc::ClientContext ctx; - grpc::CompletionQueue cq; - std::unique_ptr call( - stub->Call(&ctx, method, &cq, tag(1))); - void* got_tag; - bool ok; - cq.Next(&got_tag, &ok); - GPR_ASSERT(ok); - - std::ifstream input_file(FLAGS_input_binary_file, - std::ios::in | std::ios::binary); - std::stringstream input_stream; - input_stream << input_file.rdbuf(); - - gpr_slice s = gpr_slice_from_copied_string(input_stream.str().c_str()); - grpc::Slice req_slice(s, grpc::Slice::STEAL_REF); - grpc::ByteBuffer request(&req_slice, 1); - call->Write(request, tag(2)); - cq.Next(&got_tag, &ok); - GPR_ASSERT(ok); - call->WritesDone(tag(3)); - cq.Next(&got_tag, &ok); - GPR_ASSERT(ok); - grpc::ByteBuffer recv_buffer; - call->Read(&recv_buffer, tag(4)); - cq.Next(&got_tag, &ok); - if (!ok) { - std::cout << "Failed to read response." << std::endl; - return; - } - grpc::Status status; - call->Finish(&status, tag(5)); - cq.Next(&got_tag, &ok); - GPR_ASSERT(ok); - - if (status.IsOk()) { - std::cout << "RPC finished with OK status." << std::endl; - std::vector slices; - recv_buffer.Dump(&slices); - - std::ofstream output_file(FLAGS_output_binary_file, - std::ios::trunc | std::ios::binary); - for (size_t i = 0; i < slices.size(); i++) { - output_file.write(reinterpret_cast(slices[i].begin()), - slices[i].size()); - } - } else { - std::cout << "RPC finished with status code " << status.code() - << " details: " << status.details() << std::endl; - } -} - int main(int argc, char** argv) { grpc_init(); @@ -160,6 +97,7 @@ int main(int argc, char** argv) { << std::endl; } grpc::string server_address(argv[2]); + // TODO(yangg) basic check of method string grpc::string method(argv[3]); if (FLAGS_input_binary_file.empty()) { @@ -169,7 +107,10 @@ int main(int argc, char** argv) { } std::cout << "connecting to " << server_address << std::endl; - // TODO(yangg) basic check of method string + std::ifstream input_file(FLAGS_input_binary_file, + std::ios::in | std::ios::binary); + std::stringstream input_stream; + input_stream << input_file.rdbuf(); std::unique_ptr creds; if (!FLAGS_enable_ssl) { @@ -184,7 +125,13 @@ int main(int argc, char** argv) { std::shared_ptr channel = grpc::CreateChannel(server_address, creds, grpc::ChannelArguments()); - Call(channel, method); + grpc::string response; + grpc::testing::CliCall::Call(channel, method, input_stream.str(), &response); + if (!response.empty()) { + std::ofstream output_file(FLAGS_output_binary_file, + std::ios::trunc | std::ios::binary); + output_file << response; + } channel.reset(); grpc_shutdown(); diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json index 0150fd4a5d..eab07040e7 100644 --- a/tools/run_tests/tests.json +++ b/tools/run_tests/tests.json @@ -346,6 +346,11 @@ "language": "c++", "name": "channel_arguments_test" }, + { + "flaky": false, + "language": "c++", + "name": "cli_call_test" + }, { "flaky": false, "language": "c++", -- cgit v1.2.3 From 80df992f98238dafb279b91fa9936e9207bb0d03 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Fri, 27 Mar 2015 14:31:49 -0700 Subject: Added composer commands to PHP Dockerfiles --- tools/dockerfile/grpc_php/Dockerfile | 2 ++ tools/dockerfile/grpc_php_base/Dockerfile | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/dockerfile/grpc_php/Dockerfile b/tools/dockerfile/grpc_php/Dockerfile index e84455fc94..0b4819841d 100644 --- a/tools/dockerfile/grpc_php/Dockerfile +++ b/tools/dockerfile/grpc_php/Dockerfile @@ -46,4 +46,6 @@ RUN cd /var/local/git/grpc/src/php/ext/grpc \ && ./configure \ && make +RUN cd /var/local/git/grpc/src/php && composer install + RUN cd /var/local/git/grpc/src/php && ./bin/run_tests.sh \ No newline at end of file diff --git a/tools/dockerfile/grpc_php_base/Dockerfile b/tools/dockerfile/grpc_php_base/Dockerfile index c58cccba74..3ed9b49089 100644 --- a/tools/dockerfile/grpc_php_base/Dockerfile +++ b/tools/dockerfile/grpc_php_base/Dockerfile @@ -64,9 +64,12 @@ RUN apt-get update && apt-get install -y \ sqlite3 \ zlib1g-dev -# Install the version of PHP gRPC is tested against ENV DEBIAN_FRONTEND noniteractive +# Install composer +RUN curl -sS https://getcomposer.org/installer | php +RUN mv composer.phar /usr/local/bin/composer + # Download the patched PHP protobuf so that PHP gRPC clients can be generated # from proto3 schemas. RUN git clone https://github.com/murgatroid99/Protobuf-PHP.git /var/local/git/protobuf-php -- cgit v1.2.3 From 9ddc3da29fd0a5234b1ad318a85c912017cfbd91 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Fri, 27 Mar 2015 15:31:20 -0700 Subject: Removed redundant autoload require lines --- src/php/lib/Grpc/AbstractCall.php | 2 -- src/php/lib/Grpc/BaseStub.php | 1 - src/php/lib/Grpc/BidiStreamingCall.php | 1 - src/php/lib/Grpc/ClientStreamingCall.php | 1 - src/php/lib/Grpc/ServerStreamingCall.php | 2 -- src/php/lib/Grpc/UnaryCall.php | 2 -- 6 files changed, 9 deletions(-) diff --git a/src/php/lib/Grpc/AbstractCall.php b/src/php/lib/Grpc/AbstractCall.php index d7c3263040..d81df97067 100644 --- a/src/php/lib/Grpc/AbstractCall.php +++ b/src/php/lib/Grpc/AbstractCall.php @@ -33,8 +33,6 @@ */ namespace Grpc; -require_once realpath(dirname(__FILE__) . '/../../vendor/autoload.php'); - abstract class AbstractCall { protected $call; diff --git a/src/php/lib/Grpc/BaseStub.php b/src/php/lib/Grpc/BaseStub.php index 83e992ae70..fc83dace20 100755 --- a/src/php/lib/Grpc/BaseStub.php +++ b/src/php/lib/Grpc/BaseStub.php @@ -32,7 +32,6 @@ * */ namespace Grpc; -require_once realpath(dirname(__FILE__) . '/../../vendor/autoload.php'); /** * Base class for generated client stubs. Stub methods are expected to call diff --git a/src/php/lib/Grpc/BidiStreamingCall.php b/src/php/lib/Grpc/BidiStreamingCall.php index d45fd21510..454f7621ae 100644 --- a/src/php/lib/Grpc/BidiStreamingCall.php +++ b/src/php/lib/Grpc/BidiStreamingCall.php @@ -32,7 +32,6 @@ * */ namespace Grpc; -require_once realpath(dirname(__FILE__) . '/../../vendor/autoload.php'); /** * Represents an active call that allows for sending and recieving messages in diff --git a/src/php/lib/Grpc/ClientStreamingCall.php b/src/php/lib/Grpc/ClientStreamingCall.php index 17c85b4c2b..fa29037b42 100644 --- a/src/php/lib/Grpc/ClientStreamingCall.php +++ b/src/php/lib/Grpc/ClientStreamingCall.php @@ -32,7 +32,6 @@ * */ namespace Grpc; -require_once realpath(dirname(__FILE__) . '/../../vendor/autoload.php'); /** * Represents an active call that sends a stream of messages and then gets a diff --git a/src/php/lib/Grpc/ServerStreamingCall.php b/src/php/lib/Grpc/ServerStreamingCall.php index ac5e02eb53..574c1bb1e0 100644 --- a/src/php/lib/Grpc/ServerStreamingCall.php +++ b/src/php/lib/Grpc/ServerStreamingCall.php @@ -33,8 +33,6 @@ */ namespace Grpc; -require_once realpath(dirname(__FILE__) . '/../../vendor/autoload.php'); - /** * Represents an active call that sends a single message and then gets a stream * of reponses diff --git a/src/php/lib/Grpc/UnaryCall.php b/src/php/lib/Grpc/UnaryCall.php index 14c024085c..814d477697 100644 --- a/src/php/lib/Grpc/UnaryCall.php +++ b/src/php/lib/Grpc/UnaryCall.php @@ -33,8 +33,6 @@ */ namespace Grpc; -require_once realpath(dirname(__FILE__) . '/../../vendor/autoload.php'); - /** * Represents an active call that sends a single message and then gets a single * response. -- cgit v1.2.3 From f492b16d48b48ec45adb8dfce41d0756afeb3e96 Mon Sep 17 00:00:00 2001 From: Nathaniel Manista Date: Mon, 30 Mar 2015 18:14:52 +0000 Subject: Unify early_adopter construction functions It was awkward for the generated code to call an API that offered both insecure_server and secure_server as well as insecure_stub and secure_stub. With this change there is just a single server function and a single stub function and security is decided based on arguments passed. --- src/compiler/python_generator.cc | 19 +++-- .../interop/interop/_insecure_interop_test.py | 4 +- src/python/interop/interop/_secure_interop_test.py | 9 +-- src/python/interop/interop/client.py | 8 +-- src/python/interop/interop/server.py | 8 +-- .../src/grpc/early_adopter/implementations.py | 80 +++++----------------- .../src/grpc/early_adopter/implementations_test.py | 4 +- test/compiler/python_plugin_test.py | 2 +- 8 files changed, 46 insertions(+), 88 deletions(-) diff --git a/src/compiler/python_generator.cc b/src/compiler/python_generator.cc index 748417e477..d32213f7d5 100644 --- a/src/compiler/python_generator.cc +++ b/src/compiler/python_generator.cc @@ -271,7 +271,7 @@ bool GetModuleAndMessagePath(const Descriptor* type, bool PrintServerFactory(const grpc::string& package_qualified_service_name, const ServiceDescriptor* service, Printer* out) { out->Print("def early_adopter_create_$Service$_server(servicer, port, " - "root_certificates, key_chain_pairs):\n", + "private_key=None, certificate_chain=None):\n", "Service", service->name()); { IndentScope raii_create_server_indent(out); @@ -339,10 +339,10 @@ bool PrintServerFactory(const grpc::string& package_qualified_service_name, } out->Print("}\n"); out->Print( - "return implementations.secure_server(" + "return implementations.server(" "\"$PackageQualifiedServiceName$\"," - " method_service_descriptions, port, root_certificates," - " key_chain_pairs)\n", + " method_service_descriptions, port, private_key=private_key," + " certificate_chain=certificate_chain)\n", "PackageQualifiedServiceName", package_qualified_service_name); } return true; @@ -353,7 +353,9 @@ bool PrintStubFactory(const grpc::string& package_qualified_service_name, map dict = ListToDict({ "Service", service->name(), }); - out->Print(dict, "def early_adopter_create_$Service$_stub(host, port):\n"); + out->Print(dict, "def early_adopter_create_$Service$_stub(host, port," + " secure=False, root_certificates=None, private_key=None," + " certificate_chain=None, server_host_override=None):\n"); { IndentScope raii_create_server_indent(out); map method_description_constructors; @@ -419,9 +421,12 @@ bool PrintStubFactory(const grpc::string& package_qualified_service_name, } out->Print("}\n"); out->Print( - "return implementations.insecure_stub(" + "return implementations.stub(" "\"$PackageQualifiedServiceName$\"," - " method_invocation_descriptions, host, port)\n", + " method_invocation_descriptions, host, port, secure=secure," + " root_certificates=root_certificates, private_key=private_key," + " certificate_chain=certificate_chain," + " server_host_override=server_host_override)\n", "PackageQualifiedServiceName", package_qualified_service_name); } return true; diff --git a/src/python/interop/interop/_insecure_interop_test.py b/src/python/interop/interop/_insecure_interop_test.py index e4ddff1a0b..42e7a4d5c4 100644 --- a/src/python/interop/interop/_insecure_interop_test.py +++ b/src/python/interop/interop/_insecure_interop_test.py @@ -42,11 +42,11 @@ class InsecureInteropTest( unittest.TestCase): def setUp(self): - self.server = implementations.insecure_server( + self.server = implementations.server( methods.SERVICE_NAME, methods.SERVER_METHODS, 0) self.server.start() port = self.server.port() - self.stub = implementations.insecure_stub( + self.stub = implementations.stub( methods.SERVICE_NAME, methods.CLIENT_METHODS, 'localhost', port) def tearDown(self): diff --git a/src/python/interop/interop/_secure_interop_test.py b/src/python/interop/interop/_secure_interop_test.py index 214212dca4..27e76315b6 100644 --- a/src/python/interop/interop/_secure_interop_test.py +++ b/src/python/interop/interop/_secure_interop_test.py @@ -45,14 +45,15 @@ class SecureInteropTest( unittest.TestCase): def setUp(self): - self.server = implementations.secure_server( + self.server = implementations.server( methods.SERVICE_NAME, methods.SERVER_METHODS, 0, - resources.private_key(), resources.certificate_chain()) + private_key=resources.private_key(), + certificate_chain=resources.certificate_chain()) self.server.start() port = self.server.port() - self.stub = implementations.secure_stub( + self.stub = implementations.stub( methods.SERVICE_NAME, methods.CLIENT_METHODS, 'localhost', port, - resources.test_root_certificates(), None, None, + secure=True, root_certificates=resources.test_root_certificates(), server_host_override=_SERVER_HOST_OVERRIDE) def tearDown(self): diff --git a/src/python/interop/interop/client.py b/src/python/interop/interop/client.py index fb7dfb5729..85a0dcd998 100644 --- a/src/python/interop/interop/client.py +++ b/src/python/interop/interop/client.py @@ -66,14 +66,14 @@ def _stub(args): else: root_certificates = resources.prod_root_certificates() - stub = implementations.secure_stub( + stub = implementations.stub( methods.SERVICE_NAME, methods.CLIENT_METHODS, args.server_host, - args.server_port, root_certificates, None, None, + args.server_port, secure=True, root_certificates=root_certificates, server_host_override=args.server_host_override) else: - stub = implementations.insecure_stub( + stub = implementations.stub( methods.SERVICE_NAME, methods.CLIENT_METHODS, args.server_host, - args.server_port) + args.server_port, secure=False) return stub diff --git a/src/python/interop/interop/server.py b/src/python/interop/interop/server.py index 5791203743..a67d412038 100644 --- a/src/python/interop/interop/server.py +++ b/src/python/interop/interop/server.py @@ -53,11 +53,11 @@ def serve(): if args.use_tls: private_key = resources.private_key() certificate_chain = resources.certificate_chain() - server = implementations.secure_server( - methods.SERVICE_NAME, methods.SERVER_METHODS, args.port, private_key, - certificate_chain) + server = implementations.server( + methods.SERVICE_NAME, methods.SERVER_METHODS, args.port, + private_key=private_key, certificate_chain=certificate_chain) else: - server = implementations.insecure_server( + server = implementations.server( methods.SERVICE_NAME, methods.SERVER_METHODS, args.port) server.start() diff --git a/src/python/src/grpc/early_adopter/implementations.py b/src/python/src/grpc/early_adopter/implementations.py index cc0b8ec9e8..7d3d29f06c 100644 --- a/src/python/src/grpc/early_adopter/implementations.py +++ b/src/python/src/grpc/early_adopter/implementations.py @@ -188,43 +188,10 @@ class _Stub(interfaces.Stub): raise AttributeError(attr) -def _build_stub( - service_name, methods, host, port, secure, root_certificates, private_key, - certificate_chain, server_host_override=None): - breakdown = _face_utilities.break_down_invocation(service_name, methods) - return _Stub( - breakdown, host, port, secure, root_certificates, private_key, - certificate_chain, server_host_override=server_host_override) - - -def _build_server(service_name, methods, port, private_key, certificate_chain): - breakdown = _face_utilities.break_down_service(service_name, methods) - return _Server(breakdown, port, private_key, certificate_chain) - - -def insecure_stub(service_name, methods, host, port): - """Constructs an insecure interfaces.Stub. - - Args: - service_name: The package-qualified full name of the service. - methods: A dictionary from RPC method name to - interfaces.RpcMethodInvocationDescription describing the RPCs to be - supported by the created stub. The RPC method names in the dictionary are - not qualified by the service name or decorated in any other way. - host: The host to which to connect for RPC service. - port: The port to which to connect for RPC service. - - Returns: - An interfaces.Stub affording RPC invocation. - """ - return _build_stub( - service_name, methods, host, port, False, None, None, None) - - -def secure_stub( - service_name, methods, host, port, root_certificates, private_key, - certificate_chain, server_host_override=None): - """Constructs an insecure interfaces.Stub. +def stub( + service_name, methods, host, port, secure=False, root_certificates=None, + private_key=None, certificate_chain=None, server_host_override=None): + """Constructs an interfaces.Stub. Args: service_name: The package-qualified full name of the service. @@ -234,6 +201,7 @@ def secure_stub( not qualified by the service name or decorated in any other way. host: The host to which to connect for RPC service. port: The port to which to connect for RPC service. + secure: Whether or not to construct the stub with a secure connection. root_certificates: The PEM-encoded root certificates or None to ask for them to be retrieved from a default location. private_key: The PEM-encoded private key to use or None if no private key @@ -246,32 +214,15 @@ def secure_stub( Returns: An interfaces.Stub affording RPC invocation. """ - return _build_stub( - service_name, methods, host, port, True, root_certificates, private_key, + breakdown = _face_utilities.break_down_invocation(service_name, methods) + return _Stub( + breakdown, host, port, secure, root_certificates, private_key, certificate_chain, server_host_override=server_host_override) -def insecure_server(service_name, methods, port): - """Constructs an insecure interfaces.Server. - - Args: - service_name: The package-qualified full name of the service. - methods: A dictionary from RPC method name to - interfaces.RpcMethodServiceDescription describing the RPCs to - be serviced by the created server. The RPC method names in the dictionary - are not qualified by the service name or decorated in any other way. - port: The desired port on which to serve or zero to ask for a port to - be automatically selected. - - Returns: - An interfaces.Server that will run with no security and - service unsecured raw requests. - """ - return _build_server(service_name, methods, port, None, None) - - -def secure_server(service_name, methods, port, private_key, certificate_chain): - """Constructs a secure interfaces.Server. +def server( + service_name, methods, port, private_key=None, certificate_chain=None): + """Constructs an interfaces.Server. Args: service_name: The package-qualified full name of the service. @@ -281,11 +232,12 @@ def secure_server(service_name, methods, port, private_key, certificate_chain): are not qualified by the service name or decorated in any other way. port: The port on which to serve or zero to ask for a port to be automatically selected. - private_key: A pem-encoded private key. - certificate_chain: A pem-encoded certificate chain. + private_key: A pem-encoded private key, or None for an insecure server. + certificate_chain: A pem-encoded certificate chain, or None for an insecure + server. Returns: An interfaces.Server that will serve secure traffic. """ - return _build_server( - service_name, methods, port, private_key, certificate_chain) + breakdown = _face_utilities.break_down_service(service_name, methods) + return _Server(breakdown, port, private_key, certificate_chain) diff --git a/src/python/src/grpc/early_adopter/implementations_test.py b/src/python/src/grpc/early_adopter/implementations_test.py index ae4adad90f..32b974724c 100644 --- a/src/python/src/grpc/early_adopter/implementations_test.py +++ b/src/python/src/grpc/early_adopter/implementations_test.py @@ -106,11 +106,11 @@ _TIMEOUT = 3 class EarlyAdopterImplementationsTest(unittest.TestCase): def setUp(self): - self.server = implementations.insecure_server( + self.server = implementations.server( SERVICE_NAME, _SERVICE_DESCRIPTIONS, 0) self.server.start() port = self.server.port() - self.stub = implementations.insecure_stub( + self.stub = implementations.stub( SERVICE_NAME, _INVOCATION_DESCRIPTIONS, 'localhost', port) def tearDown(self): diff --git a/test/compiler/python_plugin_test.py b/test/compiler/python_plugin_test.py index 3d2f117b0d..ad3bebac30 100644 --- a/test/compiler/python_plugin_test.py +++ b/test/compiler/python_plugin_test.py @@ -177,7 +177,7 @@ def _CreateService(test_pb2, delay): servicer = Servicer() server = getattr( - test_pb2, SERVER_FACTORY_IDENTIFIER)(servicer, 0, None, None) + test_pb2, SERVER_FACTORY_IDENTIFIER)(servicer, 0) with server: port = server.port() stub = getattr(test_pb2, STUB_FACTORY_IDENTIFIER)('localhost', port) -- cgit v1.2.3 From 3781a634b03e6e0a634f924e4fab3e86c294dca5 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Mon, 30 Mar 2015 11:47:45 -0700 Subject: Changed PHP version to 5.5 in Dockerfiles --- tools/dockerfile/grpc_php_base/Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/dockerfile/grpc_php_base/Dockerfile b/tools/dockerfile/grpc_php_base/Dockerfile index 3ed9b49089..c49d3fef66 100644 --- a/tools/dockerfile/grpc_php_base/Dockerfile +++ b/tools/dockerfile/grpc_php_base/Dockerfile @@ -32,6 +32,10 @@ # Includes PHP installation dependencies, things that are unlikely to vary. FROM grpc/base +RUN echo "deb http://packages.dotdeb.org wheezy-php55 all" >> /etc/apt/sources.list.d/dotdeb.list +RUN echo "deb-src http://packages.dotdeb.org wheezy-php55 all" >> /etc/apt/sources.list.d/dotdeb.list +RUN wget http://www.dotdeb.org/dotdeb.gpg -O- |apt-key add - + # Install RVM dependencies and other packages RUN apt-get update && apt-get install -y \ autoconf \ -- cgit v1.2.3 From 0c4b0ddcc573f2260c955f78805a9e798ea2c226 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Mon, 30 Mar 2015 13:08:34 -0700 Subject: Add tests with delayed cancellation from client and server --- test/cpp/end2end/end2end_test.cc | 70 +++++++++++++++++++++++++++++++++++++++- test/cpp/util/messages.proto | 2 ++ 2 files changed, 71 insertions(+), 1 deletion(-) diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index e2649c2826..0d5db046df 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -83,10 +83,30 @@ void MaybeEchoDeadline(ServerContext* context, const EchoRequest* request, class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service { public: + TestServiceImpl() : signal_client_(false) {} + Status Echo(ServerContext* context, const EchoRequest* request, EchoResponse* response) GRPC_OVERRIDE { response->set_message(request->message()); MaybeEchoDeadline(context, request, response); + if (request->has_param() && request->param().client_cancel_after_us()) { + { + std::unique_lock lock(mu_); + signal_client_ = true; + } + while (!context->IsCancelled()) { + std::this_thread::sleep_for(std::chrono::microseconds( + request->param().client_cancel_after_us())); + } + return Status::Cancelled; + } else if (request->has_param() && + request->param().server_cancel_after_us()) { + std::this_thread::sleep_for( + std::chrono::microseconds(request->param().server_cancel_after_us())); + return Status::Cancelled; + } else { + EXPECT_FALSE(context->IsCancelled()); + } return Status::OK; } @@ -130,6 +150,15 @@ class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service { } return Status::OK; } + + bool signal_client() { + std::unique_lock lock(mu_); + return signal_client_; + } + + private: + bool signal_client_; + std::mutex mu_; }; class TestServiceImplDupPkg @@ -151,7 +180,8 @@ class End2endTest : public ::testing::Test { server_address_ << "localhost:" << port; // Setup server ServerBuilder builder; - builder.AddListeningPort(server_address_.str(), InsecureServerCredentials()); + builder.AddListeningPort(server_address_.str(), + InsecureServerCredentials()); builder.RegisterService(&service_); builder.RegisterService(&dup_pkg_service_); builder.SetThreadPool(&thread_pool_); @@ -423,6 +453,44 @@ TEST_F(End2endTest, BadCredentials) { EXPECT_EQ("Rpc sent on a lame channel.", s.details()); } +void CancelRpc(ClientContext* context, int delay_us, TestServiceImpl* service) { + std::this_thread::sleep_for(std::chrono::microseconds(delay_us)); + while (!service->signal_client()) { + } + context->TryCancel(); +} + +// Client cancels rpc after 10ms +TEST_F(End2endTest, ClientCancelsRpc) { + ResetStub(); + EchoRequest request; + EchoResponse response; + request.set_message("Hello"); + const int kCancelDelayUs = 10 * 1000; + request.mutable_param()->set_client_cancel_after_us(kCancelDelayUs); + + ClientContext context; + std::thread cancel_thread(CancelRpc, &context, kCancelDelayUs, &service_); + Status s = stub_->Echo(&context, request, &response); + cancel_thread.join(); + EXPECT_EQ(StatusCode::CANCELLED, s.code()); + EXPECT_TRUE(s.details().empty()); +} + +// Server cancels rpc after 1ms +TEST_F(End2endTest, ServerCancelsRpc) { + ResetStub(); + EchoRequest request; + EchoResponse response; + request.set_message("Hello"); + request.mutable_param()->set_server_cancel_after_us(1000); + + ClientContext context; + Status s = stub_->Echo(&context, request, &response); + EXPECT_EQ(StatusCode::CANCELLED, s.code()); + EXPECT_TRUE(s.details().empty()); +} + } // namespace testing } // namespace grpc diff --git a/test/cpp/util/messages.proto b/test/cpp/util/messages.proto index 9c27f6869e..a79bce1f30 100644 --- a/test/cpp/util/messages.proto +++ b/test/cpp/util/messages.proto @@ -34,6 +34,8 @@ package grpc.cpp.test.util; message RequestParams { optional bool echo_deadline = 1; + optional int32 client_cancel_after_us = 2; + optional int32 server_cancel_after_us = 3; } message EchoRequest { -- cgit v1.2.3 From abd364d1d04d11ee4645fb4264fdb41fd00409c7 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Mon, 30 Mar 2015 14:29:14 -0700 Subject: Minor fix to test case switch statement, to fix a false negative --- src/php/tests/interop/interop_client.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/php/tests/interop/interop_client.php b/src/php/tests/interop/interop_client.php index 873fa00b82..6f81bfa6cd 100755 --- a/src/php/tests/interop/interop_client.php +++ b/src/php/tests/interop/interop_client.php @@ -241,6 +241,7 @@ switch($args['test_case']) { break; case 'cancel_after_first_response': cancelAfterFirstResponse($stub); + break; default: exit(1); } -- cgit v1.2.3 From f6edf686ead6c76965c5f68375186eaef06c77d8 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Tue, 31 Mar 2015 05:17:34 +0200 Subject: Early support for Bazel. --- BUILD | 565 +++++++++++++++++++++++++++++++++++++++++++++++ templates/BUILD.template | 69 ++++++ 2 files changed, 634 insertions(+) create mode 100644 BUILD create mode 100644 templates/BUILD.template diff --git a/BUILD b/BUILD new file mode 100644 index 0000000000..e5822c7442 --- /dev/null +++ b/BUILD @@ -0,0 +1,565 @@ +# GRPC Bazel BUILD file. +# This currently builds C and C++ code. + +# 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. + +licenses(["notice"]) # 3-clause BSD + + + +cc_library( + name = "gpr", + srcs = [ + "src/core/support/env.h", + "src/core/support/file.h", + "src/core/support/murmur_hash.h", + "src/core/support/string.h", + "src/core/support/string_win32.h", + "src/core/support/thd_internal.h", + "src/core/support/alloc.c", + "src/core/support/cancellable.c", + "src/core/support/cmdline.c", + "src/core/support/cpu_iphone.c", + "src/core/support/cpu_linux.c", + "src/core/support/cpu_posix.c", + "src/core/support/cpu_windows.c", + "src/core/support/env_linux.c", + "src/core/support/env_posix.c", + "src/core/support/env_win32.c", + "src/core/support/file.c", + "src/core/support/file_posix.c", + "src/core/support/file_win32.c", + "src/core/support/histogram.c", + "src/core/support/host_port.c", + "src/core/support/log.c", + "src/core/support/log_android.c", + "src/core/support/log_linux.c", + "src/core/support/log_posix.c", + "src/core/support/log_win32.c", + "src/core/support/murmur_hash.c", + "src/core/support/slice.c", + "src/core/support/slice_buffer.c", + "src/core/support/string.c", + "src/core/support/string_posix.c", + "src/core/support/string_win32.c", + "src/core/support/sync.c", + "src/core/support/sync_posix.c", + "src/core/support/sync_win32.c", + "src/core/support/thd_posix.c", + "src/core/support/thd_win32.c", + "src/core/support/time.c", + "src/core/support/time_posix.c", + "src/core/support/time_win32.c", + ], + hdrs = [ + "include/grpc/support/alloc.h", + "include/grpc/support/atm.h", + "include/grpc/support/atm_gcc_atomic.h", + "include/grpc/support/atm_gcc_sync.h", + "include/grpc/support/atm_win32.h", + "include/grpc/support/cancellable_platform.h", + "include/grpc/support/cmdline.h", + "include/grpc/support/cpu.h", + "include/grpc/support/histogram.h", + "include/grpc/support/host_port.h", + "include/grpc/support/log.h", + "include/grpc/support/log_win32.h", + "include/grpc/support/port_platform.h", + "include/grpc/support/slice.h", + "include/grpc/support/slice_buffer.h", + "include/grpc/support/sync.h", + "include/grpc/support/sync_generic.h", + "include/grpc/support/sync_posix.h", + "include/grpc/support/sync_win32.h", + "include/grpc/support/thd.h", + "include/grpc/support/time.h", + "include/grpc/support/useful.h", + ], + includes = [ + "include", + ".", + ], + deps = [ + ], +) + + + + +cc_library( + name = "grpc", + srcs = [ + "src/core/httpcli/format_request.h", + "src/core/httpcli/httpcli.h", + "src/core/httpcli/httpcli_security_context.h", + "src/core/httpcli/parser.h", + "src/core/security/auth.h", + "src/core/security/base64.h", + "src/core/security/credentials.h", + "src/core/security/json_token.h", + "src/core/security/secure_endpoint.h", + "src/core/security/secure_transport_setup.h", + "src/core/security/security_context.h", + "src/core/tsi/fake_transport_security.h", + "src/core/tsi/ssl_transport_security.h", + "src/core/tsi/transport_security.h", + "src/core/tsi/transport_security_interface.h", + "src/core/channel/census_filter.h", + "src/core/channel/channel_args.h", + "src/core/channel/channel_stack.h", + "src/core/channel/child_channel.h", + "src/core/channel/client_channel.h", + "src/core/channel/client_setup.h", + "src/core/channel/connected_channel.h", + "src/core/channel/http_client_filter.h", + "src/core/channel/http_filter.h", + "src/core/channel/http_server_filter.h", + "src/core/channel/metadata_buffer.h", + "src/core/channel/noop_filter.h", + "src/core/compression/algorithm.h", + "src/core/compression/message_compress.h", + "src/core/debug/trace.h", + "src/core/iomgr/alarm.h", + "src/core/iomgr/alarm_heap.h", + "src/core/iomgr/alarm_internal.h", + "src/core/iomgr/endpoint.h", + "src/core/iomgr/endpoint_pair.h", + "src/core/iomgr/fd_posix.h", + "src/core/iomgr/iocp_windows.h", + "src/core/iomgr/iomgr.h", + "src/core/iomgr/iomgr_internal.h", + "src/core/iomgr/iomgr_posix.h", + "src/core/iomgr/pollset.h", + "src/core/iomgr/pollset_kick.h", + "src/core/iomgr/pollset_kick_posix.h", + "src/core/iomgr/pollset_kick_windows.h", + "src/core/iomgr/pollset_posix.h", + "src/core/iomgr/pollset_windows.h", + "src/core/iomgr/resolve_address.h", + "src/core/iomgr/sockaddr.h", + "src/core/iomgr/sockaddr_posix.h", + "src/core/iomgr/sockaddr_utils.h", + "src/core/iomgr/sockaddr_win32.h", + "src/core/iomgr/socket_utils_posix.h", + "src/core/iomgr/socket_windows.h", + "src/core/iomgr/tcp_client.h", + "src/core/iomgr/tcp_posix.h", + "src/core/iomgr/tcp_server.h", + "src/core/iomgr/tcp_windows.h", + "src/core/iomgr/time_averaged_stats.h", + "src/core/iomgr/wakeup_fd_pipe.h", + "src/core/iomgr/wakeup_fd_posix.h", + "src/core/json/json.h", + "src/core/json/json_common.h", + "src/core/json/json_reader.h", + "src/core/json/json_writer.h", + "src/core/statistics/census_interface.h", + "src/core/statistics/census_log.h", + "src/core/statistics/census_rpc_stats.h", + "src/core/statistics/census_tracing.h", + "src/core/statistics/hash_table.h", + "src/core/statistics/window_stats.h", + "src/core/surface/byte_buffer_queue.h", + "src/core/surface/call.h", + "src/core/surface/channel.h", + "src/core/surface/client.h", + "src/core/surface/completion_queue.h", + "src/core/surface/event_string.h", + "src/core/surface/init.h", + "src/core/surface/server.h", + "src/core/surface/surface_trace.h", + "src/core/transport/chttp2/alpn.h", + "src/core/transport/chttp2/bin_encoder.h", + "src/core/transport/chttp2/frame.h", + "src/core/transport/chttp2/frame_data.h", + "src/core/transport/chttp2/frame_goaway.h", + "src/core/transport/chttp2/frame_ping.h", + "src/core/transport/chttp2/frame_rst_stream.h", + "src/core/transport/chttp2/frame_settings.h", + "src/core/transport/chttp2/frame_window_update.h", + "src/core/transport/chttp2/hpack_parser.h", + "src/core/transport/chttp2/hpack_table.h", + "src/core/transport/chttp2/http2_errors.h", + "src/core/transport/chttp2/huffsyms.h", + "src/core/transport/chttp2/status_conversion.h", + "src/core/transport/chttp2/stream_encoder.h", + "src/core/transport/chttp2/stream_map.h", + "src/core/transport/chttp2/timeout_encoding.h", + "src/core/transport/chttp2/varint.h", + "src/core/transport/chttp2_transport.h", + "src/core/transport/metadata.h", + "src/core/transport/stream_op.h", + "src/core/transport/transport.h", + "src/core/transport/transport_impl.h", + "src/core/httpcli/format_request.c", + "src/core/httpcli/httpcli.c", + "src/core/httpcli/httpcli_security_context.c", + "src/core/httpcli/parser.c", + "src/core/security/auth.c", + "src/core/security/base64.c", + "src/core/security/credentials.c", + "src/core/security/credentials_posix.c", + "src/core/security/credentials_win32.c", + "src/core/security/factories.c", + "src/core/security/google_default_credentials.c", + "src/core/security/json_token.c", + "src/core/security/secure_endpoint.c", + "src/core/security/secure_transport_setup.c", + "src/core/security/security_context.c", + "src/core/security/server_secure_chttp2.c", + "src/core/surface/init_secure.c", + "src/core/surface/secure_channel_create.c", + "src/core/tsi/fake_transport_security.c", + "src/core/tsi/ssl_transport_security.c", + "src/core/tsi/transport_security.c", + "src/core/channel/call_op_string.c", + "src/core/channel/census_filter.c", + "src/core/channel/channel_args.c", + "src/core/channel/channel_stack.c", + "src/core/channel/child_channel.c", + "src/core/channel/client_channel.c", + "src/core/channel/client_setup.c", + "src/core/channel/connected_channel.c", + "src/core/channel/http_client_filter.c", + "src/core/channel/http_filter.c", + "src/core/channel/http_server_filter.c", + "src/core/channel/metadata_buffer.c", + "src/core/channel/noop_filter.c", + "src/core/compression/algorithm.c", + "src/core/compression/message_compress.c", + "src/core/debug/trace.c", + "src/core/iomgr/alarm.c", + "src/core/iomgr/alarm_heap.c", + "src/core/iomgr/endpoint.c", + "src/core/iomgr/endpoint_pair_posix.c", + "src/core/iomgr/fd_posix.c", + "src/core/iomgr/iocp_windows.c", + "src/core/iomgr/iomgr.c", + "src/core/iomgr/iomgr_posix.c", + "src/core/iomgr/iomgr_windows.c", + "src/core/iomgr/pollset_kick.c", + "src/core/iomgr/pollset_multipoller_with_epoll.c", + "src/core/iomgr/pollset_multipoller_with_poll_posix.c", + "src/core/iomgr/pollset_posix.c", + "src/core/iomgr/pollset_windows.c", + "src/core/iomgr/resolve_address_posix.c", + "src/core/iomgr/resolve_address_windows.c", + "src/core/iomgr/sockaddr_utils.c", + "src/core/iomgr/socket_utils_common_posix.c", + "src/core/iomgr/socket_utils_linux.c", + "src/core/iomgr/socket_utils_posix.c", + "src/core/iomgr/socket_windows.c", + "src/core/iomgr/tcp_client_posix.c", + "src/core/iomgr/tcp_client_windows.c", + "src/core/iomgr/tcp_posix.c", + "src/core/iomgr/tcp_server_posix.c", + "src/core/iomgr/tcp_server_windows.c", + "src/core/iomgr/tcp_windows.c", + "src/core/iomgr/time_averaged_stats.c", + "src/core/iomgr/wakeup_fd_eventfd.c", + "src/core/iomgr/wakeup_fd_nospecial.c", + "src/core/iomgr/wakeup_fd_pipe.c", + "src/core/iomgr/wakeup_fd_posix.c", + "src/core/json/json.c", + "src/core/json/json_reader.c", + "src/core/json/json_string.c", + "src/core/json/json_writer.c", + "src/core/statistics/census_init.c", + "src/core/statistics/census_log.c", + "src/core/statistics/census_rpc_stats.c", + "src/core/statistics/census_tracing.c", + "src/core/statistics/hash_table.c", + "src/core/statistics/window_stats.c", + "src/core/surface/byte_buffer.c", + "src/core/surface/byte_buffer_queue.c", + "src/core/surface/byte_buffer_reader.c", + "src/core/surface/call.c", + "src/core/surface/call_details.c", + "src/core/surface/call_log_batch.c", + "src/core/surface/channel.c", + "src/core/surface/channel_create.c", + "src/core/surface/client.c", + "src/core/surface/completion_queue.c", + "src/core/surface/event_string.c", + "src/core/surface/init.c", + "src/core/surface/lame_client.c", + "src/core/surface/metadata_array.c", + "src/core/surface/server.c", + "src/core/surface/server_chttp2.c", + "src/core/surface/server_create.c", + "src/core/surface/surface_trace.c", + "src/core/transport/chttp2/alpn.c", + "src/core/transport/chttp2/bin_encoder.c", + "src/core/transport/chttp2/frame_data.c", + "src/core/transport/chttp2/frame_goaway.c", + "src/core/transport/chttp2/frame_ping.c", + "src/core/transport/chttp2/frame_rst_stream.c", + "src/core/transport/chttp2/frame_settings.c", + "src/core/transport/chttp2/frame_window_update.c", + "src/core/transport/chttp2/hpack_parser.c", + "src/core/transport/chttp2/hpack_table.c", + "src/core/transport/chttp2/huffsyms.c", + "src/core/transport/chttp2/status_conversion.c", + "src/core/transport/chttp2/stream_encoder.c", + "src/core/transport/chttp2/stream_map.c", + "src/core/transport/chttp2/timeout_encoding.c", + "src/core/transport/chttp2/varint.c", + "src/core/transport/chttp2_transport.c", + "src/core/transport/metadata.c", + "src/core/transport/stream_op.c", + "src/core/transport/transport.c", + ], + hdrs = [ + "include/grpc/grpc_security.h", + "include/grpc/byte_buffer.h", + "include/grpc/byte_buffer_reader.h", + "include/grpc/grpc.h", + "include/grpc/grpc_http.h", + "include/grpc/status.h", + ], + includes = [ + "include", + ".", + ], + deps = [ + ":gpr", + ], +) + + + + +cc_library( + name = "grpc_unsecure", + srcs = [ + "src/core/channel/census_filter.h", + "src/core/channel/channel_args.h", + "src/core/channel/channel_stack.h", + "src/core/channel/child_channel.h", + "src/core/channel/client_channel.h", + "src/core/channel/client_setup.h", + "src/core/channel/connected_channel.h", + "src/core/channel/http_client_filter.h", + "src/core/channel/http_filter.h", + "src/core/channel/http_server_filter.h", + "src/core/channel/metadata_buffer.h", + "src/core/channel/noop_filter.h", + "src/core/compression/algorithm.h", + "src/core/compression/message_compress.h", + "src/core/debug/trace.h", + "src/core/iomgr/alarm.h", + "src/core/iomgr/alarm_heap.h", + "src/core/iomgr/alarm_internal.h", + "src/core/iomgr/endpoint.h", + "src/core/iomgr/endpoint_pair.h", + "src/core/iomgr/fd_posix.h", + "src/core/iomgr/iocp_windows.h", + "src/core/iomgr/iomgr.h", + "src/core/iomgr/iomgr_internal.h", + "src/core/iomgr/iomgr_posix.h", + "src/core/iomgr/pollset.h", + "src/core/iomgr/pollset_kick.h", + "src/core/iomgr/pollset_kick_posix.h", + "src/core/iomgr/pollset_kick_windows.h", + "src/core/iomgr/pollset_posix.h", + "src/core/iomgr/pollset_windows.h", + "src/core/iomgr/resolve_address.h", + "src/core/iomgr/sockaddr.h", + "src/core/iomgr/sockaddr_posix.h", + "src/core/iomgr/sockaddr_utils.h", + "src/core/iomgr/sockaddr_win32.h", + "src/core/iomgr/socket_utils_posix.h", + "src/core/iomgr/socket_windows.h", + "src/core/iomgr/tcp_client.h", + "src/core/iomgr/tcp_posix.h", + "src/core/iomgr/tcp_server.h", + "src/core/iomgr/tcp_windows.h", + "src/core/iomgr/time_averaged_stats.h", + "src/core/iomgr/wakeup_fd_pipe.h", + "src/core/iomgr/wakeup_fd_posix.h", + "src/core/json/json.h", + "src/core/json/json_common.h", + "src/core/json/json_reader.h", + "src/core/json/json_writer.h", + "src/core/statistics/census_interface.h", + "src/core/statistics/census_log.h", + "src/core/statistics/census_rpc_stats.h", + "src/core/statistics/census_tracing.h", + "src/core/statistics/hash_table.h", + "src/core/statistics/window_stats.h", + "src/core/surface/byte_buffer_queue.h", + "src/core/surface/call.h", + "src/core/surface/channel.h", + "src/core/surface/client.h", + "src/core/surface/completion_queue.h", + "src/core/surface/event_string.h", + "src/core/surface/init.h", + "src/core/surface/server.h", + "src/core/surface/surface_trace.h", + "src/core/transport/chttp2/alpn.h", + "src/core/transport/chttp2/bin_encoder.h", + "src/core/transport/chttp2/frame.h", + "src/core/transport/chttp2/frame_data.h", + "src/core/transport/chttp2/frame_goaway.h", + "src/core/transport/chttp2/frame_ping.h", + "src/core/transport/chttp2/frame_rst_stream.h", + "src/core/transport/chttp2/frame_settings.h", + "src/core/transport/chttp2/frame_window_update.h", + "src/core/transport/chttp2/hpack_parser.h", + "src/core/transport/chttp2/hpack_table.h", + "src/core/transport/chttp2/http2_errors.h", + "src/core/transport/chttp2/huffsyms.h", + "src/core/transport/chttp2/status_conversion.h", + "src/core/transport/chttp2/stream_encoder.h", + "src/core/transport/chttp2/stream_map.h", + "src/core/transport/chttp2/timeout_encoding.h", + "src/core/transport/chttp2/varint.h", + "src/core/transport/chttp2_transport.h", + "src/core/transport/metadata.h", + "src/core/transport/stream_op.h", + "src/core/transport/transport.h", + "src/core/transport/transport_impl.h", + "src/core/surface/init_unsecure.c", + "src/core/channel/call_op_string.c", + "src/core/channel/census_filter.c", + "src/core/channel/channel_args.c", + "src/core/channel/channel_stack.c", + "src/core/channel/child_channel.c", + "src/core/channel/client_channel.c", + "src/core/channel/client_setup.c", + "src/core/channel/connected_channel.c", + "src/core/channel/http_client_filter.c", + "src/core/channel/http_filter.c", + "src/core/channel/http_server_filter.c", + "src/core/channel/metadata_buffer.c", + "src/core/channel/noop_filter.c", + "src/core/compression/algorithm.c", + "src/core/compression/message_compress.c", + "src/core/debug/trace.c", + "src/core/iomgr/alarm.c", + "src/core/iomgr/alarm_heap.c", + "src/core/iomgr/endpoint.c", + "src/core/iomgr/endpoint_pair_posix.c", + "src/core/iomgr/fd_posix.c", + "src/core/iomgr/iocp_windows.c", + "src/core/iomgr/iomgr.c", + "src/core/iomgr/iomgr_posix.c", + "src/core/iomgr/iomgr_windows.c", + "src/core/iomgr/pollset_kick.c", + "src/core/iomgr/pollset_multipoller_with_epoll.c", + "src/core/iomgr/pollset_multipoller_with_poll_posix.c", + "src/core/iomgr/pollset_posix.c", + "src/core/iomgr/pollset_windows.c", + "src/core/iomgr/resolve_address_posix.c", + "src/core/iomgr/resolve_address_windows.c", + "src/core/iomgr/sockaddr_utils.c", + "src/core/iomgr/socket_utils_common_posix.c", + "src/core/iomgr/socket_utils_linux.c", + "src/core/iomgr/socket_utils_posix.c", + "src/core/iomgr/socket_windows.c", + "src/core/iomgr/tcp_client_posix.c", + "src/core/iomgr/tcp_client_windows.c", + "src/core/iomgr/tcp_posix.c", + "src/core/iomgr/tcp_server_posix.c", + "src/core/iomgr/tcp_server_windows.c", + "src/core/iomgr/tcp_windows.c", + "src/core/iomgr/time_averaged_stats.c", + "src/core/iomgr/wakeup_fd_eventfd.c", + "src/core/iomgr/wakeup_fd_nospecial.c", + "src/core/iomgr/wakeup_fd_pipe.c", + "src/core/iomgr/wakeup_fd_posix.c", + "src/core/json/json.c", + "src/core/json/json_reader.c", + "src/core/json/json_string.c", + "src/core/json/json_writer.c", + "src/core/statistics/census_init.c", + "src/core/statistics/census_log.c", + "src/core/statistics/census_rpc_stats.c", + "src/core/statistics/census_tracing.c", + "src/core/statistics/hash_table.c", + "src/core/statistics/window_stats.c", + "src/core/surface/byte_buffer.c", + "src/core/surface/byte_buffer_queue.c", + "src/core/surface/byte_buffer_reader.c", + "src/core/surface/call.c", + "src/core/surface/call_details.c", + "src/core/surface/call_log_batch.c", + "src/core/surface/channel.c", + "src/core/surface/channel_create.c", + "src/core/surface/client.c", + "src/core/surface/completion_queue.c", + "src/core/surface/event_string.c", + "src/core/surface/init.c", + "src/core/surface/lame_client.c", + "src/core/surface/metadata_array.c", + "src/core/surface/server.c", + "src/core/surface/server_chttp2.c", + "src/core/surface/server_create.c", + "src/core/surface/surface_trace.c", + "src/core/transport/chttp2/alpn.c", + "src/core/transport/chttp2/bin_encoder.c", + "src/core/transport/chttp2/frame_data.c", + "src/core/transport/chttp2/frame_goaway.c", + "src/core/transport/chttp2/frame_ping.c", + "src/core/transport/chttp2/frame_rst_stream.c", + "src/core/transport/chttp2/frame_settings.c", + "src/core/transport/chttp2/frame_window_update.c", + "src/core/transport/chttp2/hpack_parser.c", + "src/core/transport/chttp2/hpack_table.c", + "src/core/transport/chttp2/huffsyms.c", + "src/core/transport/chttp2/status_conversion.c", + "src/core/transport/chttp2/stream_encoder.c", + "src/core/transport/chttp2/stream_map.c", + "src/core/transport/chttp2/timeout_encoding.c", + "src/core/transport/chttp2/varint.c", + "src/core/transport/chttp2_transport.c", + "src/core/transport/metadata.c", + "src/core/transport/stream_op.c", + "src/core/transport/transport.c", + ], + hdrs = [ + "include/grpc/byte_buffer.h", + "include/grpc/byte_buffer_reader.h", + "include/grpc/grpc.h", + "include/grpc/grpc_http.h", + "include/grpc/status.h", + ], + includes = [ + "include", + ".", + ], + deps = [ + ":gpr", + ], +) + + + + diff --git a/templates/BUILD.template b/templates/BUILD.template new file mode 100644 index 0000000000..997c55b1c8 --- /dev/null +++ b/templates/BUILD.template @@ -0,0 +1,69 @@ +# GRPC Bazel BUILD file. +# This currently builds C and C++ code. + +# 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. + +licenses(["notice"]) # 3-clause BSD + +% for lib in libs: +% if lib.build == "all" and lib.language == 'c': +${makelib(lib)} +% endif +% endfor + +<%def name="makelib(lib)"> + +cc_library( + name = "${lib.name}", + srcs = [ +% for hdr in lib.get("headers", []): + "${hdr}", +% endfor +% for src in lib.src: + "${src}", +% endfor + ], + hdrs = [ +% for hdr in lib.get("public_headers", []): + "${hdr}", +% endfor + ], + includes = [ + "include", + ".", + ], + deps = [ +% for dep in lib.get("deps", []): + ":${dep}", +% endfor + ], +) + + -- cgit v1.2.3 From c4bc324e1aa8b6b5746928b7f5a9183e55a55fab Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 31 Mar 2015 10:40:02 -0700 Subject: Reversed accidentally swapped test cases --- src/node/interop/interop_client.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/node/interop/interop_client.js b/src/node/interop/interop_client.js index 77804cf595..3341486b9e 100644 --- a/src/node/interop/interop_client.js +++ b/src/node/interop/interop_client.js @@ -318,8 +318,8 @@ var test_cases = { empty_stream: emptyStream, cancel_after_begin: cancelAfterBegin, cancel_after_first_response: cancelAfterFirstResponse, - compute_engine_creds: _.partial(authTest, AUTH_USER), - service_account_creds: _.partial(authTest, COMPUTE_ENGINE_USER) + compute_engine_creds: _.partial(authTest, COMPUTE_ENGINE_USER), + service_account_creds: _.partial(authTest, AUTH_USER) }; /** -- cgit v1.2.3 From ce3bd9680b2d7001b08e1c50af6ed1de2d9eb20e Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Tue, 31 Mar 2015 12:06:20 -0700 Subject: Remove outdated file --- test/cpp/qps/server.cc | 172 ------------------------------------------------- 1 file changed, 172 deletions(-) delete mode 100644 test/cpp/qps/server.cc diff --git a/test/cpp/qps/server.cc b/test/cpp/qps/server.cc deleted file mode 100644 index 258c5e145b..0000000000 --- a/test/cpp/qps/server.cc +++ /dev/null @@ -1,172 +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 -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "src/cpp/server/thread_pool.h" -#include "test/core/util/grpc_profiler.h" -#include "test/cpp/qps/qpstest.pb.h" - -#include -#include - -DEFINE_bool(enable_ssl, false, "Whether to use ssl/tls."); -DEFINE_int32(port, 0, "Server port."); -DEFINE_int32(server_threads, 4, "Number of server threads."); - -using grpc::Server; -using grpc::ServerBuilder; -using grpc::ServerContext; -using grpc::ThreadPool; -using grpc::testing::Payload; -using grpc::testing::PayloadType; -using grpc::testing::ServerStats; -using grpc::testing::SimpleRequest; -using grpc::testing::SimpleResponse; -using grpc::testing::StatsRequest; -using grpc::testing::TestService; -using grpc::Status; - -// In some distros, gflags is in the namespace google, and in some others, -// in gflags. This hack is enabling us to find both. -namespace google {} -namespace gflags {} -using namespace google; -using namespace gflags; - -static bool got_sigint = false; - -static void sigint_handler(int x) { got_sigint = 1; } - -static double time_double(struct timeval* tv) { - return tv->tv_sec + 1e-6 * tv->tv_usec; -} - -static bool SetPayload(PayloadType type, int size, Payload* payload) { - PayloadType response_type = type; - // TODO(yangg): Support UNCOMPRESSABLE payload. - if (type != PayloadType::COMPRESSABLE) { - return false; - } - payload->set_type(response_type); - std::unique_ptr body(new char[size]()); - payload->set_body(body.get(), size); - return true; -} - -namespace { - -class TestServiceImpl GRPC_FINAL : public TestService::Service { - public: - Status CollectServerStats(ServerContext* context, const StatsRequest*, - ServerStats* response) { - struct rusage usage; - struct timeval tv; - gettimeofday(&tv, NULL); - getrusage(RUSAGE_SELF, &usage); - response->set_time_now(time_double(&tv)); - response->set_time_user(time_double(&usage.ru_utime)); - response->set_time_system(time_double(&usage.ru_stime)); - return Status::OK; - } - Status UnaryCall(ServerContext* context, const SimpleRequest* request, - SimpleResponse* response) { - if (request->response_size() > 0) { - if (!SetPayload(request->response_type(), request->response_size(), - response->mutable_payload())) { - return Status(grpc::StatusCode::INTERNAL, "Error creating payload."); - } - } - return Status::OK; - } -}; - -} // namespace - -static void RunServer() { - char* server_address = NULL; - gpr_join_host_port(&server_address, "::", FLAGS_port); - - TestServiceImpl service; - - SimpleRequest request; - SimpleResponse response; - - ServerBuilder builder; - builder.AddListeningPort(server_address, grpc::InsecureServerCredentials()); - builder.RegisterService(&service); - - std::unique_ptr pool(new ThreadPool(FLAGS_server_threads)); - builder.SetThreadPool(pool.get()); - - std::unique_ptr server(builder.BuildAndStart()); - gpr_log(GPR_INFO, "Server listening on %s\n", server_address); - - grpc_profiler_start("qps_server.prof"); - - while (!got_sigint) { - sleep(5); - } - - grpc_profiler_stop(); - - gpr_free(server_address); -} - -int main(int argc, char** argv) { - grpc_init(); - ParseCommandLineFlags(&argc, &argv, true); - - signal(SIGINT, sigint_handler); - - GPR_ASSERT(FLAGS_port != 0); - GPR_ASSERT(!FLAGS_enable_ssl); - RunServer(); - - grpc_shutdown(); - return 0; -} -- cgit v1.2.3 From 49673133b383f9ec71b9a4627aba7c4a722c3332 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Tue, 31 Mar 2015 12:39:51 -0700 Subject: Remove unused header file for profiler --- test/cpp/qps/client_async.cc | 1 - test/cpp/qps/client_sync.cc | 1 - test/cpp/qps/server_async.cc | 1 - test/cpp/qps/server_sync.cc | 1 - 4 files changed, 4 deletions(-) diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc index 590d56d8d0..1ed3c7157f 100644 --- a/test/cpp/qps/client_async.cc +++ b/test/cpp/qps/client_async.cc @@ -47,7 +47,6 @@ #include #include #include -#include "test/core/util/grpc_profiler.h" #include "test/cpp/util/create_test_channel.h" #include "test/cpp/qps/qpstest.pb.h" #include "test/cpp/qps/timer.h" diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc index e4ee45a72d..77da1725ff 100644 --- a/test/cpp/qps/client_sync.cc +++ b/test/cpp/qps/client_sync.cc @@ -53,7 +53,6 @@ #include #include #include -#include "test/core/util/grpc_profiler.h" #include "test/cpp/util/create_test_channel.h" #include "test/cpp/qps/client.h" #include "test/cpp/qps/qpstest.pb.h" diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc index 83bb08cd49..65c170af81 100644 --- a/test/cpp/qps/server_async.cc +++ b/test/cpp/qps/server_async.cc @@ -52,7 +52,6 @@ #include #include #include "src/cpp/server/thread_pool.h" -#include "test/core/util/grpc_profiler.h" #include "test/cpp/qps/qpstest.pb.h" #include "test/cpp/qps/server.h" diff --git a/test/cpp/qps/server_sync.cc b/test/cpp/qps/server_sync.cc index 6724b8f79a..9964429901 100644 --- a/test/cpp/qps/server_sync.cc +++ b/test/cpp/qps/server_sync.cc @@ -47,7 +47,6 @@ #include #include #include "src/cpp/server/thread_pool.h" -#include "test/core/util/grpc_profiler.h" #include "test/cpp/qps/qpstest.pb.h" #include "test/cpp/qps/server.h" #include "test/cpp/qps/timer.h" -- cgit v1.2.3 From 54e16ee548ee18cc6d203d487e17f15ba5cd879b Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Tue, 31 Mar 2015 12:50:56 -0700 Subject: Put in calls to profiling --- test/cpp/qps/worker.cc | 96 +++++++++++++++++++++++++++++--------------------- 1 file changed, 56 insertions(+), 40 deletions(-) diff --git a/test/cpp/qps/worker.cc b/test/cpp/qps/worker.cc index dddc4c9850..378151c571 100644 --- a/test/cpp/qps/worker.cc +++ b/test/cpp/qps/worker.cc @@ -109,6 +109,60 @@ class WorkerImpl GRPC_FINAL : public Worker::Service { return Status(RESOURCE_EXHAUSTED); } + grpc_profiler_start("qps_client.prof"); + Status ret = RunTestBody(ctx,stream); + grpc_profiler_stop(); + return ret; + } + + Status RunServer(ServerContext* ctx, + ServerReaderWriter* stream) + GRPC_OVERRIDE { + InstanceGuard g(this); + if (!g.Acquired()) { + return Status(RESOURCE_EXHAUSTED); + } + + grpc_profiler_start("qps_server.prof"); + Status ret = RunServerBody(ctx,stream); + grpc_profiler_stop(); + return ret; + } + + private: + // Protect against multiple clients using this worker at once. + class InstanceGuard { + public: + InstanceGuard(WorkerImpl* impl) + : impl_(impl), acquired_(impl->TryAcquireInstance()) {} + ~InstanceGuard() { + if (acquired_) { + impl_->ReleaseInstance(); + } + } + + bool Acquired() const { return acquired_; } + + private: + WorkerImpl* const impl_; + const bool acquired_; + }; + + bool TryAcquireInstance() { + std::lock_guard g(mu_); + if (acquired_) return false; + acquired_ = true; + return true; + } + + void ReleaseInstance() { + std::lock_guard g(mu_); + GPR_ASSERT(acquired_); + acquired_ = false; + } + + Status RunTestBody(ServerContext* ctx, + ServerReaderWriter* stream) { ClientArgs args; if (!stream->Read(&args)) { return Status(INVALID_ARGUMENT); @@ -135,14 +189,8 @@ class WorkerImpl GRPC_FINAL : public Worker::Service { return Status::OK; } - Status RunServer(ServerContext* ctx, - ServerReaderWriter* stream) - GRPC_OVERRIDE { - InstanceGuard g(this); - if (!g.Acquired()) { - return Status(RESOURCE_EXHAUSTED); - } - + Status RunServerBody(ServerContext* ctx, + ServerReaderWriter* stream) { ServerArgs args; if (!stream->Read(&args)) { return Status(INVALID_ARGUMENT); @@ -170,38 +218,6 @@ class WorkerImpl GRPC_FINAL : public Worker::Service { return Status::OK; } - private: - // Protect against multiple clients using this worker at once. - class InstanceGuard { - public: - InstanceGuard(WorkerImpl* impl) - : impl_(impl), acquired_(impl->TryAcquireInstance()) {} - ~InstanceGuard() { - if (acquired_) { - impl_->ReleaseInstance(); - } - } - - bool Acquired() const { return acquired_; } - - private: - WorkerImpl* const impl_; - const bool acquired_; - }; - - bool TryAcquireInstance() { - std::lock_guard g(mu_); - if (acquired_) return false; - acquired_ = true; - return true; - } - - void ReleaseInstance() { - std::lock_guard g(mu_); - GPR_ASSERT(acquired_); - acquired_ = false; - } - std::mutex mu_; bool acquired_; }; -- cgit v1.2.3 From 5bf4d2ae36ee10f0deb2a8f43afa37b2009feeb6 Mon Sep 17 00:00:00 2001 From: Masood Malekghassemi Date: Tue, 31 Mar 2015 15:58:17 -0700 Subject: Reformat style of using PyObject_HEAD --- src/python/src/grpc/_adapter/_call.h | 5 ++++- src/python/src/grpc/_adapter/_channel.h | 5 ++++- src/python/src/grpc/_adapter/_client_credentials.h | 3 ++- src/python/src/grpc/_adapter/_completion_queue.h | 3 ++- src/python/src/grpc/_adapter/_server.h | 5 ++++- src/python/src/grpc/_adapter/_server_credentials.h | 3 ++- 6 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/python/src/grpc/_adapter/_call.h b/src/python/src/grpc/_adapter/_call.h index a936e23023..fabc6f399d 100644 --- a/src/python/src/grpc/_adapter/_call.h +++ b/src/python/src/grpc/_adapter/_call.h @@ -37,7 +37,10 @@ #include #include -typedef struct { PyObject_HEAD grpc_call *c_call; } Call; +typedef struct { + PyObject_HEAD; + grpc_call *c_call; +} Call; PyTypeObject pygrpc_CallType; diff --git a/src/python/src/grpc/_adapter/_channel.h b/src/python/src/grpc/_adapter/_channel.h index 6241ccd02e..303b675192 100644 --- a/src/python/src/grpc/_adapter/_channel.h +++ b/src/python/src/grpc/_adapter/_channel.h @@ -37,7 +37,10 @@ #include #include -typedef struct { PyObject_HEAD grpc_channel *c_channel; } Channel; +typedef struct { + PyObject_HEAD; + grpc_channel *c_channel; +} Channel; PyTypeObject pygrpc_ChannelType; diff --git a/src/python/src/grpc/_adapter/_client_credentials.h b/src/python/src/grpc/_adapter/_client_credentials.h index 664dc80d75..47476ce15f 100644 --- a/src/python/src/grpc/_adapter/_client_credentials.h +++ b/src/python/src/grpc/_adapter/_client_credentials.h @@ -38,7 +38,8 @@ #include typedef struct { - PyObject_HEAD grpc_credentials *c_client_credentials; + PyObject_HEAD; + grpc_credentials *c_client_credentials; } ClientCredentials; PyTypeObject pygrpc_ClientCredentialsType; diff --git a/src/python/src/grpc/_adapter/_completion_queue.h b/src/python/src/grpc/_adapter/_completion_queue.h index 8e5ee9f406..3a39476a2e 100644 --- a/src/python/src/grpc/_adapter/_completion_queue.h +++ b/src/python/src/grpc/_adapter/_completion_queue.h @@ -38,7 +38,8 @@ #include typedef struct { - PyObject_HEAD grpc_completion_queue *c_completion_queue; + PyObject_HEAD; + grpc_completion_queue *c_completion_queue; } CompletionQueue; PyTypeObject pygrpc_CompletionQueueType; diff --git a/src/python/src/grpc/_adapter/_server.h b/src/python/src/grpc/_adapter/_server.h index 0c517e3715..4248712c1c 100644 --- a/src/python/src/grpc/_adapter/_server.h +++ b/src/python/src/grpc/_adapter/_server.h @@ -37,7 +37,10 @@ #include #include -typedef struct { PyObject_HEAD grpc_server *c_server; } Server; +typedef struct { + PyObject_HEAD; + grpc_server *c_server; +} Server; int pygrpc_add_server(PyObject *module); diff --git a/src/python/src/grpc/_adapter/_server_credentials.h b/src/python/src/grpc/_adapter/_server_credentials.h index 2e56efdcd9..bb6ff2c5bb 100644 --- a/src/python/src/grpc/_adapter/_server_credentials.h +++ b/src/python/src/grpc/_adapter/_server_credentials.h @@ -38,7 +38,8 @@ #include typedef struct { - PyObject_HEAD grpc_server_credentials *c_server_credentials; + PyObject_HEAD; + grpc_server_credentials *c_server_credentials; } ServerCredentials; PyTypeObject pygrpc_ServerCredentialsType; -- cgit v1.2.3 From a60dd3b7d5a355521e2641efe07aae55e3336a38 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 31 Mar 2015 17:53:18 -0700 Subject: Added proto files --- src/php/tests/generated_code/math.proto | 80 +++++++++++++++++++ src/php/tests/interop/empty.proto | 43 +++++++++++ src/php/tests/interop/messages.proto | 132 ++++++++++++++++++++++++++++++++ src/php/tests/interop/test.proto | 72 +++++++++++++++++ 4 files changed, 327 insertions(+) create mode 100644 src/php/tests/generated_code/math.proto create mode 100644 src/php/tests/interop/empty.proto create mode 100644 src/php/tests/interop/messages.proto create mode 100644 src/php/tests/interop/test.proto diff --git a/src/php/tests/generated_code/math.proto b/src/php/tests/generated_code/math.proto new file mode 100644 index 0000000000..e34ad5e967 --- /dev/null +++ b/src/php/tests/generated_code/math.proto @@ -0,0 +1,80 @@ + +// 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. + +syntax = "proto3"; + +package math; + +message DivArgs { + optional int64 dividend = 1; + optional int64 divisor = 2; +} + +message DivReply { + optional int64 quotient = 1; + optional int64 remainder = 2; +} + +message FibArgs { + optional int64 limit = 1; +} + +message Num { + optional int64 num = 1; +} + +message FibReply { + optional int64 count = 1; +} + +service Math { + // Div divides args.dividend by args.divisor and returns the quotient and + // remainder. + rpc Div (DivArgs) returns (DivReply) { + } + + // DivMany accepts an arbitrary number of division args from the client stream + // and sends back the results in the reply stream. The stream continues until + // the client closes its end; the server does the same after sending all the + // replies. The stream ends immediately if either end aborts. + rpc DivMany (stream DivArgs) returns (stream DivReply) { + } + + // Fib generates numbers in the Fibonacci sequence. If args.limit > 0, Fib + // generates up to limit numbers; otherwise it continues until the call is + // canceled. Unlike Fib above, Fib has no final FibReply. + rpc Fib (FibArgs) returns (stream Num) { + } + + // Sum sums a stream of numbers, returning the final result once the stream + // is closed. + rpc Sum (stream Num) returns (Num) { + } +} diff --git a/src/php/tests/interop/empty.proto b/src/php/tests/interop/empty.proto new file mode 100644 index 0000000000..4295a0a960 --- /dev/null +++ b/src/php/tests/interop/empty.proto @@ -0,0 +1,43 @@ + +// 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. + +syntax = "proto2"; + +package grpc.testing; + +// An empty message that you can re-use to avoid defining duplicated empty +// messages in your project. A typical example is to use it as argument or the +// return value of a service API. For instance: +// +// service Foo { +// rpc Bar (grpc.testing.Empty) returns (grpc.testing.Empty) { }; +// }; +// +message Empty {} diff --git a/src/php/tests/interop/messages.proto b/src/php/tests/interop/messages.proto new file mode 100644 index 0000000000..de0b1a2320 --- /dev/null +++ b/src/php/tests/interop/messages.proto @@ -0,0 +1,132 @@ + +// 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. + +// Message definitions to be used by integration test service definitions. + +syntax = "proto2"; + +package grpc.testing; + +// The type of payload that should be returned. +enum PayloadType { + // Compressable text format. + COMPRESSABLE = 0; + + // Uncompressable binary format. + UNCOMPRESSABLE = 1; + + // Randomly chosen from all other formats defined in this enum. + RANDOM = 2; +} + +// A block of data, to simply increase gRPC message size. +message Payload { + // The type of data in body. + optional PayloadType type = 1 [default = COMPRESSABLE]; + // Primary contents of payload. + optional bytes body = 2; +} + +// Unary request. +message SimpleRequest { + // Desired payload type in the response from the server. + // If response_type is RANDOM, server randomly chooses one from other formats. + optional PayloadType response_type = 1 [default = COMPRESSABLE]; + + // Desired payload size in the response from the server. + // If response_type is COMPRESSABLE, this denotes the size before compression. + optional int32 response_size = 2; + + // Optional input payload sent along with the request. + optional Payload payload = 3; + + // Whether SimpleResponse should include username. + optional bool fill_username = 4; + + // Whether SimpleResponse should include OAuth scope. + optional bool fill_oauth_scope = 5; +} + +// Unary response, as configured by the request. +message SimpleResponse { + // Payload to increase message size. + optional Payload payload = 1; + // The user the request came from, for verifying authentication was + // successful when the client expected it. + optional string username = 2; + // OAuth scope. + optional string oauth_scope = 3; +} + +// Client-streaming request. +message StreamingInputCallRequest { + // Optional input payload sent along with the request. + optional Payload payload = 1; + + // Not expecting any payload from the response. +} + +// Client-streaming response. +message StreamingInputCallResponse { + // Aggregated size of payloads received from the client. + optional int32 aggregated_payload_size = 1; +} + +// Configuration for a particular response. +message ResponseParameters { + // Desired payload sizes in responses from the server. + // If response_type is COMPRESSABLE, this denotes the size before compression. + optional int32 size = 1; + + // Desired interval between consecutive responses in the response stream in + // microseconds. + optional int32 interval_us = 2; +} + +// Server-streaming request. +message StreamingOutputCallRequest { + // Desired payload type in the response from the server. + // If response_type is RANDOM, the payload from each response in the stream + // might be of different types. This is to simulate a mixed type of payload + // stream. + optional PayloadType response_type = 1 [default = COMPRESSABLE]; + + // Configuration for each expected response message. + repeated ResponseParameters response_parameters = 2; + + // Optional input payload sent along with the request. + optional Payload payload = 3; +} + +// Server-streaming response, as configured by the request and parameters. +message StreamingOutputCallResponse { + // Payload to increase response size. + optional Payload payload = 1; +} diff --git a/src/php/tests/interop/test.proto b/src/php/tests/interop/test.proto new file mode 100644 index 0000000000..927a3a83aa --- /dev/null +++ b/src/php/tests/interop/test.proto @@ -0,0 +1,72 @@ + +// 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. + +// An integration test service that covers all the method signature permutations +// of unary/streaming requests/responses. +syntax = "proto2"; + +import "empty.proto"; +import "messages.proto"; + +package grpc.testing; + +// A simple service to test the various types of RPCs and experiment with +// performance with various types of payload. +service TestService { + // One empty request followed by one empty response. + rpc EmptyCall(grpc.testing.Empty) returns (grpc.testing.Empty); + + // One request followed by one response. + // TODO(Issue 527): Describe required server behavior. + rpc UnaryCall(SimpleRequest) returns (SimpleResponse); + + // One request followed by a sequence of responses (streamed download). + // The server returns the payload with client desired type and sizes. + rpc StreamingOutputCall(StreamingOutputCallRequest) + returns (stream StreamingOutputCallResponse); + + // A sequence of requests followed by one response (streamed upload). + // The server returns the aggregated size of client payload as the result. + rpc StreamingInputCall(stream StreamingInputCallRequest) + returns (StreamingInputCallResponse); + + // A sequence of requests with each request served by the server immediately. + // As one request could lead to multiple responses, this interface + // demonstrates the idea of full duplexing. + rpc FullDuplexCall(stream StreamingOutputCallRequest) + returns (stream StreamingOutputCallResponse); + + // A sequence of requests followed by a sequence of responses. + // The server buffers all the client requests and then serves them in order. A + // stream of responses are returned to the client when the server starts with + // first request. + rpc HalfDuplexCall(stream StreamingOutputCallRequest) + returns (stream StreamingOutputCallResponse); +} -- cgit v1.2.3 From 65dda6ca3129613eb1be819cc735617144f5ccf5 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 31 Mar 2015 18:04:14 -0700 Subject: Updated generated code to match protos --- src/php/tests/generated_code/math.php | 106 ++++++++++---------- src/php/tests/interop/empty.php | 5 +- src/php/tests/interop/empty.proto | 4 +- src/php/tests/interop/messages.php | 181 +++++++++++++++++----------------- src/php/tests/interop/test.php | 4 +- src/php/tests/interop/test.proto | 2 +- 6 files changed, 154 insertions(+), 148 deletions(-) diff --git a/src/php/tests/generated_code/math.php b/src/php/tests/generated_code/math.php index e97a5cf97e..875f719e9e 100755 --- a/src/php/tests/generated_code/math.php +++ b/src/php/tests/generated_code/math.php @@ -1,7 +1,7 @@ number = 1; $f->name = "dividend"; $f->type = \DrSlump\Protobuf::TYPE_INT64; - $f->rule = \DrSlump\Protobuf::RULE_REQUIRED; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; $descriptor->addField($f); - // REQUIRED INT64 divisor = 2 + // OPTIONAL INT64 divisor = 2 $f = new \DrSlump\Protobuf\Field(); $f->number = 2; $f->name = "divisor"; $f->type = \DrSlump\Protobuf::TYPE_INT64; - $f->rule = \DrSlump\Protobuf::RULE_REQUIRED; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; $descriptor->addField($f); foreach (self::$__extensions as $cb) { @@ -52,7 +52,7 @@ namespace math { public function hasDividend(){ return $this->_has(1); } - + /** * Clear value * @@ -61,7 +61,7 @@ namespace math { public function clearDividend(){ return $this->_clear(1); } - + /** * Get value * @@ -70,7 +70,7 @@ namespace math { public function getDividend(){ return $this->_get(1); } - + /** * Set value * @@ -80,7 +80,7 @@ namespace math { public function setDividend( $value){ return $this->_set(1, $value); } - + /** * Check if has a value * @@ -89,7 +89,7 @@ namespace math { public function hasDivisor(){ return $this->_has(2); } - + /** * Clear value * @@ -98,7 +98,7 @@ namespace math { public function clearDivisor(){ return $this->_clear(2); } - + /** * Get value * @@ -107,7 +107,7 @@ namespace math { public function getDivisor(){ return $this->_get(2); } - + /** * Set value * @@ -126,10 +126,10 @@ namespace math { /** @var int */ public $quotient = null; - + /** @var int */ public $remainder = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -138,20 +138,20 @@ namespace math { { $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'math.DivReply'); - // REQUIRED INT64 quotient = 1 + // OPTIONAL INT64 quotient = 1 $f = new \DrSlump\Protobuf\Field(); $f->number = 1; $f->name = "quotient"; $f->type = \DrSlump\Protobuf::TYPE_INT64; - $f->rule = \DrSlump\Protobuf::RULE_REQUIRED; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; $descriptor->addField($f); - // REQUIRED INT64 remainder = 2 + // OPTIONAL INT64 remainder = 2 $f = new \DrSlump\Protobuf\Field(); $f->number = 2; $f->name = "remainder"; $f->type = \DrSlump\Protobuf::TYPE_INT64; - $f->rule = \DrSlump\Protobuf::RULE_REQUIRED; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; $descriptor->addField($f); foreach (self::$__extensions as $cb) { @@ -169,7 +169,7 @@ namespace math { public function hasQuotient(){ return $this->_has(1); } - + /** * Clear value * @@ -178,7 +178,7 @@ namespace math { public function clearQuotient(){ return $this->_clear(1); } - + /** * Get value * @@ -187,7 +187,7 @@ namespace math { public function getQuotient(){ return $this->_get(1); } - + /** * Set value * @@ -197,7 +197,7 @@ namespace math { public function setQuotient( $value){ return $this->_set(1, $value); } - + /** * Check if has a value * @@ -206,7 +206,7 @@ namespace math { public function hasRemainder(){ return $this->_has(2); } - + /** * Clear value * @@ -215,7 +215,7 @@ namespace math { public function clearRemainder(){ return $this->_clear(2); } - + /** * Get value * @@ -224,7 +224,7 @@ namespace math { public function getRemainder(){ return $this->_get(2); } - + /** * Set value * @@ -243,7 +243,7 @@ namespace math { /** @var int */ public $limit = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -275,7 +275,7 @@ namespace math { public function hasLimit(){ return $this->_has(1); } - + /** * Clear value * @@ -284,7 +284,7 @@ namespace math { public function clearLimit(){ return $this->_clear(1); } - + /** * Get value * @@ -293,7 +293,7 @@ namespace math { public function getLimit(){ return $this->_get(1); } - + /** * Set value * @@ -312,7 +312,7 @@ namespace math { /** @var int */ public $num = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -321,12 +321,12 @@ namespace math { { $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'math.Num'); - // REQUIRED INT64 num = 1 + // OPTIONAL INT64 num = 1 $f = new \DrSlump\Protobuf\Field(); $f->number = 1; $f->name = "num"; $f->type = \DrSlump\Protobuf::TYPE_INT64; - $f->rule = \DrSlump\Protobuf::RULE_REQUIRED; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; $descriptor->addField($f); foreach (self::$__extensions as $cb) { @@ -344,7 +344,7 @@ namespace math { public function hasNum(){ return $this->_has(1); } - + /** * Clear value * @@ -353,7 +353,7 @@ namespace math { public function clearNum(){ return $this->_clear(1); } - + /** * Get value * @@ -362,7 +362,7 @@ namespace math { public function getNum(){ return $this->_get(1); } - + /** * Set value * @@ -381,7 +381,7 @@ namespace math { /** @var int */ public $count = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -390,12 +390,12 @@ namespace math { { $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'math.FibReply'); - // REQUIRED INT64 count = 1 + // OPTIONAL INT64 count = 1 $f = new \DrSlump\Protobuf\Field(); $f->number = 1; $f->name = "count"; $f->type = \DrSlump\Protobuf::TYPE_INT64; - $f->rule = \DrSlump\Protobuf::RULE_REQUIRED; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; $descriptor->addField($f); foreach (self::$__extensions as $cb) { @@ -413,7 +413,7 @@ namespace math { public function hasCount(){ return $this->_has(1); } - + /** * Clear value * @@ -422,7 +422,7 @@ namespace math { public function clearCount(){ return $this->_clear(1); } - + /** * Get value * @@ -431,7 +431,7 @@ namespace math { public function getCount(){ return $this->_get(1); } - + /** * Set value * @@ -446,34 +446,36 @@ namespace math { namespace math { - class MathClient extends \Grpc\BaseStub { + class MathClient{ + + private $rpc_impl; + + public function __construct($rpc_impl) { + $this->rpc_impl = $rpc_impl; + } /** * @param math\DivArgs $input - * @return math\DivReply */ public function Div(\math\DivArgs $argument, $metadata = array()) { - return $this->_simpleRequest('/Math/Div', $argument, '\math\DivReply::deserialize', $metadata); + return $this->rpc_impl->_simpleRequest('/math.Math/Div', $argument, '\math\DivReply::deserialize', $metadata); } /** * @param math\DivArgs $input - * @return math\DivReply */ public function DivMany($metadata = array()) { - return $this->_bidiRequest('/Math/DivMany', '\math\DivReply::deserialize', $metadata); + return $this->rpc_impl->_bidiRequest('/math.Math/DivMany', '\math\DivReply::deserialize', $metadata); } /** * @param math\FibArgs $input - * @return math\Num */ public function Fib($argument, $metadata = array()) { - return $this->_serverStreamRequest('/Math/Fib', $argument, '\math\Num::deserialize', $metadata); + return $this->rpc_impl->_serverStreamRequest('/math.Math/Fib', $argument, '\math\Num::deserialize', $metadata); } /** * @param math\Num $input - * @return math\Num */ public function Sum($arguments, $metadata = array()) { - return $this->_clientStreamRequest('/Math/Sum', $arguments, '\math\Num::deserialize', $metadata); + return $this->rpc_impl->_clientStreamRequest('/math.Math/Sum', $arguments, '\math\Num::deserialize', $metadata); } } } diff --git a/src/php/tests/interop/empty.php b/src/php/tests/interop/empty.php index 22b11803b6..0004e30953 100755 --- a/src/php/tests/interop/empty.php +++ b/src/php/tests/interop/empty.php @@ -1,7 +1,7 @@ type = \DrSlump\Protobuf::TYPE_ENUM; $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; $f->reference = '\grpc\testing\PayloadType'; + $f->default = \grpc\testing\PayloadType::COMPRESSABLE; $descriptor->addField($f); // OPTIONAL BYTES body = 2 @@ -61,7 +62,7 @@ namespace grpc\testing { public function hasType(){ return $this->_has(1); } - + /** * Clear value * @@ -70,7 +71,7 @@ namespace grpc\testing { public function clearType(){ return $this->_clear(1); } - + /** * Get value * @@ -79,7 +80,7 @@ namespace grpc\testing { public function getType(){ return $this->_get(1); } - + /** * Set value * @@ -89,7 +90,7 @@ namespace grpc\testing { public function setType( $value){ return $this->_set(1, $value); } - + /** * Check if has a value * @@ -98,7 +99,7 @@ namespace grpc\testing { public function hasBody(){ return $this->_has(2); } - + /** * Clear value * @@ -107,7 +108,7 @@ namespace grpc\testing { public function clearBody(){ return $this->_clear(2); } - + /** * Get value * @@ -116,7 +117,7 @@ namespace grpc\testing { public function getBody(){ return $this->_get(2); } - + /** * Set value * @@ -134,20 +135,20 @@ namespace grpc\testing { class SimpleRequest extends \DrSlump\Protobuf\Message { /** @var int - \grpc\testing\PayloadType */ - public $response_type = null; - + public $response_type = \grpc\testing\PayloadType::COMPRESSABLE; + /** @var int */ public $response_size = null; - + /** @var \grpc\testing\Payload */ public $payload = null; - + /** @var boolean */ public $fill_username = null; - + /** @var boolean */ public $fill_oauth_scope = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -163,6 +164,7 @@ namespace grpc\testing { $f->type = \DrSlump\Protobuf::TYPE_ENUM; $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; $f->reference = '\grpc\testing\PayloadType'; + $f->default = \grpc\testing\PayloadType::COMPRESSABLE; $descriptor->addField($f); // OPTIONAL INT32 response_size = 2 @@ -213,7 +215,7 @@ namespace grpc\testing { public function hasResponseType(){ return $this->_has(1); } - + /** * Clear value * @@ -222,7 +224,7 @@ namespace grpc\testing { public function clearResponseType(){ return $this->_clear(1); } - + /** * Get value * @@ -231,7 +233,7 @@ namespace grpc\testing { public function getResponseType(){ return $this->_get(1); } - + /** * Set value * @@ -241,7 +243,7 @@ namespace grpc\testing { public function setResponseType( $value){ return $this->_set(1, $value); } - + /** * Check if has a value * @@ -250,7 +252,7 @@ namespace grpc\testing { public function hasResponseSize(){ return $this->_has(2); } - + /** * Clear value * @@ -259,7 +261,7 @@ namespace grpc\testing { public function clearResponseSize(){ return $this->_clear(2); } - + /** * Get value * @@ -268,7 +270,7 @@ namespace grpc\testing { public function getResponseSize(){ return $this->_get(2); } - + /** * Set value * @@ -278,7 +280,7 @@ namespace grpc\testing { public function setResponseSize( $value){ return $this->_set(2, $value); } - + /** * Check if has a value * @@ -287,7 +289,7 @@ namespace grpc\testing { public function hasPayload(){ return $this->_has(3); } - + /** * Clear value * @@ -296,7 +298,7 @@ namespace grpc\testing { public function clearPayload(){ return $this->_clear(3); } - + /** * Get value * @@ -305,7 +307,7 @@ namespace grpc\testing { public function getPayload(){ return $this->_get(3); } - + /** * Set value * @@ -315,7 +317,7 @@ namespace grpc\testing { public function setPayload(\grpc\testing\Payload $value){ return $this->_set(3, $value); } - + /** * Check if has a value * @@ -324,7 +326,7 @@ namespace grpc\testing { public function hasFillUsername(){ return $this->_has(4); } - + /** * Clear value * @@ -333,7 +335,7 @@ namespace grpc\testing { public function clearFillUsername(){ return $this->_clear(4); } - + /** * Get value * @@ -342,7 +344,7 @@ namespace grpc\testing { public function getFillUsername(){ return $this->_get(4); } - + /** * Set value * @@ -352,7 +354,7 @@ namespace grpc\testing { public function setFillUsername( $value){ return $this->_set(4, $value); } - + /** * Check if has a value * @@ -361,7 +363,7 @@ namespace grpc\testing { public function hasFillOauthScope(){ return $this->_has(5); } - + /** * Clear value * @@ -370,7 +372,7 @@ namespace grpc\testing { public function clearFillOauthScope(){ return $this->_clear(5); } - + /** * Get value * @@ -379,7 +381,7 @@ namespace grpc\testing { public function getFillOauthScope(){ return $this->_get(5); } - + /** * Set value * @@ -398,13 +400,13 @@ namespace grpc\testing { /** @var \grpc\testing\Payload */ public $payload = null; - + /** @var string */ public $username = null; - + /** @var string */ public $oauth_scope = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -453,7 +455,7 @@ namespace grpc\testing { public function hasPayload(){ return $this->_has(1); } - + /** * Clear value * @@ -462,7 +464,7 @@ namespace grpc\testing { public function clearPayload(){ return $this->_clear(1); } - + /** * Get value * @@ -471,7 +473,7 @@ namespace grpc\testing { public function getPayload(){ return $this->_get(1); } - + /** * Set value * @@ -481,7 +483,7 @@ namespace grpc\testing { public function setPayload(\grpc\testing\Payload $value){ return $this->_set(1, $value); } - + /** * Check if has a value * @@ -490,7 +492,7 @@ namespace grpc\testing { public function hasUsername(){ return $this->_has(2); } - + /** * Clear value * @@ -499,7 +501,7 @@ namespace grpc\testing { public function clearUsername(){ return $this->_clear(2); } - + /** * Get value * @@ -508,7 +510,7 @@ namespace grpc\testing { public function getUsername(){ return $this->_get(2); } - + /** * Set value * @@ -518,7 +520,7 @@ namespace grpc\testing { public function setUsername( $value){ return $this->_set(2, $value); } - + /** * Check if has a value * @@ -527,7 +529,7 @@ namespace grpc\testing { public function hasOauthScope(){ return $this->_has(3); } - + /** * Clear value * @@ -536,7 +538,7 @@ namespace grpc\testing { public function clearOauthScope(){ return $this->_clear(3); } - + /** * Get value * @@ -545,7 +547,7 @@ namespace grpc\testing { public function getOauthScope(){ return $this->_get(3); } - + /** * Set value * @@ -564,7 +566,7 @@ namespace grpc\testing { /** @var \grpc\testing\Payload */ public $payload = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -597,7 +599,7 @@ namespace grpc\testing { public function hasPayload(){ return $this->_has(1); } - + /** * Clear value * @@ -606,7 +608,7 @@ namespace grpc\testing { public function clearPayload(){ return $this->_clear(1); } - + /** * Get value * @@ -615,7 +617,7 @@ namespace grpc\testing { public function getPayload(){ return $this->_get(1); } - + /** * Set value * @@ -634,7 +636,7 @@ namespace grpc\testing { /** @var int */ public $aggregated_payload_size = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -666,7 +668,7 @@ namespace grpc\testing { public function hasAggregatedPayloadSize(){ return $this->_has(1); } - + /** * Clear value * @@ -675,7 +677,7 @@ namespace grpc\testing { public function clearAggregatedPayloadSize(){ return $this->_clear(1); } - + /** * Get value * @@ -684,7 +686,7 @@ namespace grpc\testing { public function getAggregatedPayloadSize(){ return $this->_get(1); } - + /** * Set value * @@ -703,10 +705,10 @@ namespace grpc\testing { /** @var int */ public $size = null; - + /** @var int */ public $interval_us = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -746,7 +748,7 @@ namespace grpc\testing { public function hasSize(){ return $this->_has(1); } - + /** * Clear value * @@ -755,7 +757,7 @@ namespace grpc\testing { public function clearSize(){ return $this->_clear(1); } - + /** * Get value * @@ -764,7 +766,7 @@ namespace grpc\testing { public function getSize(){ return $this->_get(1); } - + /** * Set value * @@ -774,7 +776,7 @@ namespace grpc\testing { public function setSize( $value){ return $this->_set(1, $value); } - + /** * Check if has a value * @@ -783,7 +785,7 @@ namespace grpc\testing { public function hasIntervalUs(){ return $this->_has(2); } - + /** * Clear value * @@ -792,7 +794,7 @@ namespace grpc\testing { public function clearIntervalUs(){ return $this->_clear(2); } - + /** * Get value * @@ -801,7 +803,7 @@ namespace grpc\testing { public function getIntervalUs(){ return $this->_get(2); } - + /** * Set value * @@ -819,14 +821,14 @@ namespace grpc\testing { class StreamingOutputCallRequest extends \DrSlump\Protobuf\Message { /** @var int - \grpc\testing\PayloadType */ - public $response_type = null; - + public $response_type = \grpc\testing\PayloadType::COMPRESSABLE; + /** @var \grpc\testing\ResponseParameters[] */ public $response_parameters = array(); - + /** @var \grpc\testing\Payload */ public $payload = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -842,6 +844,7 @@ namespace grpc\testing { $f->type = \DrSlump\Protobuf::TYPE_ENUM; $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; $f->reference = '\grpc\testing\PayloadType'; + $f->default = \grpc\testing\PayloadType::COMPRESSABLE; $descriptor->addField($f); // REPEATED MESSAGE response_parameters = 2 @@ -877,7 +880,7 @@ namespace grpc\testing { public function hasResponseType(){ return $this->_has(1); } - + /** * Clear value * @@ -886,7 +889,7 @@ namespace grpc\testing { public function clearResponseType(){ return $this->_clear(1); } - + /** * Get value * @@ -895,7 +898,7 @@ namespace grpc\testing { public function getResponseType(){ return $this->_get(1); } - + /** * Set value * @@ -905,7 +908,7 @@ namespace grpc\testing { public function setResponseType( $value){ return $this->_set(1, $value); } - + /** * Check if has a value * @@ -914,7 +917,7 @@ namespace grpc\testing { public function hasResponseParameters(){ return $this->_has(2); } - + /** * Clear value * @@ -923,7 +926,7 @@ namespace grpc\testing { public function clearResponseParameters(){ return $this->_clear(2); } - + /** * Get value * @@ -933,7 +936,7 @@ namespace grpc\testing { public function getResponseParameters($idx = NULL){ return $this->_get(2, $idx); } - + /** * Set value * @@ -943,7 +946,7 @@ namespace grpc\testing { public function setResponseParameters(\grpc\testing\ResponseParameters $value, $idx = NULL){ return $this->_set(2, $value, $idx); } - + /** * Get all elements of * @@ -952,7 +955,7 @@ namespace grpc\testing { public function getResponseParametersList(){ return $this->_get(2); } - + /** * Add a new element to * @@ -962,7 +965,7 @@ namespace grpc\testing { public function addResponseParameters(\grpc\testing\ResponseParameters $value){ return $this->_add(2, $value); } - + /** * Check if has a value * @@ -971,7 +974,7 @@ namespace grpc\testing { public function hasPayload(){ return $this->_has(3); } - + /** * Clear value * @@ -980,7 +983,7 @@ namespace grpc\testing { public function clearPayload(){ return $this->_clear(3); } - + /** * Get value * @@ -989,7 +992,7 @@ namespace grpc\testing { public function getPayload(){ return $this->_get(3); } - + /** * Set value * @@ -1008,7 +1011,7 @@ namespace grpc\testing { /** @var \grpc\testing\Payload */ public $payload = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -1041,7 +1044,7 @@ namespace grpc\testing { public function hasPayload(){ return $this->_has(1); } - + /** * Clear value * @@ -1050,7 +1053,7 @@ namespace grpc\testing { public function clearPayload(){ return $this->_clear(1); } - + /** * Get value * @@ -1059,7 +1062,7 @@ namespace grpc\testing { public function getPayload(){ return $this->_get(1); } - + /** * Set value * diff --git a/src/php/tests/interop/test.php b/src/php/tests/interop/test.php index 014bbc9517..8a6cf76857 100755 --- a/src/php/tests/interop/test.php +++ b/src/php/tests/interop/test.php @@ -1,7 +1,7 @@ Date: Tue, 31 Mar 2015 18:17:36 -0700 Subject: Removed generated code files --- src/php/tests/generated_code/math.php | 481 --------------- src/php/tests/interop/empty.php | 26 - src/php/tests/interop/message_set.php | 26 - src/php/tests/interop/messages.php | 1077 --------------------------------- src/php/tests/interop/test.php | 52 -- 5 files changed, 1662 deletions(-) delete mode 100755 src/php/tests/generated_code/math.php delete mode 100755 src/php/tests/interop/empty.php delete mode 100755 src/php/tests/interop/message_set.php delete mode 100755 src/php/tests/interop/messages.php delete mode 100755 src/php/tests/interop/test.php diff --git a/src/php/tests/generated_code/math.php b/src/php/tests/generated_code/math.php deleted file mode 100755 index 875f719e9e..0000000000 --- a/src/php/tests/generated_code/math.php +++ /dev/null @@ -1,481 +0,0 @@ -number = 1; - $f->name = "dividend"; - $f->type = \DrSlump\Protobuf::TYPE_INT64; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $descriptor->addField($f); - - // OPTIONAL INT64 divisor = 2 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 2; - $f->name = "divisor"; - $f->type = \DrSlump\Protobuf::TYPE_INT64; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - return $descriptor; - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasDividend(){ - return $this->_has(1); - } - - /** - * Clear value - * - * @return \math\DivArgs - */ - public function clearDividend(){ - return $this->_clear(1); - } - - /** - * Get value - * - * @return int - */ - public function getDividend(){ - return $this->_get(1); - } - - /** - * Set value - * - * @param int $value - * @return \math\DivArgs - */ - public function setDividend( $value){ - return $this->_set(1, $value); - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasDivisor(){ - return $this->_has(2); - } - - /** - * Clear value - * - * @return \math\DivArgs - */ - public function clearDivisor(){ - return $this->_clear(2); - } - - /** - * Get value - * - * @return int - */ - public function getDivisor(){ - return $this->_get(2); - } - - /** - * Set value - * - * @param int $value - * @return \math\DivArgs - */ - public function setDivisor( $value){ - return $this->_set(2, $value); - } - } -} - -namespace math { - - class DivReply extends \DrSlump\Protobuf\Message { - - /** @var int */ - public $quotient = null; - - /** @var int */ - public $remainder = null; - - - /** @var \Closure[] */ - protected static $__extensions = array(); - - public static function descriptor() - { - $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'math.DivReply'); - - // OPTIONAL INT64 quotient = 1 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "quotient"; - $f->type = \DrSlump\Protobuf::TYPE_INT64; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $descriptor->addField($f); - - // OPTIONAL INT64 remainder = 2 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 2; - $f->name = "remainder"; - $f->type = \DrSlump\Protobuf::TYPE_INT64; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - return $descriptor; - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasQuotient(){ - return $this->_has(1); - } - - /** - * Clear value - * - * @return \math\DivReply - */ - public function clearQuotient(){ - return $this->_clear(1); - } - - /** - * Get value - * - * @return int - */ - public function getQuotient(){ - return $this->_get(1); - } - - /** - * Set value - * - * @param int $value - * @return \math\DivReply - */ - public function setQuotient( $value){ - return $this->_set(1, $value); - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasRemainder(){ - return $this->_has(2); - } - - /** - * Clear value - * - * @return \math\DivReply - */ - public function clearRemainder(){ - return $this->_clear(2); - } - - /** - * Get value - * - * @return int - */ - public function getRemainder(){ - return $this->_get(2); - } - - /** - * Set value - * - * @param int $value - * @return \math\DivReply - */ - public function setRemainder( $value){ - return $this->_set(2, $value); - } - } -} - -namespace math { - - class FibArgs extends \DrSlump\Protobuf\Message { - - /** @var int */ - public $limit = null; - - - /** @var \Closure[] */ - protected static $__extensions = array(); - - public static function descriptor() - { - $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'math.FibArgs'); - - // OPTIONAL INT64 limit = 1 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "limit"; - $f->type = \DrSlump\Protobuf::TYPE_INT64; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - return $descriptor; - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasLimit(){ - return $this->_has(1); - } - - /** - * Clear value - * - * @return \math\FibArgs - */ - public function clearLimit(){ - return $this->_clear(1); - } - - /** - * Get value - * - * @return int - */ - public function getLimit(){ - return $this->_get(1); - } - - /** - * Set value - * - * @param int $value - * @return \math\FibArgs - */ - public function setLimit( $value){ - return $this->_set(1, $value); - } - } -} - -namespace math { - - class Num extends \DrSlump\Protobuf\Message { - - /** @var int */ - public $num = null; - - - /** @var \Closure[] */ - protected static $__extensions = array(); - - public static function descriptor() - { - $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'math.Num'); - - // OPTIONAL INT64 num = 1 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "num"; - $f->type = \DrSlump\Protobuf::TYPE_INT64; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - return $descriptor; - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasNum(){ - return $this->_has(1); - } - - /** - * Clear value - * - * @return \math\Num - */ - public function clearNum(){ - return $this->_clear(1); - } - - /** - * Get value - * - * @return int - */ - public function getNum(){ - return $this->_get(1); - } - - /** - * Set value - * - * @param int $value - * @return \math\Num - */ - public function setNum( $value){ - return $this->_set(1, $value); - } - } -} - -namespace math { - - class FibReply extends \DrSlump\Protobuf\Message { - - /** @var int */ - public $count = null; - - - /** @var \Closure[] */ - protected static $__extensions = array(); - - public static function descriptor() - { - $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'math.FibReply'); - - // OPTIONAL INT64 count = 1 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "count"; - $f->type = \DrSlump\Protobuf::TYPE_INT64; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - return $descriptor; - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasCount(){ - return $this->_has(1); - } - - /** - * Clear value - * - * @return \math\FibReply - */ - public function clearCount(){ - return $this->_clear(1); - } - - /** - * Get value - * - * @return int - */ - public function getCount(){ - return $this->_get(1); - } - - /** - * Set value - * - * @param int $value - * @return \math\FibReply - */ - public function setCount( $value){ - return $this->_set(1, $value); - } - } -} - -namespace math { - - class MathClient{ - - private $rpc_impl; - - public function __construct($rpc_impl) { - $this->rpc_impl = $rpc_impl; - } - /** - * @param math\DivArgs $input - */ - public function Div(\math\DivArgs $argument, $metadata = array()) { - return $this->rpc_impl->_simpleRequest('/math.Math/Div', $argument, '\math\DivReply::deserialize', $metadata); - } - /** - * @param math\DivArgs $input - */ - public function DivMany($metadata = array()) { - return $this->rpc_impl->_bidiRequest('/math.Math/DivMany', '\math\DivReply::deserialize', $metadata); - } - /** - * @param math\FibArgs $input - */ - public function Fib($argument, $metadata = array()) { - return $this->rpc_impl->_serverStreamRequest('/math.Math/Fib', $argument, '\math\Num::deserialize', $metadata); - } - /** - * @param math\Num $input - */ - public function Sum($arguments, $metadata = array()) { - return $this->rpc_impl->_clientStreamRequest('/math.Math/Sum', $arguments, '\math\Num::deserialize', $metadata); - } - } -} diff --git a/src/php/tests/interop/empty.php b/src/php/tests/interop/empty.php deleted file mode 100755 index 0004e30953..0000000000 --- a/src/php/tests/interop/empty.php +++ /dev/null @@ -1,26 +0,0 @@ -addField($cb(), true); - } - - return $descriptor; - } - } -} - diff --git a/src/php/tests/interop/message_set.php b/src/php/tests/interop/message_set.php deleted file mode 100755 index c35c6d74b2..0000000000 --- a/src/php/tests/interop/message_set.php +++ /dev/null @@ -1,26 +0,0 @@ -addField($cb(), true); - } - - return $descriptor; - } - } -} - diff --git a/src/php/tests/interop/messages.php b/src/php/tests/interop/messages.php deleted file mode 100755 index 5a3dff2c59..0000000000 --- a/src/php/tests/interop/messages.php +++ /dev/null @@ -1,1077 +0,0 @@ -number = 1; - $f->name = "type"; - $f->type = \DrSlump\Protobuf::TYPE_ENUM; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $f->reference = '\grpc\testing\PayloadType'; - $f->default = \grpc\testing\PayloadType::COMPRESSABLE; - $descriptor->addField($f); - - // OPTIONAL BYTES body = 2 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 2; - $f->name = "body"; - $f->type = \DrSlump\Protobuf::TYPE_BYTES; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - return $descriptor; - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasType(){ - return $this->_has(1); - } - - /** - * Clear value - * - * @return \grpc\testing\Payload - */ - public function clearType(){ - return $this->_clear(1); - } - - /** - * Get value - * - * @return int - \grpc\testing\PayloadType - */ - public function getType(){ - return $this->_get(1); - } - - /** - * Set value - * - * @param int - \grpc\testing\PayloadType $value - * @return \grpc\testing\Payload - */ - public function setType( $value){ - return $this->_set(1, $value); - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasBody(){ - return $this->_has(2); - } - - /** - * Clear value - * - * @return \grpc\testing\Payload - */ - public function clearBody(){ - return $this->_clear(2); - } - - /** - * Get value - * - * @return string - */ - public function getBody(){ - return $this->_get(2); - } - - /** - * Set value - * - * @param string $value - * @return \grpc\testing\Payload - */ - public function setBody( $value){ - return $this->_set(2, $value); - } - } -} - -namespace grpc\testing { - - class SimpleRequest extends \DrSlump\Protobuf\Message { - - /** @var int - \grpc\testing\PayloadType */ - public $response_type = \grpc\testing\PayloadType::COMPRESSABLE; - - /** @var int */ - public $response_size = null; - - /** @var \grpc\testing\Payload */ - public $payload = null; - - /** @var boolean */ - public $fill_username = null; - - /** @var boolean */ - public $fill_oauth_scope = null; - - - /** @var \Closure[] */ - protected static $__extensions = array(); - - public static function descriptor() - { - $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'grpc.testing.SimpleRequest'); - - // OPTIONAL ENUM response_type = 1 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "response_type"; - $f->type = \DrSlump\Protobuf::TYPE_ENUM; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $f->reference = '\grpc\testing\PayloadType'; - $f->default = \grpc\testing\PayloadType::COMPRESSABLE; - $descriptor->addField($f); - - // OPTIONAL INT32 response_size = 2 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 2; - $f->name = "response_size"; - $f->type = \DrSlump\Protobuf::TYPE_INT32; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $descriptor->addField($f); - - // OPTIONAL MESSAGE payload = 3 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 3; - $f->name = "payload"; - $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $f->reference = '\grpc\testing\Payload'; - $descriptor->addField($f); - - // OPTIONAL BOOL fill_username = 4 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 4; - $f->name = "fill_username"; - $f->type = \DrSlump\Protobuf::TYPE_BOOL; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $descriptor->addField($f); - - // OPTIONAL BOOL fill_oauth_scope = 5 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 5; - $f->name = "fill_oauth_scope"; - $f->type = \DrSlump\Protobuf::TYPE_BOOL; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - return $descriptor; - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasResponseType(){ - return $this->_has(1); - } - - /** - * Clear value - * - * @return \grpc\testing\SimpleRequest - */ - public function clearResponseType(){ - return $this->_clear(1); - } - - /** - * Get value - * - * @return int - \grpc\testing\PayloadType - */ - public function getResponseType(){ - return $this->_get(1); - } - - /** - * Set value - * - * @param int - \grpc\testing\PayloadType $value - * @return \grpc\testing\SimpleRequest - */ - public function setResponseType( $value){ - return $this->_set(1, $value); - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasResponseSize(){ - return $this->_has(2); - } - - /** - * Clear value - * - * @return \grpc\testing\SimpleRequest - */ - public function clearResponseSize(){ - return $this->_clear(2); - } - - /** - * Get value - * - * @return int - */ - public function getResponseSize(){ - return $this->_get(2); - } - - /** - * Set value - * - * @param int $value - * @return \grpc\testing\SimpleRequest - */ - public function setResponseSize( $value){ - return $this->_set(2, $value); - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasPayload(){ - return $this->_has(3); - } - - /** - * Clear value - * - * @return \grpc\testing\SimpleRequest - */ - public function clearPayload(){ - return $this->_clear(3); - } - - /** - * Get value - * - * @return \grpc\testing\Payload - */ - public function getPayload(){ - return $this->_get(3); - } - - /** - * Set value - * - * @param \grpc\testing\Payload $value - * @return \grpc\testing\SimpleRequest - */ - public function setPayload(\grpc\testing\Payload $value){ - return $this->_set(3, $value); - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasFillUsername(){ - return $this->_has(4); - } - - /** - * Clear value - * - * @return \grpc\testing\SimpleRequest - */ - public function clearFillUsername(){ - return $this->_clear(4); - } - - /** - * Get value - * - * @return boolean - */ - public function getFillUsername(){ - return $this->_get(4); - } - - /** - * Set value - * - * @param boolean $value - * @return \grpc\testing\SimpleRequest - */ - public function setFillUsername( $value){ - return $this->_set(4, $value); - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasFillOauthScope(){ - return $this->_has(5); - } - - /** - * Clear value - * - * @return \grpc\testing\SimpleRequest - */ - public function clearFillOauthScope(){ - return $this->_clear(5); - } - - /** - * Get value - * - * @return boolean - */ - public function getFillOauthScope(){ - return $this->_get(5); - } - - /** - * Set value - * - * @param boolean $value - * @return \grpc\testing\SimpleRequest - */ - public function setFillOauthScope( $value){ - return $this->_set(5, $value); - } - } -} - -namespace grpc\testing { - - class SimpleResponse extends \DrSlump\Protobuf\Message { - - /** @var \grpc\testing\Payload */ - public $payload = null; - - /** @var string */ - public $username = null; - - /** @var string */ - public $oauth_scope = null; - - - /** @var \Closure[] */ - protected static $__extensions = array(); - - public static function descriptor() - { - $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'grpc.testing.SimpleResponse'); - - // OPTIONAL MESSAGE payload = 1 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "payload"; - $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $f->reference = '\grpc\testing\Payload'; - $descriptor->addField($f); - - // OPTIONAL STRING username = 2 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 2; - $f->name = "username"; - $f->type = \DrSlump\Protobuf::TYPE_STRING; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $descriptor->addField($f); - - // OPTIONAL STRING oauth_scope = 3 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 3; - $f->name = "oauth_scope"; - $f->type = \DrSlump\Protobuf::TYPE_STRING; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - return $descriptor; - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasPayload(){ - return $this->_has(1); - } - - /** - * Clear value - * - * @return \grpc\testing\SimpleResponse - */ - public function clearPayload(){ - return $this->_clear(1); - } - - /** - * Get value - * - * @return \grpc\testing\Payload - */ - public function getPayload(){ - return $this->_get(1); - } - - /** - * Set value - * - * @param \grpc\testing\Payload $value - * @return \grpc\testing\SimpleResponse - */ - public function setPayload(\grpc\testing\Payload $value){ - return $this->_set(1, $value); - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasUsername(){ - return $this->_has(2); - } - - /** - * Clear value - * - * @return \grpc\testing\SimpleResponse - */ - public function clearUsername(){ - return $this->_clear(2); - } - - /** - * Get value - * - * @return string - */ - public function getUsername(){ - return $this->_get(2); - } - - /** - * Set value - * - * @param string $value - * @return \grpc\testing\SimpleResponse - */ - public function setUsername( $value){ - return $this->_set(2, $value); - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasOauthScope(){ - return $this->_has(3); - } - - /** - * Clear value - * - * @return \grpc\testing\SimpleResponse - */ - public function clearOauthScope(){ - return $this->_clear(3); - } - - /** - * Get value - * - * @return string - */ - public function getOauthScope(){ - return $this->_get(3); - } - - /** - * Set value - * - * @param string $value - * @return \grpc\testing\SimpleResponse - */ - public function setOauthScope( $value){ - return $this->_set(3, $value); - } - } -} - -namespace grpc\testing { - - class StreamingInputCallRequest extends \DrSlump\Protobuf\Message { - - /** @var \grpc\testing\Payload */ - public $payload = null; - - - /** @var \Closure[] */ - protected static $__extensions = array(); - - public static function descriptor() - { - $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'grpc.testing.StreamingInputCallRequest'); - - // OPTIONAL MESSAGE payload = 1 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "payload"; - $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $f->reference = '\grpc\testing\Payload'; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - return $descriptor; - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasPayload(){ - return $this->_has(1); - } - - /** - * Clear value - * - * @return \grpc\testing\StreamingInputCallRequest - */ - public function clearPayload(){ - return $this->_clear(1); - } - - /** - * Get value - * - * @return \grpc\testing\Payload - */ - public function getPayload(){ - return $this->_get(1); - } - - /** - * Set value - * - * @param \grpc\testing\Payload $value - * @return \grpc\testing\StreamingInputCallRequest - */ - public function setPayload(\grpc\testing\Payload $value){ - return $this->_set(1, $value); - } - } -} - -namespace grpc\testing { - - class StreamingInputCallResponse extends \DrSlump\Protobuf\Message { - - /** @var int */ - public $aggregated_payload_size = null; - - - /** @var \Closure[] */ - protected static $__extensions = array(); - - public static function descriptor() - { - $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'grpc.testing.StreamingInputCallResponse'); - - // OPTIONAL INT32 aggregated_payload_size = 1 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "aggregated_payload_size"; - $f->type = \DrSlump\Protobuf::TYPE_INT32; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - return $descriptor; - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasAggregatedPayloadSize(){ - return $this->_has(1); - } - - /** - * Clear value - * - * @return \grpc\testing\StreamingInputCallResponse - */ - public function clearAggregatedPayloadSize(){ - return $this->_clear(1); - } - - /** - * Get value - * - * @return int - */ - public function getAggregatedPayloadSize(){ - return $this->_get(1); - } - - /** - * Set value - * - * @param int $value - * @return \grpc\testing\StreamingInputCallResponse - */ - public function setAggregatedPayloadSize( $value){ - return $this->_set(1, $value); - } - } -} - -namespace grpc\testing { - - class ResponseParameters extends \DrSlump\Protobuf\Message { - - /** @var int */ - public $size = null; - - /** @var int */ - public $interval_us = null; - - - /** @var \Closure[] */ - protected static $__extensions = array(); - - public static function descriptor() - { - $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'grpc.testing.ResponseParameters'); - - // OPTIONAL INT32 size = 1 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "size"; - $f->type = \DrSlump\Protobuf::TYPE_INT32; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $descriptor->addField($f); - - // OPTIONAL INT32 interval_us = 2 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 2; - $f->name = "interval_us"; - $f->type = \DrSlump\Protobuf::TYPE_INT32; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - return $descriptor; - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasSize(){ - return $this->_has(1); - } - - /** - * Clear value - * - * @return \grpc\testing\ResponseParameters - */ - public function clearSize(){ - return $this->_clear(1); - } - - /** - * Get value - * - * @return int - */ - public function getSize(){ - return $this->_get(1); - } - - /** - * Set value - * - * @param int $value - * @return \grpc\testing\ResponseParameters - */ - public function setSize( $value){ - return $this->_set(1, $value); - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasIntervalUs(){ - return $this->_has(2); - } - - /** - * Clear value - * - * @return \grpc\testing\ResponseParameters - */ - public function clearIntervalUs(){ - return $this->_clear(2); - } - - /** - * Get value - * - * @return int - */ - public function getIntervalUs(){ - return $this->_get(2); - } - - /** - * Set value - * - * @param int $value - * @return \grpc\testing\ResponseParameters - */ - public function setIntervalUs( $value){ - return $this->_set(2, $value); - } - } -} - -namespace grpc\testing { - - class StreamingOutputCallRequest extends \DrSlump\Protobuf\Message { - - /** @var int - \grpc\testing\PayloadType */ - public $response_type = \grpc\testing\PayloadType::COMPRESSABLE; - - /** @var \grpc\testing\ResponseParameters[] */ - public $response_parameters = array(); - - /** @var \grpc\testing\Payload */ - public $payload = null; - - - /** @var \Closure[] */ - protected static $__extensions = array(); - - public static function descriptor() - { - $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'grpc.testing.StreamingOutputCallRequest'); - - // OPTIONAL ENUM response_type = 1 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "response_type"; - $f->type = \DrSlump\Protobuf::TYPE_ENUM; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $f->reference = '\grpc\testing\PayloadType'; - $f->default = \grpc\testing\PayloadType::COMPRESSABLE; - $descriptor->addField($f); - - // REPEATED MESSAGE response_parameters = 2 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 2; - $f->name = "response_parameters"; - $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; - $f->rule = \DrSlump\Protobuf::RULE_REPEATED; - $f->reference = '\grpc\testing\ResponseParameters'; - $descriptor->addField($f); - - // OPTIONAL MESSAGE payload = 3 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 3; - $f->name = "payload"; - $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $f->reference = '\grpc\testing\Payload'; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - return $descriptor; - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasResponseType(){ - return $this->_has(1); - } - - /** - * Clear value - * - * @return \grpc\testing\StreamingOutputCallRequest - */ - public function clearResponseType(){ - return $this->_clear(1); - } - - /** - * Get value - * - * @return int - \grpc\testing\PayloadType - */ - public function getResponseType(){ - return $this->_get(1); - } - - /** - * Set value - * - * @param int - \grpc\testing\PayloadType $value - * @return \grpc\testing\StreamingOutputCallRequest - */ - public function setResponseType( $value){ - return $this->_set(1, $value); - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasResponseParameters(){ - return $this->_has(2); - } - - /** - * Clear value - * - * @return \grpc\testing\StreamingOutputCallRequest - */ - public function clearResponseParameters(){ - return $this->_clear(2); - } - - /** - * Get value - * - * @param int $idx - * @return \grpc\testing\ResponseParameters - */ - public function getResponseParameters($idx = NULL){ - return $this->_get(2, $idx); - } - - /** - * Set value - * - * @param \grpc\testing\ResponseParameters $value - * @return \grpc\testing\StreamingOutputCallRequest - */ - public function setResponseParameters(\grpc\testing\ResponseParameters $value, $idx = NULL){ - return $this->_set(2, $value, $idx); - } - - /** - * Get all elements of - * - * @return \grpc\testing\ResponseParameters[] - */ - public function getResponseParametersList(){ - return $this->_get(2); - } - - /** - * Add a new element to - * - * @param \grpc\testing\ResponseParameters $value - * @return \grpc\testing\StreamingOutputCallRequest - */ - public function addResponseParameters(\grpc\testing\ResponseParameters $value){ - return $this->_add(2, $value); - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasPayload(){ - return $this->_has(3); - } - - /** - * Clear value - * - * @return \grpc\testing\StreamingOutputCallRequest - */ - public function clearPayload(){ - return $this->_clear(3); - } - - /** - * Get value - * - * @return \grpc\testing\Payload - */ - public function getPayload(){ - return $this->_get(3); - } - - /** - * Set value - * - * @param \grpc\testing\Payload $value - * @return \grpc\testing\StreamingOutputCallRequest - */ - public function setPayload(\grpc\testing\Payload $value){ - return $this->_set(3, $value); - } - } -} - -namespace grpc\testing { - - class StreamingOutputCallResponse extends \DrSlump\Protobuf\Message { - - /** @var \grpc\testing\Payload */ - public $payload = null; - - - /** @var \Closure[] */ - protected static $__extensions = array(); - - public static function descriptor() - { - $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'grpc.testing.StreamingOutputCallResponse'); - - // OPTIONAL MESSAGE payload = 1 - $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "payload"; - $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $f->reference = '\grpc\testing\Payload'; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } - - return $descriptor; - } - - /** - * Check if has a value - * - * @return boolean - */ - public function hasPayload(){ - return $this->_has(1); - } - - /** - * Clear value - * - * @return \grpc\testing\StreamingOutputCallResponse - */ - public function clearPayload(){ - return $this->_clear(1); - } - - /** - * Get value - * - * @return \grpc\testing\Payload - */ - public function getPayload(){ - return $this->_get(1); - } - - /** - * Set value - * - * @param \grpc\testing\Payload $value - * @return \grpc\testing\StreamingOutputCallResponse - */ - public function setPayload(\grpc\testing\Payload $value){ - return $this->_set(1, $value); - } - } -} - diff --git a/src/php/tests/interop/test.php b/src/php/tests/interop/test.php deleted file mode 100755 index 8a6cf76857..0000000000 --- a/src/php/tests/interop/test.php +++ /dev/null @@ -1,52 +0,0 @@ -rpc_impl = $rpc_impl; - } - /** - * @param grpc\testing\EmptyMessage $input - */ - public function EmptyCall(\grpc\testing\EmptyMessage $argument, $metadata = array()) { - return $this->rpc_impl->_simpleRequest('/grpc.testing.TestService/EmptyCall', $argument, '\grpc\testing\EmptyMessage::deserialize', $metadata); - } - /** - * @param grpc\testing\SimpleRequest $input - */ - public function UnaryCall(\grpc\testing\SimpleRequest $argument, $metadata = array()) { - return $this->rpc_impl->_simpleRequest('/grpc.testing.TestService/UnaryCall', $argument, '\grpc\testing\SimpleResponse::deserialize', $metadata); - } - /** - * @param grpc\testing\StreamingOutputCallRequest $input - */ - public function StreamingOutputCall($argument, $metadata = array()) { - return $this->rpc_impl->_serverStreamRequest('/grpc.testing.TestService/StreamingOutputCall', $argument, '\grpc\testing\StreamingOutputCallResponse::deserialize', $metadata); - } - /** - * @param grpc\testing\StreamingInputCallRequest $input - */ - public function StreamingInputCall($arguments, $metadata = array()) { - return $this->rpc_impl->_clientStreamRequest('/grpc.testing.TestService/StreamingInputCall', $arguments, '\grpc\testing\StreamingInputCallResponse::deserialize', $metadata); - } - /** - * @param grpc\testing\StreamingOutputCallRequest $input - */ - public function FullDuplexCall($metadata = array()) { - return $this->rpc_impl->_bidiRequest('/grpc.testing.TestService/FullDuplexCall', '\grpc\testing\StreamingOutputCallResponse::deserialize', $metadata); - } - /** - * @param grpc\testing\StreamingOutputCallRequest $input - */ - public function HalfDuplexCall($metadata = array()) { - return $this->rpc_impl->_bidiRequest('/grpc.testing.TestService/HalfDuplexCall', '\grpc\testing\StreamingOutputCallResponse::deserialize', $metadata); - } - } -} -- cgit v1.2.3 From 081cccc145edafb242575ed7dcda3b9780db1722 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 31 Mar 2015 18:20:04 -0700 Subject: Re-added overzealously removed file --- src/php/tests/interop/message_set.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 src/php/tests/interop/message_set.php diff --git a/src/php/tests/interop/message_set.php b/src/php/tests/interop/message_set.php new file mode 100755 index 0000000000..c35c6d74b2 --- /dev/null +++ b/src/php/tests/interop/message_set.php @@ -0,0 +1,26 @@ +addField($cb(), true); + } + + return $descriptor; + } + } +} + -- cgit v1.2.3 From d8cc6b8e7273cae65d1433ba695a5fd9816925ba Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 1 Apr 2015 11:14:16 -0700 Subject: Do not expect metadata until expecting first read --- src/php/lib/Grpc/AbstractCall.php | 1 + src/php/lib/Grpc/BidiStreamingCall.php | 14 +++++++++----- src/php/lib/Grpc/ClientStreamingCall.php | 7 +++---- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/php/lib/Grpc/AbstractCall.php b/src/php/lib/Grpc/AbstractCall.php index d81df97067..413d5966e1 100644 --- a/src/php/lib/Grpc/AbstractCall.php +++ b/src/php/lib/Grpc/AbstractCall.php @@ -47,6 +47,7 @@ abstract class AbstractCall { public function __construct(Channel $channel, $method, $deserialize) { $this->call = new Call($channel, $method, Timeval::inf_future()); $this->deserialize = $deserialize; + $this->metadata = null; } /** diff --git a/src/php/lib/Grpc/BidiStreamingCall.php b/src/php/lib/Grpc/BidiStreamingCall.php index 454f7621ae..2afceafce9 100644 --- a/src/php/lib/Grpc/BidiStreamingCall.php +++ b/src/php/lib/Grpc/BidiStreamingCall.php @@ -43,10 +43,7 @@ class BidiStreamingCall extends AbstractCall { * @param array $metadata Metadata to send with the call, if applicable */ public function start($metadata) { - $event = $this->call->start_batch([ - OP_SEND_INITIAL_METADATA => $metadata, - OP_RECV_INITIAL_METADATA => true]); - $this->metadata = $event->metadata; + $this->call->start_batch([OP_SEND_INITIAL_METADATA => $metadata]); } /** @@ -54,7 +51,14 @@ class BidiStreamingCall extends AbstractCall { * @return The next value from the server, or null if there is none */ public function read() { - $read_event = $this->call->start_batch([OP_RECV_MESSAGE => true]); + $batch = [OP_RECV_MESSAGE => true]; + if ($this->metadata === null) { + $batch[OP_RECV_INITIAL_METADATA] = true; + } + $read_event = $this->call->start_batch($batch); + if ($this->metadata === null) { + $this->metadata = $read_event->metadata; + } return $this->deserializeResponse($read_event->message); } diff --git a/src/php/lib/Grpc/ClientStreamingCall.php b/src/php/lib/Grpc/ClientStreamingCall.php index fa29037b42..ec585da985 100644 --- a/src/php/lib/Grpc/ClientStreamingCall.php +++ b/src/php/lib/Grpc/ClientStreamingCall.php @@ -44,10 +44,7 @@ class ClientStreamingCall extends AbstractCall { * @param array $metadata Metadata to send with the call, if applicable */ public function start($arg_iter, $metadata = array()) { - $event = $this->call->start_batch([ - OP_SEND_INITIAL_METADATA => $metadata, - OP_RECV_INITIAL_METADATA => true]); - $this->metadata = $event->metadata; + $event = $this->call->start_batch([OP_SEND_INITIAL_METADATA => $metadata]); foreach($arg_iter as $arg) { $this->call->start_batch([OP_SEND_MESSAGE => $arg->serialize()]); } @@ -60,8 +57,10 @@ class ClientStreamingCall extends AbstractCall { */ public function wait() { $event = $this->call->start_batch([ + OP_RECV_INITIAL_METADATA => true, OP_RECV_MESSAGE => true, OP_RECV_STATUS_ON_CLIENT => true]); + $this->metadata = $event->metadata; return array($this->deserializeResponse($event->message), $event->status); } } \ No newline at end of file -- cgit v1.2.3 From 650b2c71b9d9cd6bce62e6a961ca1268a1267d0e Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 1 Apr 2015 13:34:19 -0700 Subject: Generate interop-related code in docker build --- tools/dockerfile/grpc_php/Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/dockerfile/grpc_php/Dockerfile b/tools/dockerfile/grpc_php/Dockerfile index 0b4819841d..770d0d2627 100644 --- a/tools/dockerfile/grpc_php/Dockerfile +++ b/tools/dockerfile/grpc_php/Dockerfile @@ -48,4 +48,6 @@ RUN cd /var/local/git/grpc/src/php/ext/grpc \ RUN cd /var/local/git/grpc/src/php && composer install +RUN cd /var/local/git/grpc/src/php && protoc-gen-php -i tests/interop/ -o tests/interop/ tests/interop/test.proto + RUN cd /var/local/git/grpc/src/php && ./bin/run_tests.sh \ No newline at end of file -- cgit v1.2.3 From 5a5032dd4ce43aed1330ad31430f8c9b3e833a72 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Wed, 1 Apr 2015 13:54:44 -0700 Subject: Add a macro to enable replacing the default with a custom port picker --- include/grpc/support/port_platform.h | 2 +- test/core/util/port_posix.c | 7 ++++--- test/core/util/test_config.h | 4 ++++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/include/grpc/support/port_platform.h b/include/grpc/support/port_platform.h index 9b639cf82d..41185dbf64 100644 --- a/include/grpc/support/port_platform.h +++ b/include/grpc/support/port_platform.h @@ -199,7 +199,7 @@ #endif #if defined(GPR_POSIX_SOCKET) + defined(GPR_WIN32) != 1 -#error Must define exactly one of GPR_POSIX_POLLSET, GPR_WIN32 +#error Must define exactly one of GPR_POSIX_SOCKET, GPR_WIN32 #endif typedef int16_t gpr_int16; diff --git a/test/core/util/port_posix.c b/test/core/util/port_posix.c index 36f13e1b51..7467c2f9ea 100644 --- a/test/core/util/port_posix.c +++ b/test/core/util/port_posix.c @@ -32,7 +32,8 @@ */ #include -#ifdef GPR_POSIX_SOCKET +#include "test/core/util/test_config.h" +#if defined(GPR_POSIX_SOCKET) && defined(GRPC_TEST_PICK_PORT) #include "test/core/util/port.h" @@ -125,7 +126,7 @@ int grpc_pick_unused_port(void) { } else { port = 0; } - + if (!is_port_available(&port, is_tcp)) { continue; } @@ -155,4 +156,4 @@ int grpc_pick_unused_port_or_die(void) { return port; } -#endif /* GPR_POSIX_SOCKET */ +#endif /* GPR_POSIX_SOCKET && GRPC_TEST_PICK_PORT */ diff --git a/test/core/util/test_config.h b/test/core/util/test_config.h index 668a069f26..0b3c54373d 100644 --- a/test/core/util/test_config.h +++ b/test/core/util/test_config.h @@ -59,6 +59,10 @@ extern "C" { gpr_time_add(gpr_now(), \ gpr_time_from_micros(GRPC_TEST_SLOWDOWN_FACTOR * 1e3 * (x))) +#ifndef GRPC_TEST_CUSTOM_PICK_PORT +#define GRPC_TEST_PICK_PORT +#endif + void grpc_test_init(int argc, char **argv); #ifdef __cplusplus -- cgit v1.2.3 From 929481e1077b524073e0e3a5c6a2a40f37a74770 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Wed, 1 Apr 2015 13:58:25 -0700 Subject: add missing header into build.json and regenerate project --- build.json | 3 +++ vsprojects/vs2013/gpr_test_util.vcxproj | 3 +++ 2 files changed, 6 insertions(+) diff --git a/build.json b/build.json index 9e9a1cec67..1353b19855 100644 --- a/build.json +++ b/build.json @@ -350,6 +350,9 @@ "name": "gpr_test_util", "build": "private", "language": "c", + "headers": [ + "test/core/util/test_config.h" + ], "src": [ "test/core/util/test_config.c" ], diff --git a/vsprojects/vs2013/gpr_test_util.vcxproj b/vsprojects/vs2013/gpr_test_util.vcxproj index 04caa7e9b1..e0608b31fc 100644 --- a/vsprojects/vs2013/gpr_test_util.vcxproj +++ b/vsprojects/vs2013/gpr_test_util.vcxproj @@ -77,6 +77,9 @@ true + + + -- cgit v1.2.3 From 8242ba74e35d40b6ac1759b7dd4f5770d7ed57ae Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 1 Apr 2015 15:29:44 -0700 Subject: Made external header includes use angle brackets --- src/php/ext/grpc/byte_buffer.c | 12 ++++++------ src/php/ext/grpc/byte_buffer.h | 2 +- src/php/ext/grpc/call.c | 18 +++++++++--------- src/php/ext/grpc/call.h | 8 ++++---- src/php/ext/grpc/channel.c | 16 ++++++++-------- src/php/ext/grpc/channel.h | 8 ++++---- src/php/ext/grpc/credentials.c | 16 ++++++++-------- src/php/ext/grpc/php_grpc.c | 6 +++--- src/php/ext/grpc/server.c | 16 ++++++++-------- src/php/ext/grpc/server.h | 8 ++++---- src/php/ext/grpc/server_credentials.c | 16 ++++++++-------- src/php/ext/grpc/server_credentials.h | 10 +++++----- src/php/ext/grpc/timeval.c | 14 +++++++------- src/php/ext/grpc/timeval.h | 10 +++++----- 14 files changed, 80 insertions(+), 80 deletions(-) diff --git a/src/php/ext/grpc/byte_buffer.c b/src/php/ext/grpc/byte_buffer.c index 9f122d6da6..4f3e6b67af 100644 --- a/src/php/ext/grpc/byte_buffer.c +++ b/src/php/ext/grpc/byte_buffer.c @@ -35,18 +35,18 @@ #include "config.h" #endif -#include "php.h" -#include "php_ini.h" -#include "ext/standard/info.h" -#include "ext/spl/spl_exceptions.h" +#include +#include +#include +#include #include "php_grpc.h" #include #include "byte_buffer.h" -#include "grpc/grpc.h" -#include "grpc/support/slice.h" +#include +#include grpc_byte_buffer *string_to_byte_buffer(char *string, size_t length) { gpr_slice slice = gpr_slice_from_copied_buffer(string, length); diff --git a/src/php/ext/grpc/byte_buffer.h b/src/php/ext/grpc/byte_buffer.h index 7a40638591..0e9d1e7145 100644 --- a/src/php/ext/grpc/byte_buffer.h +++ b/src/php/ext/grpc/byte_buffer.h @@ -34,7 +34,7 @@ #ifndef NET_GRPC_PHP_GRPC_BYTE_BUFFER_H_ #define NET_GRPC_PHP_GRPC_BYTE_BUFFER_H_ -#include "grpc/grpc.h" +#include grpc_byte_buffer *string_to_byte_buffer(char *string, size_t length); diff --git a/src/php/ext/grpc/call.c b/src/php/ext/grpc/call.c index ba1b2a407d..6e83e79a4f 100644 --- a/src/php/ext/grpc/call.c +++ b/src/php/ext/grpc/call.c @@ -37,20 +37,20 @@ #include "config.h" #endif -#include "php.h" -#include "php_ini.h" -#include "ext/standard/info.h" -#include "ext/spl/spl_exceptions.h" +#include +#include +#include +#include #include "php_grpc.h" -#include "zend_exceptions.h" -#include "zend_hash.h" +#include +#include #include -#include "grpc/support/log.h" -#include "grpc/support/alloc.h" -#include "grpc/grpc.h" +#include +#include +#include #include "timeval.h" #include "channel.h" diff --git a/src/php/ext/grpc/call.h b/src/php/ext/grpc/call.h index 743effe5a1..e7eb9a75e2 100644 --- a/src/php/ext/grpc/call.h +++ b/src/php/ext/grpc/call.h @@ -38,12 +38,12 @@ #include "config.h" #endif -#include "php.h" -#include "php_ini.h" -#include "ext/standard/info.h" +#include +#include +#include #include "php_grpc.h" -#include "grpc/grpc.h" +#include /* Class entry for the Call PHP class */ extern zend_class_entry *grpc_ce_call; diff --git a/src/php/ext/grpc/channel.c b/src/php/ext/grpc/channel.c index c96fb128a6..51a3eae0f4 100644 --- a/src/php/ext/grpc/channel.c +++ b/src/php/ext/grpc/channel.c @@ -37,19 +37,19 @@ #include "config.h" #endif -#include "php.h" -#include "php_ini.h" -#include "ext/standard/info.h" -#include "ext/spl/spl_exceptions.h" +#include +#include +#include +#include #include "php_grpc.h" -#include "zend_exceptions.h" +#include #include -#include "grpc/grpc.h" -#include "grpc/support/log.h" -#include "grpc/grpc_security.h" +#include +#include +#include #include "server.h" #include "credentials.h" diff --git a/src/php/ext/grpc/channel.h b/src/php/ext/grpc/channel.h index 2c79668a4d..c13fa4c6d7 100755 --- a/src/php/ext/grpc/channel.h +++ b/src/php/ext/grpc/channel.h @@ -38,12 +38,12 @@ #include "config.h" #endif -#include "php.h" -#include "php_ini.h" -#include "ext/standard/info.h" +#include +#include +#include #include "php_grpc.h" -#include "grpc/grpc.h" +#include /* Class entry for the PHP Channel class */ extern zend_class_entry *grpc_ce_channel; diff --git a/src/php/ext/grpc/credentials.c b/src/php/ext/grpc/credentials.c index a94b0eac2d..a262b9981f 100644 --- a/src/php/ext/grpc/credentials.c +++ b/src/php/ext/grpc/credentials.c @@ -37,17 +37,17 @@ #include "config.h" #endif -#include "php.h" -#include "php_ini.h" -#include "ext/standard/info.h" -#include "ext/spl/spl_exceptions.h" +#include +#include +#include +#include #include "php_grpc.h" -#include "zend_exceptions.h" -#include "zend_hash.h" +#include +#include -#include "grpc/grpc.h" -#include "grpc/grpc_security.h" +#include +#include zend_class_entry *grpc_ce_credentials; diff --git a/src/php/ext/grpc/php_grpc.c b/src/php/ext/grpc/php_grpc.c index 1f9edfe881..3e669ecd17 100644 --- a/src/php/ext/grpc/php_grpc.c +++ b/src/php/ext/grpc/php_grpc.c @@ -42,9 +42,9 @@ #include "config.h" #endif -#include "php.h" -#include "php_ini.h" -#include "ext/standard/info.h" +#include +#include +#include #include "php_grpc.h" // ZEND_DECLARE_MODULE_GLOBALS(grpc) diff --git a/src/php/ext/grpc/server.c b/src/php/ext/grpc/server.c index 86b29958fb..46fe745c5a 100644 --- a/src/php/ext/grpc/server.c +++ b/src/php/ext/grpc/server.c @@ -37,19 +37,19 @@ #include "config.h" #endif -#include "php.h" -#include "php_ini.h" -#include "ext/standard/info.h" -#include "ext/spl/spl_exceptions.h" +#include +#include +#include +#include #include "php_grpc.h" -#include "zend_exceptions.h" +#include #include -#include "grpc/grpc.h" -#include "grpc/support/log.h" -#include "grpc/grpc_security.h" +#include +#include +#include #include "server.h" #include "channel.h" diff --git a/src/php/ext/grpc/server.h b/src/php/ext/grpc/server.h index ebb8d25ae1..a2ee2ff5a9 100755 --- a/src/php/ext/grpc/server.h +++ b/src/php/ext/grpc/server.h @@ -38,12 +38,12 @@ #include "config.h" #endif -#include "php.h" -#include "php_ini.h" -#include "ext/standard/info.h" +#include +#include +#include #include "php_grpc.h" -#include "grpc/grpc.h" +#include /* Class entry for the Server PHP class */ extern zend_class_entry *grpc_ce_server; diff --git a/src/php/ext/grpc/server_credentials.c b/src/php/ext/grpc/server_credentials.c index df64e65986..c4c1fabb1a 100644 --- a/src/php/ext/grpc/server_credentials.c +++ b/src/php/ext/grpc/server_credentials.c @@ -37,17 +37,17 @@ #include "config.h" #endif -#include "php.h" -#include "php_ini.h" -#include "ext/standard/info.h" -#include "ext/spl/spl_exceptions.h" +#include +#include +#include +#include #include "php_grpc.h" -#include "zend_exceptions.h" -#include "zend_hash.h" +#include +#include -#include "grpc/grpc.h" -#include "grpc/grpc_security.h" +#include +#include zend_class_entry *grpc_ce_server_credentials; diff --git a/src/php/ext/grpc/server_credentials.h b/src/php/ext/grpc/server_credentials.h index 8ed3697150..7101d65000 100755 --- a/src/php/ext/grpc/server_credentials.h +++ b/src/php/ext/grpc/server_credentials.h @@ -38,13 +38,13 @@ #include "config.h" #endif -#include "php.h" -#include "php_ini.h" -#include "ext/standard/info.h" +#include +#include +#include #include "php_grpc.h" -#include "grpc/grpc.h" -#include "grpc/grpc_security.h" +#include +#include /* Class entry for the Server_Credentials PHP class */ extern zend_class_entry *grpc_ce_server_credentials; diff --git a/src/php/ext/grpc/timeval.c b/src/php/ext/grpc/timeval.c index f90f0062ba..1c9542dbff 100644 --- a/src/php/ext/grpc/timeval.c +++ b/src/php/ext/grpc/timeval.c @@ -37,18 +37,18 @@ #include "config.h" #endif -#include "php.h" -#include "php_ini.h" -#include "ext/standard/info.h" -#include "ext/spl/spl_exceptions.h" +#include +#include +#include +#include #include "php_grpc.h" -#include "zend_exceptions.h" +#include #include -#include "grpc/grpc.h" -#include "grpc/support/time.h" +#include +#include zend_class_entry *grpc_ce_timeval; diff --git a/src/php/ext/grpc/timeval.h b/src/php/ext/grpc/timeval.h index e3183f691d..07cef037cb 100755 --- a/src/php/ext/grpc/timeval.h +++ b/src/php/ext/grpc/timeval.h @@ -38,13 +38,13 @@ #include "config.h" #endif -#include "php.h" -#include "php_ini.h" -#include "ext/standard/info.h" +#include +#include +#include #include "php_grpc.h" -#include "grpc/grpc.h" -#include "grpc/support/time.h" +#include +#include /* Class entry for the Timeval PHP Class */ extern zend_class_entry *grpc_ce_timeval; -- cgit v1.2.3 From 7eb76cc78043b79dfcb9316c3f2e0a0baa19e696 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Wed, 1 Apr 2015 15:52:08 -0700 Subject: make target of port.c depend on test_config --- build.json | 1 + vsprojects/vs2013/grpc.sln | 1 + vsprojects/vs2013/grpc_test_util.vcxproj | 3 +++ 3 files changed, 5 insertions(+) diff --git a/build.json b/build.json index 1353b19855..1e7ab9661b 100644 --- a/build.json +++ b/build.json @@ -437,6 +437,7 @@ ], "deps": [ "gpr", + "gpr_test_util", "grpc" ], "vs_project_guid": "{17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}" diff --git a/vsprojects/vs2013/grpc.sln b/vsprojects/vs2013/grpc.sln index a3915b3591..4e56edd9ff 100644 --- a/vsprojects/vs2013/grpc.sln +++ b/vsprojects/vs2013/grpc.sln @@ -18,6 +18,7 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc_test_util", "grpc_test_util.vcxproj", "{17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}" ProjectSection(ProjectDependencies) = postProject {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + {EAB0A629-17A9-44DB-B5FF-E91A721FE037} = {EAB0A629-17A9-44DB-B5FF-E91A721FE037} {29D16885-7228-4C31-81ED-5F9187C7F2A9} = {29D16885-7228-4C31-81ED-5F9187C7F2A9} EndProjectSection EndProject diff --git a/vsprojects/vs2013/grpc_test_util.vcxproj b/vsprojects/vs2013/grpc_test_util.vcxproj index 7269671bd3..4756f53928 100644 --- a/vsprojects/vs2013/grpc_test_util.vcxproj +++ b/vsprojects/vs2013/grpc_test_util.vcxproj @@ -105,6 +105,9 @@ {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + + {EAB0A629-17A9-44DB-B5FF-E91A721FE037} + {29D16885-7228-4C31-81ED-5F9187C7F2A9} -- cgit v1.2.3 From 9e0ee11756cd79078fec5e4e3a8d25ec59a70ae9 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 1 Apr 2015 16:29:01 -0700 Subject: Removed pedantic flag from PHP build --- src/php/ext/grpc/config.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/php/ext/grpc/config.m4 b/src/php/ext/grpc/config.m4 index d1a8decb73..11778e3bb6 100755 --- a/src/php/ext/grpc/config.m4 +++ b/src/php/ext/grpc/config.m4 @@ -66,5 +66,5 @@ if test "$PHP_GRPC" != "no"; then PHP_SUBST(GRPC_SHARED_LIBADD) - PHP_NEW_EXTENSION(grpc, byte_buffer.c call.c channel.c credentials.c timeval.c server.c server_credentials.c php_grpc.c, $ext_shared, , -Wall -Werror -pedantic -std=c99) + PHP_NEW_EXTENSION(grpc, byte_buffer.c call.c channel.c credentials.c timeval.c server.c server_credentials.c php_grpc.c, $ext_shared, , -Wall -Werror -std=c11) fi -- cgit v1.2.3 From bbbb3a001643408d00ff74eb891a54f935ce21d4 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 1 Apr 2015 16:29:41 -0700 Subject: Updated scripts with PHP 5.6's build location --- src/php/bin/interop_client.sh | 5 ++++- src/php/bin/run_tests.sh | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/php/bin/interop_client.sh b/src/php/bin/interop_client.sh index 2c61ea8aa0..75cfda9f85 100755 --- a/src/php/bin/interop_client.sh +++ b/src/php/bin/interop_client.sh @@ -31,5 +31,8 @@ set +e cd $(dirname $0) -php -d extension_dir=../ext/grpc/modules/ -d extension=grpc.so \ + +module_dir=`php --version | grep -q 'PHP 5.6' && echo '../ext/grpc' || '../ext/grpc/modules'` + +php -d extension_dir=$module_dir -d extension=grpc.so \ ../tests/interop/interop_client.php $@ 1>&2 diff --git a/src/php/bin/run_tests.sh b/src/php/bin/run_tests.sh index c3358ed899..a8e806b0f3 100755 --- a/src/php/bin/run_tests.sh +++ b/src/php/bin/run_tests.sh @@ -34,13 +34,15 @@ set -e cd $(dirname $0) default_extension_dir=`php -i | grep extension_dir | sed 's/.*=> //g'` +module_dir=`php --version | grep -q 'PHP 5.6' && echo '../ext/grpc' || '../ext/grpc/modules'` + # sym-link in system supplied extensions for f in $default_extension_dir/*.so do - ln -s $f ../ext/grpc/modules/$(basename $f) &> /dev/null || true + ln -s $f $module_dir/$(basename $f) &> /dev/null || true done php \ - -d extension_dir=../ext/grpc/modules/ \ + -d extension_dir=$module_dir \ -d extension=grpc.so \ `which phpunit` -v --debug --strict ../tests/unit_tests -- cgit v1.2.3 From bfa9e4f8220a59663fb789d53af1332fe456eeae Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 1 Apr 2015 16:38:49 -0700 Subject: Fixed scripts again for PHP 5.5 --- src/php/bin/interop_client.sh | 2 +- src/php/bin/run_tests.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/php/bin/interop_client.sh b/src/php/bin/interop_client.sh index 75cfda9f85..22e4a493c4 100755 --- a/src/php/bin/interop_client.sh +++ b/src/php/bin/interop_client.sh @@ -32,7 +32,7 @@ set +e cd $(dirname $0) -module_dir=`php --version | grep -q 'PHP 5.6' && echo '../ext/grpc' || '../ext/grpc/modules'` +module_dir=`php --version | grep -q 'PHP 5.6' && echo '../ext/grpc' || echo '../ext/grpc/modules'` php -d extension_dir=$module_dir -d extension=grpc.so \ ../tests/interop/interop_client.php $@ 1>&2 diff --git a/src/php/bin/run_tests.sh b/src/php/bin/run_tests.sh index a8e806b0f3..1335672e9e 100755 --- a/src/php/bin/run_tests.sh +++ b/src/php/bin/run_tests.sh @@ -34,7 +34,7 @@ set -e cd $(dirname $0) default_extension_dir=`php -i | grep extension_dir | sed 's/.*=> //g'` -module_dir=`php --version | grep -q 'PHP 5.6' && echo '../ext/grpc' || '../ext/grpc/modules'` +module_dir=`php --version | grep -q 'PHP 5.6' && echo '../ext/grpc' || echo '../ext/grpc/modules'` # sym-link in system supplied extensions for f in $default_extension_dir/*.so -- cgit v1.2.3 From 841f90f86fa30d87502bd968a2ebdbd4556710d2 Mon Sep 17 00:00:00 2001 From: Masood Malekghassemi Date: Wed, 1 Apr 2015 10:35:17 -0700 Subject: Add metadata support to low-level Python framework --- src/python/src/grpc/_adapter/_call.c | 21 ++++++- src/python/src/grpc/_adapter/_completion_queue.c | 75 ++++++++++++++++++------ src/python/src/grpc/_adapter/_datatypes.py | 2 +- src/python/src/grpc/_adapter/_low_test.py | 45 +++++++++++++- 4 files changed, 121 insertions(+), 22 deletions(-) diff --git a/src/python/src/grpc/_adapter/_call.c b/src/python/src/grpc/_adapter/_call.c index d8806e5680..f837267e9a 100644 --- a/src/python/src/grpc/_adapter/_call.c +++ b/src/python/src/grpc/_adapter/_call.c @@ -160,8 +160,22 @@ static const PyObject *pygrpc_call_accept(Call *self, PyObject *args) { return result; } +static const PyObject *pygrpc_call_add_metadata(Call *self, PyObject *args) { + const char* key = NULL; + const char* value = NULL; + int value_length = 0; + if (!PyArg_ParseTuple(args, "ss#", &key, &value, &value_length)) { + return NULL; + } + grpc_metadata metadata; + metadata.key = key; + metadata.value = value; + metadata.value_length = value_length; + return pygrpc_translate_call_error( + grpc_call_add_metadata_old(self->c_call, &metadata, 0)); +} + static const PyObject *pygrpc_call_premetadata(Call *self) { - /* TODO(nathaniel): Metadata support. */ return pygrpc_translate_call_error( grpc_call_server_end_initial_metadata_old(self->c_call, 0)); } @@ -236,6 +250,11 @@ static PyMethodDef methods[] = { {"complete", (PyCFunction)pygrpc_call_complete, METH_O, "Complete writes to this call."}, {"accept", (PyCFunction)pygrpc_call_accept, METH_VARARGS, "Accept an RPC."}, + {"add_metadata", (PyCFunction)pygrpc_call_add_metadata, METH_VARARGS, + "Add metadata to the call. May not be called after invoke on the client " + "side. On the server side: when called before premetadata it provides " + "'leading' metadata, when called after premetadata but before status it " + "provides 'trailing metadata'; may not be called after status."}, {"premetadata", (PyCFunction)pygrpc_call_premetadata, METH_VARARGS, "Indicate the end of leading metadata in the response."}, {"read", (PyCFunction)pygrpc_call_read, METH_O, diff --git a/src/python/src/grpc/_adapter/_completion_queue.c b/src/python/src/grpc/_adapter/_completion_queue.c index b56ca1926e..76d6b6cb44 100644 --- a/src/python/src/grpc/_adapter/_completion_queue.c +++ b/src/python/src/grpc/_adapter/_completion_queue.c @@ -115,35 +115,56 @@ static PyObject *pygrpc_status_code(grpc_status_code c_status_code) { } } +static PyObject *pygrpc_metadata_collection_get( + grpc_metadata *metadata_elements, size_t count) { + PyObject *metadata = PyList_New(count); + size_t i; + for (i = 0; i < count; ++i) { + grpc_metadata elem = metadata_elements[i]; + PyObject *key = PyString_FromString(elem.key); + PyObject *value = PyString_FromStringAndSize(elem.value, elem.value_length); + PyObject* kvp = PyTuple_Pack(2, key, value); + // n.b. PyList_SetItem *steals* a reference to the set element. + PyList_SetItem(metadata, i, kvp); + Py_DECREF(key); + Py_DECREF(value); + } + return metadata; +} + static PyObject *pygrpc_stop_event_args(grpc_event *c_event) { - return PyTuple_Pack(7, stop_event_kind, Py_None, Py_None, Py_None, - Py_None, Py_None, Py_None); + return PyTuple_Pack(8, stop_event_kind, Py_None, Py_None, Py_None, + Py_None, Py_None, Py_None, Py_None); } static PyObject *pygrpc_write_event_args(grpc_event *c_event) { PyObject *write_accepted = c_event->data.write_accepted == GRPC_OP_OK ? Py_True : Py_False; - return PyTuple_Pack(7, write_event_kind, (PyObject *)c_event->tag, - write_accepted, Py_None, Py_None, Py_None, Py_None); + return PyTuple_Pack(8, write_event_kind, (PyObject *)c_event->tag, + write_accepted, Py_None, Py_None, Py_None, Py_None, + Py_None); } static PyObject *pygrpc_complete_event_args(grpc_event *c_event) { PyObject *complete_accepted = c_event->data.finish_accepted == GRPC_OP_OK ? Py_True : Py_False; - return PyTuple_Pack(7, complete_event_kind, (PyObject *)c_event->tag, - Py_None, complete_accepted, Py_None, Py_None, Py_None); + return PyTuple_Pack(8, complete_event_kind, (PyObject *)c_event->tag, + Py_None, complete_accepted, Py_None, Py_None, Py_None, + Py_None); } static PyObject *pygrpc_service_event_args(grpc_event *c_event) { if (c_event->data.server_rpc_new.method == NULL) { - return PyTuple_Pack(7, service_event_kind, c_event->tag, - Py_None, Py_None, Py_None, Py_None, Py_None); + return PyTuple_Pack( + 8, service_event_kind, c_event->tag, Py_None, Py_None, Py_None, Py_None, + Py_None, Py_None); } else { PyObject *method = NULL; PyObject *host = NULL; PyObject *service_deadline = NULL; Call *call = NULL; PyObject *service_acceptance = NULL; + PyObject *metadata = NULL; PyObject *event_args = NULL; method = PyBytes_FromString(c_event->data.server_rpc_new.method); @@ -173,11 +194,16 @@ static PyObject *pygrpc_service_event_args(grpc_event *c_event) { goto error; } - event_args = PyTuple_Pack(7, service_event_kind, + metadata = pygrpc_metadata_collection_get( + c_event->data.server_rpc_new.metadata_elements, + c_event->data.server_rpc_new.metadata_count); + event_args = PyTuple_Pack(8, service_event_kind, (PyObject *)c_event->tag, Py_None, Py_None, - service_acceptance, Py_None, Py_None); + service_acceptance, Py_None, Py_None, + metadata); Py_DECREF(service_acceptance); + Py_DECREF(metadata); error: Py_XDECREF(call); Py_XDECREF(method); @@ -190,8 +216,8 @@ error: static PyObject *pygrpc_read_event_args(grpc_event *c_event) { if (c_event->data.read == NULL) { - return PyTuple_Pack(7, read_event_kind, (PyObject *)c_event->tag, - Py_None, Py_None, Py_None, Py_None, Py_None); + return PyTuple_Pack(8, read_event_kind, (PyObject *)c_event->tag, + Py_None, Py_None, Py_None, Py_None, Py_None, Py_None); } else { size_t length; size_t offset; @@ -216,17 +242,23 @@ static PyObject *pygrpc_read_event_args(grpc_event *c_event) { if (bytes == NULL) { return NULL; } - event_args = PyTuple_Pack(7, read_event_kind, (PyObject *)c_event->tag, - Py_None, Py_None, Py_None, bytes, Py_None); + event_args = PyTuple_Pack(8, read_event_kind, (PyObject *)c_event->tag, + Py_None, Py_None, Py_None, bytes, Py_None, + Py_None); Py_DECREF(bytes); return event_args; } } static PyObject *pygrpc_metadata_event_args(grpc_event *c_event) { - /* TODO(nathaniel): Actual transmission of metadata. */ - return PyTuple_Pack(7, metadata_event_kind, (PyObject *)c_event->tag, - Py_None, Py_None, Py_None, Py_None, Py_None); + PyObject *metadata = pygrpc_metadata_collection_get( + c_event->data.client_metadata_read.elements, + c_event->data.client_metadata_read.count); + PyObject* result = PyTuple_Pack( + 8, metadata_event_kind, (PyObject *)c_event->tag, Py_None, Py_None, + Py_None, Py_None, Py_None, metadata); + Py_DECREF(metadata); + return result; } static PyObject *pygrpc_finished_event_args(grpc_event *c_event) { @@ -253,9 +285,14 @@ static PyObject *pygrpc_finished_event_args(grpc_event *c_event) { if (status == NULL) { return NULL; } - event_args = PyTuple_Pack(7, finish_event_kind, (PyObject *)c_event->tag, - Py_None, Py_None, Py_None, Py_None, status); + PyObject* metadata = pygrpc_metadata_collection_get( + c_event->data.finished.metadata_elements, + c_event->data.finished.metadata_count); + event_args = PyTuple_Pack(8, finish_event_kind, (PyObject *)c_event->tag, + Py_None, Py_None, Py_None, Py_None, status, + metadata); Py_DECREF(status); + Py_DECREF(metadata); return event_args; } diff --git a/src/python/src/grpc/_adapter/_datatypes.py b/src/python/src/grpc/_adapter/_datatypes.py index e271ec83b9..3b22784243 100644 --- a/src/python/src/grpc/_adapter/_datatypes.py +++ b/src/python/src/grpc/_adapter/_datatypes.py @@ -70,7 +70,7 @@ class Event( collections.namedtuple( 'Event', ['kind', 'tag', 'write_accepted', 'complete_accepted', - 'service_acceptance', 'bytes', 'status'])): + 'service_acceptance', 'bytes', 'status', 'metadata'])): """Describes an event emitted from a completion queue.""" @enum.unique diff --git a/src/python/src/grpc/_adapter/_low_test.py b/src/python/src/grpc/_adapter/_low_test.py index b04ac1c950..e88b70969c 100644 --- a/src/python/src/grpc/_adapter/_low_test.py +++ b/src/python/src/grpc/_adapter/_low_test.py @@ -115,6 +115,18 @@ class EchoTest(unittest.TestCase): def _perform_echo_test(self, test_data): method = 'test method' details = 'test details' + server_leading_metadata_key = 'my_server_leading_key' + server_leading_metadata_value = 'my_server_leading_value' + server_trailing_metadata_key = 'my_server_trailing_key' + server_trailing_metadata_value = 'my_server_trailing_value' + client_metadata_key = 'my_client_key' + client_metadata_value = 'my_client_value' + server_leading_binary_metadata_key = 'my_server_leading_key-bin' + server_leading_binary_metadata_value = b'\0'*2047 + server_trailing_binary_metadata_key = 'my_server_trailing_key-bin' + server_trailing_binary_metadata_value = b'\0'*2047 + client_binary_metadata_key = 'my_client_key-bin' + client_binary_metadata_value = b'\0'*2047 deadline = _FUTURE metadata_tag = object() finish_tag = object() @@ -128,6 +140,9 @@ class EchoTest(unittest.TestCase): client_data = [] client_call = _low.Call(self.channel, method, self.host, deadline) + client_call.add_metadata(client_metadata_key, client_metadata_value) + client_call.add_metadata(client_binary_metadata_key, + client_binary_metadata_value) client_call.invoke(self.client_completion_queue, metadata_tag, finish_tag) @@ -139,15 +154,31 @@ class EchoTest(unittest.TestCase): self.assertEqual(method, service_accepted.service_acceptance.method) self.assertEqual(self.host, service_accepted.service_acceptance.host) self.assertIsNotNone(service_accepted.service_acceptance.call) + metadata = dict(service_accepted.metadata) + self.assertIn(client_metadata_key, metadata) + self.assertEqual(client_metadata_value, metadata[client_metadata_key]) + self.assertIn(client_binary_metadata_key, metadata) + self.assertEqual(client_binary_metadata_value, + metadata[client_binary_metadata_key]) server_call = service_accepted.service_acceptance.call server_call.accept(self.server_completion_queue, finish_tag) + server_call.add_metadata(server_leading_metadata_key, + server_leading_metadata_value) + server_call.add_metadata(server_leading_binary_metadata_key, + server_leading_binary_metadata_value) server_call.premetadata() metadata_accepted = self.client_completion_queue.get(_FUTURE) self.assertIsNotNone(metadata_accepted) self.assertEqual(_low.Event.Kind.METADATA_ACCEPTED, metadata_accepted.kind) self.assertEqual(metadata_tag, metadata_accepted.tag) - # TODO(nathaniel): Test transmission and reception of metadata. + metadata = dict(metadata_accepted.metadata) + self.assertIn(server_leading_metadata_key, metadata) + self.assertEqual(server_leading_metadata_value, + metadata[server_leading_metadata_key]) + self.assertIn(server_leading_binary_metadata_key, metadata) + self.assertEqual(server_leading_binary_metadata_value, + metadata[server_leading_binary_metadata_key]) for datum in test_data: client_call.write(datum, write_tag) @@ -194,6 +225,11 @@ class EchoTest(unittest.TestCase): self.assertEqual(read_tag, read_accepted.tag) self.assertIsNone(read_accepted.bytes) + server_call.add_metadata(server_trailing_metadata_key, + server_trailing_metadata_value) + server_call.add_metadata(server_trailing_binary_metadata_key, + server_trailing_binary_metadata_value) + server_call.status(_low.Status(_low.Code.OK, details), status_tag) server_terminal_event_one = self.server_completion_queue.get(_FUTURE) server_terminal_event_two = self.server_completion_queue.get(_FUTURE) @@ -229,6 +265,13 @@ class EchoTest(unittest.TestCase): self.assertEqual(_low.Event.Kind.FINISH, finish_accepted.kind) self.assertEqual(finish_tag, finish_accepted.tag) self.assertEqual(_low.Status(_low.Code.OK, details), finish_accepted.status) + metadata = dict(finish_accepted.metadata) + self.assertIn(server_trailing_metadata_key, metadata) + self.assertEqual(server_trailing_metadata_value, + metadata[server_trailing_metadata_key]) + self.assertIn(server_trailing_binary_metadata_key, metadata) + self.assertEqual(server_trailing_binary_metadata_value, + metadata[server_trailing_binary_metadata_key]) server_timeout_none_event = self.server_completion_queue.get(0) self.assertIsNone(server_timeout_none_event) -- cgit v1.2.3 From 7f13eb2348012e318a78a32ab379b4e27ec71cb4 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Wed, 1 Apr 2015 20:57:33 -0700 Subject: Shutting off warnings about control paths. --- src/core/httpcli/parser.c | 2 ++ src/core/transport/chttp2_transport.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/core/httpcli/parser.c b/src/core/httpcli/parser.c index f4decda98a..7b2a62060c 100644 --- a/src/core/httpcli/parser.c +++ b/src/core/httpcli/parser.c @@ -177,6 +177,8 @@ static int addbyte(grpc_httpcli_parser *parser, gpr_uint8 byte) { } gpr_log(GPR_ERROR, "should never reach here"); abort(); + + return 0; } void grpc_httpcli_parser_init(grpc_httpcli_parser *parser) { diff --git a/src/core/transport/chttp2_transport.c b/src/core/transport/chttp2_transport.c index 2b15b2a812..4c0394d46f 100644 --- a/src/core/transport/chttp2_transport.c +++ b/src/core/transport/chttp2_transport.c @@ -1710,6 +1710,8 @@ static int process_read(transport *t, gpr_slice slice) { gpr_log(GPR_ERROR, "should never reach here"); abort(); + + return 0; } /* tcp read callback */ -- cgit v1.2.3 From b53af532afaf9458ea279d3a97e249bd59732f0f Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Thu, 2 Apr 2015 09:24:39 -0700 Subject: Bug fix. User can destroy status after calling Finish and we should keep a copy of it instead of a pointer --- include/grpc++/impl/call.h | 4 +++- src/cpp/common/call.cc | 16 ++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h index e117ac6313..7ba758040b 100644 --- a/include/grpc++/impl/call.h +++ b/include/grpc++/impl/call.h @@ -109,7 +109,9 @@ class CallOpBuffer : public CompletionQueueTag { char* status_details_; size_t status_details_capacity_; // Server send status - const Status* send_status_; + bool send_status_; + grpc_status_code send_status_code_; + grpc::string send_status_details_; size_t trailing_metadata_count_; grpc_metadata* trailing_metadata_; int cancelled_buf_; diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index 1599e5117f..b013f28ac3 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -60,7 +60,8 @@ CallOpBuffer::CallOpBuffer() status_code_(GRPC_STATUS_OK), status_details_(nullptr), status_details_capacity_(0), - send_status_(nullptr), + send_status_(false), + send_status_code_(GRPC_STATUS_OK), trailing_metadata_count_(0), trailing_metadata_(nullptr), cancelled_buf_(0), @@ -104,7 +105,9 @@ void CallOpBuffer::Reset(void* next_return_tag) { status_code_ = GRPC_STATUS_OK; - send_status_ = nullptr; + send_status_ = false; + send_status_code_ = GRPC_STATUS_OK; + send_status_details_.clear(); trailing_metadata_count_ = 0; trailing_metadata_ = nullptr; @@ -208,7 +211,9 @@ void CallOpBuffer::AddServerSendStatus( } else { trailing_metadata_count_ = 0; } - send_status_ = &status; + send_status_ = true; + send_status_code_ = static_cast(status.code()); + send_status_details_ = status.details(); } void CallOpBuffer::FillOps(grpc_op* ops, size_t* nops) { @@ -263,10 +268,9 @@ void CallOpBuffer::FillOps(grpc_op* ops, size_t* nops) { trailing_metadata_count_; ops[*nops].data.send_status_from_server.trailing_metadata = trailing_metadata_; - ops[*nops].data.send_status_from_server.status = - static_cast(send_status_->code()); + ops[*nops].data.send_status_from_server.status = send_status_code_; ops[*nops].data.send_status_from_server.status_details = - send_status_->details().c_str(); + send_status_details_.empty() ? nullptr : send_status_details_.c_str(); (*nops)++; } if (recv_closed_) { -- cgit v1.2.3 From c1d7e24751c50c0d1471498454f9a657dc0dcb01 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 2 Apr 2015 10:02:43 -0700 Subject: Changed C files to have camelCase method names --- src/php/ext/grpc/call.c | 4 ++-- src/php/ext/grpc/server.c | 12 ++++++------ src/php/ext/grpc/timeval.c | 12 ++++++------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/php/ext/grpc/call.c b/src/php/ext/grpc/call.c index 6e83e79a4f..6bc65b5367 100644 --- a/src/php/ext/grpc/call.c +++ b/src/php/ext/grpc/call.c @@ -263,7 +263,7 @@ PHP_METHOD(Call, __construct) { * @param array batch Array of actions to take * @return object Object with results of all actions */ -PHP_METHOD(Call, start_batch) { +PHP_METHOD(Call, startBatch) { wrapped_grpc_call *call = (wrapped_grpc_call *)zend_object_store_get_object(getThis() TSRMLS_CC); grpc_op ops[8]; @@ -494,7 +494,7 @@ PHP_METHOD(Call, cancel) { static zend_function_entry call_methods[] = { PHP_ME(Call, __construct, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR) - PHP_ME(Call, start_batch, NULL, ZEND_ACC_PUBLIC) + PHP_ME(Call, startBatch, NULL, ZEND_ACC_PUBLIC) PHP_ME(Call, cancel, NULL, ZEND_ACC_PUBLIC) PHP_FE_END}; void grpc_init_call(TSRMLS_D) { diff --git a/src/php/ext/grpc/server.c b/src/php/ext/grpc/server.c index 46fe745c5a..dbb9425619 100644 --- a/src/php/ext/grpc/server.c +++ b/src/php/ext/grpc/server.c @@ -133,7 +133,7 @@ PHP_METHOD(Server, __construct) { * @param long $tag_cancel The tag to use if the call is cancelled * @return Void */ -PHP_METHOD(Server, request_call) { +PHP_METHOD(Server, requestCall) { grpc_call_error error_code; wrapped_grpc_server *server = (wrapped_grpc_server *)zend_object_store_get_object(getThis() TSRMLS_CC); @@ -178,7 +178,7 @@ cleanup: * @param string $addr The address to add * @return true on success, false on failure */ -PHP_METHOD(Server, add_http2_port) { +PHP_METHOD(Server, addHttp2Port) { wrapped_grpc_server *server = (wrapped_grpc_server *)zend_object_store_get_object(getThis() TSRMLS_CC); const char *addr; @@ -193,7 +193,7 @@ PHP_METHOD(Server, add_http2_port) { RETURN_LONG(grpc_server_add_http2_port(server->wrapped, addr)); } -PHP_METHOD(Server, add_secure_http2_port) { +PHP_METHOD(Server, addSecureHttp2Port) { wrapped_grpc_server *server = (wrapped_grpc_server *)zend_object_store_get_object(getThis() TSRMLS_CC); const char *addr; @@ -227,9 +227,9 @@ PHP_METHOD(Server, start) { static zend_function_entry server_methods[] = { PHP_ME(Server, __construct, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR) - PHP_ME(Server, request_call, NULL, ZEND_ACC_PUBLIC) - PHP_ME(Server, add_http2_port, NULL, ZEND_ACC_PUBLIC) - PHP_ME(Server, add_secure_http2_port, NULL, ZEND_ACC_PUBLIC) + PHP_ME(Server, requestCall, NULL, ZEND_ACC_PUBLIC) + PHP_ME(Server, addHttp2Port, NULL, ZEND_ACC_PUBLIC) + PHP_ME(Server, addSecureHttp2Port, NULL, ZEND_ACC_PUBLIC) PHP_ME(Server, start, NULL, ZEND_ACC_PUBLIC) PHP_FE_END}; void grpc_init_server(TSRMLS_D) { diff --git a/src/php/ext/grpc/timeval.c b/src/php/ext/grpc/timeval.c index 1c9542dbff..8a278d6760 100644 --- a/src/php/ext/grpc/timeval.c +++ b/src/php/ext/grpc/timeval.c @@ -227,7 +227,7 @@ PHP_METHOD(Timeval, zero) { * Returns the infinite future time value as a timeval object * @return Timeval Infinite future time value */ -PHP_METHOD(Timeval, inf_future) { +PHP_METHOD(Timeval, infFuture) { zval *grpc_php_timeval_inf_future = grpc_php_wrap_timeval(gpr_inf_future); RETURN_DESTROY_ZVAL(grpc_php_timeval_inf_future); } @@ -236,7 +236,7 @@ PHP_METHOD(Timeval, inf_future) { * Returns the infinite past time value as a timeval object * @return Timeval Infinite past time value */ -PHP_METHOD(Timeval, inf_past) { +PHP_METHOD(Timeval, infPast) { zval *grpc_php_timeval_inf_past = grpc_php_wrap_timeval(gpr_inf_past); RETURN_DESTROY_ZVAL(grpc_php_timeval_inf_past); } @@ -245,7 +245,7 @@ PHP_METHOD(Timeval, inf_past) { * Sleep until this time, interpreted as an absolute timeout * @return void */ -PHP_METHOD(Timeval, sleep_until) { +PHP_METHOD(Timeval, sleepUntil) { wrapped_grpc_timeval *this = (wrapped_grpc_timeval *)zend_object_store_get_object(getThis() TSRMLS_CC); gpr_sleep_until(this->wrapped); @@ -255,11 +255,11 @@ static zend_function_entry timeval_methods[] = { PHP_ME(Timeval, __construct, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR) PHP_ME(Timeval, add, NULL, ZEND_ACC_PUBLIC) PHP_ME(Timeval, compare, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME(Timeval, inf_future, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME(Timeval, inf_past, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) + PHP_ME(Timeval, infFuture, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) + PHP_ME(Timeval, infPast, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_ME(Timeval, now, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_ME(Timeval, similar, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME(Timeval, sleep_until, NULL, ZEND_ACC_PUBLIC) + PHP_ME(Timeval, sleepUntil, NULL, ZEND_ACC_PUBLIC) PHP_ME(Timeval, subtract, NULL, ZEND_ACC_PUBLIC) PHP_ME(Timeval, zero, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_FE_END}; -- cgit v1.2.3 From 10286d3f60d9f2e1c9702be43f6a716986facdab Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 2 Apr 2015 10:09:26 -0700 Subject: Updated PHP files to new method names --- src/php/lib/Grpc/AbstractCall.php | 2 +- src/php/lib/Grpc/BidiStreamingCall.php | 10 +++++----- src/php/lib/Grpc/ClientStreamingCall.php | 8 ++++---- src/php/lib/Grpc/ServerStreamingCall.php | 8 ++++---- src/php/lib/Grpc/UnaryCall.php | 4 ++-- src/php/tests/unit_tests/CallTest.php | 12 ++++++------ src/php/tests/unit_tests/EndToEndTest.php | 22 +++++++++++----------- src/php/tests/unit_tests/SecureEndToEndTest.php | 24 ++++++++++++------------ src/php/tests/unit_tests/TimevalTest.php | 6 +++--- 9 files changed, 48 insertions(+), 48 deletions(-) diff --git a/src/php/lib/Grpc/AbstractCall.php b/src/php/lib/Grpc/AbstractCall.php index 413d5966e1..1add972589 100644 --- a/src/php/lib/Grpc/AbstractCall.php +++ b/src/php/lib/Grpc/AbstractCall.php @@ -45,7 +45,7 @@ abstract class AbstractCall { * @param string $method The method to call on the remote server */ public function __construct(Channel $channel, $method, $deserialize) { - $this->call = new Call($channel, $method, Timeval::inf_future()); + $this->call = new Call($channel, $method, Timeval::infFuture()); $this->deserialize = $deserialize; $this->metadata = null; } diff --git a/src/php/lib/Grpc/BidiStreamingCall.php b/src/php/lib/Grpc/BidiStreamingCall.php index 2afceafce9..76c642bef4 100644 --- a/src/php/lib/Grpc/BidiStreamingCall.php +++ b/src/php/lib/Grpc/BidiStreamingCall.php @@ -43,7 +43,7 @@ class BidiStreamingCall extends AbstractCall { * @param array $metadata Metadata to send with the call, if applicable */ public function start($metadata) { - $this->call->start_batch([OP_SEND_INITIAL_METADATA => $metadata]); + $this->call->startBatch([OP_SEND_INITIAL_METADATA => $metadata]); } /** @@ -55,7 +55,7 @@ class BidiStreamingCall extends AbstractCall { if ($this->metadata === null) { $batch[OP_RECV_INITIAL_METADATA] = true; } - $read_event = $this->call->start_batch($batch); + $read_event = $this->call->startBatch($batch); if ($this->metadata === null) { $this->metadata = $read_event->metadata; } @@ -68,14 +68,14 @@ class BidiStreamingCall extends AbstractCall { * @param ByteBuffer $data The data to write */ public function write($data) { - $this->call->start_batch([OP_SEND_MESSAGE => $data->serialize()]); + $this->call->startBatch([OP_SEND_MESSAGE => $data->serialize()]); } /** * Indicate that no more writes will be sent. */ public function writesDone() { - $this->call->start_batch([OP_SEND_CLOSE_FROM_CLIENT => true]); + $this->call->startBatch([OP_SEND_CLOSE_FROM_CLIENT => true]); } /** @@ -84,7 +84,7 @@ class BidiStreamingCall extends AbstractCall { * and array $metadata members */ public function getStatus() { - $status_event = $this->call->start_batch([ + $status_event = $this->call->startBatch([ OP_RECV_STATUS_ON_CLIENT => true ]); return $status_event->status; diff --git a/src/php/lib/Grpc/ClientStreamingCall.php b/src/php/lib/Grpc/ClientStreamingCall.php index ec585da985..61439d3f47 100644 --- a/src/php/lib/Grpc/ClientStreamingCall.php +++ b/src/php/lib/Grpc/ClientStreamingCall.php @@ -44,11 +44,11 @@ class ClientStreamingCall extends AbstractCall { * @param array $metadata Metadata to send with the call, if applicable */ public function start($arg_iter, $metadata = array()) { - $event = $this->call->start_batch([OP_SEND_INITIAL_METADATA => $metadata]); + $event = $this->call->startBatch([OP_SEND_INITIAL_METADATA => $metadata]); foreach($arg_iter as $arg) { - $this->call->start_batch([OP_SEND_MESSAGE => $arg->serialize()]); + $this->call->startBatch([OP_SEND_MESSAGE => $arg->serialize()]); } - $this->call->start_batch([OP_SEND_CLOSE_FROM_CLIENT => true]); + $this->call->startBatch([OP_SEND_CLOSE_FROM_CLIENT => true]); } /** @@ -56,7 +56,7 @@ class ClientStreamingCall extends AbstractCall { * @return [response data, status] */ public function wait() { - $event = $this->call->start_batch([ + $event = $this->call->startBatch([ OP_RECV_INITIAL_METADATA => true, OP_RECV_MESSAGE => true, OP_RECV_STATUS_ON_CLIENT => true]); diff --git a/src/php/lib/Grpc/ServerStreamingCall.php b/src/php/lib/Grpc/ServerStreamingCall.php index 574c1bb1e0..631c863345 100644 --- a/src/php/lib/Grpc/ServerStreamingCall.php +++ b/src/php/lib/Grpc/ServerStreamingCall.php @@ -44,7 +44,7 @@ class ServerStreamingCall extends AbstractCall { * @param array $metadata Metadata to send with the call, if applicable */ public function start($arg, $metadata = array()) { - $event = $this->call->start_batch([ + $event = $this->call->startBatch([ OP_SEND_INITIAL_METADATA => $metadata, OP_RECV_INITIAL_METADATA => true, OP_SEND_MESSAGE => $arg->serialize(), @@ -56,10 +56,10 @@ class ServerStreamingCall extends AbstractCall { * @return An iterator of response values */ public function responses() { - $response = $this->call->start_batch([OP_RECV_MESSAGE => true])->message; + $response = $this->call->startBatch([OP_RECV_MESSAGE => true])->message; while($response !== null) { yield $this->deserializeResponse($response); - $response = $this->call->start_batch([OP_RECV_MESSAGE => true])->message; + $response = $this->call->startBatch([OP_RECV_MESSAGE => true])->message; } } @@ -69,7 +69,7 @@ class ServerStreamingCall extends AbstractCall { * and array $metadata members */ public function getStatus() { - $status_event = $this->call->start_batch([ + $status_event = $this->call->startBatch([ OP_RECV_STATUS_ON_CLIENT => true ]); return $status_event->status; diff --git a/src/php/lib/Grpc/UnaryCall.php b/src/php/lib/Grpc/UnaryCall.php index 814d477697..97a10a40f4 100644 --- a/src/php/lib/Grpc/UnaryCall.php +++ b/src/php/lib/Grpc/UnaryCall.php @@ -44,7 +44,7 @@ class UnaryCall extends AbstractCall { * @param array $metadata Metadata to send with the call, if applicable */ public function start($arg, $metadata = array()) { - $event = $this->call->start_batch([ + $event = $this->call->startBatch([ OP_SEND_INITIAL_METADATA => $metadata, OP_RECV_INITIAL_METADATA => true, OP_SEND_MESSAGE => $arg->serialize(), @@ -57,7 +57,7 @@ class UnaryCall extends AbstractCall { * @return [response data, status] */ public function wait() { - $event = $this->call->start_batch([ + $event = $this->call->startBatch([ OP_RECV_MESSAGE => true, OP_RECV_STATUS_ON_CLIENT => true]); return array($this->deserializeResponse($event->message), $event->status); diff --git a/src/php/tests/unit_tests/CallTest.php b/src/php/tests/unit_tests/CallTest.php index d361ce0030..77a2d86ce4 100755 --- a/src/php/tests/unit_tests/CallTest.php +++ b/src/php/tests/unit_tests/CallTest.php @@ -37,21 +37,21 @@ class CallTest extends PHPUnit_Framework_TestCase{ public static function setUpBeforeClass() { self::$server = new Grpc\Server([]); - self::$port = self::$server->add_http2_port('0.0.0.0:0'); + self::$port = self::$server->addHttp2Port('0.0.0.0:0'); } public function setUp() { $this->channel = new Grpc\Channel('localhost:' . self::$port, []); $this->call = new Grpc\Call($this->channel, '/foo', - Grpc\Timeval::inf_future()); + Grpc\Timeval::infFuture()); } public function testAddEmptyMetadata() { $batch = [ Grpc\OP_SEND_INITIAL_METADATA => [] ]; - $result = $this->call->start_batch($batch); + $result = $this->call->startBatch($batch); $this->assertTrue($result->send_metadata); } @@ -59,7 +59,7 @@ class CallTest extends PHPUnit_Framework_TestCase{ $batch = [ Grpc\OP_SEND_INITIAL_METADATA => ['key' => ['value']] ]; - $result = $this->call->start_batch($batch); + $result = $this->call->startBatch($batch); $this->assertTrue($result->send_metadata); } @@ -67,7 +67,7 @@ class CallTest extends PHPUnit_Framework_TestCase{ $batch = [ Grpc\OP_SEND_INITIAL_METADATA => ['key' => ['value1', 'value2']] ]; - $result = $this->call->start_batch($batch); + $result = $this->call->startBatch($batch); $this->assertTrue($result->send_metadata); } @@ -76,7 +76,7 @@ class CallTest extends PHPUnit_Framework_TestCase{ Grpc\OP_SEND_INITIAL_METADATA => ['key1' => ['value1'], 'key2' => ['value2', 'value3']] ]; - $result = $this->call->start_batch($batch); + $result = $this->call->startBatch($batch); $this->assertTrue($result->send_metadata); } } diff --git a/src/php/tests/unit_tests/EndToEndTest.php b/src/php/tests/unit_tests/EndToEndTest.php index 3e165b7213..296873fa8f 100755 --- a/src/php/tests/unit_tests/EndToEndTest.php +++ b/src/php/tests/unit_tests/EndToEndTest.php @@ -34,7 +34,7 @@ class EndToEndTest extends PHPUnit_Framework_TestCase{ public function setUp() { $this->server = new Grpc\Server([]); - $port = $this->server->add_http2_port('0.0.0.0:0'); + $port = $this->server->addHttp2Port('0.0.0.0:0'); $this->channel = new Grpc\Channel('localhost:' . $port, []); $this->server->start(); } @@ -45,13 +45,13 @@ class EndToEndTest extends PHPUnit_Framework_TestCase{ } public function testSimpleRequestBody() { - $deadline = Grpc\Timeval::inf_future(); + $deadline = Grpc\Timeval::infFuture(); $status_text = 'xyz'; $call = new Grpc\Call($this->channel, 'dummy_method', $deadline); - $event = $call->start_batch([ + $event = $call->startBatch([ Grpc\OP_SEND_INITIAL_METADATA => [], Grpc\OP_SEND_CLOSE_FROM_CLIENT => true ]); @@ -59,12 +59,12 @@ class EndToEndTest extends PHPUnit_Framework_TestCase{ $this->assertTrue($event->send_metadata); $this->assertTrue($event->send_close); - $event = $this->server->request_call(); + $event = $this->server->requestCall(); $this->assertSame('dummy_method', $event->method); $this->assertSame([], $event->metadata); $server_call = $event->call; - $event = $server_call->start_batch([ + $event = $server_call->startBatch([ Grpc\OP_SEND_INITIAL_METADATA => [], Grpc\OP_SEND_STATUS_FROM_SERVER => [ 'metadata' => [], @@ -78,7 +78,7 @@ class EndToEndTest extends PHPUnit_Framework_TestCase{ $this->assertTrue($event->send_status); $this->assertFalse($event->cancelled); - $event = $call->start_batch([ + $event = $call->startBatch([ Grpc\OP_RECV_INITIAL_METADATA => true, Grpc\OP_RECV_STATUS_ON_CLIENT => true ]); @@ -94,7 +94,7 @@ class EndToEndTest extends PHPUnit_Framework_TestCase{ } public function testClientServerFullRequestResponse() { - $deadline = Grpc\Timeval::inf_future(); + $deadline = Grpc\Timeval::infFuture(); $req_text = 'client_server_full_request_response'; $reply_text = 'reply:client_server_full_request_response'; $status_text = 'status:client_server_full_response_text'; @@ -103,7 +103,7 @@ class EndToEndTest extends PHPUnit_Framework_TestCase{ 'dummy_method', $deadline); - $event = $call->start_batch([ + $event = $call->startBatch([ Grpc\OP_SEND_INITIAL_METADATA => [], Grpc\OP_SEND_CLOSE_FROM_CLIENT => true, Grpc\OP_SEND_MESSAGE => $req_text @@ -113,11 +113,11 @@ class EndToEndTest extends PHPUnit_Framework_TestCase{ $this->assertTrue($event->send_close); $this->assertTrue($event->send_message); - $event = $this->server->request_call(); + $event = $this->server->requestCall(); $this->assertSame('dummy_method', $event->method); $server_call = $event->call; - $event = $server_call->start_batch([ + $event = $server_call->startBatch([ Grpc\OP_SEND_INITIAL_METADATA => [], Grpc\OP_SEND_MESSAGE => $reply_text, Grpc\OP_SEND_STATUS_FROM_SERVER => [ @@ -135,7 +135,7 @@ class EndToEndTest extends PHPUnit_Framework_TestCase{ $this->assertFalse($event->cancelled); $this->assertSame($req_text, $event->message); - $event = $call->start_batch([ + $event = $call->startBatch([ Grpc\OP_RECV_INITIAL_METADATA => true, Grpc\OP_RECV_MESSAGE => true, Grpc\OP_RECV_STATUS_ON_CLIENT => true, diff --git a/src/php/tests/unit_tests/SecureEndToEndTest.php b/src/php/tests/unit_tests/SecureEndToEndTest.php index 2d62fe9d5e..0c18cd3e91 100755 --- a/src/php/tests/unit_tests/SecureEndToEndTest.php +++ b/src/php/tests/unit_tests/SecureEndToEndTest.php @@ -40,8 +40,8 @@ class SecureEndToEndTest extends PHPUnit_Framework_TestCase{ file_get_contents(dirname(__FILE__) . '/../data/server1.key'), file_get_contents(dirname(__FILE__) . '/../data/server1.pem')); $this->server = new Grpc\Server(); - $port = $this->server->add_secure_http2_port('0.0.0.0:0', - $server_credentials); + $port = $this->server->addSecureHttp2Port('0.0.0.0:0', + $server_credentials); $this->server->start(); $this->channel = new Grpc\Channel( 'localhost:' . $port, @@ -57,13 +57,13 @@ class SecureEndToEndTest extends PHPUnit_Framework_TestCase{ } public function testSimpleRequestBody() { - $deadline = Grpc\Timeval::inf_future(); + $deadline = Grpc\Timeval::infFuture(); $status_text = 'xyz'; $call = new Grpc\Call($this->channel, 'dummy_method', $deadline); - $event = $call->start_batch([ + $event = $call->startBatch([ Grpc\OP_SEND_INITIAL_METADATA => [], Grpc\OP_SEND_CLOSE_FROM_CLIENT => true ]); @@ -71,12 +71,12 @@ class SecureEndToEndTest extends PHPUnit_Framework_TestCase{ $this->assertTrue($event->send_metadata); $this->assertTrue($event->send_close); - $event = $this->server->request_call(); + $event = $this->server->requestCall(); $this->assertSame('dummy_method', $event->method); $this->assertSame([], $event->metadata); $server_call = $event->call; - $event = $server_call->start_batch([ + $event = $server_call->startBatch([ Grpc\OP_SEND_INITIAL_METADATA => [], Grpc\OP_SEND_STATUS_FROM_SERVER => [ 'metadata' => [], @@ -90,7 +90,7 @@ class SecureEndToEndTest extends PHPUnit_Framework_TestCase{ $this->assertTrue($event->send_status); $this->assertFalse($event->cancelled); - $event = $call->start_batch([ + $event = $call->startBatch([ Grpc\OP_RECV_INITIAL_METADATA => true, Grpc\OP_RECV_STATUS_ON_CLIENT => true ]); @@ -106,7 +106,7 @@ class SecureEndToEndTest extends PHPUnit_Framework_TestCase{ } public function testClientServerFullRequestResponse() { - $deadline = Grpc\Timeval::inf_future(); + $deadline = Grpc\Timeval::infFuture(); $req_text = 'client_server_full_request_response'; $reply_text = 'reply:client_server_full_request_response'; $status_text = 'status:client_server_full_response_text'; @@ -115,7 +115,7 @@ class SecureEndToEndTest extends PHPUnit_Framework_TestCase{ 'dummy_method', $deadline); - $event = $call->start_batch([ + $event = $call->startBatch([ Grpc\OP_SEND_INITIAL_METADATA => [], Grpc\OP_SEND_CLOSE_FROM_CLIENT => true, Grpc\OP_SEND_MESSAGE => $req_text @@ -125,11 +125,11 @@ class SecureEndToEndTest extends PHPUnit_Framework_TestCase{ $this->assertTrue($event->send_close); $this->assertTrue($event->send_message); - $event = $this->server->request_call(); + $event = $this->server->requestCall(); $this->assertSame('dummy_method', $event->method); $server_call = $event->call; - $event = $server_call->start_batch([ + $event = $server_call->startBatch([ Grpc\OP_SEND_INITIAL_METADATA => [], Grpc\OP_SEND_MESSAGE => $reply_text, Grpc\OP_SEND_STATUS_FROM_SERVER => [ @@ -147,7 +147,7 @@ class SecureEndToEndTest extends PHPUnit_Framework_TestCase{ $this->assertFalse($event->cancelled); $this->assertSame($req_text, $event->message); - $event = $call->start_batch([ + $event = $call->startBatch([ Grpc\OP_RECV_INITIAL_METADATA => true, Grpc\OP_RECV_MESSAGE => true, Grpc\OP_RECV_STATUS_ON_CLIENT => true, diff --git a/src/php/tests/unit_tests/TimevalTest.php b/src/php/tests/unit_tests/TimevalTest.php index d20069afa1..a8bfcf0ac4 100755 --- a/src/php/tests/unit_tests/TimevalTest.php +++ b/src/php/tests/unit_tests/TimevalTest.php @@ -39,14 +39,14 @@ class TimevalTest extends PHPUnit_Framework_TestCase{ public function testPastIsLessThanZero() { $zero = Grpc\Timeval::zero(); - $past = Grpc\Timeval::inf_past(); + $past = Grpc\Timeval::infPast(); $this->assertLessThan(0, Grpc\Timeval::compare($past, $zero)); $this->assertGreaterThan(0, Grpc\Timeval::compare($zero, $past)); } public function testFutureIsGreaterThanZero() { $zero = Grpc\Timeval::zero(); - $future = Grpc\Timeval::inf_future(); + $future = Grpc\Timeval::infFuture(); $this->assertLessThan(0, Grpc\Timeval::compare($zero, $future)); $this->assertGreaterThan(0, Grpc\Timeval::compare($future, $zero)); } @@ -56,7 +56,7 @@ class TimevalTest extends PHPUnit_Framework_TestCase{ */ public function testNowIsBetweenZeroAndFuture() { $zero = Grpc\Timeval::zero(); - $future = Grpc\Timeval::inf_future(); + $future = Grpc\Timeval::infFuture(); $now = Grpc\Timeval::now(); $this->assertLessThan(0, Grpc\Timeval::compare($zero, $now)); $this->assertLessThan(0, Grpc\Timeval::compare($now, $future)); -- cgit v1.2.3 From e9866e977e625e5876ca3f1d61b606dfca74dc60 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Thu, 2 Apr 2015 10:27:50 -0700 Subject: resolve comment --- include/grpc++/impl/call.h | 2 +- src/cpp/common/call.cc | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h index 7ba758040b..b14c41dfa6 100644 --- a/include/grpc++/impl/call.h +++ b/include/grpc++/impl/call.h @@ -109,7 +109,7 @@ class CallOpBuffer : public CompletionQueueTag { char* status_details_; size_t status_details_capacity_; // Server send status - bool send_status_; + bool send_status_available_; grpc_status_code send_status_code_; grpc::string send_status_details_; size_t trailing_metadata_count_; diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index b013f28ac3..e75e77e0b5 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -60,7 +60,7 @@ CallOpBuffer::CallOpBuffer() status_code_(GRPC_STATUS_OK), status_details_(nullptr), status_details_capacity_(0), - send_status_(false), + send_status_available_(false), send_status_code_(GRPC_STATUS_OK), trailing_metadata_count_(0), trailing_metadata_(nullptr), @@ -105,7 +105,7 @@ void CallOpBuffer::Reset(void* next_return_tag) { status_code_ = GRPC_STATUS_OK; - send_status_ = false; + send_status_available_ = false; send_status_code_ = GRPC_STATUS_OK; send_status_details_.clear(); trailing_metadata_count_ = 0; @@ -211,7 +211,7 @@ void CallOpBuffer::AddServerSendStatus( } else { trailing_metadata_count_ = 0; } - send_status_ = true; + send_status_available_ = true; send_status_code_ = static_cast(status.code()); send_status_details_ = status.details(); } @@ -262,7 +262,7 @@ void CallOpBuffer::FillOps(grpc_op* ops, size_t* nops) { &status_details_capacity_; (*nops)++; } - if (send_status_) { + if (send_status_available_) { ops[*nops].op = GRPC_OP_SEND_STATUS_FROM_SERVER; ops[*nops].data.send_status_from_server.trailing_metadata_count = trailing_metadata_count_; -- cgit v1.2.3 From a727fe22b6f149c2cdc70b8a6d9f0f1b90709d4a Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Wed, 1 Apr 2015 20:48:26 -0700 Subject: Created Visual Studio 2010 project files. Also removed the unused shared projects. --- templates/vsprojects/vs2010/Grpc.mak.template | 107 +++ .../vsprojects/vs2010/gpr.vcxproj.filters.template | 2 + templates/vsprojects/vs2010/gpr.vcxproj.template | 2 + .../vs2010/gpr_test_util.vcxproj.template | 2 + .../vs2010/grpc++.vcxproj.filters.template | 2 + .../vsprojects/vs2010/grpc++.vcxproj.template | 2 + templates/vsprojects/vs2010/grpc.sln.template | 63 ++ .../vs2010/grpc.vcxproj.filters.template | 2 + templates/vsprojects/vs2010/grpc.vcxproj.template | 2 + .../vs2010/grpc_csharp_ext.vcxproj.template | 2 + .../vs2010/grpc_csharp_ext_shared.vcxproj.template | 2 + .../vs2010/grpc_test_util.vcxproj.template | 2 + .../vs2010/grpc_unsecure.vcxproj.filters.template | 2 + .../vs2010/grpc_unsecure.vcxproj.template | 2 + .../vsprojects/vs2010/vcxproj.filters_defs.include | 64 ++ templates/vsprojects/vs2010/vcxproj_defs.include | 131 ++++ .../vs2013/gpr_shared.vcxproj.filters.template | 2 - .../vsprojects/vs2013/gpr_shared.vcxproj.template | 2 - .../vs2013/grpc_shared.vcxproj.filters.template | 2 - .../vsprojects/vs2013/grpc_shared.vcxproj.template | 2 - test/core/end2end/gen_build_json.py | 2 +- tools/buildgen/build-cleaner.py | 2 +- tools/buildgen/mako_renderer.py | 2 +- vsprojects/vs2010/Grpc.mak | 712 ++++++++++++++++++++ vsprojects/vs2010/build_openssl_x86.bat | 8 + vsprojects/vs2010/global.props | 14 + vsprojects/vs2010/gpr.vcxproj | 184 ++++++ vsprojects/vs2010/gpr.vcxproj.filters | 217 ++++++ vsprojects/vs2010/gpr_shared.vcxproj | 184 ++++++ vsprojects/vs2010/gpr_shared.vcxproj.filters | 217 ++++++ vsprojects/vs2010/gpr_test_util.vcxproj | 90 +++ vsprojects/vs2010/grpc++.vcxproj | 177 +++++ vsprojects/vs2010/grpc++.vcxproj.filters | 211 ++++++ vsprojects/vs2010/grpc.sln | 100 +++ vsprojects/vs2010/grpc.vcxproj | 434 ++++++++++++ vsprojects/vs2010/grpc.vcxproj.filters | 736 +++++++++++++++++++++ vsprojects/vs2010/grpc_csharp_ext.vcxproj | 94 +++ vsprojects/vs2010/grpc_csharp_ext_shared.vcxproj | 98 +++ vsprojects/vs2010/grpc_shared.vcxproj | 442 +++++++++++++ vsprojects/vs2010/grpc_shared.vcxproj.filters | 736 +++++++++++++++++++++ vsprojects/vs2010/grpc_test_util.vcxproj | 113 ++++ vsprojects/vs2010/grpc_unsecure.vcxproj | 378 +++++++++++ vsprojects/vs2010/grpc_unsecure.vcxproj.filters | 619 +++++++++++++++++ vsprojects/vs2010/ssl.props | 13 + vsprojects/vs2010/third_party/zlibvc.vcxproj | 188 ++++++ vsprojects/vs2010/winsock.props | 12 + 46 files changed, 6369 insertions(+), 11 deletions(-) create mode 100644 templates/vsprojects/vs2010/Grpc.mak.template create mode 100644 templates/vsprojects/vs2010/gpr.vcxproj.filters.template create mode 100644 templates/vsprojects/vs2010/gpr.vcxproj.template create mode 100644 templates/vsprojects/vs2010/gpr_test_util.vcxproj.template create mode 100644 templates/vsprojects/vs2010/grpc++.vcxproj.filters.template create mode 100644 templates/vsprojects/vs2010/grpc++.vcxproj.template create mode 100644 templates/vsprojects/vs2010/grpc.sln.template create mode 100644 templates/vsprojects/vs2010/grpc.vcxproj.filters.template create mode 100644 templates/vsprojects/vs2010/grpc.vcxproj.template create mode 100644 templates/vsprojects/vs2010/grpc_csharp_ext.vcxproj.template create mode 100644 templates/vsprojects/vs2010/grpc_csharp_ext_shared.vcxproj.template create mode 100644 templates/vsprojects/vs2010/grpc_test_util.vcxproj.template create mode 100644 templates/vsprojects/vs2010/grpc_unsecure.vcxproj.filters.template create mode 100644 templates/vsprojects/vs2010/grpc_unsecure.vcxproj.template create mode 100644 templates/vsprojects/vs2010/vcxproj.filters_defs.include create mode 100644 templates/vsprojects/vs2010/vcxproj_defs.include delete mode 100644 templates/vsprojects/vs2013/gpr_shared.vcxproj.filters.template delete mode 100644 templates/vsprojects/vs2013/gpr_shared.vcxproj.template delete mode 100644 templates/vsprojects/vs2013/grpc_shared.vcxproj.filters.template delete mode 100644 templates/vsprojects/vs2013/grpc_shared.vcxproj.template create mode 100644 vsprojects/vs2010/Grpc.mak create mode 100644 vsprojects/vs2010/build_openssl_x86.bat create mode 100644 vsprojects/vs2010/global.props create mode 100644 vsprojects/vs2010/gpr.vcxproj create mode 100644 vsprojects/vs2010/gpr.vcxproj.filters create mode 100644 vsprojects/vs2010/gpr_shared.vcxproj create mode 100644 vsprojects/vs2010/gpr_shared.vcxproj.filters create mode 100644 vsprojects/vs2010/gpr_test_util.vcxproj create mode 100644 vsprojects/vs2010/grpc++.vcxproj create mode 100644 vsprojects/vs2010/grpc++.vcxproj.filters create mode 100644 vsprojects/vs2010/grpc.sln create mode 100644 vsprojects/vs2010/grpc.vcxproj create mode 100644 vsprojects/vs2010/grpc.vcxproj.filters create mode 100644 vsprojects/vs2010/grpc_csharp_ext.vcxproj create mode 100644 vsprojects/vs2010/grpc_csharp_ext_shared.vcxproj create mode 100644 vsprojects/vs2010/grpc_shared.vcxproj create mode 100644 vsprojects/vs2010/grpc_shared.vcxproj.filters create mode 100644 vsprojects/vs2010/grpc_test_util.vcxproj create mode 100644 vsprojects/vs2010/grpc_unsecure.vcxproj create mode 100644 vsprojects/vs2010/grpc_unsecure.vcxproj.filters create mode 100644 vsprojects/vs2010/ssl.props create mode 100644 vsprojects/vs2010/third_party/zlibvc.vcxproj create mode 100644 vsprojects/vs2010/winsock.props diff --git a/templates/vsprojects/vs2010/Grpc.mak.template b/templates/vsprojects/vs2010/Grpc.mak.template new file mode 100644 index 0000000000..8e1b33bba7 --- /dev/null +++ b/templates/vsprojects/vs2010/Grpc.mak.template @@ -0,0 +1,107 @@ +# 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. +<%! + import re +%>\ +<%def name="to_windows_path(path)">${path.replace('/','\\')}\ +<% + allowed_dependencies = set(['gpr', 'grpc', 'gpr_test_util', 'grpc_test_util']) + buildable_targets = [ target for target in targets if set(target.deps).issubset(allowed_dependencies) and all([src.endswith('.c') for src in target.src])] + test_targets = [ target for target in buildable_targets if target.name.endswith('_test') ] +%>\ +# NMake file to build secondary gRPC targets on Windows. +# Use grpc.sln to solution to build the gRPC libraries. + +OUT_DIR=test_bin + +CC=cl.exe +LINK=link.exe + +INCLUDES=/I..\.. /I..\..\include /I..\..\third_party\zlib /I..\third_party /I..\..\third_party\openssl\inc32 +DEFINES=/D WIN32 /D _LIB /D _USE_32BIT_TIME_T /D _UNICODE /D UNICODE /D _CRT_SECURE_NO_WARNINGS +CFLAGS=/c $(INCLUDES) /nologo /Z7 /W3 /WX- /sdl $(DEFINES) /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TC /analyze- +LFLAGS=/DEBUG /INCREMENTAL /NOLOGO /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 + +OPENSSL_LIBS=..\..\third_party\openssl\out32\ssleay32.lib ..\..\third_party\openssl\out32\libeay32.lib +WINSOCK_LIBS=ws2_32.lib +ZLIB_LIBS=Debug\zlibwapi.lib +LIBS=$(OPENSSL_LIBS) $(WINSOCK_LIBS) $(ZLIB_LIBS) + +gpr_test_util: + MSBuild.exe gpr_test_util.vcxproj /p:Configuration=Debug + +grpc_test_util: + MSBuild.exe grpc_test_util.vcxproj /p:Configuration=Debug + +$(OUT_DIR): + mkdir $(OUT_DIR) + +buildtests: \ +% for target in test_targets: +${target.name}.exe \ +% endfor + + echo All tests built. + +test: \ +% for target in test_targets: +${target.name} \ +% endfor + + echo All tests ran. + +test_gpr: \ +% for target in [ tgt for tgt in test_targets if tgt.name.startswith('gpr_')]: +${target.name} \ +% endfor + + echo All tests ran. + +% for target in buildable_targets: +${target.name}.exe: grpc_test_util + echo Building ${target.name} + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ \ +%for source in target.src: +..\..\${to_windows_path(source)} \ +%endfor + + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\${target.name}.exe" \ +%for dep in target.deps: +Debug\${dep}.lib \ +%endfor +$(LIBS) \ +%for source in target.src: +$(OUT_DIR)\${re.search('([^/]+)\.c$', source).group(1)}.obj \ +%endfor + +${target.name}: ${target.name}.exe + echo Running ${target.name} + $(OUT_DIR)\${target.name}.exe + +% endfor diff --git a/templates/vsprojects/vs2010/gpr.vcxproj.filters.template b/templates/vsprojects/vs2010/gpr.vcxproj.filters.template new file mode 100644 index 0000000000..c8b2ce099e --- /dev/null +++ b/templates/vsprojects/vs2010/gpr.vcxproj.filters.template @@ -0,0 +1,2 @@ +<%namespace file="vcxproj.filters_defs.include" import="gen_filters"/>\ +${gen_filters('gpr', libs, targets)} diff --git a/templates/vsprojects/vs2010/gpr.vcxproj.template b/templates/vsprojects/vs2010/gpr.vcxproj.template new file mode 100644 index 0000000000..c478aadcdd --- /dev/null +++ b/templates/vsprojects/vs2010/gpr.vcxproj.template @@ -0,0 +1,2 @@ +<%namespace file="vcxproj_defs.include" import="gen_project"/>\ +${gen_project('gpr', libs, targets)} diff --git a/templates/vsprojects/vs2010/gpr_test_util.vcxproj.template b/templates/vsprojects/vs2010/gpr_test_util.vcxproj.template new file mode 100644 index 0000000000..1f1bc0a5fb --- /dev/null +++ b/templates/vsprojects/vs2010/gpr_test_util.vcxproj.template @@ -0,0 +1,2 @@ +<%namespace file="vcxproj_defs.include" import="gen_project"/>\ +${gen_project('gpr_test_util', libs, targets)} \ No newline at end of file diff --git a/templates/vsprojects/vs2010/grpc++.vcxproj.filters.template b/templates/vsprojects/vs2010/grpc++.vcxproj.filters.template new file mode 100644 index 0000000000..d74cce8c78 --- /dev/null +++ b/templates/vsprojects/vs2010/grpc++.vcxproj.filters.template @@ -0,0 +1,2 @@ +<%namespace file="vcxproj.filters_defs.include" import="gen_filters"/>\ +${gen_filters('grpc++', libs, targets)} diff --git a/templates/vsprojects/vs2010/grpc++.vcxproj.template b/templates/vsprojects/vs2010/grpc++.vcxproj.template new file mode 100644 index 0000000000..93994bb392 --- /dev/null +++ b/templates/vsprojects/vs2010/grpc++.vcxproj.template @@ -0,0 +1,2 @@ +<%namespace file="vcxproj_defs.include" import="gen_project"/>\ +${gen_project('grpc++', libs, targets)} \ No newline at end of file diff --git a/templates/vsprojects/vs2010/grpc.sln.template b/templates/vsprojects/vs2010/grpc.sln.template new file mode 100644 index 0000000000..b90c0d7cdb --- /dev/null +++ b/templates/vsprojects/vs2010/grpc.sln.template @@ -0,0 +1,63 @@ +## Template for Visual Studio solution +## based on http://msdn.microsoft.com/en-us/library/bb165951(v=vs.90).aspx +## NOTE: tabs in this file are needed by Visual Studio to correctly interpret +## the file. +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual C++ Express 2010 +<% +## Visual Studio uses GUIDs for project types +## http://msdn.microsoft.com/en-us/library/hb23x61k%28v=vs.80%29.aspx +cpp_proj_type = "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}" +%>\ +% for project in vsprojects: +Project("${cpp_proj_type}") = "${project.name}", "${project.name}.vcxproj", "${project.vs_project_guid}" + % if project.get('deps', None): + ProjectSection(ProjectDependencies) = postProject + % for dep in project.get('deps', []): + ${vsproject_dict[dep].vs_project_guid} = ${vsproject_dict[dep].vs_project_guid} + % endfor + EndProjectSection + % endif +EndProject +% endfor +Project("${cpp_proj_type}") = "gpr_shared", "gpr_shared.vcxproj", "{3D304D6B-AAF8-428B-AC7D-A698DDDE93C0}" +EndProject +Project("${cpp_proj_type}") = "grpc_shared", "grpc_shared.vcxproj", "{F2EE8FDB-F1E0-43A0-A297-6F255BB52AAA}" +EndProject +Project("${cpp_proj_type}") = "grpc_csharp_ext_shared", "grpc_csharp_ext_shared.vcxproj", "{C26D04A8-37C6-44C7-B458-906C9FCE928C}" +EndProject +Project("${cpp_proj_type}") = "zlibvc", "third_party\zlibvc.vcxproj", "{8FD826F8-3739-44E6-8CC8-997122E53B8D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution +% for project in vsprojects: + ${project.vs_project_guid}.Debug|Win32.ActiveCfg = Debug|Win32 + ${project.vs_project_guid}.Debug|Win32.Build.0 = Debug|Win32 + ${project.vs_project_guid}.Release|Win32.ActiveCfg = Release|Win32 + ${project.vs_project_guid}.Release|Win32.Build.0 = Release|Win32 +% endfor + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Win32.ActiveCfg = Debug|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Win32.Build.0 = Debug|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Win32.ActiveCfg = Release|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Win32.Build.0 = Release|Win32 + {3D304D6B-AAF8-428B-AC7D-A698DDDE93C0}.Debug|Win32.ActiveCfg = Debug|Win32 + {3D304D6B-AAF8-428B-AC7D-A698DDDE93C0}.Debug|Win32.Build.0 = Debug|Win32 + {3D304D6B-AAF8-428B-AC7D-A698DDDE93C0}.Release|Win32.ActiveCfg = Release|Win32 + {3D304D6B-AAF8-428B-AC7D-A698DDDE93C0}.Release|Win32.Build.0 = Release|Win32 + {F2EE8FDB-F1E0-43A0-A297-6F255BB52AAA}.Debug|Win32.ActiveCfg = Debug|Win32 + {F2EE8FDB-F1E0-43A0-A297-6F255BB52AAA}.Debug|Win32.Build.0 = Debug|Win32 + {F2EE8FDB-F1E0-43A0-A297-6F255BB52AAA}.Release|Win32.ActiveCfg = Release|Win32 + {F2EE8FDB-F1E0-43A0-A297-6F255BB52AAA}.Release|Win32.Build.0 = Release|Win32 + {C26D04A8-37C6-44C7-B458-906C9FCE928C}.Debug|Win32.ActiveCfg = Debug|Win32 + {C26D04A8-37C6-44C7-B458-906C9FCE928C}.Debug|Win32.Build.0 = Debug|Win32 + {C26D04A8-37C6-44C7-B458-906C9FCE928C}.Release|Win32.ActiveCfg = Release|Win32 + {C26D04A8-37C6-44C7-B458-906C9FCE928C}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/templates/vsprojects/vs2010/grpc.vcxproj.filters.template b/templates/vsprojects/vs2010/grpc.vcxproj.filters.template new file mode 100644 index 0000000000..b8e91bd61c --- /dev/null +++ b/templates/vsprojects/vs2010/grpc.vcxproj.filters.template @@ -0,0 +1,2 @@ +<%namespace file="vcxproj.filters_defs.include" import="gen_filters"/>\ +${gen_filters('grpc', libs, targets)} diff --git a/templates/vsprojects/vs2010/grpc.vcxproj.template b/templates/vsprojects/vs2010/grpc.vcxproj.template new file mode 100644 index 0000000000..3de6453f52 --- /dev/null +++ b/templates/vsprojects/vs2010/grpc.vcxproj.template @@ -0,0 +1,2 @@ +<%namespace file="vcxproj_defs.include" import="gen_project"/>\ +${gen_project('grpc', libs, targets)} \ No newline at end of file diff --git a/templates/vsprojects/vs2010/grpc_csharp_ext.vcxproj.template b/templates/vsprojects/vs2010/grpc_csharp_ext.vcxproj.template new file mode 100644 index 0000000000..84aa50209a --- /dev/null +++ b/templates/vsprojects/vs2010/grpc_csharp_ext.vcxproj.template @@ -0,0 +1,2 @@ +<%namespace file="vcxproj_defs.include" import="gen_project"/>\ +${gen_project('grpc_csharp_ext', libs, targets)} diff --git a/templates/vsprojects/vs2010/grpc_csharp_ext_shared.vcxproj.template b/templates/vsprojects/vs2010/grpc_csharp_ext_shared.vcxproj.template new file mode 100644 index 0000000000..193a2cd13f --- /dev/null +++ b/templates/vsprojects/vs2010/grpc_csharp_ext_shared.vcxproj.template @@ -0,0 +1,2 @@ +<%namespace file="vcxproj_defs.include" import="gen_project"/>\ +${gen_project('grpc_csharp_ext', libs, targets, configuration_type = 'DynamicLibrary', project_guid = '{C26D04A8-37C6-44C7-B458-906C9FCE928C}', additional_props = ['winsock', 'ssl'])} diff --git a/templates/vsprojects/vs2010/grpc_test_util.vcxproj.template b/templates/vsprojects/vs2010/grpc_test_util.vcxproj.template new file mode 100644 index 0000000000..72e625d9b9 --- /dev/null +++ b/templates/vsprojects/vs2010/grpc_test_util.vcxproj.template @@ -0,0 +1,2 @@ +<%namespace file="vcxproj_defs.include" import="gen_project"/>\ +${gen_project('grpc_test_util', libs, targets)} \ No newline at end of file diff --git a/templates/vsprojects/vs2010/grpc_unsecure.vcxproj.filters.template b/templates/vsprojects/vs2010/grpc_unsecure.vcxproj.filters.template new file mode 100644 index 0000000000..ef918922ef --- /dev/null +++ b/templates/vsprojects/vs2010/grpc_unsecure.vcxproj.filters.template @@ -0,0 +1,2 @@ +<%namespace file="vcxproj.filters_defs.include" import="gen_filters"/>\ +${gen_filters('grpc_unsecure', libs, targets)} diff --git a/templates/vsprojects/vs2010/grpc_unsecure.vcxproj.template b/templates/vsprojects/vs2010/grpc_unsecure.vcxproj.template new file mode 100644 index 0000000000..4f62b85a85 --- /dev/null +++ b/templates/vsprojects/vs2010/grpc_unsecure.vcxproj.template @@ -0,0 +1,2 @@ +<%namespace file="vcxproj_defs.include" import="gen_project"/>\ +${gen_project('grpc_unsecure', libs, targets)} \ No newline at end of file diff --git a/templates/vsprojects/vs2010/vcxproj.filters_defs.include b/templates/vsprojects/vs2010/vcxproj.filters_defs.include new file mode 100644 index 0000000000..539ae932f1 --- /dev/null +++ b/templates/vsprojects/vs2010/vcxproj.filters_defs.include @@ -0,0 +1,64 @@ +<%! + import re + import hashlib + + def calc_to_filter(path): + return '\\'.join(path.split('/')[:-1]) +%>\ +<%def name="to_windows_path(path)">${path.replace('/','\\')}\ +<%def name="to_filter(path)">${calc_to_filter(path)}\ +<%def name="filter_to_guid(proj, filter)">${re.sub('(........)(....)(....)(....)', r'\1-\2-\3-\4-', hashlib.md5(''.join([filter, proj])).hexdigest())}\ +<%def name="gen_filters(name, libs, targets)">\ +% for project in vsprojects: + % if project.name == name: + + + % if project.get('src',[]): + + % for src_name in project.src: + + ${to_filter(src_name)} + + % endfor + + % endif + % if project.get('public_headers',[]): + + % for public_header in project.public_headers: + + ${to_filter(public_header)} + + % endfor + + % endif + % if project.get('headers',[]): + + % for header in project.headers: + + ${to_filter(header)} + + % endfor + + % endif +<% + filters = set() + files = project.get('src', []) + project.get('public_headers', []) + project.get('headers', []) + for file in files: + filter = calc_to_filter(file) + paths = filter.split('\\') + for i in range(len(paths)): + filters.add('\\'.join(paths[:i + 1])) + + filters = sorted(filters) +%> + + % for filter in filters: + + {${filter_to_guid(project.name, filter)}} + + % endfor + + + % endif +% endfor +\ \ No newline at end of file diff --git a/templates/vsprojects/vs2010/vcxproj_defs.include b/templates/vsprojects/vs2010/vcxproj_defs.include new file mode 100644 index 0000000000..8fd78a34dc --- /dev/null +++ b/templates/vsprojects/vs2010/vcxproj_defs.include @@ -0,0 +1,131 @@ +<%def name="to_windows_path(path)">${path.replace('/','\\')}\ +<%def name="get_subsystem(is_library)">${'Windows' if is_library else 'Console'}\ +<%def name="gen_project(name, libs, targets, configuration_type = 'StaticLibrary', project_guid = None, additional_props = [], depends_on_zlib = False)">\ +% for project in vsprojects: + % if project.name == name: + + + + + Debug + Win32 + + + Release + Win32 + + + + ${project_guid if project_guid else project.vs_project_guid} + + + + ${configuration_type} + true + Unicode + $(Configuration)\$(ProjectName)\ + + + ${configuration_type} + false + true + Unicode + $(Configuration)\$(ProjectName)\ + + + + + + + + % for prop in additional_props: + + % endfor + + + + + % for prop in additional_props: + + % endfor + + + + ${name} + + + ${name} + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) + true + + + ${get_subsystem(project.is_library)} + true + + + + + Level3 + NotUsing + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) + true + + + ${get_subsystem(project.is_library)} + true + true + true + + + % if project.get('public_headers',[]): + + % for public_header in project.public_headers: + + % endfor + + % endif + % if project.get('headers',[]): + + % for header in project.headers: + + % endfor + + % endif + % if project.get('src',[]): + + % for src_name in project.src: + + + % endfor + + % endif + % if project.get('deps',[]): + + % for dep in project.deps: + + ${vsproject_dict[dep].vs_project_guid} + + % endfor + % if depends_on_zlib: + + {8fd826f8-3739-44e6-8cc8-997122e53b8d} + + % endif + + % endif + + + + + % endif +% endfor +\ \ No newline at end of file diff --git a/templates/vsprojects/vs2013/gpr_shared.vcxproj.filters.template b/templates/vsprojects/vs2013/gpr_shared.vcxproj.filters.template deleted file mode 100644 index c8b2ce099e..0000000000 --- a/templates/vsprojects/vs2013/gpr_shared.vcxproj.filters.template +++ /dev/null @@ -1,2 +0,0 @@ -<%namespace file="vcxproj.filters_defs.include" import="gen_filters"/>\ -${gen_filters('gpr', libs, targets)} diff --git a/templates/vsprojects/vs2013/gpr_shared.vcxproj.template b/templates/vsprojects/vs2013/gpr_shared.vcxproj.template deleted file mode 100644 index d1b1dd3c8b..0000000000 --- a/templates/vsprojects/vs2013/gpr_shared.vcxproj.template +++ /dev/null @@ -1,2 +0,0 @@ -<%namespace file="vcxproj_defs.include" import="gen_project"/>\ -${gen_project('gpr', libs, targets, configuration_type = 'DynamicLibrary', project_guid = '{3D304D6B-AAF8-428B-AC7D-A698DDDE93C0}')} diff --git a/templates/vsprojects/vs2013/grpc_shared.vcxproj.filters.template b/templates/vsprojects/vs2013/grpc_shared.vcxproj.filters.template deleted file mode 100644 index b8e91bd61c..0000000000 --- a/templates/vsprojects/vs2013/grpc_shared.vcxproj.filters.template +++ /dev/null @@ -1,2 +0,0 @@ -<%namespace file="vcxproj.filters_defs.include" import="gen_filters"/>\ -${gen_filters('grpc', libs, targets)} diff --git a/templates/vsprojects/vs2013/grpc_shared.vcxproj.template b/templates/vsprojects/vs2013/grpc_shared.vcxproj.template deleted file mode 100644 index 890189c28d..0000000000 --- a/templates/vsprojects/vs2013/grpc_shared.vcxproj.template +++ /dev/null @@ -1,2 +0,0 @@ -<%namespace file="vcxproj_defs.include" import="gen_project"/>\ -${gen_project('grpc', libs, targets, configuration_type = 'DynamicLibrary', project_guid = '{F2EE8FDB-F1E0-43A0-A297-6F255BB52AAA}', additional_props = ['ssl', 'winsock'], depends_on_zlib = True)} diff --git a/test/core/end2end/gen_build_json.py b/test/core/end2end/gen_build_json.py index 67fc0a6e53..23349daafe 100755 --- a/test/core/end2end/gen_build_json.py +++ b/test/core/end2end/gen_build_json.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2.7 +#!/usr/bin/env python # Copyright 2015, Google Inc. # All rights reserved. # diff --git a/tools/buildgen/build-cleaner.py b/tools/buildgen/build-cleaner.py index 1d9157aad7..6c5355bce3 100755 --- a/tools/buildgen/build-cleaner.py +++ b/tools/buildgen/build-cleaner.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright 2015, Google Inc. # All rights reserved. # diff --git a/tools/buildgen/mako_renderer.py b/tools/buildgen/mako_renderer.py index f0dc818c0c..534377e69e 100755 --- a/tools/buildgen/mako_renderer.py +++ b/tools/buildgen/mako_renderer.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2.7 +#!/usr/bin/env python # Copyright 2015, Google Inc. # All rights reserved. # diff --git a/vsprojects/vs2010/Grpc.mak b/vsprojects/vs2010/Grpc.mak new file mode 100644 index 0000000000..203c787287 --- /dev/null +++ b/vsprojects/vs2010/Grpc.mak @@ -0,0 +1,712 @@ +# 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. +# NMake file to build secondary gRPC targets on Windows. +# Use grpc.sln to solution to build the gRPC libraries. + +OUT_DIR=test_bin + +CC=cl.exe +LINK=link.exe + +INCLUDES=/I..\.. /I..\..\include /I..\..\third_party\zlib /I..\third_party /I..\..\third_party\openssl\inc32 +DEFINES=/D WIN32 /D _LIB /D _USE_32BIT_TIME_T /D _UNICODE /D UNICODE /D _CRT_SECURE_NO_WARNINGS +CFLAGS=/c $(INCLUDES) /nologo /Z7 /W3 /WX- /sdl $(DEFINES) /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TC /analyze- +LFLAGS=/DEBUG /INCREMENTAL /NOLOGO /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 + +OPENSSL_LIBS=..\..\third_party\openssl\out32\ssleay32.lib ..\..\third_party\openssl\out32\libeay32.lib +WINSOCK_LIBS=ws2_32.lib +ZLIB_LIBS=Debug\zlibwapi.lib +LIBS=$(OPENSSL_LIBS) $(WINSOCK_LIBS) $(ZLIB_LIBS) + +gpr_test_util: + MSBuild.exe gpr_test_util.vcxproj /p:Configuration=Debug + +grpc_test_util: + MSBuild.exe grpc_test_util.vcxproj /p:Configuration=Debug + +$(OUT_DIR): + mkdir $(OUT_DIR) + +buildtests: alarm_heap_test.exe alarm_list_test.exe alarm_test.exe alpn_test.exe bin_encoder_test.exe census_hash_table_test.exe census_statistics_multiple_writers_circular_buffer_test.exe census_statistics_multiple_writers_test.exe census_statistics_performance_test.exe census_statistics_quick_test.exe census_statistics_small_log_test.exe census_stats_store_test.exe census_stub_test.exe census_trace_store_test.exe census_window_stats_test.exe chttp2_status_conversion_test.exe chttp2_stream_encoder_test.exe chttp2_stream_map_test.exe chttp2_transport_end2end_test.exe dualstack_socket_test.exe echo_test.exe fd_posix_test.exe fling_stream_test.exe fling_test.exe gpr_cancellable_test.exe gpr_cmdline_test.exe gpr_env_test.exe gpr_file_test.exe gpr_histogram_test.exe gpr_host_port_test.exe gpr_log_test.exe gpr_slice_buffer_test.exe gpr_slice_test.exe gpr_string_test.exe gpr_sync_test.exe gpr_thd_test.exe gpr_time_test.exe gpr_useful_test.exe grpc_base64_test.exe grpc_byte_buffer_reader_test.exe grpc_channel_stack_test.exe grpc_completion_queue_test.exe grpc_credentials_test.exe grpc_json_token_test.exe grpc_stream_op_test.exe hpack_parser_test.exe hpack_table_test.exe httpcli_format_request_test.exe httpcli_parser_test.exe httpcli_test.exe json_rewrite_test.exe json_test.exe lame_client_test.exe message_compress_test.exe metadata_buffer_test.exe multi_init_test.exe murmur_hash_test.exe no_server_test.exe poll_kick_posix_test.exe resolve_address_test.exe secure_endpoint_test.exe sockaddr_utils_test.exe tcp_client_posix_test.exe tcp_posix_test.exe tcp_server_posix_test.exe time_averaged_stats_test.exe time_test.exe timeout_encoding_test.exe transport_metadata_test.exe transport_security_test.exe + echo All tests built. + +test: alarm_heap_test alarm_list_test alarm_test alpn_test bin_encoder_test census_hash_table_test census_statistics_multiple_writers_circular_buffer_test census_statistics_multiple_writers_test census_statistics_performance_test census_statistics_quick_test census_statistics_small_log_test census_stats_store_test census_stub_test census_trace_store_test census_window_stats_test chttp2_status_conversion_test chttp2_stream_encoder_test chttp2_stream_map_test chttp2_transport_end2end_test dualstack_socket_test echo_test fd_posix_test fling_stream_test fling_test gpr_cancellable_test gpr_cmdline_test gpr_env_test gpr_file_test gpr_histogram_test gpr_host_port_test gpr_log_test gpr_slice_buffer_test gpr_slice_test gpr_string_test gpr_sync_test gpr_thd_test gpr_time_test gpr_useful_test grpc_base64_test grpc_byte_buffer_reader_test grpc_channel_stack_test grpc_completion_queue_test grpc_credentials_test grpc_json_token_test grpc_stream_op_test hpack_parser_test hpack_table_test httpcli_format_request_test httpcli_parser_test httpcli_test json_rewrite_test json_test lame_client_test message_compress_test metadata_buffer_test multi_init_test murmur_hash_test no_server_test poll_kick_posix_test resolve_address_test secure_endpoint_test sockaddr_utils_test tcp_client_posix_test tcp_posix_test tcp_server_posix_test time_averaged_stats_test time_test timeout_encoding_test transport_metadata_test transport_security_test + echo All tests ran. + +test_gpr: gpr_cancellable_test gpr_cmdline_test gpr_env_test gpr_file_test gpr_histogram_test gpr_host_port_test gpr_log_test gpr_slice_buffer_test gpr_slice_test gpr_string_test gpr_sync_test gpr_thd_test gpr_time_test gpr_useful_test + echo All tests ran. + +alarm_heap_test.exe: grpc_test_util + echo Building alarm_heap_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\iomgr\alarm_heap_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\alarm_heap_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\alarm_heap_test.obj +alarm_heap_test: alarm_heap_test.exe + echo Running alarm_heap_test + $(OUT_DIR)\alarm_heap_test.exe + +alarm_list_test.exe: grpc_test_util + echo Building alarm_list_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\iomgr\alarm_list_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\alarm_list_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\alarm_list_test.obj +alarm_list_test: alarm_list_test.exe + echo Running alarm_list_test + $(OUT_DIR)\alarm_list_test.exe + +alarm_test.exe: grpc_test_util + echo Building alarm_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\iomgr\alarm_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\alarm_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\alarm_test.obj +alarm_test: alarm_test.exe + echo Running alarm_test + $(OUT_DIR)\alarm_test.exe + +alpn_test.exe: grpc_test_util + echo Building alpn_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\transport\chttp2\alpn_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\alpn_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\alpn_test.obj +alpn_test: alpn_test.exe + echo Running alpn_test + $(OUT_DIR)\alpn_test.exe + +bin_encoder_test.exe: grpc_test_util + echo Building bin_encoder_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\transport\chttp2\bin_encoder_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\bin_encoder_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\bin_encoder_test.obj +bin_encoder_test: bin_encoder_test.exe + echo Running bin_encoder_test + $(OUT_DIR)\bin_encoder_test.exe + +census_hash_table_test.exe: grpc_test_util + echo Building census_hash_table_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\statistics\hash_table_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\census_hash_table_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\hash_table_test.obj +census_hash_table_test: census_hash_table_test.exe + echo Running census_hash_table_test + $(OUT_DIR)\census_hash_table_test.exe + +census_statistics_multiple_writers_circular_buffer_test.exe: grpc_test_util + echo Building census_statistics_multiple_writers_circular_buffer_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\statistics\multiple_writers_circular_buffer_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\census_statistics_multiple_writers_circular_buffer_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\multiple_writers_circular_buffer_test.obj +census_statistics_multiple_writers_circular_buffer_test: census_statistics_multiple_writers_circular_buffer_test.exe + echo Running census_statistics_multiple_writers_circular_buffer_test + $(OUT_DIR)\census_statistics_multiple_writers_circular_buffer_test.exe + +census_statistics_multiple_writers_test.exe: grpc_test_util + echo Building census_statistics_multiple_writers_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\statistics\multiple_writers_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\census_statistics_multiple_writers_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\multiple_writers_test.obj +census_statistics_multiple_writers_test: census_statistics_multiple_writers_test.exe + echo Running census_statistics_multiple_writers_test + $(OUT_DIR)\census_statistics_multiple_writers_test.exe + +census_statistics_performance_test.exe: grpc_test_util + echo Building census_statistics_performance_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\statistics\performance_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\census_statistics_performance_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\performance_test.obj +census_statistics_performance_test: census_statistics_performance_test.exe + echo Running census_statistics_performance_test + $(OUT_DIR)\census_statistics_performance_test.exe + +census_statistics_quick_test.exe: grpc_test_util + echo Building census_statistics_quick_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\statistics\quick_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\census_statistics_quick_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\quick_test.obj +census_statistics_quick_test: census_statistics_quick_test.exe + echo Running census_statistics_quick_test + $(OUT_DIR)\census_statistics_quick_test.exe + +census_statistics_small_log_test.exe: grpc_test_util + echo Building census_statistics_small_log_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\statistics\small_log_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\census_statistics_small_log_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\small_log_test.obj +census_statistics_small_log_test: census_statistics_small_log_test.exe + echo Running census_statistics_small_log_test + $(OUT_DIR)\census_statistics_small_log_test.exe + +census_stats_store_test.exe: grpc_test_util + echo Building census_stats_store_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\statistics\rpc_stats_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\census_stats_store_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\rpc_stats_test.obj +census_stats_store_test: census_stats_store_test.exe + echo Running census_stats_store_test + $(OUT_DIR)\census_stats_store_test.exe + +census_stub_test.exe: grpc_test_util + echo Building census_stub_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\statistics\census_stub_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\census_stub_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\census_stub_test.obj +census_stub_test: census_stub_test.exe + echo Running census_stub_test + $(OUT_DIR)\census_stub_test.exe + +census_trace_store_test.exe: grpc_test_util + echo Building census_trace_store_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\statistics\trace_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\census_trace_store_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\trace_test.obj +census_trace_store_test: census_trace_store_test.exe + echo Running census_trace_store_test + $(OUT_DIR)\census_trace_store_test.exe + +census_window_stats_test.exe: grpc_test_util + echo Building census_window_stats_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\statistics\window_stats_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\census_window_stats_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\window_stats_test.obj +census_window_stats_test: census_window_stats_test.exe + echo Running census_window_stats_test + $(OUT_DIR)\census_window_stats_test.exe + +chttp2_status_conversion_test.exe: grpc_test_util + echo Building chttp2_status_conversion_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\transport\chttp2\status_conversion_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\chttp2_status_conversion_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\status_conversion_test.obj +chttp2_status_conversion_test: chttp2_status_conversion_test.exe + echo Running chttp2_status_conversion_test + $(OUT_DIR)\chttp2_status_conversion_test.exe + +chttp2_stream_encoder_test.exe: grpc_test_util + echo Building chttp2_stream_encoder_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\transport\chttp2\stream_encoder_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\chttp2_stream_encoder_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\stream_encoder_test.obj +chttp2_stream_encoder_test: chttp2_stream_encoder_test.exe + echo Running chttp2_stream_encoder_test + $(OUT_DIR)\chttp2_stream_encoder_test.exe + +chttp2_stream_map_test.exe: grpc_test_util + echo Building chttp2_stream_map_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\transport\chttp2\stream_map_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\chttp2_stream_map_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\stream_map_test.obj +chttp2_stream_map_test: chttp2_stream_map_test.exe + echo Running chttp2_stream_map_test + $(OUT_DIR)\chttp2_stream_map_test.exe + +chttp2_transport_end2end_test.exe: grpc_test_util + echo Building chttp2_transport_end2end_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\transport\chttp2_transport_end2end_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\chttp2_transport_end2end_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\chttp2_transport_end2end_test.obj +chttp2_transport_end2end_test: chttp2_transport_end2end_test.exe + echo Running chttp2_transport_end2end_test + $(OUT_DIR)\chttp2_transport_end2end_test.exe + +dualstack_socket_test.exe: grpc_test_util + echo Building dualstack_socket_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\end2end\dualstack_socket_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\dualstack_socket_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\dualstack_socket_test.obj +dualstack_socket_test: dualstack_socket_test.exe + echo Running dualstack_socket_test + $(OUT_DIR)\dualstack_socket_test.exe + +echo_client.exe: grpc_test_util + echo Building echo_client + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\echo\client.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\echo_client.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\client.obj +echo_client: echo_client.exe + echo Running echo_client + $(OUT_DIR)\echo_client.exe + +echo_server.exe: grpc_test_util + echo Building echo_server + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\echo\server.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\echo_server.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\server.obj +echo_server: echo_server.exe + echo Running echo_server + $(OUT_DIR)\echo_server.exe + +echo_test.exe: grpc_test_util + echo Building echo_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\echo\echo_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\echo_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\echo_test.obj +echo_test: echo_test.exe + echo Running echo_test + $(OUT_DIR)\echo_test.exe + +fd_posix_test.exe: grpc_test_util + echo Building fd_posix_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\iomgr\fd_posix_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\fd_posix_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\fd_posix_test.obj +fd_posix_test: fd_posix_test.exe + echo Running fd_posix_test + $(OUT_DIR)\fd_posix_test.exe + +fling_client.exe: grpc_test_util + echo Building fling_client + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\fling\client.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\fling_client.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\client.obj +fling_client: fling_client.exe + echo Running fling_client + $(OUT_DIR)\fling_client.exe + +fling_server.exe: grpc_test_util + echo Building fling_server + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\fling\server.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\fling_server.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\server.obj +fling_server: fling_server.exe + echo Running fling_server + $(OUT_DIR)\fling_server.exe + +fling_stream_test.exe: grpc_test_util + echo Building fling_stream_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\fling\fling_stream_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\fling_stream_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\fling_stream_test.obj +fling_stream_test: fling_stream_test.exe + echo Running fling_stream_test + $(OUT_DIR)\fling_stream_test.exe + +fling_test.exe: grpc_test_util + echo Building fling_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\fling\fling_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\fling_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\fling_test.obj +fling_test: fling_test.exe + echo Running fling_test + $(OUT_DIR)\fling_test.exe + +gen_hpack_tables.exe: grpc_test_util + echo Building gen_hpack_tables + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\src\core\transport\chttp2\gen_hpack_tables.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\gen_hpack_tables.exe" Debug\grpc_test_util.lib Debug\gpr.lib Debug\grpc.lib $(LIBS) $(OUT_DIR)\gen_hpack_tables.obj +gen_hpack_tables: gen_hpack_tables.exe + echo Running gen_hpack_tables + $(OUT_DIR)\gen_hpack_tables.exe + +gpr_cancellable_test.exe: grpc_test_util + echo Building gpr_cancellable_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\support\cancellable_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\gpr_cancellable_test.exe" Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\cancellable_test.obj +gpr_cancellable_test: gpr_cancellable_test.exe + echo Running gpr_cancellable_test + $(OUT_DIR)\gpr_cancellable_test.exe + +gpr_cmdline_test.exe: grpc_test_util + echo Building gpr_cmdline_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\support\cmdline_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\gpr_cmdline_test.exe" Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\cmdline_test.obj +gpr_cmdline_test: gpr_cmdline_test.exe + echo Running gpr_cmdline_test + $(OUT_DIR)\gpr_cmdline_test.exe + +gpr_env_test.exe: grpc_test_util + echo Building gpr_env_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\support\env_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\gpr_env_test.exe" Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\env_test.obj +gpr_env_test: gpr_env_test.exe + echo Running gpr_env_test + $(OUT_DIR)\gpr_env_test.exe + +gpr_file_test.exe: grpc_test_util + echo Building gpr_file_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\support\file_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\gpr_file_test.exe" Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\file_test.obj +gpr_file_test: gpr_file_test.exe + echo Running gpr_file_test + $(OUT_DIR)\gpr_file_test.exe + +gpr_histogram_test.exe: grpc_test_util + echo Building gpr_histogram_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\support\histogram_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\gpr_histogram_test.exe" Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\histogram_test.obj +gpr_histogram_test: gpr_histogram_test.exe + echo Running gpr_histogram_test + $(OUT_DIR)\gpr_histogram_test.exe + +gpr_host_port_test.exe: grpc_test_util + echo Building gpr_host_port_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\support\host_port_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\gpr_host_port_test.exe" Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\host_port_test.obj +gpr_host_port_test: gpr_host_port_test.exe + echo Running gpr_host_port_test + $(OUT_DIR)\gpr_host_port_test.exe + +gpr_log_test.exe: grpc_test_util + echo Building gpr_log_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\support\log_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\gpr_log_test.exe" Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\log_test.obj +gpr_log_test: gpr_log_test.exe + echo Running gpr_log_test + $(OUT_DIR)\gpr_log_test.exe + +gpr_slice_buffer_test.exe: grpc_test_util + echo Building gpr_slice_buffer_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\support\slice_buffer_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\gpr_slice_buffer_test.exe" Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\slice_buffer_test.obj +gpr_slice_buffer_test: gpr_slice_buffer_test.exe + echo Running gpr_slice_buffer_test + $(OUT_DIR)\gpr_slice_buffer_test.exe + +gpr_slice_test.exe: grpc_test_util + echo Building gpr_slice_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\support\slice_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\gpr_slice_test.exe" Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\slice_test.obj +gpr_slice_test: gpr_slice_test.exe + echo Running gpr_slice_test + $(OUT_DIR)\gpr_slice_test.exe + +gpr_string_test.exe: grpc_test_util + echo Building gpr_string_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\support\string_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\gpr_string_test.exe" Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\string_test.obj +gpr_string_test: gpr_string_test.exe + echo Running gpr_string_test + $(OUT_DIR)\gpr_string_test.exe + +gpr_sync_test.exe: grpc_test_util + echo Building gpr_sync_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\support\sync_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\gpr_sync_test.exe" Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\sync_test.obj +gpr_sync_test: gpr_sync_test.exe + echo Running gpr_sync_test + $(OUT_DIR)\gpr_sync_test.exe + +gpr_thd_test.exe: grpc_test_util + echo Building gpr_thd_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\support\thd_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\gpr_thd_test.exe" Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\thd_test.obj +gpr_thd_test: gpr_thd_test.exe + echo Running gpr_thd_test + $(OUT_DIR)\gpr_thd_test.exe + +gpr_time_test.exe: grpc_test_util + echo Building gpr_time_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\support\time_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\gpr_time_test.exe" Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\time_test.obj +gpr_time_test: gpr_time_test.exe + echo Running gpr_time_test + $(OUT_DIR)\gpr_time_test.exe + +gpr_useful_test.exe: grpc_test_util + echo Building gpr_useful_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\support\useful_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\gpr_useful_test.exe" Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\useful_test.obj +gpr_useful_test: gpr_useful_test.exe + echo Running gpr_useful_test + $(OUT_DIR)\gpr_useful_test.exe + +grpc_base64_test.exe: grpc_test_util + echo Building grpc_base64_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\security\base64_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\grpc_base64_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\base64_test.obj +grpc_base64_test: grpc_base64_test.exe + echo Running grpc_base64_test + $(OUT_DIR)\grpc_base64_test.exe + +grpc_byte_buffer_reader_test.exe: grpc_test_util + echo Building grpc_byte_buffer_reader_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\surface\byte_buffer_reader_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\grpc_byte_buffer_reader_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\byte_buffer_reader_test.obj +grpc_byte_buffer_reader_test: grpc_byte_buffer_reader_test.exe + echo Running grpc_byte_buffer_reader_test + $(OUT_DIR)\grpc_byte_buffer_reader_test.exe + +grpc_channel_stack_test.exe: grpc_test_util + echo Building grpc_channel_stack_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\channel\channel_stack_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\grpc_channel_stack_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\channel_stack_test.obj +grpc_channel_stack_test: grpc_channel_stack_test.exe + echo Running grpc_channel_stack_test + $(OUT_DIR)\grpc_channel_stack_test.exe + +grpc_completion_queue_benchmark.exe: grpc_test_util + echo Building grpc_completion_queue_benchmark + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\surface\completion_queue_benchmark.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\grpc_completion_queue_benchmark.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\completion_queue_benchmark.obj +grpc_completion_queue_benchmark: grpc_completion_queue_benchmark.exe + echo Running grpc_completion_queue_benchmark + $(OUT_DIR)\grpc_completion_queue_benchmark.exe + +grpc_completion_queue_test.exe: grpc_test_util + echo Building grpc_completion_queue_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\surface\completion_queue_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\grpc_completion_queue_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\completion_queue_test.obj +grpc_completion_queue_test: grpc_completion_queue_test.exe + echo Running grpc_completion_queue_test + $(OUT_DIR)\grpc_completion_queue_test.exe + +grpc_create_jwt.exe: grpc_test_util + echo Building grpc_create_jwt + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\security\create_jwt.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\grpc_create_jwt.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\create_jwt.obj +grpc_create_jwt: grpc_create_jwt.exe + echo Running grpc_create_jwt + $(OUT_DIR)\grpc_create_jwt.exe + +grpc_credentials_test.exe: grpc_test_util + echo Building grpc_credentials_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\security\credentials_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\grpc_credentials_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\credentials_test.obj +grpc_credentials_test: grpc_credentials_test.exe + echo Running grpc_credentials_test + $(OUT_DIR)\grpc_credentials_test.exe + +grpc_fetch_oauth2.exe: grpc_test_util + echo Building grpc_fetch_oauth2 + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\security\fetch_oauth2.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\grpc_fetch_oauth2.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\fetch_oauth2.obj +grpc_fetch_oauth2: grpc_fetch_oauth2.exe + echo Running grpc_fetch_oauth2 + $(OUT_DIR)\grpc_fetch_oauth2.exe + +grpc_json_token_test.exe: grpc_test_util + echo Building grpc_json_token_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\security\json_token_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\grpc_json_token_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\json_token_test.obj +grpc_json_token_test: grpc_json_token_test.exe + echo Running grpc_json_token_test + $(OUT_DIR)\grpc_json_token_test.exe + +grpc_print_google_default_creds_token.exe: grpc_test_util + echo Building grpc_print_google_default_creds_token + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\security\print_google_default_creds_token.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\grpc_print_google_default_creds_token.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\print_google_default_creds_token.obj +grpc_print_google_default_creds_token: grpc_print_google_default_creds_token.exe + echo Running grpc_print_google_default_creds_token + $(OUT_DIR)\grpc_print_google_default_creds_token.exe + +grpc_stream_op_test.exe: grpc_test_util + echo Building grpc_stream_op_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\transport\stream_op_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\grpc_stream_op_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\stream_op_test.obj +grpc_stream_op_test: grpc_stream_op_test.exe + echo Running grpc_stream_op_test + $(OUT_DIR)\grpc_stream_op_test.exe + +hpack_parser_test.exe: grpc_test_util + echo Building hpack_parser_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\transport\chttp2\hpack_parser_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\hpack_parser_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\hpack_parser_test.obj +hpack_parser_test: hpack_parser_test.exe + echo Running hpack_parser_test + $(OUT_DIR)\hpack_parser_test.exe + +hpack_table_test.exe: grpc_test_util + echo Building hpack_table_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\transport\chttp2\hpack_table_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\hpack_table_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\hpack_table_test.obj +hpack_table_test: hpack_table_test.exe + echo Running hpack_table_test + $(OUT_DIR)\hpack_table_test.exe + +httpcli_format_request_test.exe: grpc_test_util + echo Building httpcli_format_request_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\httpcli\format_request_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\httpcli_format_request_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\format_request_test.obj +httpcli_format_request_test: httpcli_format_request_test.exe + echo Running httpcli_format_request_test + $(OUT_DIR)\httpcli_format_request_test.exe + +httpcli_parser_test.exe: grpc_test_util + echo Building httpcli_parser_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\httpcli\parser_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\httpcli_parser_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\parser_test.obj +httpcli_parser_test: httpcli_parser_test.exe + echo Running httpcli_parser_test + $(OUT_DIR)\httpcli_parser_test.exe + +httpcli_test.exe: grpc_test_util + echo Building httpcli_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\httpcli\httpcli_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\httpcli_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\httpcli_test.obj +httpcli_test: httpcli_test.exe + echo Running httpcli_test + $(OUT_DIR)\httpcli_test.exe + +json_rewrite.exe: grpc_test_util + echo Building json_rewrite + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\json\json_rewrite.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\json_rewrite.exe" Debug\grpc.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\json_rewrite.obj +json_rewrite: json_rewrite.exe + echo Running json_rewrite + $(OUT_DIR)\json_rewrite.exe + +json_rewrite_test.exe: grpc_test_util + echo Building json_rewrite_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\json\json_rewrite_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\json_rewrite_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\json_rewrite_test.obj +json_rewrite_test: json_rewrite_test.exe + echo Running json_rewrite_test + $(OUT_DIR)\json_rewrite_test.exe + +json_test.exe: grpc_test_util + echo Building json_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\json\json_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\json_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\json_test.obj +json_test: json_test.exe + echo Running json_test + $(OUT_DIR)\json_test.exe + +lame_client_test.exe: grpc_test_util + echo Building lame_client_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\surface\lame_client_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\lame_client_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\lame_client_test.obj +lame_client_test: lame_client_test.exe + echo Running lame_client_test + $(OUT_DIR)\lame_client_test.exe + +low_level_ping_pong_benchmark.exe: grpc_test_util + echo Building low_level_ping_pong_benchmark + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\network_benchmarks\low_level_ping_pong.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\low_level_ping_pong_benchmark.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\low_level_ping_pong.obj +low_level_ping_pong_benchmark: low_level_ping_pong_benchmark.exe + echo Running low_level_ping_pong_benchmark + $(OUT_DIR)\low_level_ping_pong_benchmark.exe + +message_compress_test.exe: grpc_test_util + echo Building message_compress_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\compression\message_compress_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\message_compress_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\message_compress_test.obj +message_compress_test: message_compress_test.exe + echo Running message_compress_test + $(OUT_DIR)\message_compress_test.exe + +metadata_buffer_test.exe: grpc_test_util + echo Building metadata_buffer_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\channel\metadata_buffer_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\metadata_buffer_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\metadata_buffer_test.obj +metadata_buffer_test: metadata_buffer_test.exe + echo Running metadata_buffer_test + $(OUT_DIR)\metadata_buffer_test.exe + +multi_init_test.exe: grpc_test_util + echo Building multi_init_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\surface\multi_init_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\multi_init_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\multi_init_test.obj +multi_init_test: multi_init_test.exe + echo Running multi_init_test + $(OUT_DIR)\multi_init_test.exe + +murmur_hash_test.exe: grpc_test_util + echo Building murmur_hash_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\support\murmur_hash_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\murmur_hash_test.exe" Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\murmur_hash_test.obj +murmur_hash_test: murmur_hash_test.exe + echo Running murmur_hash_test + $(OUT_DIR)\murmur_hash_test.exe + +no_server_test.exe: grpc_test_util + echo Building no_server_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\end2end\no_server_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\no_server_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\no_server_test.obj +no_server_test: no_server_test.exe + echo Running no_server_test + $(OUT_DIR)\no_server_test.exe + +poll_kick_posix_test.exe: grpc_test_util + echo Building poll_kick_posix_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\iomgr\poll_kick_posix_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\poll_kick_posix_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\poll_kick_posix_test.obj +poll_kick_posix_test: poll_kick_posix_test.exe + echo Running poll_kick_posix_test + $(OUT_DIR)\poll_kick_posix_test.exe + +resolve_address_test.exe: grpc_test_util + echo Building resolve_address_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\iomgr\resolve_address_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\resolve_address_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\resolve_address_test.obj +resolve_address_test: resolve_address_test.exe + echo Running resolve_address_test + $(OUT_DIR)\resolve_address_test.exe + +secure_endpoint_test.exe: grpc_test_util + echo Building secure_endpoint_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\security\secure_endpoint_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\secure_endpoint_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\secure_endpoint_test.obj +secure_endpoint_test: secure_endpoint_test.exe + echo Running secure_endpoint_test + $(OUT_DIR)\secure_endpoint_test.exe + +sockaddr_utils_test.exe: grpc_test_util + echo Building sockaddr_utils_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\iomgr\sockaddr_utils_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\sockaddr_utils_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\sockaddr_utils_test.obj +sockaddr_utils_test: sockaddr_utils_test.exe + echo Running sockaddr_utils_test + $(OUT_DIR)\sockaddr_utils_test.exe + +tcp_client_posix_test.exe: grpc_test_util + echo Building tcp_client_posix_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\iomgr\tcp_client_posix_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\tcp_client_posix_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\tcp_client_posix_test.obj +tcp_client_posix_test: tcp_client_posix_test.exe + echo Running tcp_client_posix_test + $(OUT_DIR)\tcp_client_posix_test.exe + +tcp_posix_test.exe: grpc_test_util + echo Building tcp_posix_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\iomgr\tcp_posix_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\tcp_posix_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\tcp_posix_test.obj +tcp_posix_test: tcp_posix_test.exe + echo Running tcp_posix_test + $(OUT_DIR)\tcp_posix_test.exe + +tcp_server_posix_test.exe: grpc_test_util + echo Building tcp_server_posix_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\iomgr\tcp_server_posix_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\tcp_server_posix_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\tcp_server_posix_test.obj +tcp_server_posix_test: tcp_server_posix_test.exe + echo Running tcp_server_posix_test + $(OUT_DIR)\tcp_server_posix_test.exe + +time_averaged_stats_test.exe: grpc_test_util + echo Building time_averaged_stats_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\iomgr\time_averaged_stats_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\time_averaged_stats_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\time_averaged_stats_test.obj +time_averaged_stats_test: time_averaged_stats_test.exe + echo Running time_averaged_stats_test + $(OUT_DIR)\time_averaged_stats_test.exe + +time_test.exe: grpc_test_util + echo Building time_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\support\time_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\time_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\time_test.obj +time_test: time_test.exe + echo Running time_test + $(OUT_DIR)\time_test.exe + +timeout_encoding_test.exe: grpc_test_util + echo Building timeout_encoding_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\transport\chttp2\timeout_encoding_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\timeout_encoding_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\timeout_encoding_test.obj +timeout_encoding_test: timeout_encoding_test.exe + echo Running timeout_encoding_test + $(OUT_DIR)\timeout_encoding_test.exe + +transport_metadata_test.exe: grpc_test_util + echo Building transport_metadata_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\transport\metadata_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\transport_metadata_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\metadata_test.obj +transport_metadata_test: transport_metadata_test.exe + echo Running transport_metadata_test + $(OUT_DIR)\transport_metadata_test.exe + +transport_security_test.exe: grpc_test_util + echo Building transport_security_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ ..\..\test\core\tsi\transport_security_test.c + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\transport_security_test.exe" Debug\grpc_test_util.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) $(OUT_DIR)\transport_security_test.obj +transport_security_test: transport_security_test.exe + echo Running transport_security_test + $(OUT_DIR)\transport_security_test.exe + diff --git a/vsprojects/vs2010/build_openssl_x86.bat b/vsprojects/vs2010/build_openssl_x86.bat new file mode 100644 index 0000000000..9f7a01324f --- /dev/null +++ b/vsprojects/vs2010/build_openssl_x86.bat @@ -0,0 +1,8 @@ +@echo Building OpenSSL 32bits using Visual Studio 2010. + +@call "%VS100COMNTOOLS%\..\..\vc\vcvarsall.bat" x86 + +cd ..\..\third_party\openssl +nmake /F ..\..\vsprojects\third_party\openssl\OpenSSL.mak init out32\ssleay32.lib out32\libeay32.lib + +pause diff --git a/vsprojects/vs2010/global.props b/vsprojects/vs2010/global.props new file mode 100644 index 0000000000..e9b9d6cb85 --- /dev/null +++ b/vsprojects/vs2010/global.props @@ -0,0 +1,14 @@ + + + + + + + + $(SolutionDir)\..\..;$(SolutionDir)\..\..\include;$(SolutionDir)\..\..\third_party\zlib;$(SolutionDir)\..\third_party;$(SolutionDir)\..\..\third_party\openssl\inc32;$(SolutionDir)\..\..\third_party\protobuf\src + GRPC_OLD_CXX;_CRT_SECURE_NO_WARNINGS;_UNICODE;UNICODE;%(PreprocessorDefinitions) + EnableAllWarnings + + + + \ No newline at end of file diff --git a/vsprojects/vs2010/gpr.vcxproj b/vsprojects/vs2010/gpr.vcxproj new file mode 100644 index 0000000000..f50f87134c --- /dev/null +++ b/vsprojects/vs2010/gpr.vcxproj @@ -0,0 +1,184 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + + + + StaticLibrary + true + Unicode + $(Configuration)\$(ProjectName)\ + + + StaticLibrary + false + true + Unicode + $(Configuration)\$(ProjectName)\ + + + + + + + + + + + + + + + gpr + + + gpr + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) + true + + + Windows + true + + + + + Level3 + NotUsing + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vsprojects/vs2010/gpr.vcxproj.filters b/vsprojects/vs2010/gpr.vcxproj.filters new file mode 100644 index 0000000000..dffaf1e62d --- /dev/null +++ b/vsprojects/vs2010/gpr.vcxproj.filters @@ -0,0 +1,217 @@ + + + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + + + + {9ea89137-2bf7-b6d9-b7af-7cb4d1b74928} + + + {e6957ec1-85ba-6515-03c0-e12878045b1f} + + + {31c42000-3ed7-95e1-d076-df814b72cdee} + + + {60eb2826-e58b-cb10-a98d-fe04727398a2} + + + {c5e1baa7-de77-beb1-9675-942261648f79} + + + {bb116f2a-ea2a-c233-82da-0c54e3cbfec1} + + + + diff --git a/vsprojects/vs2010/gpr_shared.vcxproj b/vsprojects/vs2010/gpr_shared.vcxproj new file mode 100644 index 0000000000..174911fb21 --- /dev/null +++ b/vsprojects/vs2010/gpr_shared.vcxproj @@ -0,0 +1,184 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {3D304D6B-AAF8-428B-AC7D-A698DDDE93C0} + + + + DynamicLibrary + true + Unicode + $(Configuration)\$(ProjectName)\ + + + DynamicLibrary + false + true + Unicode + $(Configuration)\$(ProjectName)\ + + + + + + + + + + + + + + + gpr + + + gpr + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) + true + + + Windows + true + + + + + Level3 + NotUsing + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vsprojects/vs2010/gpr_shared.vcxproj.filters b/vsprojects/vs2010/gpr_shared.vcxproj.filters new file mode 100644 index 0000000000..dffaf1e62d --- /dev/null +++ b/vsprojects/vs2010/gpr_shared.vcxproj.filters @@ -0,0 +1,217 @@ + + + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + + + + {9ea89137-2bf7-b6d9-b7af-7cb4d1b74928} + + + {e6957ec1-85ba-6515-03c0-e12878045b1f} + + + {31c42000-3ed7-95e1-d076-df814b72cdee} + + + {60eb2826-e58b-cb10-a98d-fe04727398a2} + + + {c5e1baa7-de77-beb1-9675-942261648f79} + + + {bb116f2a-ea2a-c233-82da-0c54e3cbfec1} + + + + diff --git a/vsprojects/vs2010/gpr_test_util.vcxproj b/vsprojects/vs2010/gpr_test_util.vcxproj new file mode 100644 index 0000000000..667e451b18 --- /dev/null +++ b/vsprojects/vs2010/gpr_test_util.vcxproj @@ -0,0 +1,90 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {EAB0A629-17A9-44DB-B5FF-E91A721FE037} + + + + StaticLibrary + true + Unicode + $(Configuration)\$(ProjectName)\ + + + StaticLibrary + false + true + Unicode + $(Configuration)\$(ProjectName)\ + + + + + + + + + + + + + + + gpr_test_util + + + gpr_test_util + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) + true + + + Windows + true + + + + + Level3 + NotUsing + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + + + + + + + + + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + + + + + + diff --git a/vsprojects/vs2010/grpc++.vcxproj b/vsprojects/vs2010/grpc++.vcxproj new file mode 100644 index 0000000000..0ee433163c --- /dev/null +++ b/vsprojects/vs2010/grpc++.vcxproj @@ -0,0 +1,177 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {C187A093-A0FE-489D-A40A-6E33DE0F9FEB} + + + + StaticLibrary + true + Unicode + $(Configuration)\$(ProjectName)\ + + + StaticLibrary + false + true + Unicode + $(Configuration)\$(ProjectName)\ + + + + + + + + + + + + + + + grpc++ + + + grpc++ + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) + true + + + Windows + true + + + + + Level3 + NotUsing + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + + + {29D16885-7228-4C31-81ED-5F9187C7F2A9} + + + + + + diff --git a/vsprojects/vs2010/grpc++.vcxproj.filters b/vsprojects/vs2010/grpc++.vcxproj.filters new file mode 100644 index 0000000000..ed93daee04 --- /dev/null +++ b/vsprojects/vs2010/grpc++.vcxproj.filters @@ -0,0 +1,211 @@ + + + + + src\cpp\client + + + src\cpp\server + + + src\cpp\client + + + src\cpp\client + + + src\cpp\client + + + src\cpp\client + + + src\cpp\client + + + src\cpp\client + + + src\cpp\client + + + src\cpp\client + + + src\cpp\client + + + src\cpp\common + + + src\cpp\common + + + src\cpp\common + + + src\cpp\proto + + + src\cpp\server + + + src\cpp\server + + + src\cpp\server + + + src\cpp\server + + + src\cpp\server + + + src\cpp\server + + + src\cpp\server + + + src\cpp\util + + + src\cpp\util + + + src\cpp\util + + + src\cpp\util + + + + + include\grpc++ + + + include\grpc++ + + + include\grpc++ + + + include\grpc++ + + + include\grpc++ + + + include\grpc++ + + + include\grpc++ + + + include\grpc++ + + + include\grpc++ + + + include\grpc++ + + + include\grpc++ + + + include\grpc++\impl + + + include\grpc++\impl + + + include\grpc++\impl + + + include\grpc++\impl + + + include\grpc++\impl + + + include\grpc++\impl + + + include\grpc++ + + + include\grpc++ + + + include\grpc++ + + + include\grpc++ + + + include\grpc++ + + + include\grpc++ + + + include\grpc++ + + + include\grpc++ + + + include\grpc++ + + + + + src\cpp\client + + + src\cpp\proto + + + src\cpp\server + + + src\cpp\util + + + + + + {82445414-24cd-8198-1fe1-4267c3f3df00} + + + {784a0281-f547-aeb0-9f55-b26b7de9c769} + + + {0da8cd95-314f-da1b-5ce7-7791a5be1f1a} + + + {328ff211-2886-406e-56f9-18ba1686f363} + + + {2420a905-e4f1-a5aa-a364-6a112878a39e} + + + {7febf32a-d7a6-76fa-9e17-f189f591c062} + + + {2336e396-7e0b-8bf9-3b09-adc6ad1f0e5b} + + + {c22e8b9b-d2eb-a2e8-0cb8-3f7e3c902a7b} + + + {321b0980-74ad-e8ca-f23b-deffa5d6bb8f} + + + {f842537a-2bf1-1ec3-b495-7d62c64a1c06} + + + + diff --git a/vsprojects/vs2010/grpc.sln b/vsprojects/vs2010/grpc.sln new file mode 100644 index 0000000000..34e437c704 --- /dev/null +++ b/vsprojects/vs2010/grpc.sln @@ -0,0 +1,100 @@ +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual C++ Express 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gpr", "gpr.vcxproj", "{B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gpr_test_util", "gpr_test_util.vcxproj", "{EAB0A629-17A9-44DB-B5FF-E91A721FE037}" + ProjectSection(ProjectDependencies) = postProject + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc", "grpc.vcxproj", "{29D16885-7228-4C31-81ED-5F9187C7F2A9}" + ProjectSection(ProjectDependencies) = postProject + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc_test_util", "grpc_test_util.vcxproj", "{17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}" + ProjectSection(ProjectDependencies) = postProject + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + {29D16885-7228-4C31-81ED-5F9187C7F2A9} = {29D16885-7228-4C31-81ED-5F9187C7F2A9} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc_unsecure", "grpc_unsecure.vcxproj", "{46CEDFFF-9692-456A-AA24-38B5D6BCF4C5}" + ProjectSection(ProjectDependencies) = postProject + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc++", "grpc++.vcxproj", "{C187A093-A0FE-489D-A40A-6E33DE0F9FEB}" + ProjectSection(ProjectDependencies) = postProject + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + {29D16885-7228-4C31-81ED-5F9187C7F2A9} = {29D16885-7228-4C31-81ED-5F9187C7F2A9} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc_csharp_ext", "grpc_csharp_ext.vcxproj", "{D64C6D63-4458-4A88-AB38-35678384A7E4}" + ProjectSection(ProjectDependencies) = postProject + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + {29D16885-7228-4C31-81ED-5F9187C7F2A9} = {29D16885-7228-4C31-81ED-5F9187C7F2A9} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gpr_shared", "gpr_shared.vcxproj", "{3D304D6B-AAF8-428B-AC7D-A698DDDE93C0}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc_shared", "grpc_shared.vcxproj", "{F2EE8FDB-F1E0-43A0-A297-6F255BB52AAA}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc_csharp_ext_shared", "grpc_csharp_ext_shared.vcxproj", "{C26D04A8-37C6-44C7-B458-906C9FCE928C}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibvc", "third_party\zlibvc.vcxproj", "{8FD826F8-3739-44E6-8CC8-997122E53B8D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}.Debug|Win32.ActiveCfg = Debug|Win32 + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}.Debug|Win32.Build.0 = Debug|Win32 + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}.Release|Win32.ActiveCfg = Release|Win32 + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}.Release|Win32.Build.0 = Release|Win32 + {EAB0A629-17A9-44DB-B5FF-E91A721FE037}.Debug|Win32.ActiveCfg = Debug|Win32 + {EAB0A629-17A9-44DB-B5FF-E91A721FE037}.Debug|Win32.Build.0 = Debug|Win32 + {EAB0A629-17A9-44DB-B5FF-E91A721FE037}.Release|Win32.ActiveCfg = Release|Win32 + {EAB0A629-17A9-44DB-B5FF-E91A721FE037}.Release|Win32.Build.0 = Release|Win32 + {29D16885-7228-4C31-81ED-5F9187C7F2A9}.Debug|Win32.ActiveCfg = Debug|Win32 + {29D16885-7228-4C31-81ED-5F9187C7F2A9}.Debug|Win32.Build.0 = Debug|Win32 + {29D16885-7228-4C31-81ED-5F9187C7F2A9}.Release|Win32.ActiveCfg = Release|Win32 + {29D16885-7228-4C31-81ED-5F9187C7F2A9}.Release|Win32.Build.0 = Release|Win32 + {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}.Debug|Win32.ActiveCfg = Debug|Win32 + {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}.Debug|Win32.Build.0 = Debug|Win32 + {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}.Release|Win32.ActiveCfg = Release|Win32 + {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}.Release|Win32.Build.0 = Release|Win32 + {46CEDFFF-9692-456A-AA24-38B5D6BCF4C5}.Debug|Win32.ActiveCfg = Debug|Win32 + {46CEDFFF-9692-456A-AA24-38B5D6BCF4C5}.Debug|Win32.Build.0 = Debug|Win32 + {46CEDFFF-9692-456A-AA24-38B5D6BCF4C5}.Release|Win32.ActiveCfg = Release|Win32 + {46CEDFFF-9692-456A-AA24-38B5D6BCF4C5}.Release|Win32.Build.0 = Release|Win32 + {C187A093-A0FE-489D-A40A-6E33DE0F9FEB}.Debug|Win32.ActiveCfg = Debug|Win32 + {C187A093-A0FE-489D-A40A-6E33DE0F9FEB}.Debug|Win32.Build.0 = Debug|Win32 + {C187A093-A0FE-489D-A40A-6E33DE0F9FEB}.Release|Win32.ActiveCfg = Release|Win32 + {C187A093-A0FE-489D-A40A-6E33DE0F9FEB}.Release|Win32.Build.0 = Release|Win32 + {D64C6D63-4458-4A88-AB38-35678384A7E4}.Debug|Win32.ActiveCfg = Debug|Win32 + {D64C6D63-4458-4A88-AB38-35678384A7E4}.Debug|Win32.Build.0 = Debug|Win32 + {D64C6D63-4458-4A88-AB38-35678384A7E4}.Release|Win32.ActiveCfg = Release|Win32 + {D64C6D63-4458-4A88-AB38-35678384A7E4}.Release|Win32.Build.0 = Release|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Win32.ActiveCfg = Debug|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Win32.Build.0 = Debug|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Win32.ActiveCfg = Release|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Win32.Build.0 = Release|Win32 + {3D304D6B-AAF8-428B-AC7D-A698DDDE93C0}.Debug|Win32.ActiveCfg = Debug|Win32 + {3D304D6B-AAF8-428B-AC7D-A698DDDE93C0}.Debug|Win32.Build.0 = Debug|Win32 + {3D304D6B-AAF8-428B-AC7D-A698DDDE93C0}.Release|Win32.ActiveCfg = Release|Win32 + {3D304D6B-AAF8-428B-AC7D-A698DDDE93C0}.Release|Win32.Build.0 = Release|Win32 + {F2EE8FDB-F1E0-43A0-A297-6F255BB52AAA}.Debug|Win32.ActiveCfg = Debug|Win32 + {F2EE8FDB-F1E0-43A0-A297-6F255BB52AAA}.Debug|Win32.Build.0 = Debug|Win32 + {F2EE8FDB-F1E0-43A0-A297-6F255BB52AAA}.Release|Win32.ActiveCfg = Release|Win32 + {F2EE8FDB-F1E0-43A0-A297-6F255BB52AAA}.Release|Win32.Build.0 = Release|Win32 + {C26D04A8-37C6-44C7-B458-906C9FCE928C}.Debug|Win32.ActiveCfg = Debug|Win32 + {C26D04A8-37C6-44C7-B458-906C9FCE928C}.Debug|Win32.Build.0 = Debug|Win32 + {C26D04A8-37C6-44C7-B458-906C9FCE928C}.Release|Win32.ActiveCfg = Release|Win32 + {C26D04A8-37C6-44C7-B458-906C9FCE928C}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/vsprojects/vs2010/grpc.vcxproj b/vsprojects/vs2010/grpc.vcxproj new file mode 100644 index 0000000000..203ca347d3 --- /dev/null +++ b/vsprojects/vs2010/grpc.vcxproj @@ -0,0 +1,434 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {29D16885-7228-4C31-81ED-5F9187C7F2A9} + + + + StaticLibrary + true + Unicode + $(Configuration)\$(ProjectName)\ + + + StaticLibrary + false + true + Unicode + $(Configuration)\$(ProjectName)\ + + + + + + + + + + + + + + + grpc + + + grpc + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) + true + + + Windows + true + + + + + Level3 + NotUsing + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + + + + + + diff --git a/vsprojects/vs2010/grpc.vcxproj.filters b/vsprojects/vs2010/grpc.vcxproj.filters new file mode 100644 index 0000000000..20dbe8c444 --- /dev/null +++ b/vsprojects/vs2010/grpc.vcxproj.filters @@ -0,0 +1,736 @@ + + + + + src\core\httpcli + + + src\core\httpcli + + + src\core\httpcli + + + src\core\httpcli + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\surface + + + src\core\surface + + + src\core\tsi + + + src\core\tsi + + + src\core\tsi + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\compression + + + src\core\compression + + + src\core\debug + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\json + + + src\core\json + + + src\core\json + + + src\core\json + + + src\core\statistics + + + src\core\statistics + + + src\core\statistics + + + src\core\statistics + + + src\core\statistics + + + src\core\statistics + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport + + + src\core\transport + + + src\core\transport + + + src\core\transport + + + + + include\grpc + + + include\grpc + + + include\grpc + + + include\grpc + + + include\grpc + + + include\grpc + + + + + src\core\httpcli + + + src\core\httpcli + + + src\core\httpcli + + + src\core\httpcli + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\tsi + + + src\core\tsi + + + src\core\tsi + + + src\core\tsi + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\compression + + + src\core\compression + + + src\core\debug + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\json + + + src\core\json + + + src\core\json + + + src\core\json + + + src\core\statistics + + + src\core\statistics + + + src\core\statistics + + + src\core\statistics + + + src\core\statistics + + + src\core\statistics + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport + + + src\core\transport + + + src\core\transport + + + src\core\transport + + + src\core\transport + + + + + + {968de0a1-346d-b75a-6f19-6a55119b8235} + + + {880c644d-b84f-cfca-98bd-e145f36232ab} + + + {d538af37-07b2-062b-fa2a-d9f882cb2737} + + + {ea745680-21ea-9c5e-679b-64dc40562d08} + + + {d897b6c3-c555-234e-a589-b4f008063615} + + + {263cb913-dfe6-42a4-096b-cac231f76305} + + + {1da7ef8a-a06d-5499-b3de-19fee4a4214d} + + + {a9bc00ad-835f-c625-c6d9-6a1324f98b9f} + + + {1baf3894-af37-e647-bdbc-95dc17ed0073} + + + {e665cc0e-b994-d7c5-cc18-2007392019f0} + + + {1d850ac6-e639-4eab-5338-4ba40272fcc9} + + + {0ef49896-2313-4a3f-1ce2-716fa0e5c6ca} + + + {aeb18e82-5d25-0aad-8b02-a0a3470073ce} + + + {168fa1b1-1c18-eb55-9a4d-746bc58df2c1} + + + {b8b623c3-a168-a2b1-0d5f-b70a1f1cd8d2} + + + {0b0f9ab1-efa4-7f03-e446-6fb9b5227e84} + + + + diff --git a/vsprojects/vs2010/grpc_csharp_ext.vcxproj b/vsprojects/vs2010/grpc_csharp_ext.vcxproj new file mode 100644 index 0000000000..a507a9b714 --- /dev/null +++ b/vsprojects/vs2010/grpc_csharp_ext.vcxproj @@ -0,0 +1,94 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {D64C6D63-4458-4A88-AB38-35678384A7E4} + + + + StaticLibrary + true + Unicode + $(Configuration)\$(ProjectName)\ + + + StaticLibrary + false + true + Unicode + $(Configuration)\$(ProjectName)\ + + + + + + + + + + + + + + + grpc_csharp_ext + + + grpc_csharp_ext + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) + true + + + Windows + true + + + + + Level3 + NotUsing + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + + + + + + + + + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + + + {29D16885-7228-4C31-81ED-5F9187C7F2A9} + + + + + + + diff --git a/vsprojects/vs2010/grpc_csharp_ext_shared.vcxproj b/vsprojects/vs2010/grpc_csharp_ext_shared.vcxproj new file mode 100644 index 0000000000..b17f927de4 --- /dev/null +++ b/vsprojects/vs2010/grpc_csharp_ext_shared.vcxproj @@ -0,0 +1,98 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {C26D04A8-37C6-44C7-B458-906C9FCE928C} + + + + DynamicLibrary + true + Unicode + $(Configuration)\$(ProjectName)\ + + + DynamicLibrary + false + true + Unicode + $(Configuration)\$(ProjectName)\ + + + + + + + + + + + + + + + + + + + grpc_csharp_ext + + + grpc_csharp_ext + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) + true + + + Windows + true + + + + + Level3 + NotUsing + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + + + + + + + + + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + + + {29D16885-7228-4C31-81ED-5F9187C7F2A9} + + + + + + + diff --git a/vsprojects/vs2010/grpc_shared.vcxproj b/vsprojects/vs2010/grpc_shared.vcxproj new file mode 100644 index 0000000000..96c2fe0b85 --- /dev/null +++ b/vsprojects/vs2010/grpc_shared.vcxproj @@ -0,0 +1,442 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {F2EE8FDB-F1E0-43A0-A297-6F255BB52AAA} + + + + DynamicLibrary + true + Unicode + $(Configuration)\$(ProjectName)\ + + + DynamicLibrary + false + true + Unicode + $(Configuration)\$(ProjectName)\ + + + + + + + + + + + + + + + + + + + grpc + + + grpc + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) + true + + + Windows + true + + + + + Level3 + NotUsing + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + + + {8fd826f8-3739-44e6-8cc8-997122e53b8d} + + + + + + + diff --git a/vsprojects/vs2010/grpc_shared.vcxproj.filters b/vsprojects/vs2010/grpc_shared.vcxproj.filters new file mode 100644 index 0000000000..20dbe8c444 --- /dev/null +++ b/vsprojects/vs2010/grpc_shared.vcxproj.filters @@ -0,0 +1,736 @@ + + + + + src\core\httpcli + + + src\core\httpcli + + + src\core\httpcli + + + src\core\httpcli + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\surface + + + src\core\surface + + + src\core\tsi + + + src\core\tsi + + + src\core\tsi + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\compression + + + src\core\compression + + + src\core\debug + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\json + + + src\core\json + + + src\core\json + + + src\core\json + + + src\core\statistics + + + src\core\statistics + + + src\core\statistics + + + src\core\statistics + + + src\core\statistics + + + src\core\statistics + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport + + + src\core\transport + + + src\core\transport + + + src\core\transport + + + + + include\grpc + + + include\grpc + + + include\grpc + + + include\grpc + + + include\grpc + + + include\grpc + + + + + src\core\httpcli + + + src\core\httpcli + + + src\core\httpcli + + + src\core\httpcli + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\tsi + + + src\core\tsi + + + src\core\tsi + + + src\core\tsi + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\compression + + + src\core\compression + + + src\core\debug + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\json + + + src\core\json + + + src\core\json + + + src\core\json + + + src\core\statistics + + + src\core\statistics + + + src\core\statistics + + + src\core\statistics + + + src\core\statistics + + + src\core\statistics + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport + + + src\core\transport + + + src\core\transport + + + src\core\transport + + + src\core\transport + + + + + + {968de0a1-346d-b75a-6f19-6a55119b8235} + + + {880c644d-b84f-cfca-98bd-e145f36232ab} + + + {d538af37-07b2-062b-fa2a-d9f882cb2737} + + + {ea745680-21ea-9c5e-679b-64dc40562d08} + + + {d897b6c3-c555-234e-a589-b4f008063615} + + + {263cb913-dfe6-42a4-096b-cac231f76305} + + + {1da7ef8a-a06d-5499-b3de-19fee4a4214d} + + + {a9bc00ad-835f-c625-c6d9-6a1324f98b9f} + + + {1baf3894-af37-e647-bdbc-95dc17ed0073} + + + {e665cc0e-b994-d7c5-cc18-2007392019f0} + + + {1d850ac6-e639-4eab-5338-4ba40272fcc9} + + + {0ef49896-2313-4a3f-1ce2-716fa0e5c6ca} + + + {aeb18e82-5d25-0aad-8b02-a0a3470073ce} + + + {168fa1b1-1c18-eb55-9a4d-746bc58df2c1} + + + {b8b623c3-a168-a2b1-0d5f-b70a1f1cd8d2} + + + {0b0f9ab1-efa4-7f03-e446-6fb9b5227e84} + + + + diff --git a/vsprojects/vs2010/grpc_test_util.vcxproj b/vsprojects/vs2010/grpc_test_util.vcxproj new file mode 100644 index 0000000000..6be239156e --- /dev/null +++ b/vsprojects/vs2010/grpc_test_util.vcxproj @@ -0,0 +1,113 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} + + + + StaticLibrary + true + Unicode + $(Configuration)\$(ProjectName)\ + + + StaticLibrary + false + true + Unicode + $(Configuration)\$(ProjectName)\ + + + + + + + + + + + + + + + grpc_test_util + + + grpc_test_util + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) + true + + + Windows + true + + + + + Level3 + NotUsing + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + + + {29D16885-7228-4C31-81ED-5F9187C7F2A9} + + + + + + diff --git a/vsprojects/vs2010/grpc_unsecure.vcxproj b/vsprojects/vs2010/grpc_unsecure.vcxproj new file mode 100644 index 0000000000..1558d72514 --- /dev/null +++ b/vsprojects/vs2010/grpc_unsecure.vcxproj @@ -0,0 +1,378 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {46CEDFFF-9692-456A-AA24-38B5D6BCF4C5} + + + + StaticLibrary + true + Unicode + $(Configuration)\$(ProjectName)\ + + + StaticLibrary + false + true + Unicode + $(Configuration)\$(ProjectName)\ + + + + + + + + + + + + + + + grpc_unsecure + + + grpc_unsecure + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) + true + + + Windows + true + + + + + Level3 + NotUsing + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + + + + + + diff --git a/vsprojects/vs2010/grpc_unsecure.vcxproj.filters b/vsprojects/vs2010/grpc_unsecure.vcxproj.filters new file mode 100644 index 0000000000..4b758d6113 --- /dev/null +++ b/vsprojects/vs2010/grpc_unsecure.vcxproj.filters @@ -0,0 +1,619 @@ + + + + + src\core\surface + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\compression + + + src\core\compression + + + src\core\debug + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\json + + + src\core\json + + + src\core\json + + + src\core\json + + + src\core\statistics + + + src\core\statistics + + + src\core\statistics + + + src\core\statistics + + + src\core\statistics + + + src\core\statistics + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport + + + src\core\transport + + + src\core\transport + + + src\core\transport + + + + + include\grpc + + + include\grpc + + + include\grpc + + + include\grpc + + + include\grpc + + + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\compression + + + src\core\compression + + + src\core\debug + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\json + + + src\core\json + + + src\core\json + + + src\core\json + + + src\core\statistics + + + src\core\statistics + + + src\core\statistics + + + src\core\statistics + + + src\core\statistics + + + src\core\statistics + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport + + + src\core\transport + + + src\core\transport + + + src\core\transport + + + src\core\transport + + + + + + {10076c7e-7c8e-8005-0c81-64454af2cbc8} + + + {77b9717b-b8d8-dd5f-14bb-a3e96809a70a} + + + {aaf326a1-c884-46ea-875a-cbbd9983e539} + + + {88491077-386b-2039-d14c-0c40136b5f7a} + + + {cc102c4b-66ff-cf4c-2288-d76327e1a183} + + + {2e3aca1d-223d-10a1-b282-7f9fc68ee6f5} + + + {6d8d5774-7291-554d-fafa-583463cd3fd9} + + + {a9df8b24-ecea-ff6d-8999-d8fa54cd70bf} + + + {443ffc61-1bea-2477-6e54-1ddf8c139264} + + + {e084164c-a069-00e3-db35-4e0b1cd6f0b7} + + + {6cd0127e-c24b-d43c-38f5-198db8d4322a} + + + {6687ff98-e36e-c0b1-2756-1bc79edec406} + + + {5fcd6206-f774-9ae6-4b85-305d6a723843} + + + + diff --git a/vsprojects/vs2010/ssl.props b/vsprojects/vs2010/ssl.props new file mode 100644 index 0000000000..283bd17817 --- /dev/null +++ b/vsprojects/vs2010/ssl.props @@ -0,0 +1,13 @@ + + + + + + + + ..\..\third_party\openssl\out32;%(AdditionalLibraryDirectories) + ssleay32.lib;libeay32.lib;%(AdditionalDependencies) + + + + \ No newline at end of file diff --git a/vsprojects/vs2010/third_party/zlibvc.vcxproj b/vsprojects/vs2010/third_party/zlibvc.vcxproj new file mode 100644 index 0000000000..749e3fcafb --- /dev/null +++ b/vsprojects/vs2010/third_party/zlibvc.vcxproj @@ -0,0 +1,188 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {8FD826F8-3739-44E6-8CC8-997122E53B8D} + + + + StaticLibrary + false + true + + + StaticLibrary + false + Unicode + + + + + + + + + + + + + true + false + false + false + zlibwapi + zlibwapi + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + Win32 + $(OutDir)zlibvc.tlb + + + Disabled + ..\..\..\third_party\zlib;..\..\..\third_party\zlib\masmx86;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + + + false + $(IntDir)zlibvc.pch + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + ProgramDatabase + + + _DEBUG;%(PreprocessorDefinitions) + 0x040c + + + /MACHINE:I386 /SAFESEH:NO %(AdditionalOptions) + ..\..\..\third_party\zlib\contrib\masmx86\match686.obj;..\..\..\third_party\zlib\contrib\masmx86\inffas32.obj;%(AdditionalDependencies) + $(OutDir)zlibwapi.dll + true + .\zlibvc.def + true + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + false + + + $(OutDir)zlibwapi.lib + + + cd ..\..\..\third_party\zlib\contrib\masmx86 + bld_ml32.bat + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + Win32 + $(OutDir)zlibvc.tlb + + + OnlyExplicitInline + ..\..\..\third_party\zlib;..\..\..\third_party\zlib\contrib\masmx86;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + true + + + false + true + $(IntDir)zlibvc.pch + All + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040c + + + /MACHINE:I386 %(AdditionalOptions) + ..\..\..\third_party\zlib\contrib\masmx86\match686.obj;..\..\..\third_party\zlib\contrib\masmx86\inffas32.obj;%(AdditionalDependencies) + $(OutDir)zlibwapi.dll + true + false + .\zlibvc.def + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + false + + + $(OutDir)zlibwapi.lib + + + cd ..\..\..\third_party\zlib\contrib\masmx86 + bld_ml32.bat + + + + + + + + + + + + + + + + + + + + + %(AdditionalIncludeDirectories) + ZLIB_INTERNAL;%(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + ZLIB_INTERNAL;%(PreprocessorDefinitions) + + + + + + + + + + + + + + + + + + diff --git a/vsprojects/vs2010/winsock.props b/vsprojects/vs2010/winsock.props new file mode 100644 index 0000000000..1e84104911 --- /dev/null +++ b/vsprojects/vs2010/winsock.props @@ -0,0 +1,12 @@ + + + + + + + + ws2_32.lib;%(AdditionalDependencies) + + + + \ No newline at end of file -- cgit v1.2.3 From f2554d051bef272ca627c84283fa8022df772fbb Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Thu, 2 Apr 2015 13:58:27 -0700 Subject: Revive proper SIGINT handling --- test/cpp/qps/worker.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/cpp/qps/worker.cc b/test/cpp/qps/worker.cc index 378151c571..b6830cc055 100644 --- a/test/cpp/qps/worker.cc +++ b/test/cpp/qps/worker.cc @@ -71,6 +71,8 @@ using namespace gflags; static bool got_sigint = false; +static void sigint_handler(int x) {got_sigint = true;} + namespace grpc { namespace testing { @@ -248,6 +250,8 @@ int main(int argc, char** argv) { grpc_init(); ParseCommandLineFlags(&argc, &argv, true); + signal(SIGINT, sigint_handler); + grpc::testing::RunServer(); grpc_shutdown(); -- cgit v1.2.3 From dc7110fdc581b49662e0a640da717e683c547b5a Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Thu, 2 Apr 2015 13:59:05 -0700 Subject: Add new CONFIG for building with mutrace --- Makefile | 9 +++++++++ templates/Makefile.template | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/Makefile b/Makefile index 0b2fe0701d..fad9eb26fb 100644 --- a/Makefile +++ b/Makefile @@ -94,6 +94,15 @@ CPPFLAGS_dbg = -O0 LDFLAGS_dbg = DEFINES_dbg = _DEBUG DEBUG +VALID_CONFIG_mutrace = 1 +CC_mutrace = $(DEFAULT_CC) +CXX_mutrace = $(DEFAULT_CXX) +LD_mutrace = $(DEFAULT_CC) +LDXX_mutrace = $(DEFAULT_CXX) +CPPFLAGS_mutrace = -O0 +LDFLAGS_mutrace = -rdynamic +DEFINES_mutrace = _DEBUG DEBUG + VALID_CONFIG_valgrind = 1 REQUIRE_CUSTOM_LIBRARIES_valgrind = 1 CC_valgrind = $(DEFAULT_CC) diff --git a/templates/Makefile.template b/templates/Makefile.template index 36d11425df..340cf23599 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -111,6 +111,15 @@ CPPFLAGS_dbg = -O0 LDFLAGS_dbg = DEFINES_dbg = _DEBUG DEBUG +VALID_CONFIG_mutrace = 1 +CC_mutrace = $(DEFAULT_CC) +CXX_mutrace = $(DEFAULT_CXX) +LD_mutrace = $(DEFAULT_CC) +LDXX_mutrace = $(DEFAULT_CXX) +CPPFLAGS_mutrace = -O0 +LDFLAGS_mutrace = -rdynamic +DEFINES_mutrace = _DEBUG DEBUG + VALID_CONFIG_valgrind = 1 REQUIRE_CUSTOM_LIBRARIES_valgrind = 1 CC_valgrind = $(DEFAULT_CC) -- cgit v1.2.3 From 7d3d9ca24c3079030b2d57c1548a9d1d32b4829b Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Thu, 2 Apr 2015 14:34:27 -0700 Subject: Eliminate a redundant unlock-lock pair since this code is only invoked from one place --- src/core/transport/metadata.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/core/transport/metadata.c b/src/core/transport/metadata.c index 1c15716fad..066cc263a1 100644 --- a/src/core/transport/metadata.c +++ b/src/core/transport/metadata.c @@ -97,7 +97,7 @@ static void internal_string_ref(internal_string *s); static void internal_string_unref(internal_string *s); static void discard_metadata(grpc_mdctx *ctx); static void gc_mdtab(grpc_mdctx *ctx); -static void metadata_context_destroy(grpc_mdctx *ctx); +static void metadata_context_destroy_locked(grpc_mdctx *ctx); static void lock(grpc_mdctx *ctx) { gpr_mu_lock(&ctx->mu); } @@ -122,8 +122,7 @@ static void unlock(grpc_mdctx *ctx) { discard_metadata(ctx); } if (ctx->strtab_count == 0) { - gpr_mu_unlock(&ctx->mu); - metadata_context_destroy(ctx); + metadata_context_destroy_locked(ctx); return; } } @@ -185,8 +184,7 @@ static void discard_metadata(grpc_mdctx *ctx) { } } -static void metadata_context_destroy(grpc_mdctx *ctx) { - gpr_mu_lock(&ctx->mu); +static void metadata_context_destroy_locked(grpc_mdctx *ctx) { GPR_ASSERT(ctx->strtab_count == 0); GPR_ASSERT(ctx->mdtab_count == 0); GPR_ASSERT(ctx->mdtab_free == 0); -- cgit v1.2.3 From e80fdd374040186087e339c1e90ffcf45cce7029 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 2 Apr 2015 14:43:03 -0700 Subject: Updated GeneratedCodeTest to match (not so) recent stub changes --- src/php/tests/generated_code/GeneratedCodeTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/php/tests/generated_code/GeneratedCodeTest.php b/src/php/tests/generated_code/GeneratedCodeTest.php index afd7f21de4..927d24ca63 100755 --- a/src/php/tests/generated_code/GeneratedCodeTest.php +++ b/src/php/tests/generated_code/GeneratedCodeTest.php @@ -41,7 +41,8 @@ class GeneratedCodeTest extends PHPUnit_Framework_TestCase { protected static $client; protected static $timeout; public static function setUpBeforeClass() { - self::$client = new math\MathClient(getenv('GRPC_TEST_HOST')); + self::$client = new math\MathClient(new Grpc\BaseStub( + getenv('GRPC_TEST_HOST'), [])); } public function testSimpleRequest() { -- cgit v1.2.3 From 74c14e5ac752edc7e1dc0aaf31abfd1153df1d0a Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Thu, 2 Apr 2015 14:58:53 -0700 Subject: Add in a racy check for min deadline in run_some_expired_alarms before attempting the trylock. This shaves the number of g_mu and g_checker_mu uses dramatically in perf test workload and all tests still pass. --- src/core/iomgr/alarm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/iomgr/alarm.c b/src/core/iomgr/alarm.c index 5860834de3..3b7092449a 100644 --- a/src/core/iomgr/alarm.c +++ b/src/core/iomgr/alarm.c @@ -307,6 +307,10 @@ static int run_some_expired_alarms(gpr_mu *drop_mu, gpr_timespec now, /* TODO(ctiller): verify that there are any alarms (atomically) here */ + if (gpr_time_cmp(g_shard_queue[0]->min_deadline, now) >= 0) { + return 0; + } + if (gpr_mu_trylock(&g_checker_mu)) { gpr_mu_lock(&g_mu); -- cgit v1.2.3 From 8c61db91648ae4852ac7db7522eb0168e01e01a0 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 2 Apr 2015 15:22:31 -0700 Subject: cleanup of C# API examples --- src/csharp/Grpc.Examples.MathClient/MathClient.cs | 10 +++- .../Grpc.Examples.Tests/Grpc.Examples.Tests.csproj | 12 ++++ .../Grpc.Examples.Tests/MathClientServerTests.cs | 21 +++---- src/csharp/Grpc.Examples.Tests/packages.config | 13 +++-- src/csharp/Grpc.Examples/MathExamples.cs | 67 ++++++++++------------ 5 files changed, 66 insertions(+), 57 deletions(-) diff --git a/src/csharp/Grpc.Examples.MathClient/MathClient.cs b/src/csharp/Grpc.Examples.MathClient/MathClient.cs index f5956bd33e..ca7683d399 100644 --- a/src/csharp/Grpc.Examples.MathClient/MathClient.cs +++ b/src/csharp/Grpc.Examples.MathClient/MathClient.cs @@ -46,11 +46,15 @@ namespace math MathGrpc.IMathServiceClient stub = new MathGrpc.MathServiceClientStub(channel); MathExamples.DivExample(stub); - MathExamples.FibExample(stub); + MathExamples.DivAsyncExample(stub).Wait(); - MathExamples.SumExample(stub); + MathExamples.FibExample(stub).Wait(); - MathExamples.DivManyExample(stub); + MathExamples.SumExample(stub).Wait(); + + MathExamples.DivManyExample(stub).Wait(); + + MathExamples.DependendRequestsExample(stub).Wait(); } GrpcEnvironment.Shutdown(); diff --git a/src/csharp/Grpc.Examples.Tests/Grpc.Examples.Tests.csproj b/src/csharp/Grpc.Examples.Tests/Grpc.Examples.Tests.csproj index cf5a640079..f9c1caf700 100644 --- a/src/csharp/Grpc.Examples.Tests/Grpc.Examples.Tests.csproj +++ b/src/csharp/Grpc.Examples.Tests/Grpc.Examples.Tests.csproj @@ -37,6 +37,18 @@ ..\packages\Google.ProtocolBuffers.2.4.1.521\lib\net40\Google.ProtocolBuffers.dll + + ..\packages\Rx-Interfaces.2.2.5\lib\net45\System.Reactive.Interfaces.dll + + + ..\packages\Rx-Core.2.2.5\lib\net45\System.Reactive.Core.dll + + + ..\packages\Rx-Linq.2.2.5\lib\net45\System.Reactive.Linq.dll + + + ..\packages\Rx-PlatformServices.2.2.5\lib\net45\System.Reactive.PlatformServices.dll + diff --git a/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs b/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs index 85f213cb39..fa5d6688a6 100644 --- a/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs +++ b/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs @@ -33,6 +33,7 @@ using System; using System.Collections.Generic; +using System.Reactive.Linq; using System.Threading; using System.Threading.Tasks; using Grpc.Core; @@ -120,14 +121,12 @@ namespace math.Tests [Test] public void Sum() { - var res = client.Sum(); - foreach (var num in new long[] { 10, 20, 30 }) - { - res.Inputs.OnNext(Num.CreateBuilder().SetNum_(num).Build()); - } - res.Inputs.OnCompleted(); + var clientStreamingResult = client.Sum(); + var numList = new List { 10, 20, 30 }.ConvertAll( + n => Num.CreateBuilder().SetNum_(n).Build()); + numList.Subscribe(clientStreamingResult.Inputs); - Assert.AreEqual(60, res.Task.Result.Num_); + Assert.AreEqual(60, clientStreamingResult.Task.Result.Num_); } [Test] @@ -142,13 +141,7 @@ namespace math.Tests var recorder = new RecordingObserver(); var requestObserver = client.DivMany(recorder); - - foreach (var arg in divArgsList) - { - requestObserver.OnNext(arg); - } - requestObserver.OnCompleted(); - + divArgsList.Subscribe(requestObserver); var result = recorder.ToList().Result; CollectionAssert.AreEqual(new long[] { 3, 4, 3 }, result.ConvertAll((divReply) => divReply.Quotient)); diff --git a/src/csharp/Grpc.Examples.Tests/packages.config b/src/csharp/Grpc.Examples.Tests/packages.config index 51c17bcd5e..06c5e6a4eb 100644 --- a/src/csharp/Grpc.Examples.Tests/packages.config +++ b/src/csharp/Grpc.Examples.Tests/packages.config @@ -1,5 +1,10 @@ - - - - + + + + + + + + + \ No newline at end of file diff --git a/src/csharp/Grpc.Examples/MathExamples.cs b/src/csharp/Grpc.Examples/MathExamples.cs index b8bb7eacbd..032372b2a1 100644 --- a/src/csharp/Grpc.Examples/MathExamples.cs +++ b/src/csharp/Grpc.Examples/MathExamples.cs @@ -45,51 +45,45 @@ namespace math Console.WriteLine("Div Result: " + result); } - public static void DivAsyncExample(MathGrpc.IMathServiceClient stub) + public static async Task DivAsyncExample(MathGrpc.IMathServiceClient stub) { - Task call = stub.DivAsync(new DivArgs.Builder { Dividend = 4, Divisor = 5 }.Build()); - DivReply result = call.Result; - Console.WriteLine(result); + Task resultTask = stub.DivAsync(new DivArgs.Builder { Dividend = 4, Divisor = 5 }.Build()); + DivReply result = await resultTask; + Console.WriteLine("DivAsync Result: " + result); } - public static void DivAsyncWithCancellationExample(MathGrpc.IMathServiceClient stub) + public static async Task DivAsyncWithCancellationExample(MathGrpc.IMathServiceClient stub) { - Task call = stub.DivAsync(new DivArgs.Builder { Dividend = 4, Divisor = 5 }.Build()); - DivReply result = call.Result; + Task resultTask = stub.DivAsync(new DivArgs.Builder { Dividend = 4, Divisor = 5 }.Build()); + DivReply result = await resultTask; Console.WriteLine(result); } - public static void FibExample(MathGrpc.IMathServiceClient stub) + public static async Task FibExample(MathGrpc.IMathServiceClient stub) { var recorder = new RecordingObserver(); stub.Fib(new FibArgs.Builder { Limit = 5 }.Build(), recorder); - - List numbers = recorder.ToList().Result; - Console.WriteLine("Fib Result: " + string.Join("|", recorder.ToList().Result)); + List result = await recorder.ToList(); + Console.WriteLine("Fib Result: " + string.Join("|", result)); } - public static void SumExample(MathGrpc.IMathServiceClient stub) + public static async Task SumExample(MathGrpc.IMathServiceClient stub) { - List numbers = new List + var numbers = new List { new Num.Builder { Num_ = 1 }.Build(), new Num.Builder { Num_ = 2 }.Build(), new Num.Builder { Num_ = 3 }.Build() }; - var res = stub.Sum(); - foreach (var num in numbers) - { - res.Inputs.OnNext(num); - } - res.Inputs.OnCompleted(); - - Console.WriteLine("Sum Result: " + res.Task.Result); + var clientStreamingResult = stub.Sum(); + numbers.Subscribe(clientStreamingResult.Inputs); + Console.WriteLine("Sum Result: " + await clientStreamingResult.Task); } - public static void DivManyExample(MathGrpc.IMathServiceClient stub) + public static async Task DivManyExample(MathGrpc.IMathServiceClient stub) { - List divArgsList = new List + var divArgsList = new List { new DivArgs.Builder { Dividend = 10, Divisor = 3 }.Build(), new DivArgs.Builder { Dividend = 100, Divisor = 21 }.Build(), @@ -97,26 +91,27 @@ namespace math }; var recorder = new RecordingObserver(); - var inputs = stub.DivMany(recorder); - foreach (var input in divArgsList) - { - inputs.OnNext(input); - } - inputs.OnCompleted(); - - Console.WriteLine("DivMany Result: " + string.Join("|", recorder.ToList().Result)); + divArgsList.Subscribe(inputs); + var result = await recorder.ToList(); + Console.WriteLine("DivMany Result: " + string.Join("|", result)); } - public static void DependendRequestsExample(MathGrpc.IMathServiceClient stub) + public static async Task DependendRequestsExample(MathGrpc.IMathServiceClient stub) { - var numberList = new List + var numbers = new List { - new Num.Builder { Num_ = 1 }.Build(), - new Num.Builder { Num_ = 2 }.Build(), new Num.Builder { Num_ = 3 }.Build() + new Num.Builder { Num_ = 1 }.Build(), + new Num.Builder { Num_ = 2 }.Build(), + new Num.Builder { Num_ = 3 }.Build() }; - numberList.ToObservable(); + var clientStreamingResult = stub.Sum(); + numbers.Subscribe(clientStreamingResult.Inputs); + Num sum = await clientStreamingResult.Task; + + DivReply result = await stub.DivAsync(new DivArgs.Builder { Dividend = sum.Num_, Divisor = numbers.Count }.Build()); + Console.WriteLine("Avg Result: " + result); } } } -- cgit v1.2.3 From ae96ae2baddcb015366b094ff484ff7eb9fbbc1d Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Thu, 2 Apr 2015 23:59:33 +0200 Subject: Starting off by removing all offending headers. --- include/grpc++/server.h | 2 -- src/cpp/server/server_context.cc | 2 -- src/cpp/server/thread_pool.h | 3 --- 3 files changed, 7 deletions(-) diff --git a/include/grpc++/server.h b/include/grpc++/server.h index bddb4f62aa..3ecfad98af 100644 --- a/include/grpc++/server.h +++ b/include/grpc++/server.h @@ -34,10 +34,8 @@ #ifndef GRPCXX_SERVER_H #define GRPCXX_SERVER_H -#include #include #include -#include #include #include diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index bb3c2d1405..0fe4b4d8e3 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -33,8 +33,6 @@ #include -#include - #include #include #include diff --git a/src/cpp/server/thread_pool.h b/src/cpp/server/thread_pool.h index 41e2009ff1..c773cdb629 100644 --- a/src/cpp/server/thread_pool.h +++ b/src/cpp/server/thread_pool.h @@ -37,9 +37,6 @@ #include #include -#include -#include -#include #include #include -- cgit v1.2.3 From 7c26b0e5c7f13a3024f76e949454b73170459571 Mon Sep 17 00:00:00 2001 From: Matt Ward Date: Thu, 2 Apr 2015 19:04:30 -0700 Subject: move Documentation up in the readme the documentation is kinda the most important part so let's put the important things first. --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index fa60b83d16..b78745f02c 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,10 @@ Copyright 2015 Google Inc. +#Documentation + +You can find more detailed documentation and examples in the [grpc-common repository](http://github.com/grpc/grpc-common). + #Installation See grpc/INSTALL for installation instructions for various platforms. @@ -25,10 +29,6 @@ of shared C core library [src/core] (src/core). Java source code is in [grpc-java] (http://github.com/grpc/grpc-java) repository. Go source code is in [grpc-go] (http://github.com/grpc/grpc-go) repository. -#Documentation - -You can find more detailed documentation and examples in the [grpc-common repository](http://github.com/grpc/grpc-common). - #Current Status of libraries Libraries in different languages are in different state of development. We are seeking contributions for all of these libraries. -- cgit v1.2.3 From ad1d7d93432873c4d736632e2be734d485e477fa Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Fri, 3 Apr 2015 20:00:59 +0200 Subject: Actually removing shared project files now. --- templates/vsprojects/vs2010/grpc.sln.template | 4 - templates/vsprojects/vs2013/grpc.sln.template | 4 - vsprojects/vs2010/gpr_shared.vcxproj | 184 ------- vsprojects/vs2010/gpr_shared.vcxproj.filters | 217 -------- vsprojects/vs2010/gpr_test_util.vcxproj | 3 + vsprojects/vs2010/grpc.sln | 5 +- vsprojects/vs2010/grpc_shared.vcxproj | 442 ---------------- vsprojects/vs2010/grpc_shared.vcxproj.filters | 736 -------------------------- vsprojects/vs2010/grpc_test_util.vcxproj | 3 + vsprojects/vs2013/gpr_shared.vcxproj | 186 ------- vsprojects/vs2013/gpr_shared.vcxproj.filters | 217 -------- vsprojects/vs2013/grpc.sln | 4 - vsprojects/vs2013/grpc_shared.vcxproj | 444 ---------------- vsprojects/vs2013/grpc_shared.vcxproj.filters | 736 -------------------------- 14 files changed, 7 insertions(+), 3178 deletions(-) delete mode 100644 vsprojects/vs2010/gpr_shared.vcxproj delete mode 100644 vsprojects/vs2010/gpr_shared.vcxproj.filters delete mode 100644 vsprojects/vs2010/grpc_shared.vcxproj delete mode 100644 vsprojects/vs2010/grpc_shared.vcxproj.filters delete mode 100644 vsprojects/vs2013/gpr_shared.vcxproj delete mode 100644 vsprojects/vs2013/gpr_shared.vcxproj.filters delete mode 100644 vsprojects/vs2013/grpc_shared.vcxproj delete mode 100644 vsprojects/vs2013/grpc_shared.vcxproj.filters diff --git a/templates/vsprojects/vs2010/grpc.sln.template b/templates/vsprojects/vs2010/grpc.sln.template index b90c0d7cdb..47aa03ca41 100644 --- a/templates/vsprojects/vs2010/grpc.sln.template +++ b/templates/vsprojects/vs2010/grpc.sln.template @@ -20,10 +20,6 @@ Project("${cpp_proj_type}") = "${project.name}", "${project.name}.vcxproj", "${p % endif EndProject % endfor -Project("${cpp_proj_type}") = "gpr_shared", "gpr_shared.vcxproj", "{3D304D6B-AAF8-428B-AC7D-A698DDDE93C0}" -EndProject -Project("${cpp_proj_type}") = "grpc_shared", "grpc_shared.vcxproj", "{F2EE8FDB-F1E0-43A0-A297-6F255BB52AAA}" -EndProject Project("${cpp_proj_type}") = "grpc_csharp_ext_shared", "grpc_csharp_ext_shared.vcxproj", "{C26D04A8-37C6-44C7-B458-906C9FCE928C}" EndProject Project("${cpp_proj_type}") = "zlibvc", "third_party\zlibvc.vcxproj", "{8FD826F8-3739-44E6-8CC8-997122E53B8D}" diff --git a/templates/vsprojects/vs2013/grpc.sln.template b/templates/vsprojects/vs2013/grpc.sln.template index d17f4a31aa..2b0f76b90d 100644 --- a/templates/vsprojects/vs2013/grpc.sln.template +++ b/templates/vsprojects/vs2013/grpc.sln.template @@ -23,10 +23,6 @@ Project("${cpp_proj_type}") = "${project.name}", "${project.name}.vcxproj", "${p % endif EndProject % endfor -Project("${cpp_proj_type}") = "gpr_shared", "gpr_shared.vcxproj", "{3D304D6B-AAF8-428B-AC7D-A698DDDE93C0}" -EndProject -Project("${cpp_proj_type}") = "grpc_shared", "grpc_shared.vcxproj", "{F2EE8FDB-F1E0-43A0-A297-6F255BB52AAA}" -EndProject Project("${cpp_proj_type}") = "grpc_csharp_ext_shared", "grpc_csharp_ext_shared.vcxproj", "{C26D04A8-37C6-44C7-B458-906C9FCE928C}" EndProject Project("${cpp_proj_type}") = "zlibvc", "third_party\zlibvc.vcxproj", "{8FD826F8-3739-44E6-8CC8-997122E53B8D}" diff --git a/vsprojects/vs2010/gpr_shared.vcxproj b/vsprojects/vs2010/gpr_shared.vcxproj deleted file mode 100644 index 174911fb21..0000000000 --- a/vsprojects/vs2010/gpr_shared.vcxproj +++ /dev/null @@ -1,184 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {3D304D6B-AAF8-428B-AC7D-A698DDDE93C0} - - - - DynamicLibrary - true - Unicode - $(Configuration)\$(ProjectName)\ - - - DynamicLibrary - false - true - Unicode - $(Configuration)\$(ProjectName)\ - - - - - - - - - - - - - - - gpr - - - gpr - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) - true - - - Windows - true - - - - - Level3 - NotUsing - MaxSpeed - true - true - WIN32;NDEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) - true - - - Windows - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/vsprojects/vs2010/gpr_shared.vcxproj.filters b/vsprojects/vs2010/gpr_shared.vcxproj.filters deleted file mode 100644 index dffaf1e62d..0000000000 --- a/vsprojects/vs2010/gpr_shared.vcxproj.filters +++ /dev/null @@ -1,217 +0,0 @@ - - - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - - - - {9ea89137-2bf7-b6d9-b7af-7cb4d1b74928} - - - {e6957ec1-85ba-6515-03c0-e12878045b1f} - - - {31c42000-3ed7-95e1-d076-df814b72cdee} - - - {60eb2826-e58b-cb10-a98d-fe04727398a2} - - - {c5e1baa7-de77-beb1-9675-942261648f79} - - - {bb116f2a-ea2a-c233-82da-0c54e3cbfec1} - - - - diff --git a/vsprojects/vs2010/gpr_test_util.vcxproj b/vsprojects/vs2010/gpr_test_util.vcxproj index 667e451b18..0568fcf719 100644 --- a/vsprojects/vs2010/gpr_test_util.vcxproj +++ b/vsprojects/vs2010/gpr_test_util.vcxproj @@ -75,6 +75,9 @@ true + + + diff --git a/vsprojects/vs2010/grpc.sln b/vsprojects/vs2010/grpc.sln index 34e437c704..8d1f87789d 100644 --- a/vsprojects/vs2010/grpc.sln +++ b/vsprojects/vs2010/grpc.sln @@ -15,6 +15,7 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc_test_util", "grpc_test_util.vcxproj", "{17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}" ProjectSection(ProjectDependencies) = postProject {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + {EAB0A629-17A9-44DB-B5FF-E91A721FE037} = {EAB0A629-17A9-44DB-B5FF-E91A721FE037} {29D16885-7228-4C31-81ED-5F9187C7F2A9} = {29D16885-7228-4C31-81ED-5F9187C7F2A9} EndProjectSection EndProject @@ -35,10 +36,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc_csharp_ext", "grpc_csh {29D16885-7228-4C31-81ED-5F9187C7F2A9} = {29D16885-7228-4C31-81ED-5F9187C7F2A9} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gpr_shared", "gpr_shared.vcxproj", "{3D304D6B-AAF8-428B-AC7D-A698DDDE93C0}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc_shared", "grpc_shared.vcxproj", "{F2EE8FDB-F1E0-43A0-A297-6F255BB52AAA}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc_csharp_ext_shared", "grpc_csharp_ext_shared.vcxproj", "{C26D04A8-37C6-44C7-B458-906C9FCE928C}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibvc", "third_party\zlibvc.vcxproj", "{8FD826F8-3739-44E6-8CC8-997122E53B8D}" diff --git a/vsprojects/vs2010/grpc_shared.vcxproj b/vsprojects/vs2010/grpc_shared.vcxproj deleted file mode 100644 index 96c2fe0b85..0000000000 --- a/vsprojects/vs2010/grpc_shared.vcxproj +++ /dev/null @@ -1,442 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {F2EE8FDB-F1E0-43A0-A297-6F255BB52AAA} - - - - DynamicLibrary - true - Unicode - $(Configuration)\$(ProjectName)\ - - - DynamicLibrary - false - true - Unicode - $(Configuration)\$(ProjectName)\ - - - - - - - - - - - - - - - - - - - grpc - - - grpc - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) - true - - - Windows - true - - - - - Level3 - NotUsing - MaxSpeed - true - true - WIN32;NDEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) - true - - - Windows - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} - - - {8fd826f8-3739-44e6-8cc8-997122e53b8d} - - - - - - - diff --git a/vsprojects/vs2010/grpc_shared.vcxproj.filters b/vsprojects/vs2010/grpc_shared.vcxproj.filters deleted file mode 100644 index 20dbe8c444..0000000000 --- a/vsprojects/vs2010/grpc_shared.vcxproj.filters +++ /dev/null @@ -1,736 +0,0 @@ - - - - - src\core\httpcli - - - src\core\httpcli - - - src\core\httpcli - - - src\core\httpcli - - - src\core\security - - - src\core\security - - - src\core\security - - - src\core\security - - - src\core\security - - - src\core\security - - - src\core\security - - - src\core\security - - - src\core\security - - - src\core\security - - - src\core\security - - - src\core\security - - - src\core\surface - - - src\core\surface - - - src\core\tsi - - - src\core\tsi - - - src\core\tsi - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\compression - - - src\core\compression - - - src\core\debug - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\json - - - src\core\json - - - src\core\json - - - src\core\json - - - src\core\statistics - - - src\core\statistics - - - src\core\statistics - - - src\core\statistics - - - src\core\statistics - - - src\core\statistics - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport - - - src\core\transport - - - src\core\transport - - - src\core\transport - - - - - include\grpc - - - include\grpc - - - include\grpc - - - include\grpc - - - include\grpc - - - include\grpc - - - - - src\core\httpcli - - - src\core\httpcli - - - src\core\httpcli - - - src\core\httpcli - - - src\core\security - - - src\core\security - - - src\core\security - - - src\core\security - - - src\core\security - - - src\core\security - - - src\core\security - - - src\core\tsi - - - src\core\tsi - - - src\core\tsi - - - src\core\tsi - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\compression - - - src\core\compression - - - src\core\debug - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\json - - - src\core\json - - - src\core\json - - - src\core\json - - - src\core\statistics - - - src\core\statistics - - - src\core\statistics - - - src\core\statistics - - - src\core\statistics - - - src\core\statistics - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport - - - src\core\transport - - - src\core\transport - - - src\core\transport - - - src\core\transport - - - - - - {968de0a1-346d-b75a-6f19-6a55119b8235} - - - {880c644d-b84f-cfca-98bd-e145f36232ab} - - - {d538af37-07b2-062b-fa2a-d9f882cb2737} - - - {ea745680-21ea-9c5e-679b-64dc40562d08} - - - {d897b6c3-c555-234e-a589-b4f008063615} - - - {263cb913-dfe6-42a4-096b-cac231f76305} - - - {1da7ef8a-a06d-5499-b3de-19fee4a4214d} - - - {a9bc00ad-835f-c625-c6d9-6a1324f98b9f} - - - {1baf3894-af37-e647-bdbc-95dc17ed0073} - - - {e665cc0e-b994-d7c5-cc18-2007392019f0} - - - {1d850ac6-e639-4eab-5338-4ba40272fcc9} - - - {0ef49896-2313-4a3f-1ce2-716fa0e5c6ca} - - - {aeb18e82-5d25-0aad-8b02-a0a3470073ce} - - - {168fa1b1-1c18-eb55-9a4d-746bc58df2c1} - - - {b8b623c3-a168-a2b1-0d5f-b70a1f1cd8d2} - - - {0b0f9ab1-efa4-7f03-e446-6fb9b5227e84} - - - - diff --git a/vsprojects/vs2010/grpc_test_util.vcxproj b/vsprojects/vs2010/grpc_test_util.vcxproj index 6be239156e..967543f78a 100644 --- a/vsprojects/vs2010/grpc_test_util.vcxproj +++ b/vsprojects/vs2010/grpc_test_util.vcxproj @@ -103,6 +103,9 @@ {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + + {EAB0A629-17A9-44DB-B5FF-E91A721FE037} + {29D16885-7228-4C31-81ED-5F9187C7F2A9} diff --git a/vsprojects/vs2013/gpr_shared.vcxproj b/vsprojects/vs2013/gpr_shared.vcxproj deleted file mode 100644 index 85339652ed..0000000000 --- a/vsprojects/vs2013/gpr_shared.vcxproj +++ /dev/null @@ -1,186 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {3D304D6B-AAF8-428B-AC7D-A698DDDE93C0} - - - - DynamicLibrary - true - v120 - Unicode - $(Configuration)\$(ProjectName)\ - - - DynamicLibrary - false - v120 - true - Unicode - $(Configuration)\$(ProjectName)\ - - - - - - - - - - - - - - - gpr - - - gpr - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) - true - - - Windows - true - - - - - Level3 - NotUsing - MaxSpeed - true - true - WIN32;NDEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) - true - - - Windows - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/vsprojects/vs2013/gpr_shared.vcxproj.filters b/vsprojects/vs2013/gpr_shared.vcxproj.filters deleted file mode 100644 index dffaf1e62d..0000000000 --- a/vsprojects/vs2013/gpr_shared.vcxproj.filters +++ /dev/null @@ -1,217 +0,0 @@ - - - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - include\grpc\support - - - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - src\core\support - - - - - - {9ea89137-2bf7-b6d9-b7af-7cb4d1b74928} - - - {e6957ec1-85ba-6515-03c0-e12878045b1f} - - - {31c42000-3ed7-95e1-d076-df814b72cdee} - - - {60eb2826-e58b-cb10-a98d-fe04727398a2} - - - {c5e1baa7-de77-beb1-9675-942261648f79} - - - {bb116f2a-ea2a-c233-82da-0c54e3cbfec1} - - - - diff --git a/vsprojects/vs2013/grpc.sln b/vsprojects/vs2013/grpc.sln index 4e56edd9ff..dfefddfbbd 100644 --- a/vsprojects/vs2013/grpc.sln +++ b/vsprojects/vs2013/grpc.sln @@ -39,10 +39,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc_csharp_ext", "grpc_csh {29D16885-7228-4C31-81ED-5F9187C7F2A9} = {29D16885-7228-4C31-81ED-5F9187C7F2A9} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gpr_shared", "gpr_shared.vcxproj", "{3D304D6B-AAF8-428B-AC7D-A698DDDE93C0}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc_shared", "grpc_shared.vcxproj", "{F2EE8FDB-F1E0-43A0-A297-6F255BB52AAA}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc_csharp_ext_shared", "grpc_csharp_ext_shared.vcxproj", "{C26D04A8-37C6-44C7-B458-906C9FCE928C}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibvc", "third_party\zlibvc.vcxproj", "{8FD826F8-3739-44E6-8CC8-997122E53B8D}" diff --git a/vsprojects/vs2013/grpc_shared.vcxproj b/vsprojects/vs2013/grpc_shared.vcxproj deleted file mode 100644 index b673cc7bde..0000000000 --- a/vsprojects/vs2013/grpc_shared.vcxproj +++ /dev/null @@ -1,444 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {F2EE8FDB-F1E0-43A0-A297-6F255BB52AAA} - - - - DynamicLibrary - true - v120 - Unicode - $(Configuration)\$(ProjectName)\ - - - DynamicLibrary - false - v120 - true - Unicode - $(Configuration)\$(ProjectName)\ - - - - - - - - - - - - - - - - - - - grpc - - - grpc - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) - true - - - Windows - true - - - - - Level3 - NotUsing - MaxSpeed - true - true - WIN32;NDEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) - true - - - Windows - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} - - - {8fd826f8-3739-44e6-8cc8-997122e53b8d} - - - - - - - diff --git a/vsprojects/vs2013/grpc_shared.vcxproj.filters b/vsprojects/vs2013/grpc_shared.vcxproj.filters deleted file mode 100644 index 20dbe8c444..0000000000 --- a/vsprojects/vs2013/grpc_shared.vcxproj.filters +++ /dev/null @@ -1,736 +0,0 @@ - - - - - src\core\httpcli - - - src\core\httpcli - - - src\core\httpcli - - - src\core\httpcli - - - src\core\security - - - src\core\security - - - src\core\security - - - src\core\security - - - src\core\security - - - src\core\security - - - src\core\security - - - src\core\security - - - src\core\security - - - src\core\security - - - src\core\security - - - src\core\security - - - src\core\surface - - - src\core\surface - - - src\core\tsi - - - src\core\tsi - - - src\core\tsi - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\compression - - - src\core\compression - - - src\core\debug - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\json - - - src\core\json - - - src\core\json - - - src\core\json - - - src\core\statistics - - - src\core\statistics - - - src\core\statistics - - - src\core\statistics - - - src\core\statistics - - - src\core\statistics - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport - - - src\core\transport - - - src\core\transport - - - src\core\transport - - - - - include\grpc - - - include\grpc - - - include\grpc - - - include\grpc - - - include\grpc - - - include\grpc - - - - - src\core\httpcli - - - src\core\httpcli - - - src\core\httpcli - - - src\core\httpcli - - - src\core\security - - - src\core\security - - - src\core\security - - - src\core\security - - - src\core\security - - - src\core\security - - - src\core\security - - - src\core\tsi - - - src\core\tsi - - - src\core\tsi - - - src\core\tsi - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\channel - - - src\core\compression - - - src\core\compression - - - src\core\debug - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\iomgr - - - src\core\json - - - src\core\json - - - src\core\json - - - src\core\json - - - src\core\statistics - - - src\core\statistics - - - src\core\statistics - - - src\core\statistics - - - src\core\statistics - - - src\core\statistics - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\surface - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport\chttp2 - - - src\core\transport - - - src\core\transport - - - src\core\transport - - - src\core\transport - - - src\core\transport - - - - - - {968de0a1-346d-b75a-6f19-6a55119b8235} - - - {880c644d-b84f-cfca-98bd-e145f36232ab} - - - {d538af37-07b2-062b-fa2a-d9f882cb2737} - - - {ea745680-21ea-9c5e-679b-64dc40562d08} - - - {d897b6c3-c555-234e-a589-b4f008063615} - - - {263cb913-dfe6-42a4-096b-cac231f76305} - - - {1da7ef8a-a06d-5499-b3de-19fee4a4214d} - - - {a9bc00ad-835f-c625-c6d9-6a1324f98b9f} - - - {1baf3894-af37-e647-bdbc-95dc17ed0073} - - - {e665cc0e-b994-d7c5-cc18-2007392019f0} - - - {1d850ac6-e639-4eab-5338-4ba40272fcc9} - - - {0ef49896-2313-4a3f-1ce2-716fa0e5c6ca} - - - {aeb18e82-5d25-0aad-8b02-a0a3470073ce} - - - {168fa1b1-1c18-eb55-9a4d-746bc58df2c1} - - - {b8b623c3-a168-a2b1-0d5f-b70a1f1cd8d2} - - - {0b0f9ab1-efa4-7f03-e446-6fb9b5227e84} - - - - -- cgit v1.2.3 From 660a33e11fd16b8f75cd68bc1423ff18883b0065 Mon Sep 17 00:00:00 2001 From: Masood Malekghassemi Date: Fri, 3 Apr 2015 10:38:44 -0700 Subject: Satisfy C90 pedantry in Python adapter --- src/python/src/grpc/_adapter/_call.c | 2 +- src/python/src/grpc/_adapter/_call.h | 2 +- src/python/src/grpc/_adapter/_channel.h | 2 +- src/python/src/grpc/_adapter/_client_credentials.h | 2 +- src/python/src/grpc/_adapter/_completion_queue.c | 5 +++-- src/python/src/grpc/_adapter/_completion_queue.h | 2 +- src/python/src/grpc/_adapter/_server.h | 2 +- src/python/src/grpc/_adapter/_server_credentials.h | 2 +- 8 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/python/src/grpc/_adapter/_call.c b/src/python/src/grpc/_adapter/_call.c index f837267e9a..bf96c1a3fa 100644 --- a/src/python/src/grpc/_adapter/_call.c +++ b/src/python/src/grpc/_adapter/_call.c @@ -164,10 +164,10 @@ static const PyObject *pygrpc_call_add_metadata(Call *self, PyObject *args) { const char* key = NULL; const char* value = NULL; int value_length = 0; + grpc_metadata metadata; if (!PyArg_ParseTuple(args, "ss#", &key, &value, &value_length)) { return NULL; } - grpc_metadata metadata; metadata.key = key; metadata.value = value; metadata.value_length = value_length; diff --git a/src/python/src/grpc/_adapter/_call.h b/src/python/src/grpc/_adapter/_call.h index fabc6f399d..c04a2285f7 100644 --- a/src/python/src/grpc/_adapter/_call.h +++ b/src/python/src/grpc/_adapter/_call.h @@ -38,7 +38,7 @@ #include typedef struct { - PyObject_HEAD; + PyObject_HEAD grpc_call *c_call; } Call; diff --git a/src/python/src/grpc/_adapter/_channel.h b/src/python/src/grpc/_adapter/_channel.h index 303b675192..afc0f80359 100644 --- a/src/python/src/grpc/_adapter/_channel.h +++ b/src/python/src/grpc/_adapter/_channel.h @@ -38,7 +38,7 @@ #include typedef struct { - PyObject_HEAD; + PyObject_HEAD grpc_channel *c_channel; } Channel; diff --git a/src/python/src/grpc/_adapter/_client_credentials.h b/src/python/src/grpc/_adapter/_client_credentials.h index 47476ce15f..bb9f7f0c3a 100644 --- a/src/python/src/grpc/_adapter/_client_credentials.h +++ b/src/python/src/grpc/_adapter/_client_credentials.h @@ -38,7 +38,7 @@ #include typedef struct { - PyObject_HEAD; + PyObject_HEAD grpc_credentials *c_client_credentials; } ClientCredentials; diff --git a/src/python/src/grpc/_adapter/_completion_queue.c b/src/python/src/grpc/_adapter/_completion_queue.c index 76d6b6cb44..a639eff53e 100644 --- a/src/python/src/grpc/_adapter/_completion_queue.c +++ b/src/python/src/grpc/_adapter/_completion_queue.c @@ -124,7 +124,7 @@ static PyObject *pygrpc_metadata_collection_get( PyObject *key = PyString_FromString(elem.key); PyObject *value = PyString_FromStringAndSize(elem.value, elem.value_length); PyObject* kvp = PyTuple_Pack(2, key, value); - // n.b. PyList_SetItem *steals* a reference to the set element. + /* n.b. PyList_SetItem *steals* a reference to the set element. */ PyList_SetItem(metadata, i, kvp); Py_DECREF(key); Py_DECREF(value); @@ -266,6 +266,7 @@ static PyObject *pygrpc_finished_event_args(grpc_event *c_event) { PyObject *details; PyObject *status; PyObject *event_args; + PyObject *metadata; code = pygrpc_status_code(c_event->data.finished.status); if (code == NULL) { @@ -285,7 +286,7 @@ static PyObject *pygrpc_finished_event_args(grpc_event *c_event) { if (status == NULL) { return NULL; } - PyObject* metadata = pygrpc_metadata_collection_get( + metadata = pygrpc_metadata_collection_get( c_event->data.finished.metadata_elements, c_event->data.finished.metadata_count); event_args = PyTuple_Pack(8, finish_event_kind, (PyObject *)c_event->tag, diff --git a/src/python/src/grpc/_adapter/_completion_queue.h b/src/python/src/grpc/_adapter/_completion_queue.h index 3a39476a2e..9b377d15d9 100644 --- a/src/python/src/grpc/_adapter/_completion_queue.h +++ b/src/python/src/grpc/_adapter/_completion_queue.h @@ -38,7 +38,7 @@ #include typedef struct { - PyObject_HEAD; + PyObject_HEAD grpc_completion_queue *c_completion_queue; } CompletionQueue; diff --git a/src/python/src/grpc/_adapter/_server.h b/src/python/src/grpc/_adapter/_server.h index 4248712c1c..4836bb638c 100644 --- a/src/python/src/grpc/_adapter/_server.h +++ b/src/python/src/grpc/_adapter/_server.h @@ -38,7 +38,7 @@ #include typedef struct { - PyObject_HEAD; + PyObject_HEAD grpc_server *c_server; } Server; diff --git a/src/python/src/grpc/_adapter/_server_credentials.h b/src/python/src/grpc/_adapter/_server_credentials.h index bb6ff2c5bb..6090404bd9 100644 --- a/src/python/src/grpc/_adapter/_server_credentials.h +++ b/src/python/src/grpc/_adapter/_server_credentials.h @@ -38,7 +38,7 @@ #include typedef struct { - PyObject_HEAD; + PyObject_HEAD grpc_server_credentials *c_server_credentials; } ServerCredentials; -- cgit v1.2.3 From 49388b31a0a363dd82a49f593d1b100e77a09aa9 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Fri, 3 Apr 2015 12:49:31 -0700 Subject: Reworded test case descriptions --- src/node/test/surface_test.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/node/test/surface_test.js b/src/node/test/surface_test.js index d6e480521b..590c644c71 100644 --- a/src/node/test/surface_test.js +++ b/src/node/test/surface_test.js @@ -202,7 +202,7 @@ describe('Trailing metadata', function() { after(function() { server.shutdown(); }); - it('when a unary call succeeds', function(done) { + it('should be present when a unary call succeeds', function(done) { var call = client.unary({error: false}, function(err, data) { assert.ifError(err); }); @@ -211,7 +211,7 @@ describe('Trailing metadata', function() { done(); }); }); - it('when a unary call fails', function(done) { + it('should be present when a unary call fails', function(done) { var call = client.unary({error: true}, function(err, data) { assert(err); }); @@ -220,7 +220,7 @@ describe('Trailing metadata', function() { done(); }); }); - it('when a client stream call succeeds', function(done) { + it('should be present when a client stream call succeeds', function(done) { var call = client.clientStream(function(err, data) { assert.ifError(err); }); @@ -232,7 +232,7 @@ describe('Trailing metadata', function() { done(); }); }); - it('when a client stream call fails', function(done) { + it('should be present when a client stream call fails', function(done) { var call = client.clientStream(function(err, data) { assert(err); }); @@ -244,7 +244,7 @@ describe('Trailing metadata', function() { done(); }); }); - it('when a server stream call succeeds', function(done) { + it('should be present when a server stream call succeeds', function(done) { var call = client.serverStream({error: false}); call.on('data', function(){}); call.on('status', function(status) { @@ -253,7 +253,7 @@ describe('Trailing metadata', function() { done(); }); }); - it('when a server stream call fails', function(done) { + it('should be present when a server stream call fails', function(done) { var call = client.serverStream({error: true}); call.on('data', function(){}); call.on('status', function(status) { @@ -262,7 +262,7 @@ describe('Trailing metadata', function() { done(); }); }); - it('when a bidi stream succeeds', function(done) { + it('should be present when a bidi stream succeeds', function(done) { var call = client.bidiStream(); call.write({error: false}); call.write({error: false}); @@ -274,7 +274,7 @@ describe('Trailing metadata', function() { done(); }); }); - it('when a bidi stream fails', function(done) { + it('should be present when a bidi stream fails', function(done) { var call = client.bidiStream(); call.write({error: false}); call.write({error: true}); -- cgit v1.2.3 From 91647cc8154b06df9225eaa67b03b05fbb353043 Mon Sep 17 00:00:00 2001 From: Nicolas Noble Date: Fri, 3 Apr 2015 13:32:47 -0700 Subject: Adding joinable threads, and gpr_thd_join. --- BUILD | 1 + Makefile | 2 + build.json | 1 + include/grpc/support/thd.h | 19 ++++++++- src/core/support/thd.c | 66 ++++++++++++++++++++++++++++++++ src/core/support/thd_posix.c | 16 ++++---- src/core/support/thd_win32.c | 72 ++++++++++++++++++++++++++--------- test/core/support/thd_test.c | 11 ++++++ vsprojects/vs2010/gpr.vcxproj | 2 + vsprojects/vs2010/gpr.vcxproj.filters | 3 ++ vsprojects/vs2013/gpr.vcxproj | 2 + vsprojects/vs2013/gpr.vcxproj.filters | 3 ++ 12 files changed, 170 insertions(+), 28 deletions(-) create mode 100644 src/core/support/thd.c diff --git a/BUILD b/BUILD index e5822c7442..ccff9c05c6 100644 --- a/BUILD +++ b/BUILD @@ -72,6 +72,7 @@ cc_library( "src/core/support/sync.c", "src/core/support/sync_posix.c", "src/core/support/sync_win32.c", + "src/core/support/thd.c", "src/core/support/thd_posix.c", "src/core/support/thd_win32.c", "src/core/support/time.c", diff --git a/Makefile b/Makefile index fad9eb26fb..4e99231a1c 100644 --- a/Makefile +++ b/Makefile @@ -2334,6 +2334,7 @@ LIBGPR_SRC = \ src/core/support/sync.c \ src/core/support/sync_posix.c \ src/core/support/sync_win32.c \ + src/core/support/thd.c \ src/core/support/thd_posix.c \ src/core/support/thd_win32.c \ src/core/support/time.c \ @@ -2428,6 +2429,7 @@ $(OBJDIR)/$(CONFIG)/src/core/support/string_win32.o: $(OBJDIR)/$(CONFIG)/src/core/support/sync.o: $(OBJDIR)/$(CONFIG)/src/core/support/sync_posix.o: $(OBJDIR)/$(CONFIG)/src/core/support/sync_win32.o: +$(OBJDIR)/$(CONFIG)/src/core/support/thd.o: $(OBJDIR)/$(CONFIG)/src/core/support/thd_posix.o: $(OBJDIR)/$(CONFIG)/src/core/support/thd_win32.o: $(OBJDIR)/$(CONFIG)/src/core/support/time.o: diff --git a/build.json b/build.json index 1e7ab9661b..06adfee9f7 100644 --- a/build.json +++ b/build.json @@ -337,6 +337,7 @@ "src/core/support/sync.c", "src/core/support/sync_posix.c", "src/core/support/sync_win32.c", + "src/core/support/thd.c", "src/core/support/thd_posix.c", "src/core/support/thd_win32.c", "src/core/support/time.c", diff --git a/include/grpc/support/thd.h b/include/grpc/support/thd.h index 64d5bed49a..8126992d6b 100644 --- a/include/grpc/support/thd.h +++ b/include/grpc/support/thd.h @@ -52,9 +52,8 @@ typedef gpr_uint64 gpr_thd_id; /* Thread creation options. */ typedef struct { - int flags; /* Flags below can be set here. Default value 0. */ + int flags; /* Opaque field. Get and set with accessors below. */ } gpr_thd_options; -/* No flags are currently defined. */ /* Create a new thread running (*thd_body)(arg) and place its thread identifier in *t, and return true. If there are insufficient resources, return false. @@ -66,9 +65,25 @@ int gpr_thd_new(gpr_thd_id *t, void (*thd_body)(void *arg), void *arg, /* Return a gpr_thd_options struct with all fields set to defaults. */ gpr_thd_options gpr_thd_options_default(void); +/* Set the thread to become detached on startup - this is the default. */ +void gpr_thd_options_set_detached(gpr_thd_options *options); + +/* Set the thread to become joinable - mutually exclusive with detached. */ +void gpr_thd_options_set_joinable(gpr_thd_options *options); + +/* Returns non-zero if the option detached is set. */ +int gpr_thd_options_is_detached(const gpr_thd_options *options); + +/* Returns non-zero if the option joinable is set. */ +int gpr_thd_options_is_joinable(const gpr_thd_options *options); + /* Returns the identifier of the current thread. */ gpr_thd_id gpr_thd_currentid(void); +/* Blocks until the specified thread properly terminates. + Calling this on a detached thread has unpredictable results. */ +void gpr_thd_join(gpr_thd_id t); + #ifdef __cplusplus } #endif diff --git a/src/core/support/thd.c b/src/core/support/thd.c new file mode 100644 index 0000000000..ec308f3119 --- /dev/null +++ b/src/core/support/thd.c @@ -0,0 +1,66 @@ +/* + * + * 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. + * + */ + +/* Posix implementation for gpr threads. */ + +#include + +#include + +enum { + GPR_THD_JOINABLE = 1 +}; + +gpr_thd_options gpr_thd_options_default(void) { + gpr_thd_options options; + memset(&options, 0, sizeof(options)); + return options; +} + +void gpr_thd_options_set_detached(gpr_thd_options *options) { + options->flags &= ~GPR_THD_JOINABLE; +} + +void gpr_thd_options_set_joinable(gpr_thd_options *options) { + options->flags |= GPR_THD_JOINABLE; +} + +int gpr_thd_options_is_detached(const gpr_thd_options *options) { + if (!options) return 1; + return (options->flags & GPR_THD_JOINABLE) == 0; +} + +int gpr_thd_options_is_joinable(const gpr_thd_options *options) { + if (!options) return 0; + return (options->flags & GPR_THD_JOINABLE) == GPR_THD_JOINABLE; +} diff --git a/src/core/support/thd_posix.c b/src/core/support/thd_posix.c index f50ea58335..7bf527201d 100644 --- a/src/core/support/thd_posix.c +++ b/src/core/support/thd_posix.c @@ -68,7 +68,11 @@ int gpr_thd_new(gpr_thd_id *t, void (*thd_body)(void *arg), void *arg, a->arg = arg; GPR_ASSERT(pthread_attr_init(&attr) == 0); - GPR_ASSERT(pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED) == 0); + if (gpr_thd_options_is_detached(options)) { + GPR_ASSERT(pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED) == 0); + } else { + GPR_ASSERT(pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE) == 0); + } thread_started = (pthread_create(&p, &attr, &thread_body, a) == 0); GPR_ASSERT(pthread_attr_destroy(&attr) == 0); if (!thread_started) { @@ -78,14 +82,12 @@ int gpr_thd_new(gpr_thd_id *t, void (*thd_body)(void *arg), void *arg, return thread_started; } -gpr_thd_options gpr_thd_options_default(void) { - gpr_thd_options options; - memset(&options, 0, sizeof(options)); - return options; -} - gpr_thd_id gpr_thd_currentid(void) { return (gpr_thd_id)pthread_self(); } +void gpr_thd_join(gpr_thd_id t) { + pthread_join(t, NULL); +} + #endif /* GPR_POSIX_SYNC */ diff --git a/src/core/support/thd_win32.c b/src/core/support/thd_win32.c index 347cad57e3..f92fb64a5c 100644 --- a/src/core/support/thd_win32.c +++ b/src/core/support/thd_win32.c @@ -31,7 +31,7 @@ * */ -/* Posix implementation for gpr threads. */ +/* Windows implementation for gpr threads. */ #include @@ -40,47 +40,81 @@ #include #include #include +#include #include -struct thd_arg { +#if defined(_MSC_VER) +#define thread_local __declspec(thread) +#elif defined(__GNUC__) +#define thread_local __thread +#else +#error "Unknown compiler - please file a bug report" +#endif + +struct thd_info { void (*body)(void *arg); /* body of a thread */ void *arg; /* argument to a thread */ + HANDLE join_event; /* if joinable, the join event */ + int joinable; /* true if not detached */ }; +static thread_local struct thd_info *g_thd_info; + +/* Destroys a thread info */ +static destroy_thread(struct thd_info *t) { + if (t->joinable) CloseHandle(t->join_event); + gpr_free(t); +} + /* Body of every thread started via gpr_thd_new. */ static DWORD WINAPI thread_body(void *v) { - struct thd_arg a = *(struct thd_arg *)v; - gpr_free(v); - (*a.body)(a.arg); + g_thd_info = (struct thd_info *)v; + g_thd_info->body(g_thd_info->arg); + if (g_thd_info->joinable) { + BOOL ret = SetEvent(g_thd_info->join_event); + GPR_ASSERT(ret); + } else { + destroy_thread(g_thd_info); + } return 0; } int gpr_thd_new(gpr_thd_id *t, void (*thd_body)(void *arg), void *arg, const gpr_thd_options *options) { HANDLE handle; - DWORD thread_id; - struct thd_arg *a = gpr_malloc(sizeof(*a)); - a->body = thd_body; - a->arg = arg; + struct thd_info *info = gpr_malloc(sizeof(*info)); + info->body = thd_body; + info->arg = arg; *t = 0; - handle = CreateThread(NULL, 64 * 1024, thread_body, a, 0, &thread_id); + if (gpr_thd_options_is_joinable(options)) { + info->joinable = 1; + info->join_event = CreateEvent(NULL, FALSE, FALSE, NULL); + if (info->join_event == NULL) { + gpr_free(info); + return 0; + } + } else { + info->joinable = 0; + } + handle = CreateThread(NULL, 64 * 1024, thread_body, info, 0, NULL); if (handle == NULL) { - gpr_free(a); + destroy_thread(info); } else { - CloseHandle(handle); /* threads are "detached" */ + *t = (gpr_thd_id)info; + CloseHandle(handle); } - *t = (gpr_thd_id)thread_id; return handle != NULL; } -gpr_thd_options gpr_thd_options_default(void) { - gpr_thd_options options; - memset(&options, 0, sizeof(options)); - return options; +gpr_thd_id gpr_thd_currentid(void) { + return (gpr_thd_id)g_thd_info; } -gpr_thd_id gpr_thd_currentid(void) { - return (gpr_thd_id)GetCurrentThreadId(); +void gpr_thd_join(gpr_thd_id t) { + struct thd_info *info = (struct thd_info *)t; + DWORD ret = WaitForSingleObject(info->join_event, INFINITE); + GPR_ASSERT(ret == WAIT_OBJECT_0); + destroy_thread(info); } #endif /* GPR_WIN32 */ diff --git a/test/core/support/thd_test.c b/test/core/support/thd_test.c index c03a905d2a..bb3d54a262 100644 --- a/test/core/support/thd_test.c +++ b/test/core/support/thd_test.c @@ -60,12 +60,16 @@ static void thd_body(void *v) { gpr_mu_unlock(&t->mu); } +static void thd_body_joinable(void *v) { } + /* Test that we can create a number of threads and wait for them. */ static void test(void) { int i; gpr_thd_id thd; + gpr_thd_id thds[1000]; struct test t; int n = 1000; + gpr_thd_options options = gpr_thd_options_default(); gpr_mu_init(&t.mu); gpr_cv_init(&t.done_cv); t.n = n; @@ -79,6 +83,13 @@ static void test(void) { } gpr_mu_unlock(&t.mu); GPR_ASSERT(t.n == 0); + gpr_thd_options_set_joinable(&options); + for (i = 0; i < n; i++) { + GPR_ASSERT(gpr_thd_new(&thds[i], &thd_body_joinable, NULL, &options)); + } + for (i = 0; i < n; i++) { + gpr_thd_join(thds[i]); + } } /* ------------------------------------------------- */ diff --git a/vsprojects/vs2010/gpr.vcxproj b/vsprojects/vs2010/gpr.vcxproj index f50f87134c..d23124c86c 100644 --- a/vsprojects/vs2010/gpr.vcxproj +++ b/vsprojects/vs2010/gpr.vcxproj @@ -166,6 +166,8 @@ + + diff --git a/vsprojects/vs2010/gpr.vcxproj.filters b/vsprojects/vs2010/gpr.vcxproj.filters index dffaf1e62d..1f8794441b 100644 --- a/vsprojects/vs2010/gpr.vcxproj.filters +++ b/vsprojects/vs2010/gpr.vcxproj.filters @@ -88,6 +88,9 @@ src\core\support + + src\core\support + src\core\support diff --git a/vsprojects/vs2013/gpr.vcxproj b/vsprojects/vs2013/gpr.vcxproj index 4b44cc645f..e0fa68e035 100644 --- a/vsprojects/vs2013/gpr.vcxproj +++ b/vsprojects/vs2013/gpr.vcxproj @@ -168,6 +168,8 @@ + + diff --git a/vsprojects/vs2013/gpr.vcxproj.filters b/vsprojects/vs2013/gpr.vcxproj.filters index dffaf1e62d..1f8794441b 100644 --- a/vsprojects/vs2013/gpr.vcxproj.filters +++ b/vsprojects/vs2013/gpr.vcxproj.filters @@ -88,6 +88,9 @@ src\core\support + + src\core\support + src\core\support -- cgit v1.2.3 From 2a113f6edcc0948c521f2f3e351d138b66316026 Mon Sep 17 00:00:00 2001 From: Tim Emiola Date: Fri, 3 Apr 2015 15:10:52 -0700 Subject: Add the version of the built deb to be configured by a file --- tools/distpackages/build_deb_packages.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tools/distpackages/build_deb_packages.sh b/tools/distpackages/build_deb_packages.sh index 7b2acb6577..3976529ab5 100755 --- a/tools/distpackages/build_deb_packages.sh +++ b/tools/distpackages/build_deb_packages.sh @@ -30,11 +30,18 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # Where to put resulting .deb packages. -deb_dest="deb_out" +deb_dest="/tmp/deb_out" mkdir -p $deb_dest -version='0.5.0.0' +# Update version from default values if the file /version.txt exists +# +# - when present, /version.txt will by the docker build pkg_version='0.5.0' +if [ -f /version.txt ]; then + pkg_version=$(cat /version.txt) +fi +version="${pkg_version}.0" +echo "Target release => $pkg_version" if [ -f /.dockerinit ]; then # We're in Docker where uname -p returns "unknown". @@ -110,8 +117,5 @@ do dpkg-deb -c $deb_path echo "Problems reported by lintian:" lintian $deb_path - echo done - - -- cgit v1.2.3 From f82b37831422c600eb970d0242b976f0faa8df60 Mon Sep 17 00:00:00 2001 From: Tim Emiola Date: Fri, 3 Apr 2015 15:14:07 -0700 Subject: Add the version of the built deb to be configured by a file --- tools/distpackages/build_deb_packages.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/distpackages/build_deb_packages.sh b/tools/distpackages/build_deb_packages.sh index 3976529ab5..7dff8e3743 100755 --- a/tools/distpackages/build_deb_packages.sh +++ b/tools/distpackages/build_deb_packages.sh @@ -35,7 +35,7 @@ mkdir -p $deb_dest # Update version from default values if the file /version.txt exists # -# - when present, /version.txt will by the docker build +# - when present, /version.txt will added by the docker build. pkg_version='0.5.0' if [ -f /version.txt ]; then pkg_version=$(cat /version.txt) -- cgit v1.2.3 From 0bfdfa126d8793dde37f9ec741cb96fbb9f5a49e Mon Sep 17 00:00:00 2001 From: Tim Emiola Date: Fri, 3 Apr 2015 15:58:29 -0700 Subject: Simplifies the work needed to create a new deb - automates much of the workflow for building a deb package - adds a version.txt file that is used configure the version on the deb package * updates the Dockerfile to make use of this --- tools/dockerfile/grpc_build_deb/Dockerfile | 3 ++ tools/dockerfile/grpc_build_deb/version.txt | 1 + tools/gce_setup/grpc_docker.sh | 60 ++++++++++++++++++++++++++--- 3 files changed, 59 insertions(+), 5 deletions(-) create mode 100644 tools/dockerfile/grpc_build_deb/version.txt diff --git a/tools/dockerfile/grpc_build_deb/Dockerfile b/tools/dockerfile/grpc_build_deb/Dockerfile index 24ffc7379c..cf8da594e9 100644 --- a/tools/dockerfile/grpc_build_deb/Dockerfile +++ b/tools/dockerfile/grpc_build_deb/Dockerfile @@ -30,6 +30,9 @@ # Dockerfile to build Debian packages for gRPC C core. FROM grpc/base +# Add the file containing the gRPC version +ADD version.txt version.txt + # Install dependencies RUN apt-get update && apt-get install -y lintian diff --git a/tools/dockerfile/grpc_build_deb/version.txt b/tools/dockerfile/grpc_build_deb/version.txt new file mode 100644 index 0000000000..4b9fcbec10 --- /dev/null +++ b/tools/dockerfile/grpc_build_deb/version.txt @@ -0,0 +1 @@ +0.5.1 diff --git a/tools/gce_setup/grpc_docker.sh b/tools/gce_setup/grpc_docker.sh index 497112ce39..0e82ac1d12 100755 --- a/tools/gce_setup/grpc_docker.sh +++ b/tools/gce_setup/grpc_docker.sh @@ -673,7 +673,7 @@ _grpc_build_proto_bins_args() { } # grpc_build_proto_bins -# +# # - rebuilds the dist_proto docker image # * doing this builds the protoc and the ruby, python and cpp bins statically # @@ -693,11 +693,11 @@ grpc_build_proto_bins() { gce_has_instance $grpc_project $host || return 1; local project_opt="--project $grpc_project" local zone_opt="--zone $grpc_zone" - + # rebuild the dist_proto image local label='dist_proto' grpc_update_image -- -h $host $label || return 1 - + # run a command to copy the generated archive to the docker host local docker_prefix='sudo docker run -v /tmp:/tmp/proto_bins_out' local tar_name='proto-bins*.tar.gz' @@ -715,6 +715,58 @@ grpc_build_proto_bins() { gcloud compute copy-files $rmt_tar $local_copy $project_opt $zone_opt || return 1 } +_grpc_build_debs_args() { + [[ -n $1 ]] && { # host + host=$1 + shift + } || { + host='grpc-docker-builder' + } +} + +# grpc_build_debs +# +# - rebuilds the build_debs +# * doing this builds a deb package for release debs +# +# - runs a docker command that copies the debs from the docker instance to its +# host +# - copies the debs from the host to the local machine +grpc_build_debs() { + _grpc_ensure_gcloud_ssh || return 1; + + # declare vars local so that they don't pollute the shell environment + # where this func is used. + local grpc_zone grpc_project dry_run # set by _grpc_set_project_and_zone + # set by _grpc_build_debs_args + local host + + # set the project zone and check that all necessary args are provided + _grpc_set_project_and_zone -f _grpc_build_debs_args "$@" || return 1 + gce_has_instance $grpc_project $host || return 1; + local project_opt="--project $grpc_project" + local zone_opt="--zone $grpc_zone" + + # rebuild the build_deb image + local label='build_deb' + grpc_update_image -- -h $host $label || return 1 + + # run a command to copy the debs from the docker instance to the host. + local docker_prefix='sudo docker run -v /tmp:/tmp/host_deb_out' + local cp_cmd="/bin/bash -c 'cp -v /tmp/deb_out/*.deb /tmp/host_deb_out'" + local cmd="$docker_prefix grpc/$label $cp_cmd" + local ssh_cmd="bash -l -c \"$cmd\"" + echo "will run:" + echo " $ssh_cmd" + echo "on $host" + gcloud compute $project_opt ssh $zone_opt $host --command "$cmd" || return 1 + + # copy the debs from host machine to the local one. + local rmt_debs="$host:/tmp/*.deb" + local local_copy="$(pwd)" + gcloud compute copy-files $rmt_debs $local_copy $project_opt $zone_opt || return 1 +} + _grpc_launch_servers_args() { [[ -n $1 ]] && { # host host=$1 @@ -1310,5 +1362,3 @@ _grpc_default_creds_test_flags() { _grpc_gce_test_flags() { echo " --default_service_account=155450119199-r5aaqa2vqoa9g5mv2m6s3m1l293rlmel@developer.gserviceaccount.com --oauth_scope=https://www.googleapis.com/auth/xapi.zoo" } - -# TODO(grpc-team): add grpc_interop_gen_xxx_cmd for python -- cgit v1.2.3 From ff2828be3dcb22f09d05117eaa1dddea17703ecf Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Fri, 3 Apr 2015 03:16:46 +0200 Subject: Rewriting mutex, condition_variable, and thread. --- Makefile | 1 - include/grpc++/config.h | 49 ++++++++++++++----- include/grpc++/impl/sync.h | 46 +++++++++++++++++ include/grpc++/impl/sync_cxx11.h | 49 +++++++++++++++++++ include/grpc++/impl/sync_no_cxx11.h | 98 +++++++++++++++++++++++++++++++++++++ include/grpc++/impl/thd.h | 46 +++++++++++++++++ include/grpc++/impl/thd_cxx11.h | 45 +++++++++++++++++ include/grpc++/impl/thd_no_cxx11.h | 81 ++++++++++++++++++++++++++++++ include/grpc++/server.h | 5 +- src/cpp/server/server.cc | 10 ++-- src/cpp/server/server_context.cc | 9 ++-- src/cpp/server/thread_pool.cc | 11 +++-- src/cpp/server/thread_pool.h | 9 ++-- templates/Makefile.template | 1 - vsprojects/vs2010/global.props | 2 +- 15 files changed, 430 insertions(+), 32 deletions(-) create mode 100644 include/grpc++/impl/sync.h create mode 100644 include/grpc++/impl/sync_cxx11.h create mode 100644 include/grpc++/impl/sync_no_cxx11.h create mode 100644 include/grpc++/impl/thd.h create mode 100644 include/grpc++/impl/thd_cxx11.h create mode 100644 include/grpc++/impl/thd_no_cxx11.h diff --git a/Makefile b/Makefile index 0b2fe0701d..3e5295fb7f 100644 --- a/Makefile +++ b/Makefile @@ -218,7 +218,6 @@ ifeq ($(HAS_CXX11),true) CXXFLAGS += -std=c++11 else CXXFLAGS += -std=c++0x -DEFINES += GRPC_OLD_CXX endif CPPFLAGS += -g -Wall -Wextra -Werror -Wno-long-long -Wno-unused-parameter LDFLAGS += -g diff --git a/include/grpc++/config.h b/include/grpc++/config.h index 8ef5d71bfa..0f3d69289f 100644 --- a/include/grpc++/config.h +++ b/include/grpc++/config.h @@ -34,11 +34,46 @@ #ifndef GRPCXX_CONFIG_H #define GRPCXX_CONFIG_H -#ifdef GRPC_OLD_CXX +#if !defined(GRPC_NO_AUTODETECT_PLATFORM) + +#ifdef _MSC_VER +// Visual Studio 2010 is 1600. +#if _MSC_VER < 1600 +#error "gRPC is only supported with Visual Studio starting at 2010" +// Visual Studio 2013 is 1800. +#elif _MSC_VER < 1800 +#define GRPC_CXX0X_NO_FINAL 1 +#define GRPC_CXX0X_NO_OVERRIDE 1 +#define GRPC_CXX0X_NO_CHRONO 1 +#define GRPC_CXX0X_NO_THREAD 1 +#endif +#endif // Visual Studio + +#ifndef __clang__ +#ifdef __GNUC__ +// nullptr was added in gcc 4.6 +#if (__GNUC__ * 100 + __GNUC_MINOR__ < 406) +#define GRPC_CXX0X_NO_NULLPTR 1 +#endif +// final and override were added in gcc 4.7 +#if (__GNUC__ * 100 + __GNUC_MINOR__ < 407) +#define GRPC_CXX0X_NO_FINAL 1 +#define GRPC_CXX0X_NO_OVERRIDE 1 +#endif +#endif +#endif + +#endif + +#ifdef GRPC_CXX0X_NO_FINAL #define GRPC_FINAL -#define GRPC_OVERRIDE #else #define GRPC_FINAL final +#endif + +#ifdef GRPC_CXX0X_NO_OVERRIDE +#define GRPC_OVERRIDE +#else #define GRPC_OVERRIDE override #endif @@ -65,15 +100,7 @@ ::google::protobuf::io::ZeroCopyInputStream #endif -#ifndef __clang__ -#ifdef __GNUC__ -#if (__GNUC__ * 100 + __GNUC_MINOR__ < 406) -#define GRPC_NO_NULLPTR -#endif -#endif -#endif - -#ifdef GRPC_NO_NULLPTR +#ifdef GRPC_CXX0X_NO_NULLPTR #include const class { public: diff --git a/include/grpc++/impl/sync.h b/include/grpc++/impl/sync.h new file mode 100644 index 0000000000..64d1003685 --- /dev/null +++ b/include/grpc++/impl/sync.h @@ -0,0 +1,46 @@ +/* + * + * 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. + * + */ + +#ifndef GRPCXX_IMPL_SYNC_H +#define GRPCXX_IMPL_SYNC_H + +#include + +#ifdef GRPC_CXX0X_NO_THREAD +#include +#else +#include + +#endif + +#endif // GRPCXX_IMPL_SYNC_H diff --git a/include/grpc++/impl/sync_cxx11.h b/include/grpc++/impl/sync_cxx11.h new file mode 100644 index 0000000000..4e6f1da3a6 --- /dev/null +++ b/include/grpc++/impl/sync_cxx11.h @@ -0,0 +1,49 @@ +/* + * + * 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. + * + */ + +#ifndef GRPCXX_IMPL_SYNC_CXX11_H +#define GRPCXX_IMPL_SYNC_CXX11_H + +#include +#include + +namespace grpc { + +using std::condition_variable; +using std::mutex; +using std::lock_guard; +using std::unique_lock; + +} // namespace grpc + +#endif // GRPCXX_IMPL_SYNC_CXX11_H diff --git a/include/grpc++/impl/sync_no_cxx11.h b/include/grpc++/impl/sync_no_cxx11.h new file mode 100644 index 0000000000..3bf4fb8e3d --- /dev/null +++ b/include/grpc++/impl/sync_no_cxx11.h @@ -0,0 +1,98 @@ +/* + * + * 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. + * + */ + +#ifndef GRPCXX_IMPL_SYNC_NO_CXX11_H +#define GRPCXX_IMPL_SYNC_NO_CXX11_H + +#include + +namespace grpc { + +template +class lock_guard; +class condition_variable; + +class mutex { + public: + mutex() { gpr_mu_init(&mu_); } + ~mutex() { gpr_mu_destroy(&mu_); } + private: + ::gpr_mu mu_; + template + friend class lock_guard; + friend class condition_variable; +}; + +template +class lock_guard { + public: + lock_guard(mutex &mu) : mu_(mu), locked(true) { gpr_mu_lock(&mu.mu_); } + ~lock_guard() { unlock(); } + void lock() { + if (!locked) gpr_mu_lock(&mu_.mu_); + locked = true; + } + void unlock() { + if (locked) gpr_mu_unlock(&mu_.mu_); + locked = false; + } + private: + mutex &mu_; + bool locked; + friend class condition_variable; +}; + +template +class unique_lock : public lock_guard { + public: + unique_lock(mutex &mu) : lock_guard(mu) { } +}; + +class condition_variable { + public: + condition_variable() { gpr_cv_init(&cv_); } + ~condition_variable() { gpr_cv_destroy(&cv_); } + void wait(lock_guard &mu) { + mu.locked = false; + gpr_cv_wait(&cv_, &mu.mu_.mu_, gpr_inf_future); + mu.locked = true; + } + void notify_one() { gpr_cv_signal(&cv_); } + void notify_all() { gpr_cv_broadcast(&cv_); } + private: + gpr_cv cv_; +}; + +} // namespace grpc + +#endif // GRPCXX_IMPL_SYNC_NO_CXX11_H diff --git a/include/grpc++/impl/thd.h b/include/grpc++/impl/thd.h new file mode 100644 index 0000000000..6a4c86a490 --- /dev/null +++ b/include/grpc++/impl/thd.h @@ -0,0 +1,46 @@ +/* + * + * 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. + * + */ + +#ifndef GRPCXX_IMPL_THD_H +#define GRPCXX_IMPL_THD_H + +#include + +#ifdef GRPC_CXX0X_NO_THREAD +#include +#else +#include + +#endif + +#endif // GRPCXX_IMPL_THD_H diff --git a/include/grpc++/impl/thd_cxx11.h b/include/grpc++/impl/thd_cxx11.h new file mode 100644 index 0000000000..2055b1d538 --- /dev/null +++ b/include/grpc++/impl/thd_cxx11.h @@ -0,0 +1,45 @@ +/* + * + * 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. + * + */ + +#ifndef GRPCXX_IMPL_THD_CXX11_H +#define GRPCXX_IMPL_THD_CXX11_H + +#include + +namespace grpc { + +using std::thread; + +} // namespace grpc + +#endif // GRPCXX_IMPL_THD_CXX11_H diff --git a/include/grpc++/impl/thd_no_cxx11.h b/include/grpc++/impl/thd_no_cxx11.h new file mode 100644 index 0000000000..f54cc1b6de --- /dev/null +++ b/include/grpc++/impl/thd_no_cxx11.h @@ -0,0 +1,81 @@ +/* + * + * 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. + * + */ + +#ifndef GRPCXX_IMPL_THD_NO_CXX11_H +#define GRPCXX_IMPL_THD_NO_CXX11_H + +#include + +namespace grpc { + +class thread { + public: + template thread(void (T::*fptr)(), T *obj) { + func_ = new thread_function(fptr, obj); + start(); + } + ~thread() { delete func_; } + void join() { gpr_thd_join(thd); } + private: + void start() { + gpr_thd_options options = gpr_thd_options_default(); + gpr_thd_options_set_joinable(&options); + gpr_thd_new(&thd, thread_func, (void *) func_, &options); + } + static void thread_func(void *arg) { + thread_function_base *func = (thread_function_base *) arg; + func->call(); + } + class thread_function_base { + public: + virtual ~thread_function_base() { } + virtual void call() = 0; + }; + template + class thread_function : public thread_function_base { + public: + thread_function(void (T::*fptr)(), T *obj) + : fptr_(fptr) + , obj_(obj) { } + virtual void call() { (obj_->*fptr_)(); } + private: + void (T::*fptr_)(); + T *obj_; + }; + thread_function_base *func_; + gpr_thd_id thd; +}; + +} // namespace grpc + +#endif // GRPCXX_IMPL_THD_NO_CXX11_H diff --git a/include/grpc++/server.h b/include/grpc++/server.h index 3ecfad98af..eb50611573 100644 --- a/include/grpc++/server.h +++ b/include/grpc++/server.h @@ -41,6 +41,7 @@ #include #include #include +#include #include struct grpc_server; @@ -108,12 +109,12 @@ class Server GRPC_FINAL : private CallHook, CompletionQueue cq_; // Sever status - std::mutex mu_; + grpc::mutex mu_; bool started_; bool shutdown_; // The number of threads which are running callbacks. int num_running_cb_; - std::condition_variable callback_cv_; + grpc::condition_variable callback_cv_; std::list sync_methods_; diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index bd0a23739c..046133c5eb 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -183,7 +183,7 @@ Server::Server(ThreadPoolInterface* thread_pool, bool thread_pool_owned) Server::~Server() { { - std::unique_lock lock(mu_); + grpc::unique_lock lock(mu_); if (started_ && !shutdown_) { lock.unlock(); Shutdown(); @@ -259,7 +259,7 @@ bool Server::Start() { } void Server::Shutdown() { - std::unique_lock lock(mu_); + grpc::unique_lock lock(mu_); if (started_ && !shutdown_) { shutdown_ = true; grpc_server_shutdown(server_); @@ -273,7 +273,7 @@ void Server::Shutdown() { } void Server::Wait() { - std::unique_lock lock(mu_); + grpc::unique_lock lock(mu_); while (num_running_cb_ != 0) { callback_cv_.wait(lock); } @@ -405,7 +405,7 @@ void Server::RequestAsyncGenericCall(GenericServerContext* context, void Server::ScheduleCallback() { { - std::unique_lock lock(mu_); + grpc::unique_lock lock(mu_); num_running_cb_++; } thread_pool_->ScheduleCallback(std::bind(&Server::RunRpc, this)); @@ -426,7 +426,7 @@ void Server::RunRpc() { } { - std::unique_lock lock(mu_); + grpc::unique_lock lock(mu_); num_running_cb_--; if (shutdown_) { callback_cv_.notify_all(); diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index 0fe4b4d8e3..ffd6d30d5d 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -34,6 +34,7 @@ #include #include +#include #include #include #include "src/cpp/util/time.h" @@ -55,14 +56,14 @@ class ServerContext::CompletionOp GRPC_FINAL : public CallOpBuffer { void Unref(); private: - std::mutex mu_; + grpc::mutex mu_; int refs_; bool finalized_; bool cancelled_; }; void ServerContext::CompletionOp::Unref() { - std::unique_lock lock(mu_); + grpc::unique_lock lock(mu_); if (--refs_ == 0) { lock.unlock(); delete this; @@ -71,13 +72,13 @@ void ServerContext::CompletionOp::Unref() { bool ServerContext::CompletionOp::CheckCancelled(CompletionQueue* cq) { cq->TryPluck(this); - std::lock_guard g(mu_); + grpc::lock_guard g(mu_); return finalized_ ? cancelled_ : false; } bool ServerContext::CompletionOp::FinalizeResult(void** tag, bool* status) { GPR_ASSERT(CallOpBuffer::FinalizeResult(tag, status)); - std::unique_lock lock(mu_); + grpc::unique_lock lock(mu_); finalized_ = true; if (!*status) cancelled_ = true; if (--refs_ == 0) { diff --git a/src/cpp/server/thread_pool.cc b/src/cpp/server/thread_pool.cc index 80c96111b1..e8d0e89ed2 100644 --- a/src/cpp/server/thread_pool.cc +++ b/src/cpp/server/thread_pool.cc @@ -31,6 +31,9 @@ * */ +#include +#include + #include "src/cpp/server/thread_pool.h" namespace grpc { @@ -38,7 +41,7 @@ namespace grpc { void ThreadPool::ThreadFunc() { for (;;) { // Wait until work is available or we are shutting down. - std::unique_lock lock(mu_); + grpc::unique_lock lock(mu_); if (!shutdown_ && callbacks_.empty()) { cv_.wait(lock); } @@ -57,13 +60,13 @@ void ThreadPool::ThreadFunc() { ThreadPool::ThreadPool(int num_threads) : shutdown_(false) { for (int i = 0; i < num_threads; i++) { - threads_.push_back(std::thread(&ThreadPool::ThreadFunc, this)); + threads_.push_back(grpc::thread(&ThreadPool::ThreadFunc, this)); } } ThreadPool::~ThreadPool() { { - std::lock_guard lock(mu_); + grpc::lock_guard lock(mu_); shutdown_ = true; cv_.notify_all(); } @@ -73,7 +76,7 @@ ThreadPool::~ThreadPool() { } void ThreadPool::ScheduleCallback(const std::function& callback) { - std::lock_guard lock(mu_); + grpc::lock_guard lock(mu_); callbacks_.push(callback); cv_.notify_one(); } diff --git a/src/cpp/server/thread_pool.h b/src/cpp/server/thread_pool.h index c773cdb629..0f24d6e9b3 100644 --- a/src/cpp/server/thread_pool.h +++ b/src/cpp/server/thread_pool.h @@ -35,6 +35,9 @@ #define GRPC_INTERNAL_CPP_SERVER_THREAD_POOL_H #include + +#include +#include #include #include @@ -50,11 +53,11 @@ class ThreadPool GRPC_FINAL : public ThreadPoolInterface { void ScheduleCallback(const std::function& callback) GRPC_OVERRIDE; private: - std::mutex mu_; - std::condition_variable cv_; + grpc::mutex mu_; + grpc::condition_variable cv_; bool shutdown_; std::queue> callbacks_; - std::vector threads_; + std::vector threads_; void ThreadFunc(); }; diff --git a/templates/Makefile.template b/templates/Makefile.template index 36d11425df..8579a623c6 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -235,7 +235,6 @@ ifeq ($(HAS_CXX11),true) CXXFLAGS += -std=c++11 else CXXFLAGS += -std=c++0x -DEFINES += GRPC_OLD_CXX endif CPPFLAGS += -g -Wall -Wextra -Werror -Wno-long-long -Wno-unused-parameter LDFLAGS += -g diff --git a/vsprojects/vs2010/global.props b/vsprojects/vs2010/global.props index e9b9d6cb85..ae44e18d4e 100644 --- a/vsprojects/vs2010/global.props +++ b/vsprojects/vs2010/global.props @@ -6,7 +6,7 @@ $(SolutionDir)\..\..;$(SolutionDir)\..\..\include;$(SolutionDir)\..\..\third_party\zlib;$(SolutionDir)\..\third_party;$(SolutionDir)\..\..\third_party\openssl\inc32;$(SolutionDir)\..\..\third_party\protobuf\src - GRPC_OLD_CXX;_CRT_SECURE_NO_WARNINGS;_UNICODE;UNICODE;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;_UNICODE;UNICODE;%(PreprocessorDefinitions) EnableAllWarnings -- cgit v1.2.3 From cf1a7e03e73b5e9b3c01d56398869650eb5ccb48 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Sat, 4 Apr 2015 10:15:08 -0700 Subject: Remove the racy check added in commit i74c14e5ac752edc7e1dc0aaf31abfd1153df1d0a. This is potentially unsafe since checking the deadline involves more than 1 word read. --- src/core/iomgr/alarm.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/core/iomgr/alarm.c b/src/core/iomgr/alarm.c index 3b7092449a..5860834de3 100644 --- a/src/core/iomgr/alarm.c +++ b/src/core/iomgr/alarm.c @@ -307,10 +307,6 @@ static int run_some_expired_alarms(gpr_mu *drop_mu, gpr_timespec now, /* TODO(ctiller): verify that there are any alarms (atomically) here */ - if (gpr_time_cmp(g_shard_queue[0]->min_deadline, now) >= 0) { - return 0; - } - if (gpr_mu_trylock(&g_checker_mu)) { gpr_mu_lock(&g_mu); -- cgit v1.2.3 From 3f670f4f26c2190dacea0af0c74538f32af387b7 Mon Sep 17 00:00:00 2001 From: Alexander Staubo Date: Sun, 5 Apr 2015 01:09:37 -0400 Subject: Remove unused references to malloc.h (which is non-standard, Linux-specific and generally deprecated; use instead). --- src/node/ext/byte_buffer.cc | 1 - src/node/ext/channel.cc | 2 -- src/node/ext/server.cc | 2 -- 3 files changed, 5 deletions(-) diff --git a/src/node/ext/byte_buffer.cc b/src/node/ext/byte_buffer.cc index 82b54b518c..01bd92ea52 100644 --- a/src/node/ext/byte_buffer.cc +++ b/src/node/ext/byte_buffer.cc @@ -32,7 +32,6 @@ */ #include -#include #include #include diff --git a/src/node/ext/channel.cc b/src/node/ext/channel.cc index 787e274973..d37bf763dd 100644 --- a/src/node/ext/channel.cc +++ b/src/node/ext/channel.cc @@ -31,8 +31,6 @@ * */ -#include - #include #include diff --git a/src/node/ext/server.cc b/src/node/ext/server.cc index e47bac833b..3c2396b810 100644 --- a/src/node/ext/server.cc +++ b/src/node/ext/server.cc @@ -38,8 +38,6 @@ #include #include -#include - #include #include "grpc/grpc.h" #include "grpc/grpc_security.h" -- cgit v1.2.3 From cd7096deb60c91fdd56c2ef9aaf763a1161dc8ad Mon Sep 17 00:00:00 2001 From: Nathaniel Manista Date: Mon, 6 Apr 2015 15:08:36 +0000 Subject: Add a metadata_transformer to the Python stub. --- src/compiler/python_generator.cc | 4 +++- src/python/src/grpc/_adapter/_links_test.py | 11 ++++++++++- src/python/src/grpc/_adapter/rear.py | 10 +++++++++- src/python/src/grpc/early_adopter/implementations.py | 12 +++++++++--- 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/compiler/python_generator.cc b/src/compiler/python_generator.cc index d32213f7d5..72149bc4e3 100644 --- a/src/compiler/python_generator.cc +++ b/src/compiler/python_generator.cc @@ -354,6 +354,7 @@ bool PrintStubFactory(const grpc::string& package_qualified_service_name, "Service", service->name(), }); out->Print(dict, "def early_adopter_create_$Service$_stub(host, port," + " metadata_transformer=None," " secure=False, root_certificates=None, private_key=None," " certificate_chain=None, server_host_override=None):\n"); { @@ -423,7 +424,8 @@ bool PrintStubFactory(const grpc::string& package_qualified_service_name, out->Print( "return implementations.stub(" "\"$PackageQualifiedServiceName$\"," - " method_invocation_descriptions, host, port, secure=secure," + " method_invocation_descriptions, host, port," + " metadata_transformer=metadata_transformer, secure=secure," " root_certificates=root_certificates, private_key=private_key," " certificate_chain=certificate_chain," " server_host_override=server_host_override)\n", diff --git a/src/python/src/grpc/_adapter/_links_test.py b/src/python/src/grpc/_adapter/_links_test.py index cfdcc2c4bc..4987be389a 100644 --- a/src/python/src/grpc/_adapter/_links_test.py +++ b/src/python/src/grpc/_adapter/_links_test.py @@ -43,6 +43,14 @@ _IDENTITY = lambda x: x _TIMEOUT = 2 +# TODO(nathaniel): End-to-end metadata testing. +def _transform_metadata(unused_metadata): + return ( + ('one unused key', 'one unused value'), + ('another unused key', 'another unused value'), +) + + class RoundTripTest(unittest.TestCase): def setUp(self): @@ -76,7 +84,8 @@ class RoundTripTest(unittest.TestCase): rear_link = rear.RearLink( 'localhost', port, self.rear_link_pool, {test_method: None}, - {test_method: None}, False, None, None, None) + {test_method: None}, False, None, None, None, + metadata_transformer=_transform_metadata) rear_link.join_fore_link(test_fore_link) test_fore_link.join_rear_link(rear_link) rear_link.start() diff --git a/src/python/src/grpc/_adapter/rear.py b/src/python/src/grpc/_adapter/rear.py index f19321c426..2b93aa6331 100644 --- a/src/python/src/grpc/_adapter/rear.py +++ b/src/python/src/grpc/_adapter/rear.py @@ -93,7 +93,7 @@ class RearLink(base_interfaces.RearLink, activated.Activated): def __init__( self, host, port, pool, request_serializers, response_deserializers, secure, root_certificates, private_key, certificate_chain, - server_host_override=None): + metadata_transformer=None, server_host_override=None): """Constructor. Args: @@ -111,6 +111,9 @@ class RearLink(base_interfaces.RearLink, activated.Activated): key should be used. certificate_chain: The PEM-encoded certificate chain to use or None if no certificate chain should be used. + metadata_transformer: A function that given a metadata object produces + another metadata to be used in the underlying communication on the + wire. server_host_override: (For testing only) the target name used for SSL host name checking. """ @@ -134,6 +137,7 @@ class RearLink(base_interfaces.RearLink, activated.Activated): self._root_certificates = root_certificates self._private_key = private_key self._certificate_chain = certificate_chain + self._metadata_transformer = metadata_transformer self._server_host_override = server_host_override def _on_write_event(self, operation_id, event, rpc_state): @@ -243,6 +247,10 @@ class RearLink(base_interfaces.RearLink, activated.Activated): """ request_serializer = self._request_serializers[name] call = _low.Call(self._channel, name, self._host, time.time() + timeout) + if self._metadata_transformer is not None: + metadata = self._metadata_transformer([]) + for metadata_key, metadata_value in metadata: + call.add_metadata(metadata_key, metadata_value) call.invoke(self._completion_queue, operation_id, operation_id) outstanding = set(_INVOCATION_EVENT_KINDS) diff --git a/src/python/src/grpc/early_adopter/implementations.py b/src/python/src/grpc/early_adopter/implementations.py index 7d3d29f06c..35456d38c6 100644 --- a/src/python/src/grpc/early_adopter/implementations.py +++ b/src/python/src/grpc/early_adopter/implementations.py @@ -114,7 +114,7 @@ class _Stub(interfaces.Stub): def __init__( self, breakdown, host, port, secure, root_certificates, private_key, - certificate_chain, server_host_override=None): + certificate_chain, metadata_transformer=None, server_host_override=None): self._lock = threading.Lock() self._breakdown = breakdown self._host = host @@ -123,6 +123,7 @@ class _Stub(interfaces.Stub): self._root_certificates = root_certificates self._private_key = private_key self._certificate_chain = certificate_chain + self._metadata_transformer = metadata_transformer self._server_host_override = server_host_override self._pool = None @@ -141,6 +142,7 @@ class _Stub(interfaces.Stub): self._breakdown.request_serializers, self._breakdown.response_deserializers, self._secure, self._root_certificates, self._private_key, self._certificate_chain, + metadata_transformer=self._metadata_transformer, server_host_override=self._server_host_override) self._front.join_rear_link(self._rear_link) self._rear_link.join_fore_link(self._front) @@ -189,8 +191,9 @@ class _Stub(interfaces.Stub): def stub( - service_name, methods, host, port, secure=False, root_certificates=None, - private_key=None, certificate_chain=None, server_host_override=None): + service_name, methods, host, port, metadata_transformer=None, secure=False, + root_certificates=None, private_key=None, certificate_chain=None, + server_host_override=None): """Constructs an interfaces.Stub. Args: @@ -201,6 +204,9 @@ def stub( not qualified by the service name or decorated in any other way. host: The host to which to connect for RPC service. port: The port to which to connect for RPC service. + metadata_transformer: A callable that given a metadata object produces + another metadata object to be used in the underlying communication on the + wire. secure: Whether or not to construct the stub with a secure connection. root_certificates: The PEM-encoded root certificates or None to ask for them to be retrieved from a default location. -- cgit v1.2.3 From 425e46c56c8ec872831b90e13806d75e35903a9e Mon Sep 17 00:00:00 2001 From: Alexander Staubo Date: Sun, 5 Apr 2015 01:33:58 -0400 Subject: Fix compilation of Node package conditionally on Mac: * Set compilation target 10.9. * Add C++11 compilation. * Remove librt dependency. --- src/node/binding.gyp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/node/binding.gyp b/src/node/binding.gyp index 7ef3bdf4bd..83f72fabca 100644 --- a/src/node/binding.gyp +++ b/src/node/binding.gyp @@ -18,12 +18,29 @@ ], 'link_settings': { 'libraries': [ - '-lrt', '-lpthread', '-lgrpc', '-lgpr' - ], + ] }, + "conditions": [ + ['OS == "mac"', { + 'xcode_settings': { + 'MACOSX_DEPLOYMENT_TARGET': '10.9', + 'OTHER_CFLAGS': [ + '-std=c++11', + '-stdlib=libc++' + ] + } + }], + ['OS != "mac"', { + 'link_settings': { + 'libraries': [ + '-lrt' + ] + } + }] + ], "target_name": "grpc", "sources": [ "ext/byte_buffer.cc", -- cgit v1.2.3 From 89ad0578544f9f7f24001338d8b13d0fdf1d0dc4 Mon Sep 17 00:00:00 2001 From: Nathaniel Manista Date: Mon, 6 Apr 2015 17:05:50 +0000 Subject: Update the generated Python interop code. https://github.com/grpc/grpc/issues/1150 tracks the fact that these files shouldn't even exist. For now, however, they do and should be kept current. --- src/python/interop/interop/empty_pb2.py | 5 +- src/python/interop/interop/messages_pb2.py | 5 +- src/python/interop/interop/test_pb2.py | 223 ++++++++++++++++------------- 3 files changed, 132 insertions(+), 101 deletions(-) diff --git a/src/python/interop/interop/empty_pb2.py b/src/python/interop/interop/empty_pb2.py index 732a358a36..8c1ce2f13e 100644 --- a/src/python/interop/interop/empty_pb2.py +++ b/src/python/interop/interop/empty_pb2.py @@ -57,6 +57,7 @@ Empty = _reflection.GeneratedProtocolMessageType('Empty', (_message.Message,), d _sym_db.RegisterMessage(Empty) -from grpc.framework.face import demonstration as _face_testing -from grpc.framework.face import interfaces as _face_interfaces +import abc +from grpc.early_adopter import implementations +from grpc.framework.alpha import utilities # @@protoc_insertion_point(module_scope) diff --git a/src/python/interop/interop/messages_pb2.py b/src/python/interop/interop/messages_pb2.py index d449a99140..0bf3d86a31 100644 --- a/src/python/interop/interop/messages_pb2.py +++ b/src/python/interop/interop/messages_pb2.py @@ -441,6 +441,7 @@ StreamingOutputCallResponse = _reflection.GeneratedProtocolMessageType('Streamin _sym_db.RegisterMessage(StreamingOutputCallResponse) -from grpc.framework.face import demonstration as _face_testing -from grpc.framework.face import interfaces as _face_interfaces +import abc +from grpc.early_adopter import implementations +from grpc.framework.alpha import utilities # @@protoc_insertion_point(module_scope) diff --git a/src/python/interop/interop/test_pb2.py b/src/python/interop/interop/test_pb2.py index e86094611b..71325d5a9f 100644 --- a/src/python/interop/interop/test_pb2.py +++ b/src/python/interop/interop/test_pb2.py @@ -29,121 +29,150 @@ _sym_db.RegisterFileDescriptor(DESCRIPTOR) -from grpc.framework.face import demonstration as _face_testing -from grpc.framework.face import interfaces as _face_interfaces -class TestServiceService(object): +import abc +from grpc.early_adopter import implementations +from grpc.framework.alpha import utilities +class EarlyAdopterTestServiceServicer(object): """""" - def __init__(self): - pass -class TestServiceServicer(object): - """""" - def EmptyCall(self, arg): + __metaclass__ = abc.ABCMeta + @abc.abstractmethod + def EmptyCall(self, request, context): + raise NotImplementedError() + @abc.abstractmethod + def UnaryCall(self, request, context): raise NotImplementedError() - def UnaryCall(self, arg): + @abc.abstractmethod + def StreamingOutputCall(self, request, context): raise NotImplementedError() - def StreamingOutputCall(self, arg): + @abc.abstractmethod + def StreamingInputCall(self, request_iterator, context): raise NotImplementedError() - def StreamingInputCall(self, arg): + @abc.abstractmethod + def FullDuplexCall(self, request_iterator, context): raise NotImplementedError() - def FullDuplexCall(self, arg): + @abc.abstractmethod + def HalfDuplexCall(self, request_iterator, context): + raise NotImplementedError() +class EarlyAdopterTestServiceServer(object): + """""" + __metaclass__ = abc.ABCMeta + @abc.abstractmethod + def start(self): raise NotImplementedError() - def HalfDuplexCall(self, arg): + @abc.abstractmethod + def stop(self): raise NotImplementedError() -class TestServiceStub(object): +class EarlyAdopterTestServiceStub(object): """""" - def EmptyCall(self, arg): + __metaclass__ = abc.ABCMeta + @abc.abstractmethod + def EmptyCall(self, request): raise NotImplementedError() EmptyCall.async = None - def UnaryCall(self, arg): + @abc.abstractmethod + def UnaryCall(self, request): raise NotImplementedError() UnaryCall.async = None - def StreamingOutputCall(self, arg): + @abc.abstractmethod + def StreamingOutputCall(self, request): raise NotImplementedError() StreamingOutputCall.async = None - def StreamingInputCall(self, arg): + @abc.abstractmethod + def StreamingInputCall(self, request_iterator): raise NotImplementedError() StreamingInputCall.async = None - def FullDuplexCall(self, arg): + @abc.abstractmethod + def FullDuplexCall(self, request_iterator): raise NotImplementedError() FullDuplexCall.async = None - def HalfDuplexCall(self, arg): + @abc.abstractmethod + def HalfDuplexCall(self, request_iterator): raise NotImplementedError() HalfDuplexCall.async = None -class _TestServiceStub(TestServiceStub): - def __init__(self, face_stub, default_timeout): - self._face_stub = face_stub - self._default_timeout = default_timeout - stub_self = self - class EmptyCall(object): - def __call__(self, arg): - return stub_self._face_stub.blocking_value_in_value_out("EmptyCall", arg, stub_self._default_timeout) - def async(self, arg): - return stub_self._face_stub.future_value_in_value_out("EmptyCall", arg, stub_self._default_timeout) - self.EmptyCall = EmptyCall() - class UnaryCall(object): - def __call__(self, arg): - return stub_self._face_stub.blocking_value_in_value_out("UnaryCall", arg, stub_self._default_timeout) - def async(self, arg): - return stub_self._face_stub.future_value_in_value_out("UnaryCall", arg, stub_self._default_timeout) - self.UnaryCall = UnaryCall() - class StreamingOutputCall(object): - def __call__(self, arg): - return stub_self._face_stub.inline_value_in_stream_out("StreamingOutputCall", arg, stub_self._default_timeout) - def async(self, arg): - return stub_self._face_stub.inline_value_in_stream_out("StreamingOutputCall", arg, stub_self._default_timeout) - self.StreamingOutputCall = StreamingOutputCall() - class StreamingInputCall(object): - def __call__(self, arg): - return stub_self._face_stub.blocking_stream_in_value_out("StreamingInputCall", arg, stub_self._default_timeout) - def async(self, arg): - return stub_self._face_stub.future_stream_in_value_out("StreamingInputCall", arg, stub_self._default_timeout) - self.StreamingInputCall = StreamingInputCall() - class FullDuplexCall(object): - def __call__(self, arg): - return stub_self._face_stub.inline_stream_in_stream_out("FullDuplexCall", arg, stub_self._default_timeout) - def async(self, arg): - return stub_self._face_stub.inline_stream_in_stream_out("FullDuplexCall", arg, stub_self._default_timeout) - self.FullDuplexCall = FullDuplexCall() - class HalfDuplexCall(object): - def __call__(self, arg): - return stub_self._face_stub.inline_stream_in_stream_out("HalfDuplexCall", arg, stub_self._default_timeout) - def async(self, arg): - return stub_self._face_stub.inline_stream_in_stream_out("HalfDuplexCall", arg, stub_self._default_timeout) - self.HalfDuplexCall = HalfDuplexCall() -def mock_TestService(servicer, default_timeout): - value_in_value_out = {} - value_in_stream_out = {} - stream_in_value_out = {} - stream_in_stream_out = {} - class EmptyCall(_face_interfaces.InlineValueInValueOutMethod): - def service(self, request, context): - return servicer.EmptyCall(request) - value_in_value_out['EmptyCall'] = EmptyCall() - class UnaryCall(_face_interfaces.InlineValueInValueOutMethod): - def service(self, request, context): - return servicer.UnaryCall(request) - value_in_value_out['UnaryCall'] = UnaryCall() - class StreamingOutputCall(_face_interfaces.InlineValueInStreamOutMethod): - def service(self, request, context): - return servicer.StreamingOutputCall(request) - value_in_stream_out['StreamingOutputCall'] = StreamingOutputCall() - class StreamingInputCall(_face_interfaces.InlineStreamInValueOutMethod): - def service(self, request, context): - return servicer.StreamingInputCall(request) - stream_in_value_out['StreamingInputCall'] = StreamingInputCall() - class FullDuplexCall(_face_interfaces.InlineStreamInStreamOutMethod): - def service(self, request, context): - return servicer.FullDuplexCall(request) - stream_in_stream_out['FullDuplexCall'] = FullDuplexCall() - class HalfDuplexCall(_face_interfaces.InlineStreamInStreamOutMethod): - def service(self, request, context): - return servicer.HalfDuplexCall(request) - stream_in_stream_out['HalfDuplexCall'] = HalfDuplexCall() - face_linked_pair = _face_testing.server_and_stub(default_timeout,inline_value_in_value_out_methods=value_in_value_out,inline_value_in_stream_out_methods=value_in_stream_out,inline_stream_in_value_out_methods=stream_in_value_out,inline_stream_in_stream_out_methods=stream_in_stream_out) - class LinkedPair(object): - def __init__(self, server, stub): - self.server = server - self.stub = stub - stub = _TestServiceStub(face_linked_pair.stub, default_timeout) - return LinkedPair(None, stub) +def early_adopter_create_TestService_server(servicer, port, private_key=None, certificate_chain=None): + import test.cpp.interop.empty_pb2 + import test.cpp.interop.empty_pb2 + import test.cpp.interop.messages_pb2 + import test.cpp.interop.messages_pb2 + import test.cpp.interop.messages_pb2 + import test.cpp.interop.messages_pb2 + import test.cpp.interop.messages_pb2 + import test.cpp.interop.messages_pb2 + import test.cpp.interop.messages_pb2 + import test.cpp.interop.messages_pb2 + import test.cpp.interop.messages_pb2 + import test.cpp.interop.messages_pb2 + method_service_descriptions = { + "EmptyCall": utilities.unary_unary_service_description( + servicer.EmptyCall, + test.cpp.interop.empty_pb2.Empty.FromString, + test.cpp.interop.empty_pb2.Empty.SerializeToString, + ), + "FullDuplexCall": utilities.stream_stream_service_description( + servicer.FullDuplexCall, + test.cpp.interop.messages_pb2.StreamingOutputCallRequest.FromString, + test.cpp.interop.messages_pb2.StreamingOutputCallResponse.SerializeToString, + ), + "HalfDuplexCall": utilities.stream_stream_service_description( + servicer.HalfDuplexCall, + test.cpp.interop.messages_pb2.StreamingOutputCallRequest.FromString, + test.cpp.interop.messages_pb2.StreamingOutputCallResponse.SerializeToString, + ), + "StreamingInputCall": utilities.stream_unary_service_description( + servicer.StreamingInputCall, + test.cpp.interop.messages_pb2.StreamingInputCallRequest.FromString, + test.cpp.interop.messages_pb2.StreamingInputCallResponse.SerializeToString, + ), + "StreamingOutputCall": utilities.unary_stream_service_description( + servicer.StreamingOutputCall, + test.cpp.interop.messages_pb2.StreamingOutputCallRequest.FromString, + test.cpp.interop.messages_pb2.StreamingOutputCallResponse.SerializeToString, + ), + "UnaryCall": utilities.unary_unary_service_description( + servicer.UnaryCall, + test.cpp.interop.messages_pb2.SimpleRequest.FromString, + test.cpp.interop.messages_pb2.SimpleResponse.SerializeToString, + ), + } + return implementations.server("grpc.testing.TestService", method_service_descriptions, port, private_key=private_key, certificate_chain=certificate_chain) +def early_adopter_create_TestService_stub(host, port, metadata_transformer=None, secure=False, root_certificates=None, private_key=None, certificate_chain=None, server_host_override=None): + import test.cpp.interop.empty_pb2 + import test.cpp.interop.empty_pb2 + import test.cpp.interop.messages_pb2 + import test.cpp.interop.messages_pb2 + import test.cpp.interop.messages_pb2 + import test.cpp.interop.messages_pb2 + import test.cpp.interop.messages_pb2 + import test.cpp.interop.messages_pb2 + import test.cpp.interop.messages_pb2 + import test.cpp.interop.messages_pb2 + import test.cpp.interop.messages_pb2 + import test.cpp.interop.messages_pb2 + method_invocation_descriptions = { + "EmptyCall": utilities.unary_unary_invocation_description( + test.cpp.interop.empty_pb2.Empty.SerializeToString, + test.cpp.interop.empty_pb2.Empty.FromString, + ), + "FullDuplexCall": utilities.stream_stream_invocation_description( + test.cpp.interop.messages_pb2.StreamingOutputCallRequest.SerializeToString, + test.cpp.interop.messages_pb2.StreamingOutputCallResponse.FromString, + ), + "HalfDuplexCall": utilities.stream_stream_invocation_description( + test.cpp.interop.messages_pb2.StreamingOutputCallRequest.SerializeToString, + test.cpp.interop.messages_pb2.StreamingOutputCallResponse.FromString, + ), + "StreamingInputCall": utilities.stream_unary_invocation_description( + test.cpp.interop.messages_pb2.StreamingInputCallRequest.SerializeToString, + test.cpp.interop.messages_pb2.StreamingInputCallResponse.FromString, + ), + "StreamingOutputCall": utilities.unary_stream_invocation_description( + test.cpp.interop.messages_pb2.StreamingOutputCallRequest.SerializeToString, + test.cpp.interop.messages_pb2.StreamingOutputCallResponse.FromString, + ), + "UnaryCall": utilities.unary_unary_invocation_description( + test.cpp.interop.messages_pb2.SimpleRequest.SerializeToString, + test.cpp.interop.messages_pb2.SimpleResponse.FromString, + ), + } + return implementations.stub("grpc.testing.TestService", method_invocation_descriptions, host, port, metadata_transformer=metadata_transformer, secure=secure, root_certificates=root_certificates, private_key=private_key, certificate_chain=certificate_chain, server_host_override=server_host_override) # @@protoc_insertion_point(module_scope) -- cgit v1.2.3 From 4c64d4695a86533cef5ccea1ae77d94685b117bb Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 6 Apr 2015 11:16:28 -0700 Subject: Added example math server --- src/csharp/Grpc.Examples.MathServer/.gitignore | 2 + .../Grpc.Examples.MathServer.csproj | 52 ++++++++++++++++++ src/csharp/Grpc.Examples.MathServer/MathServer.cs | 61 ++++++++++++++++++++++ .../Properties/AssemblyInfo.cs | 12 +++++ src/csharp/Grpc.sln | 6 +++ 5 files changed, 133 insertions(+) create mode 100644 src/csharp/Grpc.Examples.MathServer/.gitignore create mode 100644 src/csharp/Grpc.Examples.MathServer/Grpc.Examples.MathServer.csproj create mode 100644 src/csharp/Grpc.Examples.MathServer/MathServer.cs create mode 100644 src/csharp/Grpc.Examples.MathServer/Properties/AssemblyInfo.cs diff --git a/src/csharp/Grpc.Examples.MathServer/.gitignore b/src/csharp/Grpc.Examples.MathServer/.gitignore new file mode 100644 index 0000000000..1746e3269e --- /dev/null +++ b/src/csharp/Grpc.Examples.MathServer/.gitignore @@ -0,0 +1,2 @@ +bin +obj diff --git a/src/csharp/Grpc.Examples.MathServer/Grpc.Examples.MathServer.csproj b/src/csharp/Grpc.Examples.MathServer/Grpc.Examples.MathServer.csproj new file mode 100644 index 0000000000..3f7e6c0768 --- /dev/null +++ b/src/csharp/Grpc.Examples.MathServer/Grpc.Examples.MathServer.csproj @@ -0,0 +1,52 @@ + + + + Debug + x86 + 10.0.0 + 2.0 + {BF62FE08-373A-43D6-9D73-41CAA38B7011} + Exe + Grpc.Examples.MathServer + Grpc.Examples.MathServer + v4.5 + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + true + x86 + + + full + true + bin\Release + prompt + 4 + true + x86 + + + + + + + + + + + + {CCC4440E-49F7-4790-B0AF-FEABB0837AE7} + Grpc.Core + + + {7DC1433E-3225-42C7-B7EA-546D56E27A4B} + Grpc.Examples + + + \ No newline at end of file diff --git a/src/csharp/Grpc.Examples.MathServer/MathServer.cs b/src/csharp/Grpc.Examples.MathServer/MathServer.cs new file mode 100644 index 0000000000..884a84d0a6 --- /dev/null +++ b/src/csharp/Grpc.Examples.MathServer/MathServer.cs @@ -0,0 +1,61 @@ +#region Copyright notice and license +// 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. +#endregion + +using System; +using System.Runtime.InteropServices; +using System.Threading; +using Grpc.Core; + +namespace math +{ + class MainClass + { + public static void Main(string[] args) + { + String host = "0.0.0.0"; + + GrpcEnvironment.Initialize(); + + Server server = new Server(); + server.AddServiceDefinition(MathGrpc.BindService(new MathServiceImpl())); + int port = server.AddListeningPort(host + ":0"); + server.Start(); + + Console.WriteLine("MathServer listening on port " + port); + + Console.WriteLine("Press any key to stop the server..."); + Console.ReadKey(); + + server.ShutdownAsync().Wait(); + GrpcEnvironment.Shutdown(); + } + } +} diff --git a/src/csharp/Grpc.Examples.MathServer/Properties/AssemblyInfo.cs b/src/csharp/Grpc.Examples.MathServer/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..6b3d0516b9 --- /dev/null +++ b/src/csharp/Grpc.Examples.MathServer/Properties/AssemblyInfo.cs @@ -0,0 +1,12 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +[assembly: AssemblyTitle("Grpc.Examples.MathServer")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("Google Inc. All rights reserved.")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: AssemblyVersion("0.1.*")] diff --git a/src/csharp/Grpc.sln b/src/csharp/Grpc.sln index 2e6d288699..2f8c2e1719 100644 --- a/src/csharp/Grpc.sln +++ b/src/csharp/Grpc.sln @@ -17,6 +17,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grpc.IntegrationTesting.Cli EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grpc.IntegrationTesting.Server", "Grpc.IntegrationTesting.Server\Grpc.IntegrationTesting.Server.csproj", "{A654F3B8-E859-4E6A-B30D-227527DBEF0D}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grpc.Examples.MathServer", "Grpc.Examples.MathServer\Grpc.Examples.MathServer.csproj", "{BF62FE08-373A-43D6-9D73-41CAA38B7011}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x86 = Debug|x86 @@ -47,6 +49,10 @@ Global {A654F3B8-E859-4E6A-B30D-227527DBEF0D}.Debug|x86.Build.0 = Debug|x86 {A654F3B8-E859-4E6A-B30D-227527DBEF0D}.Release|x86.ActiveCfg = Release|x86 {A654F3B8-E859-4E6A-B30D-227527DBEF0D}.Release|x86.Build.0 = Release|x86 + {BF62FE08-373A-43D6-9D73-41CAA38B7011}.Debug|x86.ActiveCfg = Debug|x86 + {BF62FE08-373A-43D6-9D73-41CAA38B7011}.Debug|x86.Build.0 = Debug|x86 + {BF62FE08-373A-43D6-9D73-41CAA38B7011}.Release|x86.ActiveCfg = Release|x86 + {BF62FE08-373A-43D6-9D73-41CAA38B7011}.Release|x86.Build.0 = Release|x86 {C61154BA-DD4A-4838-8420-0162A28925E0}.Debug|x86.ActiveCfg = Debug|x86 {C61154BA-DD4A-4838-8420-0162A28925E0}.Debug|x86.Build.0 = Debug|x86 {C61154BA-DD4A-4838-8420-0162A28925E0}.Release|x86.ActiveCfg = Release|x86 -- cgit v1.2.3 From 451887ba2c366091f0cff96d0d71752a557223c0 Mon Sep 17 00:00:00 2001 From: Masood Malekghassemi Date: Mon, 30 Mar 2015 17:44:19 -0700 Subject: Enable PyPI package management --- src/python/README.md | 22 ++++++++++++++++- src/python/interop/setup.py | 16 ++++++++----- src/python/src/.gitignore | 3 +++ src/python/src/MANIFEST.in | 1 + src/python/src/README.rst | 27 +++++++++++++++++++++ src/python/src/setup.py | 17 +++++++++---- tools/distrib/python/submit.py | 54 ++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 129 insertions(+), 11 deletions(-) create mode 100644 src/python/src/.gitignore create mode 100644 src/python/src/MANIFEST.in create mode 100644 src/python/src/README.rst create mode 100755 tools/distrib/python/submit.py diff --git a/src/python/README.md b/src/python/README.md index c8057be38b..82bc776732 100644 --- a/src/python/README.md +++ b/src/python/README.md @@ -42,7 +42,14 @@ $ tools/run_tests/run_python.sh Installing ----------------------- -- [Install the gRPC core](https://github.com/grpc/grpc/blob/master/INSTALL) +- Install the gRPC core + - [Debian package](https://github.com/grpc/grpc/releases) + ``` + $ wget https://github.com/grpc/grpc/releases/download/release-0_5_0/libgrpc_0.5.0_amd64.deb + $ wget https://github.com/grpc/grpc/releases/download/release-0_5_0/libgrpc-dev_0.5.0_amd64.deb + $ sudo dpkg -i libgrpc_0.5.0_amd64.deb libgrpc-dev_0.5.0_amd64.deb + ``` + - [From source](https://github.com/grpc/grpc/blob/master/INSTALL) - Install gRPC Python's dependencies ``` @@ -53,3 +60,16 @@ $ pip install -r src/python/requirements.txt ``` $ pip install src/python/src ``` + +Packaging to PyPI +----------------------- + +- Install packaging dependencies +``` +$ pip install setuptools twine +``` + +- Push to PyPI +``` +$ ../../tools/distrib/python/submit.py +``` diff --git a/src/python/interop/setup.py b/src/python/interop/setup.py index 6db5435090..7a329924a5 100644 --- a/src/python/interop/setup.py +++ b/src/python/interop/setup.py @@ -29,7 +29,7 @@ """A setup module for the GRPC Python interop testing package.""" -from distutils import core as _core +import setuptools _PACKAGES = ( 'interop', @@ -45,9 +45,13 @@ _PACKAGE_DATA = { 'credentials/server1.pem',] } -_INSTALL_REQUIRES = ['grpc-2015>=0.0.1'] +_INSTALL_REQUIRES = ['grpcio>=0.4.0a4'] -_core.setup( - name='interop', version='0.0.1', packages=_PACKAGES, - package_dir=_PACKAGE_DIRECTORIES, package_data=_PACKAGE_DATA, - install_requires=_INSTALL_REQUIRES) +setuptools.setup( + name='interop', + version='0.0.1', + packages=_PACKAGES, + package_dir=_PACKAGE_DIRECTORIES, + package_data=_PACKAGE_DATA, + install_requires=_INSTALL_REQUIRES +) diff --git a/src/python/src/.gitignore b/src/python/src/.gitignore new file mode 100644 index 0000000000..bc15a52cf1 --- /dev/null +++ b/src/python/src/.gitignore @@ -0,0 +1,3 @@ +MANIFEST +grpcio.egg-info/ +dist/ diff --git a/src/python/src/MANIFEST.in b/src/python/src/MANIFEST.in new file mode 100644 index 0000000000..6f32db0548 --- /dev/null +++ b/src/python/src/MANIFEST.in @@ -0,0 +1 @@ +graft grpc diff --git a/src/python/src/README.rst b/src/python/src/README.rst new file mode 100644 index 0000000000..bc1815febc --- /dev/null +++ b/src/python/src/README.rst @@ -0,0 +1,27 @@ +gRPC Python +=========== + +Package for GRPC Python. + +Dependencies +------------ + +Ensure that you have installed GRPC core. + +On debian linux systems, install from our released deb package: + +:: + + $ wget https://github.com/grpc/grpc/releases/download/release-0_5_0/libgrpc_0.5.0_amd64.deb + $ wget https://github.com/grpc/grpc/releases/download/release-0_5_0/libgrpc-dev_0.5.0_amd64.deb + $ sudo dpkg -i libgrpc_0.5.0_amd64.deb libgrpc-dev_0.5.0_amd64.deb + +Otherwise, install from source: + +:: + + git clone https://github.com/grpc/grpc.git + cd grpc + ./configure + make && make install + diff --git a/src/python/src/setup.py b/src/python/src/setup.py index bd70634b8f..a6924b27c3 100644 --- a/src/python/src/setup.py +++ b/src/python/src/setup.py @@ -30,6 +30,7 @@ """A setup module for the GRPC Python package.""" from distutils import core as _core +import setuptools _EXTENSION_SOURCES = ( 'grpc/_adapter/_c.c', @@ -80,7 +81,15 @@ _PACKAGE_DIRECTORIES = { 'grpc.framework': 'grpc/framework', } -_core.setup( - name='grpc-2015', version='0.4.0', - ext_modules=[_EXTENSION_MODULE], packages=list(_PACKAGES), - package_dir=_PACKAGE_DIRECTORIES) +setuptools.setup( + name='grpcio', + version='0.4.0a8', + ext_modules=[_EXTENSION_MODULE], + packages=list(_PACKAGES), + package_dir=_PACKAGE_DIRECTORIES, + install_requires=[ + 'enum34==1.0.4', + 'futures==2.2.0', + 'protobuf==3.0.0-alpha-1' + ] +) diff --git a/tools/distrib/python/submit.py b/tools/distrib/python/submit.py new file mode 100755 index 0000000000..5d8a917365 --- /dev/null +++ b/tools/distrib/python/submit.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python + +import argparse +import os +import shutil +import subprocess + +parser = argparse.ArgumentParser( + description='Submit the package to a PyPI repository.') +parser.add_argument( + '--repository', '-r', metavar='r', type=str, default='pypi', + help='The repository to push the package to. ' + 'Ensure the value appears in your .pypirc file. ' + 'Defaults to "pypi".' +) +parser.add_argument( + '--identity', '-i', metavar='i', type=str, + help='GPG identity to sign the files with.' +) +parser.add_argument( + '--username', '-u', metavar='u', type=str, + help='Username to authenticate with the repository. Not needed if you have ' + 'configured your .pypirc to include your username.' +) +parser.add_argument( + '--password', '-p', metavar='p', type=str, + help='Password to authenticate with the repository. Not needed if you have ' + 'configured your .pypirc to include your password.' +) +args = parser.parse_args() + +# Move to the root directory of Python GRPC. +pkgdir = os.path.join(os.path.dirname(os.path.abspath(__file__)), + '../../../src/python/src') +# Remove previous distributions; they somehow confuse twine. +try: + shutil.rmtree(os.path.join(pkgdir, 'dist/')) +except: + pass + +# Make the push. +cmd = ['python', 'setup.py', 'sdist'] +subprocess.call(cmd) + +cmd = ['twine', 'upload', '-r', args.repository] +if args.identity is not None: + cmd.extend(['-i', args.identity]) +if args.username is not None: + cmd.extend(['-u', args.username]) +if args.password is not None: + cmd.extend(['-p', args.password]) +cmd.append('dist/*') + +subprocess.call(cmd, cwd=pkgdir) -- cgit v1.2.3 From b092916a2ae7380ee22902d8c3cb217d6a7dc758 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Tue, 7 Apr 2015 01:17:14 +0200 Subject: Addressing concerns. --- include/grpc++/impl/sync.h | 3 +-- include/grpc++/impl/sync_no_cxx11.h | 13 ++++++++----- include/grpc++/impl/thd.h | 3 +-- include/grpc++/impl/thd_no_cxx11.h | 16 ++++++++++++---- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/include/grpc++/impl/sync.h b/include/grpc++/impl/sync.h index 64d1003685..2f41d2bdeb 100644 --- a/include/grpc++/impl/sync.h +++ b/include/grpc++/impl/sync.h @@ -37,10 +37,9 @@ #include #ifdef GRPC_CXX0X_NO_THREAD -#include +#include #else #include - #endif #endif // GRPCXX_IMPL_SYNC_H diff --git a/include/grpc++/impl/sync_no_cxx11.h b/include/grpc++/impl/sync_no_cxx11.h index 3bf4fb8e3d..5636373b81 100644 --- a/include/grpc++/impl/sync_no_cxx11.h +++ b/include/grpc++/impl/sync_no_cxx11.h @@ -56,13 +56,14 @@ class mutex { template class lock_guard { public: - lock_guard(mutex &mu) : mu_(mu), locked(true) { gpr_mu_lock(&mu.mu_); } - ~lock_guard() { unlock(); } - void lock() { + lock_guard(mutex &mu) : mu_(mu), locked(true) { gpr_mu_lock(&mu.mu_); } + ~lock_guard() { unlock_internal(); } + protected: + void lock_internal() { if (!locked) gpr_mu_lock(&mu_.mu_); locked = true; } - void unlock() { + void unlock_internal() { if (locked) gpr_mu_unlock(&mu_.mu_); locked = false; } @@ -75,7 +76,9 @@ class lock_guard { template class unique_lock : public lock_guard { public: - unique_lock(mutex &mu) : lock_guard(mu) { } + unique_lock(mutex &mu) : lock_guard(mu) { } + void lock() { lock_internal(); } + void unlock() { unlock_internal(); } }; class condition_variable { diff --git a/include/grpc++/impl/thd.h b/include/grpc++/impl/thd.h index 6a4c86a490..4c4578a92d 100644 --- a/include/grpc++/impl/thd.h +++ b/include/grpc++/impl/thd.h @@ -37,10 +37,9 @@ #include #ifdef GRPC_CXX0X_NO_THREAD -#include +#include #else #include - #endif #endif // GRPCXX_IMPL_THD_H diff --git a/include/grpc++/impl/thd_no_cxx11.h b/include/grpc++/impl/thd_no_cxx11.h index f54cc1b6de..a01b931df8 100644 --- a/include/grpc++/impl/thd_no_cxx11.h +++ b/include/grpc++/impl/thd_no_cxx11.h @@ -42,15 +42,22 @@ class thread { public: template thread(void (T::*fptr)(), T *obj) { func_ = new thread_function(fptr, obj); + joined_ = false; start(); } - ~thread() { delete func_; } - void join() { gpr_thd_join(thd); } + ~thread() { + if (!joined_) std::terminate(); + delete func_; + } + void join() { + gpr_thd_join(thd_); + joined_ = true; + } private: void start() { gpr_thd_options options = gpr_thd_options_default(); gpr_thd_options_set_joinable(&options); - gpr_thd_new(&thd, thread_func, (void *) func_, &options); + gpr_thd_new(&thd_, thread_func, (void *) func_, &options); } static void thread_func(void *arg) { thread_function_base *func = (thread_function_base *) arg; @@ -73,7 +80,8 @@ class thread { T *obj_; }; thread_function_base *func_; - gpr_thd_id thd; + gpr_thd_id thd_; + bool joined_; }; } // namespace grpc -- cgit v1.2.3 From d44824749682314412b48c2d598f4e6b1a4c79b6 Mon Sep 17 00:00:00 2001 From: Tony Han Date: Fri, 3 Apr 2015 14:02:12 +0800 Subject: change gflags in .gitmodules to github --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 97b7197be3..557321001f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -11,4 +11,4 @@ branch = v3.0.0-alpha-1 [submodule "third_party/gflags"] path = third_party/gflags - url = https://code.google.com/p/gflags + url = https://github.com/gflags/gflags.git -- cgit v1.2.3 From a397330cc0f8177c7d3d2cbaac07134cbaa50c74 Mon Sep 17 00:00:00 2001 From: Nicolas Noble Date: Tue, 7 Apr 2015 08:11:33 -0700 Subject: Fixing MacOS build breakage introduced in #1191. --- src/core/support/thd_posix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/support/thd_posix.c b/src/core/support/thd_posix.c index 7bf527201d..fa4eb50556 100644 --- a/src/core/support/thd_posix.c +++ b/src/core/support/thd_posix.c @@ -87,7 +87,7 @@ gpr_thd_id gpr_thd_currentid(void) { } void gpr_thd_join(gpr_thd_id t) { - pthread_join(t, NULL); + pthread_join((pthread_t)t, NULL); } #endif /* GPR_POSIX_SYNC */ -- cgit v1.2.3 From 2db4ebdec9567fcb1d7df6ee3ce676ea0bdfaa07 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 7 Apr 2015 09:57:23 -0700 Subject: Updated composer.json to version 0.5.0 --- src/php/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/php/composer.json b/src/php/composer.json index dca61a9889..3c0cb37231 100644 --- a/src/php/composer.json +++ b/src/php/composer.json @@ -1,7 +1,7 @@ { "name": "grpc/grpc", "description": "gRPC library for PHP", - "version": "0.2.0", + "version": "0.5.0", "homepage": "http://grpc.io", "license": "BSD-3-Clause", "require": { -- cgit v1.2.3 From 5e51518f61e8268a003e83f1d5140c2775e05044 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Tue, 7 Apr 2015 19:08:38 +0200 Subject: Bumping library version to 0.6. --- Makefile | 2 +- build.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 6428da5566..753bbfb401 100644 --- a/Makefile +++ b/Makefile @@ -284,7 +284,7 @@ E = @echo Q = @ endif -VERSION = 0.5.0.0 +VERSION = 0.6.0.0 CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES)) CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) diff --git a/build.json b/build.json index 06adfee9f7..d814e4c6bd 100644 --- a/build.json +++ b/build.json @@ -3,7 +3,7 @@ "#": "The public version number of the library.", "version": { "major": 0, - "minor": 5, + "minor": 6, "micro": 0, "build": 0 } -- cgit v1.2.3 From e8fef4319c83e745bd89b5b5f6aa40ac8ffdcbb5 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 7 Apr 2015 10:58:15 -0700 Subject: csharp version 0.1 -> 0.2 --- src/csharp/Grpc.Core.Tests/Properties/AssemblyInfo.cs | 2 +- src/csharp/Grpc.Core/Grpc.Core.nuspec | 2 +- src/csharp/Grpc.Core/Properties/AssemblyInfo.cs | 2 +- src/csharp/Grpc.Examples.MathClient/Properties/AssemblyInfo.cs | 2 +- src/csharp/Grpc.Examples.Tests/Properties/AssemblyInfo.cs | 2 +- src/csharp/Grpc.Examples/Properties/AssemblyInfo.cs | 2 +- src/csharp/Grpc.IntegrationTesting.Client/Properties/AssemblyInfo.cs | 2 +- src/csharp/Grpc.IntegrationTesting.Server/Properties/AssemblyInfo.cs | 2 +- src/csharp/Grpc.IntegrationTesting/Properties/AssemblyInfo.cs | 2 +- src/csharp/Grpc.nuspec | 4 ++-- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/csharp/Grpc.Core.Tests/Properties/AssemblyInfo.cs b/src/csharp/Grpc.Core.Tests/Properties/AssemblyInfo.cs index e4328806ad..e0f0474245 100644 --- a/src/csharp/Grpc.Core.Tests/Properties/AssemblyInfo.cs +++ b/src/csharp/Grpc.Core.Tests/Properties/AssemblyInfo.cs @@ -9,4 +9,4 @@ using System.Runtime.CompilerServices; [assembly: AssemblyCopyright("Google Inc. All rights reserved.")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -[assembly: AssemblyVersion("0.1.*")] +[assembly: AssemblyVersion("0.2.*")] diff --git a/src/csharp/Grpc.Core/Grpc.Core.nuspec b/src/csharp/Grpc.Core/Grpc.Core.nuspec index af8a8869ca..f2032522c9 100644 --- a/src/csharp/Grpc.Core/Grpc.Core.nuspec +++ b/src/csharp/Grpc.Core/Grpc.Core.nuspec @@ -7,7 +7,7 @@ Core C# implementation of gRPC - an RPC library and framework. See project site for more info. This is an experimental release, not ready to use. - 0.1.0 + 0.2.0 Google Inc. jtattermusch https://github.com/grpc/grpc/blob/master/LICENSE diff --git a/src/csharp/Grpc.Core/Properties/AssemblyInfo.cs b/src/csharp/Grpc.Core/Properties/AssemblyInfo.cs index 168939cf8c..81218cb67e 100644 --- a/src/csharp/Grpc.Core/Properties/AssemblyInfo.cs +++ b/src/csharp/Grpc.Core/Properties/AssemblyInfo.cs @@ -9,6 +9,6 @@ using System.Runtime.CompilerServices; [assembly: AssemblyCopyright("Google Inc. All rights reserved.")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -[assembly: AssemblyVersion("0.1.*")] +[assembly: AssemblyVersion("0.2.*")] [assembly: InternalsVisibleTo("Grpc.Core.Tests")] diff --git a/src/csharp/Grpc.Examples.MathClient/Properties/AssemblyInfo.cs b/src/csharp/Grpc.Examples.MathClient/Properties/AssemblyInfo.cs index 11fc099a95..1989ca8430 100644 --- a/src/csharp/Grpc.Examples.MathClient/Properties/AssemblyInfo.cs +++ b/src/csharp/Grpc.Examples.MathClient/Properties/AssemblyInfo.cs @@ -9,4 +9,4 @@ using System.Runtime.CompilerServices; [assembly: AssemblyCopyright("Google Inc. All rights reserved.")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -[assembly: AssemblyVersion("0.1.*")] +[assembly: AssemblyVersion("0.2.*")] diff --git a/src/csharp/Grpc.Examples.Tests/Properties/AssemblyInfo.cs b/src/csharp/Grpc.Examples.Tests/Properties/AssemblyInfo.cs index 43c7616ac3..d78e9210c0 100644 --- a/src/csharp/Grpc.Examples.Tests/Properties/AssemblyInfo.cs +++ b/src/csharp/Grpc.Examples.Tests/Properties/AssemblyInfo.cs @@ -9,4 +9,4 @@ using System.Runtime.CompilerServices; [assembly: AssemblyCopyright("Google Inc. All rights reserved.")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -[assembly: AssemblyVersion("0.1.*")] +[assembly: AssemblyVersion("0.2.*")] diff --git a/src/csharp/Grpc.Examples/Properties/AssemblyInfo.cs b/src/csharp/Grpc.Examples/Properties/AssemblyInfo.cs index b55d24166c..fd1cdbbc1c 100644 --- a/src/csharp/Grpc.Examples/Properties/AssemblyInfo.cs +++ b/src/csharp/Grpc.Examples/Properties/AssemblyInfo.cs @@ -9,4 +9,4 @@ using System.Runtime.CompilerServices; [assembly: AssemblyCopyright("Google Inc. All rights reserved.")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -[assembly: AssemblyVersion("0.1.*")] +[assembly: AssemblyVersion("0.2.*")] diff --git a/src/csharp/Grpc.IntegrationTesting.Client/Properties/AssemblyInfo.cs b/src/csharp/Grpc.IntegrationTesting.Client/Properties/AssemblyInfo.cs index c93dd1eb2f..d9d36f03e4 100644 --- a/src/csharp/Grpc.IntegrationTesting.Client/Properties/AssemblyInfo.cs +++ b/src/csharp/Grpc.IntegrationTesting.Client/Properties/AssemblyInfo.cs @@ -9,4 +9,4 @@ using System.Runtime.CompilerServices; [assembly: AssemblyCopyright("Google Inc. All rights reserved.")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -[assembly: AssemblyVersion("0.1.*")] +[assembly: AssemblyVersion("0.2.*")] diff --git a/src/csharp/Grpc.IntegrationTesting.Server/Properties/AssemblyInfo.cs b/src/csharp/Grpc.IntegrationTesting.Server/Properties/AssemblyInfo.cs index f3def1aea4..b0b163b883 100644 --- a/src/csharp/Grpc.IntegrationTesting.Server/Properties/AssemblyInfo.cs +++ b/src/csharp/Grpc.IntegrationTesting.Server/Properties/AssemblyInfo.cs @@ -9,4 +9,4 @@ using System.Runtime.CompilerServices; [assembly: AssemblyCopyright("Google Inc. All rights reserved.")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -[assembly: AssemblyVersion("0.1.*")] +[assembly: AssemblyVersion("0.2.*")] diff --git a/src/csharp/Grpc.IntegrationTesting/Properties/AssemblyInfo.cs b/src/csharp/Grpc.IntegrationTesting/Properties/AssemblyInfo.cs index f09a448e9e..fe6c8a8aed 100644 --- a/src/csharp/Grpc.IntegrationTesting/Properties/AssemblyInfo.cs +++ b/src/csharp/Grpc.IntegrationTesting/Properties/AssemblyInfo.cs @@ -9,4 +9,4 @@ using System.Runtime.CompilerServices; [assembly: AssemblyCopyright("Google Inc. All rights reserved.")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -[assembly: AssemblyVersion("0.1.*")] +[assembly: AssemblyVersion("0.2.*")] diff --git a/src/csharp/Grpc.nuspec b/src/csharp/Grpc.nuspec index 96a6aaf6b7..4c106a2ca2 100644 --- a/src/csharp/Grpc.nuspec +++ b/src/csharp/Grpc.nuspec @@ -7,7 +7,7 @@ C# implementation of gRPC - an RPC library and framework. See project site for more info. This is an experimental release, not ready to use. - 0.1.0 + 0.2.0 Google Inc. jtattermusch https://github.com/grpc/grpc/blob/master/LICENSE @@ -17,7 +17,7 @@ Copyright 2015, Google Inc. gRPC RPC Protocol HTTP/2 - + -- cgit v1.2.3 From 2b34e5adf180fae100609d1efdcf8c7a8c6b6f18 Mon Sep 17 00:00:00 2001 From: Masood Malekghassemi Date: Tue, 7 Apr 2015 11:03:11 -0700 Subject: Version update to 0.5.0 --- src/python/src/setup.py | 2 +- tools/distrib/python/submit.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/python/src/setup.py b/src/python/src/setup.py index a6924b27c3..1e45a8e8d5 100644 --- a/src/python/src/setup.py +++ b/src/python/src/setup.py @@ -83,7 +83,7 @@ _PACKAGE_DIRECTORIES = { setuptools.setup( name='grpcio', - version='0.4.0a8', + version='0.5.0a0', ext_modules=[_EXTENSION_MODULE], packages=list(_PACKAGES), package_dir=_PACKAGE_DIRECTORIES, diff --git a/tools/distrib/python/submit.py b/tools/distrib/python/submit.py index 5d8a917365..79ebb93e57 100755 --- a/tools/distrib/python/submit.py +++ b/tools/distrib/python/submit.py @@ -40,7 +40,7 @@ except: # Make the push. cmd = ['python', 'setup.py', 'sdist'] -subprocess.call(cmd) +subprocess.call(cmd, cwd=pkgdir) cmd = ['twine', 'upload', '-r', args.repository] if args.identity is not None: -- cgit v1.2.3 From 14e941d0d25e9f840799b84bc4ce97d6fcc1eb83 Mon Sep 17 00:00:00 2001 From: Tim Emiola Date: Tue, 7 Apr 2015 11:06:52 -0700 Subject: Bump ruby version to match the new release --- src/ruby/lib/grpc/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ruby/lib/grpc/version.rb b/src/ruby/lib/grpc/version.rb index 513a53724f..bfd0cbb393 100644 --- a/src/ruby/lib/grpc/version.rb +++ b/src/ruby/lib/grpc/version.rb @@ -29,5 +29,5 @@ # GRPC contains the General RPC module. module GRPC - VERSION = '0.5.0' + VERSION = '0.6.0' end -- cgit v1.2.3 From d3efd0a1ecce86405ac5eee2121fdb767e65fdb4 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 7 Apr 2015 11:40:29 -0700 Subject: Created Objective C stub code generators --- src/compiler/generator_helpers.h | 21 +++ src/compiler/objective_c_generator.cc | 234 +++++++++++++++++++++++++++ src/compiler/objective_c_generator.h | 48 ++++++ src/compiler/objective_c_generator_helpers.h | 58 +++++++ src/compiler/objective_c_plugin.cc | 95 +++++++++++ 5 files changed, 456 insertions(+) create mode 100644 src/compiler/objective_c_generator.cc create mode 100644 src/compiler/objective_c_generator.h create mode 100644 src/compiler/objective_c_generator_helpers.h create mode 100644 src/compiler/objective_c_plugin.cc diff --git a/src/compiler/generator_helpers.h b/src/compiler/generator_helpers.h index 30857891c7..2a3366ac65 100644 --- a/src/compiler/generator_helpers.h +++ b/src/compiler/generator_helpers.h @@ -95,6 +95,27 @@ inline std::vector tokenize(const grpc::string &input, } } +inline grpc::string CapitalizeFirstLetter(grpc::string str) { + if (s.empty()) { + return s; + } + s[0] = ::toupper(s[0]); + return s; +} + +inline grpc::string LowerUnderscoreToUpperCamel(grpc::string str) { + std::vector tokens = tokenize(str, "_"); + grpc::string result = ""; + for (unsigned int i = 0; i < tokens.size(); i++) { + result += CapitalizeFirstLetter(tokens[i]); + } + return result; +} + +inline grpc::string FileNameInUpperCamel(const grpc::protobuf::FileDescriptor *file) { + return LowerUnderscoreToUpperCamel(StripProto(file->name())); +} + } // namespace grpc_generator #endif // GRPC_INTERNAL_COMPILER_GENERATOR_HELPERS_H diff --git a/src/compiler/objective_c_generator.cc b/src/compiler/objective_c_generator.cc new file mode 100644 index 0000000000..41ffabe898 --- /dev/null +++ b/src/compiler/objective_c_generator.cc @@ -0,0 +1,234 @@ +/* + * + * 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 + +#include "src/compiler/objective_c_generator.h" +#include "src/compiler/objective_c_generator_helpers.h" + +#include "src/compiler/config.h" + +#include + +namespace grpc_objective_c_generator { +namespace { + +void PrintSimpleBlockSignature(grpc::protobuf::io::Printer *printer, + const grpc::protobuf::MethodDescriptor *method, + std::map *vars) { + (*vars)["method_name"] = method->name(); + (*vars)["request_type"] = PrefixedName(method->input_type()); + (*vars)["response_type"] = PrefixedName(method->output_type()); + + if (method->server_streaming()) { + printer->Print("// When the response stream finishes, the handler is " + "called with nil for both arguments.\n\n"); + } else { + printer->Print("// The handler is only called once.\n\n"); + } + printer->Print(vars, "- (id)$method_name$WithRequest:" + "($request_type$)request completionHandler:(void(^)" + "($response_type$ *, NSError *))handler"); +} + +void PrintSimpleDelegateSignature(grpc::protobuf::io::Printer *printer, + const grpc::protobuf::MethodDescriptor *method, + std::map *vars) { + (*vars)["method_name"] = method->name(); + (*vars)["request_type"] = PrefixedName(method->input_type()); + + printer->Print(vars, "- (id)$method_name$WithRequest:" + "($request_type$)request delegate:(id)delegate"); +} + +void PrintAdvancedSignature(grpc::protobuf::io::Printer *printer, + const grpc::protobuf::MethodDescriptor *method, + std::map *vars) { + (*vars)["method_name"] = method->name(); + printer->Print(vars, "- (GRXSource *)$method_name$WithRequest:" + "(id)request"); +} + +grpc::string GetHeader(const grpc::protobuf::ServiceDescriptor *service + const grpc::string message_header) { + grpc::string output; + grpc::protobuf::io::StringOutputStream output_stream(&output); + grpc::protobuf::io::Printer printer(&output_stream, '$'); + std::map vars; + printer.Print("#import \"PBgRPCClient.h\"\n"); + printer.Print("#import \"PBStub.h\"\n"); + vars["message_header"] = message_header; + printer.Print(&vars, "#import \"$message_header$\"\n\n"); + printer.Print("@protocol GRXSource\n"); + printer.Print("@class GRXSource\n\n"); + vars["service_name"] = service->name(); + printer.Print("@protocol $service_name$Stub \n\n"); + printer.Print("#pragma mark Simple block handlers\n\n"); + for (int i = 0; i < service->method_count(); i++) { + PrintSimpleBlockSignature(&printer, service->method(i), &vars); + printer.Print(";\n"); + } + printer.Print("\n"); + printer.Print("#pragma mark Simple delegate handlers.\n\n"); + printer.Print("# TODO(jcanizales): Use high-level snippets to remove this duplication."); + for (int i = 0; i < service->method_count(); i++) { + PrintSimpleDelegateSignature(&printer, service->method(i), &vars); + printer.Print(";\n"); + } + printer.Print("\n"); + printer.Print("#pragma mark Advanced handlers.\n\n"); + for (int i = 0; i < service->method_count(); i++) { + PrintAdvancedSignature(&printer, service->method(i), &vars); + printer.Print(";\n"); + } + printer.Print("\n"); + printer.Print("@end\n\n"); + printer.Print("// Basic stub that only does marshalling and parsing\n"); + printer.Print(&vars, "@interface $service_name$Stub :" + " PBStub<$service_name$Stub>\n"); + printer.Print("- (instancetype)initWithHost:(NSString *)host;\n"); + printer.Print("@end\n"); + return output; +} + +void PrintSourceMethodSimpleBlock(grpc::protobuf::io::Printer *printer, + const grpc::protobuf::MethodDescriptor *method, + std::map *vars) { + PrintSimpleBlockSignature(printer, method, vars); + + (*vars)["method_name"] = method->name(); + printer->Print(" {\n"); + printer->Indent(); + printer->Print(vars, "return [[self $method_name$WithRequest:request] " + "connectHandler:^(id value, NSError *error) {\n"); + printer->Indent(); + printer->Print("handler(value, error);\n"); + printer->Outdent(); + printer->Print("}];\n"); + printer->Outdent(); + printer->Print("}\n"); +} + +void PrintSourceMethodSimpleDelegate(grpc::protobuf::io::Printer *printer, + const grpc::protobuf::MethodDescriptor *method, + std::map *vars) { + PrintSimpleDelegateSignature(printer, method, vars); + + (*vars)["method_name"] = method->name(); + printer->Print(" {\n"); + printer->Indent(); + printer->Print(vars, "return [[self $method_name$WithRequest:request]" + "connectToSink:delegate];\n"); + printer->Outdent(); + printer->Print("}\n"); +} + +void PrintSourceMethodAdvanced(grpc::protobuf::io::Printer *printer, + const grpc::protobuf::MethodDescriptor *method, + std::map *vars) { + PrintAdvancedSignature(printer, method, vars); + + (*vars)["method_name"] = method->name(); + printer->Print(" {\n"); + printer->Indent(); + printer->Print(vars, "return [self $method_name$WithRequest:request " + "client:[self newClient]];\n"); + printer->Outdent(); + printer->Print("}\n"); +} + +void PrintSourceMethodHandler(grpc::protobuf::io::Printer *printer, + const grpc::protobuf::MethodDescriptor *method, + std::map *vars) { + (*vars)["method_name"] = method->name(); + (*vars)["response_type"] = PrefixedName(method->output_type()); + (*vars)["caps_name"] = grpc_generator::CapitalizeFirstLetter(method->name()); + + printer->Print(vars, "- (GRXSource *)$method_name$WithRequest:" + "(id)request client:(PBgRPCClient *)client {\n"); + printer->Indent(); + printer->Print(vars, + "return [self responseWithMethod:$@\"$caps_name\"\n"); + printer->Print(vars, + " class:[$response_type$ class]\n"); + printer->Print(" request:request\n"); + printer->Print(" client:client];\n"); + printer->Outdent(); + printer->Print("}\n"); +} + +grpc::string GetSource(const grpc::protobuf::ServiceDescriptor *service) { + grpc::string output; + grpc::protobuf::io::StringOutputStream output_stream(&output); + grpc::protobuf::io::Printer printer(&output_stream, '$'); + std::map vars; + vars["service_name"] = service->name(); + printer.Print(&vars, "#import \"$service_name$Stub.pb.h\"\n"); + printer.Print("#import \"PBGeneratedMessage+GRXSource.h\"\n\n"); + vars["full_name"] = service->full_name(); + printer.Print(&vars, + "static NSString *const kInterface = @\"$full_name$\";\n"); + printer.Print("@implementation $service_name$Stub\n\n"); + printer.Print("- (instancetype)initWithHost:(NSString *)host {\n"); + printer.Indent(); + printer.Print("if ((self = [super initWithHost:host " + "interface:kInterface])) {\n"); + printer.Print("}\n"); + printer.Print("return self;\n"); + printer.Outdent(); + printer.Print("}\n\n"); + printer.Print("#pragma mark Simple block handlers.\n"); + for (int i = 0; i < service->method_count(); i++) { + PrintSourceMethodSimpleBlock(&printer, service->method(i), &vars); + } + printer.Print("\n"); + printer.Print("#pragma mark Simple delegate handlers.\n"); + for (int i = 0; i < service->method_count(); i++) { + PrintSourceMethodSimpleDelegate(&printer, service->method(i), &vars); + } + printer.Print("\n"); + printer.Print("#pragma mark Advanced handlers.\n"); + for (int i = 0; i < service->method_count(); i++) { + PrintSourceMethodAdvanced(&printer, service->method(i), &vars); + } + printer.Print("\n"); + printer.Print("#pragma mark Handlers for subclasses " + "(stub wrappers) to override.\n"); + for (int i = 0; i < service->method_count(); i++) { + PrintSourceMethodHandler(&printer, service->method(i), &vars); + } + printer.Print("@end\n"); + return output; +} + +} // namespace grpc_objective_c_generator diff --git a/src/compiler/objective_c_generator.h b/src/compiler/objective_c_generator.h new file mode 100644 index 0000000000..bea63f51e5 --- /dev/null +++ b/src/compiler/objective_c_generator.h @@ -0,0 +1,48 @@ +/* + * + * 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. + * + */ + +#ifndef GRPC_INTERNAL_COMPILER_OBJECTIVE_C_GENERATOR_H +#define GRPC_INTERNAL_COMPILER_OBJECTIVE_C_GENERATOR_H + +#include "src/compiler/config.h" + +namespace grpc_objective_c_generator { + +grpc::string GetHeader(const grpc::protobuf::ServiceDescriptor *service + const grpc::string message_header); + +grpc::string GetSource(const grpc::protobuf::ServiceDescriptor *service); + +} // namespace grpc_objective_c_generator + +#endif // GRPC_INTERNAL_COMPILER_OBJECTIVE_C_GENERATOR_H diff --git a/src/compiler/objective_c_generator_helpers.h b/src/compiler/objective_c_generator_helpers.h new file mode 100644 index 0000000000..0c2ece823c --- /dev/null +++ b/src/compiler/objective_c_generator_helpers.h @@ -0,0 +1,58 @@ +/* + * + * 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. + * + */ + +#ifndef GRPC_INTERNAL_COMPILER_OBJECTIVE_C_GENERATOR_HELPERS_H +#define GRPC_INTERNAL_COMPILER_OBJECTIVE_C_GENERATOR_HELPERS_H + +#include +#include "src/compiler/config.h" +#include "src/compiler/generator_helpers.h" + +namespace grpc_objective_c_generator { + +const grpc::string prefix = "PBG"; + +inline grpc::string MessageHeaderName(const grpc::protobuf::FileDescriptor *file) { + return FileNameInUpperCase(file) + ".pb.h"; +} + +inline grpc::string StubFileName(grpc::string service_name) { + return prefix + service_name + "Stub"; +} + +inline grpc::string PrefixedName(grpc::string name) { + return prefix + name; +} + +} +#endif // GRPC_INTERNAL_COMPILER_OBJECTIVE_C_GENERATOR_HELPERS_H diff --git a/src/compiler/objective_c_plugin.cc b/src/compiler/objective_c_plugin.cc new file mode 100644 index 0000000000..4d4146b5c4 --- /dev/null +++ b/src/compiler/objective_c_plugin.cc @@ -0,0 +1,95 @@ +/* + * + * 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. + * + */ + +// Generates Objective C gRPC service interface out of Protobuf IDL. + +#include + +#include "src/compiler/config.h" +#include "src/compiler/objective_c_generator.h" +#include "src/compiler/objective_c_generator_helpers.h" + +class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { + public: + ObjectiveCGrpcGenerator() {} + virtual ~ObjectiveCGrpcGenerator() {} + + virtual bool Generate(const grpc::protobuf::FileDescriptor *file, + const grpc::string ¶meter, + grpc::protobuf::compiler::GeneratorContext *context, + grpc::string *error) const { + + if (file->service_count() == 0) { + // No services. Do nothing. + return true; + } + + for (int i = 0; i < file->service_count(); i++) { + const grpc::protobuf::ServiceDescriptor *service = file->service(i); + grpc::sring file_name = grpc_objective_c_generator::StubFileName( + service->name()); + + // Generate .pb.h + grpc::string header_code = grpc_objective_c_generator::GetHeader(service); + std::unique_ptr header_output( + context->Open(file_name + ".pb.h")); + grpc::protobuf::io::CodedOutputStream header_coded_out(output.get()); + header_coded_out.WriteRaw(header_code.data(), header_code.size()); + + // Generate .pb.m + grpc::string source_code = grpc_objective_c_generator::GetSource(service); + std::unique_ptr source_output( + context->Open(file_name + ".pb.m")); + grpc::protobuf::io::CodedOutputStream source_coded_out(output.get()); + source_coded_out.WriteRaw(source_code.data(), source_code.size()); + } + + return true; + } + + private: + // Insert the given code into the given file at the given insertion point. + void Insert(grpc::protobuf::compiler::GeneratorContext *context, + const grpc::string &filename, const grpc::string &insertion_point, + const grpc::string &code) const { + std::unique_ptr output( + context->OpenForInsert(filename, insertion_point)); + grpc::protobuf::io::CodedOutputStream coded_out(output.get()); + coded_out.WriteRaw(code.data(), code.size()); + } +}; + +int main(int argc, char *argv[]) { + ObjectiveCGrpcGenerator generator; + return grpc::protobuf::compiler::PluginMain(argc, argv, &generator); +} -- cgit v1.2.3 From 8eac91eaf4200e4f3bae1486d22e54e4710ae162 Mon Sep 17 00:00:00 2001 From: Alexander Staubo Date: Mon, 6 Apr 2015 12:06:22 -0400 Subject: OS X doesn't have librt, so don't link to it. --- src/python/src/setup.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/python/src/setup.py b/src/python/src/setup.py index 1e45a8e8d5..32ac41e285 100644 --- a/src/python/src/setup.py +++ b/src/python/src/setup.py @@ -31,6 +31,7 @@ from distutils import core as _core import setuptools +import sys _EXTENSION_SOURCES = ( 'grpc/_adapter/_c.c', @@ -50,8 +51,9 @@ _EXTENSION_INCLUDE_DIRECTORIES = ( _EXTENSION_LIBRARIES = ( 'grpc', 'gpr', - 'rt', ) +if not "darwin" in sys.platform: + _EXTENSION_LIBRARIES += ('rt',) _EXTENSION_MODULE = _core.Extension( 'grpc._adapter._c', sources=list(_EXTENSION_SOURCES), -- cgit v1.2.3 From 8c5d68bd0bd705b8d6e5b6952850edc0d70c754d Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 7 Apr 2015 12:34:50 -0700 Subject: add calltype decl where missing --- src/csharp/ext/grpc_csharp_ext.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/csharp/ext/grpc_csharp_ext.c b/src/csharp/ext/grpc_csharp_ext.c index 9a1c908d11..e182468d9b 100644 --- a/src/csharp/ext/grpc_csharp_ext.c +++ b/src/csharp/ext/grpc_csharp_ext.c @@ -731,7 +731,7 @@ grpcsharp_ssl_credentials_create(const char *pem_root_certs, } } -GPR_EXPORT void grpcsharp_credentials_release(grpc_credentials *creds) { +GPR_EXPORT void GPR_CALLTYPE grpcsharp_credentials_release(grpc_credentials *creds) { grpc_credentials_release(creds); } @@ -765,7 +765,7 @@ grpcsharp_ssl_server_credentials_create( return creds; } -GPR_EXPORT void grpcsharp_server_credentials_release( +GPR_EXPORT void GPR_CALLTYPE grpcsharp_server_credentials_release( grpc_server_credentials *creds) { grpc_server_credentials_release(creds); } -- cgit v1.2.3 From ac0002adb8c8baa9382576c8075fda6b7cd02dab Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 7 Apr 2015 12:49:14 -0700 Subject: Made Objective C plugin build without error --- Makefile | 37 ++++++++- build.json | 15 ++++ src/compiler/generator_helpers.h | 2 +- src/compiler/objective_c_generator.cc | 116 ++++++++++++++------------- src/compiler/objective_c_generator.h | 2 +- src/compiler/objective_c_generator_helpers.h | 2 +- src/compiler/objective_c_plugin.cc | 11 ++- 7 files changed, 120 insertions(+), 65 deletions(-) diff --git a/Makefile b/Makefile index 4e99231a1c..22235b7ded 100644 --- a/Makefile +++ b/Makefile @@ -456,7 +456,7 @@ endif .SECONDARY = %.pb.h %.pb.cc -PROTOC_PLUGINS = $(BINDIR)/$(CONFIG)/grpc_cpp_plugin $(BINDIR)/$(CONFIG)/grpc_python_plugin $(BINDIR)/$(CONFIG)/grpc_ruby_plugin +PROTOC_PLUGINS = $(BINDIR)/$(CONFIG)/grpc_cpp_plugin $(BINDIR)/$(CONFIG)/grpc_objective_c_plugin $(BINDIR)/$(CONFIG)/grpc_python_plugin $(BINDIR)/$(CONFIG)/grpc_ruby_plugin ifeq ($(DEP_MISSING),) all: static shared plugins dep_error: @@ -632,6 +632,7 @@ end2end_test: $(BINDIR)/$(CONFIG)/end2end_test generic_end2end_test: $(BINDIR)/$(CONFIG)/generic_end2end_test grpc_cli: $(BINDIR)/$(CONFIG)/grpc_cli grpc_cpp_plugin: $(BINDIR)/$(CONFIG)/grpc_cpp_plugin +grpc_objective_c_plugin: $(BINDIR)/$(CONFIG)/grpc_objective_c_plugin grpc_python_plugin: $(BINDIR)/$(CONFIG)/grpc_python_plugin grpc_ruby_plugin: $(BINDIR)/$(CONFIG)/grpc_ruby_plugin interop_client: $(BINDIR)/$(CONFIG)/interop_client @@ -2266,6 +2267,8 @@ else $(Q) $(INSTALL) -d $(prefix)/bin $(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_cpp_plugin $(prefix)/bin/grpc_cpp_plugin $(Q) $(INSTALL) -d $(prefix)/bin + $(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_objective_c_plugin $(prefix)/bin/grpc_objective_c_plugin + $(Q) $(INSTALL) -d $(prefix)/bin $(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_python_plugin $(prefix)/bin/grpc_python_plugin $(Q) $(INSTALL) -d $(prefix)/bin $(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_ruby_plugin $(prefix)/bin/grpc_ruby_plugin @@ -3615,6 +3618,7 @@ $(OBJDIR)/$(CONFIG)/src/cpp/util/time.o: LIBGRPC_PLUGIN_SUPPORT_SRC = \ src/compiler/cpp_generator.cc \ + src/compiler/objective_c_generator.cc \ src/compiler/python_generator.cc \ src/compiler/ruby_generator.cc \ @@ -3649,6 +3653,7 @@ ifneq ($(NO_DEPS),true) endif $(OBJDIR)/$(CONFIG)/src/compiler/cpp_generator.o: +$(OBJDIR)/$(CONFIG)/src/compiler/objective_c_generator.o: $(OBJDIR)/$(CONFIG)/src/compiler/python_generator.o: $(OBJDIR)/$(CONFIG)/src/compiler/ruby_generator.o: @@ -8331,6 +8336,36 @@ ifneq ($(NO_DEPS),true) endif +GRPC_OBJECTIVE_C_PLUGIN_SRC = \ + src/compiler/objective_c_plugin.cc \ + +GRPC_OBJECTIVE_C_PLUGIN_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GRPC_OBJECTIVE_C_PLUGIN_SRC)))) + + +ifeq ($(NO_PROTOBUF),true) + +# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. + +$(BINDIR)/$(CONFIG)/grpc_objective_c_plugin: protobuf_dep_error + +else + +$(BINDIR)/$(CONFIG)/grpc_objective_c_plugin: $(PROTOBUF_DEP) $(GRPC_OBJECTIVE_C_PLUGIN_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a + $(E) "[HOSTLD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(HOST_LDXX) $(HOST_LDFLAGS) $(GRPC_OBJECTIVE_C_PLUGIN_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a $(HOST_LDLIBSXX) $(HOST_LDLIBS_PROTOC) $(HOST_LDLIBS) $(HOST_LDLIBS_PROTOC) -o $(BINDIR)/$(CONFIG)/grpc_objective_c_plugin + +endif + +$(OBJDIR)/$(CONFIG)/src/compiler/objective_c_plugin.o: $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a + +deps_grpc_objective_c_plugin: $(GRPC_OBJECTIVE_C_PLUGIN_OBJS:.o=.dep) + +ifneq ($(NO_DEPS),true) +-include $(GRPC_OBJECTIVE_C_PLUGIN_OBJS:.o=.dep) +endif + + GRPC_PYTHON_PLUGIN_SRC = \ src/compiler/python_plugin.cc \ diff --git a/build.json b/build.json index 06adfee9f7..890a5385a9 100644 --- a/build.json +++ b/build.json @@ -514,6 +514,8 @@ "src/compiler/cpp_generator.h", "src/compiler/cpp_generator_helpers.h", "src/compiler/generator_helpers.h", + "src/compiler/objective_c_generator.h", + "src/compiler/objective_c_generator_helpers.h", "src/compiler/python_generator.h", "src/compiler/ruby_generator.h", "src/compiler/ruby_generator_helpers-inl.h", @@ -522,6 +524,7 @@ ], "src": [ "src/compiler/cpp_generator.cc", + "src/compiler/objective_c_generator.cc", "src/compiler/python_generator.cc", "src/compiler/ruby_generator.cc" ], @@ -1817,6 +1820,18 @@ ], "secure": "no" }, + { + "name": "grpc_objective_c_plugin", + "build": "protoc", + "language": "c++", + "src": [ + "src/compiler/objective_c_plugin.cc" + ], + "deps": [ + "grpc_plugin_support" + ], + "secure": "no" + }, { "name": "grpc_python_plugin", "build": "protoc", diff --git a/src/compiler/generator_helpers.h b/src/compiler/generator_helpers.h index 2a3366ac65..374e1374cf 100644 --- a/src/compiler/generator_helpers.h +++ b/src/compiler/generator_helpers.h @@ -95,7 +95,7 @@ inline std::vector tokenize(const grpc::string &input, } } -inline grpc::string CapitalizeFirstLetter(grpc::string str) { +inline grpc::string CapitalizeFirstLetter(grpc::string s) { if (s.empty()) { return s; } diff --git a/src/compiler/objective_c_generator.cc b/src/compiler/objective_c_generator.cc index 41ffabe898..c68c9c37c2 100644 --- a/src/compiler/objective_c_generator.cc +++ b/src/compiler/objective_c_generator.cc @@ -47,8 +47,8 @@ void PrintSimpleBlockSignature(grpc::protobuf::io::Printer *printer, const grpc::protobuf::MethodDescriptor *method, std::map *vars) { (*vars)["method_name"] = method->name(); - (*vars)["request_type"] = PrefixedName(method->input_type()); - (*vars)["response_type"] = PrefixedName(method->output_type()); + (*vars)["request_type"] = PrefixedName(method->input_type()->name()); + (*vars)["response_type"] = PrefixedName(method->output_type()->name()); if (method->server_streaming()) { printer->Print("// When the response stream finishes, the handler is " @@ -56,7 +56,7 @@ void PrintSimpleBlockSignature(grpc::protobuf::io::Printer *printer, } else { printer->Print("// The handler is only called once.\n\n"); } - printer->Print(vars, "- (id)$method_name$WithRequest:" + printer->Print(*vars, "- (id)$method_name$WithRequest:" "($request_type$)request completionHandler:(void(^)" "($response_type$ *, NSError *))handler"); } @@ -65,9 +65,9 @@ void PrintSimpleDelegateSignature(grpc::protobuf::io::Printer *printer, const grpc::protobuf::MethodDescriptor *method, std::map *vars) { (*vars)["method_name"] = method->name(); - (*vars)["request_type"] = PrefixedName(method->input_type()); + (*vars)["request_type"] = PrefixedName(method->input_type()->name()); - printer->Print(vars, "- (id)$method_name$WithRequest:" + printer->Print(*vars, "- (id)$method_name$WithRequest:" "($request_type$)request delegate:(id)delegate"); } @@ -75,52 +75,10 @@ void PrintAdvancedSignature(grpc::protobuf::io::Printer *printer, const grpc::protobuf::MethodDescriptor *method, std::map *vars) { (*vars)["method_name"] = method->name(); - printer->Print(vars, "- (GRXSource *)$method_name$WithRequest:" + printer->Print(*vars, "- (GRXSource *)$method_name$WithRequest:" "(id)request"); } -grpc::string GetHeader(const grpc::protobuf::ServiceDescriptor *service - const grpc::string message_header) { - grpc::string output; - grpc::protobuf::io::StringOutputStream output_stream(&output); - grpc::protobuf::io::Printer printer(&output_stream, '$'); - std::map vars; - printer.Print("#import \"PBgRPCClient.h\"\n"); - printer.Print("#import \"PBStub.h\"\n"); - vars["message_header"] = message_header; - printer.Print(&vars, "#import \"$message_header$\"\n\n"); - printer.Print("@protocol GRXSource\n"); - printer.Print("@class GRXSource\n\n"); - vars["service_name"] = service->name(); - printer.Print("@protocol $service_name$Stub \n\n"); - printer.Print("#pragma mark Simple block handlers\n\n"); - for (int i = 0; i < service->method_count(); i++) { - PrintSimpleBlockSignature(&printer, service->method(i), &vars); - printer.Print(";\n"); - } - printer.Print("\n"); - printer.Print("#pragma mark Simple delegate handlers.\n\n"); - printer.Print("# TODO(jcanizales): Use high-level snippets to remove this duplication."); - for (int i = 0; i < service->method_count(); i++) { - PrintSimpleDelegateSignature(&printer, service->method(i), &vars); - printer.Print(";\n"); - } - printer.Print("\n"); - printer.Print("#pragma mark Advanced handlers.\n\n"); - for (int i = 0; i < service->method_count(); i++) { - PrintAdvancedSignature(&printer, service->method(i), &vars); - printer.Print(";\n"); - } - printer.Print("\n"); - printer.Print("@end\n\n"); - printer.Print("// Basic stub that only does marshalling and parsing\n"); - printer.Print(&vars, "@interface $service_name$Stub :" - " PBStub<$service_name$Stub>\n"); - printer.Print("- (instancetype)initWithHost:(NSString *)host;\n"); - printer.Print("@end\n"); - return output; -} - void PrintSourceMethodSimpleBlock(grpc::protobuf::io::Printer *printer, const grpc::protobuf::MethodDescriptor *method, std::map *vars) { @@ -129,7 +87,7 @@ void PrintSourceMethodSimpleBlock(grpc::protobuf::io::Printer *printer, (*vars)["method_name"] = method->name(); printer->Print(" {\n"); printer->Indent(); - printer->Print(vars, "return [[self $method_name$WithRequest:request] " + printer->Print(*vars, "return [[self $method_name$WithRequest:request] " "connectHandler:^(id value, NSError *error) {\n"); printer->Indent(); printer->Print("handler(value, error);\n"); @@ -147,7 +105,7 @@ void PrintSourceMethodSimpleDelegate(grpc::protobuf::io::Printer *printer, (*vars)["method_name"] = method->name(); printer->Print(" {\n"); printer->Indent(); - printer->Print(vars, "return [[self $method_name$WithRequest:request]" + printer->Print(*vars, "return [[self $method_name$WithRequest:request]" "connectToSink:delegate];\n"); printer->Outdent(); printer->Print("}\n"); @@ -161,7 +119,7 @@ void PrintSourceMethodAdvanced(grpc::protobuf::io::Printer *printer, (*vars)["method_name"] = method->name(); printer->Print(" {\n"); printer->Indent(); - printer->Print(vars, "return [self $method_name$WithRequest:request " + printer->Print(*vars, "return [self $method_name$WithRequest:request " "client:[self newClient]];\n"); printer->Outdent(); printer->Print("}\n"); @@ -171,15 +129,15 @@ void PrintSourceMethodHandler(grpc::protobuf::io::Printer *printer, const grpc::protobuf::MethodDescriptor *method, std::map *vars) { (*vars)["method_name"] = method->name(); - (*vars)["response_type"] = PrefixedName(method->output_type()); + (*vars)["response_type"] = PrefixedName(method->output_type()->name()); (*vars)["caps_name"] = grpc_generator::CapitalizeFirstLetter(method->name()); - printer->Print(vars, "- (GRXSource *)$method_name$WithRequest:" + printer->Print(*vars, "- (GRXSource *)$method_name$WithRequest:" "(id)request client:(PBgRPCClient *)client {\n"); printer->Indent(); - printer->Print(vars, + printer->Print(*vars, "return [self responseWithMethod:$@\"$caps_name\"\n"); - printer->Print(vars, + printer->Print(*vars, " class:[$response_type$ class]\n"); printer->Print(" request:request\n"); printer->Print(" client:client];\n"); @@ -187,16 +145,60 @@ void PrintSourceMethodHandler(grpc::protobuf::io::Printer *printer, printer->Print("}\n"); } +} + +grpc::string GetHeader(const grpc::protobuf::ServiceDescriptor *service, + const grpc::string message_header) { + grpc::string output; + grpc::protobuf::io::StringOutputStream output_stream(&output); + grpc::protobuf::io::Printer printer(&output_stream, '$'); + std::map vars; + printer.Print("#import \"PBgRPCClient.h\"\n"); + printer.Print("#import \"PBStub.h\"\n"); + vars["message_header"] = message_header; + printer.Print(vars, "#import \"$message_header$\"\n\n"); + printer.Print("@protocol GRXSource\n"); + printer.Print("@class GRXSource\n\n"); + vars["service_name"] = service->name(); + printer.Print("@protocol $service_name$Stub \n\n"); + printer.Print("#pragma mark Simple block handlers\n\n"); + for (int i = 0; i < service->method_count(); i++) { + PrintSimpleBlockSignature(&printer, service->method(i), &vars); + printer.Print(";\n"); + } + printer.Print("\n"); + printer.Print("#pragma mark Simple delegate handlers.\n\n"); + printer.Print("# TODO(jcanizales): Use high-level snippets to remove this duplication."); + for (int i = 0; i < service->method_count(); i++) { + PrintSimpleDelegateSignature(&printer, service->method(i), &vars); + printer.Print(";\n"); + } + printer.Print("\n"); + printer.Print("#pragma mark Advanced handlers.\n\n"); + for (int i = 0; i < service->method_count(); i++) { + PrintAdvancedSignature(&printer, service->method(i), &vars); + printer.Print(";\n"); + } + printer.Print("\n"); + printer.Print("@end\n\n"); + printer.Print("// Basic stub that only does marshalling and parsing\n"); + printer.Print(vars, "@interface $service_name$Stub :" + " PBStub<$service_name$Stub>\n"); + printer.Print("- (instancetype)initWithHost:(NSString *)host;\n"); + printer.Print("@end\n"); + return output; +} + grpc::string GetSource(const grpc::protobuf::ServiceDescriptor *service) { grpc::string output; grpc::protobuf::io::StringOutputStream output_stream(&output); grpc::protobuf::io::Printer printer(&output_stream, '$'); std::map vars; vars["service_name"] = service->name(); - printer.Print(&vars, "#import \"$service_name$Stub.pb.h\"\n"); + printer.Print(vars, "#import \"$service_name$Stub.pb.h\"\n"); printer.Print("#import \"PBGeneratedMessage+GRXSource.h\"\n\n"); vars["full_name"] = service->full_name(); - printer.Print(&vars, + printer.Print(vars, "static NSString *const kInterface = @\"$full_name$\";\n"); printer.Print("@implementation $service_name$Stub\n\n"); printer.Print("- (instancetype)initWithHost:(NSString *)host {\n"); diff --git a/src/compiler/objective_c_generator.h b/src/compiler/objective_c_generator.h index bea63f51e5..93c730b34e 100644 --- a/src/compiler/objective_c_generator.h +++ b/src/compiler/objective_c_generator.h @@ -38,7 +38,7 @@ namespace grpc_objective_c_generator { -grpc::string GetHeader(const grpc::protobuf::ServiceDescriptor *service +grpc::string GetHeader(const grpc::protobuf::ServiceDescriptor *service, const grpc::string message_header); grpc::string GetSource(const grpc::protobuf::ServiceDescriptor *service); diff --git a/src/compiler/objective_c_generator_helpers.h b/src/compiler/objective_c_generator_helpers.h index 0c2ece823c..6a7c13991f 100644 --- a/src/compiler/objective_c_generator_helpers.h +++ b/src/compiler/objective_c_generator_helpers.h @@ -43,7 +43,7 @@ namespace grpc_objective_c_generator { const grpc::string prefix = "PBG"; inline grpc::string MessageHeaderName(const grpc::protobuf::FileDescriptor *file) { - return FileNameInUpperCase(file) + ".pb.h"; + return grpc_generator::FileNameInUpperCamel(file) + ".pb.h"; } inline grpc::string StubFileName(grpc::string service_name) { diff --git a/src/compiler/objective_c_plugin.cc b/src/compiler/objective_c_plugin.cc index 4d4146b5c4..eebce0cd20 100644 --- a/src/compiler/objective_c_plugin.cc +++ b/src/compiler/objective_c_plugin.cc @@ -56,21 +56,24 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { for (int i = 0; i < file->service_count(); i++) { const grpc::protobuf::ServiceDescriptor *service = file->service(i); - grpc::sring file_name = grpc_objective_c_generator::StubFileName( + grpc::string file_name = grpc_objective_c_generator::StubFileName( service->name()); // Generate .pb.h - grpc::string header_code = grpc_objective_c_generator::GetHeader(service); + grpc::string header_code = grpc_objective_c_generator::GetHeader( + service, grpc_objective_c_generator::MessageHeaderName(file)); std::unique_ptr header_output( context->Open(file_name + ".pb.h")); - grpc::protobuf::io::CodedOutputStream header_coded_out(output.get()); + grpc::protobuf::io::CodedOutputStream header_coded_out( + header_output.get()); header_coded_out.WriteRaw(header_code.data(), header_code.size()); // Generate .pb.m grpc::string source_code = grpc_objective_c_generator::GetSource(service); std::unique_ptr source_output( context->Open(file_name + ".pb.m")); - grpc::protobuf::io::CodedOutputStream source_coded_out(output.get()); + grpc::protobuf::io::CodedOutputStream source_coded_out( + source_output.get()); source_coded_out.WriteRaw(source_code.data(), source_code.size()); } -- cgit v1.2.3 From aec96aa2232b3ab7f86bc08a99f82684406edf0b Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 7 Apr 2015 14:32:15 -0700 Subject: Fix server shutdown A previous fix to make close() occur later can cause socket reuse by servers to fail as previous sockets are left asynchronously open. This change: - adds a callback to TCP server shutdown to signal that the server is completely shutdown - wait for that callback before destroying listeners in the server (and before destroying the server) - handles fallout --- src/core/iomgr/tcp_server.h | 4 +- src/core/iomgr/tcp_server_posix.c | 58 ++++++++++++++++++++++----- src/core/security/server_secure_chttp2.c | 4 +- src/core/surface/completion_queue.c | 7 ++++ src/core/surface/completion_queue.h | 2 + src/core/surface/server.c | 44 +++++++++++++++++--- src/core/surface/server.h | 2 + src/core/surface/server_chttp2.c | 4 +- test/core/end2end/tests/cancel_after_invoke.c | 5 ++- test/core/end2end/tests/cancel_test_helpers.h | 5 ++- test/core/iomgr/tcp_server_posix_test.c | 10 ++--- 11 files changed, 117 insertions(+), 28 deletions(-) diff --git a/src/core/iomgr/tcp_server.h b/src/core/iomgr/tcp_server.h index 68ee85c5a7..1e58901a7a 100644 --- a/src/core/iomgr/tcp_server.h +++ b/src/core/iomgr/tcp_server.h @@ -71,6 +71,8 @@ int grpc_tcp_server_add_port(grpc_tcp_server *s, const void *addr, up when grpc_tcp_server_destroy is called. */ int grpc_tcp_server_get_fd(grpc_tcp_server *s, unsigned index); -void grpc_tcp_server_destroy(grpc_tcp_server *server); +void grpc_tcp_server_destroy(grpc_tcp_server *server, + void (*shutdown_done)(void *shutdown_done_arg), + void *shutdown_done_arg); #endif /* GRPC_INTERNAL_CORE_IOMGR_TCP_SERVER_H */ diff --git a/src/core/iomgr/tcp_server_posix.c b/src/core/iomgr/tcp_server_posix.c index 90b7eb451d..482166e2eb 100644 --- a/src/core/iomgr/tcp_server_posix.c +++ b/src/core/iomgr/tcp_server_posix.c @@ -102,12 +102,18 @@ struct grpc_tcp_server { gpr_cv cv; /* active port count: how many ports are actually still listening */ - int active_ports; + size_t active_ports; + /* destroyed port count: how many ports are completely destroyed */ + size_t destroyed_ports; /* all listening ports */ server_port *ports; size_t nports; size_t port_capacity; + + /* shutdown callback */ + void (*shutdown_complete)(void *); + void *shutdown_complete_arg; }; grpc_tcp_server *grpc_tcp_server_create(void) { @@ -115,6 +121,7 @@ grpc_tcp_server *grpc_tcp_server_create(void) { gpr_mu_init(&s->mu); gpr_cv_init(&s->cv); s->active_ports = 0; + s->destroyed_ports = 0; s->cb = NULL; s->cb_arg = NULL; s->ports = gpr_malloc(sizeof(server_port) * INIT_PORT_CAP); @@ -123,29 +130,62 @@ grpc_tcp_server *grpc_tcp_server_create(void) { return s; } -void grpc_tcp_server_destroy(grpc_tcp_server *s) { +static void finish_shutdown(grpc_tcp_server *s) { + s->shutdown_complete(s->shutdown_complete_arg); + + gpr_mu_destroy(&s->mu); + gpr_cv_destroy(&s->cv); + + gpr_free(s->ports); + gpr_free(s); +} + +static void destroyed_port(void *server, int success) { + grpc_tcp_server *s = server; + gpr_mu_lock(&s->mu); + s->destroyed_ports++; + if (s->destroyed_ports == s->nports) { + gpr_mu_unlock(&s->mu); + finish_shutdown(s); + } else { + gpr_mu_unlock(&s->mu); + } +} + +static void dont_care_about_shutdown_completion(void *ignored) {} + +void grpc_tcp_server_destroy(grpc_tcp_server *s, + void (*shutdown_complete)(void *shutdown_complete_arg), + void *shutdown_complete_arg) { size_t i; gpr_mu_lock(&s->mu); + + s->shutdown_complete = shutdown_complete ? shutdown_complete : dont_care_about_shutdown_completion; + s->shutdown_complete_arg = shutdown_complete_arg; + /* shutdown all fd's */ for (i = 0; i < s->nports; i++) { grpc_fd_shutdown(s->ports[i].emfd); } /* wait while that happens */ + /* TODO(ctiller): make this asynchronous also */ while (s->active_ports) { gpr_cv_wait(&s->cv, &s->mu, gpr_inf_future); } gpr_mu_unlock(&s->mu); /* delete ALL the things */ - for (i = 0; i < s->nports; i++) { - server_port *sp = &s->ports[i]; - if (sp->addr.sockaddr.sa_family == AF_UNIX) { - unlink_if_unix_domain_socket(&sp->addr.un); + if (s->nports) { + for (i = 0; i < s->nports; i++) { + server_port *sp = &s->ports[i]; + if (sp->addr.sockaddr.sa_family == AF_UNIX) { + unlink_if_unix_domain_socket(&sp->addr.un); + } + grpc_fd_orphan(sp->emfd, destroyed_port, s); } - grpc_fd_orphan(sp->emfd, NULL, NULL); + } else { + finish_shutdown(s); } - gpr_free(s->ports); - gpr_free(s); } /* get max listen queue size on linux */ diff --git a/src/core/security/server_secure_chttp2.c b/src/core/security/server_secure_chttp2.c index c155b80b7e..d5b3a82b87 100644 --- a/src/core/security/server_secure_chttp2.c +++ b/src/core/security/server_secure_chttp2.c @@ -120,7 +120,7 @@ static void destroy(grpc_server *server, void *statep) { grpc_server_secure_state *state = statep; gpr_mu_lock(&state->mu); state->is_shutdown = 1; - grpc_tcp_server_destroy(state->tcp); + grpc_tcp_server_destroy(state->tcp, grpc_server_listener_destroy_done, server); gpr_mu_unlock(&state->mu); state_unref(state); } @@ -213,7 +213,7 @@ error: grpc_resolved_addresses_destroy(resolved); } if (tcp) { - grpc_tcp_server_destroy(tcp); + grpc_tcp_server_destroy(tcp, NULL, NULL); } if (state) { gpr_free(state); diff --git a/src/core/surface/completion_queue.c b/src/core/surface/completion_queue.c index 6a1d83ce5d..b08bd93693 100644 --- a/src/core/surface/completion_queue.c +++ b/src/core/surface/completion_queue.c @@ -432,3 +432,10 @@ void grpc_cq_dump_pending_ops(grpc_completion_queue *cc) { grpc_pollset *grpc_cq_pollset(grpc_completion_queue *cc) { return &cc->pollset; } + +void grpc_cq_hack_spin_pollset(grpc_completion_queue *cc) { + gpr_mu_lock(GRPC_POLLSET_MU(&cc->pollset)); + grpc_pollset_kick(&cc->pollset); + grpc_pollset_work(&cc->pollset, gpr_time_add(gpr_now(), gpr_time_from_millis(100))); + gpr_mu_unlock(GRPC_POLLSET_MU(&cc->pollset)); +} diff --git a/src/core/surface/completion_queue.h b/src/core/surface/completion_queue.h index 3054264cad..3e9e2d186e 100644 --- a/src/core/surface/completion_queue.h +++ b/src/core/surface/completion_queue.h @@ -114,4 +114,6 @@ void grpc_cq_dump_pending_ops(grpc_completion_queue *cc); grpc_pollset *grpc_cq_pollset(grpc_completion_queue *cc); +void grpc_cq_hack_spin_pollset(grpc_completion_queue *cc); + #endif /* GRPC_INTERNAL_CORE_SURFACE_COMPLETION_QUEUE_H */ diff --git a/src/core/surface/server.c b/src/core/surface/server.c index 424734c54c..2e013ea742 100644 --- a/src/core/surface/server.c +++ b/src/core/surface/server.c @@ -137,6 +137,7 @@ struct grpc_server { size_t cq_count; gpr_mu mu; + gpr_cv cv; registered_method *registered_methods; requested_call_array requested_calls; @@ -149,6 +150,7 @@ struct grpc_server { channel_data root_channel_data; listener *listeners; + int listeners_destroyed; gpr_refcount internal_refcount; }; @@ -263,6 +265,7 @@ static void server_unref(grpc_server *server) { if (gpr_unref(&server->internal_refcount)) { grpc_channel_args_destroy(server->channel_args); gpr_mu_destroy(&server->mu); + gpr_cv_destroy(&server->cv); gpr_free(server->channel_filters); requested_call_array_destroy(&server->requested_calls); while ((rm = server->registered_methods) != NULL) { @@ -620,6 +623,7 @@ grpc_server *grpc_server_create_from_filters(grpc_completion_queue *cq, if (cq) addcq(server, cq); gpr_mu_init(&server->mu); + gpr_cv_init(&server->cv); server->unregistered_cq = cq; /* decremented by grpc_server_destroy */ @@ -781,6 +785,15 @@ grpc_transport_setup_result grpc_server_setup_transport( return result; } +static int num_listeners(grpc_server *server) { + listener *l; + int n = 0; + for (l = server->listeners; l; l = l->next) { + n++; + } + return n; +} + static void shutdown_internal(grpc_server *server, gpr_uint8 have_shutdown_tag, void *shutdown_tag) { listener *l; @@ -878,11 +891,6 @@ static void shutdown_internal(grpc_server *server, gpr_uint8 have_shutdown_tag, for (l = server->listeners; l; l = l->next) { l->destroy(server, l->arg); } - while (server->listeners) { - l = server->listeners; - server->listeners = l->next; - gpr_free(l); - } } void grpc_server_shutdown(grpc_server *server) { @@ -893,8 +901,18 @@ void grpc_server_shutdown_and_notify(grpc_server *server, void *tag) { shutdown_internal(server, 1, tag); } +void grpc_server_listener_destroy_done(void *s) { + grpc_server *server = s; + gpr_mu_lock(&server->mu); + server->listeners_destroyed++; + gpr_cv_signal(&server->cv); + gpr_mu_unlock(&server->mu); +} + void grpc_server_destroy(grpc_server *server) { channel_data *c; + listener *l; + size_t i; gpr_mu_lock(&server->mu); if (!server->shutdown) { gpr_mu_unlock(&server->mu); @@ -902,6 +920,22 @@ void grpc_server_destroy(grpc_server *server) { gpr_mu_lock(&server->mu); } + while (server->listeners_destroyed != num_listeners(server)) { + for (i = 0; i < server->cq_count; i++) { + gpr_mu_unlock(&server->mu); + grpc_cq_hack_spin_pollset(server->cqs[i]); + gpr_mu_lock(&server->mu); + } + + gpr_cv_wait(&server->cv, &server->mu, gpr_time_add(gpr_now(), gpr_time_from_millis(100))); + } + + while (server->listeners) { + l = server->listeners; + server->listeners = l->next; + gpr_free(l); + } + for (c = server->root_channel_data.next; c != &server->root_channel_data; c = c->next) { shutdown_channel(c); diff --git a/src/core/surface/server.h b/src/core/surface/server.h index e33f69b8c7..548a16c6c9 100644 --- a/src/core/surface/server.h +++ b/src/core/surface/server.h @@ -51,6 +51,8 @@ void grpc_server_add_listener(grpc_server *server, void *listener, grpc_pollset **pollsets, size_t npollsets), void (*destroy)(grpc_server *server, void *arg)); +void grpc_server_listener_destroy_done(void *server); + /* Setup a transport - creates a channel stack, binds the transport to the server */ grpc_transport_setup_result grpc_server_setup_transport( diff --git a/src/core/surface/server_chttp2.c b/src/core/surface/server_chttp2.c index 27434b39e2..9a23125752 100644 --- a/src/core/surface/server_chttp2.c +++ b/src/core/surface/server_chttp2.c @@ -75,7 +75,7 @@ static void start(grpc_server *server, void *tcpp, grpc_pollset **pollsets, size callbacks) */ static void destroy(grpc_server *server, void *tcpp) { grpc_tcp_server *tcp = tcpp; - grpc_tcp_server_destroy(tcp); + grpc_tcp_server_destroy(tcp, grpc_server_listener_destroy_done, server); } int grpc_server_add_http2_port(grpc_server *server, const char *addr) { @@ -131,7 +131,7 @@ error: grpc_resolved_addresses_destroy(resolved); } if (tcp) { - grpc_tcp_server_destroy(tcp); + grpc_tcp_server_destroy(tcp, NULL, NULL); } return 0; } diff --git a/test/core/end2end/tests/cancel_after_invoke.c b/test/core/end2end/tests/cancel_after_invoke.c index e15fa7fcd9..326321f4e2 100644 --- a/test/core/end2end/tests/cancel_after_invoke.c +++ b/test/core/end2end/tests/cancel_after_invoke.c @@ -51,10 +51,11 @@ static void *tag(gpr_intptr t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char *test_name, + cancellation_mode mode, 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); + gpr_log(GPR_INFO, "%s/%s/%s", test_name, config.name, mode.name); f = config.create_fixture(client_args, server_args); config.init_client(&f, client_args); config.init_server(&f, server_args); @@ -109,7 +110,7 @@ static void test_cancel_after_invoke(grpc_end2end_test_config config, grpc_op ops[6]; grpc_op *op; grpc_call *c; - grpc_end2end_test_fixture f = begin_test(config, __FUNCTION__, NULL, NULL); + grpc_end2end_test_fixture f = begin_test(config, __FUNCTION__, mode, NULL, NULL); gpr_timespec deadline = five_seconds_time(); cq_verifier *v_client = cq_verifier_create(f.client_cq); grpc_metadata_array initial_metadata_recv; diff --git a/test/core/end2end/tests/cancel_test_helpers.h b/test/core/end2end/tests/cancel_test_helpers.h index f2581dc32f..3d92b64ae4 100644 --- a/test/core/end2end/tests/cancel_test_helpers.h +++ b/test/core/end2end/tests/cancel_test_helpers.h @@ -35,6 +35,7 @@ #define GRPC_TEST_CORE_END2END_TESTS_CANCEL_TEST_HELPERS_H typedef struct { + const char *name; grpc_call_error (*initiate_cancel)(grpc_call *call); grpc_status_code expect_status; const char *expect_details; @@ -45,7 +46,7 @@ static grpc_call_error wait_for_deadline(grpc_call *call) { } static const cancellation_mode cancellation_modes[] = { - {grpc_call_cancel, GRPC_STATUS_CANCELLED, ""}, - {wait_for_deadline, GRPC_STATUS_DEADLINE_EXCEEDED, "Deadline Exceeded"}, }; + {"cancel", grpc_call_cancel, GRPC_STATUS_CANCELLED, ""}, + {"deadline", wait_for_deadline, GRPC_STATUS_DEADLINE_EXCEEDED, "Deadline Exceeded"}, }; #endif /* GRPC_TEST_CORE_END2END_TESTS_CANCEL_TEST_HELPERS_H */ diff --git a/test/core/iomgr/tcp_server_posix_test.c b/test/core/iomgr/tcp_server_posix_test.c index 2689c3f38e..6b80ee1ee8 100644 --- a/test/core/iomgr/tcp_server_posix_test.c +++ b/test/core/iomgr/tcp_server_posix_test.c @@ -60,14 +60,14 @@ static void on_connect(void *arg, grpc_endpoint *tcp) { static void test_no_op(void) { grpc_tcp_server *s = grpc_tcp_server_create(); - grpc_tcp_server_destroy(s); + grpc_tcp_server_destroy(s, NULL, NULL); } static void test_no_op_with_start(void) { grpc_tcp_server *s = grpc_tcp_server_create(); LOG_TEST(); grpc_tcp_server_start(s, NULL, 0, on_connect, NULL); - grpc_tcp_server_destroy(s); + grpc_tcp_server_destroy(s, NULL, NULL); } static void test_no_op_with_port(void) { @@ -80,7 +80,7 @@ static void test_no_op_with_port(void) { GPR_ASSERT( grpc_tcp_server_add_port(s, (struct sockaddr *)&addr, sizeof(addr))); - grpc_tcp_server_destroy(s); + grpc_tcp_server_destroy(s, NULL, NULL); } static void test_no_op_with_port_and_start(void) { @@ -95,7 +95,7 @@ static void test_no_op_with_port_and_start(void) { grpc_tcp_server_start(s, NULL, 0, on_connect, NULL); - grpc_tcp_server_destroy(s); + grpc_tcp_server_destroy(s, NULL, NULL); } static void test_connect(int n) { @@ -144,7 +144,7 @@ static void test_connect(int n) { gpr_mu_unlock(&mu); - grpc_tcp_server_destroy(s); + grpc_tcp_server_destroy(s, NULL, NULL); } int main(int argc, char **argv) { -- cgit v1.2.3 From 6d97916b16f21c9b5a379ce5ddd35d30956f0304 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 7 Apr 2015 16:13:13 -0700 Subject: Update Windows build for interface changes --- src/core/iomgr/tcp_server_windows.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core/iomgr/tcp_server_windows.c b/src/core/iomgr/tcp_server_windows.c index 0c3ab1dc91..896c9e5d08 100644 --- a/src/core/iomgr/tcp_server_windows.c +++ b/src/core/iomgr/tcp_server_windows.c @@ -92,7 +92,9 @@ grpc_tcp_server *grpc_tcp_server_create(void) { return s; } -void grpc_tcp_server_destroy(grpc_tcp_server *s) { +void grpc_tcp_server_destroy(grpc_tcp_server *s, + void(*shutdown_done)(void *shutdown_done_arg), + void *shutdown_done_arg) { size_t i; gpr_mu_lock(&s->mu); /* shutdown all fd's */ @@ -112,6 +114,10 @@ void grpc_tcp_server_destroy(grpc_tcp_server *s) { } gpr_free(s->ports); gpr_free(s); + + if (shutdown_done) { + shutdown_done(shutdown_done_arg); + } } /* Prepare a recently-created socket for listening. */ -- cgit v1.2.3 From c02c1d883a08a2b6a646e7d736028c48baac3026 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 7 Apr 2015 16:21:55 -0700 Subject: clang-format --- src/core/iomgr/tcp_server.h | 6 ++--- src/core/iomgr/tcp_server_posix.c | 10 ++++---- src/core/iomgr/tcp_server_windows.c | 34 +++++++++++++-------------- src/core/security/server_secure_chttp2.c | 17 ++++++++------ src/core/surface/completion_queue.c | 3 ++- src/core/surface/completion_queue.h | 2 +- src/core/surface/server.c | 13 +++++----- src/core/surface/server.h | 5 ++-- src/core/surface/server_chttp2.c | 3 ++- test/core/end2end/tests/cancel_after_invoke.c | 3 ++- test/core/end2end/tests/cancel_test_helpers.h | 6 +++-- 11 files changed, 56 insertions(+), 46 deletions(-) diff --git a/src/core/iomgr/tcp_server.h b/src/core/iomgr/tcp_server.h index 1e58901a7a..66bb3ef701 100644 --- a/src/core/iomgr/tcp_server.h +++ b/src/core/iomgr/tcp_server.h @@ -71,8 +71,8 @@ int grpc_tcp_server_add_port(grpc_tcp_server *s, const void *addr, up when grpc_tcp_server_destroy is called. */ int grpc_tcp_server_get_fd(grpc_tcp_server *s, unsigned index); -void grpc_tcp_server_destroy(grpc_tcp_server *server, - void (*shutdown_done)(void *shutdown_done_arg), +void grpc_tcp_server_destroy(grpc_tcp_server *server, + void (*shutdown_done)(void *shutdown_done_arg), void *shutdown_done_arg); -#endif /* GRPC_INTERNAL_CORE_IOMGR_TCP_SERVER_H */ +#endif /* GRPC_INTERNAL_CORE_IOMGR_TCP_SERVER_H */ diff --git a/src/core/iomgr/tcp_server_posix.c b/src/core/iomgr/tcp_server_posix.c index 482166e2eb..895f85fc68 100644 --- a/src/core/iomgr/tcp_server_posix.c +++ b/src/core/iomgr/tcp_server_posix.c @@ -154,13 +154,15 @@ static void destroyed_port(void *server, int success) { static void dont_care_about_shutdown_completion(void *ignored) {} -void grpc_tcp_server_destroy(grpc_tcp_server *s, - void (*shutdown_complete)(void *shutdown_complete_arg), - void *shutdown_complete_arg) { +void grpc_tcp_server_destroy( + grpc_tcp_server *s, void (*shutdown_complete)(void *shutdown_complete_arg), + void *shutdown_complete_arg) { size_t i; gpr_mu_lock(&s->mu); - s->shutdown_complete = shutdown_complete ? shutdown_complete : dont_care_about_shutdown_completion; + s->shutdown_complete = shutdown_complete + ? shutdown_complete + : dont_care_about_shutdown_completion; s->shutdown_complete_arg = shutdown_complete_arg; /* shutdown all fd's */ diff --git a/src/core/iomgr/tcp_server_windows.c b/src/core/iomgr/tcp_server_windows.c index 896c9e5d08..a43d5670a4 100644 --- a/src/core/iomgr/tcp_server_windows.c +++ b/src/core/iomgr/tcp_server_windows.c @@ -93,8 +93,8 @@ grpc_tcp_server *grpc_tcp_server_create(void) { } void grpc_tcp_server_destroy(grpc_tcp_server *s, - void(*shutdown_done)(void *shutdown_done_arg), - void *shutdown_done_arg) { + void (*shutdown_done)(void *shutdown_done_arg), + void *shutdown_done_arg) { size_t i; gpr_mu_lock(&s->mu); /* shutdown all fd's */ @@ -116,13 +116,13 @@ void grpc_tcp_server_destroy(grpc_tcp_server *s, gpr_free(s); if (shutdown_done) { - shutdown_done(shutdown_done_arg); + shutdown_done(shutdown_done_arg); } } /* Prepare a recently-created socket for listening. */ -static int prepare_socket(SOCKET sock, - const struct sockaddr *addr, int addr_len) { +static int prepare_socket(SOCKET sock, const struct sockaddr *addr, + int addr_len) { struct sockaddr_storage sockname_temp; socklen_t sockname_len; @@ -153,15 +153,15 @@ static int prepare_socket(SOCKET sock, } sockname_len = sizeof(sockname_temp); - if (getsockname(sock, (struct sockaddr *) &sockname_temp, &sockname_len) - == SOCKET_ERROR) { + if (getsockname(sock, (struct sockaddr *)&sockname_temp, &sockname_len) == + SOCKET_ERROR) { char *utf8_message = gpr_format_message(WSAGetLastError()); gpr_log(GPR_ERROR, "getsockname: %s", utf8_message); gpr_free(utf8_message); goto error; } - return grpc_sockaddr_get_port((struct sockaddr *) &sockname_temp); + return grpc_sockaddr_get_port((struct sockaddr *)&sockname_temp); error: if (sock != INVALID_SOCKET) closesocket(sock); @@ -227,8 +227,7 @@ static void on_accept(void *arg, int success) { DWORD transfered_bytes = 0; DWORD flags; BOOL wsa_success = WSAGetOverlappedResult(sock, &info->overlapped, - &transfered_bytes, FALSE, - &flags); + &transfered_bytes, FALSE, &flags); if (!wsa_success) { char *utf8_message = gpr_format_message(WSAGetLastError()); gpr_log(GPR_ERROR, "on_accept error: %s", utf8_message); @@ -263,9 +262,9 @@ static int add_socket_to_server(grpc_tcp_server *s, SOCKET sock, if (sock == INVALID_SOCKET) return -1; - status = WSAIoctl(sock, SIO_GET_EXTENSION_FUNCTION_POINTER, - &guid, sizeof(guid), &AcceptEx, sizeof(AcceptEx), - &ioctl_num_bytes, NULL, NULL); + status = + WSAIoctl(sock, SIO_GET_EXTENSION_FUNCTION_POINTER, &guid, sizeof(guid), + &AcceptEx, sizeof(AcceptEx), &ioctl_num_bytes, NULL, NULL); if (status != 0) { char *utf8_message = gpr_format_message(WSAGetLastError()); @@ -313,9 +312,8 @@ int grpc_tcp_server_add_port(grpc_tcp_server *s, const void *addr, for (i = 0; i < s->nports; i++) { sockname_len = sizeof(sockname_temp); if (0 == getsockname(s->ports[i].socket->socket, - (struct sockaddr *) &sockname_temp, - &sockname_len)) { - port = grpc_sockaddr_get_port((struct sockaddr *) &sockname_temp); + (struct sockaddr *)&sockname_temp, &sockname_len)) { + port = grpc_sockaddr_get_port((struct sockaddr *)&sockname_temp); if (port > 0) { allocated_addr = malloc(addr_len); memcpy(allocated_addr, addr, addr_len); @@ -336,7 +334,7 @@ int grpc_tcp_server_add_port(grpc_tcp_server *s, const void *addr, if (grpc_sockaddr_is_wildcard(addr, &port)) { grpc_sockaddr_make_wildcard6(port, &wildcard); - addr = (struct sockaddr *) &wildcard; + addr = (struct sockaddr *)&wildcard; addr_len = sizeof(wildcard); } @@ -375,4 +373,4 @@ void grpc_tcp_server_start(grpc_tcp_server *s, grpc_pollset **pollset, gpr_mu_unlock(&s->mu); } -#endif /* GPR_WINSOCK_SOCKET */ +#endif /* GPR_WINSOCK_SOCKET */ diff --git a/src/core/security/server_secure_chttp2.c b/src/core/security/server_secure_chttp2.c index d5b3a82b87..081272724c 100644 --- a/src/core/security/server_secure_chttp2.c +++ b/src/core/security/server_secure_chttp2.c @@ -85,10 +85,10 @@ static void on_secure_transport_setup_done(void *statep, if (status == GRPC_SECURITY_OK) { gpr_mu_lock(&state->mu); if (!state->is_shutdown) { - grpc_create_chttp2_transport( - setup_transport, state->server, - grpc_server_get_channel_args(state->server), - secure_endpoint, NULL, 0, grpc_mdctx_create(), 0); + grpc_create_chttp2_transport(setup_transport, state->server, + grpc_server_get_channel_args(state->server), + secure_endpoint, NULL, 0, + grpc_mdctx_create(), 0); } else { /* We need to consume this here, because the server may already have gone * away. */ @@ -104,7 +104,8 @@ static void on_secure_transport_setup_done(void *statep, static void on_accept(void *statep, grpc_endpoint *tcp) { grpc_server_secure_state *state = statep; state_ref(state); - grpc_setup_secure_transport(state->ctx, tcp, on_secure_transport_setup_done, state); + grpc_setup_secure_transport(state->ctx, tcp, on_secure_transport_setup_done, + state); } /* Server callback: start listening on our ports */ @@ -120,12 +121,14 @@ static void destroy(grpc_server *server, void *statep) { grpc_server_secure_state *state = statep; gpr_mu_lock(&state->mu); state->is_shutdown = 1; - grpc_tcp_server_destroy(state->tcp, grpc_server_listener_destroy_done, server); + grpc_tcp_server_destroy(state->tcp, grpc_server_listener_destroy_done, + server); gpr_mu_unlock(&state->mu); state_unref(state); } -int grpc_server_add_secure_http2_port(grpc_server *server, const char *addr, grpc_server_credentials *creds) { +int grpc_server_add_secure_http2_port(grpc_server *server, const char *addr, + grpc_server_credentials *creds) { grpc_resolved_addresses *resolved = NULL; grpc_tcp_server *tcp = NULL; grpc_server_secure_state *state = NULL; diff --git a/src/core/surface/completion_queue.c b/src/core/surface/completion_queue.c index b08bd93693..24f4a05071 100644 --- a/src/core/surface/completion_queue.c +++ b/src/core/surface/completion_queue.c @@ -436,6 +436,7 @@ grpc_pollset *grpc_cq_pollset(grpc_completion_queue *cc) { void grpc_cq_hack_spin_pollset(grpc_completion_queue *cc) { gpr_mu_lock(GRPC_POLLSET_MU(&cc->pollset)); grpc_pollset_kick(&cc->pollset); - grpc_pollset_work(&cc->pollset, gpr_time_add(gpr_now(), gpr_time_from_millis(100))); + grpc_pollset_work(&cc->pollset, + gpr_time_add(gpr_now(), gpr_time_from_millis(100))); gpr_mu_unlock(GRPC_POLLSET_MU(&cc->pollset)); } diff --git a/src/core/surface/completion_queue.h b/src/core/surface/completion_queue.h index 3e9e2d186e..3a7cc99dda 100644 --- a/src/core/surface/completion_queue.h +++ b/src/core/surface/completion_queue.h @@ -116,4 +116,4 @@ grpc_pollset *grpc_cq_pollset(grpc_completion_queue *cc); void grpc_cq_hack_spin_pollset(grpc_completion_queue *cc); -#endif /* GRPC_INTERNAL_CORE_SURFACE_COMPLETION_QUEUE_H */ +#endif /* GRPC_INTERNAL_CORE_SURFACE_COMPLETION_QUEUE_H */ diff --git a/src/core/surface/server.c b/src/core/surface/server.c index 2e013ea742..17cba9a505 100644 --- a/src/core/surface/server.c +++ b/src/core/surface/server.c @@ -592,9 +592,8 @@ static void destroy_channel_elem(grpc_channel_element *elem) { } static const grpc_channel_filter server_surface_filter = { - call_op, channel_op, sizeof(call_data), - init_call_elem, destroy_call_elem, sizeof(channel_data), - init_channel_elem, destroy_channel_elem, "server", + call_op, channel_op, sizeof(call_data), init_call_elem, destroy_call_elem, + sizeof(channel_data), init_channel_elem, destroy_channel_elem, "server", }; static void addcq(grpc_server *server, grpc_completion_queue *cq) { @@ -737,7 +736,8 @@ grpc_transport_setup_result grpc_server_setup_transport( channel = grpc_channel_create_from_filters(filters, num_filters, s->channel_args, mdctx, 0); chand = (channel_data *)grpc_channel_stack_element( - grpc_channel_get_channel_stack(channel), 0)->channel_data; + grpc_channel_get_channel_stack(channel), 0) + ->channel_data; chand->server = s; server_ref(s); chand->channel = channel; @@ -758,7 +758,7 @@ grpc_transport_setup_result grpc_server_setup_transport( method = grpc_mdstr_from_string(mdctx, rm->method); hash = GRPC_MDSTR_KV_HASH(host ? host->hash : 0, method->hash); for (probes = 0; chand->registered_methods[(hash + probes) % slots] - .server_registered_method != NULL; + .server_registered_method != NULL; probes++) ; if (probes > max_probes) max_probes = probes; @@ -927,7 +927,8 @@ void grpc_server_destroy(grpc_server *server) { gpr_mu_lock(&server->mu); } - gpr_cv_wait(&server->cv, &server->mu, gpr_time_add(gpr_now(), gpr_time_from_millis(100))); + gpr_cv_wait(&server->cv, &server->mu, + gpr_time_add(gpr_now(), gpr_time_from_millis(100))); } while (server->listeners) { diff --git a/src/core/surface/server.h b/src/core/surface/server.h index 548a16c6c9..2cfa38fa43 100644 --- a/src/core/surface/server.h +++ b/src/core/surface/server.h @@ -48,7 +48,8 @@ grpc_server *grpc_server_create_from_filters(grpc_completion_queue *cq, and when it shuts down, it will call destroy */ void grpc_server_add_listener(grpc_server *server, void *listener, void (*start)(grpc_server *server, void *arg, - grpc_pollset **pollsets, size_t npollsets), + grpc_pollset **pollsets, + size_t npollsets), void (*destroy)(grpc_server *server, void *arg)); void grpc_server_listener_destroy_done(void *server); @@ -62,4 +63,4 @@ grpc_transport_setup_result grpc_server_setup_transport( const grpc_channel_args *grpc_server_get_channel_args(grpc_server *server); -#endif /* GRPC_INTERNAL_CORE_SURFACE_SERVER_H */ +#endif /* GRPC_INTERNAL_CORE_SURFACE_SERVER_H */ diff --git a/src/core/surface/server_chttp2.c b/src/core/surface/server_chttp2.c index 9a23125752..f3b9219f8b 100644 --- a/src/core/surface/server_chttp2.c +++ b/src/core/surface/server_chttp2.c @@ -66,7 +66,8 @@ static void new_transport(void *server, grpc_endpoint *tcp) { } /* Server callback: start listening on our ports */ -static void start(grpc_server *server, void *tcpp, grpc_pollset **pollsets, size_t pollset_count) { +static void start(grpc_server *server, void *tcpp, grpc_pollset **pollsets, + size_t pollset_count) { grpc_tcp_server *tcp = tcpp; grpc_tcp_server_start(tcp, pollsets, pollset_count, new_transport, server); } diff --git a/test/core/end2end/tests/cancel_after_invoke.c b/test/core/end2end/tests/cancel_after_invoke.c index 326321f4e2..592dfd415f 100644 --- a/test/core/end2end/tests/cancel_after_invoke.c +++ b/test/core/end2end/tests/cancel_after_invoke.c @@ -110,7 +110,8 @@ static void test_cancel_after_invoke(grpc_end2end_test_config config, grpc_op ops[6]; grpc_op *op; grpc_call *c; - grpc_end2end_test_fixture f = begin_test(config, __FUNCTION__, mode, NULL, NULL); + grpc_end2end_test_fixture f = + begin_test(config, __FUNCTION__, mode, NULL, NULL); gpr_timespec deadline = five_seconds_time(); cq_verifier *v_client = cq_verifier_create(f.client_cq); grpc_metadata_array initial_metadata_recv; diff --git a/test/core/end2end/tests/cancel_test_helpers.h b/test/core/end2end/tests/cancel_test_helpers.h index 3d92b64ae4..0d680fcfe1 100644 --- a/test/core/end2end/tests/cancel_test_helpers.h +++ b/test/core/end2end/tests/cancel_test_helpers.h @@ -47,6 +47,8 @@ static grpc_call_error wait_for_deadline(grpc_call *call) { static const cancellation_mode cancellation_modes[] = { {"cancel", grpc_call_cancel, GRPC_STATUS_CANCELLED, ""}, - {"deadline", wait_for_deadline, GRPC_STATUS_DEADLINE_EXCEEDED, "Deadline Exceeded"}, }; + {"deadline", wait_for_deadline, GRPC_STATUS_DEADLINE_EXCEEDED, + "Deadline Exceeded"}, +}; -#endif /* GRPC_TEST_CORE_END2END_TESTS_CANCEL_TEST_HELPERS_H */ +#endif /* GRPC_TEST_CORE_END2END_TESTS_CANCEL_TEST_HELPERS_H */ -- cgit v1.2.3 From d1be74ff5687090186efe9390697beb61df777f1 Mon Sep 17 00:00:00 2001 From: Masood Malekghassemi Date: Tue, 7 Apr 2015 16:23:09 -0700 Subject: Enable dylib installation on MacOS Enables the installation of dylibs to the MacOS prefix, and ensures that the install name of the dylibs are just their file names rather than their relative paths from project root when built. --- Makefile | 24 ++++++++++++------------ templates/Makefile.template | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 753bbfb401..903e497b77 100644 --- a/Makefile +++ b/Makefile @@ -2162,10 +2162,10 @@ ifeq ($(SYSTEM),MINGW32) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/gpr.$(SHARED_EXT) $(prefix)/lib/gpr.$(SHARED_EXT) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgpr-imp.a $(prefix)/lib/libgpr-imp.a else -ifneq ($(SYSTEM),Darwin) $(E) "[INSTALL] Installing libgpr.$(SHARED_EXT)" $(Q) $(INSTALL) -d $(prefix)/lib $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgpr.$(SHARED_EXT) $(prefix)/lib/libgpr.$(SHARED_EXT) +ifneq ($(SYSTEM),Darwin) $(Q) ln -sf libgpr.$(SHARED_EXT) $(prefix)/lib/libgpr.so endif endif @@ -2175,10 +2175,10 @@ ifeq ($(SYSTEM),MINGW32) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/grpc.$(SHARED_EXT) $(prefix)/lib/grpc.$(SHARED_EXT) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc-imp.a $(prefix)/lib/libgrpc-imp.a else -ifneq ($(SYSTEM),Darwin) $(E) "[INSTALL] Installing libgrpc.$(SHARED_EXT)" $(Q) $(INSTALL) -d $(prefix)/lib $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc.$(SHARED_EXT) $(prefix)/lib/libgrpc.$(SHARED_EXT) +ifneq ($(SYSTEM),Darwin) $(Q) ln -sf libgrpc.$(SHARED_EXT) $(prefix)/lib/libgrpc.so endif endif @@ -2188,10 +2188,10 @@ ifeq ($(SYSTEM),MINGW32) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/grpc_unsecure.$(SHARED_EXT) $(prefix)/lib/grpc_unsecure.$(SHARED_EXT) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure-imp.a $(prefix)/lib/libgrpc_unsecure-imp.a else -ifneq ($(SYSTEM),Darwin) $(E) "[INSTALL] Installing libgrpc_unsecure.$(SHARED_EXT)" $(Q) $(INSTALL) -d $(prefix)/lib $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.$(SHARED_EXT) $(prefix)/lib/libgrpc_unsecure.$(SHARED_EXT) +ifneq ($(SYSTEM),Darwin) $(Q) ln -sf libgrpc_unsecure.$(SHARED_EXT) $(prefix)/lib/libgrpc_unsecure.so endif endif @@ -2209,10 +2209,10 @@ ifeq ($(SYSTEM),MINGW32) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/grpc++.$(SHARED_EXT) $(prefix)/lib/grpc++.$(SHARED_EXT) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++-imp.a $(prefix)/lib/libgrpc++-imp.a else -ifneq ($(SYSTEM),Darwin) $(E) "[INSTALL] Installing libgrpc++.$(SHARED_EXT)" $(Q) $(INSTALL) -d $(prefix)/lib $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++.$(SHARED_EXT) $(prefix)/lib/libgrpc++.$(SHARED_EXT) +ifneq ($(SYSTEM),Darwin) $(Q) ln -sf libgrpc++.$(SHARED_EXT) $(prefix)/lib/libgrpc++.so endif endif @@ -2222,10 +2222,10 @@ ifeq ($(SYSTEM),MINGW32) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/grpc++_unsecure.$(SHARED_EXT) $(prefix)/lib/grpc++_unsecure.$(SHARED_EXT) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure-imp.a $(prefix)/lib/libgrpc++_unsecure-imp.a else -ifneq ($(SYSTEM),Darwin) $(E) "[INSTALL] Installing libgrpc++_unsecure.$(SHARED_EXT)" $(Q) $(INSTALL) -d $(prefix)/lib $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.$(SHARED_EXT) $(prefix)/lib/libgrpc++_unsecure.$(SHARED_EXT) +ifneq ($(SYSTEM),Darwin) $(Q) ln -sf libgrpc++_unsecure.$(SHARED_EXT) $(prefix)/lib/libgrpc++_unsecure.so endif endif @@ -2243,10 +2243,10 @@ ifeq ($(SYSTEM),MINGW32) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/grpc_csharp_ext.$(SHARED_EXT) $(prefix)/lib/grpc_csharp_ext.$(SHARED_EXT) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext-imp.a $(prefix)/lib/libgrpc_csharp_ext-imp.a else -ifneq ($(SYSTEM),Darwin) $(E) "[INSTALL] Installing libgrpc_csharp_ext.$(SHARED_EXT)" $(Q) $(INSTALL) -d $(prefix)/lib $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext.$(SHARED_EXT) $(prefix)/lib/libgrpc_csharp_ext.$(SHARED_EXT) +ifneq ($(SYSTEM),Darwin) $(Q) ln -sf libgrpc_csharp_ext.$(SHARED_EXT) $(prefix)/lib/libgrpc_csharp_ext.so endif endif @@ -2387,7 +2387,7 @@ $(LIBDIR)/$(CONFIG)/libgpr.$(SHARED_EXT): $(LIBGPR_OBJS) $(ZLIB_DEP) $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` ifeq ($(SYSTEM),Darwin) - $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgpr.$(SHARED_EXT) $(LIBGPR_OBJS) $(LDLIBS) + $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name libgpr.$(SHARED_EXT) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgpr.$(SHARED_EXT) $(LIBGPR_OBJS) $(LDLIBS) else $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgpr.so.0 -o $(LIBDIR)/$(CONFIG)/libgpr.$(SHARED_EXT) $(LIBGPR_OBJS) $(LDLIBS) $(Q) ln -sf libgpr.$(SHARED_EXT) $(LIBDIR)/$(CONFIG)/libgpr.so.0 @@ -2777,7 +2777,7 @@ $(LIBDIR)/$(CONFIG)/libgrpc.$(SHARED_EXT): $(LIBGRPC_OBJS) $(ZLIB_DEP) $(LIBDIR $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` ifeq ($(SYSTEM),Darwin) - $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc.$(SHARED_EXT) $(LIBGRPC_OBJS) $(LDLIBS) $(LDLIBS_SECURE) $(OPENSSL_MERGE_LIBS) -lgpr + $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name libgrpc.$(SHARED_EXT) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc.$(SHARED_EXT) $(LIBGRPC_OBJS) $(LDLIBS) $(LDLIBS_SECURE) $(OPENSSL_MERGE_LIBS) -lgpr else $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc.so.0 -o $(LIBDIR)/$(CONFIG)/libgrpc.$(SHARED_EXT) $(LIBGRPC_OBJS) $(LDLIBS) $(LDLIBS_SECURE) $(OPENSSL_MERGE_LIBS) -lgpr $(Q) ln -sf libgrpc.$(SHARED_EXT) $(LIBDIR)/$(CONFIG)/libgrpc.so.0 @@ -3117,7 +3117,7 @@ $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.$(SHARED_EXT): $(LIBGRPC_UNSECURE_OBJS) $( $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` ifeq ($(SYSTEM),Darwin) - $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.$(SHARED_EXT) $(LIBGRPC_UNSECURE_OBJS) $(LDLIBS) -lgpr + $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name libgrpc_unsecure.$(SHARED_EXT) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.$(SHARED_EXT) $(LIBGRPC_UNSECURE_OBJS) $(LDLIBS) -lgpr else $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc_unsecure.so.0 -o $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.$(SHARED_EXT) $(LIBGRPC_UNSECURE_OBJS) $(LDLIBS) -lgpr $(Q) ln -sf libgrpc_unsecure.$(SHARED_EXT) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.so.0 @@ -3367,7 +3367,7 @@ $(LIBDIR)/$(CONFIG)/libgrpc++.$(SHARED_EXT): $(LIBGRPC++_OBJS) $(ZLIB_DEP) $(LI $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` ifeq ($(SYSTEM),Darwin) - $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc++.$(SHARED_EXT) $(LIBGRPC++_OBJS) $(LDLIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) -lgpr -lgrpc + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name libgrpc++.$(SHARED_EXT) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc++.$(SHARED_EXT) $(LIBGRPC++_OBJS) $(LDLIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) -lgpr -lgrpc else $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc++.so.0 -o $(LIBDIR)/$(CONFIG)/libgrpc++.$(SHARED_EXT) $(LIBGRPC++_OBJS) $(LDLIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) -lgpr -lgrpc $(Q) ln -sf libgrpc++.$(SHARED_EXT) $(LIBDIR)/$(CONFIG)/libgrpc++.so.0 @@ -3572,7 +3572,7 @@ $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.$(SHARED_EXT): $(LIBGRPC++_UNSECURE_OBJS) $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` ifeq ($(SYSTEM),Darwin) - $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.$(SHARED_EXT) $(LIBGRPC++_UNSECURE_OBJS) $(LDLIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) -lgpr -lgrpc_unsecure + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name libgrpc++_unsecure.$(SHARED_EXT) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.$(SHARED_EXT) $(LIBGRPC++_UNSECURE_OBJS) $(LDLIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) -lgpr -lgrpc_unsecure else $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc++_unsecure.so.0 -o $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.$(SHARED_EXT) $(LIBGRPC++_UNSECURE_OBJS) $(LDLIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) -lgpr -lgrpc_unsecure $(Q) ln -sf libgrpc++_unsecure.$(SHARED_EXT) $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.so.0 @@ -3831,7 +3831,7 @@ $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext.$(SHARED_EXT): $(LIBGRPC_CSHARP_EXT_OBJS) $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` ifeq ($(SYSTEM),Darwin) - $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext.$(SHARED_EXT) $(LIBGRPC_CSHARP_EXT_OBJS) $(LDLIBS) -lgpr -lgrpc + $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name libgrpc_csharp_ext.$(SHARED_EXT) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext.$(SHARED_EXT) $(LIBGRPC_CSHARP_EXT_OBJS) $(LDLIBS) -lgpr -lgrpc else $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc_csharp_ext.so.0 -o $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext.$(SHARED_EXT) $(LIBGRPC_CSHARP_EXT_OBJS) $(LDLIBS) -lgpr -lgrpc $(Q) ln -sf libgrpc_csharp_ext.$(SHARED_EXT) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext.so.0 diff --git a/templates/Makefile.template b/templates/Makefile.template index d6c80a5c14..848ee87bbc 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -926,10 +926,10 @@ ifeq ($(SYSTEM),MINGW32) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/${lib.name}.$(SHARED_EXT) $(prefix)/lib/${lib.name}.$(SHARED_EXT) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}-imp.a $(prefix)/lib/lib${lib.name}-imp.a else -ifneq ($(SYSTEM),Darwin) $(E) "[INSTALL] Installing lib${lib.name}.$(SHARED_EXT)" $(Q) $(INSTALL) -d $(prefix)/lib $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.$(SHARED_EXT) +ifneq ($(SYSTEM),Darwin) $(Q) ln -sf lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.so endif endif @@ -1166,7 +1166,7 @@ ${out_libbase}.$(SHARED_EXT): $(LIB${lib.name.upper()}_OBJS) ${lib_deps} $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` ifeq ($(SYSTEM),Darwin) - $(Q) ${ld} $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -dynamiclib -o ${out_libbase}.$(SHARED_EXT) ${common}${libs} + $(Q) ${ld} $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name lib${lib.name}.$(SHARED_EXT) -dynamiclib -o ${out_libbase}.$(SHARED_EXT) ${common}${libs} else $(Q) ${ld} $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,lib${lib.name}.so.${settings.version.major} -o ${out_libbase}.$(SHARED_EXT) ${common}${libs} $(Q) ln -sf lib${lib.name}.$(SHARED_EXT) ${out_libbase}.so.${settings.version.major} -- cgit v1.2.3 From 1e3361c1616751e7697616e3d2fd904265411703 Mon Sep 17 00:00:00 2001 From: Tim Emiola Date: Tue, 7 Apr 2015 20:22:25 -0700 Subject: Use the local version of the distpackages when build debian files --- tools/distpackages/build_deb_packages.sh | 13 +++++++++++-- tools/dockerfile/grpc_build_deb/Dockerfile | 10 ++++++++-- tools/gce_setup/grpc_docker.sh | 5 +++++ tools/gce_setup/shared_startup_funcs.sh | 6 ++++++ 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/tools/distpackages/build_deb_packages.sh b/tools/distpackages/build_deb_packages.sh index 7dff8e3743..366a5184c8 100755 --- a/tools/distpackages/build_deb_packages.sh +++ b/tools/distpackages/build_deb_packages.sh @@ -30,9 +30,13 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # Where to put resulting .deb packages. +set -x deb_dest="/tmp/deb_out" mkdir -p $deb_dest +# Where the grpc disto is +grpc_root="/var/local/git/grpc" + # Update version from default values if the file /version.txt exists # # - when present, /version.txt will added by the docker build. @@ -71,7 +75,9 @@ do if [ $pkg_name == "libgrpc" ] then # Copy shared libraries - (cd ../..; make install-shared_c prefix=$tmp_dir/$pkg_name/usr/lib) + pushd $grpc_root + make install-shared_c prefix=$tmp_dir/$pkg_name/usr/lib + popd mv $tmp_dir/$pkg_name/usr/lib/lib $arch_lib_dir # non-dev package should contain so.0 symlinks @@ -84,7 +90,10 @@ do if [ $pkg_name == "libgrpc-dev" ] then # Copy headers and static libraries - (cd ../..; make install-headers_c install-static_c prefix=$tmp_dir/$pkg_name/usr/lib) + pushd $grpc_root + make install-headers_c install-static_c prefix=$tmp_dir/$pkg_name/usr/lib + popd + mv $tmp_dir/$pkg_name/usr/lib/include $tmp_dir/$pkg_name/usr/include mv $tmp_dir/$pkg_name/usr/lib/lib $arch_lib_dir diff --git a/tools/dockerfile/grpc_build_deb/Dockerfile b/tools/dockerfile/grpc_build_deb/Dockerfile index cf8da594e9..7f025b6712 100644 --- a/tools/dockerfile/grpc_build_deb/Dockerfile +++ b/tools/dockerfile/grpc_build_deb/Dockerfile @@ -33,8 +33,14 @@ FROM grpc/base # Add the file containing the gRPC version ADD version.txt version.txt +# Add the update-to-date distpackages folder +ADD distpackages distpackages + # Install dependencies -RUN apt-get update && apt-get install -y lintian +RUN echo 'deb http://http.debian.net/debian experimental main contrib non-free' >> /etc/apt/sources.list +RUN apt-get update \ + && apt-get -t experimental install -y openssl=1.0.2-1 \ + && apt-get install -y lintian # Get the source from GitHub RUN git clone https://github.com/grpc/grpc.git /var/local/git/grpc @@ -42,4 +48,4 @@ RUN cd /var/local/git/grpc && \ git pull --recurse-submodules && \ git submodule update --init --recursive -RUN /bin/bash -l -c 'cd /var/local/git/grpc/tools/distpackages && ./build_deb_packages.sh' +RUN /bin/bash -l -c 'cd /distpackages && ./build_deb_packages.sh' diff --git a/tools/gce_setup/grpc_docker.sh b/tools/gce_setup/grpc_docker.sh index 0e82ac1d12..dc480983ff 100755 --- a/tools/gce_setup/grpc_docker.sh +++ b/tools/gce_setup/grpc_docker.sh @@ -747,6 +747,11 @@ grpc_build_debs() { local project_opt="--project $grpc_project" local zone_opt="--zone $grpc_zone" + # Update the remote distpackages_dir + local src_dist_dir='tools/distpackages' + local rmt_dist_dir="$host:~" + gcloud compute copy-files $src_dist_dir $rmt_dist_dir $project_opt $zone_opt || return 1 + # rebuild the build_deb image local label='build_deb' grpc_update_image -- -h $host $label || return 1 diff --git a/tools/gce_setup/shared_startup_funcs.sh b/tools/gce_setup/shared_startup_funcs.sh index e6eecc56db..c4a076757a 100755 --- a/tools/gce_setup/shared_startup_funcs.sh +++ b/tools/gce_setup/shared_startup_funcs.sh @@ -434,6 +434,12 @@ grpc_dockerfile_install() { grpc_docker_sync_service_account $dockerfile_dir/service_account || return 1; } + # For deb builds, copy the distpackages folder into the docker directory so + # that it can be installed using ADD distpackages distpackages. + [[ $image_label == "grpc/build_deb" ]] && { + cp -vR ~/distpackages $dockerfile_dir + } + # TODO(temiola): maybe make cache/no-cache a func option? sudo docker build $cache_opt -t $image_label $dockerfile_dir || { echo "$FUNCNAME:: build of $image_label <- $dockerfile_dir" -- cgit v1.2.3 From 0c62832cc111c2ce6a060f37ffb3e11729124f9f Mon Sep 17 00:00:00 2001 From: Tim Emiola Date: Tue, 7 Apr 2015 19:02:29 -0700 Subject: Updated the version to 0.6.0 --- tools/dockerfile/grpc_build_deb/version.txt | 2 +- tools/dockerfile/grpc_dist_proto/version.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/dockerfile/grpc_build_deb/version.txt b/tools/dockerfile/grpc_build_deb/version.txt index 4b9fcbec10..a918a2aa18 100644 --- a/tools/dockerfile/grpc_build_deb/version.txt +++ b/tools/dockerfile/grpc_build_deb/version.txt @@ -1 +1 @@ -0.5.1 +0.6.0 diff --git a/tools/dockerfile/grpc_dist_proto/version.txt b/tools/dockerfile/grpc_dist_proto/version.txt index 8f0916f768..a918a2aa18 100644 --- a/tools/dockerfile/grpc_dist_proto/version.txt +++ b/tools/dockerfile/grpc_dist_proto/version.txt @@ -1 +1 @@ -0.5.0 +0.6.0 -- cgit v1.2.3 From ded51698fdd55e93080a3a76cb0d7cdf42068a2c Mon Sep 17 00:00:00 2001 From: Tim Emiola Date: Tue, 7 Apr 2015 20:31:57 -0700 Subject: Update the libgrpc debian package to depend on the experimental version of openssl --- tools/distpackages/templates/libgrpc/DEBIAN/control | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/distpackages/templates/libgrpc/DEBIAN/control b/tools/distpackages/templates/libgrpc/DEBIAN/control index 417a825827..5854b1f4a1 100644 --- a/tools/distpackages/templates/libgrpc/DEBIAN/control +++ b/tools/distpackages/templates/libgrpc/DEBIAN/control @@ -2,7 +2,8 @@ Package: libgrpc Version: 0.5.0 Architecture: amd64 Maintainer: Jan Tattermusch -Depends: libc6 +Depends: libc6, openssl (1.0.2-1) +Build-Depends-Indep: openssl (1.0.2-1) Section: libs Priority: optional Homepage: https://github.com/grpc/grpc -- cgit v1.2.3 From 282130923c12532be75c6ec70220b0422e3dfb08 Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Tue, 7 Apr 2015 10:32:55 -0700 Subject: Add interoperability test case descriptions It is a partially manual port from Google Docs to Markdown. The content was not changed in any important way. --- doc/interop-test-descriptions.md | 685 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 685 insertions(+) create mode 100644 doc/interop-test-descriptions.md diff --git a/doc/interop-test-descriptions.md b/doc/interop-test-descriptions.md new file mode 100644 index 0000000000..3f5ce37e1e --- /dev/null +++ b/doc/interop-test-descriptions.md @@ -0,0 +1,685 @@ +Interoperability Test Case Descriptions +======================================= + +Client and server use +[test.proto](https://github.com/grpc/grpc/blob/master/test/cpp/interop/test.proto) +and the [gRPC over HTTP/2 v2 +protocol](https://github.com/grpc/grpc-common/blob/master/PROTOCOL-HTTP2.md). + +Client +------ + +Clients implement test cases that test certain functionally. Each client is +provided the test case it is expected to run as a command-line parameter. Names +should be lowercase and without spaces. + +Clients should accept these arguments: +* --server_host=HOSTNAME + * The server host to connect to. For example, "localhost" or "127.0.0.1" +* --server_host_override=HOSTNAME + * The server host to claim to be connecting to, for use in TLS and HTTP/2 + :authority header. If unspecified, the value of --server_host will be + used +* --server_port=PORT + * The server port to connect to. For example, "8080" +* --test_case=TESTCASE + * The name of the test case to execute. For example, "empty_unary" +* --use_tls=BOOLEAN + * Whether to use a plaintext or encrypted connection +* --use_test_ca=BOOLEAN + * Whether to replace platform root CAs with + [ca.pem](https://github.com/grpc/grpc/blob/master/src/core/tsi/test_creds/ca.pem) + as the CA root + +Clients must support TLS with ALPN. Clients must not disable certificate +checking. + +### empty_unary + +This test verifies that implementations support zero-size messages. Ideally, +client implementations would verify that the request and response were zero +bytes serialized, but this is generally prohibitive to perform, so is not +required. + +Server features: +* [EmptyCall][] + +Procedure: + 1. Client calls EmptyCall with the default Empty message + +Asserts: +* call was successful +* response is non-null + +*It may be possible to use UnaryCall instead of EmptyCall, but it is harder to +ensure that the proto serialized to zero bytes.* + +### large_unary + +This test verifies unary calls succeed in sending messages, and touches on flow +control (even if compression is enabled on the channel). + +Server features: +* [UnaryCall][] +* [Compressable Payload][] + +Procedure: + 1. Client calls UnaryCall with: + + ``` + { + response_type: COMPRESSABLE + response_size: 314159 + payload:{ + body: 271828 bytes of zeros + } + } + ``` + +Asserts: +* call was successful +* response payload type is COMPRESSABLE +* response payload body is 314159 bytes in size +* clients are free to assert that the response payload body contents are zero + and comparing the entire response message against a golden response + +### client_streaming + +This test verifies that client-only streaming succeeds. + +Server features: +* [StreamingInputCall][] +* [Compressable Payload][] + +Procedure: + 1. Client calls StreamingInputCall + 2. Client sends: + + ``` + { + payload:{ + body: 27182 bytes of zeros + } + } + ``` + 3. Client then sends: + + ``` + { + payload:{ + body: 8 bytes of zeros + } + } + ``` + 4. Client then sends: + + ``` + { + payload:{ + body: 1828 bytes of zeros + } + } + ``` + 5. Client then sends: + + ``` + { + payload:{ + body: 45904 bytes of zeros + } + } + ``` + 6. Client halfCloses + +Asserts: +* call was successful +* response aggregated_payload_size is 74922 + +### server_streaming + +This test verifies that server-only streaming succeeds. + +Server features: +* [StreamingOutputCall][] +* [Compressable Payload][] + +Procedure: + 1. Client calls StreamingOutputCall with: + + ``` + { + response_type:COMPRESSABLE + response_parameters:{ + size: 31415 + } + response_parameters:{ + size: 9 + } + response_parameters:{ + size: 2653 + } + response_parameters:{ + size: 58979 + } + } + ``` + +Asserts: +* call was successful +* exactly four responses +* response payloads are COMPRESSABLE +* response payload bodies are sized (in order): 31415, 9, 2653, 58979 +* clients are free to assert that the response payload body contents are zero + and comparing the entire response messages against golden responses + +### ping_pong + +This test verifies that full duplex bidi is supported. + +Server features: +* [FullDuplexCall][] +* [Compressable Payload][] + +Procedure: + 1. Client calls FullDuplexCall with: + + ``` + { + response_type: COMPRESSABLE + response_parameters:{ + size: 31415 + } + payload:{ + body: 27182 bytes of zeros + } + } + ``` + 2. After getting a reply, it sends: + + ``` + { + response_type: COMPRESSABLE + response_parameters:{ + size: 9 + } + payload:{ + body: 8 bytes of zeros + } + } + ``` + 3. After getting a reply, it sends: + + ``` + { + response_type: COMPRESSABLE + response_parameters:{ + size: 2653 + } + payload:{ + body: 1828 bytes of zeros + } + } + ``` + 4. After getting a reply, it sends: + + ``` + { + response_type: COMPRESSABLE + response_parameters:{ + size: 58979 + } + payload:{ + body: 45904 bytes of zeros + } + } + ``` + +Asserts: +* call was successful +* exactly four responses +* response payloads are COMPRESSABLE +* response payload bodies are sized (in order): 31415, 9, 2653, 58979 +* clients are free to assert that the response payload body contents are zero + and comparing the entire response messages against golden responses + +### empty_stream + +This test verifies that streams support having zero-messages in both +directions. + +Server features: +* [FullDuplexCall][] + +Procedure: + 1. Client calls FullDuplexCall and then half-closes + +Asserts: +* call was successful +* exactly zero responses + +### compute_engine_creds + +Status: Not yet implementable + +This test is only for cloud-to-prod path. + +This test verifies unary calls succeed in sending messages while using Service +Credentials from GCE metadata server. The client instance needs to be created +with desired oauth scope. + +Server features: +* [UnaryCall][] +* [Compressable Payload][] +* SimpeResponse.username +* SimpleResponse.oauth_scope + +Procedure: + 1. Client sets flags default_service_account with GCE service account name and + oauth_scope with the oauth scope to use. + 2. Client configures channel to use GCECredentials + 3. Client calls UnaryCall on the channel with: + + ``` + { + response_type: COMPRESSABLE + response_size: 314159 + payload:{ + body: 271828 bytes of zeros + } + fill_username: true + fill_oauth_scope: true + } + ``` + +Asserts: +* call was successful +* received SimpleResponse.username equals FLAGS_default_service_account +* received SimpleResponse.oauth_scope is in FLAGS_oauth_scope +* response payload body is 314159 bytes in size +* clients are free to assert that the response payload body contents are zero + and comparing the entire response message against a golden response + +### service_account_creds + +Status: Not yet implementable + +This test is only for cloud-to-prod path. + +This test verifies unary calls succeed in sending messages while using JWT +signing keys (redeemed for OAuth2 access tokens by the auth implementation) + +Server features: +* [UnaryCall][] +* [Compressable Payload][] +* SimpleResponse.username +* SimpleResponse.oauth_scope + +Procedure: + 1. Client sets flags service_account_key_file with the path to json key file, + oauth_scope to the oauth scope. + 2. Client configures the channel to use ServiceAccountCredentials. + 3. Client calls UnaryCall with: + + ``` + { + response_type: COMPRESSABLE + response_size: 314159 + payload:{ + body: 271828 bytes of zeros + } + fill_username: true + fill_oauth_scope: true + } + ``` + +Asserts: +* call was successful +* received SimpleResponse.username is in the json key file read from + FLAGS_service_account_key_file +* received SimpleResponse.oauth_scope is in FLAGS_oauth_scope +* response payload body is 314159 bytes in size +* clients are free to assert that the response payload body contents are zero + and comparing the entire response message against a golden response + +### jwt_token_creds + +Status: Not yet implementable + +This test is only for cloud-to-prod path. + +This test verifies unary calls succeed in sending messages while using JWT +token (created by the project's key file) + +Server features: +* [UnaryCall][] +* [Compressable Payload][] +* SimpleResponse.username +* SimpleResponse.oauth_scope + +Procedure: + 1. Client sets flags service_account_key_file with the path to json key file + 2. Client configures the channel to use JWTTokenCredentials. + 3. Client calls UnaryCall with: + + ``` + { + response_type: COMPRESSABLE + response_size: 314159 + payload:{ + body: 271828 bytes of zeros + } + fill_username: true + } + ``` + +Asserts: +* call was successful +* received SimpleResponse.username is in the json key file read from + FLAGS_service_account_key_file +* response payload body is 314159 bytes in size +* clients are free to assert that the response payload body contents are zero + and comparing the entire response message against a golden response + +### Metadata (TODO: fix name) + +Status: Not yet implementable + +This test verifies that custom metadata in either binary or ascii format can be +sent in header and trailer. + +Server features: +* [UnaryCall][] +* [Compressable Payload][] +* Ability to receive custom metadata from client in header and send custom data + back to client in both header and trailer. (TODO: this is not defined) + +Procedure: + 1. While sending custom metadata (ascii + binary) in the header, client calls UnaryCall with: + + ``` + { + response_type: COMPRESSABLE + response_size: 314159 + payload:{ + body: 271828 bytes of zeros + } + } + ``` + +Asserts: +* call was successful +* custom metadata is echoed back in the response header. +* custom metadata is echoed back in the response trailer. + +### status_code_and_message + +Status: Not yet implementable + +This test verifies unary calls succeed in sending messages, and propagates back +status code and message sent along with the messages. + +Server features: +* [UnaryCall][] + +Procedure: + 1. Client calls UnaryCall with: + + ``` + { + response_status:{ + code: 2 + message: "test status message" + } + } + ``` + +Asserts: +* received status code is the same with sent code +* received status message is the same with sent message + +### unimplemented_method + +Status: Not yet implementable + +This test verifies calling unimplemented RPC method returns unimplemented +status. + +Procedure: +* Client calls UnimplementedCall with: + + ``` + { + response_type: COMPRESSABLE + response_size: 314159 + payload:{ + body: 271828 bytes of zeros + } + } + ``` + +Asserts: +* received status code is 12 (UNIMPLEMENTED) +* received status message is empty or null/unset + +### cancel_after_begin + +This test verifies that a request can be cancelled after metadata has been sent +but before payloads are sent. + +Server features: +* [StreamingInputCall][] + +Procedure: + 1. Client starts StreamingInputCall + 2. Client immediately cancels request + +Asserts: +* Call completed with status CANCELLED + +### cancel_after_first_response + +This test verifies that a request can be cancelled after receiving a message +from the server. + +Server features: +* [FullDuplexCall][] +* [Compressable Payload][] + +Procedure: + 1. Client starts FullDuplexCall with + + ``` + { + response_type: COMPRESSABLE + response_parameters:{ + size: 31415 + } + payload:{ + body: 27182 bytes of zeros + } + } + ``` + 2. After receiving a response, client cancels request + +Asserts: +* Call completed with status CANCELLED + +### concurrent_large_unary + +Status: TODO + +Client performs 1000 large_unary tests in parallel on the same channel. + +### Flow control. Pushback at client for large messages (TODO: fix name) + +Status: TODO + +This test verifies that a client sending faster than a server can drain sees +pushback (i.e., attempts to send succeed only after appropriate delays). + +### TODO Tests + +High priority: + +Propagation of status code and message (yangg) + +Cancel after sent headers (ctiller - done) + +Cancel after received first message (ctiller - done) + +Timeout after expire (zhaoq) + +Zero-message streams (ejona) + +Multiple thousand simultaneous calls on same Channel (ctiller - done) + +OAuth2 tokens + Service Credentials from GCE metadata server (GCE->prod only) +(abhishek) + +OAuth2 tokens + JWT signing key (GCE->prod only) (abhishek) + +Metadata: client headers, server headers + trailers, binary+ascii (chenw) + +Normal priority: + +Cancel before start (ctiller) + +Cancel after sent first message (ctiller) + +Cancel after received headers (ctiller) + +Timeout but completed before expire (zhaoq) + +Multiple thousand simultaneous calls timeout on same Channel (ctiller) + +Lower priority: + +Flow control. Pushback at client for large messages (abhishek) + +Flow control. Pushback at server for large messages (abhishek) + +Going over max concurrent streams doesn't fail (client controls itself) +(abhishek) + +RPC method not implemented (yangg) + +Multiple thousand simultaneous calls on different Channels (ctiller) + +Failed TLS hostname verification (ejona?) + +To priorize: + +Start streaming RPC but don't send any requests, server responds + +### Postponed Tests + +Resilience to buggy servers: These tests would verify that a client application +isn't affected negatively by the responses put on the wire by a buggy server +(e.g. the client library won't make the application crash). + +Reconnect after transport failure + +Reconnect backoff + +Fuzz testing + + +Server +------ + +Servers implement various named features for clients to test with. Server +features are orthogonal. If a server implements a feature, it is always +available for clients. Names are simple descriptions for developer +communication and tracking. + +Servers should accept these arguments: + +* --port=PORT + + * The port to listen on. For example, "8080" + +* --use_tls=BOOLEAN + + * Whether to use a plaintext or encrypted connection + +Servers must support TLS with ALPN. They should use +[server1.pem](https://github.com/grpc/grpc/blob/master/src/core/tsi/test_creds/server1.pem) +for their certificate. + +### EmptyCall +[EmptyCall]: #emptycall + +Server implements EmptyCall which immediately returns the empty message. + +### UnaryCall +[UnaryCall]: #unarycall + +Server implements UnaryCall which immediately returns a SimpleResponse with a +payload body of size SimpleRequest.response_size bytes and type as appropriate +for the SimpleRequest.response_type. If the server does not support the +response_type, then it should fail the RPC with INVALID_ARGUMENT. + +If the request sets fill_username, the server should return the client username +it sees in field SimpleResponse.username. If the request sets fill_oauth_scope, +the server should return the oauth scope of the rpc in the form of "xapi_zoo" +in field SimpleResponse.oauth_scope. + +### StreamingInputCall +[StreamingInputCall]: #streaminginputcall + +Server implements StreamingInputCall which upon half close immediately returns +a StreamingInputCallResponse where aggregated_payload_size is the sum of all +request payload bodies received. + +### StreamingOutputCall +[StreamingOutputCall]: #streamingoutputcall + +Server implements StreamingOutputCall by replying, in order, with one +StreamingOutputCallResponses for each ResponseParameters in +StreamingOutputCallRequest. Each StreamingOutputCallResponses should have a +payload body of size ResponseParameters.size bytes, as specified by its +respective ResponseParameters. After sending all responses, it closes with OK. + +### FullDuplexCall +[FullDuplexCall]: #fullduplexcall + +Server implements FullDuplexCall by replying, in order, with one +StreamingOutputCallResponses for each ResponseParameters in each +StreamingOutputCallRequest. Each StreamingOutputCallResponses should have a +payload body of size ResponseParameters.size bytes, as specified by its +respective ResponseParameters. After receiving half close and sending all +responses, it closes with OK. + +### Compressable Payload +[Compressable Payload]: #compressable-payload + +When the client requests COMPRESSABLE payload, the response includes a payload +of the size requested containing all zeros and the payload type is +COMPRESSABLE. + +### Observe ResponseParameters.interval_us +[Observe ResponseParameters.interval_us]: #observe-responseparametersinterval_us + +In StreamingOutputCall and FullDuplexCall, server delays sending a +StreamingOutputCallResponse by the ResponseParameters's interval_us for that +particular response, relative to the last response sent. That is, interval_us +acts like a sleep *before* sending the response and accumulates from one +response to the next. + +Interaction with flow control is unspecified. + +### Echo Auth Information + +Status: Pending + +If a SimpleRequest has fill_username=true and that request was successfully +authenticated, then the SimpleResponse should have username filled with the +canonical form of the authenticated source. The canonical form is dependent on +the authentication method, but is likely to be a base 10 integer identifier or +an email address. + +Discussion: + +Ideally, this would be communicated via metadata and not in the +request/response, but we want to use this test in code paths that don't yet +fully communicate metadata. -- cgit v1.2.3 From c8f95e359232417358cfe3797f9f090cec670a24 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Wed, 8 Apr 2015 18:13:58 +0200 Subject: Fixing msys2 compilation... --- src/core/support/thd_win32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/support/thd_win32.c b/src/core/support/thd_win32.c index f92fb64a5c..3cc798293a 100644 --- a/src/core/support/thd_win32.c +++ b/src/core/support/thd_win32.c @@ -61,7 +61,7 @@ struct thd_info { static thread_local struct thd_info *g_thd_info; /* Destroys a thread info */ -static destroy_thread(struct thd_info *t) { +static void destroy_thread(struct thd_info *t) { if (t->joinable) CloseHandle(t->join_event); gpr_free(t); } -- cgit v1.2.3 From 59838499889025fab037db4fcd0201f4bc45702d Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 8 Apr 2015 15:47:14 -0700 Subject: Added script to generate test .php files from .proto files --- src/php/bin/generate_proto_php.sh | 43 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 src/php/bin/generate_proto_php.sh diff --git a/src/php/bin/generate_proto_php.sh b/src/php/bin/generate_proto_php.sh new file mode 100755 index 0000000000..3cc07aba34 --- /dev/null +++ b/src/php/bin/generate_proto_php.sh @@ -0,0 +1,43 @@ +#!/bin/sh +# 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. + + +set +e +cd $(dirname $0) + +cd ../tests/generated_code + +protoc-gen-php -i . -o . ./math.proto + +cd - + +cd ../tests/interop + +protoc-gen-php -i . -o . ./test.proto -- cgit v1.2.3 From 35d06e99fb310c81b1fdd79a8ffda2a5bb3fe02f Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 8 Apr 2015 15:49:56 -0700 Subject: Simplified script --- src/php/bin/generate_proto_php.sh | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/php/bin/generate_proto_php.sh b/src/php/bin/generate_proto_php.sh index 3cc07aba34..16f93747ab 100755 --- a/src/php/bin/generate_proto_php.sh +++ b/src/php/bin/generate_proto_php.sh @@ -32,12 +32,9 @@ set +e cd $(dirname $0) -cd ../tests/generated_code +gen_code='../tests/generated_code' +interop='../tests/interop' -protoc-gen-php -i . -o . ./math.proto +protoc-gen-php -i $gen_code -o $gen_code $gen_code/math.proto -cd - - -cd ../tests/interop - -protoc-gen-php -i . -o . ./test.proto +protoc-gen-php -i $interop -o $interop $interop/test.proto -- cgit v1.2.3 From aa11066573722b704c718f418514735f1c86edb6 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 8 Apr 2015 16:53:47 -0700 Subject: Fixed memory leaks in PHP extension code --- src/php/ext/grpc/call.c | 11 +++++++---- src/php/ext/grpc/channel.c | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/php/ext/grpc/call.c b/src/php/ext/grpc/call.c index 6bc65b5367..b1525e9246 100644 --- a/src/php/ext/grpc/call.c +++ b/src/php/ext/grpc/call.c @@ -443,8 +443,9 @@ PHP_METHOD(Call, startBatch) { add_property_bool(result, "send_status", true); break; case GRPC_OP_RECV_INITIAL_METADATA: - add_property_zval(result, "metadata", - grpc_parse_metadata_array(&recv_metadata)); + array = grpc_parse_metadata_array(&recv_metadata); + add_property_zval(result, "metadata", array); + Z_DELREF_P(array); break; case GRPC_OP_RECV_MESSAGE: byte_buffer_to_string(message, &message_str, &message_len); @@ -458,11 +459,13 @@ PHP_METHOD(Call, startBatch) { case GRPC_OP_RECV_STATUS_ON_CLIENT: MAKE_STD_ZVAL(recv_status); object_init(recv_status); - add_property_zval(recv_status, "metadata", - grpc_parse_metadata_array(&recv_trailing_metadata)); + array = grpc_parse_metadata_array(&recv_trailing_metadata); + add_property_zval(recv_status, "metadata", array); + Z_DELREF_P(array); add_property_long(recv_status, "code", status); add_property_string(recv_status, "details", status_details, true); add_property_zval(result, "status", recv_status); + Z_DELREF_P(recv_status); break; case GRPC_OP_RECV_CLOSE_ON_SERVER: add_property_bool(result, "cancelled", cancelled); diff --git a/src/php/ext/grpc/channel.c b/src/php/ext/grpc/channel.c index 51a3eae0f4..b8262db162 100644 --- a/src/php/ext/grpc/channel.c +++ b/src/php/ext/grpc/channel.c @@ -62,6 +62,7 @@ void free_wrapped_grpc_channel(void *object TSRMLS_DC) { if (channel->wrapped != NULL) { grpc_channel_destroy(channel->wrapped); } + efree(channel->target); efree(channel); } -- cgit v1.2.3 From b9de09f2acd9f85a222a1cc410051832bcc7d91c Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 8 Apr 2015 17:08:05 -0700 Subject: Allow specifying warmup, benchmark times --- test/cpp/qps/driver.cc | 8 +++++--- test/cpp/qps/driver.h | 5 ++++- test/cpp/qps/qps_driver.cc | 8 ++++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc index 64a53496ae..f44883783d 100644 --- a/test/cpp/qps/driver.cc +++ b/test/cpp/qps/driver.cc @@ -74,7 +74,9 @@ static vector get_hosts(const string& name) { ScenarioResult RunScenario(const ClientConfig& initial_client_config, size_t num_clients, const ServerConfig& server_config, - size_t num_servers) { + size_t num_servers, + int warmup_seconds, + int benchmark_seconds) { // ClientContext allocator (all are destroyed at scope exit) list contexts; auto alloc_context = [&contexts]() { @@ -146,7 +148,7 @@ ScenarioResult RunScenario(const ClientConfig& initial_client_config, // Let everything warmup gpr_log(GPR_INFO, "Warming up"); gpr_timespec start = gpr_now(); - gpr_sleep_until(gpr_time_add(start, gpr_time_from_seconds(5))); + gpr_sleep_until(gpr_time_add(start, gpr_time_from_seconds(warmup_seconds))); // Start a run gpr_log(GPR_INFO, "Starting"); @@ -171,7 +173,7 @@ ScenarioResult RunScenario(const ClientConfig& initial_client_config, // Wait some time gpr_log(GPR_INFO, "Running"); - gpr_sleep_until(gpr_time_add(start, gpr_time_from_seconds(15))); + gpr_sleep_until(gpr_time_add(start, gpr_time_from_seconds(benchmark_seconds))); // Finish a run ScenarioResult result; diff --git a/test/cpp/qps/driver.h b/test/cpp/qps/driver.h index d87e80dc55..7a81b701c4 100644 --- a/test/cpp/qps/driver.h +++ b/test/cpp/qps/driver.h @@ -54,7 +54,10 @@ struct ScenarioResult { ScenarioResult RunScenario(const grpc::testing::ClientConfig& client_config, size_t num_clients, const grpc::testing::ServerConfig& server_config, - size_t num_servers); + size_t num_servers, + int warmup_seconds, + int benchmark_seconds); + } // namespace testing } // namespace grpc diff --git a/test/cpp/qps/qps_driver.cc b/test/cpp/qps/qps_driver.cc index f7aa8e2aba..f42d538b16 100644 --- a/test/cpp/qps/qps_driver.cc +++ b/test/cpp/qps/qps_driver.cc @@ -40,6 +40,9 @@ DEFINE_int32(num_clients, 1, "Number of client binaries"); DEFINE_int32(num_servers, 1, "Number of server binaries"); +DEFINE_int32(warmup_seconds, 5, "Warmup time (in seconds)"); +DEFINE_int32(benchmark_seconds, 30, "Benchmark time (in seconds)"); + // Common config DEFINE_bool(enable_ssl, false, "Use SSL"); DEFINE_string(rpc_type, "UNARY", "Type of RPC: UNARY or STREAMING"); @@ -98,8 +101,9 @@ int main(int argc, char** argv) { server_config.set_threads(FLAGS_server_threads); server_config.set_enable_ssl(FLAGS_enable_ssl); - auto result = RunScenario(client_config, FLAGS_num_clients, server_config, - FLAGS_num_servers); + auto result = RunScenario(client_config, FLAGS_num_clients, + server_config, FLAGS_num_servers, + FLAGS_warmup_seconds, FLAGS_benchmark_seconds); gpr_log(GPR_INFO, "QPS: %.1f", result.latencies.Count() / -- cgit v1.2.3 From c76b5652d47fe65f825cd3bce31a13916dad1503 Mon Sep 17 00:00:00 2001 From: Tim Emiola Date: Wed, 8 Apr 2015 17:19:34 -0700 Subject: Use the release tag specified by the version --- tools/distpackages/build_deb_packages.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/distpackages/build_deb_packages.sh b/tools/distpackages/build_deb_packages.sh index 366a5184c8..0beb41ed0a 100755 --- a/tools/distpackages/build_deb_packages.sh +++ b/tools/distpackages/build_deb_packages.sh @@ -45,7 +45,13 @@ if [ -f /version.txt ]; then pkg_version=$(cat /version.txt) fi version="${pkg_version}.0" -echo "Target release => $pkg_version" +release_tag="release-${pkg_version//./_}" +echo "Target release => $pkg_version, will checkout tag $release_tag" + +# Switch grpc_root to the release tag +pushd $grpc_root +git checkout $release_tag || { echo "bad release tag ${release_tag}"; exit 1; } +popd if [ -f /.dockerinit ]; then # We're in Docker where uname -p returns "unknown". -- cgit v1.2.3 From 2c2cf6d2c57ac4ade74f8e4bc664f0fcc2db1e10 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 9 Apr 2015 09:40:20 -0700 Subject: Smoke test initial version --- Makefile | 45 +++++++++++- build.json | 18 +++++ test/cpp/qps/smoke_test.cc | 176 +++++++++++++++++++++++++++++++++++++++++++++ test/cpp/qps/smoke_test.sh | 28 ++++++++ 4 files changed, 266 insertions(+), 1 deletion(-) create mode 100644 test/cpp/qps/smoke_test.cc create mode 100755 test/cpp/qps/smoke_test.sh diff --git a/Makefile b/Makefile index 8e01bb88dc..6665eb418c 100644 --- a/Makefile +++ b/Makefile @@ -641,6 +641,7 @@ pubsub_client: $(BINDIR)/$(CONFIG)/pubsub_client pubsub_publisher_test: $(BINDIR)/$(CONFIG)/pubsub_publisher_test pubsub_subscriber_test: $(BINDIR)/$(CONFIG)/pubsub_subscriber_test qps_driver: $(BINDIR)/$(CONFIG)/qps_driver +qps_smoke_test: $(BINDIR)/$(CONFIG)/qps_smoke_test qps_worker: $(BINDIR)/$(CONFIG)/qps_worker status_test: $(BINDIR)/$(CONFIG)/status_test thread_pool_test: $(BINDIR)/$(CONFIG)/thread_pool_test @@ -1081,7 +1082,7 @@ buildtests: buildtests_c buildtests_cxx buildtests_c: privatelibs_c $(BINDIR)/$(CONFIG)/alarm_heap_test $(BINDIR)/$(CONFIG)/alarm_list_test $(BINDIR)/$(CONFIG)/alarm_test $(BINDIR)/$(CONFIG)/alpn_test $(BINDIR)/$(CONFIG)/bin_encoder_test $(BINDIR)/$(CONFIG)/census_hash_table_test $(BINDIR)/$(CONFIG)/census_statistics_multiple_writers_circular_buffer_test $(BINDIR)/$(CONFIG)/census_statistics_multiple_writers_test $(BINDIR)/$(CONFIG)/census_statistics_performance_test $(BINDIR)/$(CONFIG)/census_statistics_quick_test $(BINDIR)/$(CONFIG)/census_statistics_small_log_test $(BINDIR)/$(CONFIG)/census_stub_test $(BINDIR)/$(CONFIG)/census_window_stats_test $(BINDIR)/$(CONFIG)/chttp2_status_conversion_test $(BINDIR)/$(CONFIG)/chttp2_stream_encoder_test $(BINDIR)/$(CONFIG)/chttp2_stream_map_test $(BINDIR)/$(CONFIG)/chttp2_transport_end2end_test $(BINDIR)/$(CONFIG)/dualstack_socket_test $(BINDIR)/$(CONFIG)/echo_client $(BINDIR)/$(CONFIG)/echo_server $(BINDIR)/$(CONFIG)/echo_test $(BINDIR)/$(CONFIG)/fd_posix_test $(BINDIR)/$(CONFIG)/fling_client $(BINDIR)/$(CONFIG)/fling_server $(BINDIR)/$(CONFIG)/fling_stream_test $(BINDIR)/$(CONFIG)/fling_test $(BINDIR)/$(CONFIG)/gpr_cancellable_test $(BINDIR)/$(CONFIG)/gpr_cmdline_test $(BINDIR)/$(CONFIG)/gpr_env_test $(BINDIR)/$(CONFIG)/gpr_file_test $(BINDIR)/$(CONFIG)/gpr_histogram_test $(BINDIR)/$(CONFIG)/gpr_host_port_test $(BINDIR)/$(CONFIG)/gpr_log_test $(BINDIR)/$(CONFIG)/gpr_slice_buffer_test $(BINDIR)/$(CONFIG)/gpr_slice_test $(BINDIR)/$(CONFIG)/gpr_string_test $(BINDIR)/$(CONFIG)/gpr_sync_test $(BINDIR)/$(CONFIG)/gpr_thd_test $(BINDIR)/$(CONFIG)/gpr_time_test $(BINDIR)/$(CONFIG)/gpr_useful_test $(BINDIR)/$(CONFIG)/grpc_base64_test $(BINDIR)/$(CONFIG)/grpc_byte_buffer_reader_test $(BINDIR)/$(CONFIG)/grpc_channel_stack_test $(BINDIR)/$(CONFIG)/grpc_completion_queue_test $(BINDIR)/$(CONFIG)/grpc_credentials_test $(BINDIR)/$(CONFIG)/grpc_json_token_test $(BINDIR)/$(CONFIG)/grpc_stream_op_test $(BINDIR)/$(CONFIG)/hpack_parser_test $(BINDIR)/$(CONFIG)/hpack_table_test $(BINDIR)/$(CONFIG)/httpcli_format_request_test $(BINDIR)/$(CONFIG)/httpcli_parser_test $(BINDIR)/$(CONFIG)/httpcli_test $(BINDIR)/$(CONFIG)/json_rewrite $(BINDIR)/$(CONFIG)/json_rewrite_test $(BINDIR)/$(CONFIG)/json_test $(BINDIR)/$(CONFIG)/lame_client_test $(BINDIR)/$(CONFIG)/message_compress_test $(BINDIR)/$(CONFIG)/metadata_buffer_test $(BINDIR)/$(CONFIG)/multi_init_test $(BINDIR)/$(CONFIG)/murmur_hash_test $(BINDIR)/$(CONFIG)/no_server_test $(BINDIR)/$(CONFIG)/poll_kick_posix_test $(BINDIR)/$(CONFIG)/resolve_address_test $(BINDIR)/$(CONFIG)/secure_endpoint_test $(BINDIR)/$(CONFIG)/sockaddr_utils_test $(BINDIR)/$(CONFIG)/tcp_client_posix_test $(BINDIR)/$(CONFIG)/tcp_posix_test $(BINDIR)/$(CONFIG)/tcp_server_posix_test $(BINDIR)/$(CONFIG)/time_averaged_stats_test $(BINDIR)/$(CONFIG)/time_test $(BINDIR)/$(CONFIG)/timeout_encoding_test $(BINDIR)/$(CONFIG)/transport_metadata_test $(BINDIR)/$(CONFIG)/transport_security_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_no_op_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_thread_stress_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_writes_done_hangs_with_pending_read_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_accept_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_accept_and_writes_closed_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_before_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_in_a_vacuum_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_census_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_disappearing_server_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_early_server_shutdown_finishes_inflight_calls_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_early_server_shutdown_finishes_tags_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_graceful_server_shutdown_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_invoke_large_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_max_concurrent_streams_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_no_op_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_ping_pong_streaming_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_binary_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_trailing_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_with_large_metadata_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_simple_delayed_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_thread_stress_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_writes_done_hangs_with_pending_read_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_no_op_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_thread_stress_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_writes_done_hangs_with_pending_read_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_accept_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_accept_and_writes_closed_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_before_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_in_a_vacuum_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_census_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_disappearing_server_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_inflight_calls_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_tags_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_graceful_server_shutdown_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_invoke_large_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_max_concurrent_streams_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_no_op_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_ping_pong_streaming_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_binary_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_trailing_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_large_metadata_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_delayed_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_thread_stress_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_writes_done_hangs_with_pending_read_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_no_op_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_thread_stress_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_writes_done_hangs_with_pending_read_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_accept_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_accept_and_writes_closed_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_before_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_in_a_vacuum_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_census_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_disappearing_server_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_early_server_shutdown_finishes_inflight_calls_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_early_server_shutdown_finishes_tags_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_graceful_server_shutdown_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_invoke_large_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_max_concurrent_streams_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_no_op_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_ping_pong_streaming_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_binary_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_trailing_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_with_large_metadata_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_delayed_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_thread_stress_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_writes_done_hangs_with_pending_read_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_no_op_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_thread_stress_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_writes_done_hangs_with_pending_read_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_accept_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_accept_and_writes_closed_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_before_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_in_a_vacuum_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_census_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_disappearing_server_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_early_server_shutdown_finishes_inflight_calls_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_early_server_shutdown_finishes_tags_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_graceful_server_shutdown_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_invoke_large_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_max_concurrent_streams_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_no_op_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_ping_pong_streaming_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_binary_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_trailing_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_large_metadata_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_delayed_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_thread_stress_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_writes_done_hangs_with_pending_read_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_no_op_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_thread_stress_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_writes_done_hangs_with_pending_read_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_and_writes_closed_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_before_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_in_a_vacuum_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_census_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_disappearing_server_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_early_server_shutdown_finishes_inflight_calls_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_early_server_shutdown_finishes_tags_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_graceful_server_shutdown_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_invoke_large_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_max_concurrent_streams_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_no_op_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_ping_pong_streaming_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_binary_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_trailing_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_large_metadata_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_delayed_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_thread_stress_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_writes_done_hangs_with_pending_read_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_no_op_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_thread_stress_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_writes_done_hangs_with_pending_read_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_and_writes_closed_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_before_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_in_a_vacuum_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_census_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_disappearing_server_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_inflight_calls_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_tags_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_graceful_server_shutdown_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_invoke_large_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_max_concurrent_streams_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_no_op_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_ping_pong_streaming_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_binary_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_large_metadata_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_delayed_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_thread_stress_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_writes_done_hangs_with_pending_read_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_no_op_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_thread_stress_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_writes_done_hangs_with_pending_read_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_and_writes_closed_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_before_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_in_a_vacuum_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_census_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_disappearing_server_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_inflight_calls_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_tags_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_graceful_server_shutdown_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_invoke_large_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_max_concurrent_streams_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_no_op_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_ping_pong_streaming_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_binary_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_large_metadata_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_delayed_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_thread_stress_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_writes_done_hangs_with_pending_read_legacy_test -buildtests_cxx: privatelibs_cxx $(BINDIR)/$(CONFIG)/async_end2end_test $(BINDIR)/$(CONFIG)/channel_arguments_test $(BINDIR)/$(CONFIG)/cli_call_test $(BINDIR)/$(CONFIG)/credentials_test $(BINDIR)/$(CONFIG)/cxx_time_test $(BINDIR)/$(CONFIG)/end2end_test $(BINDIR)/$(CONFIG)/generic_end2end_test $(BINDIR)/$(CONFIG)/grpc_cli $(BINDIR)/$(CONFIG)/interop_client $(BINDIR)/$(CONFIG)/interop_server $(BINDIR)/$(CONFIG)/interop_test $(BINDIR)/$(CONFIG)/pubsub_client $(BINDIR)/$(CONFIG)/pubsub_publisher_test $(BINDIR)/$(CONFIG)/pubsub_subscriber_test $(BINDIR)/$(CONFIG)/qps_driver $(BINDIR)/$(CONFIG)/qps_worker $(BINDIR)/$(CONFIG)/status_test $(BINDIR)/$(CONFIG)/thread_pool_test +buildtests_cxx: privatelibs_cxx $(BINDIR)/$(CONFIG)/async_end2end_test $(BINDIR)/$(CONFIG)/channel_arguments_test $(BINDIR)/$(CONFIG)/cli_call_test $(BINDIR)/$(CONFIG)/credentials_test $(BINDIR)/$(CONFIG)/cxx_time_test $(BINDIR)/$(CONFIG)/end2end_test $(BINDIR)/$(CONFIG)/generic_end2end_test $(BINDIR)/$(CONFIG)/grpc_cli $(BINDIR)/$(CONFIG)/interop_client $(BINDIR)/$(CONFIG)/interop_server $(BINDIR)/$(CONFIG)/interop_test $(BINDIR)/$(CONFIG)/pubsub_client $(BINDIR)/$(CONFIG)/pubsub_publisher_test $(BINDIR)/$(CONFIG)/pubsub_subscriber_test $(BINDIR)/$(CONFIG)/qps_driver $(BINDIR)/$(CONFIG)/qps_smoke_test $(BINDIR)/$(CONFIG)/qps_worker $(BINDIR)/$(CONFIG)/status_test $(BINDIR)/$(CONFIG)/thread_pool_test test: test_c test_cxx @@ -8731,6 +8732,48 @@ endif endif +QPS_SMOKE_TEST_SRC = \ + test/cpp/qps/smoke_test.cc \ + +QPS_SMOKE_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(QPS_SMOKE_TEST_SRC)))) + +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL with ALPN. + +$(BINDIR)/$(CONFIG)/qps_smoke_test: openssl_dep_error + +else + + +ifeq ($(NO_PROTOBUF),true) + +# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. + +$(BINDIR)/$(CONFIG)/qps_smoke_test: protobuf_dep_error + +else + +$(BINDIR)/$(CONFIG)/qps_smoke_test: $(PROTOBUF_DEP) $(QPS_SMOKE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LDXX) $(LDFLAGS) $(QPS_SMOKE_TEST_OBJS) $(GTEST_LIB) $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/qps_smoke_test + +endif + +endif + +$(OBJDIR)/$(CONFIG)/test/cpp/qps/smoke_test.o: $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + +deps_qps_smoke_test: $(QPS_SMOKE_TEST_OBJS:.o=.dep) + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(QPS_SMOKE_TEST_OBJS:.o=.dep) +endif +endif + + QPS_WORKER_SRC = \ test/cpp/qps/client_async.cc \ test/cpp/qps/client_sync.cc \ diff --git a/build.json b/build.json index f8f23e0d33..f2a39c6f2c 100644 --- a/build.json +++ b/build.json @@ -1979,6 +1979,24 @@ "gpr" ] }, + { + "name": "qps_smoke_test", + "build": "test", + "run": false, + "language": "c++", + "src": [ + "test/cpp/qps/smoke_test.cc" + ], + "deps": [ + "qps", + "grpc++_test_util", + "grpc_test_util", + "grpc++", + "grpc", + "gpr_test_util", + "gpr" + ] + }, { "name": "qps_worker", "build": "test", diff --git a/test/cpp/qps/smoke_test.cc b/test/cpp/qps/smoke_test.cc new file mode 100644 index 0000000000..85dca1f67b --- /dev/null +++ b/test/cpp/qps/smoke_test.cc @@ -0,0 +1,176 @@ +/* + * + * 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 + +#include "test/cpp/qps/driver.h" +#include "test/cpp/qps/stats.h" + +namespace grpc { +namespace testing { + +static void RunSynchronousUnaryPingPong() { + gpr_log(GPR_INFO, "Running Synchronous Unary Ping Pong"); + + ClientConfig client_config; + client_config.set_client_type(SYNCHRONOUS_CLIENT); + client_config.set_enable_ssl(false); + client_config.set_outstanding_rpcs_per_channel(1); + client_config.set_client_channels(1); + client_config.set_payload_size(1); + client_config.set_rpc_type(UNARY); + + ServerConfig server_config; + server_config.set_server_type(SYNCHRONOUS_SERVER); + server_config.set_enable_ssl(false); + server_config.set_threads(1); + + auto result = RunScenario(client_config, 1, server_config, 1, 5, 15); + + gpr_log(GPR_INFO, "QPS: %.1f", + result.latencies.Count() / + average(result.client_resources, + [](ResourceUsage u) { return u.wall_time; })); + gpr_log(GPR_INFO, "Latencies (50/95/99/99.9%%-ile): %.1f/%.1f/%.1f/%.1f us", + result.latencies.Percentile(50) / 1000, + result.latencies.Percentile(95) / 1000, + result.latencies.Percentile(99) / 1000, + result.latencies.Percentile(99.9) / 1000); +} + +static void RunSynchronousStreamingPingPong() { + gpr_log(GPR_INFO, "Running Synchronous Streaming Ping Pong"); + + ClientConfig client_config; + client_config.set_client_type(SYNCHRONOUS_CLIENT); + client_config.set_enable_ssl(false); + client_config.set_outstanding_rpcs_per_channel(1); + client_config.set_client_channels(1); + client_config.set_payload_size(1); + client_config.set_rpc_type(STREAMING); + + ServerConfig server_config; + server_config.set_server_type(SYNCHRONOUS_SERVER); + server_config.set_enable_ssl(false); + server_config.set_threads(1); + + auto result = RunScenario(client_config, 1, server_config, 1, 5, 15); + + gpr_log(GPR_INFO, "QPS: %.1f", + result.latencies.Count() / + average(result.client_resources, + [](ResourceUsage u) { return u.wall_time; })); + gpr_log(GPR_INFO, "Latencies (50/95/99/99.9%%-ile): %.1f/%.1f/%.1f/%.1f us", + result.latencies.Percentile(50) / 1000, + result.latencies.Percentile(95) / 1000, + result.latencies.Percentile(99) / 1000, + result.latencies.Percentile(99.9) / 1000); +} + +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_enable_ssl(false); + client_config.set_outstanding_rpcs_per_channel(1); + client_config.set_client_channels(1); + client_config.set_payload_size(1); + client_config.set_async_client_threads(1); + client_config.set_rpc_type(UNARY); + + ServerConfig server_config; + server_config.set_server_type(ASYNC_SERVER); + server_config.set_enable_ssl(false); + server_config.set_threads(1); + + auto result = RunScenario(client_config, 1, server_config, 1, 5, 15); + + gpr_log(GPR_INFO, "QPS: %.1f", + result.latencies.Count() / + average(result.client_resources, + [](ResourceUsage u) { return u.wall_time; })); + gpr_log(GPR_INFO, "Latencies (50/95/99/99.9%%-ile): %.1f/%.1f/%.1f/%.1f us", + result.latencies.Percentile(50) / 1000, + result.latencies.Percentile(95) / 1000, + result.latencies.Percentile(99) / 1000, + result.latencies.Percentile(99.9) / 1000); +} + +static void RunQPS() { + gpr_log(GPR_INFO, "Running QPS test"); + + ClientConfig client_config; + client_config.set_client_type(ASYNC_CLIENT); + client_config.set_enable_ssl(false); + client_config.set_outstanding_rpcs_per_channel(1000); + client_config.set_client_channels(8); + client_config.set_payload_size(1); + client_config.set_async_client_threads(8); + client_config.set_rpc_type(UNARY); + + ServerConfig server_config; + server_config.set_server_type(ASYNC_SERVER); + server_config.set_enable_ssl(false); + server_config.set_threads(4); + + auto result = RunScenario(client_config, 1, server_config, 1, 10, 30); + + auto qps = + result.latencies.Count() / + average(result.client_resources, + [](ResourceUsage u) { return u.wall_time; }); + + gpr_log(GPR_INFO, "QPS: %.1f (%.1f/core)", qps, qps/client_config.client_channels()); + gpr_log(GPR_INFO, "Latencies (50/95/99/99.9%%-ile): %.1f/%.1f/%.1f/%.1f us", + result.latencies.Percentile(50) / 1000, + result.latencies.Percentile(95) / 1000, + result.latencies.Percentile(99) / 1000, + result.latencies.Percentile(99.9) / 1000); +} + +} // namespace testing +} // namespace grpc + +int main(int argc, char** argv) { + grpc_init(); + + using namespace grpc::testing; + RunSynchronousStreamingPingPong(); + RunSynchronousUnaryPingPong(); + RunAsyncUnaryPingPong(); + RunQPS(); + + grpc_shutdown(); + return 0; +} diff --git a/test/cpp/qps/smoke_test.sh b/test/cpp/qps/smoke_test.sh new file mode 100755 index 0000000000..ba7f0a4f27 --- /dev/null +++ b/test/cpp/qps/smoke_test.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +# performs a single qps run with one client and one server + +set -ex + +cd $(dirname $0)/../../.. + +killall qps_worker || true + +config=opt + +NUMCPUS=`python2.7 -c 'import multiprocessing; print multiprocessing.cpu_count()'` + +make CONFIG=$config qps_worker qps_smoke_test -j$NUMCPUS + +bins/$config/qps_worker -driver_port 10000 -server_port 10001 & +PID1=$! +bins/$config/qps_worker -driver_port 10010 -server_port 10011 & +PID2=$! + +export QPS_WORKERS="localhost:10000,localhost:10010" + +bins/$config/qps_smoke_test $* + +kill -2 $PID1 $PID2 +wait + -- cgit v1.2.3 From aa2fca5a4830044f183b2ede7e593702d8b8826d Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 9 Apr 2015 10:56:06 -0700 Subject: Remove asserts --- test/cpp/qps/client_async.cc | 16 ++-------------- test/cpp/qps/client_sync.cc | 6 +++--- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc index 1ed3c7157f..b07620140e 100644 --- a/test/cpp/qps/client_async.cc +++ b/test/cpp/qps/client_async.cc @@ -137,13 +137,7 @@ class AsyncUnaryClient GRPC_FINAL : public Client { cli_cqs_.emplace_back(new CompletionQueue); } - auto payload_size = config.payload_size(); - auto check_done = [payload_size](grpc::Status s, SimpleResponse* response) { - GPR_ASSERT(s.IsOk() && (response->payload().type() == - grpc::testing::PayloadType::COMPRESSABLE) && - (response->payload().body().length() == - static_cast(payload_size))); - }; + auto check_done = [](grpc::Status s, SimpleResponse* response) {}; int t = 0; for (int i = 0; i < config.outstanding_rpcs_per_channel(); i++) { @@ -270,13 +264,7 @@ class AsyncStreamingClient GRPC_FINAL : public Client { cli_cqs_.emplace_back(new CompletionQueue); } - auto payload_size = config.payload_size(); - auto check_done = [payload_size](grpc::Status s, SimpleResponse *response) { - GPR_ASSERT(s.IsOk() && (response->payload().type() == - grpc::testing::PayloadType::COMPRESSABLE) && - (response->payload().body().length() == - static_cast(payload_size))); - }; + auto check_done = [](grpc::Status s, SimpleResponse* response) {}; int t = 0; for (int i = 0; i < config.outstanding_rpcs_per_channel(); i++) { diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc index 77da1725ff..46eb3b8d74 100644 --- a/test/cpp/qps/client_sync.cc +++ b/test/cpp/qps/client_sync.cc @@ -113,9 +113,9 @@ class SynchronousStreamingClient GRPC_FINAL : public SynchronousClient { void ThreadFunc(Histogram* histogram, size_t thread_idx) GRPC_OVERRIDE { double start = Timer::Now(); - EXPECT_TRUE(stream_->Write(request_)); - EXPECT_TRUE(stream_->Read(&responses_[thread_idx])); - histogram->Add((Timer::Now() - start) * 1e9); + if (stream_->Write(request_) && stream_->Read(&responses_[thread_idx])) { + histogram->Add((Timer::Now() - start) * 1e9); + } } private: grpc::ClientContext context_; -- cgit v1.2.3 From 8a5a666ad03b158a32dee787166d7127eedd929c Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 9 Apr 2015 11:31:28 -0700 Subject: Handle errors better on client --- test/cpp/qps/client.h | 32 ++++++++++++++++++-------------- test/cpp/qps/client_async.cc | 8 ++++++-- test/cpp/qps/client_sync.cc | 7 +++++-- 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h index cae7f44537..6e7f63e444 100644 --- a/test/cpp/qps/client.h +++ b/test/cpp/qps/client.h @@ -104,7 +104,7 @@ class Client { void EndThreads() { threads_.clear(); } - virtual void ThreadFunc(Histogram* histogram, size_t thread_idx) = 0; + virtual bool ThreadFunc(Histogram* histogram, size_t thread_idx) = 0; private: class Thread { @@ -113,20 +113,24 @@ class Client { : done_(false), new_(nullptr), impl_([this, idx, client]() { - for (;;) { - // run the loop body - client->ThreadFunc(&histogram_, idx); - // lock, see if we're done - std::lock_guard g(mu_); - if (done_) {return;} - // check if we're marking, swap out the histogram if so - if (new_) { - new_->Swap(&histogram_); - new_ = nullptr; - cv_.notify_one(); + for (;;) { + // run the loop body + bool thread_still_ok = client->ThreadFunc(&histogram_, idx); + // lock, see if we're done + std::lock_guard g(mu_); + if (!thread_still_ok) { + gpr_log(GPR_ERROR, "Finishing client thread due to RPC error"); + done_ = true; + } + if (done_) {return;} + // check if we're marking, swap out the histogram if so + if (new_) { + new_->Swap(&histogram_); + new_ = nullptr; + cv_.notify_one(); + } } - } - }) {} + }) {} ~Thread() { { diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc index b07620140e..fecff5c8ce 100644 --- a/test/cpp/qps/client_async.cc +++ b/test/cpp/qps/client_async.cc @@ -173,7 +173,7 @@ class AsyncUnaryClient GRPC_FINAL : public Client { } } - void ThreadFunc(Histogram* histogram, size_t thread_idx) GRPC_OVERRIDE { + bool ThreadFunc(Histogram* histogram, size_t thread_idx) GRPC_OVERRIDE { void* got_tag; bool ok; cli_cqs_[thread_idx]->Next(&got_tag, &ok); @@ -185,6 +185,8 @@ class AsyncUnaryClient GRPC_FINAL : public Client { ctx->StartNewClone(); delete ctx; } + + return true; } std::vector> cli_cqs_; @@ -301,7 +303,7 @@ class AsyncStreamingClient GRPC_FINAL : public Client { } } - void ThreadFunc(Histogram *histogram, size_t thread_idx) GRPC_OVERRIDE { + bool ThreadFunc(Histogram *histogram, size_t thread_idx) GRPC_OVERRIDE { void *got_tag; bool ok; cli_cqs_[thread_idx]->Next(&got_tag, &ok); @@ -313,6 +315,8 @@ class AsyncStreamingClient GRPC_FINAL : public Client { ctx->StartNewClone(); delete ctx; } + + return true; } std::vector> cli_cqs_; diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc index 46eb3b8d74..0c8b4f090f 100644 --- a/test/cpp/qps/client_sync.cc +++ b/test/cpp/qps/client_sync.cc @@ -83,13 +83,14 @@ class SynchronousUnaryClient GRPC_FINAL : public SynchronousClient { SynchronousClient(config) {StartThreads(num_threads_);} ~SynchronousUnaryClient() {} - void ThreadFunc(Histogram* histogram, size_t thread_idx) GRPC_OVERRIDE { + bool ThreadFunc(Histogram* histogram, size_t thread_idx) GRPC_OVERRIDE { auto* stub = channels_[thread_idx % channels_.size()].get_stub(); double start = Timer::Now(); grpc::ClientContext context; grpc::Status s = stub->UnaryCall(&context, request_, &responses_[thread_idx]); histogram->Add((Timer::Now() - start) * 1e9); + return s.IsOk(); } }; @@ -111,11 +112,13 @@ class SynchronousStreamingClient GRPC_FINAL : public SynchronousClient { } } - void ThreadFunc(Histogram* histogram, size_t thread_idx) GRPC_OVERRIDE { + bool ThreadFunc(Histogram* histogram, size_t thread_idx) GRPC_OVERRIDE { double start = Timer::Now(); if (stream_->Write(request_) && stream_->Read(&responses_[thread_idx])) { histogram->Add((Timer::Now() - start) * 1e9); + return true; } + return false; } private: grpc::ClientContext context_; -- cgit v1.2.3 From 1c61af73643fff22f7e0dda08d73b812ffffcb9f Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 9 Apr 2015 12:08:44 -0700 Subject: Dont sleep forever on async cq --- test/cpp/qps/client_async.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc index fecff5c8ce..8b0619d5fc 100644 --- a/test/cpp/qps/client_async.cc +++ b/test/cpp/qps/client_async.cc @@ -176,7 +176,11 @@ class AsyncUnaryClient GRPC_FINAL : public Client { bool ThreadFunc(Histogram* histogram, size_t thread_idx) GRPC_OVERRIDE { void* got_tag; bool ok; - cli_cqs_[thread_idx]->Next(&got_tag, &ok); + switch (cli_cqs_[thread_idx]->AsyncNext(&got_tag, &ok, std::chrono::system_clock::now() + std::chrono::seconds(11))) { + case CompletionQueue::SHUTDOWN: return false; + case CompletionQueue::TIMEOUT: return true; + case CompletionQueue::GOT_EVENT: break; + } ClientRpcContext* ctx = ClientRpcContext::detag(got_tag); if (ctx->RunNextState(ok, histogram) == false) { @@ -306,7 +310,11 @@ class AsyncStreamingClient GRPC_FINAL : public Client { bool ThreadFunc(Histogram *histogram, size_t thread_idx) GRPC_OVERRIDE { void *got_tag; bool ok; - cli_cqs_[thread_idx]->Next(&got_tag, &ok); + switch (cli_cqs_[thread_idx]->AsyncNext(&got_tag, &ok, std::chrono::system_clock::now() + std::chrono::seconds(11))) { + case CompletionQueue::SHUTDOWN: return false; + case CompletionQueue::TIMEOUT: return true; + case CompletionQueue::GOT_EVENT: break; + } ClientRpcContext *ctx = ClientRpcContext::detag(got_tag); if (ctx->RunNextState(ok, histogram) == false) { -- cgit v1.2.3 From 8221e40ac0e11f4c4eea7c72dd962a0318686426 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 9 Apr 2015 12:23:21 -0700 Subject: Indentation fixes, s/11/1/g --- test/cpp/qps/client_async.cc | 2 +- test/cpp/qps/server_async.cc | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc index 8b0619d5fc..7e2850dd65 100644 --- a/test/cpp/qps/client_async.cc +++ b/test/cpp/qps/client_async.cc @@ -310,7 +310,7 @@ class AsyncStreamingClient GRPC_FINAL : public Client { bool ThreadFunc(Histogram *histogram, size_t thread_idx) GRPC_OVERRIDE { void *got_tag; bool ok; - switch (cli_cqs_[thread_idx]->AsyncNext(&got_tag, &ok, std::chrono::system_clock::now() + std::chrono::seconds(11))) { + switch (cli_cqs_[thread_idx]->AsyncNext(&got_tag, &ok, std::chrono::system_clock::now() + std::chrono::seconds(1))) { case CompletionQueue::SHUTDOWN: return false; case CompletionQueue::TIMEOUT: return true; case CompletionQueue::GOT_EVENT: break; diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc index 65c170af81..9a176638e8 100644 --- a/test/cpp/qps/server_async.cc +++ b/test/cpp/qps/server_async.cc @@ -97,15 +97,15 @@ class AsyncQpsServerTest : public Server { bool ok; void* got_tag; while (srv_cq_.Next(&got_tag, &ok)) { - ServerRpcContext* ctx = detag(got_tag); - // The tag is a pointer to an RPC context to invoke - if (ctx->RunNextState(ok) == false) { - // this RPC context is done, so refresh it + ServerRpcContext* ctx = detag(got_tag); + // The tag is a pointer to an RPC context to invoke + if (ctx->RunNextState(ok) == false) { + // this RPC context is done, so refresh it std::lock_guard g(shutdown_mutex_); if (!shutdown_) { ctx->Reset(); } - } + } } return; })); @@ -175,8 +175,9 @@ class AsyncQpsServerTest : public Server { private: bool finisher(bool) { return false; } bool invoker(bool ok) { - if (!ok) - return false; + if (!ok) { + return false; + } ResponseType response; @@ -230,8 +231,9 @@ class AsyncQpsServerTest : public Server { private: bool request_done(bool ok) { - if (!ok) - return false; + if (!ok) { + return false; + } stream_.Read(&req_, AsyncQpsServerTest::tag(this)); next_state_ = &ServerRpcContextStreamingImpl::read_done; return true; -- cgit v1.2.3 From e6b00382235a5d071598792f7046537290ef9ac6 Mon Sep 17 00:00:00 2001 From: Masood Malekghassemi Date: Thu, 9 Apr 2015 12:25:39 -0700 Subject: Add OAuth interop tests to Python Also adds the commands to the grpc_docker shell library script to support running in docker. --- src/python/interop/interop/_interop_test_case.py | 10 ++-- src/python/interop/interop/client.py | 24 ++++++++-- src/python/interop/interop/methods.py | 60 +++++++++++++++++++----- src/python/interop/setup.py | 2 +- tools/gce_setup/grpc_docker.sh | 29 ++++++++++++ 5 files changed, 103 insertions(+), 22 deletions(-) diff --git a/src/python/interop/interop/_interop_test_case.py b/src/python/interop/interop/_interop_test_case.py index fec8f1915d..cd6a574e90 100644 --- a/src/python/interop/interop/_interop_test_case.py +++ b/src/python/interop/interop/_interop_test_case.py @@ -40,16 +40,16 @@ class InteropTestCase(object): """ def testEmptyUnary(self): - methods.TestCase.EMPTY_UNARY.test_interoperability(self.stub) + methods.TestCase.EMPTY_UNARY.test_interoperability(self.stub, None) def testLargeUnary(self): - methods.TestCase.LARGE_UNARY.test_interoperability(self.stub) + methods.TestCase.LARGE_UNARY.test_interoperability(self.stub, None) def testServerStreaming(self): - methods.TestCase.SERVER_STREAMING.test_interoperability(self.stub) + methods.TestCase.SERVER_STREAMING.test_interoperability(self.stub, None) def testClientStreaming(self): - methods.TestCase.CLIENT_STREAMING.test_interoperability(self.stub) + methods.TestCase.CLIENT_STREAMING.test_interoperability(self.stub, None) def testPingPong(self): - methods.TestCase.PING_PONG.test_interoperability(self.stub) + methods.TestCase.PING_PONG.test_interoperability(self.stub, None) diff --git a/src/python/interop/interop/client.py b/src/python/interop/interop/client.py index 85a0dcd998..bae5e17460 100644 --- a/src/python/interop/interop/client.py +++ b/src/python/interop/interop/client.py @@ -30,6 +30,7 @@ """The Python implementation of the GRPC interoperability test client.""" import argparse +from oauth2client import client as oauth2client_client from grpc.early_adopter import implementations @@ -43,9 +44,6 @@ def _args(): parser = argparse.ArgumentParser() parser.add_argument( '--server_host', help='the host to which to connect', type=str) - parser.add_argument( - '--server_host_override', - help='the server host to which to claim to connect', type=str) parser.add_argument( '--server_port', help='the port to which to connect', type=int) parser.add_argument( @@ -56,10 +54,25 @@ def _args(): parser.add_argument( '--use_test_ca', help='replace platform root CAs with ca.pem', action='store_true') + parser.add_argument( + '--server_host_override', + help='the server host to which to claim to connect', type=str) + parser.add_argument('--oauth_scope', help='scope for OAuth tokens', type=str) + parser.add_argument( + '--default_service_account', + help='email address of the default service account', type=str) return parser.parse_args() +def _oauth_access_token(args): + credentials = client.GoogleCredentials.get_application_default() + scoped_credentials = credentials.create_scoped([args.oauth_scope]) + return scoped_credentials.get_access_token().access_token def _stub(args): + if args.oauth_scope: + metadata_transformer = lambda x: [('Authorization', 'Bearer %s' % _oauth_access_token(args))] + else: + metadata_transformer = lambda x: [] if args.use_tls: if args.use_test_ca: root_certificates = resources.test_root_certificates() @@ -68,7 +81,8 @@ def _stub(args): stub = implementations.stub( methods.SERVICE_NAME, methods.CLIENT_METHODS, args.server_host, - args.server_port, secure=True, root_certificates=root_certificates, + args.server_port, metadata_transformer=metadata_transformer, + secure=True, root_certificates=root_certificates, server_host_override=args.server_host_override) else: stub = implementations.stub( @@ -89,7 +103,7 @@ def _test_interoperability(): args = _args() stub = _stub(args) test_case = _test_case_from_arg(args.test_case) - test_case.test_interoperability(stub) + test_case.test_interoperability(stub, args) if __name__ == '__main__': diff --git a/src/python/interop/interop/methods.py b/src/python/interop/interop/methods.py index 79550a3789..c69771dff1 100644 --- a/src/python/interop/interop/methods.py +++ b/src/python/interop/interop/methods.py @@ -30,8 +30,12 @@ """Implementations of interoperability test methods.""" import enum +import json +import os import threading +from oauth2client import client as oauth2client_client + from grpc.framework.alpha import utilities from interop import empty_pb2 @@ -150,19 +154,12 @@ SERVER_METHODS = { } -def _empty_unary(stub): - with stub: - response = stub.EmptyCall(empty_pb2.Empty(), _TIMEOUT) - if not isinstance(response, empty_pb2.Empty): - raise TypeError( - 'response is of type "%s", not empty_pb2.Empty!', type(response)) - - -def _large_unary(stub): +def _large_unary_common_behavior(stub, fill_username, fill_oauth_scope): with stub: request = messages_pb2.SimpleRequest( response_type=messages_pb2.COMPRESSABLE, response_size=314159, - payload=messages_pb2.Payload(body=b'\x00' * 271828)) + payload=messages_pb2.Payload(body=b'\x00' * 271828), + fill_username=fill_username, fill_oauth_scope=fill_oauth_scope) response_future = stub.UnaryCall.async(request, _TIMEOUT) response = response_future.result() if response.payload.type is not messages_pb2.COMPRESSABLE: @@ -171,6 +168,19 @@ def _large_unary(stub): if len(response.payload.body) != 314159: raise ValueError( 'response body of incorrect size %d!' % len(response.payload.body)) + return response + + +def _empty_unary(stub): + with stub: + response = stub.EmptyCall(empty_pb2.Empty(), _TIMEOUT) + if not isinstance(response, empty_pb2.Empty): + raise TypeError( + 'response is of type "%s", not empty_pb2.Empty!', type(response)) + + +def _large_unary(stub): + _large_unary_common_behavior(stub, False, False) def _client_streaming(stub): @@ -266,6 +276,28 @@ def _ping_pong(stub): pipe.close() +def _compute_engine_creds(stub, args): + response = _large_unary_common_behavior(stub, True, True) + if args.default_service_account != response.username: + raise ValueError( + 'expected username %s, got %s' % (args.default_service_account, + response.username)) + + +def _service_account_creds(stub, args): + json_key_filename = os.environ[ + oauth2client_client.GOOGLE_APPLICATION_CREDENTIALS] + wanted_email = json.load(open(json_key_filename, 'rb'))['client_email'] + response = _large_unary_common_behavior(stub, True, True) + if wanted_email != response.username: + raise ValueError( + 'expected username %s, got %s' % (wanted_email, response.username)) + if response.oauth_scope in args.oauth_scope: + raise ValueError( + 'expected to find oauth scope "%s" in received "%s"' % + (response.oauth_scope, args.oauth_scope)) + + @enum.unique class TestCase(enum.Enum): EMPTY_UNARY = 'empty_unary' @@ -273,8 +305,10 @@ class TestCase(enum.Enum): SERVER_STREAMING = 'server_streaming' CLIENT_STREAMING = 'client_streaming' PING_PONG = 'ping_pong' + COMPUTE_ENGINE_CREDS = 'compute_engine_creds' + SERVICE_ACCOUNT_CREDS = 'service_account_creds' - def test_interoperability(self, stub): + def test_interoperability(self, stub, args): if self is TestCase.EMPTY_UNARY: _empty_unary(stub) elif self is TestCase.LARGE_UNARY: @@ -285,5 +319,9 @@ class TestCase(enum.Enum): _client_streaming(stub) elif self is TestCase.PING_PONG: _ping_pong(stub) + elif self is TestCase.COMPUTE_ENGINE_CREDS: + _compute_engine_creds(stub, args) + elif self is TestCase.SERVICE_ACCOUNT_CREDS: + _service_account_creds(stub, args) else: raise NotImplementedError('Test case "%s" not implemented!' % self.name) diff --git a/src/python/interop/setup.py b/src/python/interop/setup.py index 7a329924a5..502fcbedd8 100644 --- a/src/python/interop/setup.py +++ b/src/python/interop/setup.py @@ -45,7 +45,7 @@ _PACKAGE_DATA = { 'credentials/server1.pem',] } -_INSTALL_REQUIRES = ['grpcio>=0.4.0a4'] +_INSTALL_REQUIRES = ['oauth2client>=1.4.7', 'grpcio>=0.4.0a4'] setuptools.setup( name='interop', diff --git a/tools/gce_setup/grpc_docker.sh b/tools/gce_setup/grpc_docker.sh index dc480983ff..40634291cf 100755 --- a/tools/gce_setup/grpc_docker.sh +++ b/tools/gce_setup/grpc_docker.sh @@ -1041,6 +1041,35 @@ grpc_interop_gen_python_cmd() { echo $the_cmd } +# constructs the full dockerized python service_account auth interop test cmd. +# +# call-seq: +# flags= .... # generic flags to include the command +# cmd=$($grpc_gen_test_cmd $flags) +grpc_cloud_prod_auth_service_account_creds_gen_python_cmd() { + local cmd_prefix="sudo docker run grpc/ruby bin/bash -l -c"; + local gfe_flags=$(_grpc_prod_gfe_flags) + local added_gfe_flags=$(_grpc_default_creds_test_flags) + local env_prefix="SSL_CERT_FILE=/cacerts/roots.pem" + env_prefix+=" GOOGLE_APPLICATION_CREDENTIALS=/service_account/stubbyCloudTestingTest-7dd63462c60c.json" + local the_cmd="$cmd_prefix '$env_prefix python -B -m interop.client --use_tls $gfe_flags $added_gfe_flags $@'" + echo $the_cmd +} + +# constructs the full dockerized python gce auth interop test cmd. +# +# call-seq: +# flags= .... # generic flags to include the command +# cmd=$($grpc_gen_test_cmd $flags) +grpc_cloud_prod_auth_compute_engine_creds_gen_python_cmd() { + local cmd_prefix="sudo docker run grpc/ruby bin/bash -l -c"; + local gfe_flags=$(_grpc_prod_gfe_flags) + local added_gfe_flags=$(_grpc_gce_test_flags) + local env_prefix="SSL_CERT_FILE=/cacerts/roots.pem" + local the_cmd="$cmd_prefix '$env_prefix python -B -m interop.client --use_tls $gfe_flags $added_gfe_flags $@'" + echo $the_cmd +} + # constructs the full dockerized java interop test cmd. # # call-seq: -- cgit v1.2.3 From 206d59a56a0224e0a99d05e9cec7ad1c130f1af0 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 9 Apr 2015 20:06:33 +0000 Subject: fine tuning --- test/cpp/qps/smoke_test.cc | 8 ++++---- test/cpp/qps/smoke_test.sh | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/cpp/qps/smoke_test.cc b/test/cpp/qps/smoke_test.cc index 85dca1f67b..a6b5ef60a5 100644 --- a/test/cpp/qps/smoke_test.cc +++ b/test/cpp/qps/smoke_test.cc @@ -55,7 +55,7 @@ static void RunSynchronousUnaryPingPong() { server_config.set_enable_ssl(false); server_config.set_threads(1); - auto result = RunScenario(client_config, 1, server_config, 1, 5, 15); + auto result = RunScenario(client_config, 1, server_config, 1, 30, 120); gpr_log(GPR_INFO, "QPS: %.1f", result.latencies.Count() / @@ -84,7 +84,7 @@ static void RunSynchronousStreamingPingPong() { server_config.set_enable_ssl(false); server_config.set_threads(1); - auto result = RunScenario(client_config, 1, server_config, 1, 5, 15); + auto result = RunScenario(client_config, 1, server_config, 1, 30, 120); gpr_log(GPR_INFO, "QPS: %.1f", result.latencies.Count() / @@ -114,7 +114,7 @@ static void RunAsyncUnaryPingPong() { server_config.set_enable_ssl(false); server_config.set_threads(1); - auto result = RunScenario(client_config, 1, server_config, 1, 5, 15); + auto result = RunScenario(client_config, 1, server_config, 1, 30, 120); gpr_log(GPR_INFO, "QPS: %.1f", result.latencies.Count() / @@ -144,7 +144,7 @@ static void RunQPS() { server_config.set_enable_ssl(false); server_config.set_threads(4); - auto result = RunScenario(client_config, 1, server_config, 1, 10, 30); + auto result = RunScenario(client_config, 1, server_config, 1, 30, 120); auto qps = result.latencies.Count() / diff --git a/test/cpp/qps/smoke_test.sh b/test/cpp/qps/smoke_test.sh index ba7f0a4f27..431a29705e 100755 --- a/test/cpp/qps/smoke_test.sh +++ b/test/cpp/qps/smoke_test.sh @@ -8,7 +8,7 @@ cd $(dirname $0)/../../.. killall qps_worker || true -config=opt +config=dbg NUMCPUS=`python2.7 -c 'import multiprocessing; print multiprocessing.cpu_count()'` -- cgit v1.2.3 From 0caebbfcfe45a6469b7ff6744fffe2e0a4871485 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Thu, 9 Apr 2015 23:08:51 +0200 Subject: Splitting gRPC service class codegen into its own set of files. --- Makefile | 118 ++++++++++++++++++------ examples/pubsub/publisher.h | 2 +- examples/pubsub/subscriber.h | 2 +- src/compiler/cpp_generator.cc | 153 +++++++++++++++++++++++++++++-- src/compiler/cpp_generator.h | 19 +++- src/compiler/cpp_plugin.cc | 36 +++++--- templates/Makefile.template | 16 ++-- test/cpp/end2end/async_end2end_test.cc | 4 +- test/cpp/end2end/end2end_test.cc | 4 +- test/cpp/end2end/generic_end2end_test.cc | 2 +- test/cpp/interop/client.cc | 6 +- test/cpp/interop/server.cc | 6 +- test/cpp/qps/client.h | 2 +- test/cpp/qps/client_async.cc | 2 +- test/cpp/qps/client_sync.cc | 2 +- test/cpp/qps/driver.h | 2 +- test/cpp/qps/histogram.h | 2 +- test/cpp/qps/server.h | 2 +- test/cpp/qps/server_async.cc | 2 +- test/cpp/qps/server_sync.cc | 2 +- test/cpp/qps/worker.cc | 2 +- test/cpp/util/cli_call_test.cc | 2 +- 22 files changed, 302 insertions(+), 86 deletions(-) diff --git a/Makefile b/Makefile index 8e01bb88dc..c50eb8c0cb 100644 --- a/Makefile +++ b/Makefile @@ -2001,92 +2001,152 @@ endif ifeq ($(NO_PROTOC),true) $(GENDIR)/examples/pubsub/empty.pb.cc: protoc_dep_error +$(GENDIR)/examples/pubsub/empty.grpc.pb.cc: protoc_dep_error else $(GENDIR)/examples/pubsub/empty.pb.cc: examples/pubsub/empty.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(E) "[PROTOC] Generating protobuf CC file from $<" $(Q) mkdir -p `dirname $@` - $(Q) $(PROTOC) --cpp_out=$(GENDIR) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $< + $(Q) $(PROTOC) --cpp_out=$(GENDIR) $< + +$(GENDIR)/examples/pubsub/empty.grpc.pb.cc: examples/pubsub/empty.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) + $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" + $(Q) mkdir -p `dirname $@` + $(Q) $(PROTOC) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $< endif ifeq ($(NO_PROTOC),true) $(GENDIR)/examples/pubsub/label.pb.cc: protoc_dep_error +$(GENDIR)/examples/pubsub/label.grpc.pb.cc: protoc_dep_error else $(GENDIR)/examples/pubsub/label.pb.cc: examples/pubsub/label.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(E) "[PROTOC] Generating protobuf CC file from $<" $(Q) mkdir -p `dirname $@` - $(Q) $(PROTOC) --cpp_out=$(GENDIR) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $< + $(Q) $(PROTOC) --cpp_out=$(GENDIR) $< + +$(GENDIR)/examples/pubsub/label.grpc.pb.cc: examples/pubsub/label.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) + $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" + $(Q) mkdir -p `dirname $@` + $(Q) $(PROTOC) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $< endif ifeq ($(NO_PROTOC),true) $(GENDIR)/examples/pubsub/pubsub.pb.cc: protoc_dep_error +$(GENDIR)/examples/pubsub/pubsub.grpc.pb.cc: protoc_dep_error else $(GENDIR)/examples/pubsub/pubsub.pb.cc: examples/pubsub/pubsub.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(E) "[PROTOC] Generating protobuf CC file from $<" $(Q) mkdir -p `dirname $@` - $(Q) $(PROTOC) --cpp_out=$(GENDIR) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $< + $(Q) $(PROTOC) --cpp_out=$(GENDIR) $< + +$(GENDIR)/examples/pubsub/pubsub.grpc.pb.cc: examples/pubsub/pubsub.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) + $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" + $(Q) mkdir -p `dirname $@` + $(Q) $(PROTOC) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $< endif ifeq ($(NO_PROTOC),true) $(GENDIR)/test/cpp/interop/empty.pb.cc: protoc_dep_error +$(GENDIR)/test/cpp/interop/empty.grpc.pb.cc: protoc_dep_error else $(GENDIR)/test/cpp/interop/empty.pb.cc: test/cpp/interop/empty.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(E) "[PROTOC] Generating protobuf CC file from $<" $(Q) mkdir -p `dirname $@` - $(Q) $(PROTOC) --cpp_out=$(GENDIR) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $< + $(Q) $(PROTOC) --cpp_out=$(GENDIR) $< + +$(GENDIR)/test/cpp/interop/empty.grpc.pb.cc: test/cpp/interop/empty.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) + $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" + $(Q) mkdir -p `dirname $@` + $(Q) $(PROTOC) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $< endif ifeq ($(NO_PROTOC),true) $(GENDIR)/test/cpp/interop/messages.pb.cc: protoc_dep_error +$(GENDIR)/test/cpp/interop/messages.grpc.pb.cc: protoc_dep_error else $(GENDIR)/test/cpp/interop/messages.pb.cc: test/cpp/interop/messages.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(E) "[PROTOC] Generating protobuf CC file from $<" $(Q) mkdir -p `dirname $@` - $(Q) $(PROTOC) --cpp_out=$(GENDIR) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $< + $(Q) $(PROTOC) --cpp_out=$(GENDIR) $< + +$(GENDIR)/test/cpp/interop/messages.grpc.pb.cc: test/cpp/interop/messages.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) + $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" + $(Q) mkdir -p `dirname $@` + $(Q) $(PROTOC) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $< endif ifeq ($(NO_PROTOC),true) $(GENDIR)/test/cpp/interop/test.pb.cc: protoc_dep_error +$(GENDIR)/test/cpp/interop/test.grpc.pb.cc: protoc_dep_error else $(GENDIR)/test/cpp/interop/test.pb.cc: test/cpp/interop/test.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(E) "[PROTOC] Generating protobuf CC file from $<" $(Q) mkdir -p `dirname $@` - $(Q) $(PROTOC) --cpp_out=$(GENDIR) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $< + $(Q) $(PROTOC) --cpp_out=$(GENDIR) $< + +$(GENDIR)/test/cpp/interop/test.grpc.pb.cc: test/cpp/interop/test.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) + $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" + $(Q) mkdir -p `dirname $@` + $(Q) $(PROTOC) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $< endif ifeq ($(NO_PROTOC),true) $(GENDIR)/test/cpp/qps/qpstest.pb.cc: protoc_dep_error +$(GENDIR)/test/cpp/qps/qpstest.grpc.pb.cc: protoc_dep_error else $(GENDIR)/test/cpp/qps/qpstest.pb.cc: test/cpp/qps/qpstest.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(E) "[PROTOC] Generating protobuf CC file from $<" $(Q) mkdir -p `dirname $@` - $(Q) $(PROTOC) --cpp_out=$(GENDIR) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $< + $(Q) $(PROTOC) --cpp_out=$(GENDIR) $< + +$(GENDIR)/test/cpp/qps/qpstest.grpc.pb.cc: test/cpp/qps/qpstest.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) + $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" + $(Q) mkdir -p `dirname $@` + $(Q) $(PROTOC) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $< endif ifeq ($(NO_PROTOC),true) $(GENDIR)/test/cpp/util/echo.pb.cc: protoc_dep_error +$(GENDIR)/test/cpp/util/echo.grpc.pb.cc: protoc_dep_error else $(GENDIR)/test/cpp/util/echo.pb.cc: test/cpp/util/echo.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(E) "[PROTOC] Generating protobuf CC file from $<" $(Q) mkdir -p `dirname $@` - $(Q) $(PROTOC) --cpp_out=$(GENDIR) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $< + $(Q) $(PROTOC) --cpp_out=$(GENDIR) $< + +$(GENDIR)/test/cpp/util/echo.grpc.pb.cc: test/cpp/util/echo.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) + $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" + $(Q) mkdir -p `dirname $@` + $(Q) $(PROTOC) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $< endif ifeq ($(NO_PROTOC),true) $(GENDIR)/test/cpp/util/echo_duplicate.pb.cc: protoc_dep_error +$(GENDIR)/test/cpp/util/echo_duplicate.grpc.pb.cc: protoc_dep_error else $(GENDIR)/test/cpp/util/echo_duplicate.pb.cc: test/cpp/util/echo_duplicate.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(E) "[PROTOC] Generating protobuf CC file from $<" $(Q) mkdir -p `dirname $@` - $(Q) $(PROTOC) --cpp_out=$(GENDIR) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $< + $(Q) $(PROTOC) --cpp_out=$(GENDIR) $< + +$(GENDIR)/test/cpp/util/echo_duplicate.grpc.pb.cc: test/cpp/util/echo_duplicate.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) + $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" + $(Q) mkdir -p `dirname $@` + $(Q) $(PROTOC) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $< endif ifeq ($(NO_PROTOC),true) $(GENDIR)/test/cpp/util/messages.pb.cc: protoc_dep_error +$(GENDIR)/test/cpp/util/messages.grpc.pb.cc: protoc_dep_error else $(GENDIR)/test/cpp/util/messages.pb.cc: test/cpp/util/messages.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(E) "[PROTOC] Generating protobuf CC file from $<" $(Q) mkdir -p `dirname $@` - $(Q) $(PROTOC) --cpp_out=$(GENDIR) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $< + $(Q) $(PROTOC) --cpp_out=$(GENDIR) $< + +$(GENDIR)/test/cpp/util/messages.grpc.pb.cc: test/cpp/util/messages.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) + $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" + $(Q) mkdir -p `dirname $@` + $(Q) $(PROTOC) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $< endif @@ -3417,9 +3477,9 @@ $(OBJDIR)/$(CONFIG)/src/cpp/util/time.o: LIBGRPC++_TEST_UTIL_SRC = \ - $(GENDIR)/test/cpp/util/messages.pb.cc \ - $(GENDIR)/test/cpp/util/echo.pb.cc \ - $(GENDIR)/test/cpp/util/echo_duplicate.pb.cc \ + $(GENDIR)/test/cpp/util/messages.pb.cc $(GENDIR)/test/cpp/util/messages.grpc.pb.cc \ + $(GENDIR)/test/cpp/util/echo.pb.cc $(GENDIR)/test/cpp/util/echo.grpc.pb.cc \ + $(GENDIR)/test/cpp/util/echo_duplicate.pb.cc $(GENDIR)/test/cpp/util/echo_duplicate.grpc.pb.cc \ test/cpp/util/cli_call.cc \ test/cpp/util/create_test_channel.cc \ @@ -3480,8 +3540,8 @@ endif -$(OBJDIR)/$(CONFIG)/test/cpp/util/cli_call.o: $(GENDIR)/test/cpp/util/messages.pb.cc $(GENDIR)/test/cpp/util/echo.pb.cc $(GENDIR)/test/cpp/util/echo_duplicate.pb.cc -$(OBJDIR)/$(CONFIG)/test/cpp/util/create_test_channel.o: $(GENDIR)/test/cpp/util/messages.pb.cc $(GENDIR)/test/cpp/util/echo.pb.cc $(GENDIR)/test/cpp/util/echo_duplicate.pb.cc +$(OBJDIR)/$(CONFIG)/test/cpp/util/cli_call.o: $(GENDIR)/test/cpp/util/messages.pb.cc $(GENDIR)/test/cpp/util/messages.grpc.pb.cc $(GENDIR)/test/cpp/util/echo.pb.cc $(GENDIR)/test/cpp/util/echo.grpc.pb.cc $(GENDIR)/test/cpp/util/echo_duplicate.pb.cc $(GENDIR)/test/cpp/util/echo_duplicate.grpc.pb.cc +$(OBJDIR)/$(CONFIG)/test/cpp/util/create_test_channel.o: $(GENDIR)/test/cpp/util/messages.pb.cc $(GENDIR)/test/cpp/util/messages.grpc.pb.cc $(GENDIR)/test/cpp/util/echo.pb.cc $(GENDIR)/test/cpp/util/echo.grpc.pb.cc $(GENDIR)/test/cpp/util/echo_duplicate.pb.cc $(GENDIR)/test/cpp/util/echo_duplicate.grpc.pb.cc LIBGRPC++_UNSECURE_SRC = \ @@ -3658,9 +3718,9 @@ $(OBJDIR)/$(CONFIG)/src/compiler/ruby_generator.o: LIBPUBSUB_CLIENT_LIB_SRC = \ - $(GENDIR)/examples/pubsub/label.pb.cc \ - $(GENDIR)/examples/pubsub/empty.pb.cc \ - $(GENDIR)/examples/pubsub/pubsub.pb.cc \ + $(GENDIR)/examples/pubsub/label.pb.cc $(GENDIR)/examples/pubsub/label.grpc.pb.cc \ + $(GENDIR)/examples/pubsub/empty.pb.cc $(GENDIR)/examples/pubsub/empty.grpc.pb.cc \ + $(GENDIR)/examples/pubsub/pubsub.pb.cc $(GENDIR)/examples/pubsub/pubsub.grpc.pb.cc \ examples/pubsub/publisher.cc \ examples/pubsub/subscriber.cc \ @@ -3721,12 +3781,12 @@ endif -$(OBJDIR)/$(CONFIG)/examples/pubsub/publisher.o: $(GENDIR)/examples/pubsub/label.pb.cc $(GENDIR)/examples/pubsub/empty.pb.cc $(GENDIR)/examples/pubsub/pubsub.pb.cc -$(OBJDIR)/$(CONFIG)/examples/pubsub/subscriber.o: $(GENDIR)/examples/pubsub/label.pb.cc $(GENDIR)/examples/pubsub/empty.pb.cc $(GENDIR)/examples/pubsub/pubsub.pb.cc +$(OBJDIR)/$(CONFIG)/examples/pubsub/publisher.o: $(GENDIR)/examples/pubsub/label.pb.cc $(GENDIR)/examples/pubsub/label.grpc.pb.cc $(GENDIR)/examples/pubsub/empty.pb.cc $(GENDIR)/examples/pubsub/empty.grpc.pb.cc $(GENDIR)/examples/pubsub/pubsub.pb.cc $(GENDIR)/examples/pubsub/pubsub.grpc.pb.cc +$(OBJDIR)/$(CONFIG)/examples/pubsub/subscriber.o: $(GENDIR)/examples/pubsub/label.pb.cc $(GENDIR)/examples/pubsub/label.grpc.pb.cc $(GENDIR)/examples/pubsub/empty.pb.cc $(GENDIR)/examples/pubsub/empty.grpc.pb.cc $(GENDIR)/examples/pubsub/pubsub.pb.cc $(GENDIR)/examples/pubsub/pubsub.grpc.pb.cc LIBQPS_SRC = \ - $(GENDIR)/test/cpp/qps/qpstest.pb.cc \ + $(GENDIR)/test/cpp/qps/qpstest.pb.cc $(GENDIR)/test/cpp/qps/qpstest.grpc.pb.cc \ test/cpp/qps/driver.cc \ test/cpp/qps/timer.cc \ @@ -3783,8 +3843,8 @@ endif endif -$(OBJDIR)/$(CONFIG)/test/cpp/qps/driver.o: $(GENDIR)/test/cpp/qps/qpstest.pb.cc -$(OBJDIR)/$(CONFIG)/test/cpp/qps/timer.o: $(GENDIR)/test/cpp/qps/qpstest.pb.cc +$(OBJDIR)/$(CONFIG)/test/cpp/qps/driver.o: $(GENDIR)/test/cpp/qps/qpstest.pb.cc $(GENDIR)/test/cpp/qps/qpstest.grpc.pb.cc +$(OBJDIR)/$(CONFIG)/test/cpp/qps/timer.o: $(GENDIR)/test/cpp/qps/qpstest.pb.cc $(GENDIR)/test/cpp/qps/qpstest.grpc.pb.cc LIBGRPC_CSHARP_EXT_SRC = \ @@ -8426,9 +8486,9 @@ endif INTEROP_CLIENT_SRC = \ - $(GENDIR)/test/cpp/interop/empty.pb.cc \ - $(GENDIR)/test/cpp/interop/messages.pb.cc \ - $(GENDIR)/test/cpp/interop/test.pb.cc \ + $(GENDIR)/test/cpp/interop/empty.pb.cc $(GENDIR)/test/cpp/interop/empty.grpc.pb.cc \ + $(GENDIR)/test/cpp/interop/messages.pb.cc $(GENDIR)/test/cpp/interop/messages.grpc.pb.cc \ + $(GENDIR)/test/cpp/interop/test.pb.cc $(GENDIR)/test/cpp/interop/test.grpc.pb.cc \ test/cpp/interop/client.cc \ INTEROP_CLIENT_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(INTEROP_CLIENT_SRC)))) @@ -8474,9 +8534,9 @@ endif INTEROP_SERVER_SRC = \ - $(GENDIR)/test/cpp/interop/empty.pb.cc \ - $(GENDIR)/test/cpp/interop/messages.pb.cc \ - $(GENDIR)/test/cpp/interop/test.pb.cc \ + $(GENDIR)/test/cpp/interop/empty.pb.cc $(GENDIR)/test/cpp/interop/empty.grpc.pb.cc \ + $(GENDIR)/test/cpp/interop/messages.pb.cc $(GENDIR)/test/cpp/interop/messages.grpc.pb.cc \ + $(GENDIR)/test/cpp/interop/test.pb.cc $(GENDIR)/test/cpp/interop/test.grpc.pb.cc \ test/cpp/interop/server.cc \ INTEROP_SERVER_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(INTEROP_SERVER_SRC)))) diff --git a/examples/pubsub/publisher.h b/examples/pubsub/publisher.h index c90406ffef..33bcf98df4 100644 --- a/examples/pubsub/publisher.h +++ b/examples/pubsub/publisher.h @@ -37,7 +37,7 @@ #include #include -#include "examples/pubsub/pubsub.pb.h" +#include "examples/pubsub/pubsub.grpc.pb.h" namespace grpc { namespace examples { diff --git a/examples/pubsub/subscriber.h b/examples/pubsub/subscriber.h index c587c01b82..40ab45471d 100644 --- a/examples/pubsub/subscriber.h +++ b/examples/pubsub/subscriber.h @@ -37,7 +37,7 @@ #include #include -#include "examples/pubsub/pubsub.pb.h" +#include "examples/pubsub/pubsub.grpc.pb.h" namespace grpc { namespace examples { diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index 0a84c73520..c78f0333d8 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -109,8 +109,47 @@ bool HasBidiStreaming(const grpc::protobuf::FileDescriptor *file) { } return false; } + +grpc::string FilenameIdentifier(const grpc::string& filename) { + grpc::string result; + for (unsigned i = 0; i < filename.size(); i++) { + char c = filename[i]; + if (isalnum(c)) { + result.push_back(c); + } else { + static char hex[] = "0123456789abcdef"; + result.push_back('_'); + result.push_back(hex[(c >> 4) & 0xf]); + result.push_back(hex[c & 0xf]); + } + } + return result; +} } // namespace +grpc::string GetHeaderPrologue(const grpc::protobuf::FileDescriptor *file, + const Parameters ¶ms) { + grpc::string output; + grpc::protobuf::io::StringOutputStream output_stream(&output); + grpc::protobuf::io::Printer printer(&output_stream, '$'); + std::map vars; + + vars["filename"] = file->name(); + vars["filename_identifier"] = FilenameIdentifier(file->name()); + vars["filename_base"] = grpc_generator::StripProto(file->name()); + + printer.Print(vars, "// Generated by the gRPC protobuf plugin.\n"); + printer.Print(vars, "// If you make any local change, they will be lost.\n"); + printer.Print(vars, "// source: $filename$\n"); + printer.Print(vars, "#ifndef GRPC_$filename_identifier$__INCLUDED\n"); + printer.Print(vars, "#define GRPC_$filename_identifier$__INCLUDED\n"); + printer.Print(vars, "\n"); + printer.Print(vars, "#include \"$filename_base$.pb.h\"\n"); + printer.Print(vars, "\n"); + + return output; +} + grpc::string GetHeaderIncludes(const grpc::protobuf::FileDescriptor *file, const Parameters ¶ms) { grpc::string temp = @@ -156,17 +195,21 @@ grpc::string GetHeaderIncludes(const grpc::protobuf::FileDescriptor *file, "class ServerAsyncReaderWriter;\n"); } temp.append("} // namespace grpc\n"); - return temp; -} -grpc::string GetSourceIncludes(const Parameters ¶m) { - return "#include \n" - "#include \n" - "#include \n" - "#include \n" - "#include \n" - "#include \n" - "#include \n"; + temp.append("\n"); + + std::vector parts = + grpc_generator::tokenize(file->package(), "."); + + for (auto part = parts.begin(); part != parts.end(); part++) { + temp.append("namespace "); + temp.append(*part); + temp.append(" {\n"); + } + + temp.append("\n"); + + return temp; } void PrintHeaderClientMethod(grpc::protobuf::io::Printer *printer, @@ -378,6 +421,78 @@ grpc::string GetHeaderServices(const grpc::protobuf::FileDescriptor *file, return output; } +grpc::string GetHeaderEpilogue(const grpc::protobuf::FileDescriptor *file, + const Parameters ¶ms) { + grpc::string output; + grpc::protobuf::io::StringOutputStream output_stream(&output); + grpc::protobuf::io::Printer printer(&output_stream, '$'); + std::map vars; + + vars["filename"] = file->name(); + vars["filename_identifier"] = FilenameIdentifier(file->name()); + + std::vector parts = + grpc_generator::tokenize(file->package(), "."); + + for (auto part = parts.rbegin(); part != parts.rend(); part++) { + vars["part"] = *part; + printer.Print(vars, "} // namespace $part$\n"); + } + + printer.Print(vars, "\n\n"); + printer.Print(vars, "#endif // GRPC_$filename_identifier$__INCLUDED\n"); + + return output; +} + +grpc::string GetSourcePrologue(const grpc::protobuf::FileDescriptor *file, + const Parameters ¶ms) { + grpc::string output; + grpc::protobuf::io::StringOutputStream output_stream(&output); + grpc::protobuf::io::Printer printer(&output_stream, '$'); + std::map vars; + + vars["filename"] = file->name(); + vars["filename_base"] = grpc_generator::StripProto(file->name()); + + printer.Print(vars, "// Generated by the gRPC protobuf plugin.\n"); + printer.Print(vars, "// If you make any local change, they will be lost.\n"); + printer.Print(vars, "// source: $filename$\n\n"); + printer.Print(vars, "#include \"$filename_base$.pb.h\"\n"); + printer.Print(vars, "#include \"$filename_base$.grpc.pb.h\"\n"); + printer.Print(vars, "\n"); + + return output; +} + +grpc::string GetSourceIncludes(const grpc::protobuf::FileDescriptor *file, + const Parameters ¶m) { + grpc::string output; + grpc::protobuf::io::StringOutputStream output_stream(&output); + grpc::protobuf::io::Printer printer(&output_stream, '$'); + std::map vars; + + printer.Print(vars, "#include \n"); + printer.Print(vars, "#include \n"); + printer.Print(vars, "#include \n"); + printer.Print(vars, "#include \n"); + printer.Print(vars, "#include \n"); + printer.Print(vars, "#include \n"); + printer.Print(vars, "#include \n"); + + std::vector parts = + grpc_generator::tokenize(file->package(), "."); + + for (auto part = parts.begin(); part != parts.end(); part++) { + vars["part"] = *part; + printer.Print(vars, "namespace $part$ {\n"); + } + + printer.Print(vars, "\n"); + + return output; +} + void PrintSourceClientMethod(grpc::protobuf::io::Printer *printer, const grpc::protobuf::MethodDescriptor *method, std::map *vars) { @@ -741,4 +856,22 @@ grpc::string GetSourceServices(const grpc::protobuf::FileDescriptor *file, return output; } +grpc::string GetSourceEpilogue(const grpc::protobuf::FileDescriptor *file, + const Parameters ¶ms) { + grpc::string temp; + + std::vector parts = + grpc_generator::tokenize(file->package(), "."); + + for (auto part = parts.begin(); part != parts.end(); part++) { + temp.append("} // namespace "); + temp.append(*part); + temp.append("\n"); + } + + temp.append("\n"); + + return temp; +} + } // namespace grpc_cpp_generator diff --git a/src/compiler/cpp_generator.h b/src/compiler/cpp_generator.h index 04ad71c067..70c2e985f6 100644 --- a/src/compiler/cpp_generator.h +++ b/src/compiler/cpp_generator.h @@ -44,12 +44,25 @@ struct Parameters { grpc::string services_namespace; }; +// Return the prologue of the generated header file. +grpc::string GetHeaderPrologue(const grpc::protobuf::FileDescriptor *file, + const Parameters ¶ms); + // Return the includes needed for generated header file. grpc::string GetHeaderIncludes(const grpc::protobuf::FileDescriptor *file, const Parameters ¶ms); // Return the includes needed for generated source file. -grpc::string GetSourceIncludes(const Parameters ¶ms); +grpc::string GetSourceIncludes(const grpc::protobuf::FileDescriptor *file, + const Parameters ¶ms); + +// Return the epilogue of the generated header file. +grpc::string GetHeaderEpilogue(const grpc::protobuf::FileDescriptor *file, + const Parameters ¶ms); + +// Return the prologue of the generated source file. +grpc::string GetSourcePrologue(const grpc::protobuf::FileDescriptor *file, + const Parameters ¶ms); // Return the services for generated header file. grpc::string GetHeaderServices(const grpc::protobuf::FileDescriptor *file, @@ -59,6 +72,10 @@ grpc::string GetHeaderServices(const grpc::protobuf::FileDescriptor *file, grpc::string GetSourceServices(const grpc::protobuf::FileDescriptor *file, const Parameters ¶ms); +// Return the epilogue of the generated source file. +grpc::string GetSourceEpilogue(const grpc::protobuf::FileDescriptor *file, + const Parameters ¶ms); + } // namespace grpc_cpp_generator #endif // GRPC_INTERNAL_COMPILER_CPP_GENERATOR_H diff --git a/src/compiler/cpp_plugin.cc b/src/compiler/cpp_plugin.cc index acbe128213..88c704948e 100644 --- a/src/compiler/cpp_plugin.cc +++ b/src/compiler/cpp_plugin.cc @@ -58,11 +58,6 @@ class CppGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { return false; } - if (file->service_count() == 0) { - // No services. Do nothing. - return true; - } - grpc_cpp_generator::Parameters generator_parameters; if (!parameter.empty()) { @@ -84,16 +79,27 @@ class CppGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { grpc::string file_name = grpc_generator::StripProto(file->name()); - // Generate .pb.h - Insert(context, file_name + ".pb.h", "includes", - grpc_cpp_generator::GetHeaderIncludes(file, generator_parameters)); - Insert(context, file_name + ".pb.h", "namespace_scope", - grpc_cpp_generator::GetHeaderServices(file, generator_parameters)); - // Generate .pb.cc - Insert(context, file_name + ".pb.cc", "includes", - grpc_cpp_generator::GetSourceIncludes(generator_parameters)); - Insert(context, file_name + ".pb.cc", "namespace_scope", - grpc_cpp_generator::GetSourceServices(file, generator_parameters)); + grpc::string header_code = + grpc_cpp_generator::GetHeaderPrologue(file, generator_parameters) + + grpc_cpp_generator::GetHeaderIncludes(file, generator_parameters) + + grpc_cpp_generator::GetHeaderServices(file, generator_parameters) + + grpc_cpp_generator::GetHeaderEpilogue(file, generator_parameters); + std::unique_ptr header_output( + context->Open(file_name + ".grpc.pb.h")); + grpc::protobuf::io::CodedOutputStream header_coded_out( + header_output.get()); + header_coded_out.WriteRaw(header_code.data(), header_code.size()); + + grpc::string source_code = + grpc_cpp_generator::GetSourcePrologue(file, generator_parameters) + + grpc_cpp_generator::GetSourceIncludes(file, generator_parameters) + + grpc_cpp_generator::GetSourceServices(file, generator_parameters) + + grpc_cpp_generator::GetSourceEpilogue(file, generator_parameters); + std::unique_ptr source_output( + context->Open(file_name + ".grpc.pb.cc")); + grpc::protobuf::io::CodedOutputStream source_coded_out( + source_output.get()); + source_coded_out.WriteRaw(source_code.data(), source_code.size()); return true; } diff --git a/templates/Makefile.template b/templates/Makefile.template index 848ee87bbc..776ee7a49b 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -35,17 +35,11 @@ proto_re = re.compile('(.*)\\.proto') - def excluded(filename, exclude_res): - for r in exclude_res: - if r.match(filename): - return True - return False - def proto_to_cc(filename): m = proto_re.match(filename) if not m: return filename - return '$(GENDIR)/' + m.group(1) + '.pb.cc' + return '$(GENDIR)/' + m.group(1) + '.pb.cc $(GENDIR)/' + m.group(1) + '.grpc.pb.cc' %> @@ -840,11 +834,17 @@ endif % for p in protos: ifeq ($(NO_PROTOC),true) $(GENDIR)/${p}.pb.cc: protoc_dep_error +$(GENDIR)/${p}.grpc.pb.cc: protoc_dep_error else $(GENDIR)/${p}.pb.cc: ${p}.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(E) "[PROTOC] Generating protobuf CC file from $<" $(Q) mkdir -p `dirname $@` - $(Q) $(PROTOC) --cpp_out=$(GENDIR) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $< + $(Q) $(PROTOC) --cpp_out=$(GENDIR) $< + +$(GENDIR)/${p}.grpc.pb.cc: ${p}.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) + $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" + $(Q) mkdir -p `dirname $@` + $(Q) $(PROTOC) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $< endif % endfor diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index 9938fcf12e..dd294d9516 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -35,8 +35,8 @@ #include #include "test/core/util/test_config.h" -#include "test/cpp/util/echo_duplicate.pb.h" -#include "test/cpp/util/echo.pb.h" +#include "test/cpp/util/echo_duplicate.grpc.pb.h" +#include "test/cpp/util/echo.grpc.pb.h" #include "src/cpp/util/time.h" #include #include diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index 0d5db046df..f96051cafa 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -35,8 +35,8 @@ #include #include "test/core/util/test_config.h" -#include "test/cpp/util/echo_duplicate.pb.h" -#include "test/cpp/util/echo.pb.h" +#include "test/cpp/util/echo_duplicate.grpc.pb.h" +#include "test/cpp/util/echo.grpc.pb.h" #include "src/cpp/util/time.h" #include "src/cpp/server/thread_pool.h" #include diff --git a/test/cpp/end2end/generic_end2end_test.cc b/test/cpp/end2end/generic_end2end_test.cc index 9cdd8c94d1..eb6f5369a9 100644 --- a/test/cpp/end2end/generic_end2end_test.cc +++ b/test/cpp/end2end/generic_end2end_test.cc @@ -38,7 +38,7 @@ #include "src/cpp/util/time.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" -#include "test/cpp/util/echo.pb.h" +#include "test/cpp/util/echo.grpc.pb.h" #include #include #include diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc index de6c6b7b77..7c5e1aa715 100644 --- a/test/cpp/interop/client.cc +++ b/test/cpp/interop/client.cc @@ -51,9 +51,9 @@ #include #include #include "test/cpp/util/create_test_channel.h" -#include "test/cpp/interop/test.pb.h" -#include "test/cpp/interop/empty.pb.h" -#include "test/cpp/interop/messages.pb.h" +#include "test/cpp/interop/test.grpc.pb.h" +#include "test/cpp/interop/empty.grpc.pb.h" +#include "test/cpp/interop/messages.grpc.pb.h" DEFINE_bool(enable_ssl, false, "Whether to use ssl/tls."); DEFINE_bool(use_prod_roots, false, "True to use SSL roots for google"); diff --git a/test/cpp/interop/server.cc b/test/cpp/interop/server.cc index 780a7370ac..87bf48938b 100644 --- a/test/cpp/interop/server.cc +++ b/test/cpp/interop/server.cc @@ -49,9 +49,9 @@ #include #include #include -#include "test/cpp/interop/test.pb.h" -#include "test/cpp/interop/empty.pb.h" -#include "test/cpp/interop/messages.pb.h" +#include "test/cpp/interop/test.grpc.pb.h" +#include "test/cpp/interop/empty.grpc.pb.h" +#include "test/cpp/interop/messages.grpc.pb.h" DEFINE_bool(enable_ssl, false, "Whether to use ssl/tls."); DEFINE_int32(port, 0, "Server port."); diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h index cae7f44537..08b338c747 100644 --- a/test/cpp/qps/client.h +++ b/test/cpp/qps/client.h @@ -36,7 +36,7 @@ #include "test/cpp/qps/histogram.h" #include "test/cpp/qps/timer.h" -#include "test/cpp/qps/qpstest.pb.h" +#include "test/cpp/qps/qpstest.grpc.pb.h" #include #include diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc index 1ed3c7157f..c01d840178 100644 --- a/test/cpp/qps/client_async.cc +++ b/test/cpp/qps/client_async.cc @@ -48,7 +48,7 @@ #include #include #include "test/cpp/util/create_test_channel.h" -#include "test/cpp/qps/qpstest.pb.h" +#include "test/cpp/qps/qpstest.grpc.pb.h" #include "test/cpp/qps/timer.h" #include "test/cpp/qps/client.h" diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc index 77da1725ff..947618121b 100644 --- a/test/cpp/qps/client_sync.cc +++ b/test/cpp/qps/client_sync.cc @@ -55,7 +55,7 @@ #include #include "test/cpp/util/create_test_channel.h" #include "test/cpp/qps/client.h" -#include "test/cpp/qps/qpstest.pb.h" +#include "test/cpp/qps/qpstest.grpc.pb.h" #include "test/cpp/qps/histogram.h" #include "test/cpp/qps/timer.h" diff --git a/test/cpp/qps/driver.h b/test/cpp/qps/driver.h index d87e80dc55..348c032bf3 100644 --- a/test/cpp/qps/driver.h +++ b/test/cpp/qps/driver.h @@ -35,7 +35,7 @@ #define TEST_QPS_DRIVER_H #include "test/cpp/qps/histogram.h" -#include "test/cpp/qps/qpstest.pb.h" +#include "test/cpp/qps/qpstest.grpc.pb.h" namespace grpc { namespace testing { diff --git a/test/cpp/qps/histogram.h b/test/cpp/qps/histogram.h index 7ba00e94c3..eb17821cdc 100644 --- a/test/cpp/qps/histogram.h +++ b/test/cpp/qps/histogram.h @@ -35,7 +35,7 @@ #define TEST_QPS_HISTOGRAM_H #include -#include "test/cpp/qps/qpstest.pb.h" +#include "test/cpp/qps/qpstest.grpc.pb.h" namespace grpc { namespace testing { diff --git a/test/cpp/qps/server.h b/test/cpp/qps/server.h index ef71cb94d0..68e0115410 100644 --- a/test/cpp/qps/server.h +++ b/test/cpp/qps/server.h @@ -35,7 +35,7 @@ #define TEST_QPS_SERVER_H #include "test/cpp/qps/timer.h" -#include "test/cpp/qps/qpstest.pb.h" +#include "test/cpp/qps/qpstest.grpc.pb.h" namespace grpc { namespace testing { diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc index 65c170af81..2e366a8d72 100644 --- a/test/cpp/qps/server_async.cc +++ b/test/cpp/qps/server_async.cc @@ -52,7 +52,7 @@ #include #include #include "src/cpp/server/thread_pool.h" -#include "test/cpp/qps/qpstest.pb.h" +#include "test/cpp/qps/qpstest.grpc.pb.h" #include "test/cpp/qps/server.h" #include diff --git a/test/cpp/qps/server_sync.cc b/test/cpp/qps/server_sync.cc index 9964429901..2770233a7c 100644 --- a/test/cpp/qps/server_sync.cc +++ b/test/cpp/qps/server_sync.cc @@ -47,7 +47,7 @@ #include #include #include "src/cpp/server/thread_pool.h" -#include "test/cpp/qps/qpstest.pb.h" +#include "test/cpp/qps/qpstest.grpc.pb.h" #include "test/cpp/qps/server.h" #include "test/cpp/qps/timer.h" diff --git a/test/cpp/qps/worker.cc b/test/cpp/qps/worker.cc index b6830cc055..101eb9f969 100644 --- a/test/cpp/qps/worker.cc +++ b/test/cpp/qps/worker.cc @@ -55,7 +55,7 @@ #include #include "test/core/util/grpc_profiler.h" #include "test/cpp/util/create_test_channel.h" -#include "test/cpp/qps/qpstest.pb.h" +#include "test/cpp/qps/qpstest.grpc.pb.h" #include "test/cpp/qps/client.h" #include "test/cpp/qps/server.h" diff --git a/test/cpp/util/cli_call_test.cc b/test/cpp/util/cli_call_test.cc index 91fc40c31f..32ef392cc4 100644 --- a/test/cpp/util/cli_call_test.cc +++ b/test/cpp/util/cli_call_test.cc @@ -33,7 +33,7 @@ #include "test/core/util/test_config.h" #include "test/cpp/util/cli_call.h" -#include "test/cpp/util/echo.pb.h" +#include "test/cpp/util/echo.grpc.pb.h" #include "src/cpp/server/thread_pool.h" #include #include -- cgit v1.2.3 From 4cc8a172f584270791abd1521789896927c538c7 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 9 Apr 2015 21:46:33 +0000 Subject: Tweaks --- test/cpp/qps/smoke_test.cc | 11 +++++++---- test/cpp/qps/smoke_test.sh | 2 +- third_party/openssl | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/test/cpp/qps/smoke_test.cc b/test/cpp/qps/smoke_test.cc index a6b5ef60a5..5cdabb88a0 100644 --- a/test/cpp/qps/smoke_test.cc +++ b/test/cpp/qps/smoke_test.cc @@ -39,6 +39,9 @@ namespace grpc { namespace testing { +static const int WARMUP = 5; +static const int BENCHMARK = 10; + static void RunSynchronousUnaryPingPong() { gpr_log(GPR_INFO, "Running Synchronous Unary Ping Pong"); @@ -55,7 +58,7 @@ static void RunSynchronousUnaryPingPong() { server_config.set_enable_ssl(false); server_config.set_threads(1); - auto result = RunScenario(client_config, 1, server_config, 1, 30, 120); + auto result = RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK); gpr_log(GPR_INFO, "QPS: %.1f", result.latencies.Count() / @@ -84,7 +87,7 @@ static void RunSynchronousStreamingPingPong() { server_config.set_enable_ssl(false); server_config.set_threads(1); - auto result = RunScenario(client_config, 1, server_config, 1, 30, 120); + auto result = RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK); gpr_log(GPR_INFO, "QPS: %.1f", result.latencies.Count() / @@ -114,7 +117,7 @@ static void RunAsyncUnaryPingPong() { server_config.set_enable_ssl(false); server_config.set_threads(1); - auto result = RunScenario(client_config, 1, server_config, 1, 30, 120); + auto result = RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK); gpr_log(GPR_INFO, "QPS: %.1f", result.latencies.Count() / @@ -144,7 +147,7 @@ static void RunQPS() { server_config.set_enable_ssl(false); server_config.set_threads(4); - auto result = RunScenario(client_config, 1, server_config, 1, 30, 120); + auto result = RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK); auto qps = result.latencies.Count() / diff --git a/test/cpp/qps/smoke_test.sh b/test/cpp/qps/smoke_test.sh index 431a29705e..ba7f0a4f27 100755 --- a/test/cpp/qps/smoke_test.sh +++ b/test/cpp/qps/smoke_test.sh @@ -8,7 +8,7 @@ cd $(dirname $0)/../../.. killall qps_worker || true -config=dbg +config=opt NUMCPUS=`python2.7 -c 'import multiprocessing; print multiprocessing.cpu_count()'` diff --git a/third_party/openssl b/third_party/openssl index 3df69d3aef..4ac0329582 160000 --- a/third_party/openssl +++ b/third_party/openssl @@ -1 +1 @@ -Subproject commit 3df69d3aefde7671053d4e3c242b228e5d79c83f +Subproject commit 4ac0329582829f5378d8078c8d314ad37db87736 -- cgit v1.2.3 From 176f921b9b01bfd592298b0da4fb9f1b2b26e1f3 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 9 Apr 2015 14:54:53 -0700 Subject: Revert openssl --- third_party/openssl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/openssl b/third_party/openssl index 4ac0329582..3df69d3aef 160000 --- a/third_party/openssl +++ b/third_party/openssl @@ -1 +1 @@ -Subproject commit 4ac0329582829f5378d8078c8d314ad37db87736 +Subproject commit 3df69d3aefde7671053d4e3c242b228e5d79c83f -- cgit v1.2.3 From 1d2240cc6c95ce4de29f1b8c19dea07d1a7d85d2 Mon Sep 17 00:00:00 2001 From: Julien Boeuf Date: Thu, 9 Apr 2015 21:07:56 -0700 Subject: Have the secure credentials in separate header files. --- build.json | 4 ++ src/cpp/client/secure_credentials.cc | 35 +++++------------- src/cpp/client/secure_credentials.h | 57 +++++++++++++++++++++++++++++ src/cpp/server/secure_server_credentials.cc | 31 ++++------------ src/cpp/server/secure_server_credentials.h | 56 ++++++++++++++++++++++++++++ vsprojects/vs2010/grpc++.vcxproj | 2 + vsprojects/vs2010/grpc++.vcxproj.filters | 6 +++ vsprojects/vs2013/grpc++.vcxproj | 2 + vsprojects/vs2013/grpc++.vcxproj.filters | 6 +++ 9 files changed, 150 insertions(+), 49 deletions(-) create mode 100644 src/cpp/client/secure_credentials.h create mode 100644 src/cpp/server/secure_server_credentials.h diff --git a/build.json b/build.json index f8f23e0d33..960af947f8 100644 --- a/build.json +++ b/build.json @@ -464,6 +464,10 @@ "name": "grpc++", "build": "all", "language": "c++", + "headers": [ + "src/cpp/client/secure_credentials.h", + "src/cpp/server/secure_server_credentials.h" + ], "src": [ "src/cpp/client/secure_credentials.cc", "src/cpp/server/secure_server_credentials.cc" diff --git a/src/cpp/client/secure_credentials.cc b/src/cpp/client/secure_credentials.cc index d6f9acc675..0a73b2c0f6 100644 --- a/src/cpp/client/secure_credentials.cc +++ b/src/cpp/client/secure_credentials.cc @@ -31,38 +31,23 @@ * */ -#include #include #include -#include -#include #include "src/cpp/client/channel.h" +#include "src/cpp/client/secure_credentials.h" namespace grpc { -class SecureCredentials GRPC_FINAL : public Credentials { - public: - explicit SecureCredentials(grpc_credentials* c_creds) : c_creds_(c_creds) {} - ~SecureCredentials() GRPC_OVERRIDE { grpc_credentials_release(c_creds_); } - grpc_credentials* GetRawCreds() { return c_creds_; } - - std::shared_ptr CreateChannel( - const string& target, const grpc::ChannelArguments& args) GRPC_OVERRIDE { - grpc_channel_args channel_args; - args.SetChannelArgs(&channel_args); - return std::shared_ptr(new Channel( - args.GetSslTargetNameOverride().empty() - ? target - : args.GetSslTargetNameOverride(), - grpc_secure_channel_create(c_creds_, target.c_str(), &channel_args))); - } - - SecureCredentials* AsSecureCredentials() GRPC_OVERRIDE { return this; } - - private: - grpc_credentials* const c_creds_; -}; +std::shared_ptr SecureCredentials::CreateChannel( + const string& target, const grpc::ChannelArguments& args) { + grpc_channel_args channel_args; + args.SetChannelArgs(&channel_args); + return std::shared_ptr(new Channel( + args.GetSslTargetNameOverride().empty() ? target + : args.GetSslTargetNameOverride(), + grpc_secure_channel_create(c_creds_, target.c_str(), &channel_args))); +} namespace { std::unique_ptr WrapCredentials(grpc_credentials* creds) { diff --git a/src/cpp/client/secure_credentials.h b/src/cpp/client/secure_credentials.h new file mode 100644 index 0000000000..eb68238844 --- /dev/null +++ b/src/cpp/client/secure_credentials.h @@ -0,0 +1,57 @@ +/* + * + * 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 + +#include +#include + +namespace grpc { + +class SecureCredentials GRPC_FINAL : public Credentials { + public: + explicit SecureCredentials(grpc_credentials* c_creds) : c_creds_(c_creds) {} + ~SecureCredentials() GRPC_OVERRIDE { grpc_credentials_release(c_creds_); } + grpc_credentials* GetRawCreds() { return c_creds_; } + + std::shared_ptr CreateChannel( + const string& target, const grpc::ChannelArguments& args) GRPC_OVERRIDE; + SecureCredentials* AsSecureCredentials() GRPC_OVERRIDE { return this; } + + private: + grpc_credentials* const c_creds_; +}; + +} // namespace grpc + + diff --git a/src/cpp/server/secure_server_credentials.cc b/src/cpp/server/secure_server_credentials.cc index 49d69a3fb9..3e262dd74f 100644 --- a/src/cpp/server/secure_server_credentials.cc +++ b/src/cpp/server/secure_server_credentials.cc @@ -31,39 +31,22 @@ * */ -#include - -#include +#include "src/cpp/server/secure_server_credentials.h" namespace grpc { -namespace { -class SecureServerCredentials GRPC_FINAL : public ServerCredentials { - public: - explicit SecureServerCredentials(grpc_server_credentials* creds) - : creds_(creds) {} - ~SecureServerCredentials() GRPC_OVERRIDE { - grpc_server_credentials_release(creds_); - } - - int AddPortToServer(const grpc::string& addr, - grpc_server* server) GRPC_OVERRIDE { - return grpc_server_add_secure_http2_port(server, addr.c_str(), creds_); - } - - private: - grpc_server_credentials* const creds_; -}; -} // namespace +int SecureServerCredentials::AddPortToServer( + const grpc::string& addr, grpc_server* server) { + return grpc_server_add_secure_http2_port(server, addr.c_str(), creds_); +} std::shared_ptr SslServerCredentials( const SslServerCredentialsOptions& options) { std::vector pem_key_cert_pairs; for (auto key_cert_pair = options.pem_key_cert_pairs.begin(); - key_cert_pair != options.pem_key_cert_pairs.end(); - key_cert_pair++) { + key_cert_pair != options.pem_key_cert_pairs.end(); key_cert_pair++) { grpc_ssl_pem_key_cert_pair p = {key_cert_pair->private_key.c_str(), - key_cert_pair->cert_chain.c_str()}; + key_cert_pair->cert_chain.c_str()}; pem_key_cert_pairs.push_back(p); } grpc_server_credentials* c_creds = grpc_ssl_server_credentials_create( diff --git a/src/cpp/server/secure_server_credentials.h b/src/cpp/server/secure_server_credentials.h new file mode 100644 index 0000000000..fa49d30743 --- /dev/null +++ b/src/cpp/server/secure_server_credentials.h @@ -0,0 +1,56 @@ +/* + * + * 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 + +#include + +namespace grpc { + +class SecureServerCredentials GRPC_FINAL : public ServerCredentials { + public: + explicit SecureServerCredentials(grpc_server_credentials* creds) + : creds_(creds) {} + ~SecureServerCredentials() GRPC_OVERRIDE { + grpc_server_credentials_release(creds_); + } + + int AddPortToServer(const grpc::string& addr, + grpc_server* server) GRPC_OVERRIDE; + + private: + grpc_server_credentials* const creds_; +}; + +} // namespace grpc + diff --git a/vsprojects/vs2010/grpc++.vcxproj b/vsprojects/vs2010/grpc++.vcxproj index 0ee433163c..c1795923c7 100644 --- a/vsprojects/vs2010/grpc++.vcxproj +++ b/vsprojects/vs2010/grpc++.vcxproj @@ -104,6 +104,8 @@ + + diff --git a/vsprojects/vs2010/grpc++.vcxproj.filters b/vsprojects/vs2010/grpc++.vcxproj.filters index ed93daee04..77f5383054 100644 --- a/vsprojects/vs2010/grpc++.vcxproj.filters +++ b/vsprojects/vs2010/grpc++.vcxproj.filters @@ -161,6 +161,12 @@ + + src\cpp\client + + + src\cpp\server + src\cpp\client diff --git a/vsprojects/vs2013/grpc++.vcxproj b/vsprojects/vs2013/grpc++.vcxproj index d545a949cb..b9039c5a8f 100644 --- a/vsprojects/vs2013/grpc++.vcxproj +++ b/vsprojects/vs2013/grpc++.vcxproj @@ -106,6 +106,8 @@ + + diff --git a/vsprojects/vs2013/grpc++.vcxproj.filters b/vsprojects/vs2013/grpc++.vcxproj.filters index ed93daee04..77f5383054 100644 --- a/vsprojects/vs2013/grpc++.vcxproj.filters +++ b/vsprojects/vs2013/grpc++.vcxproj.filters @@ -161,6 +161,12 @@ + + src\cpp\client + + + src\cpp\server + src\cpp\client -- cgit v1.2.3 From 41faf0f4c893b57ba5a9ee1cf1ad329c9c9cec08 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 10 Apr 2015 08:06:05 -0700 Subject: s/11/1 --- test/cpp/qps/client_async.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc index 7e2850dd65..3ab06bd7c7 100644 --- a/test/cpp/qps/client_async.cc +++ b/test/cpp/qps/client_async.cc @@ -176,7 +176,7 @@ class AsyncUnaryClient GRPC_FINAL : public Client { bool ThreadFunc(Histogram* histogram, size_t thread_idx) GRPC_OVERRIDE { void* got_tag; bool ok; - switch (cli_cqs_[thread_idx]->AsyncNext(&got_tag, &ok, std::chrono::system_clock::now() + std::chrono::seconds(11))) { + switch (cli_cqs_[thread_idx]->AsyncNext(&got_tag, &ok, std::chrono::system_clock::now() + std::chrono::seconds(1))) { case CompletionQueue::SHUTDOWN: return false; case CompletionQueue::TIMEOUT: return true; case CompletionQueue::GOT_EVENT: break; -- cgit v1.2.3 From 66048f4fc1c0b181e05ef21f7821443abd258240 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 10 Apr 2015 08:23:52 -0700 Subject: Add reporting library, use it --- Makefile | 3 ++ build.json | 2 + test/cpp/qps/histogram.h | 4 +- test/cpp/qps/qps_driver.cc | 37 ++---------------- test/cpp/qps/report.cc | 94 ++++++++++++++++++++++++++++++++++++++++++++++ test/cpp/qps/report.h | 57 ++++++++++++++++++++++++++++ test/cpp/qps/smoke_test.cc | 48 +++++------------------ 7 files changed, 171 insertions(+), 74 deletions(-) create mode 100644 test/cpp/qps/report.cc create mode 100644 test/cpp/qps/report.h diff --git a/Makefile b/Makefile index 6665eb418c..d98202db01 100644 --- a/Makefile +++ b/Makefile @@ -3729,6 +3729,7 @@ $(OBJDIR)/$(CONFIG)/examples/pubsub/subscriber.o: $(GENDIR)/examples/pubsub/ LIBQPS_SRC = \ $(GENDIR)/test/cpp/qps/qpstest.pb.cc \ test/cpp/qps/driver.cc \ + test/cpp/qps/report.cc \ test/cpp/qps/timer.cc \ @@ -3758,6 +3759,7 @@ ifneq ($(OPENSSL_DEP),) # otherwise parallel compilation will fail if a source is compiled first. test/cpp/qps/qpstest.proto: $(OPENSSL_DEP) test/cpp/qps/driver.cc: $(OPENSSL_DEP) +test/cpp/qps/report.cc: $(OPENSSL_DEP) test/cpp/qps/timer.cc: $(OPENSSL_DEP) endif @@ -3785,6 +3787,7 @@ endif $(OBJDIR)/$(CONFIG)/test/cpp/qps/driver.o: $(GENDIR)/test/cpp/qps/qpstest.pb.cc +$(OBJDIR)/$(CONFIG)/test/cpp/qps/report.o: $(GENDIR)/test/cpp/qps/qpstest.pb.cc $(OBJDIR)/$(CONFIG)/test/cpp/qps/timer.o: $(GENDIR)/test/cpp/qps/qpstest.pb.cc diff --git a/build.json b/build.json index f2a39c6f2c..6f37a0a728 100644 --- a/build.json +++ b/build.json @@ -554,11 +554,13 @@ "language": "c++", "headers": [ "test/cpp/qps/driver.h", + "test/cpp/qps/report.h", "test/cpp/qps/timer.h" ], "src": [ "test/cpp/qps/qpstest.proto", "test/cpp/qps/driver.cc", + "test/cpp/qps/report.cc", "test/cpp/qps/timer.cc" ] }, diff --git a/test/cpp/qps/histogram.h b/test/cpp/qps/histogram.h index 7ba00e94c3..fbb80abf87 100644 --- a/test/cpp/qps/histogram.h +++ b/test/cpp/qps/histogram.h @@ -50,10 +50,10 @@ class Histogram { void Merge(Histogram* h) { gpr_histogram_merge(impl_, h->impl_); } void Add(double value) { gpr_histogram_add(impl_, value); } - double Percentile(double pctile) { + double Percentile(double pctile) const { return gpr_histogram_percentile(impl_, pctile); } - double Count() { return gpr_histogram_count(impl_); } + double Count() const { return gpr_histogram_count(impl_); } void Swap(Histogram* other) { std::swap(impl_, other->impl_); } void FillProto(HistogramData* p) { size_t n; diff --git a/test/cpp/qps/qps_driver.cc b/test/cpp/qps/qps_driver.cc index f42d538b16..220f826118 100644 --- a/test/cpp/qps/qps_driver.cc +++ b/test/cpp/qps/qps_driver.cc @@ -35,7 +35,7 @@ #include #include "test/cpp/qps/driver.h" -#include "test/cpp/qps/stats.h" +#include "test/cpp/qps/report.h" DEFINE_int32(num_clients, 1, "Number of client binaries"); DEFINE_int32(num_servers, 1, "Number of server binaries"); @@ -65,7 +65,6 @@ using grpc::testing::ClientType; using grpc::testing::ServerType; using grpc::testing::RpcType; using grpc::testing::ResourceUsage; -using grpc::testing::sum; // In some distros, gflags is in the namespace google, and in some others, // in gflags. This hack is enabling us to find both. @@ -105,37 +104,9 @@ int main(int argc, char** argv) { server_config, FLAGS_num_servers, FLAGS_warmup_seconds, FLAGS_benchmark_seconds); - gpr_log(GPR_INFO, "QPS: %.1f", - result.latencies.Count() / - average(result.client_resources, - [](ResourceUsage u) { return u.wall_time; })); - - gpr_log(GPR_INFO, "Latencies (50/95/99/99.9%%-ile): %.1f/%.1f/%.1f/%.1f us", - result.latencies.Percentile(50) / 1000, - result.latencies.Percentile(95) / 1000, - result.latencies.Percentile(99) / 1000, - result.latencies.Percentile(99.9) / 1000); - - gpr_log(GPR_INFO, "Server system time: %.2f%%", - 100.0 * sum(result.server_resources, - [](ResourceUsage u) { return u.system_time; }) / - sum(result.server_resources, - [](ResourceUsage u) { return u.wall_time; })); - gpr_log(GPR_INFO, "Server user time: %.2f%%", - 100.0 * sum(result.server_resources, - [](ResourceUsage u) { return u.user_time; }) / - sum(result.server_resources, - [](ResourceUsage u) { return u.wall_time; })); - gpr_log(GPR_INFO, "Client system time: %.2f%%", - 100.0 * sum(result.client_resources, - [](ResourceUsage u) { return u.system_time; }) / - sum(result.client_resources, - [](ResourceUsage u) { return u.wall_time; })); - gpr_log(GPR_INFO, "Client user time: %.2f%%", - 100.0 * sum(result.client_resources, - [](ResourceUsage u) { return u.user_time; }) / - sum(result.client_resources, - [](ResourceUsage u) { return u.wall_time; })); + ReportQPSPerCore(result, server_config); + ReportLatency(result); + ReportTimes(result); grpc_shutdown(); return 0; diff --git a/test/cpp/qps/report.cc b/test/cpp/qps/report.cc new file mode 100644 index 0000000000..29d88da344 --- /dev/null +++ b/test/cpp/qps/report.cc @@ -0,0 +1,94 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "test/cpp/qps/report.h" + +#include +#include "test/cpp/qps/stats.h" + +namespace grpc { +namespace testing { + +// QPS: XXX +void ReportQPS(const ScenarioResult& result) { + gpr_log(GPR_INFO, "QPS: %.1f", + result.latencies.Count() / + average(result.client_resources, + [](ResourceUsage u) { return u.wall_time; })); +} + +// QPS: XXX (YYY/server core) +void ReportQPSPerCore(const ScenarioResult& result, const ServerConfig& server_config) { + auto qps = + result.latencies.Count() / + average(result.client_resources, + [](ResourceUsage u) { return u.wall_time; }); + + gpr_log(GPR_INFO, "QPS: %.1f (%.1f/server core)", qps, qps/server_config.threads()); +} + +// Latency (50/90/95/99/99.9%-ile): AA/BB/CC/DD/EE us +void ReportLatency(const ScenarioResult& result) { + gpr_log(GPR_INFO, "Latencies (50/90/95/99/99.9%%-ile): %.1f/%.1f/%.1f/%.1f/%.1f us", + result.latencies.Percentile(50) / 1000, + result.latencies.Percentile(90) / 1000, + result.latencies.Percentile(95) / 1000, + result.latencies.Percentile(99) / 1000, + result.latencies.Percentile(99.9) / 1000); +} + +void ReportTimes(const ScenarioResult& result) { + gpr_log(GPR_INFO, "Server system time: %.2f%%", + 100.0 * sum(result.server_resources, + [](ResourceUsage u) { return u.system_time; }) / + sum(result.server_resources, + [](ResourceUsage u) { return u.wall_time; })); + gpr_log(GPR_INFO, "Server user time: %.2f%%", + 100.0 * sum(result.server_resources, + [](ResourceUsage u) { return u.user_time; }) / + sum(result.server_resources, + [](ResourceUsage u) { return u.wall_time; })); + gpr_log(GPR_INFO, "Client system time: %.2f%%", + 100.0 * sum(result.client_resources, + [](ResourceUsage u) { return u.system_time; }) / + sum(result.client_resources, + [](ResourceUsage u) { return u.wall_time; })); + gpr_log(GPR_INFO, "Client user time: %.2f%%", + 100.0 * sum(result.client_resources, + [](ResourceUsage u) { return u.user_time; }) / + sum(result.client_resources, + [](ResourceUsage u) { return u.wall_time; })); +} + +} // namespace testing +} // namespace grpc diff --git a/test/cpp/qps/report.h b/test/cpp/qps/report.h new file mode 100644 index 0000000000..343e426ca4 --- /dev/null +++ b/test/cpp/qps/report.h @@ -0,0 +1,57 @@ +/* + * + * 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. + * + */ + +#ifndef TEST_QPS_REPORT_H +#define TEST_QPS_REPORT_H + +#include "test/cpp/qps/driver.h" + +namespace grpc { +namespace testing { + +// QPS: XXX +void ReportQPS(const ScenarioResult& result); +// QPS: XXX (YYY/server core) +void ReportQPSPerCore(const ScenarioResult& result, const ServerConfig& config); +// Latency (50/90/95/99/99.9%-ile): AA/BB/CC/DD/EE us +void ReportLatency(const ScenarioResult& result); +// Server system time: XX% +// Server user time: XX% +// Client system time: XX% +// Client user time: XX% +void ReportTimes(const ScenarioResult& result); + +} // namespace testing +} // namespace grpc + +#endif diff --git a/test/cpp/qps/smoke_test.cc b/test/cpp/qps/smoke_test.cc index 5cdabb88a0..c9d321f133 100644 --- a/test/cpp/qps/smoke_test.cc +++ b/test/cpp/qps/smoke_test.cc @@ -34,7 +34,7 @@ #include #include "test/cpp/qps/driver.h" -#include "test/cpp/qps/stats.h" +#include "test/cpp/qps/report.h" namespace grpc { namespace testing { @@ -60,15 +60,8 @@ static void RunSynchronousUnaryPingPong() { auto result = RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK); - gpr_log(GPR_INFO, "QPS: %.1f", - result.latencies.Count() / - average(result.client_resources, - [](ResourceUsage u) { return u.wall_time; })); - gpr_log(GPR_INFO, "Latencies (50/95/99/99.9%%-ile): %.1f/%.1f/%.1f/%.1f us", - result.latencies.Percentile(50) / 1000, - result.latencies.Percentile(95) / 1000, - result.latencies.Percentile(99) / 1000, - result.latencies.Percentile(99.9) / 1000); + ReportQPS(result); + ReportLatency(result); } static void RunSynchronousStreamingPingPong() { @@ -89,15 +82,8 @@ static void RunSynchronousStreamingPingPong() { auto result = RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK); - gpr_log(GPR_INFO, "QPS: %.1f", - result.latencies.Count() / - average(result.client_resources, - [](ResourceUsage u) { return u.wall_time; })); - gpr_log(GPR_INFO, "Latencies (50/95/99/99.9%%-ile): %.1f/%.1f/%.1f/%.1f us", - result.latencies.Percentile(50) / 1000, - result.latencies.Percentile(95) / 1000, - result.latencies.Percentile(99) / 1000, - result.latencies.Percentile(99.9) / 1000); + ReportQPS(result); + ReportLatency(result); } static void RunAsyncUnaryPingPong() { @@ -119,15 +105,8 @@ static void RunAsyncUnaryPingPong() { auto result = RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK); - gpr_log(GPR_INFO, "QPS: %.1f", - result.latencies.Count() / - average(result.client_resources, - [](ResourceUsage u) { return u.wall_time; })); - gpr_log(GPR_INFO, "Latencies (50/95/99/99.9%%-ile): %.1f/%.1f/%.1f/%.1f us", - result.latencies.Percentile(50) / 1000, - result.latencies.Percentile(95) / 1000, - result.latencies.Percentile(99) / 1000, - result.latencies.Percentile(99.9) / 1000); + ReportQPS(result); + ReportLatency(result); } static void RunQPS() { @@ -149,17 +128,8 @@ static void RunQPS() { auto result = RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK); - auto qps = - result.latencies.Count() / - average(result.client_resources, - [](ResourceUsage u) { return u.wall_time; }); - - gpr_log(GPR_INFO, "QPS: %.1f (%.1f/core)", qps, qps/client_config.client_channels()); - gpr_log(GPR_INFO, "Latencies (50/95/99/99.9%%-ile): %.1f/%.1f/%.1f/%.1f us", - result.latencies.Percentile(50) / 1000, - result.latencies.Percentile(95) / 1000, - result.latencies.Percentile(99) / 1000, - result.latencies.Percentile(99.9) / 1000); + ReportQPSPerCore(result, server_config); + ReportLatency(result); } } // namespace testing -- cgit v1.2.3 From fce25eee5d07a2480190c762ce71f85f3db17771 Mon Sep 17 00:00:00 2001 From: Julien Boeuf Date: Fri, 10 Apr 2015 08:44:20 -0700 Subject: Addressing comments. --- src/cpp/client/secure_credentials.h | 4 ++++ src/cpp/server/secure_server_credentials.h | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/cpp/client/secure_credentials.h b/src/cpp/client/secure_credentials.h index eb68238844..77d575813e 100644 --- a/src/cpp/client/secure_credentials.h +++ b/src/cpp/client/secure_credentials.h @@ -31,6 +31,9 @@ * */ +#ifndef GRPC_INTERNAL_CPP_CLIENT_SECURE_CREDENTIALS_H +#define GRPC_INTERNAL_CPP_CLIENT_SECURE_CREDENTIALS_H + #include #include @@ -54,4 +57,5 @@ class SecureCredentials GRPC_FINAL : public Credentials { } // namespace grpc +#endif // GRPC_INTERNAL_CPP_CLIENT_SECURE_CREDENTIALS_H diff --git a/src/cpp/server/secure_server_credentials.h b/src/cpp/server/secure_server_credentials.h index fa49d30743..b9803f107e 100644 --- a/src/cpp/server/secure_server_credentials.h +++ b/src/cpp/server/secure_server_credentials.h @@ -31,6 +31,9 @@ * */ +#ifndef GRPC_INTERNAL_CPP_SERVER_SECURE_SERVER_CREDENTIALS_H +#define GRPC_INTERNAL_CPP_SERVER_SECURE_SERVER_CREDENTIALS_H + #include #include @@ -54,3 +57,4 @@ class SecureServerCredentials GRPC_FINAL : public ServerCredentials { } // namespace grpc +#endif // GRPC_INTERNAL_CPP_SERVER_SECURE_SERVER_CREDENTIALS_H -- cgit v1.2.3 From 820e3d612af98786d82dcc8b46c6ac2d06e20d13 Mon Sep 17 00:00:00 2001 From: Tim Emiola Date: Fri, 10 Apr 2015 09:11:50 -0700 Subject: Fixes the Makefile template to link .so. This resolves a blocker stopping a clean linuxbrew install to work with one of the wrapped libraries. --- Makefile | 6 ++++++ templates/Makefile.template | 1 + 2 files changed, 7 insertions(+) diff --git a/Makefile b/Makefile index 8e01bb88dc..ddde6c4784 100644 --- a/Makefile +++ b/Makefile @@ -2167,6 +2167,7 @@ else $(Q) $(INSTALL) -d $(prefix)/lib $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgpr.$(SHARED_EXT) $(prefix)/lib/libgpr.$(SHARED_EXT) ifneq ($(SYSTEM),Darwin) + $(Q) ln -sf libgpr.$(SHARED_EXT) $(prefix)/lib/libgpr.so.0 $(Q) ln -sf libgpr.$(SHARED_EXT) $(prefix)/lib/libgpr.so endif endif @@ -2180,6 +2181,7 @@ else $(Q) $(INSTALL) -d $(prefix)/lib $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc.$(SHARED_EXT) $(prefix)/lib/libgrpc.$(SHARED_EXT) ifneq ($(SYSTEM),Darwin) + $(Q) ln -sf libgrpc.$(SHARED_EXT) $(prefix)/lib/libgrpc.so.0 $(Q) ln -sf libgrpc.$(SHARED_EXT) $(prefix)/lib/libgrpc.so endif endif @@ -2193,6 +2195,7 @@ else $(Q) $(INSTALL) -d $(prefix)/lib $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.$(SHARED_EXT) $(prefix)/lib/libgrpc_unsecure.$(SHARED_EXT) ifneq ($(SYSTEM),Darwin) + $(Q) ln -sf libgrpc_unsecure.$(SHARED_EXT) $(prefix)/lib/libgrpc_unsecure.so.0 $(Q) ln -sf libgrpc_unsecure.$(SHARED_EXT) $(prefix)/lib/libgrpc_unsecure.so endif endif @@ -2214,6 +2217,7 @@ else $(Q) $(INSTALL) -d $(prefix)/lib $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++.$(SHARED_EXT) $(prefix)/lib/libgrpc++.$(SHARED_EXT) ifneq ($(SYSTEM),Darwin) + $(Q) ln -sf libgrpc++.$(SHARED_EXT) $(prefix)/lib/libgrpc++.so.0 $(Q) ln -sf libgrpc++.$(SHARED_EXT) $(prefix)/lib/libgrpc++.so endif endif @@ -2227,6 +2231,7 @@ else $(Q) $(INSTALL) -d $(prefix)/lib $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.$(SHARED_EXT) $(prefix)/lib/libgrpc++_unsecure.$(SHARED_EXT) ifneq ($(SYSTEM),Darwin) + $(Q) ln -sf libgrpc++_unsecure.$(SHARED_EXT) $(prefix)/lib/libgrpc++_unsecure.so.0 $(Q) ln -sf libgrpc++_unsecure.$(SHARED_EXT) $(prefix)/lib/libgrpc++_unsecure.so endif endif @@ -2248,6 +2253,7 @@ else $(Q) $(INSTALL) -d $(prefix)/lib $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext.$(SHARED_EXT) $(prefix)/lib/libgrpc_csharp_ext.$(SHARED_EXT) ifneq ($(SYSTEM),Darwin) + $(Q) ln -sf libgrpc_csharp_ext.$(SHARED_EXT) $(prefix)/lib/libgrpc_csharp_ext.so.0 $(Q) ln -sf libgrpc_csharp_ext.$(SHARED_EXT) $(prefix)/lib/libgrpc_csharp_ext.so endif endif diff --git a/templates/Makefile.template b/templates/Makefile.template index 848ee87bbc..6315aab945 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -930,6 +930,7 @@ else $(Q) $(INSTALL) -d $(prefix)/lib $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.$(SHARED_EXT) ifneq ($(SYSTEM),Darwin) + $(Q) ln -sf lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.so.${settings.version.major} $(Q) ln -sf lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.so endif endif -- cgit v1.2.3 From 1c96a8fdb5024194b31047ff11b399107f2fee39 Mon Sep 17 00:00:00 2001 From: Donna Dionne Date: Fri, 10 Apr 2015 11:28:32 -0700 Subject: Adding php client to interop tests. --- tools/gce_setup/interop_test_runner.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/gce_setup/interop_test_runner.sh b/tools/gce_setup/interop_test_runner.sh index 7f0b5bab1a..1c6122e9ae 100755 --- a/tools/gce_setup/interop_test_runner.sh +++ b/tools/gce_setup/interop_test_runner.sh @@ -36,7 +36,7 @@ echo $result_file_name main() { source grpc_docker.sh test_cases=(large_unary empty_unary ping_pong client_streaming server_streaming cancel_after_begin cancel_after_first_response) - clients=(cxx java go ruby node python csharp_mono) + clients=(cxx java go ruby node python csharp_mono php) servers=(cxx java go ruby node python csharp_mono) for test_case in "${test_cases[@]}" do -- cgit v1.2.3 From 3c0ba0c2d6fdd08bffff3816350680dde432f416 Mon Sep 17 00:00:00 2001 From: Ming Zhao Date: Fri, 10 Apr 2015 12:05:22 -0700 Subject: Extend bazel BUILD file to build all the C/C++ libraries as well as protobuf plugins. This requires WORKSPACE to define these external dependencies for openssl and protobuf, for examples: bind( name = "libssl", actual = "//third_party/boringssl:boringssl", ) # Library needed to build protobuf codegen plugin. bind( name = "protobuf_compiler", actual = "//third_party/protobuf:protoc_lib", ) # Library that C++ code generated by protobuf C compiler should depend # on. bind( name = "protobuf_clib", actual = "//third_party/protobuf:proto_lib", ) --- BUILD | 1271 +++++++++++++++++++++++++++------------------- templates/BUILD.template | 79 ++- 2 files changed, 819 insertions(+), 531 deletions(-) diff --git a/BUILD b/BUILD index ccff9c05c6..233cf65045 100644 --- a/BUILD +++ b/BUILD @@ -32,535 +32,782 @@ licenses(["notice"]) # 3-clause BSD +package(default_visibility = ["//visibility:public"]) + + + + +cc_library( + name = "gpr", + srcs = [ + "src/core/support/env.h", + "src/core/support/file.h", + "src/core/support/murmur_hash.h", + "src/core/support/string.h", + "src/core/support/string_win32.h", + "src/core/support/thd_internal.h", + "src/core/support/alloc.c", + "src/core/support/cancellable.c", + "src/core/support/cmdline.c", + "src/core/support/cpu_iphone.c", + "src/core/support/cpu_linux.c", + "src/core/support/cpu_posix.c", + "src/core/support/cpu_windows.c", + "src/core/support/env_linux.c", + "src/core/support/env_posix.c", + "src/core/support/env_win32.c", + "src/core/support/file.c", + "src/core/support/file_posix.c", + "src/core/support/file_win32.c", + "src/core/support/histogram.c", + "src/core/support/host_port.c", + "src/core/support/log.c", + "src/core/support/log_android.c", + "src/core/support/log_linux.c", + "src/core/support/log_posix.c", + "src/core/support/log_win32.c", + "src/core/support/murmur_hash.c", + "src/core/support/slice.c", + "src/core/support/slice_buffer.c", + "src/core/support/string.c", + "src/core/support/string_posix.c", + "src/core/support/string_win32.c", + "src/core/support/sync.c", + "src/core/support/sync_posix.c", + "src/core/support/sync_win32.c", + "src/core/support/thd.c", + "src/core/support/thd_posix.c", + "src/core/support/thd_win32.c", + "src/core/support/time.c", + "src/core/support/time_posix.c", + "src/core/support/time_win32.c", + ], + hdrs = [ + "include/grpc/support/alloc.h", + "include/grpc/support/atm.h", + "include/grpc/support/atm_gcc_atomic.h", + "include/grpc/support/atm_gcc_sync.h", + "include/grpc/support/atm_win32.h", + "include/grpc/support/cancellable_platform.h", + "include/grpc/support/cmdline.h", + "include/grpc/support/cpu.h", + "include/grpc/support/histogram.h", + "include/grpc/support/host_port.h", + "include/grpc/support/log.h", + "include/grpc/support/log_win32.h", + "include/grpc/support/port_platform.h", + "include/grpc/support/slice.h", + "include/grpc/support/slice_buffer.h", + "include/grpc/support/sync.h", + "include/grpc/support/sync_generic.h", + "include/grpc/support/sync_posix.h", + "include/grpc/support/sync_win32.h", + "include/grpc/support/thd.h", + "include/grpc/support/time.h", + "include/grpc/support/useful.h", + ], + includes = [ + "include", + ".", + ], + deps = [ + ], +) + + +cc_library( + name = "grpc", + srcs = [ + "src/core/httpcli/format_request.h", + "src/core/httpcli/httpcli.h", + "src/core/httpcli/httpcli_security_context.h", + "src/core/httpcli/parser.h", + "src/core/security/auth.h", + "src/core/security/base64.h", + "src/core/security/credentials.h", + "src/core/security/json_token.h", + "src/core/security/secure_endpoint.h", + "src/core/security/secure_transport_setup.h", + "src/core/security/security_context.h", + "src/core/tsi/fake_transport_security.h", + "src/core/tsi/ssl_transport_security.h", + "src/core/tsi/transport_security.h", + "src/core/tsi/transport_security_interface.h", + "src/core/channel/census_filter.h", + "src/core/channel/channel_args.h", + "src/core/channel/channel_stack.h", + "src/core/channel/child_channel.h", + "src/core/channel/client_channel.h", + "src/core/channel/client_setup.h", + "src/core/channel/connected_channel.h", + "src/core/channel/http_client_filter.h", + "src/core/channel/http_filter.h", + "src/core/channel/http_server_filter.h", + "src/core/channel/metadata_buffer.h", + "src/core/channel/noop_filter.h", + "src/core/compression/algorithm.h", + "src/core/compression/message_compress.h", + "src/core/debug/trace.h", + "src/core/iomgr/alarm.h", + "src/core/iomgr/alarm_heap.h", + "src/core/iomgr/alarm_internal.h", + "src/core/iomgr/endpoint.h", + "src/core/iomgr/endpoint_pair.h", + "src/core/iomgr/fd_posix.h", + "src/core/iomgr/iocp_windows.h", + "src/core/iomgr/iomgr.h", + "src/core/iomgr/iomgr_internal.h", + "src/core/iomgr/iomgr_posix.h", + "src/core/iomgr/pollset.h", + "src/core/iomgr/pollset_kick.h", + "src/core/iomgr/pollset_kick_posix.h", + "src/core/iomgr/pollset_kick_windows.h", + "src/core/iomgr/pollset_posix.h", + "src/core/iomgr/pollset_windows.h", + "src/core/iomgr/resolve_address.h", + "src/core/iomgr/sockaddr.h", + "src/core/iomgr/sockaddr_posix.h", + "src/core/iomgr/sockaddr_utils.h", + "src/core/iomgr/sockaddr_win32.h", + "src/core/iomgr/socket_utils_posix.h", + "src/core/iomgr/socket_windows.h", + "src/core/iomgr/tcp_client.h", + "src/core/iomgr/tcp_posix.h", + "src/core/iomgr/tcp_server.h", + "src/core/iomgr/tcp_windows.h", + "src/core/iomgr/time_averaged_stats.h", + "src/core/iomgr/wakeup_fd_pipe.h", + "src/core/iomgr/wakeup_fd_posix.h", + "src/core/json/json.h", + "src/core/json/json_common.h", + "src/core/json/json_reader.h", + "src/core/json/json_writer.h", + "src/core/statistics/census_interface.h", + "src/core/statistics/census_log.h", + "src/core/statistics/census_rpc_stats.h", + "src/core/statistics/census_tracing.h", + "src/core/statistics/hash_table.h", + "src/core/statistics/window_stats.h", + "src/core/surface/byte_buffer_queue.h", + "src/core/surface/call.h", + "src/core/surface/channel.h", + "src/core/surface/client.h", + "src/core/surface/completion_queue.h", + "src/core/surface/event_string.h", + "src/core/surface/init.h", + "src/core/surface/server.h", + "src/core/surface/surface_trace.h", + "src/core/transport/chttp2/alpn.h", + "src/core/transport/chttp2/bin_encoder.h", + "src/core/transport/chttp2/frame.h", + "src/core/transport/chttp2/frame_data.h", + "src/core/transport/chttp2/frame_goaway.h", + "src/core/transport/chttp2/frame_ping.h", + "src/core/transport/chttp2/frame_rst_stream.h", + "src/core/transport/chttp2/frame_settings.h", + "src/core/transport/chttp2/frame_window_update.h", + "src/core/transport/chttp2/hpack_parser.h", + "src/core/transport/chttp2/hpack_table.h", + "src/core/transport/chttp2/http2_errors.h", + "src/core/transport/chttp2/huffsyms.h", + "src/core/transport/chttp2/status_conversion.h", + "src/core/transport/chttp2/stream_encoder.h", + "src/core/transport/chttp2/stream_map.h", + "src/core/transport/chttp2/timeout_encoding.h", + "src/core/transport/chttp2/varint.h", + "src/core/transport/chttp2_transport.h", + "src/core/transport/metadata.h", + "src/core/transport/stream_op.h", + "src/core/transport/transport.h", + "src/core/transport/transport_impl.h", + "src/core/httpcli/format_request.c", + "src/core/httpcli/httpcli.c", + "src/core/httpcli/httpcli_security_context.c", + "src/core/httpcli/parser.c", + "src/core/security/auth.c", + "src/core/security/base64.c", + "src/core/security/credentials.c", + "src/core/security/credentials_posix.c", + "src/core/security/credentials_win32.c", + "src/core/security/factories.c", + "src/core/security/google_default_credentials.c", + "src/core/security/json_token.c", + "src/core/security/secure_endpoint.c", + "src/core/security/secure_transport_setup.c", + "src/core/security/security_context.c", + "src/core/security/server_secure_chttp2.c", + "src/core/surface/init_secure.c", + "src/core/surface/secure_channel_create.c", + "src/core/tsi/fake_transport_security.c", + "src/core/tsi/ssl_transport_security.c", + "src/core/tsi/transport_security.c", + "src/core/channel/call_op_string.c", + "src/core/channel/census_filter.c", + "src/core/channel/channel_args.c", + "src/core/channel/channel_stack.c", + "src/core/channel/child_channel.c", + "src/core/channel/client_channel.c", + "src/core/channel/client_setup.c", + "src/core/channel/connected_channel.c", + "src/core/channel/http_client_filter.c", + "src/core/channel/http_filter.c", + "src/core/channel/http_server_filter.c", + "src/core/channel/metadata_buffer.c", + "src/core/channel/noop_filter.c", + "src/core/compression/algorithm.c", + "src/core/compression/message_compress.c", + "src/core/debug/trace.c", + "src/core/iomgr/alarm.c", + "src/core/iomgr/alarm_heap.c", + "src/core/iomgr/endpoint.c", + "src/core/iomgr/endpoint_pair_posix.c", + "src/core/iomgr/fd_posix.c", + "src/core/iomgr/iocp_windows.c", + "src/core/iomgr/iomgr.c", + "src/core/iomgr/iomgr_posix.c", + "src/core/iomgr/iomgr_windows.c", + "src/core/iomgr/pollset_kick.c", + "src/core/iomgr/pollset_multipoller_with_epoll.c", + "src/core/iomgr/pollset_multipoller_with_poll_posix.c", + "src/core/iomgr/pollset_posix.c", + "src/core/iomgr/pollset_windows.c", + "src/core/iomgr/resolve_address_posix.c", + "src/core/iomgr/resolve_address_windows.c", + "src/core/iomgr/sockaddr_utils.c", + "src/core/iomgr/socket_utils_common_posix.c", + "src/core/iomgr/socket_utils_linux.c", + "src/core/iomgr/socket_utils_posix.c", + "src/core/iomgr/socket_windows.c", + "src/core/iomgr/tcp_client_posix.c", + "src/core/iomgr/tcp_client_windows.c", + "src/core/iomgr/tcp_posix.c", + "src/core/iomgr/tcp_server_posix.c", + "src/core/iomgr/tcp_server_windows.c", + "src/core/iomgr/tcp_windows.c", + "src/core/iomgr/time_averaged_stats.c", + "src/core/iomgr/wakeup_fd_eventfd.c", + "src/core/iomgr/wakeup_fd_nospecial.c", + "src/core/iomgr/wakeup_fd_pipe.c", + "src/core/iomgr/wakeup_fd_posix.c", + "src/core/json/json.c", + "src/core/json/json_reader.c", + "src/core/json/json_string.c", + "src/core/json/json_writer.c", + "src/core/statistics/census_init.c", + "src/core/statistics/census_log.c", + "src/core/statistics/census_rpc_stats.c", + "src/core/statistics/census_tracing.c", + "src/core/statistics/hash_table.c", + "src/core/statistics/window_stats.c", + "src/core/surface/byte_buffer.c", + "src/core/surface/byte_buffer_queue.c", + "src/core/surface/byte_buffer_reader.c", + "src/core/surface/call.c", + "src/core/surface/call_details.c", + "src/core/surface/call_log_batch.c", + "src/core/surface/channel.c", + "src/core/surface/channel_create.c", + "src/core/surface/client.c", + "src/core/surface/completion_queue.c", + "src/core/surface/event_string.c", + "src/core/surface/init.c", + "src/core/surface/lame_client.c", + "src/core/surface/metadata_array.c", + "src/core/surface/server.c", + "src/core/surface/server_chttp2.c", + "src/core/surface/server_create.c", + "src/core/surface/surface_trace.c", + "src/core/transport/chttp2/alpn.c", + "src/core/transport/chttp2/bin_encoder.c", + "src/core/transport/chttp2/frame_data.c", + "src/core/transport/chttp2/frame_goaway.c", + "src/core/transport/chttp2/frame_ping.c", + "src/core/transport/chttp2/frame_rst_stream.c", + "src/core/transport/chttp2/frame_settings.c", + "src/core/transport/chttp2/frame_window_update.c", + "src/core/transport/chttp2/hpack_parser.c", + "src/core/transport/chttp2/hpack_table.c", + "src/core/transport/chttp2/huffsyms.c", + "src/core/transport/chttp2/status_conversion.c", + "src/core/transport/chttp2/stream_encoder.c", + "src/core/transport/chttp2/stream_map.c", + "src/core/transport/chttp2/timeout_encoding.c", + "src/core/transport/chttp2/varint.c", + "src/core/transport/chttp2_transport.c", + "src/core/transport/metadata.c", + "src/core/transport/stream_op.c", + "src/core/transport/transport.c", + ], + hdrs = [ + "include/grpc/grpc_security.h", + "include/grpc/byte_buffer.h", + "include/grpc/byte_buffer_reader.h", + "include/grpc/grpc.h", + "include/grpc/grpc_http.h", + "include/grpc/status.h", + ], + includes = [ + "include", + ".", + ], + deps = [ + "//external:libssl", + ":gpr", + ], +) cc_library( - name = "gpr", - srcs = [ - "src/core/support/env.h", - "src/core/support/file.h", - "src/core/support/murmur_hash.h", - "src/core/support/string.h", - "src/core/support/string_win32.h", - "src/core/support/thd_internal.h", - "src/core/support/alloc.c", - "src/core/support/cancellable.c", - "src/core/support/cmdline.c", - "src/core/support/cpu_iphone.c", - "src/core/support/cpu_linux.c", - "src/core/support/cpu_posix.c", - "src/core/support/cpu_windows.c", - "src/core/support/env_linux.c", - "src/core/support/env_posix.c", - "src/core/support/env_win32.c", - "src/core/support/file.c", - "src/core/support/file_posix.c", - "src/core/support/file_win32.c", - "src/core/support/histogram.c", - "src/core/support/host_port.c", - "src/core/support/log.c", - "src/core/support/log_android.c", - "src/core/support/log_linux.c", - "src/core/support/log_posix.c", - "src/core/support/log_win32.c", - "src/core/support/murmur_hash.c", - "src/core/support/slice.c", - "src/core/support/slice_buffer.c", - "src/core/support/string.c", - "src/core/support/string_posix.c", - "src/core/support/string_win32.c", - "src/core/support/sync.c", - "src/core/support/sync_posix.c", - "src/core/support/sync_win32.c", - "src/core/support/thd.c", - "src/core/support/thd_posix.c", - "src/core/support/thd_win32.c", - "src/core/support/time.c", - "src/core/support/time_posix.c", - "src/core/support/time_win32.c", - ], - hdrs = [ - "include/grpc/support/alloc.h", - "include/grpc/support/atm.h", - "include/grpc/support/atm_gcc_atomic.h", - "include/grpc/support/atm_gcc_sync.h", - "include/grpc/support/atm_win32.h", - "include/grpc/support/cancellable_platform.h", - "include/grpc/support/cmdline.h", - "include/grpc/support/cpu.h", - "include/grpc/support/histogram.h", - "include/grpc/support/host_port.h", - "include/grpc/support/log.h", - "include/grpc/support/log_win32.h", - "include/grpc/support/port_platform.h", - "include/grpc/support/slice.h", - "include/grpc/support/slice_buffer.h", - "include/grpc/support/sync.h", - "include/grpc/support/sync_generic.h", - "include/grpc/support/sync_posix.h", - "include/grpc/support/sync_win32.h", - "include/grpc/support/thd.h", - "include/grpc/support/time.h", - "include/grpc/support/useful.h", - ], - includes = [ - "include", - ".", - ], - deps = [ - ], + name = "grpc_unsecure", + srcs = [ + "src/core/channel/census_filter.h", + "src/core/channel/channel_args.h", + "src/core/channel/channel_stack.h", + "src/core/channel/child_channel.h", + "src/core/channel/client_channel.h", + "src/core/channel/client_setup.h", + "src/core/channel/connected_channel.h", + "src/core/channel/http_client_filter.h", + "src/core/channel/http_filter.h", + "src/core/channel/http_server_filter.h", + "src/core/channel/metadata_buffer.h", + "src/core/channel/noop_filter.h", + "src/core/compression/algorithm.h", + "src/core/compression/message_compress.h", + "src/core/debug/trace.h", + "src/core/iomgr/alarm.h", + "src/core/iomgr/alarm_heap.h", + "src/core/iomgr/alarm_internal.h", + "src/core/iomgr/endpoint.h", + "src/core/iomgr/endpoint_pair.h", + "src/core/iomgr/fd_posix.h", + "src/core/iomgr/iocp_windows.h", + "src/core/iomgr/iomgr.h", + "src/core/iomgr/iomgr_internal.h", + "src/core/iomgr/iomgr_posix.h", + "src/core/iomgr/pollset.h", + "src/core/iomgr/pollset_kick.h", + "src/core/iomgr/pollset_kick_posix.h", + "src/core/iomgr/pollset_kick_windows.h", + "src/core/iomgr/pollset_posix.h", + "src/core/iomgr/pollset_windows.h", + "src/core/iomgr/resolve_address.h", + "src/core/iomgr/sockaddr.h", + "src/core/iomgr/sockaddr_posix.h", + "src/core/iomgr/sockaddr_utils.h", + "src/core/iomgr/sockaddr_win32.h", + "src/core/iomgr/socket_utils_posix.h", + "src/core/iomgr/socket_windows.h", + "src/core/iomgr/tcp_client.h", + "src/core/iomgr/tcp_posix.h", + "src/core/iomgr/tcp_server.h", + "src/core/iomgr/tcp_windows.h", + "src/core/iomgr/time_averaged_stats.h", + "src/core/iomgr/wakeup_fd_pipe.h", + "src/core/iomgr/wakeup_fd_posix.h", + "src/core/json/json.h", + "src/core/json/json_common.h", + "src/core/json/json_reader.h", + "src/core/json/json_writer.h", + "src/core/statistics/census_interface.h", + "src/core/statistics/census_log.h", + "src/core/statistics/census_rpc_stats.h", + "src/core/statistics/census_tracing.h", + "src/core/statistics/hash_table.h", + "src/core/statistics/window_stats.h", + "src/core/surface/byte_buffer_queue.h", + "src/core/surface/call.h", + "src/core/surface/channel.h", + "src/core/surface/client.h", + "src/core/surface/completion_queue.h", + "src/core/surface/event_string.h", + "src/core/surface/init.h", + "src/core/surface/server.h", + "src/core/surface/surface_trace.h", + "src/core/transport/chttp2/alpn.h", + "src/core/transport/chttp2/bin_encoder.h", + "src/core/transport/chttp2/frame.h", + "src/core/transport/chttp2/frame_data.h", + "src/core/transport/chttp2/frame_goaway.h", + "src/core/transport/chttp2/frame_ping.h", + "src/core/transport/chttp2/frame_rst_stream.h", + "src/core/transport/chttp2/frame_settings.h", + "src/core/transport/chttp2/frame_window_update.h", + "src/core/transport/chttp2/hpack_parser.h", + "src/core/transport/chttp2/hpack_table.h", + "src/core/transport/chttp2/http2_errors.h", + "src/core/transport/chttp2/huffsyms.h", + "src/core/transport/chttp2/status_conversion.h", + "src/core/transport/chttp2/stream_encoder.h", + "src/core/transport/chttp2/stream_map.h", + "src/core/transport/chttp2/timeout_encoding.h", + "src/core/transport/chttp2/varint.h", + "src/core/transport/chttp2_transport.h", + "src/core/transport/metadata.h", + "src/core/transport/stream_op.h", + "src/core/transport/transport.h", + "src/core/transport/transport_impl.h", + "src/core/surface/init_unsecure.c", + "src/core/channel/call_op_string.c", + "src/core/channel/census_filter.c", + "src/core/channel/channel_args.c", + "src/core/channel/channel_stack.c", + "src/core/channel/child_channel.c", + "src/core/channel/client_channel.c", + "src/core/channel/client_setup.c", + "src/core/channel/connected_channel.c", + "src/core/channel/http_client_filter.c", + "src/core/channel/http_filter.c", + "src/core/channel/http_server_filter.c", + "src/core/channel/metadata_buffer.c", + "src/core/channel/noop_filter.c", + "src/core/compression/algorithm.c", + "src/core/compression/message_compress.c", + "src/core/debug/trace.c", + "src/core/iomgr/alarm.c", + "src/core/iomgr/alarm_heap.c", + "src/core/iomgr/endpoint.c", + "src/core/iomgr/endpoint_pair_posix.c", + "src/core/iomgr/fd_posix.c", + "src/core/iomgr/iocp_windows.c", + "src/core/iomgr/iomgr.c", + "src/core/iomgr/iomgr_posix.c", + "src/core/iomgr/iomgr_windows.c", + "src/core/iomgr/pollset_kick.c", + "src/core/iomgr/pollset_multipoller_with_epoll.c", + "src/core/iomgr/pollset_multipoller_with_poll_posix.c", + "src/core/iomgr/pollset_posix.c", + "src/core/iomgr/pollset_windows.c", + "src/core/iomgr/resolve_address_posix.c", + "src/core/iomgr/resolve_address_windows.c", + "src/core/iomgr/sockaddr_utils.c", + "src/core/iomgr/socket_utils_common_posix.c", + "src/core/iomgr/socket_utils_linux.c", + "src/core/iomgr/socket_utils_posix.c", + "src/core/iomgr/socket_windows.c", + "src/core/iomgr/tcp_client_posix.c", + "src/core/iomgr/tcp_client_windows.c", + "src/core/iomgr/tcp_posix.c", + "src/core/iomgr/tcp_server_posix.c", + "src/core/iomgr/tcp_server_windows.c", + "src/core/iomgr/tcp_windows.c", + "src/core/iomgr/time_averaged_stats.c", + "src/core/iomgr/wakeup_fd_eventfd.c", + "src/core/iomgr/wakeup_fd_nospecial.c", + "src/core/iomgr/wakeup_fd_pipe.c", + "src/core/iomgr/wakeup_fd_posix.c", + "src/core/json/json.c", + "src/core/json/json_reader.c", + "src/core/json/json_string.c", + "src/core/json/json_writer.c", + "src/core/statistics/census_init.c", + "src/core/statistics/census_log.c", + "src/core/statistics/census_rpc_stats.c", + "src/core/statistics/census_tracing.c", + "src/core/statistics/hash_table.c", + "src/core/statistics/window_stats.c", + "src/core/surface/byte_buffer.c", + "src/core/surface/byte_buffer_queue.c", + "src/core/surface/byte_buffer_reader.c", + "src/core/surface/call.c", + "src/core/surface/call_details.c", + "src/core/surface/call_log_batch.c", + "src/core/surface/channel.c", + "src/core/surface/channel_create.c", + "src/core/surface/client.c", + "src/core/surface/completion_queue.c", + "src/core/surface/event_string.c", + "src/core/surface/init.c", + "src/core/surface/lame_client.c", + "src/core/surface/metadata_array.c", + "src/core/surface/server.c", + "src/core/surface/server_chttp2.c", + "src/core/surface/server_create.c", + "src/core/surface/surface_trace.c", + "src/core/transport/chttp2/alpn.c", + "src/core/transport/chttp2/bin_encoder.c", + "src/core/transport/chttp2/frame_data.c", + "src/core/transport/chttp2/frame_goaway.c", + "src/core/transport/chttp2/frame_ping.c", + "src/core/transport/chttp2/frame_rst_stream.c", + "src/core/transport/chttp2/frame_settings.c", + "src/core/transport/chttp2/frame_window_update.c", + "src/core/transport/chttp2/hpack_parser.c", + "src/core/transport/chttp2/hpack_table.c", + "src/core/transport/chttp2/huffsyms.c", + "src/core/transport/chttp2/status_conversion.c", + "src/core/transport/chttp2/stream_encoder.c", + "src/core/transport/chttp2/stream_map.c", + "src/core/transport/chttp2/timeout_encoding.c", + "src/core/transport/chttp2/varint.c", + "src/core/transport/chttp2_transport.c", + "src/core/transport/metadata.c", + "src/core/transport/stream_op.c", + "src/core/transport/transport.c", + ], + hdrs = [ + "include/grpc/byte_buffer.h", + "include/grpc/byte_buffer_reader.h", + "include/grpc/grpc.h", + "include/grpc/grpc_http.h", + "include/grpc/status.h", + ], + includes = [ + "include", + ".", + ], + deps = [ + ":gpr", + ], ) +cc_library( + name = "grpc++", + srcs = [ + "src/cpp/client/secure_credentials.h", + "src/cpp/server/secure_server_credentials.h", + "src/cpp/client/channel.h", + "src/cpp/proto/proto_utils.h", + "src/cpp/server/thread_pool.h", + "src/cpp/util/time.h", + "src/cpp/client/secure_credentials.cc", + "src/cpp/server/secure_server_credentials.cc", + "src/cpp/client/channel.cc", + "src/cpp/client/channel_arguments.cc", + "src/cpp/client/client_context.cc", + "src/cpp/client/client_unary_call.cc", + "src/cpp/client/create_channel.cc", + "src/cpp/client/credentials.cc", + "src/cpp/client/generic_stub.cc", + "src/cpp/client/insecure_credentials.cc", + "src/cpp/client/internal_stub.cc", + "src/cpp/common/call.cc", + "src/cpp/common/completion_queue.cc", + "src/cpp/common/rpc_method.cc", + "src/cpp/proto/proto_utils.cc", + "src/cpp/server/async_generic_service.cc", + "src/cpp/server/insecure_server_credentials.cc", + "src/cpp/server/server.cc", + "src/cpp/server/server_builder.cc", + "src/cpp/server/server_context.cc", + "src/cpp/server/server_credentials.cc", + "src/cpp/server/thread_pool.cc", + "src/cpp/util/byte_buffer.cc", + "src/cpp/util/slice.cc", + "src/cpp/util/status.cc", + "src/cpp/util/time.cc", + ], + hdrs = [ + "include/grpc++/async_generic_service.h", + "include/grpc++/async_unary_call.h", + "include/grpc++/byte_buffer.h", + "include/grpc++/channel_arguments.h", + "include/grpc++/channel_interface.h", + "include/grpc++/client_context.h", + "include/grpc++/completion_queue.h", + "include/grpc++/config.h", + "include/grpc++/create_channel.h", + "include/grpc++/credentials.h", + "include/grpc++/generic_stub.h", + "include/grpc++/impl/call.h", + "include/grpc++/impl/client_unary_call.h", + "include/grpc++/impl/internal_stub.h", + "include/grpc++/impl/rpc_method.h", + "include/grpc++/impl/rpc_service_method.h", + "include/grpc++/impl/service_type.h", + "include/grpc++/server.h", + "include/grpc++/server_builder.h", + "include/grpc++/server_context.h", + "include/grpc++/server_credentials.h", + "include/grpc++/slice.h", + "include/grpc++/status.h", + "include/grpc++/status_code_enum.h", + "include/grpc++/stream.h", + "include/grpc++/thread_pool_interface.h", + ], + includes = [ + "include", + ".", + ], + deps = [ + "//external:protobuf_clib", + ":gpr", + ":grpc", + ], +) cc_library( - name = "grpc", - srcs = [ - "src/core/httpcli/format_request.h", - "src/core/httpcli/httpcli.h", - "src/core/httpcli/httpcli_security_context.h", - "src/core/httpcli/parser.h", - "src/core/security/auth.h", - "src/core/security/base64.h", - "src/core/security/credentials.h", - "src/core/security/json_token.h", - "src/core/security/secure_endpoint.h", - "src/core/security/secure_transport_setup.h", - "src/core/security/security_context.h", - "src/core/tsi/fake_transport_security.h", - "src/core/tsi/ssl_transport_security.h", - "src/core/tsi/transport_security.h", - "src/core/tsi/transport_security_interface.h", - "src/core/channel/census_filter.h", - "src/core/channel/channel_args.h", - "src/core/channel/channel_stack.h", - "src/core/channel/child_channel.h", - "src/core/channel/client_channel.h", - "src/core/channel/client_setup.h", - "src/core/channel/connected_channel.h", - "src/core/channel/http_client_filter.h", - "src/core/channel/http_filter.h", - "src/core/channel/http_server_filter.h", - "src/core/channel/metadata_buffer.h", - "src/core/channel/noop_filter.h", - "src/core/compression/algorithm.h", - "src/core/compression/message_compress.h", - "src/core/debug/trace.h", - "src/core/iomgr/alarm.h", - "src/core/iomgr/alarm_heap.h", - "src/core/iomgr/alarm_internal.h", - "src/core/iomgr/endpoint.h", - "src/core/iomgr/endpoint_pair.h", - "src/core/iomgr/fd_posix.h", - "src/core/iomgr/iocp_windows.h", - "src/core/iomgr/iomgr.h", - "src/core/iomgr/iomgr_internal.h", - "src/core/iomgr/iomgr_posix.h", - "src/core/iomgr/pollset.h", - "src/core/iomgr/pollset_kick.h", - "src/core/iomgr/pollset_kick_posix.h", - "src/core/iomgr/pollset_kick_windows.h", - "src/core/iomgr/pollset_posix.h", - "src/core/iomgr/pollset_windows.h", - "src/core/iomgr/resolve_address.h", - "src/core/iomgr/sockaddr.h", - "src/core/iomgr/sockaddr_posix.h", - "src/core/iomgr/sockaddr_utils.h", - "src/core/iomgr/sockaddr_win32.h", - "src/core/iomgr/socket_utils_posix.h", - "src/core/iomgr/socket_windows.h", - "src/core/iomgr/tcp_client.h", - "src/core/iomgr/tcp_posix.h", - "src/core/iomgr/tcp_server.h", - "src/core/iomgr/tcp_windows.h", - "src/core/iomgr/time_averaged_stats.h", - "src/core/iomgr/wakeup_fd_pipe.h", - "src/core/iomgr/wakeup_fd_posix.h", - "src/core/json/json.h", - "src/core/json/json_common.h", - "src/core/json/json_reader.h", - "src/core/json/json_writer.h", - "src/core/statistics/census_interface.h", - "src/core/statistics/census_log.h", - "src/core/statistics/census_rpc_stats.h", - "src/core/statistics/census_tracing.h", - "src/core/statistics/hash_table.h", - "src/core/statistics/window_stats.h", - "src/core/surface/byte_buffer_queue.h", - "src/core/surface/call.h", - "src/core/surface/channel.h", - "src/core/surface/client.h", - "src/core/surface/completion_queue.h", - "src/core/surface/event_string.h", - "src/core/surface/init.h", - "src/core/surface/server.h", - "src/core/surface/surface_trace.h", - "src/core/transport/chttp2/alpn.h", - "src/core/transport/chttp2/bin_encoder.h", - "src/core/transport/chttp2/frame.h", - "src/core/transport/chttp2/frame_data.h", - "src/core/transport/chttp2/frame_goaway.h", - "src/core/transport/chttp2/frame_ping.h", - "src/core/transport/chttp2/frame_rst_stream.h", - "src/core/transport/chttp2/frame_settings.h", - "src/core/transport/chttp2/frame_window_update.h", - "src/core/transport/chttp2/hpack_parser.h", - "src/core/transport/chttp2/hpack_table.h", - "src/core/transport/chttp2/http2_errors.h", - "src/core/transport/chttp2/huffsyms.h", - "src/core/transport/chttp2/status_conversion.h", - "src/core/transport/chttp2/stream_encoder.h", - "src/core/transport/chttp2/stream_map.h", - "src/core/transport/chttp2/timeout_encoding.h", - "src/core/transport/chttp2/varint.h", - "src/core/transport/chttp2_transport.h", - "src/core/transport/metadata.h", - "src/core/transport/stream_op.h", - "src/core/transport/transport.h", - "src/core/transport/transport_impl.h", - "src/core/httpcli/format_request.c", - "src/core/httpcli/httpcli.c", - "src/core/httpcli/httpcli_security_context.c", - "src/core/httpcli/parser.c", - "src/core/security/auth.c", - "src/core/security/base64.c", - "src/core/security/credentials.c", - "src/core/security/credentials_posix.c", - "src/core/security/credentials_win32.c", - "src/core/security/factories.c", - "src/core/security/google_default_credentials.c", - "src/core/security/json_token.c", - "src/core/security/secure_endpoint.c", - "src/core/security/secure_transport_setup.c", - "src/core/security/security_context.c", - "src/core/security/server_secure_chttp2.c", - "src/core/surface/init_secure.c", - "src/core/surface/secure_channel_create.c", - "src/core/tsi/fake_transport_security.c", - "src/core/tsi/ssl_transport_security.c", - "src/core/tsi/transport_security.c", - "src/core/channel/call_op_string.c", - "src/core/channel/census_filter.c", - "src/core/channel/channel_args.c", - "src/core/channel/channel_stack.c", - "src/core/channel/child_channel.c", - "src/core/channel/client_channel.c", - "src/core/channel/client_setup.c", - "src/core/channel/connected_channel.c", - "src/core/channel/http_client_filter.c", - "src/core/channel/http_filter.c", - "src/core/channel/http_server_filter.c", - "src/core/channel/metadata_buffer.c", - "src/core/channel/noop_filter.c", - "src/core/compression/algorithm.c", - "src/core/compression/message_compress.c", - "src/core/debug/trace.c", - "src/core/iomgr/alarm.c", - "src/core/iomgr/alarm_heap.c", - "src/core/iomgr/endpoint.c", - "src/core/iomgr/endpoint_pair_posix.c", - "src/core/iomgr/fd_posix.c", - "src/core/iomgr/iocp_windows.c", - "src/core/iomgr/iomgr.c", - "src/core/iomgr/iomgr_posix.c", - "src/core/iomgr/iomgr_windows.c", - "src/core/iomgr/pollset_kick.c", - "src/core/iomgr/pollset_multipoller_with_epoll.c", - "src/core/iomgr/pollset_multipoller_with_poll_posix.c", - "src/core/iomgr/pollset_posix.c", - "src/core/iomgr/pollset_windows.c", - "src/core/iomgr/resolve_address_posix.c", - "src/core/iomgr/resolve_address_windows.c", - "src/core/iomgr/sockaddr_utils.c", - "src/core/iomgr/socket_utils_common_posix.c", - "src/core/iomgr/socket_utils_linux.c", - "src/core/iomgr/socket_utils_posix.c", - "src/core/iomgr/socket_windows.c", - "src/core/iomgr/tcp_client_posix.c", - "src/core/iomgr/tcp_client_windows.c", - "src/core/iomgr/tcp_posix.c", - "src/core/iomgr/tcp_server_posix.c", - "src/core/iomgr/tcp_server_windows.c", - "src/core/iomgr/tcp_windows.c", - "src/core/iomgr/time_averaged_stats.c", - "src/core/iomgr/wakeup_fd_eventfd.c", - "src/core/iomgr/wakeup_fd_nospecial.c", - "src/core/iomgr/wakeup_fd_pipe.c", - "src/core/iomgr/wakeup_fd_posix.c", - "src/core/json/json.c", - "src/core/json/json_reader.c", - "src/core/json/json_string.c", - "src/core/json/json_writer.c", - "src/core/statistics/census_init.c", - "src/core/statistics/census_log.c", - "src/core/statistics/census_rpc_stats.c", - "src/core/statistics/census_tracing.c", - "src/core/statistics/hash_table.c", - "src/core/statistics/window_stats.c", - "src/core/surface/byte_buffer.c", - "src/core/surface/byte_buffer_queue.c", - "src/core/surface/byte_buffer_reader.c", - "src/core/surface/call.c", - "src/core/surface/call_details.c", - "src/core/surface/call_log_batch.c", - "src/core/surface/channel.c", - "src/core/surface/channel_create.c", - "src/core/surface/client.c", - "src/core/surface/completion_queue.c", - "src/core/surface/event_string.c", - "src/core/surface/init.c", - "src/core/surface/lame_client.c", - "src/core/surface/metadata_array.c", - "src/core/surface/server.c", - "src/core/surface/server_chttp2.c", - "src/core/surface/server_create.c", - "src/core/surface/surface_trace.c", - "src/core/transport/chttp2/alpn.c", - "src/core/transport/chttp2/bin_encoder.c", - "src/core/transport/chttp2/frame_data.c", - "src/core/transport/chttp2/frame_goaway.c", - "src/core/transport/chttp2/frame_ping.c", - "src/core/transport/chttp2/frame_rst_stream.c", - "src/core/transport/chttp2/frame_settings.c", - "src/core/transport/chttp2/frame_window_update.c", - "src/core/transport/chttp2/hpack_parser.c", - "src/core/transport/chttp2/hpack_table.c", - "src/core/transport/chttp2/huffsyms.c", - "src/core/transport/chttp2/status_conversion.c", - "src/core/transport/chttp2/stream_encoder.c", - "src/core/transport/chttp2/stream_map.c", - "src/core/transport/chttp2/timeout_encoding.c", - "src/core/transport/chttp2/varint.c", - "src/core/transport/chttp2_transport.c", - "src/core/transport/metadata.c", - "src/core/transport/stream_op.c", - "src/core/transport/transport.c", - ], - hdrs = [ - "include/grpc/grpc_security.h", - "include/grpc/byte_buffer.h", - "include/grpc/byte_buffer_reader.h", - "include/grpc/grpc.h", - "include/grpc/grpc_http.h", - "include/grpc/status.h", - ], - includes = [ - "include", - ".", - ], - deps = [ - ":gpr", - ], + name = "grpc++_unsecure", + srcs = [ + "src/cpp/client/channel.h", + "src/cpp/proto/proto_utils.h", + "src/cpp/server/thread_pool.h", + "src/cpp/util/time.h", + "src/cpp/client/channel.cc", + "src/cpp/client/channel_arguments.cc", + "src/cpp/client/client_context.cc", + "src/cpp/client/client_unary_call.cc", + "src/cpp/client/create_channel.cc", + "src/cpp/client/credentials.cc", + "src/cpp/client/generic_stub.cc", + "src/cpp/client/insecure_credentials.cc", + "src/cpp/client/internal_stub.cc", + "src/cpp/common/call.cc", + "src/cpp/common/completion_queue.cc", + "src/cpp/common/rpc_method.cc", + "src/cpp/proto/proto_utils.cc", + "src/cpp/server/async_generic_service.cc", + "src/cpp/server/insecure_server_credentials.cc", + "src/cpp/server/server.cc", + "src/cpp/server/server_builder.cc", + "src/cpp/server/server_context.cc", + "src/cpp/server/server_credentials.cc", + "src/cpp/server/thread_pool.cc", + "src/cpp/util/byte_buffer.cc", + "src/cpp/util/slice.cc", + "src/cpp/util/status.cc", + "src/cpp/util/time.cc", + ], + hdrs = [ + "include/grpc++/async_generic_service.h", + "include/grpc++/async_unary_call.h", + "include/grpc++/byte_buffer.h", + "include/grpc++/channel_arguments.h", + "include/grpc++/channel_interface.h", + "include/grpc++/client_context.h", + "include/grpc++/completion_queue.h", + "include/grpc++/config.h", + "include/grpc++/create_channel.h", + "include/grpc++/credentials.h", + "include/grpc++/generic_stub.h", + "include/grpc++/impl/call.h", + "include/grpc++/impl/client_unary_call.h", + "include/grpc++/impl/internal_stub.h", + "include/grpc++/impl/rpc_method.h", + "include/grpc++/impl/rpc_service_method.h", + "include/grpc++/impl/service_type.h", + "include/grpc++/server.h", + "include/grpc++/server_builder.h", + "include/grpc++/server_context.h", + "include/grpc++/server_credentials.h", + "include/grpc++/slice.h", + "include/grpc++/status.h", + "include/grpc++/status_code_enum.h", + "include/grpc++/stream.h", + "include/grpc++/thread_pool_interface.h", + ], + includes = [ + "include", + ".", + ], + deps = [ + "//external:protobuf_clib", + ":gpr", + ":grpc_unsecure", + ], ) +cc_library( + name = "grpc_plugin_support", + srcs = [ + "src/compiler/config.h", + "src/compiler/cpp_generator.h", + "src/compiler/cpp_generator_helpers.h", + "src/compiler/generator_helpers.h", + "src/compiler/objective_c_generator.h", + "src/compiler/objective_c_generator_helpers.h", + "src/compiler/python_generator.h", + "src/compiler/ruby_generator.h", + "src/compiler/ruby_generator_helpers-inl.h", + "src/compiler/ruby_generator_map-inl.h", + "src/compiler/ruby_generator_string-inl.h", + "src/compiler/cpp_generator.cc", + "src/compiler/objective_c_generator.cc", + "src/compiler/python_generator.cc", + "src/compiler/ruby_generator.cc", + ], + hdrs = [ + ], + includes = [ + "include", + ".", + ], + deps = [ + "//external:protobuf_compiler", + ], +) cc_library( - name = "grpc_unsecure", - srcs = [ - "src/core/channel/census_filter.h", - "src/core/channel/channel_args.h", - "src/core/channel/channel_stack.h", - "src/core/channel/child_channel.h", - "src/core/channel/client_channel.h", - "src/core/channel/client_setup.h", - "src/core/channel/connected_channel.h", - "src/core/channel/http_client_filter.h", - "src/core/channel/http_filter.h", - "src/core/channel/http_server_filter.h", - "src/core/channel/metadata_buffer.h", - "src/core/channel/noop_filter.h", - "src/core/compression/algorithm.h", - "src/core/compression/message_compress.h", - "src/core/debug/trace.h", - "src/core/iomgr/alarm.h", - "src/core/iomgr/alarm_heap.h", - "src/core/iomgr/alarm_internal.h", - "src/core/iomgr/endpoint.h", - "src/core/iomgr/endpoint_pair.h", - "src/core/iomgr/fd_posix.h", - "src/core/iomgr/iocp_windows.h", - "src/core/iomgr/iomgr.h", - "src/core/iomgr/iomgr_internal.h", - "src/core/iomgr/iomgr_posix.h", - "src/core/iomgr/pollset.h", - "src/core/iomgr/pollset_kick.h", - "src/core/iomgr/pollset_kick_posix.h", - "src/core/iomgr/pollset_kick_windows.h", - "src/core/iomgr/pollset_posix.h", - "src/core/iomgr/pollset_windows.h", - "src/core/iomgr/resolve_address.h", - "src/core/iomgr/sockaddr.h", - "src/core/iomgr/sockaddr_posix.h", - "src/core/iomgr/sockaddr_utils.h", - "src/core/iomgr/sockaddr_win32.h", - "src/core/iomgr/socket_utils_posix.h", - "src/core/iomgr/socket_windows.h", - "src/core/iomgr/tcp_client.h", - "src/core/iomgr/tcp_posix.h", - "src/core/iomgr/tcp_server.h", - "src/core/iomgr/tcp_windows.h", - "src/core/iomgr/time_averaged_stats.h", - "src/core/iomgr/wakeup_fd_pipe.h", - "src/core/iomgr/wakeup_fd_posix.h", - "src/core/json/json.h", - "src/core/json/json_common.h", - "src/core/json/json_reader.h", - "src/core/json/json_writer.h", - "src/core/statistics/census_interface.h", - "src/core/statistics/census_log.h", - "src/core/statistics/census_rpc_stats.h", - "src/core/statistics/census_tracing.h", - "src/core/statistics/hash_table.h", - "src/core/statistics/window_stats.h", - "src/core/surface/byte_buffer_queue.h", - "src/core/surface/call.h", - "src/core/surface/channel.h", - "src/core/surface/client.h", - "src/core/surface/completion_queue.h", - "src/core/surface/event_string.h", - "src/core/surface/init.h", - "src/core/surface/server.h", - "src/core/surface/surface_trace.h", - "src/core/transport/chttp2/alpn.h", - "src/core/transport/chttp2/bin_encoder.h", - "src/core/transport/chttp2/frame.h", - "src/core/transport/chttp2/frame_data.h", - "src/core/transport/chttp2/frame_goaway.h", - "src/core/transport/chttp2/frame_ping.h", - "src/core/transport/chttp2/frame_rst_stream.h", - "src/core/transport/chttp2/frame_settings.h", - "src/core/transport/chttp2/frame_window_update.h", - "src/core/transport/chttp2/hpack_parser.h", - "src/core/transport/chttp2/hpack_table.h", - "src/core/transport/chttp2/http2_errors.h", - "src/core/transport/chttp2/huffsyms.h", - "src/core/transport/chttp2/status_conversion.h", - "src/core/transport/chttp2/stream_encoder.h", - "src/core/transport/chttp2/stream_map.h", - "src/core/transport/chttp2/timeout_encoding.h", - "src/core/transport/chttp2/varint.h", - "src/core/transport/chttp2_transport.h", - "src/core/transport/metadata.h", - "src/core/transport/stream_op.h", - "src/core/transport/transport.h", - "src/core/transport/transport_impl.h", - "src/core/surface/init_unsecure.c", - "src/core/channel/call_op_string.c", - "src/core/channel/census_filter.c", - "src/core/channel/channel_args.c", - "src/core/channel/channel_stack.c", - "src/core/channel/child_channel.c", - "src/core/channel/client_channel.c", - "src/core/channel/client_setup.c", - "src/core/channel/connected_channel.c", - "src/core/channel/http_client_filter.c", - "src/core/channel/http_filter.c", - "src/core/channel/http_server_filter.c", - "src/core/channel/metadata_buffer.c", - "src/core/channel/noop_filter.c", - "src/core/compression/algorithm.c", - "src/core/compression/message_compress.c", - "src/core/debug/trace.c", - "src/core/iomgr/alarm.c", - "src/core/iomgr/alarm_heap.c", - "src/core/iomgr/endpoint.c", - "src/core/iomgr/endpoint_pair_posix.c", - "src/core/iomgr/fd_posix.c", - "src/core/iomgr/iocp_windows.c", - "src/core/iomgr/iomgr.c", - "src/core/iomgr/iomgr_posix.c", - "src/core/iomgr/iomgr_windows.c", - "src/core/iomgr/pollset_kick.c", - "src/core/iomgr/pollset_multipoller_with_epoll.c", - "src/core/iomgr/pollset_multipoller_with_poll_posix.c", - "src/core/iomgr/pollset_posix.c", - "src/core/iomgr/pollset_windows.c", - "src/core/iomgr/resolve_address_posix.c", - "src/core/iomgr/resolve_address_windows.c", - "src/core/iomgr/sockaddr_utils.c", - "src/core/iomgr/socket_utils_common_posix.c", - "src/core/iomgr/socket_utils_linux.c", - "src/core/iomgr/socket_utils_posix.c", - "src/core/iomgr/socket_windows.c", - "src/core/iomgr/tcp_client_posix.c", - "src/core/iomgr/tcp_client_windows.c", - "src/core/iomgr/tcp_posix.c", - "src/core/iomgr/tcp_server_posix.c", - "src/core/iomgr/tcp_server_windows.c", - "src/core/iomgr/tcp_windows.c", - "src/core/iomgr/time_averaged_stats.c", - "src/core/iomgr/wakeup_fd_eventfd.c", - "src/core/iomgr/wakeup_fd_nospecial.c", - "src/core/iomgr/wakeup_fd_pipe.c", - "src/core/iomgr/wakeup_fd_posix.c", - "src/core/json/json.c", - "src/core/json/json_reader.c", - "src/core/json/json_string.c", - "src/core/json/json_writer.c", - "src/core/statistics/census_init.c", - "src/core/statistics/census_log.c", - "src/core/statistics/census_rpc_stats.c", - "src/core/statistics/census_tracing.c", - "src/core/statistics/hash_table.c", - "src/core/statistics/window_stats.c", - "src/core/surface/byte_buffer.c", - "src/core/surface/byte_buffer_queue.c", - "src/core/surface/byte_buffer_reader.c", - "src/core/surface/call.c", - "src/core/surface/call_details.c", - "src/core/surface/call_log_batch.c", - "src/core/surface/channel.c", - "src/core/surface/channel_create.c", - "src/core/surface/client.c", - "src/core/surface/completion_queue.c", - "src/core/surface/event_string.c", - "src/core/surface/init.c", - "src/core/surface/lame_client.c", - "src/core/surface/metadata_array.c", - "src/core/surface/server.c", - "src/core/surface/server_chttp2.c", - "src/core/surface/server_create.c", - "src/core/surface/surface_trace.c", - "src/core/transport/chttp2/alpn.c", - "src/core/transport/chttp2/bin_encoder.c", - "src/core/transport/chttp2/frame_data.c", - "src/core/transport/chttp2/frame_goaway.c", - "src/core/transport/chttp2/frame_ping.c", - "src/core/transport/chttp2/frame_rst_stream.c", - "src/core/transport/chttp2/frame_settings.c", - "src/core/transport/chttp2/frame_window_update.c", - "src/core/transport/chttp2/hpack_parser.c", - "src/core/transport/chttp2/hpack_table.c", - "src/core/transport/chttp2/huffsyms.c", - "src/core/transport/chttp2/status_conversion.c", - "src/core/transport/chttp2/stream_encoder.c", - "src/core/transport/chttp2/stream_map.c", - "src/core/transport/chttp2/timeout_encoding.c", - "src/core/transport/chttp2/varint.c", - "src/core/transport/chttp2_transport.c", - "src/core/transport/metadata.c", - "src/core/transport/stream_op.c", - "src/core/transport/transport.c", - ], - hdrs = [ - "include/grpc/byte_buffer.h", - "include/grpc/byte_buffer_reader.h", - "include/grpc/grpc.h", - "include/grpc/grpc_http.h", - "include/grpc/status.h", - ], - includes = [ - "include", - ".", - ], - deps = [ - ":gpr", - ], + name = "grpc_csharp_ext", + srcs = [ + "src/csharp/ext/grpc_csharp_ext.c", + ], + hdrs = [ + ], + includes = [ + "include", + ".", + ], + deps = [ + ":gpr", + ":grpc", + ], ) +cc_binary( + name = "grpc_cpp_plugin", + srcs = [ + "src/compiler/cpp_plugin.cc", + ], + deps = [ + "//external:protobuf_compiler", + ":grpc_plugin_support", + ], +) + + +cc_binary( + name = "grpc_objective_c_plugin", + srcs = [ + "src/compiler/objective_c_plugin.cc", + ], + deps = [ + "//external:protobuf_compiler", + ":grpc_plugin_support", + ], +) + + +cc_binary( + name = "grpc_python_plugin", + srcs = [ + "src/compiler/python_plugin.cc", + ], + deps = [ + "//external:protobuf_compiler", + ":grpc_plugin_support", + ], +) + + +cc_binary( + name = "grpc_ruby_plugin", + srcs = [ + "src/compiler/ruby_plugin.cc", + ], + deps = [ + "//external:protobuf_compiler", + ":grpc_plugin_support", + ], +) + + + + diff --git a/templates/BUILD.template b/templates/BUILD.template index 997c55b1c8..8303b9f8e9 100644 --- a/templates/BUILD.template +++ b/templates/BUILD.template @@ -32,38 +32,79 @@ licenses(["notice"]) # 3-clause BSD +package(default_visibility = ["//visibility:public"]) + +<%! +def get_deps(target_dict): + deps = [] + if target_dict.get('secure', 'no') == 'yes': + deps = [ + "//external:libssl", + ] + if target_dict.get('build', None) == 'protoc': + deps.append("//external:protobuf_compiler") + if target_dict['name'] == 'grpc++_unsecure' or target_dict['name'] == 'grpc++': + deps.append("//external:protobuf_clib") + for d in target_dict.get('deps', []): + if d.find('//') == 0 or d[0] == ':': + deps.append(d) + else: + deps.append(':%s' % (d)) + return deps +%> + % for lib in libs: -% if lib.build == "all" and lib.language == 'c': -${makelib(lib)} +% if lib.build != "private": +${cc_library(lib)} % endif % endfor -<%def name="makelib(lib)"> +% for tgt in targets: +% if tgt.build == 'protoc': +${cc_binary(tgt)} +% endif +% endfor +<%def name="cc_library(lib)"> cc_library( - name = "${lib.name}", - srcs = [ + name = "${lib.name}", + srcs = [ % for hdr in lib.get("headers", []): - "${hdr}", + "${hdr}", % endfor % for src in lib.src: - "${src}", + "${src}", % endfor - ], - hdrs = [ + ], + hdrs = [ % for hdr in lib.get("public_headers", []): - "${hdr}", + "${hdr}", % endfor - ], - includes = [ - "include", - ".", - ], - deps = [ -% for dep in lib.get("deps", []): - ":${dep}", + ], + includes = [ + "include", + ".", + ], + deps = [ +% for dep in get_deps(lib): + "${dep}", % endfor - ], + ], ) + +<%def name="cc_binary(tgt)"> +cc_binary( + name = "${tgt.name}", + srcs = [ +% for src in tgt.src: + "${src}", +% endfor + ], + deps = [ +% for dep in get_deps(tgt): + "${dep}", +% endfor + ], +) -- cgit v1.2.3 From fa4549dd2d1966323a4beddf53bdb557a314fd64 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Fri, 10 Apr 2015 13:12:09 -0700 Subject: Add missing public headers --- Makefile | 12 ++++++++++++ build.json | 6 ++++++ vsprojects/vs2010/grpc++.vcxproj | 6 ++++++ vsprojects/vs2010/grpc++.vcxproj.filters | 18 ++++++++++++++++++ vsprojects/vs2013/grpc++.vcxproj | 6 ++++++ vsprojects/vs2013/grpc++.vcxproj.filters | 18 ++++++++++++++++++ 6 files changed, 66 insertions(+) diff --git a/Makefile b/Makefile index 71540495fa..4ba10c3c7b 100644 --- a/Makefile +++ b/Makefile @@ -3344,6 +3344,12 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/impl/rpc_method.h \ include/grpc++/impl/rpc_service_method.h \ include/grpc++/impl/service_type.h \ + include/grpc++/impl/sync.h \ + include/grpc++/impl/sync_cxx11.h \ + include/grpc++/impl/sync_no_cxx11.h \ + include/grpc++/impl/thd.h \ + include/grpc++/impl/thd_cxx11.h \ + include/grpc++/impl/thd_no_cxx11.h \ include/grpc++/server.h \ include/grpc++/server_builder.h \ include/grpc++/server_context.h \ @@ -3595,6 +3601,12 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/impl/rpc_method.h \ include/grpc++/impl/rpc_service_method.h \ include/grpc++/impl/service_type.h \ + include/grpc++/impl/sync.h \ + include/grpc++/impl/sync_cxx11.h \ + include/grpc++/impl/sync_no_cxx11.h \ + include/grpc++/impl/thd.h \ + include/grpc++/impl/thd_cxx11.h \ + include/grpc++/impl/thd_no_cxx11.h \ include/grpc++/server.h \ include/grpc++/server_builder.h \ include/grpc++/server_context.h \ diff --git a/build.json b/build.json index b45584a8ba..0a7b81d5f5 100644 --- a/build.json +++ b/build.json @@ -29,6 +29,12 @@ "include/grpc++/impl/rpc_method.h", "include/grpc++/impl/rpc_service_method.h", "include/grpc++/impl/service_type.h", + "include/grpc++/impl/sync.h", + "include/grpc++/impl/sync_cxx11.h", + "include/grpc++/impl/sync_no_cxx11.h", + "include/grpc++/impl/thd.h", + "include/grpc++/impl/thd_cxx11.h", + "include/grpc++/impl/thd_no_cxx11.h", "include/grpc++/server.h", "include/grpc++/server_builder.h", "include/grpc++/server_context.h", diff --git a/vsprojects/vs2010/grpc++.vcxproj b/vsprojects/vs2010/grpc++.vcxproj index c1795923c7..003355eabf 100644 --- a/vsprojects/vs2010/grpc++.vcxproj +++ b/vsprojects/vs2010/grpc++.vcxproj @@ -93,6 +93,12 @@ + + + + + + diff --git a/vsprojects/vs2010/grpc++.vcxproj.filters b/vsprojects/vs2010/grpc++.vcxproj.filters index 77f5383054..6466a0fa26 100644 --- a/vsprojects/vs2010/grpc++.vcxproj.filters +++ b/vsprojects/vs2010/grpc++.vcxproj.filters @@ -132,6 +132,24 @@ include\grpc++\impl + + include\grpc++\impl + + + include\grpc++\impl + + + include\grpc++\impl + + + include\grpc++\impl + + + include\grpc++\impl + + + include\grpc++\impl + include\grpc++ diff --git a/vsprojects/vs2013/grpc++.vcxproj b/vsprojects/vs2013/grpc++.vcxproj index b9039c5a8f..dff588166b 100644 --- a/vsprojects/vs2013/grpc++.vcxproj +++ b/vsprojects/vs2013/grpc++.vcxproj @@ -95,6 +95,12 @@ + + + + + + diff --git a/vsprojects/vs2013/grpc++.vcxproj.filters b/vsprojects/vs2013/grpc++.vcxproj.filters index 77f5383054..6466a0fa26 100644 --- a/vsprojects/vs2013/grpc++.vcxproj.filters +++ b/vsprojects/vs2013/grpc++.vcxproj.filters @@ -132,6 +132,24 @@ include\grpc++\impl + + include\grpc++\impl + + + include\grpc++\impl + + + include\grpc++\impl + + + include\grpc++\impl + + + include\grpc++\impl + + + include\grpc++\impl + include\grpc++ -- cgit v1.2.3