aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-03-30 08:33:28 -0700
committerGravatar Craig Tiller <ctiller@google.com>2016-03-30 08:33:28 -0700
commit801e6845569b09e8da72cb51b6a403dce19b1d41 (patch)
tree48081344886ecd6c3bd9a2112c2748986216c80b
parent026a3dda920335b08d9d970fbe29f72627113384 (diff)
parente39707458df9c77a2a2570f9dbf3d18b01ca4d68 (diff)
Merge github.com:grpc/grpc into accounting
-rw-r--r--src/core/lib/client_config/resolvers/sockaddr_resolver.c39
-rw-r--r--src/core/lib/iomgr/pollset_set_windows.c2
-rw-r--r--src/ruby/ext/grpc/rb_byte_buffer.c15
-rw-r--r--src/ruby/ext/grpc/rb_call.c14
-rwxr-xr-xtest/distrib/node/run_distrib_test.sh22
-rwxr-xr-xtools/run_tests/build_artifact_node.sh2
-rwxr-xr-xtools/run_tests/build_artifact_python.sh13
-rwxr-xr-xtools/run_tests/build_node.sh2
-rwxr-xr-xtools/run_tests/build_package_node.sh2
-rwxr-xr-xtools/run_tests/pre_build_node.sh2
-rwxr-xr-xtools/run_tests/run_node.sh2
-rwxr-xr-xtools/run_tests/run_tests.py38
-rw-r--r--vsprojects/build_vs2010.bat2
-rw-r--r--vsprojects/build_vs2013.bat2
-rw-r--r--vsprojects/build_vs2015.bat2
15 files changed, 67 insertions, 92 deletions
diff --git a/src/core/lib/client_config/resolvers/sockaddr_resolver.c b/src/core/lib/client_config/resolvers/sockaddr_resolver.c
index 5c5133649a..c787bd57d6 100644
--- a/src/core/lib/client_config/resolvers/sockaddr_resolver.c
+++ b/src/core/lib/client_config/resolvers/sockaddr_resolver.c
@@ -267,46 +267,17 @@ static grpc_resolver *sockaddr_create(
r->lb_policy_name = NULL;
if (0 != strcmp(args->uri->query, "")) {
gpr_slice query_slice;
- gpr_slice_buffer query_parts; /* the &-separated elements of the query */
- gpr_slice_buffer query_param_parts; /* the =-separated subelements */
+ gpr_slice_buffer query_parts;
query_slice =
gpr_slice_new(args->uri->query, strlen(args->uri->query), do_nothing);
gpr_slice_buffer_init(&query_parts);
- gpr_slice_buffer_init(&query_param_parts);
- /* the query can contain "lb_policy=<policy>" and "lb_enabled=<1|0>" */
-
- bool lb_enabled;
- gpr_slice_split(query_slice, "&", &query_parts);
- for (i = 0; i < query_parts.count; i++) {
- gpr_slice_split(query_parts.slices[i], "=", &query_param_parts);
- GPR_ASSERT(query_param_parts.count == 2);
- if (0 == gpr_slice_str_cmp(query_param_parts.slices[0], "lb_policy")) {
- r->lb_policy_name =
- gpr_dump_slice(query_param_parts.slices[1], GPR_DUMP_ASCII);
- } else if (0 ==
- gpr_slice_str_cmp(query_param_parts.slices[0], "lb_enabled")) {
- if (0 != gpr_slice_str_cmp(query_param_parts.slices[1], "0")) {
- /* anything other than 0 is taken to be true */
- lb_enabled = true;
- }
- } else {
- gpr_log(GPR_ERROR, "invalid query element value: '%s'",
- query_parts.slices[0]);
- }
- gpr_slice_buffer_reset_and_unref(&query_param_parts);
- }
-
- if (strcmp("grpclb", r->lb_policy_name) == 0 && !lb_enabled) {
- /* we want grpclb but the "resolved" addresses aren't LB enabled. Bail
- * out, as this is meant mostly for tests. */
- gpr_log(GPR_ERROR,
- "Requested 'grpclb' LB policy but resolved addresses don't "
- "support load balancing.");
- abort();
+ gpr_slice_split(query_slice, "=", &query_parts);
+ GPR_ASSERT(query_parts.count == 2);
+ if (0 == gpr_slice_str_cmp(query_parts.slices[0], "lb_policy")) {
+ r->lb_policy_name = gpr_dump_slice(query_parts.slices[1], GPR_DUMP_ASCII);
}
gpr_slice_buffer_destroy(&query_parts);
- gpr_slice_buffer_destroy(&query_param_parts);
gpr_slice_unref(query_slice);
}
if (r->lb_policy_name == NULL) {
diff --git a/src/core/lib/iomgr/pollset_set_windows.c b/src/core/lib/iomgr/pollset_set_windows.c
index 0b14e446ae..720fc331ed 100644
--- a/src/core/lib/iomgr/pollset_set_windows.c
+++ b/src/core/lib/iomgr/pollset_set_windows.c
@@ -37,7 +37,7 @@
#include "src/core/lib/iomgr/pollset_set_windows.h"
-grpc_pollset_set* grpc_pollset_set_create(pollset_set) { return NULL; }
+grpc_pollset_set* grpc_pollset_set_create(void) { return NULL; }
void grpc_pollset_set_destroy(grpc_pollset_set* pollset_set) {}
diff --git a/src/ruby/ext/grpc/rb_byte_buffer.c b/src/ruby/ext/grpc/rb_byte_buffer.c
index db7cac363a..9b617e13d3 100644
--- a/src/ruby/ext/grpc/rb_byte_buffer.c
+++ b/src/ruby/ext/grpc/rb_byte_buffer.c
@@ -50,21 +50,18 @@ grpc_byte_buffer* grpc_rb_s_to_byte_buffer(char *string, size_t length) {
}
VALUE grpc_rb_byte_buffer_to_s(grpc_byte_buffer *buffer) {
- size_t length = 0;
- char *string = NULL;
- size_t offset = 0;
+ VALUE rb_string;
grpc_byte_buffer_reader reader;
gpr_slice next;
if (buffer == NULL) {
return Qnil;
-
}
- length = grpc_byte_buffer_length(buffer);
- string = xmalloc(length + 1);
+ rb_string = rb_str_buf_new(grpc_byte_buffer_length(buffer));
grpc_byte_buffer_reader_init(&reader, buffer);
while (grpc_byte_buffer_reader_next(&reader, &next) != 0) {
- memcpy(string + offset, GPR_SLICE_START_PTR(next), GPR_SLICE_LENGTH(next));
- offset += GPR_SLICE_LENGTH(next);
+ rb_str_cat(rb_string, (const char *) GPR_SLICE_START_PTR(next),
+ GPR_SLICE_LENGTH(next));
+ gpr_slice_unref(next);
}
- return rb_str_new(string, length);
+ return rb_string;
}
diff --git a/src/ruby/ext/grpc/rb_call.c b/src/ruby/ext/grpc/rb_call.c
index cd0aa6aaf2..b0829efdc7 100644
--- a/src/ruby/ext/grpc/rb_call.c
+++ b/src/ruby/ext/grpc/rb_call.c
@@ -551,13 +551,26 @@ static void grpc_run_batch_stack_init(run_batch_stack *st,
/* grpc_run_batch_stack_cleanup ensures the run_batch_stack is properly
* cleaned up */
static void grpc_run_batch_stack_cleanup(run_batch_stack *st) {
+ size_t i = 0;
+
grpc_metadata_array_destroy(&st->send_metadata);
grpc_metadata_array_destroy(&st->send_trailing_metadata);
grpc_metadata_array_destroy(&st->recv_metadata);
grpc_metadata_array_destroy(&st->recv_trailing_metadata);
+
if (st->recv_status_details != NULL) {
gpr_free(st->recv_status_details);
}
+
+ if (st->recv_message != NULL) {
+ grpc_byte_buffer_destroy(st->recv_message);
+ }
+
+ for (i = 0; i < st->op_num; i++) {
+ if (st->ops[i].op == GRPC_OP_SEND_MESSAGE) {
+ grpc_byte_buffer_destroy(st->ops[i].data.send_message);
+ }
+ }
}
/* grpc_run_batch_stack_fill_ops fills the run_batch_stack ops array from
@@ -643,7 +656,6 @@ static VALUE grpc_run_batch_stack_build_result(run_batch_stack *st) {
break;
case GRPC_OP_SEND_MESSAGE:
rb_struct_aset(result, sym_send_message, Qtrue);
- grpc_byte_buffer_destroy(st->ops[i].data.send_message);
break;
case GRPC_OP_SEND_CLOSE_FROM_CLIENT:
rb_struct_aset(result, sym_send_close, Qtrue);
diff --git a/test/distrib/node/run_distrib_test.sh b/test/distrib/node/run_distrib_test.sh
index 9b8f15771b..13a42fcb0a 100755
--- a/test/distrib/node/run_distrib_test.sh
+++ b/test/distrib/node/run_distrib_test.sh
@@ -28,23 +28,31 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+function finish() {
+ rv=$?
+ kill $STATIC_PID || true
+ curl "localhost:32767/drop/$STATIC_PORT" || true
+ exit $rv
+}
+
+trap finish EXIT
+
NODE_VERSION=$1
source ~/.nvm/nvm.sh
-set -ex
cd $(dirname $0)
nvm install $NODE_VERSION
+set -ex
npm install -g node-static
-# Kill off existing static servers
-kill -9 $(ps aux | grep '[n]ode .*static' | awk '{print $2}') || true
-
STATIC_SERVER=127.0.0.1
-STATIC_PORT=8080
+# If port_server is running, get port from that. Otherwise, assume we're in
+# docker and use 8080
+STATIC_PORT=$(curl 'localhost:32767/get' || echo '8080')
-# Serves the input_artifacts directory statically at localhost:8080
+# Serves the input_artifacts directory statically at localhost:
static "$EXTERNAL_GIT_ROOT/input_artifacts" -a $STATIC_SERVER -p $STATIC_PORT &
STATIC_PID=$!
@@ -52,6 +60,4 @@ STATIC_URL="http://$STATIC_SERVER:$STATIC_PORT/"
npm install --unsafe-perm $STATIC_URL/grpc.tgz --grpc_node_binary_host_mirror=$STATIC_URL
-kill -9 $STATIC_PID
-
./distrib_test.js
diff --git a/tools/run_tests/build_artifact_node.sh b/tools/run_tests/build_artifact_node.sh
index 6aa4824538..ef3476a038 100755
--- a/tools/run_tests/build_artifact_node.sh
+++ b/tools/run_tests/build_artifact_node.sh
@@ -30,9 +30,9 @@
NODE_TARGET_ARCH=$1
source ~/.nvm/nvm.sh
-set -ex
nvm use 4
+set -ex
cd $(dirname $0)/../..
diff --git a/tools/run_tests/build_artifact_python.sh b/tools/run_tests/build_artifact_python.sh
index 7ba04d7546..1f23f9fade 100755
--- a/tools/run_tests/build_artifact_python.sh
+++ b/tools/run_tests/build_artifact_python.sh
@@ -35,15 +35,18 @@ cd $(dirname $0)/../..
if [ "$SKIP_PIP_INSTALL" == "" ]
then
pip install --upgrade six
- pip install --upgrade setuptools
+ # There's a bug in newer versions of setuptools (see
+ # https://bitbucket.org/pypa/setuptools/issues/503/pkg_resources_vendorpackagingrequirementsi)
+ pip install --upgrade 'setuptools==18'
pip install -rrequirements.txt
fi
+export GRPC_PYTHON_USE_CUSTOM_BDIST=0
+export GRPC_PYTHON_BUILD_WITH_CYTHON=1
+
# Build the source distribution first because MANIFEST.in cannot override
# exclusion of built shared objects among package resources (for some
# inexplicable reason).
-GRPC_PYTHON_USE_CUSTOM_BDIST=0 \
-GRPC_PYTHON_BUILD_WITH_CYTHON=1 \
${SETARCH_CMD} python setup.py \
sdist
@@ -51,15 +54,11 @@ ${SETARCH_CMD} python setup.py \
# and thus ought to be run in a shell command separate of others. Further, it
# trashes the actual bdist_wheel output, so it should be run first so that
# bdist_wheel may be run unmolested.
-GRPC_PYTHON_USE_CUSTOM_BDIST=0 \
-GRPC_PYTHON_BUILD_WITH_CYTHON=1 \
${SETARCH_CMD} python setup.py \
build_tagged_ext
# Wheel has a bug where directories don't get excluded.
# https://bitbucket.org/pypa/wheel/issues/99/cannot-exclude-directory
-GRPC_PYTHON_USE_CUSTOM_BDIST=0 \
-GRPC_PYTHON_BUILD_WITH_CYTHON=1 \
${SETARCH_CMD} python setup.py \
bdist_wheel
diff --git a/tools/run_tests/build_node.sh b/tools/run_tests/build_node.sh
index 9c4af07185..cbe0e31d2e 100755
--- a/tools/run_tests/build_node.sh
+++ b/tools/run_tests/build_node.sh
@@ -31,9 +31,9 @@
NODE_VERSION=$1
source ~/.nvm/nvm.sh
-set -ex
nvm use $NODE_VERSION
+set -ex
CONFIG=${CONFIG:-opt}
diff --git a/tools/run_tests/build_package_node.sh b/tools/run_tests/build_package_node.sh
index aca90a3750..540c826311 100755
--- a/tools/run_tests/build_package_node.sh
+++ b/tools/run_tests/build_package_node.sh
@@ -29,9 +29,9 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
source ~/.nvm/nvm.sh
-set -ex
nvm use 4
+set -ex
cd $(dirname $0)/../..
diff --git a/tools/run_tests/pre_build_node.sh b/tools/run_tests/pre_build_node.sh
index 11f46d60fc..1f55df0b7b 100755
--- a/tools/run_tests/pre_build_node.sh
+++ b/tools/run_tests/pre_build_node.sh
@@ -31,9 +31,9 @@
NODE_VERSION=$1
source ~/.nvm/nvm.sh
-set -ex
nvm use $NODE_VERSION
+set -ex
export GRPC_CONFIG=${CONFIG:-opt}
diff --git a/tools/run_tests/run_node.sh b/tools/run_tests/run_node.sh
index d33890068d..b94dc3ec62 100755
--- a/tools/run_tests/run_node.sh
+++ b/tools/run_tests/run_node.sh
@@ -30,9 +30,9 @@
NODE_VERSION=$1
source ~/.nvm/nvm.sh
-set -ex
nvm use $NODE_VERSION
+set -ex
CONFIG=${CONFIG:-opt}
diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py
index 6b84daea54..a9438045aa 100755
--- a/tools/run_tests/run_tests.py
+++ b/tools/run_tests/run_tests.py
@@ -120,12 +120,7 @@ def get_c_tests(travis, test_lang) :
def _check_compiler(compiler, supported_compilers):
if compiler not in supported_compilers:
- raise Exception('Compiler %s not supported (on this platform).' % compiler)
-
-
-def _check_arch(arch, supported_archs):
- if arch not in supported_archs:
- raise Exception('Architecture %s not supported.' % arch)
+ raise Exception('Compiler %s not supported.' % compiler)
def _is_use_docker_child():
@@ -469,19 +464,7 @@ class CSharpLanguage(object):
def configure(self, config, args):
self.config = config
self.args = args
- if self.platform == 'windows':
- # Explicitly choosing between x86 and x64 arch doesn't work yet
- _check_arch(self.args.arch, ['default'])
- self._make_options = [_windows_toolset_option(self.args.compiler),
- _windows_arch_option(self.args.arch)]
- else:
- _check_compiler(self.args.compiler, ['default'])
- if self.platform == 'mac':
- # On Mac, official distribution of mono is 32bit.
- self._make_options = ['EMBED_OPENSSL=true', 'EMBED_ZLIB=true',
- 'CFLAGS=-arch i386', 'LDFLAGS=-arch i386']
- else:
- self._make_options = ['EMBED_OPENSSL=true', 'EMBED_ZLIB=true']
+ _check_compiler(self.args.compiler, ['default'])
def test_specs(self):
with open('src/csharp/tests.json') as f:
@@ -528,16 +511,23 @@ class CSharpLanguage(object):
return [['tools/run_tests/pre_build_csharp.sh']]
def make_targets(self):
- return ['grpc_csharp_ext']
+ # For Windows, this target doesn't really build anything,
+ # everything is build by buildall script later.
+ if self.platform == 'windows':
+ return []
+ else:
+ return ['grpc_csharp_ext']
def make_options(self):
- return self._make_options;
+ if self.platform == 'mac':
+ # On Mac, official distribution of mono is 32bit.
+ return ['CFLAGS=-arch i386', 'LDFLAGS=-arch i386']
+ else:
+ return []
def build_steps(self):
if self.platform == 'windows':
- return [[_windows_build_bat(self.args.compiler),
- 'src/csharp/Grpc.sln',
- '/p:Configuration=%s' % _MSBUILD_CONFIG[self.config.build_config]]]
+ return [['src\\csharp\\buildall.bat']]
else:
return [['tools/run_tests/build_csharp.sh']]
diff --git a/vsprojects/build_vs2010.bat b/vsprojects/build_vs2010.bat
index 1bc3c86a92..64b0ed5d3f 100644
--- a/vsprojects/build_vs2010.bat
+++ b/vsprojects/build_vs2010.bat
@@ -1,5 +1,5 @@
@rem Convenience wrapper that runs specified gRPC target using msbuild
-@rem Usage: build_vs2010.bat TARGET_NAME
+@rem Usage: build.bat TARGET_NAME
setlocal
@rem Set VS variables (uses Visual Studio 2010)
diff --git a/vsprojects/build_vs2013.bat b/vsprojects/build_vs2013.bat
index 82c0a3ad82..be3caa9298 100644
--- a/vsprojects/build_vs2013.bat
+++ b/vsprojects/build_vs2013.bat
@@ -1,5 +1,5 @@
@rem Convenience wrapper that runs specified gRPC target using msbuild
-@rem Usage: build_vs2013.bat TARGET_NAME
+@rem Usage: build.bat TARGET_NAME
setlocal
@rem Set VS variables (uses Visual Studio 2013)
diff --git a/vsprojects/build_vs2015.bat b/vsprojects/build_vs2015.bat
index c6e1b433a3..50485a30f3 100644
--- a/vsprojects/build_vs2015.bat
+++ b/vsprojects/build_vs2015.bat
@@ -1,5 +1,5 @@
@rem Convenience wrapper that runs specified gRPC target using msbuild
-@rem Usage: build_vs2015.bat TARGET_NAME
+@rem Usage: build.bat TARGET_NAME
setlocal
@rem Set VS variables (uses Visual Studio 2015)