mirror of https://github.com/grpc/grpc.git
commit
7f729f5ad8
256 changed files with 22252 additions and 7151 deletions
@ -0,0 +1,572 @@ |
||||
/*
|
||||
* |
||||
* 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/channel/client_uchannel.h" |
||||
|
||||
#include <string.h> |
||||
|
||||
#include "src/core/census/grpc_filter.h" |
||||
#include "src/core/channel/channel_args.h" |
||||
#include "src/core/channel/client_channel.h" |
||||
#include "src/core/channel/compress_filter.h" |
||||
#include "src/core/iomgr/iomgr.h" |
||||
#include "src/core/support/string.h" |
||||
#include "src/core/surface/channel.h" |
||||
#include "src/core/transport/connectivity_state.h" |
||||
|
||||
#include <grpc/support/alloc.h> |
||||
#include <grpc/support/log.h> |
||||
#include <grpc/support/sync.h> |
||||
#include <grpc/support/useful.h> |
||||
|
||||
/** Microchannel (uchannel) implementation: a lightweight channel without any
|
||||
* load-balancing mechanisms meant for communication from within the core. */ |
||||
|
||||
typedef struct call_data call_data; |
||||
|
||||
typedef struct client_uchannel_channel_data { |
||||
/** metadata context for this channel */ |
||||
grpc_mdctx *mdctx; |
||||
|
||||
/** master channel - the grpc_channel instance that ultimately owns
|
||||
this channel_data via its channel stack. |
||||
We occasionally use this to bump the refcount on the master channel |
||||
to keep ourselves alive through an asynchronous operation. */ |
||||
grpc_channel *master; |
||||
|
||||
/** connectivity state being tracked */ |
||||
grpc_connectivity_state_tracker state_tracker; |
||||
|
||||
/** the subchannel wrapped by the microchannel */ |
||||
grpc_subchannel *subchannel; |
||||
|
||||
/** the callback used to stay subscribed to subchannel connectivity
|
||||
* notifications */ |
||||
grpc_closure connectivity_cb; |
||||
|
||||
/** the current connectivity state of the wrapped subchannel */ |
||||
grpc_connectivity_state subchannel_connectivity; |
||||
|
||||
gpr_mu mu_state; |
||||
} channel_data; |
||||
|
||||
typedef enum { |
||||
CALL_CREATED, |
||||
CALL_WAITING_FOR_SEND, |
||||
CALL_WAITING_FOR_CALL, |
||||
CALL_ACTIVE, |
||||
CALL_CANCELLED |
||||
} call_state; |
||||
|
||||
struct call_data { |
||||
/* owning element */ |
||||
grpc_call_element *elem; |
||||
|
||||
gpr_mu mu_state; |
||||
|
||||
call_state state; |
||||
gpr_timespec deadline; |
||||
grpc_closure async_setup_task; |
||||
grpc_transport_stream_op waiting_op; |
||||
/* our child call stack */ |
||||
grpc_subchannel_call *subchannel_call; |
||||
grpc_linked_mdelem status; |
||||
grpc_linked_mdelem details; |
||||
}; |
||||
|
||||
static grpc_closure *merge_into_waiting_op(grpc_call_element *elem, |
||||
grpc_transport_stream_op *new_op) |
||||
GRPC_MUST_USE_RESULT; |
||||
|
||||
static void handle_op_after_cancellation(grpc_exec_ctx *exec_ctx, |
||||
grpc_call_element *elem, |
||||
grpc_transport_stream_op *op) { |
||||
call_data *calld = elem->call_data; |
||||
channel_data *chand = elem->channel_data; |
||||
if (op->send_ops) { |
||||
grpc_stream_ops_unref_owned_objects(op->send_ops->ops, op->send_ops->nops); |
||||
op->on_done_send->cb(exec_ctx, op->on_done_send->cb_arg, 0); |
||||
} |
||||
if (op->recv_ops) { |
||||
char status[GPR_LTOA_MIN_BUFSIZE]; |
||||
grpc_metadata_batch mdb; |
||||
gpr_ltoa(GRPC_STATUS_CANCELLED, status); |
||||
calld->status.md = |
||||
grpc_mdelem_from_strings(chand->mdctx, "grpc-status", status); |
||||
calld->details.md = |
||||
grpc_mdelem_from_strings(chand->mdctx, "grpc-message", "Cancelled"); |
||||
calld->status.prev = calld->details.next = NULL; |
||||
calld->status.next = &calld->details; |
||||
calld->details.prev = &calld->status; |
||||
mdb.list.head = &calld->status; |
||||
mdb.list.tail = &calld->details; |
||||
mdb.garbage.head = mdb.garbage.tail = NULL; |
||||
mdb.deadline = gpr_inf_future(GPR_CLOCK_REALTIME); |
||||
grpc_sopb_add_metadata(op->recv_ops, mdb); |
||||
*op->recv_state = GRPC_STREAM_CLOSED; |
||||
op->on_done_recv->cb(exec_ctx, op->on_done_recv->cb_arg, 1); |
||||
} |
||||
if (op->on_consumed) { |
||||
op->on_consumed->cb(exec_ctx, op->on_consumed->cb_arg, 0); |
||||
} |
||||
} |
||||
|
||||
typedef struct { |
||||
grpc_closure closure; |
||||
grpc_call_element *elem; |
||||
} waiting_call; |
||||
|
||||
static void perform_transport_stream_op(grpc_exec_ctx *exec_ctx, |
||||
grpc_call_element *elem, |
||||
grpc_transport_stream_op *op, |
||||
int continuation); |
||||
|
||||
static int is_empty(void *p, int len) { |
||||
char *ptr = p; |
||||
int i; |
||||
for (i = 0; i < len; i++) { |
||||
if (ptr[i] != 0) return 0; |
||||
} |
||||
return 1; |
||||
} |
||||
|
||||
static void monitor_subchannel(grpc_exec_ctx *exec_ctx, void *arg, |
||||
int iomgr_success) { |
||||
channel_data *chand = arg; |
||||
grpc_connectivity_state_set(exec_ctx, &chand->state_tracker, |
||||
chand->subchannel_connectivity, |
||||
"uchannel_monitor_subchannel"); |
||||
grpc_subchannel_notify_on_state_change(exec_ctx, chand->subchannel, |
||||
&chand->subchannel_connectivity, |
||||
&chand->connectivity_cb); |
||||
} |
||||
|
||||
static void started_call_locked(grpc_exec_ctx *exec_ctx, void *arg, |
||||
int iomgr_success) { |
||||
call_data *calld = arg; |
||||
grpc_transport_stream_op op; |
||||
int have_waiting; |
||||
|
||||
if (calld->state == CALL_CANCELLED && iomgr_success == 0) { |
||||
have_waiting = !is_empty(&calld->waiting_op, sizeof(calld->waiting_op)); |
||||
gpr_mu_unlock(&calld->mu_state); |
||||
if (have_waiting) { |
||||
handle_op_after_cancellation(exec_ctx, calld->elem, &calld->waiting_op); |
||||
} |
||||
} else if (calld->state == CALL_CANCELLED && calld->subchannel_call != NULL) { |
||||
memset(&op, 0, sizeof(op)); |
||||
op.cancel_with_status = GRPC_STATUS_CANCELLED; |
||||
gpr_mu_unlock(&calld->mu_state); |
||||
grpc_subchannel_call_process_op(exec_ctx, calld->subchannel_call, &op); |
||||
} else if (calld->state == CALL_WAITING_FOR_CALL) { |
||||
have_waiting = !is_empty(&calld->waiting_op, sizeof(calld->waiting_op)); |
||||
if (calld->subchannel_call != NULL) { |
||||
calld->state = CALL_ACTIVE; |
||||
gpr_mu_unlock(&calld->mu_state); |
||||
if (have_waiting) { |
||||
grpc_subchannel_call_process_op(exec_ctx, calld->subchannel_call, |
||||
&calld->waiting_op); |
||||
} |
||||
} else { |
||||
calld->state = CALL_CANCELLED; |
||||
gpr_mu_unlock(&calld->mu_state); |
||||
if (have_waiting) { |
||||
handle_op_after_cancellation(exec_ctx, calld->elem, &calld->waiting_op); |
||||
} |
||||
} |
||||
} else { |
||||
GPR_ASSERT(calld->state == CALL_CANCELLED); |
||||
gpr_mu_unlock(&calld->mu_state); |
||||
have_waiting = !is_empty(&calld->waiting_op, sizeof(calld->waiting_op)); |
||||
if (have_waiting) { |
||||
handle_op_after_cancellation(exec_ctx, calld->elem, &calld->waiting_op); |
||||
} |
||||
} |
||||
} |
||||
|
||||
static void started_call(grpc_exec_ctx *exec_ctx, void *arg, |
||||
int iomgr_success) { |
||||
call_data *calld = arg; |
||||
gpr_mu_lock(&calld->mu_state); |
||||
started_call_locked(exec_ctx, arg, iomgr_success); |
||||
} |
||||
|
||||
static grpc_closure *merge_into_waiting_op(grpc_call_element *elem, |
||||
grpc_transport_stream_op *new_op) { |
||||
call_data *calld = elem->call_data; |
||||
grpc_closure *consumed_op = NULL; |
||||
grpc_transport_stream_op *waiting_op = &calld->waiting_op; |
||||
GPR_ASSERT((waiting_op->send_ops != NULL) + (new_op->send_ops != NULL) <= 1); |
||||
GPR_ASSERT((waiting_op->recv_ops != NULL) + (new_op->recv_ops != NULL) <= 1); |
||||
if (new_op->send_ops != NULL) { |
||||
waiting_op->send_ops = new_op->send_ops; |
||||
waiting_op->is_last_send = new_op->is_last_send; |
||||
waiting_op->on_done_send = new_op->on_done_send; |
||||
} |
||||
if (new_op->recv_ops != NULL) { |
||||
waiting_op->recv_ops = new_op->recv_ops; |
||||
waiting_op->recv_state = new_op->recv_state; |
||||
waiting_op->on_done_recv = new_op->on_done_recv; |
||||
} |
||||
if (new_op->on_consumed != NULL) { |
||||
if (waiting_op->on_consumed != NULL) { |
||||
consumed_op = waiting_op->on_consumed; |
||||
} |
||||
waiting_op->on_consumed = new_op->on_consumed; |
||||
} |
||||
if (new_op->cancel_with_status != GRPC_STATUS_OK) { |
||||
waiting_op->cancel_with_status = new_op->cancel_with_status; |
||||
} |
||||
return consumed_op; |
||||
} |
||||
|
||||
static char *cuc_get_peer(grpc_exec_ctx *exec_ctx, grpc_call_element *elem) { |
||||
call_data *calld = elem->call_data; |
||||
channel_data *chand = elem->channel_data; |
||||
grpc_subchannel_call *subchannel_call; |
||||
char *result; |
||||
|
||||
gpr_mu_lock(&calld->mu_state); |
||||
if (calld->state == CALL_ACTIVE) { |
||||
subchannel_call = calld->subchannel_call; |
||||
GRPC_SUBCHANNEL_CALL_REF(subchannel_call, "get_peer"); |
||||
gpr_mu_unlock(&calld->mu_state); |
||||
result = grpc_subchannel_call_get_peer(exec_ctx, subchannel_call); |
||||
GRPC_SUBCHANNEL_CALL_UNREF(exec_ctx, subchannel_call, "get_peer"); |
||||
return result; |
||||
} else { |
||||
gpr_mu_unlock(&calld->mu_state); |
||||
return grpc_channel_get_target(chand->master); |
||||
} |
||||
} |
||||
|
||||
static void perform_transport_stream_op(grpc_exec_ctx *exec_ctx, |
||||
grpc_call_element *elem, |
||||
grpc_transport_stream_op *op, |
||||
int continuation) { |
||||
call_data *calld = elem->call_data; |
||||
channel_data *chand = elem->channel_data; |
||||
grpc_subchannel_call *subchannel_call; |
||||
grpc_transport_stream_op op2; |
||||
GPR_ASSERT(elem->filter == &grpc_client_uchannel_filter); |
||||
GRPC_CALL_LOG_OP(GPR_INFO, elem, op); |
||||
|
||||
gpr_mu_lock(&calld->mu_state); |
||||
/* make sure the wrapped subchannel has been set (see
|
||||
* grpc_client_uchannel_set_subchannel) */ |
||||
GPR_ASSERT(chand->subchannel != NULL); |
||||
|
||||
switch (calld->state) { |
||||
case CALL_ACTIVE: |
||||
GPR_ASSERT(!continuation); |
||||
subchannel_call = calld->subchannel_call; |
||||
gpr_mu_unlock(&calld->mu_state); |
||||
grpc_subchannel_call_process_op(exec_ctx, subchannel_call, op); |
||||
break; |
||||
case CALL_CANCELLED: |
||||
gpr_mu_unlock(&calld->mu_state); |
||||
handle_op_after_cancellation(exec_ctx, elem, op); |
||||
break; |
||||
case CALL_WAITING_FOR_SEND: |
||||
GPR_ASSERT(!continuation); |
||||
grpc_exec_ctx_enqueue(exec_ctx, merge_into_waiting_op(elem, op), 1); |
||||
if (!calld->waiting_op.send_ops && |
||||
calld->waiting_op.cancel_with_status == GRPC_STATUS_OK) { |
||||
gpr_mu_unlock(&calld->mu_state); |
||||
break; |
||||
} |
||||
*op = calld->waiting_op; |
||||
memset(&calld->waiting_op, 0, sizeof(calld->waiting_op)); |
||||
continuation = 1; |
||||
/* fall through */ |
||||
case CALL_WAITING_FOR_CALL: |
||||
if (!continuation) { |
||||
if (op->cancel_with_status != GRPC_STATUS_OK) { |
||||
calld->state = CALL_CANCELLED; |
||||
op2 = calld->waiting_op; |
||||
memset(&calld->waiting_op, 0, sizeof(calld->waiting_op)); |
||||
if (op->on_consumed) { |
||||
calld->waiting_op.on_consumed = op->on_consumed; |
||||
op->on_consumed = NULL; |
||||
} else if (op2.on_consumed) { |
||||
calld->waiting_op.on_consumed = op2.on_consumed; |
||||
op2.on_consumed = NULL; |
||||
} |
||||
gpr_mu_unlock(&calld->mu_state); |
||||
handle_op_after_cancellation(exec_ctx, elem, op); |
||||
handle_op_after_cancellation(exec_ctx, elem, &op2); |
||||
grpc_subchannel_cancel_waiting_call(exec_ctx, chand->subchannel, 1); |
||||
} else { |
||||
grpc_exec_ctx_enqueue(exec_ctx, merge_into_waiting_op(elem, op), 1); |
||||
gpr_mu_unlock(&calld->mu_state); |
||||
} |
||||
break; |
||||
} |
||||
/* fall through */ |
||||
case CALL_CREATED: |
||||
if (op->cancel_with_status != GRPC_STATUS_OK) { |
||||
calld->state = CALL_CANCELLED; |
||||
gpr_mu_unlock(&calld->mu_state); |
||||
handle_op_after_cancellation(exec_ctx, elem, op); |
||||
} else { |
||||
calld->waiting_op = *op; |
||||
if (op->send_ops == NULL) { |
||||
calld->state = CALL_WAITING_FOR_SEND; |
||||
gpr_mu_unlock(&calld->mu_state); |
||||
} else { |
||||
grpc_subchannel_call_create_status call_creation_status; |
||||
grpc_pollset *pollset = calld->waiting_op.bind_pollset; |
||||
calld->state = CALL_WAITING_FOR_CALL; |
||||
grpc_closure_init(&calld->async_setup_task, started_call, calld); |
||||
call_creation_status = grpc_subchannel_create_call( |
||||
exec_ctx, chand->subchannel, pollset, &calld->subchannel_call, |
||||
&calld->async_setup_task); |
||||
if (call_creation_status == GRPC_SUBCHANNEL_CALL_CREATE_READY) { |
||||
started_call_locked(exec_ctx, calld, 1); |
||||
} else { |
||||
gpr_mu_unlock(&calld->mu_state); |
||||
} |
||||
} |
||||
} |
||||
break; |
||||
} |
||||
} |
||||
|
||||
static void cuc_start_transport_stream_op(grpc_exec_ctx *exec_ctx, |
||||
grpc_call_element *elem, |
||||
grpc_transport_stream_op *op) { |
||||
perform_transport_stream_op(exec_ctx, elem, op, 0); |
||||
} |
||||
|
||||
static void cuc_start_transport_op(grpc_exec_ctx *exec_ctx, |
||||
grpc_channel_element *elem, |
||||
grpc_transport_op *op) { |
||||
channel_data *chand = elem->channel_data; |
||||
|
||||
grpc_exec_ctx_enqueue(exec_ctx, op->on_consumed, 1); |
||||
|
||||
GPR_ASSERT(op->set_accept_stream == NULL); |
||||
GPR_ASSERT(op->bind_pollset == NULL); |
||||
|
||||
if (op->on_connectivity_state_change != NULL) { |
||||
grpc_connectivity_state_notify_on_state_change( |
||||
exec_ctx, &chand->state_tracker, op->connectivity_state, |
||||
op->on_connectivity_state_change); |
||||
op->on_connectivity_state_change = NULL; |
||||
op->connectivity_state = NULL; |
||||
} |
||||
|
||||
if (op->disconnect) { |
||||
grpc_connectivity_state_set(exec_ctx, &chand->state_tracker, |
||||
GRPC_CHANNEL_FATAL_FAILURE, "disconnect"); |
||||
} |
||||
} |
||||
|
||||
/* Constructor for call_data */ |
||||
static void cuc_init_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, |
||||
const void *server_transport_data, |
||||
grpc_transport_stream_op *initial_op) { |
||||
call_data *calld = elem->call_data; |
||||
memset(calld, 0, sizeof(call_data)); |
||||
|
||||
/* TODO(ctiller): is there something useful we can do here? */ |
||||
GPR_ASSERT(initial_op == NULL); |
||||
|
||||
GPR_ASSERT(elem->filter == &grpc_client_uchannel_filter); |
||||
GPR_ASSERT(server_transport_data == NULL); |
||||
gpr_mu_init(&calld->mu_state); |
||||
calld->elem = elem; |
||||
calld->state = CALL_CREATED; |
||||
calld->deadline = gpr_inf_future(GPR_CLOCK_REALTIME); |
||||
} |
||||
|
||||
/* Destructor for call_data */ |
||||
static void cuc_destroy_call_elem(grpc_exec_ctx *exec_ctx, |
||||
grpc_call_element *elem) { |
||||
call_data *calld = elem->call_data; |
||||
grpc_subchannel_call *subchannel_call; |
||||
|
||||
/* if the call got activated, we need to destroy the child stack also, and
|
||||
remove it from the in-flight requests tracked by the child_entry we |
||||
picked */ |
||||
gpr_mu_lock(&calld->mu_state); |
||||
switch (calld->state) { |
||||
case CALL_ACTIVE: |
||||
subchannel_call = calld->subchannel_call; |
||||
gpr_mu_unlock(&calld->mu_state); |
||||
GRPC_SUBCHANNEL_CALL_UNREF(exec_ctx, subchannel_call, "client_uchannel"); |
||||
break; |
||||
case CALL_CREATED: |
||||
case CALL_CANCELLED: |
||||
gpr_mu_unlock(&calld->mu_state); |
||||
break; |
||||
case CALL_WAITING_FOR_CALL: |
||||
case CALL_WAITING_FOR_SEND: |
||||
GPR_UNREACHABLE_CODE(return ); |
||||
} |
||||
} |
||||
|
||||
/* Constructor for channel_data */ |
||||
static void cuc_init_channel_elem(grpc_exec_ctx *exec_ctx, |
||||
grpc_channel_element *elem, |
||||
grpc_channel *master, |
||||
const grpc_channel_args *args, |
||||
grpc_mdctx *metadata_context, int is_first, |
||||
int is_last) { |
||||
channel_data *chand = elem->channel_data; |
||||
memset(chand, 0, sizeof(*chand)); |
||||
grpc_closure_init(&chand->connectivity_cb, monitor_subchannel, chand); |
||||
GPR_ASSERT(is_last); |
||||
GPR_ASSERT(elem->filter == &grpc_client_uchannel_filter); |
||||
chand->mdctx = metadata_context; |
||||
chand->master = master; |
||||
grpc_connectivity_state_init(&chand->state_tracker, GRPC_CHANNEL_IDLE, |
||||
"client_uchannel"); |
||||
gpr_mu_init(&chand->mu_state); |
||||
} |
||||
|
||||
/* Destructor for channel_data */ |
||||
static void cuc_destroy_channel_elem(grpc_exec_ctx *exec_ctx, |
||||
grpc_channel_element *elem) { |
||||
channel_data *chand = elem->channel_data; |
||||
grpc_subchannel_state_change_unsubscribe(exec_ctx, chand->subchannel, |
||||
&chand->connectivity_cb); |
||||
grpc_connectivity_state_destroy(exec_ctx, &chand->state_tracker); |
||||
gpr_mu_lock(&chand->mu_state); |
||||
} |
||||
|
||||
const grpc_channel_filter grpc_client_uchannel_filter = { |
||||
cuc_start_transport_stream_op, |
||||
cuc_start_transport_op, |
||||
sizeof(call_data), |
||||
cuc_init_call_elem, |
||||
cuc_destroy_call_elem, |
||||
sizeof(channel_data), |
||||
cuc_init_channel_elem, |
||||
cuc_destroy_channel_elem, |
||||
cuc_get_peer, |
||||
"client-uchannel", |
||||
}; |
||||
|
||||
grpc_connectivity_state grpc_client_uchannel_check_connectivity_state( |
||||
grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, int try_to_connect) { |
||||
channel_data *chand = elem->channel_data; |
||||
grpc_connectivity_state out; |
||||
out = grpc_connectivity_state_check(&chand->state_tracker); |
||||
gpr_mu_lock(&chand->mu_state); |
||||
if (out == GRPC_CHANNEL_IDLE && try_to_connect) { |
||||
grpc_connectivity_state_set(exec_ctx, &chand->state_tracker, |
||||
GRPC_CHANNEL_CONNECTING, |
||||
"uchannel_connecting_changed"); |
||||
chand->subchannel_connectivity = out; |
||||
grpc_subchannel_notify_on_state_change(exec_ctx, chand->subchannel, |
||||
&chand->subchannel_connectivity, |
||||
&chand->connectivity_cb); |
||||
} |
||||
gpr_mu_unlock(&chand->mu_state); |
||||
return out; |
||||
} |
||||
|
||||
void grpc_client_uchannel_watch_connectivity_state( |
||||
grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, |
||||
grpc_connectivity_state *state, grpc_closure *on_complete) { |
||||
channel_data *chand = elem->channel_data; |
||||
gpr_mu_lock(&chand->mu_state); |
||||
grpc_connectivity_state_notify_on_state_change( |
||||
exec_ctx, &chand->state_tracker, state, on_complete); |
||||
gpr_mu_unlock(&chand->mu_state); |
||||
} |
||||
|
||||
grpc_pollset_set *grpc_client_uchannel_get_connecting_pollset_set( |
||||
grpc_channel_element *elem) { |
||||
channel_data *chand = elem->channel_data; |
||||
grpc_channel_element *parent_elem; |
||||
gpr_mu_lock(&chand->mu_state); |
||||
parent_elem = grpc_channel_stack_last_element(grpc_channel_get_channel_stack( |
||||
grpc_subchannel_get_master(chand->subchannel))); |
||||
gpr_mu_unlock(&chand->mu_state); |
||||
return grpc_client_channel_get_connecting_pollset_set(parent_elem); |
||||
} |
||||
|
||||
void grpc_client_uchannel_add_interested_party(grpc_exec_ctx *exec_ctx, |
||||
grpc_channel_element *elem, |
||||
grpc_pollset *pollset) { |
||||
grpc_pollset_set *master_pollset_set = |
||||
grpc_client_uchannel_get_connecting_pollset_set(elem); |
||||
grpc_pollset_set_add_pollset(exec_ctx, master_pollset_set, pollset); |
||||
} |
||||
|
||||
void grpc_client_uchannel_del_interested_party(grpc_exec_ctx *exec_ctx, |
||||
grpc_channel_element *elem, |
||||
grpc_pollset *pollset) { |
||||
grpc_pollset_set *master_pollset_set = |
||||
grpc_client_uchannel_get_connecting_pollset_set(elem); |
||||
grpc_pollset_set_del_pollset(exec_ctx, master_pollset_set, pollset); |
||||
} |
||||
|
||||
grpc_channel *grpc_client_uchannel_create(grpc_subchannel *subchannel, |
||||
grpc_channel_args *args) { |
||||
grpc_channel *channel = NULL; |
||||
#define MAX_FILTERS 3 |
||||
const grpc_channel_filter *filters[MAX_FILTERS]; |
||||
grpc_mdctx *mdctx = grpc_subchannel_get_mdctx(subchannel); |
||||
grpc_channel *master = grpc_subchannel_get_master(subchannel); |
||||
char *target = grpc_channel_get_target(master); |
||||
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; |
||||
size_t n = 0; |
||||
|
||||
grpc_mdctx_ref(mdctx); |
||||
if (grpc_channel_args_is_census_enabled(args)) { |
||||
filters[n++] = &grpc_client_census_filter; |
||||
} |
||||
filters[n++] = &grpc_compress_filter; |
||||
filters[n++] = &grpc_client_uchannel_filter; |
||||
GPR_ASSERT(n <= MAX_FILTERS); |
||||
|
||||
channel = grpc_channel_create_from_filters(&exec_ctx, target, filters, n, |
||||
args, mdctx, 1); |
||||
|
||||
gpr_free(target); |
||||
return channel; |
||||
} |
||||
|
||||
void grpc_client_uchannel_set_subchannel(grpc_channel *uchannel, |
||||
grpc_subchannel *subchannel) { |
||||
grpc_channel_element *elem = |
||||
grpc_channel_stack_last_element(grpc_channel_get_channel_stack(uchannel)); |
||||
channel_data *chand = elem->channel_data; |
||||
GPR_ASSERT(elem->filter == &grpc_client_uchannel_filter); |
||||
gpr_mu_lock(&chand->mu_state); |
||||
chand->subchannel = subchannel; |
||||
gpr_mu_unlock(&chand->mu_state); |
||||
} |
@ -0,0 +1,70 @@ |
||||
/*
|
||||
* |
||||
* 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_CORE_CHANNEL_CLIENT_MICROCHANNEL_H |
||||
#define GRPC_INTERNAL_CORE_CHANNEL_CLIENT_MICROCHANNEL_H |
||||
|
||||
#include "src/core/channel/channel_stack.h" |
||||
#include "src/core/client_config/resolver.h" |
||||
|
||||
#define GRPC_MICROCHANNEL_SUBCHANNEL_ARG "grpc.microchannel_subchannel_key" |
||||
|
||||
/* A client microchannel (aka uchannel) is a channel wrapping a subchannel, for
|
||||
* the purposes of lightweight RPC communications from within the core.*/ |
||||
|
||||
extern const grpc_channel_filter grpc_client_uchannel_filter; |
||||
|
||||
grpc_connectivity_state grpc_client_uchannel_check_connectivity_state( |
||||
grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, int try_to_connect); |
||||
|
||||
void grpc_client_uchannel_watch_connectivity_state( |
||||
grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, |
||||
grpc_connectivity_state *state, grpc_closure *on_complete); |
||||
|
||||
grpc_pollset_set *grpc_client_uchannel_get_connecting_pollset_set( |
||||
grpc_channel_element *elem); |
||||
|
||||
void grpc_client_uchannel_add_interested_party(grpc_exec_ctx *exec_ctx, |
||||
grpc_channel_element *channel, |
||||
grpc_pollset *pollset); |
||||
void grpc_client_uchannel_del_interested_party(grpc_exec_ctx *exec_ctx, |
||||
grpc_channel_element *channel, |
||||
grpc_pollset *pollset); |
||||
|
||||
grpc_channel *grpc_client_uchannel_create(grpc_subchannel *subchannel, |
||||
grpc_channel_args *args); |
||||
|
||||
void grpc_client_uchannel_set_subchannel(grpc_channel *uchannel, |
||||
grpc_subchannel *subchannel); |
||||
|
||||
#endif /* GRPC_INTERNAL_CORE_CHANNEL_CLIENT_MICROCHANNEL_H */ |
@ -0,0 +1,148 @@ |
||||
/*
|
||||
* |
||||
* 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/iomgr/executor.h" |
||||
|
||||
#include <string.h> |
||||
|
||||
#include <grpc/support/alloc.h> |
||||
#include <grpc/support/log.h> |
||||
#include <grpc/support/sync.h> |
||||
#include <grpc/support/thd.h> |
||||
#include "src/core/iomgr/exec_ctx.h" |
||||
|
||||
typedef struct grpc_executor_data { |
||||
int busy; /**< is the thread currently running? */ |
||||
int shutting_down; /**< has \a grpc_shutdown() been invoked? */ |
||||
int pending_join; /**< has the thread finished but not been joined? */ |
||||
grpc_closure_list closures; /**< collection of pending work */ |
||||
gpr_thd_id tid; /**< thread id of the thread, only valid if \a busy or \a
|
||||
pending_join are true */ |
||||
gpr_thd_options options; |
||||
gpr_mu mu; |
||||
} grpc_executor; |
||||
|
||||
static grpc_executor g_executor; |
||||
|
||||
void grpc_executor_init() { |
||||
memset(&g_executor, 0, sizeof(grpc_executor)); |
||||
gpr_mu_init(&g_executor.mu); |
||||
g_executor.options = gpr_thd_options_default(); |
||||
gpr_thd_options_set_joinable(&g_executor.options); |
||||
} |
||||
|
||||
/* thread body */ |
||||
static void closure_exec_thread_func(void *ignored) { |
||||
grpc_closure *closure; |
||||
|
||||
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; |
||||
while (1) { |
||||
gpr_mu_lock(&g_executor.mu); |
||||
if (g_executor.shutting_down != 0) { |
||||
gpr_mu_unlock(&g_executor.mu); |
||||
break; |
||||
} |
||||
closure = grpc_closure_list_pop(&g_executor.closures); |
||||
if (closure == NULL) { |
||||
/* no more work, time to die */ |
||||
GPR_ASSERT(g_executor.busy == 1); |
||||
g_executor.busy = 0; |
||||
gpr_mu_unlock(&g_executor.mu); |
||||
break; |
||||
} |
||||
gpr_mu_unlock(&g_executor.mu); |
||||
closure->cb(&exec_ctx, closure->cb_arg, closure->success); |
||||
grpc_exec_ctx_flush(&exec_ctx); |
||||
} |
||||
grpc_exec_ctx_finish(&exec_ctx); |
||||
} |
||||
|
||||
/* Spawn the thread if new work has arrived a no thread is up */ |
||||
static void maybe_spawn_locked() { |
||||
if (grpc_closure_list_empty(g_executor.closures) == 1) { |
||||
return; |
||||
} |
||||
if (g_executor.shutting_down == 1) { |
||||
return; |
||||
} |
||||
|
||||
if (g_executor.busy != 0) { |
||||
/* Thread still working. New work will be picked up by already running
|
||||
* thread. Not spawning anything. */ |
||||
return; |
||||
} else if (g_executor.pending_join != 0) { |
||||
/* Pickup the remains of the previous incarnations of the thread. */ |
||||
gpr_thd_join(g_executor.tid); |
||||
g_executor.pending_join = 0; |
||||
} |
||||
|
||||
/* All previous instances of the thread should have been joined at this point.
|
||||
* Spawn time! */ |
||||
g_executor.busy = 1; |
||||
gpr_thd_new(&g_executor.tid, closure_exec_thread_func, NULL, |
||||
&g_executor.options); |
||||
g_executor.pending_join = 1; |
||||
} |
||||
|
||||
void grpc_executor_enqueue(grpc_closure *closure, int success) { |
||||
gpr_mu_lock(&g_executor.mu); |
||||
if (g_executor.shutting_down == 0) { |
||||
grpc_closure_list_add(&g_executor.closures, closure, success); |
||||
maybe_spawn_locked(); |
||||
} |
||||
gpr_mu_unlock(&g_executor.mu); |
||||
} |
||||
|
||||
void grpc_executor_shutdown() { |
||||
int pending_join; |
||||
grpc_closure *closure; |
||||
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; |
||||
|
||||
gpr_mu_lock(&g_executor.mu); |
||||
pending_join = g_executor.pending_join; |
||||
g_executor.shutting_down = 1; |
||||
gpr_mu_unlock(&g_executor.mu); |
||||
/* we can release the lock at this point despite the access to the closure
|
||||
* list below because we aren't accepting new work */ |
||||
|
||||
/* Execute pending callbacks, some may be performing cleanups */ |
||||
while ((closure = grpc_closure_list_pop(&g_executor.closures)) != NULL) { |
||||
closure->cb(&exec_ctx, closure->cb_arg, closure->success); |
||||
} |
||||
grpc_exec_ctx_finish(&exec_ctx); |
||||
GPR_ASSERT(grpc_closure_list_empty(g_executor.closures)); |
||||
if (pending_join) { |
||||
gpr_thd_join(g_executor.tid); |
||||
} |
||||
gpr_mu_destroy(&g_executor.mu); |
||||
} |
@ -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_INTERNAL_CORE_IOMGR_EXECUTOR_H |
||||
#define GRPC_INTERNAL_CORE_IOMGR_EXECUTOR_H |
||||
|
||||
#include "src/core/iomgr/closure.h" |
||||
|
||||
/** Initialize the global executor.
|
||||
* |
||||
* This mechanism is meant to outsource work (grpc_closure instances) to a |
||||
* thread, for those cases where blocking isn't an option but there isn't a |
||||
* non-blocking solution available. */ |
||||
void grpc_executor_init(); |
||||
|
||||
/** Enqueue \a closure for its eventual execution of \a f(arg) on a separate
|
||||
* thread */ |
||||
void grpc_executor_enqueue(grpc_closure *closure, int success); |
||||
|
||||
/** Shutdown the executor, running all pending work as part of the call */ |
||||
void grpc_executor_shutdown(); |
||||
|
||||
#endif /* GRPC_INTERNAL_CORE_IOMGR_EXECUTOR_H */ |
@ -1,19 +0,0 @@ |
||||
# Xcode |
||||
# |
||||
build/ |
||||
*.pbxuser |
||||
!default.pbxuser |
||||
*.mode1v3 |
||||
!default.mode1v3 |
||||
*.mode2v3 |
||||
!default.mode2v3 |
||||
*.perspectivev3 |
||||
!default.perspectivev3 |
||||
xcuserdata |
||||
*.xccheckout |
||||
*.moved-aside |
||||
DerivedData |
||||
*.hmap |
||||
*.ipa |
||||
*.xcuserstate |
||||
*.DS_Store |
@ -0,0 +1,22 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<phpunit bootstrap="tests/bootstrap.php" colors="true"> |
||||
<testsuites> |
||||
<testsuite name="grpc-unit-tests"> |
||||
<directory suffix="Test.php">tests/unit_tests</directory> |
||||
</testsuite> |
||||
<testsuite name="grpc-genereated-code-tests"> |
||||
<file>tests/generated_code/GeneratedCodeTest.php</file> |
||||
<file>tests/generated_code/GeneratedCodeWithCallbackTest.php</file> |
||||
</testsuite> |
||||
</testsuites> |
||||
<filter> |
||||
<whitelist> |
||||
<directory suffix=".php">lib/Grpc</directory> |
||||
</whitelist> |
||||
</filter> |
||||
<logging> |
||||
<log type="coverage-html" target="./log/codeCoverage" charset="UTF-8" |
||||
yui="true" highlight="true" |
||||
lowUpperBound="75" highLowerBound="95"/> |
||||
</logging> |
||||
</phpunit> |
@ -0,0 +1,21 @@ |
||||
<?php |
||||
/* |
||||
* Copyright 2014 Google Inc. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0 |
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
||||
* implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
error_reporting(E_ALL | E_STRICT); |
||||
require dirname(__DIR__) . '/vendor/autoload.php'; |
||||
date_default_timezone_set('UTC'); |
@ -0,0 +1,314 @@ |
||||
/*
|
||||
* |
||||
* Copyright 2015, Google Inc. |
||||
* All rights reserved. |
||||
* |
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions are |
||||
* met: |
||||
* |
||||
* * Redistributions of source code must retain the above copyright |
||||
* notice, this list of conditions and the following disclaimer. |
||||
* * Redistributions in binary form must reproduce the above |
||||
* copyright notice, this list of conditions and the following disclaimer |
||||
* in the documentation and/or other materials provided with the |
||||
* distribution. |
||||
* * Neither the name of Google Inc. nor the names of its |
||||
* contributors may be used to endorse or promote products derived from |
||||
* this software without specific prior written permission. |
||||
* |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
* |
||||
*/ |
||||
|
||||
#include "test/core/end2end/end2end_tests.h" |
||||
|
||||
#include <string.h> |
||||
|
||||
#include "src/core/channel/channel_args.h" |
||||
#include "src/core/channel/client_channel.h" |
||||
#include "src/core/channel/client_uchannel.h" |
||||
#include "src/core/channel/connected_channel.h" |
||||
#include "src/core/channel/http_client_filter.h" |
||||
#include "src/core/channel/http_server_filter.h" |
||||
#include "src/core/client_config/resolver_registry.h" |
||||
#include "src/core/iomgr/tcp_client.h" |
||||
#include "src/core/surface/channel.h" |
||||
#include "src/core/surface/server.h" |
||||
#include "src/core/transport/chttp2_transport.h" |
||||
#include <grpc/support/alloc.h> |
||||
#include <grpc/support/host_port.h> |
||||
#include <grpc/support/log.h> |
||||
#include <grpc/support/string_util.h> |
||||
#include <grpc/support/sync.h> |
||||
#include <grpc/support/thd.h> |
||||
#include <grpc/support/useful.h> |
||||
#include "test/core/util/port.h" |
||||
#include "test/core/util/test_config.h" |
||||
|
||||
typedef struct { |
||||
grpc_connector base; |
||||
gpr_refcount refs; |
||||
|
||||
grpc_closure *notify; |
||||
grpc_connect_in_args args; |
||||
grpc_connect_out_args *result; |
||||
|
||||
grpc_endpoint *tcp; |
||||
|
||||
grpc_mdctx *mdctx; |
||||
|
||||
grpc_closure connected; |
||||
} connector; |
||||
|
||||
static void connector_ref(grpc_connector *con) { |
||||
connector *c = (connector *)con; |
||||
gpr_ref(&c->refs); |
||||
} |
||||
|
||||
static void connector_unref(grpc_exec_ctx *exec_ctx, grpc_connector *con) { |
||||
connector *c = (connector *)con; |
||||
if (gpr_unref(&c->refs)) { |
||||
grpc_mdctx_unref(c->mdctx); |
||||
gpr_free(c); |
||||
} |
||||
} |
||||
|
||||
static void connected(grpc_exec_ctx *exec_ctx, void *arg, int success) { |
||||
connector *c = arg; |
||||
grpc_closure *notify; |
||||
grpc_endpoint *tcp = c->tcp; |
||||
if (tcp != NULL) { |
||||
c->result->transport = grpc_create_chttp2_transport( |
||||
exec_ctx, c->args.channel_args, tcp, c->mdctx, 1); |
||||
grpc_chttp2_transport_start_reading(exec_ctx, c->result->transport, NULL, |
||||
0); |
||||
GPR_ASSERT(c->result->transport); |
||||
c->result->filters = gpr_malloc(sizeof(grpc_channel_filter *)); |
||||
c->result->filters[0] = &grpc_http_client_filter; |
||||
c->result->num_filters = 1; |
||||
} else { |
||||
memset(c->result, 0, sizeof(*c->result)); |
||||
} |
||||
notify = c->notify; |
||||
c->notify = NULL; |
||||
notify->cb(exec_ctx, notify->cb_arg, 1); |
||||
} |
||||
|
||||
static void connector_shutdown(grpc_exec_ctx *exec_ctx, grpc_connector *con) {} |
||||
|
||||
static void connector_connect(grpc_exec_ctx *exec_ctx, grpc_connector *con, |
||||
const grpc_connect_in_args *args, |
||||
grpc_connect_out_args *result, |
||||
grpc_closure *notify) { |
||||
connector *c = (connector *)con; |
||||
GPR_ASSERT(c->notify == NULL); |
||||
GPR_ASSERT(notify->cb); |
||||
c->notify = notify; |
||||
c->args = *args; |
||||
c->result = result; |
||||
c->tcp = NULL; |
||||
grpc_closure_init(&c->connected, connected, c); |
||||
grpc_tcp_client_connect(exec_ctx, &c->connected, &c->tcp, |
||||
args->interested_parties, args->addr, args->addr_len, |
||||
args->deadline); |
||||
} |
||||
|
||||
static const grpc_connector_vtable connector_vtable = { |
||||
connector_ref, connector_unref, connector_shutdown, connector_connect}; |
||||
|
||||
typedef struct { |
||||
grpc_subchannel_factory base; |
||||
gpr_refcount refs; |
||||
grpc_mdctx *mdctx; |
||||
grpc_channel_args *merge_args; |
||||
grpc_channel *master; |
||||
grpc_subchannel **sniffed_subchannel; |
||||
} subchannel_factory; |
||||
|
||||
static void subchannel_factory_ref(grpc_subchannel_factory *scf) { |
||||
subchannel_factory *f = (subchannel_factory *)scf; |
||||
gpr_ref(&f->refs); |
||||
} |
||||
|
||||
static void subchannel_factory_unref(grpc_exec_ctx *exec_ctx, |
||||
grpc_subchannel_factory *scf) { |
||||
subchannel_factory *f = (subchannel_factory *)scf; |
||||
if (gpr_unref(&f->refs)) { |
||||
GRPC_CHANNEL_INTERNAL_UNREF(exec_ctx, f->master, "subchannel_factory"); |
||||
grpc_channel_args_destroy(f->merge_args); |
||||
grpc_mdctx_unref(f->mdctx); |
||||
gpr_free(f); |
||||
} |
||||
} |
||||
|
||||
static grpc_subchannel *subchannel_factory_create_subchannel( |
||||
grpc_exec_ctx *exec_ctx, grpc_subchannel_factory *scf, |
||||
grpc_subchannel_args *args) { |
||||
subchannel_factory *f = (subchannel_factory *)scf; |
||||
connector *c = gpr_malloc(sizeof(*c)); |
||||
grpc_channel_args *final_args = |
||||
grpc_channel_args_merge(args->args, f->merge_args); |
||||
grpc_subchannel *s; |
||||
memset(c, 0, sizeof(*c)); |
||||
c->base.vtable = &connector_vtable; |
||||
c->mdctx = f->mdctx; |
||||
grpc_mdctx_ref(c->mdctx); |
||||
gpr_ref_init(&c->refs, 1); |
||||
args->mdctx = f->mdctx; |
||||
args->args = final_args; |
||||
args->master = f->master; |
||||
s = grpc_subchannel_create(&c->base, args); |
||||
grpc_connector_unref(exec_ctx, &c->base); |
||||
grpc_channel_args_destroy(final_args); |
||||
*f->sniffed_subchannel = s; |
||||
return s; |
||||
} |
||||
|
||||
static const grpc_subchannel_factory_vtable test_subchannel_factory_vtable = { |
||||
subchannel_factory_ref, subchannel_factory_unref, |
||||
subchannel_factory_create_subchannel}; |
||||
|
||||
/* The evil twin of grpc_insecure_channel_create. It allows the test to use the
|
||||
* custom-built sniffing subchannel_factory */ |
||||
grpc_channel *channel_create(const char *target, const grpc_channel_args *args, |
||||
grpc_subchannel **sniffed_subchannel) { |
||||
grpc_channel *channel = NULL; |
||||
#define MAX_FILTERS 1 |
||||
const grpc_channel_filter *filters[MAX_FILTERS]; |
||||
grpc_resolver *resolver; |
||||
subchannel_factory *f; |
||||
grpc_mdctx *mdctx = grpc_mdctx_create(); |
||||
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; |
||||
size_t n = 0; |
||||
|
||||
filters[n++] = &grpc_client_channel_filter; |
||||
GPR_ASSERT(n <= MAX_FILTERS); |
||||
|
||||
channel = grpc_channel_create_from_filters(&exec_ctx, target, filters, n, |
||||
args, mdctx, 1); |
||||
|
||||
f = gpr_malloc(sizeof(*f)); |
||||
f->sniffed_subchannel = sniffed_subchannel; |
||||
f->base.vtable = &test_subchannel_factory_vtable; |
||||
gpr_ref_init(&f->refs, 1); |
||||
grpc_mdctx_ref(mdctx); |
||||
f->mdctx = mdctx; |
||||
f->merge_args = grpc_channel_args_copy(args); |
||||
f->master = channel; |
||||
GRPC_CHANNEL_INTERNAL_REF(f->master, "test_subchannel_factory"); |
||||
resolver = grpc_resolver_create(target, &f->base); |
||||
if (!resolver) { |
||||
return NULL; |
||||
} |
||||
|
||||
grpc_client_channel_set_resolver( |
||||
&exec_ctx, grpc_channel_get_channel_stack(channel), resolver); |
||||
GRPC_RESOLVER_UNREF(&exec_ctx, resolver, "test_create"); |
||||
grpc_subchannel_factory_unref(&exec_ctx, &f->base); |
||||
|
||||
grpc_exec_ctx_finish(&exec_ctx); |
||||
|
||||
return channel; |
||||
} |
||||
|
||||
typedef struct micro_fullstack_fixture_data { |
||||
char *localaddr; |
||||
grpc_channel *master_channel; |
||||
grpc_subchannel *sniffed_subchannel; |
||||
} micro_fullstack_fixture_data; |
||||
|
||||
static grpc_end2end_test_fixture chttp2_create_fixture_micro_fullstack( |
||||
grpc_channel_args *client_args, grpc_channel_args *server_args) { |
||||
grpc_end2end_test_fixture f; |
||||
int port = grpc_pick_unused_port_or_die(); |
||||
micro_fullstack_fixture_data *ffd = |
||||
gpr_malloc(sizeof(micro_fullstack_fixture_data)); |
||||
memset(&f, 0, sizeof(f)); |
||||
|
||||
gpr_join_host_port(&ffd->localaddr, "127.0.0.1", port); |
||||
|
||||
f.fixture_data = ffd; |
||||
f.cq = grpc_completion_queue_create(NULL); |
||||
|
||||
return f; |
||||
} |
||||
|
||||
static void chttp2_init_client_micro_fullstack(grpc_end2end_test_fixture *f, |
||||
grpc_channel_args *client_args) { |
||||
micro_fullstack_fixture_data *ffd = f->fixture_data; |
||||
grpc_connectivity_state conn_state; |
||||
char *ipv4_localaddr; |
||||
|
||||
gpr_asprintf(&ipv4_localaddr, "ipv4:%s", ffd->localaddr); |
||||
ffd->master_channel = |
||||
channel_create(ipv4_localaddr, client_args, &ffd->sniffed_subchannel); |
||||
gpr_free(ipv4_localaddr); |
||||
gpr_log(GPR_INFO, "MASTER CHANNEL %p ", ffd->master_channel); |
||||
/* the following will block. That's ok for this test */ |
||||
conn_state = grpc_channel_check_connectivity_state(ffd->master_channel, |
||||
1 /* try to connect */); |
||||
GPR_ASSERT(conn_state == GRPC_CHANNEL_IDLE); |
||||
|
||||
/* here sniffed_subchannel should be ready to use */ |
||||
GPR_ASSERT(conn_state == GRPC_CHANNEL_IDLE); |
||||
GPR_ASSERT(ffd->sniffed_subchannel != NULL); |
||||
f->client = grpc_client_uchannel_create(ffd->sniffed_subchannel, client_args); |
||||
grpc_client_uchannel_set_subchannel(f->client, ffd->sniffed_subchannel); |
||||
gpr_log(GPR_INFO, "CHANNEL WRAPPING SUBCHANNEL: %p(%p)", f->client, |
||||
ffd->sniffed_subchannel); |
||||
|
||||
GPR_ASSERT(f->client); |
||||
} |
||||
|
||||
static void chttp2_init_server_micro_fullstack(grpc_end2end_test_fixture *f, |
||||
grpc_channel_args *server_args) { |
||||
micro_fullstack_fixture_data *ffd = f->fixture_data; |
||||
if (f->server) { |
||||
grpc_server_destroy(f->server); |
||||
} |
||||
f->server = grpc_server_create(server_args, NULL); |
||||
grpc_server_register_completion_queue(f->server, f->cq, NULL); |
||||
GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->localaddr)); |
||||
grpc_server_start(f->server); |
||||
} |
||||
|
||||
static void chttp2_tear_down_micro_fullstack(grpc_end2end_test_fixture *f) { |
||||
micro_fullstack_fixture_data *ffd = f->fixture_data; |
||||
grpc_channel_destroy(ffd->master_channel); |
||||
ffd->master_channel = NULL; |
||||
gpr_free(ffd->localaddr); |
||||
gpr_free(ffd); |
||||
} |
||||
|
||||
/* All test configurations */ |
||||
static grpc_end2end_test_config configs[] = { |
||||
{"chttp2/micro_fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION, |
||||
chttp2_create_fixture_micro_fullstack, chttp2_init_client_micro_fullstack, |
||||
chttp2_init_server_micro_fullstack, chttp2_tear_down_micro_fullstack}, |
||||
}; |
||||
|
||||
int main(int argc, char **argv) { |
||||
size_t i; |
||||
|
||||
grpc_test_init(argc, argv); |
||||
grpc_init(); |
||||
|
||||
for (i = 0; i < sizeof(configs) / sizeof(*configs); i++) { |
||||
grpc_end2end_tests(configs[i]); |
||||
} |
||||
|
||||
grpc_shutdown(); |
||||
|
||||
return 0; |
||||
} |
@ -1,55 +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. |
||||
|
||||
# Dockerfile for gRPC C# (on Mono). |
||||
FROM grpc/csharp_mono_base |
||||
|
||||
# Pull the latest sources |
||||
RUN cd /var/local/git/grpc \ |
||||
&& git pull --recurse-submodules \ |
||||
&& git submodule update --init --recursive |
||||
|
||||
# Install the gRPC C# extension library |
||||
RUN make install_grpc_csharp_ext -j12 -C /var/local/git/grpc |
||||
|
||||
# Restore the NuGet dependencies |
||||
RUN cd /var/local/git/grpc/src/csharp && mono /var/local/NuGet.exe restore Grpc.sln |
||||
|
||||
# Build gRPC solution |
||||
RUN cd /var/local/git/grpc/src/csharp && xbuild Grpc.sln |
||||
|
||||
# Add a cacerts directory containing the Google root pem file, allowing the |
||||
# ruby client to access the production test instance |
||||
ADD cacerts cacerts |
||||
|
||||
# Add a service_account directory containing the auth creds file |
||||
ADD service_account service_account |
||||
|
||||
# Run the C# Interop Server |
||||
CMD ["/bin/bash", "-l", "-c", "cd /var/local/git/grpc/src/csharp/Grpc.IntegrationTesting.Server/bin/Debug && mono Grpc.IntegrationTesting.Server.exe --use_tls=true --port=8070"] |
@ -1,10 +0,0 @@ |
||||
#!/bin/bash |
||||
|
||||
cp -R /var/local/git-clone/grpc /var/local/git |
||||
|
||||
make install_grpc_csharp_ext -j12 -C /var/local/git/grpc |
||||
|
||||
cd /var/local/git/grpc/src/csharp && mono /var/local/NuGet.exe restore Grpc.sln |
||||
|
||||
cd /var/local/git/grpc/src/csharp && xbuild Grpc.sln |
||||
|
@ -1,56 +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. |
||||
|
||||
# Base Dockerfile for gRPC C# (on Mono). |
||||
# |
||||
# Includes gRPC C# installation dependencies, things that are unlikely to vary. |
||||
FROM grpc/base |
||||
|
||||
# Update to a newer version of mono |
||||
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF |
||||
RUN echo "deb http://download.mono-project.com/repo/debian wheezy main" | tee /etc/apt/sources.list.d/mono-xamarin.list |
||||
|
||||
# Install dependencies |
||||
RUN apt-get update && apt-get install -y \ |
||||
mono-devel \ |
||||
nunit \ |
||||
nunit-console \ |
||||
monodevelop |
||||
|
||||
# Download NuGet |
||||
RUN cd /var/local && wget www.nuget.org/NuGet.exe |
||||
|
||||
# Get the source from GitHub |
||||
RUN git clone git@github.com:grpc/grpc.git /var/local/git/grpc |
||||
RUN cd /var/local/git/grpc && \ |
||||
git pull --recurse-submodules && \ |
||||
git submodule update --init --recursive |
||||
|
||||
# Define the default command. |
||||
CMD ["bash","-l"] |
@ -1,57 +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. |
||||
|
||||
# Dockerfile for gRPC C++ |
||||
FROM grpc/base |
||||
|
||||
RUN apt-get update && apt-get -y install libgflags-dev libgtest-dev |
||||
|
||||
# Get the source from GitHub |
||||
RUN git clone https://github.com/grpc/grpc.git /var/local/git/grpc |
||||
RUN cd /var/local/git/grpc && \ |
||||
git pull --recurse-submodules && \ |
||||
git submodule update --init --recursive |
||||
|
||||
# Build the protobuf library; then the C core. |
||||
RUN cd /var/local/git/grpc/third_party/protobuf && \ |
||||
./autogen.sh && \ |
||||
./configure --prefix=/usr && \ |
||||
make -j12 && make check && make install && make clean |
||||
|
||||
RUN cd /var/local/git/grpc && ls \ |
||||
&& make clean \ |
||||
&& make gens/test/cpp/util/messages.pb.cc \ |
||||
&& make interop_client \ |
||||
&& make interop_server |
||||
|
||||
ADD service_account service_account |
||||
ADD cacerts cacerts |
||||
ENV GRPC_DEFAULT_SSL_ROOTS_FILE_PATH /cacerts/roots.pem |
||||
|
||||
CMD ["/var/local/git/grpc/bins/opt/interop_server", "--use_tls", "--port=8010"] |
@ -1,42 +0,0 @@ |
||||
#!/bin/bash |
||||
# 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. |
||||
rm -rf /var/local/git |
||||
cp -R /var/local/git-clone /var/local/git |
||||
|
||||
cd /var/local/git/grpc/third_party/protobuf && \ |
||||
./autogen.sh && \ |
||||
./configure --prefix=/usr && \ |
||||
make -j12 && make check && make install && make clean |
||||
|
||||
cd /var/local/git/grpc && ls \ |
||||
&& make clean \ |
||||
&& make gens/test/cpp/util/messages.pb.cc \ |
||||
&& make interop_client \ |
||||
&& make interop_server |
@ -1,46 +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. |
||||
|
||||
# Dockerfile for gRPC Go |
||||
FROM golang:1.4 |
||||
|
||||
# Get the source from GitHub |
||||
RUN go get google.golang.org/grpc |
||||
RUN go get golang.org/x/oauth2 |
||||
RUN go get google.golang.org/cloud |
||||
|
||||
# Add a service_account directory containing the auth creds file |
||||
ADD service_account service_account |
||||
|
||||
# Build the interop client and server |
||||
RUN cd src/google.golang.org/grpc/interop/client && go install |
||||
RUN cd src/google.golang.org/grpc/interop/server && go install |
||||
|
||||
# Specify the default command such that the interop server runs on its known testing port |
||||
CMD ["/bin/bash", "-c", "cd src/google.golang.org/grpc/interop/server && go run server.go --use_tls=true --port=8020"] |
@ -1,4 +0,0 @@ |
||||
GRPC Go Dockerfile |
||||
================== |
||||
|
||||
Dockerfile for gRPC Go development, testing and deployment. |
@ -1,34 +0,0 @@ |
||||
#!/bin/bash |
||||
# 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. |
||||
|
||||
cp -R /var/local/git-clone/grpc-go/. /go/ |
||||
go get golang.org/x/oauth2 |
||||
go get google.golang.org/cloud |
||||
cd src/google.golang.org/grpc/interop/client && go install |
@ -1,41 +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. |
||||
|
||||
# Dockerfile for the gRPC Java dev image |
||||
FROM grpc/java_base |
||||
|
||||
RUN git clone --recursive --depth 1 https://github.com/grpc/grpc-java.git /var/local/git/grpc-java && \ |
||||
cd /var/local/git/grpc-java && \ |
||||
./gradlew :grpc-interop-testing:installDist -PskipCodegen=true |
||||
|
||||
# Add a service_account directory containing the auth creds file |
||||
ADD service_account service_account |
||||
|
||||
# Specify the default command such that the interop server runs on its known testing port |
||||
CMD ["/var/local/git/grpc-java/run-test-server.sh", "--use_tls=true", "--port=8030"] |
@ -1,9 +0,0 @@ |
||||
GRPC Java Dockerfile |
||||
==================== |
||||
|
||||
Dockerfile for creating the Java development image |
||||
|
||||
As of 2014/12 this |
||||
- is based on the gRPC Java base |
||||
- pulls from gRPC Java on GitHub |
||||
- installs it and runs the tests |
@ -1,37 +0,0 @@ |
||||
#!/bin/bash |
||||
# 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. |
||||
rm -rf /var/local/git |
||||
cp -R /var/local/git-clone /var/local/git |
||||
cd /var/local/git/grpc-java/lib/netty && \ |
||||
mvn -pl codec-http2 -am -DskipTests install clean |
||||
cd /var/local/git/grpc-java && \ |
||||
./gradlew build installDist |
||||
|
||||
echo 'build finished' |
@ -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. |
||||
|
||||
# Dockerfile for the gRPC Java dev image |
||||
FROM grpc/java_base |
||||
|
||||
# Required by accessing Android's aapt |
||||
RUN apt-get install -y lib32stdc++6 lib32z1 && apt-get clean |
||||
|
||||
# Install Android SDK 24.2 |
||||
RUN curl -L http://dl.google.com/android/android-sdk_r24.2-linux.tgz | tar xz -C /usr/local |
||||
|
||||
# Environment variables |
||||
ENV ANDROID_HOME /usr/local/android-sdk-linux |
||||
ENV PATH $PATH:$ANDROID_HOME/tools |
||||
ENV PATH $PATH:$ANDROID_HOME/platform-tools |
||||
# Some old Docker versions consider '/' as HOME |
||||
ENV HOME /root |
||||
|
||||
# Update sdk for android API level 19 (4.4), 21 (5.0), 22 (5.1). |
||||
RUN echo y | android update sdk --all --filter platform-tools,build-tools-22.0.1,sys-img-armeabi-v7a-addon-google_apis-google-22,sys-img-armeabi-v7a-addon-google_apis-google-21,sys-img-armeabi-v7a-android-19,android-22,android-21,android-19,addon-google_apis-google-22,addon-google_apis-google-21,addon-google_apis-google-19,extra-android-m2repository,extra-google-m2repository --no-ui --force |
||||
|
||||
|
||||
# Create AVDs with API level 19,21,22 |
||||
RUN echo no | android create avd --force -n avd-google-api-22 -t "Google Inc.:Google APIs:22" --abi google_apis/armeabi-v7a && \ |
||||
echo no | android create avd --force -n avd-google-api-21 -t "Google Inc.:Google APIs:21" --abi google_apis/armeabi-v7a && \ |
||||
echo no | android create avd --force -n avd-google-api-19 -t "Google Inc.:Google APIs:19" --abi default/armeabi-v7a |
||||
|
||||
# Pull gRPC Java and trigger download of needed Maven and Gradle artifacts. |
||||
RUN git clone --depth 1 https://github.com/grpc/grpc-java.git /var/local/git/grpc-java && \ |
||||
cd /var/local/git/grpc-java && \ |
||||
./gradlew grpc-core:install grpc-stub:install grpc-okhttp:install grpc-protobuf-nano:install grpc-compiler:install |
||||
|
||||
# Config android sdk for gradle and build apk to trigger download of needed Maven and Gradle artifacts. |
||||
RUN cd /var/local/git/grpc-java/android-interop-testing && echo "sdk.dir=/usr/local/android-sdk-linux" > local.properties && \ |
||||
../gradlew assembleDebug |
@ -1,42 +0,0 @@ |
||||
GRPC Android Dockerfile |
||||
==================== |
||||
|
||||
Dockerfile for creating the gRPC Android integration test image |
||||
|
||||
As of 2015/05 this |
||||
- is based on the gRPC Java base |
||||
- installs Android sdk 24.2 |
||||
- creates an AVD for API level 22 |
||||
- Pulls gRpc Android test App from github |
||||
|
||||
Usage |
||||
----- |
||||
|
||||
Start the emulator in a detached container, the argument is the name of the AVD you want to start: |
||||
|
||||
``` |
||||
$ sudo docker run --name=grpc_android_test -d grpc/android /var/local/git/grpc-java/android-interop-testing/start-emulator.sh avd-google-api-22 |
||||
``` |
||||
|
||||
You can use the following cammand to wait until the emulator is ready: |
||||
``` |
||||
$ sudo docker exec grpc_android_test /var/local/git/grpc-java/android-interop-testing/wait-for-emulator.sh |
||||
``` |
||||
|
||||
When you want to update the apk, run: |
||||
``` |
||||
$ sudo docker exec grpc_android_test bash -c "cd /var/local/git/grpc-java && git pull origin master && ./gradlew grpc-core:install grpc-stub:install grpc-okhttp:install grpc-protobuf-nano:install grpc-compiler:install && cd android-interop-testing && ../gradlew installDebug" |
||||
``` |
||||
It pulls the fresh code of gRpc Java and our interop test app from github, build and install it to the runing emulator (so you need to make sure there is a runing emulator). |
||||
|
||||
Trigger the integration test: |
||||
``` |
||||
$ sudo docker exec grpc_android_test adb -e shell am instrument -w -e server_host <hostname or ip address> -e server_port 8030 -e server_host_override foo.test.google.fr -e use_tls true -e use_test_ca true -e test_case all io.grpc.android.integrationtest/.TesterInstrumentation |
||||
``` |
||||
|
||||
You can also use the android/adb cammands to get more info, such as: |
||||
``` |
||||
$ sudo docker exec grpc_android_test android list avd |
||||
$ sudo docker exec grpc_android_test adb devices |
||||
$ sudo docker exec grpc_android_test adb logcat |
||||
``` |
@ -1,55 +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. |
||||
|
||||
FROM debian:latest |
||||
|
||||
# Install JDK 8 and Git |
||||
# |
||||
# TODO(temiola): simplify this if/when a simpler process is available. |
||||
# |
||||
RUN echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections && \ |
||||
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee /etc/apt/sources.list.d/webupd8team-java.list && \ |
||||
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list && \ |
||||
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886 && \ |
||||
apt-get update && \ |
||||
apt-get -y install \ |
||||
git \ |
||||
libapr1 \ |
||||
oracle-java8-installer \ |
||||
&& \ |
||||
apt-get clean && rm -r /var/cache/oracle-jdk8-installer/ |
||||
|
||||
ENV JAVA_HOME /usr/lib/jvm/java-8-oracle |
||||
ENV PATH $PATH:$JAVA_HOME/bin |
||||
|
||||
# Trigger download of as many Gradle artifacts as possible. |
||||
RUN git clone --recursive --depth 1 https://github.com/grpc/grpc-java.git && \ |
||||
cd grpc-java && \ |
||||
./gradlew build -PskipCodegen=true && \ |
||||
rm -r "$(pwd)" |
@ -1,9 +0,0 @@ |
||||
GRPC Java Base Dockerfile |
||||
========================= |
||||
|
||||
Dockerfile for creating the Java gRPC development Docker instance. |
||||
|
||||
As of 2014/12 this |
||||
- installs tools and dependencies needed to build gRPC Java |
||||
- does not install gRPC Java itself; a separate Dockerfile that depends on |
||||
this one will do that. |
@ -1,53 +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. |
||||
|
||||
# Dockerfile for gRPC Node |
||||
FROM grpc/node_base |
||||
|
||||
# Pull the latest sources |
||||
RUN cd /var/local/git/grpc \ |
||||
&& git pull --recurse-submodules \ |
||||
&& git submodule update --init --recursive |
||||
|
||||
# Prevent breaking the build if header files are added/removed. |
||||
RUN make clean -C /var/local/git/grpc |
||||
|
||||
# Install the C core. |
||||
RUN make install_c -j12 -C /var/local/git/grpc |
||||
|
||||
RUN cd /var/local/git/grpc/src/node && npm install && node-gyp rebuild |
||||
|
||||
# Add a cacerts directory containing the Google root pem file, allowing the |
||||
# ruby client to access the production test instance |
||||
ADD cacerts cacerts |
||||
|
||||
# Add a service_account directory containing the auth creds file |
||||
ADD service_account service_account |
||||
|
||||
CMD ["/usr/bin/nodejs", "/var/local/git/grpc/src/node/interop/interop_server.js", "--use_tls=true", "--port=8040"] |
@ -1,36 +0,0 @@ |
||||
#!/bin/bash |
||||
# 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. |
||||
cp -R /var/local/git-clone/grpc /var/local/git |
||||
|
||||
make clean -C /var/local/git/grpc |
||||
|
||||
make install_c -j12 -C /var/local/git/grpc |
||||
|
||||
cd /var/local/git/grpc/src/node && npm install && node-gyp rebuild |
@ -1,53 +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. |
||||
|
||||
# Base Dockerfile for gRPC Node. |
||||
# |
||||
# Includes Node installation dependencies |
||||
FROM grpc/base |
||||
|
||||
RUN curl -sL https://deb.nodesource.com/setup | bash - |
||||
|
||||
RUN apt-get update && apt-get install -y nodejs nodejs-legacy |
||||
|
||||
RUN npm install -g node-gyp |
||||
|
||||
# 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 |
||||
RUN cd /var/local/git/grpc && \ |
||||
git pull --recurse-submodules && \ |
||||
git submodule update --init --recursive |
||||
|
||||
# TODO: pre-building seems unnecessary, because we need to run make clean |
||||
# anyway to prevent build from crashing if header files are added/removed. |
||||
# Build the C core |
||||
RUN make static_c shared_c -j12 -C /var/local/git/grpc |
||||
|
||||
# Define the default command. |
||||
CMD ["bash"] |
@ -1,60 +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. |
||||
|
||||
# Dockerfile for gRPC PHP |
||||
FROM grpc/php_base |
||||
|
||||
RUN cd /var/local/git/grpc \ |
||||
&& git pull --recurse-submodules \ |
||||
&& git submodule update --init --recursive |
||||
|
||||
# Prevent breaking the build if header files are added/removed. |
||||
RUN make clean -C /var/local/git/grpc |
||||
|
||||
RUN make install_c -j12 -C /var/local/git/grpc |
||||
|
||||
RUN cd /var/local/git/grpc/src/php/ext/grpc && git pull && phpize |
||||
|
||||
# Build the grpc PHP extension |
||||
RUN cd /var/local/git/grpc/src/php/ext/grpc \ |
||||
&& ./configure \ |
||||
&& make |
||||
|
||||
RUN cd /var/local/git/grpc/src/php && composer install |
||||
|
||||
# Add a cacerts directory containing the Google root pem file, allowing the |
||||
# php client to access the production test instance |
||||
ADD cacerts cacerts |
||||
|
||||
# Add a service_account directory containing the auth creds file |
||||
ADD service_account service_account |
||||
|
||||
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 |
@ -1,10 +0,0 @@ |
||||
GRPC PHP Dockerfile |
||||
=================== |
||||
|
||||
Dockerfile for creating the PHP development instances |
||||
|
||||
As of 2014/10 this |
||||
- is based on the GRPC PHP base |
||||
- adds a pull of the HEAD GRPC PHP source from GitHub |
||||
- it builds it |
||||
- runs the tests, i.e, the image won't be created if the tests don't pass |
@ -1,18 +0,0 @@ |
||||
#!/bin/bash |
||||
|
||||
cp -R /var/local/git-clone/grpc /var/local/git |
||||
|
||||
make clean -C /var/local/git/grpc |
||||
|
||||
make install_c -j12 -C /var/local/git/grpc |
||||
|
||||
cd /var/local/git/grpc/src/php/ext/grpc && git pull && phpize |
||||
|
||||
cd /var/local/git/grpc/src/php/ext/grpc \ |
||||
&& ./configure \ |
||||
&& make |
||||
|
||||
cd /var/local/git/grpc/src/php && composer install |
||||
|
||||
cd /var/local/git/grpc/src/php && protoc-gen-php -i tests/interop/ -o tests/interop/ tests/interop/test.proto |
||||
|
@ -1,122 +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. |
||||
|
||||
# Base Dockerfile for gRPC PHP. |
||||
# |
||||
# 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 \ |
||||
automake \ |
||||
bison \ |
||||
curl \ |
||||
g++ \ |
||||
gawk \ |
||||
gcc \ |
||||
groff \ |
||||
libc6-dev \ |
||||
libffi-dev \ |
||||
libgdbm-dev \ |
||||
libncurses5-dev \ |
||||
libreadline6-dev \ |
||||
libsqlite3-dev \ |
||||
libssl-dev \ |
||||
libtool \ |
||||
libxml2 \ |
||||
libyaml-dev \ |
||||
make \ |
||||
patch \ |
||||
php5-common \ |
||||
php5-cli \ |
||||
php5-dev \ |
||||
php-pear \ |
||||
pkg-config \ |
||||
procps \ |
||||
sqlite3 \ |
||||
zlib1g-dev |
||||
|
||||
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/stanley-cheung/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 |
||||
|
||||
# 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 |
||||
RUN cd /var/local/git/grpc && \ |
||||
git pull --recurse-submodules && \ |
||||
git submodule update --init --recursive |
||||
|
||||
# Build and install the protobuf library |
||||
RUN cd /var/local/git/grpc/third_party/protobuf && \ |
||||
./autogen.sh && \ |
||||
./configure --prefix=/usr && \ |
||||
make -j12 && make check && make install && make clean |
||||
|
||||
# Install the patched PHP protobuf so that PHP gRPC clients can be generated |
||||
# from proto3 schemas. |
||||
RUN cd /var/local/git/protobuf-php \ |
||||
&& rvm all do rake pear:package version=1.0 \ |
||||
&& pear install Protobuf-1.0.tgz |
||||
|
||||
# Install PHPUnit, used to run the PHP unit tests |
||||
RUN wget https://phar.phpunit.de/phpunit.phar \ |
||||
&& chmod +x phpunit.phar \ |
||||
&& mv phpunit.phar /usr/local/bin/phpunit |
||||
|
||||
|
||||
# TODO: pre-building seems unnecessary, because we need to run make clean |
||||
# anyway to prevent build from crashing if header files are added/removed. |
||||
# Build the C core |
||||
RUN make static_c shared_c -j12 -C /var/local/git/grpc |
||||
|
||||
# Define the default command. |
||||
CMD ["bash"] |
@ -1,9 +0,0 @@ |
||||
GRPC PHP Base Dockerfile |
||||
======================== |
||||
|
||||
Dockerfile for creating the PHP gRPC development Docker instance. |
||||
|
||||
As of 2014/10 this |
||||
- it installs tools and dependencies needed to build gRPC PHP |
||||
- it does not install gRPC PHP itself; a separate Dockerfile that depends on |
||||
this one will do that |
@ -1,57 +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. |
||||
|
||||
# Dockerfile for GRPC Python |
||||
FROM grpc/python_base |
||||
|
||||
# Pull the latest sources |
||||
RUN cd /var/local/git/grpc \ |
||||
&& git pull --recurse-submodules \ |
||||
&& git submodule update --init --recursive |
||||
|
||||
# Build the C core. |
||||
RUN make install_c -j12 -C /var/local/git/grpc |
||||
|
||||
# Build Python GRPC |
||||
RUN cd /var/local/git/grpc \ |
||||
&& pip install src/python/grpcio \ |
||||
&& pip install src/python/grpcio_test |
||||
|
||||
# Run Python GRPC's tests |
||||
RUN cd /var/local/git/grpc \ |
||||
&& python2.7 -B src/python/grpcio_test/setup.py test |
||||
|
||||
# Add a cacerts directory containing the Google root pem file, allowing the interop client to access the production test instance |
||||
ADD cacerts cacerts |
||||
|
||||
# Add a service_account directory containing the auth creds file |
||||
ADD service_account service_account |
||||
|
||||
# Specify the default command such that the interop server runs on its known testing port |
||||
CMD ["/bin/bash", "-l", "-c", "python2.7 -m interop.server --use_tls --port 8050"] |
@ -1,11 +0,0 @@ |
||||
GRPC Python Dockerfile |
||||
==================== |
||||
|
||||
Dockerfile for creating the Python development instances |
||||
|
||||
As of 2015/02 this |
||||
- is based on the GRPC Python base |
||||
- adds a pull of the HEAD GRPC Python source from GitHub |
||||
- builds it |
||||
- runs its tests and aborts image creation if the tests don't pass |
||||
- specifies the Python GRPC interop test server as default command |
@ -1,49 +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. |
||||
|
||||
# Base Dockerfile for GRPC Python. |
||||
# |
||||
# Includes Python environment and installation dependencies. |
||||
FROM grpc/base |
||||
|
||||
# Allows 'source' to work |
||||
RUN rm /bin/sh && ln -s /bin/bash /bin/sh |
||||
|
||||
# Install Python development |
||||
RUN apt-get update && apt-get install -y \ |
||||
python-all-dev \ |
||||
python3-all-dev \ |
||||
python-pip \ |
||||
python-virtualenv |
||||
|
||||
# Install Python packages from PyPI |
||||
RUN pip install futures==2.2.0 enum34==1.0.4 protobuf==3.0.0a2 cython==0.23 |
||||
|
||||
# Get the GRPC source from GitHub |
||||
RUN git clone --recursive https://github.com/grpc/grpc.git /var/local/git/grpc |
@ -1,7 +0,0 @@ |
||||
GRPC Python Base Dockerfile |
||||
======================== |
||||
|
||||
Dockerfile for creating the Python GRPC development Docker instance. |
||||
|
||||
As of 2015/02 this |
||||
- installs tools and dependencies needed to build GRPC Python |
@ -1,56 +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. |
||||
|
||||
# Dockerfile for gRPC Ruby |
||||
FROM grpc/ruby_base |
||||
|
||||
# Pull the latest sources |
||||
RUN cd /var/local/git/grpc \ |
||||
&& git pull --recurse-submodules \ |
||||
&& git submodule update --init --recursive |
||||
|
||||
# Prevent breaking the build if header files are added/removed. |
||||
RUN make clean -C /var/local/git/grpc |
||||
|
||||
# Build the C core |
||||
RUN make install_c -j12 -C /var/local/git/grpc |
||||
|
||||
# Build ruby gRPC and run its tests |
||||
RUN /bin/bash -l -c 'cd /var/local/git/grpc/src/ruby && gem update bundler && bundle && rake' |
||||
|
||||
# Add a cacerts directory containing the Google root pem file, allowing the |
||||
# ruby client to access the production test instance |
||||
ADD cacerts cacerts |
||||
|
||||
# Add a service_account directory containing the auth creds file |
||||
ADD service_account service_account |
||||
|
||||
# Specify the default command such that the interop server runs on its known |
||||
# testing port |
||||
CMD ["/bin/bash", "-l", "-c", "ruby /var/local/git/grpc/src/ruby/bin/interop/interop_server.rb --use_tls --port 8060"] |
@ -1,10 +0,0 @@ |
||||
GRPC Ruby Dockerfile |
||||
==================== |
||||
|
||||
Dockerfile for creating the Ruby development instances |
||||
|
||||
As of 2014/10 this |
||||
- is based on the GRPC Ruby base |
||||
- adds a pull of the HEAD gRPC Ruby source from GitHub |
||||
- it builds it |
||||
- runs the tests, i.e, the image won't be created if the tests don't pass |
@ -1,36 +0,0 @@ |
||||
#!/bin/bash |
||||
# 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. |
||||
cp -R /var/local/git-clone/grpc /var/local/git |
||||
|
||||
make clean -C /var/local/git/grpc |
||||
|
||||
make install_c -j12 -C /var/local/git/grpc |
||||
|
||||
/bin/bash -l -c 'cd /var/local/git/grpc/src/ruby && gem update bundler && bundle && rake' |
@ -1,92 +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. |
||||
|
||||
# Base Dockerfile for gRPC Ruby. |
||||
# |
||||
# Includes Ruby installation dependencies, things that are unlikely to vary. |
||||
FROM grpc/base |
||||
|
||||
# Allows 'source' to work |
||||
RUN rm /bin/sh && ln -s /bin/bash /bin/sh |
||||
|
||||
# Install RVM dependencies |
||||
RUN apt-get update && apt-get install -y \ |
||||
autoconf \ |
||||
automake \ |
||||
bison \ |
||||
curl \ |
||||
g++ \ |
||||
gawk \ |
||||
gcc \ |
||||
libc6-dev \ |
||||
libffi-dev \ |
||||
libgdbm-dev \ |
||||
libncurses5-dev \ |
||||
libreadline6-dev \ |
||||
libsqlite3-dev \ |
||||
libssl-dev \ |
||||
libtool \ |
||||
libyaml-dev \ |
||||
make \ |
||||
patch \ |
||||
pkg-config \ |
||||
procps \ |
||||
sqlite3 \ |
||||
zlib1g-dev |
||||
|
||||
# Install RVM, use this to install ruby |
||||
RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3 # Needed for RVM |
||||
RUN /bin/bash -l -c "curl -L get.rvm.io | bash -s stable" |
||||
|
||||
# Install Ruby 2.1 |
||||
RUN /bin/bash -l -c "rvm install ruby-2.1" |
||||
RUN /bin/bash -l -c "rvm use --default ruby-2.1" |
||||
RUN /bin/bash -l -c "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc" |
||||
RUN /bin/bash -l -c "echo 'rvm --default use ruby-2.1' >> ~/.bashrc" |
||||
RUN /bin/bash -l -c "gem install bundler --no-ri --no-rdoc" |
||||
|
||||
# Get the source from GitHub |
||||
RUN git clone https://github.com/grpc/grpc.git /var/local/git/grpc |
||||
RUN cd /var/local/git/grpc && \ |
||||
git pull --recurse-submodules && \ |
||||
git submodule update --init --recursive |
||||
|
||||
# Build and install the protobuf library |
||||
RUN cd /var/local/git/grpc/third_party/protobuf && \ |
||||
./autogen.sh && \ |
||||
./configure --prefix=/usr && \ |
||||
make -j12 && make check && make install && make clean |
||||
|
||||
# TODO: pre-building seems unnecessary, because we need to run make clean |
||||
# anyway to prevent build from crashing if header files are added/removed. |
||||
# Build the C core |
||||
RUN make static_c shared_c -j12 -C /var/local/git/grpc |
||||
|
||||
# Define the default command. |
||||
CMD ["bash"] |
@ -1,9 +0,0 @@ |
||||
GRPC RUBY Base Dockerfile |
||||
======================== |
||||
|
||||
Dockerfile for creating the Ruby gRPC development Docker instance. |
||||
|
||||
As of 2014/10 this |
||||
- it installs tools and dependencies needed to build gRPC Ruby |
||||
- it does not install gRPC Ruby itself; a separate Dockerfile that depends on |
||||
this one will do that |
@ -1,48 +0,0 @@ |
||||
GCE images for GRPC |
||||
=================== |
||||
|
||||
This directory contains a number of shell files used for setting up GCE images |
||||
and instances for developing and testing gRPC. |
||||
|
||||
|
||||
|
||||
Goal |
||||
---- |
||||
|
||||
- provides a script to create a GCE image that has everything needed to try |
||||
out gRPC on GCE. |
||||
- provide another script that creates a new GCE instance from the latest image |
||||
|
||||
- additional scripts may be added in the future |
||||
|
||||
|
||||
Usage |
||||
------ |
||||
|
||||
# Minimal usage (see the scripts themselves for options) |
||||
|
||||
$ create_grpc_dev_image.sh # creates a grpc GCE image |
||||
$ ... |
||||
$ new_grpc_dev_instance.sh # creates an instance using the latest grpc GCE image |
||||
|
||||
|
||||
Requirements |
||||
------------ |
||||
|
||||
Install [Google Cloud SDK](https://developers.google.com/cloud/sdk/) |
||||
|
||||
Contents |
||||
-------- |
||||
|
||||
Library scripts that contain bash functions used in the other scripts: |
||||
- shared_setup_funcs.sh # funcs used in create_grpc_dev_image and new_grpc_dev_instance |
||||
- gcutil_extras.sh # wrappers for common tasks that us gcutil |
||||
- build_grpc_dist.sh # funcs building the GRPC library and tests into a debian dist |
||||
|
||||
GCE [startup scripts](https://developers.google.com/compute/docs/howtos/startupscript) |
||||
- *_on_startup.sh |
||||
|
||||
Main scripts (as of 2014/09/04) |
||||
- create_grpc_dev_instance.sh |
||||
- new_grpc_dev_instance.sh |
||||
|
@ -1,46 +0,0 @@ |
||||
#!/bin/bash |
||||
# 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. |
||||
|
||||
|
||||
main() { |
||||
# rebuild images on all languages on existing builder vm. |
||||
source grpc_docker.sh |
||||
cd ../../ |
||||
|
||||
# build images for all languages |
||||
languages=(cxx java go ruby node python csharp_mono) |
||||
for lan in "${languages[@]}" |
||||
do |
||||
grpc_update_image $lan |
||||
done |
||||
} |
||||
|
||||
set -x |
||||
main "$@" |
@ -1,58 +0,0 @@ |
||||
#!/bin/bash |
||||
# 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. |
||||
|
||||
|
||||
main() { |
||||
# restart builder vm and wait for images to sync to it |
||||
source grpc_docker.sh |
||||
./new_grpc_docker_builder.sh -igrpc-docker-builder-alt-2 -anone |
||||
cd ../../ |
||||
sleep 3600 |
||||
|
||||
# build images for all languages |
||||
languages=(cxx java go ruby node python csharp_mono) |
||||
for lan in "${languages[@]}" |
||||
do |
||||
grpc_update_image $lan |
||||
done |
||||
|
||||
# restart client and server vm and wait for images to sync to them |
||||
cd tools/gce_setup |
||||
./new_grpc_docker_builder.sh -igrpc-docker-testclients -anone |
||||
./new_grpc_docker_builder.sh -igrpc-docker-server -anone |
||||
sleep 3600 |
||||
|
||||
# launch images for all languages on server |
||||
grpc_launch_servers grpc-docker-server |
||||
|
||||
} |
||||
|
||||
set -x |
||||
main "$@" |
@ -1,89 +0,0 @@ |
||||
#!/bin/bash |
||||
# 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. |
||||
|
||||
thisfile=$(readlink -ne "${BASH_SOURCE[0]}") |
||||
cur=$(date "+%Y-%m-%d-%H-%M-%S") |
||||
log_link=https://pantheon.corp.google.com/m/cloudstorage/b/stoked-keyword-656-output/o/prod_result/prod/$cur/logs |
||||
|
||||
main() { |
||||
source grpc_docker.sh |
||||
test_cases=(large_unary empty_unary ping_pong client_streaming server_streaming cancel_after_begin cancel_after_first_response empty_stream timeout_on_sleeping_server) |
||||
auth_test_cases=(service_account_creds compute_engine_creds jwt_token_creds oauth2_auth_token per_rpc_creds) |
||||
clients=(cxx java go ruby node csharp_mono csharp_dotnet python php) |
||||
for test_case in "${test_cases[@]}" |
||||
do |
||||
for client in "${clients[@]}" |
||||
do |
||||
client_vm="grpc-docker-testclients" |
||||
if [ "$client" = "csharp_dotnet" ] |
||||
then |
||||
client_vm="grpc-windows-interop1" |
||||
fi |
||||
log_file_name=cloud_{$test_case}_{$client}.txt |
||||
if grpc_cloud_prod_test $test_case $client_vm $client > /tmp/$log_file_name 2>&1 |
||||
then |
||||
echo " ['$test_case', '$client', 'prod', true, '<a href="$log_link/$log_file_name">log</a>']," >> /tmp/cloud_prod_result.txt |
||||
else |
||||
echo " ['$test_case', '$client', 'prod', false, '<a href="$log_link/$log_file_name">log</a>']," >> /tmp/cloud_prod_result.txt |
||||
fi |
||||
gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/prod_result/prod/$cur/logs/$log_file_name |
||||
rm /tmp/$log_file_name |
||||
done |
||||
done |
||||
for test_case in "${auth_test_cases[@]}" |
||||
do |
||||
for client in "${clients[@]}" |
||||
do |
||||
client_vm="grpc-docker-testclients" |
||||
if [ "$client" = "csharp_dotnet" ] |
||||
then |
||||
client_vm="grpc-windows-interop1" |
||||
fi |
||||
log_file_name=cloud_{$test_case}_{$client}.txt |
||||
if grpc_cloud_prod_auth_test $test_case $client_vm $client > /tmp/$log_file_name 2>&1 |
||||
then |
||||
echo " ['$test_case', '$client', 'prod', true, '<a href="$log_link/$log_file_name">log</a>']," >> /tmp/cloud_prod_result.txt |
||||
else |
||||
echo " ['$test_case', '$client', 'prod', false, '<a href="$log_link/$log_file_name">log</a>']," >> /tmp/cloud_prod_result.txt |
||||
fi |
||||
gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/prod_result/prod/$cur/logs/$log_file_name |
||||
rm /tmp/$log_file_name |
||||
done |
||||
done |
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then |
||||
cat pre.html /tmp/cloud_prod_result.txt post.html > /tmp/cloud_prod_result.html |
||||
gsutil cp /tmp/cloud_prod_result.html gs://stoked-keyword-656-output/prod_result/prod/$cur/cloud_prod_result.html |
||||
rm /tmp/cloud_prod_result.txt |
||||
rm /tmp/cloud_prod_result.html |
||||
fi |
||||
} |
||||
|
||||
set -x |
||||
main "$@" |
@ -1,62 +0,0 @@ |
||||
#!/bin/bash |
||||
# 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. |
||||
|
||||
thisfile=$(readlink -ne "${BASH_SOURCE[0]}") |
||||
test_case=$1 |
||||
client_vm=$2 |
||||
result=cloud_prod_result.$1 |
||||
cur=$(date "+%Y-%m-%d-%H-%M-%S") |
||||
log_link=https://pantheon.corp.google.com/m/cloudstorage/b/stoked-keyword-656-output/o/prod_result/$test_case/$cur |
||||
|
||||
main() { |
||||
source grpc_docker.sh |
||||
clients=(cxx java go ruby node csharp_mono python php) |
||||
for client in "${clients[@]}" |
||||
do |
||||
log_file_name=cloud_{$test_case}_{$client}.txt |
||||
if grpc_cloud_prod_test $test_case $client_vm $client > /tmp/$log_file_name 2>&1 |
||||
then |
||||
echo " ['$test_case', '$client', 'prod', true, '<a href="$log_link/$log_file_name">log</a>']," >> /tmp/$result.txt |
||||
else |
||||
echo " ['$test_case', '$client', 'prod', false, '<a href="$log_link/$log_file_name">log</a>']," >> /tmp/$result.txt |
||||
fi |
||||
gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/prod_result/$test_case/$cur/$log_file_name |
||||
rm /tmp/$log_file_name |
||||
done |
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then |
||||
cat pre.html /tmp/$result.txt post.html > /tmp/$result.html |
||||
gsutil cp /tmp/$result.html gs://stoked-keyword-656-output/prod_result/$test_case/$cur/$result.html |
||||
rm /tmp/$result.txt |
||||
rm /tmp/$result.html |
||||
fi |
||||
} |
||||
|
||||
set -x |
||||
main "$@" |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue