aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--BUILD5
-rw-r--r--CMakeLists.txt2
-rw-r--r--Makefile2
-rw-r--r--WORKSPACE10
-rw-r--r--bazel/grpc_build_system.bzl47
-rw-r--r--build.yaml1
-rw-r--r--doc/service_config.md2
-rw-r--r--grpc.gyp2
-rw-r--r--src/core/ext/filters/client_channel/client_channel.cc2
-rw-r--r--src/core/ext/transport/chttp2/transport/chttp2_transport.cc1
-rw-r--r--src/core/ext/transport/chttp2/transport/writing.cc8
-rw-r--r--test/core/surface/concurrent_connectivity_test.cc10
-rw-r--r--test/core/util/BUILD6
-rw-r--r--test/core/util/port_isolated_runtime_environment.cc42
-rwxr-xr-xtest/core/util/run_with_poller.sh19
-rw-r--r--test/core/util/test_config.h2
-rw-r--r--third_party/zlib.BUILD2
-rw-r--r--tools/internal_ci/linux/grpc_bazel_on_foundry.sh55
-rw-r--r--tools/interop_matrix/client_matrix.py17
-rw-r--r--tools/run_tests/generated/sources_and_headers.json1
20 files changed, 195 insertions, 41 deletions
diff --git a/BUILD b/BUILD
index 82ac73f014..13843195ea 100644
--- a/BUILD
+++ b/BUILD
@@ -38,6 +38,11 @@ config_setting(
values = {"define": "grpc_no_ares=true"},
)
+config_setting(
+ name = "remote_execution",
+ values = {"define": "GRPC_PORT_ISOLATED_RUNTIME=1"},
+)
+
# This should be updated along with build.yaml
g_stands_for = "generous"
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cf2b3cc82f..297301bb39 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1622,6 +1622,7 @@ add_library(grpc_test_util
test/core/util/parse_hexstring.cc
test/core/util/passthru_endpoint.cc
test/core/util/port.cc
+ test/core/util/port_isolated_runtime_environment.cc
test/core/util/port_server_client.cc
test/core/util/slice_splitter.cc
test/core/util/tracer_util.cc
@@ -1891,6 +1892,7 @@ add_library(grpc_test_util_unsecure
test/core/util/parse_hexstring.cc
test/core/util/passthru_endpoint.cc
test/core/util/port.cc
+ test/core/util/port_isolated_runtime_environment.cc
test/core/util/port_server_client.cc
test/core/util/slice_splitter.cc
test/core/util/tracer_util.cc
diff --git a/Makefile b/Makefile
index bd83244a61..0e52d5a325 100644
--- a/Makefile
+++ b/Makefile
@@ -3627,6 +3627,7 @@ LIBGRPC_TEST_UTIL_SRC = \
test/core/util/parse_hexstring.cc \
test/core/util/passthru_endpoint.cc \
test/core/util/port.cc \
+ test/core/util/port_isolated_runtime_environment.cc \
test/core/util/port_server_client.cc \
test/core/util/slice_splitter.cc \
test/core/util/tracer_util.cc \
@@ -3887,6 +3888,7 @@ LIBGRPC_TEST_UTIL_UNSECURE_SRC = \
test/core/util/parse_hexstring.cc \
test/core/util/passthru_endpoint.cc \
test/core/util/port.cc \
+ test/core/util/port_isolated_runtime_environment.cc \
test/core/util/port_server_client.cc \
test/core/util/slice_splitter.cc \
test/core/util/tracer_util.cc \
diff --git a/WORKSPACE b/WORKSPACE
index cead0bc877..bf09aa7cc9 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -115,3 +115,13 @@ http_archive(
strip_prefix = "abseil-cpp-cc4bed2d74f7c8717e31f9579214ab52a9c9c610",
url = "https://github.com/abseil/abseil-cpp/archive/cc4bed2d74f7c8717e31f9579214ab52a9c9c610.tar.gz",
)
+
+http_archive(
+ name = "bazel_toolchains",
+ urls = [
+ "https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/af4681c3d19f063f090222ec3d04108c4e0ca255.tar.gz",
+ "https://github.com/bazelbuild/bazel-toolchains/archive/af4681c3d19f063f090222ec3d04108c4e0ca255.tar.gz",
+ ],
+ strip_prefix = "bazel-toolchains-af4681c3d19f063f090222ec3d04108c4e0ca255",
+ sha256 = "d58bb2d6c8603f600d522b6104d6192a65339aa26cbba9f11ff5c4b36dedb928",
+)
diff --git a/bazel/grpc_build_system.bzl b/bazel/grpc_build_system.bzl
index b35ca73745..2ef8544502 100644
--- a/bazel/grpc_build_system.bzl
+++ b/bazel/grpc_build_system.bzl
@@ -23,6 +23,9 @@
# each change must be ported from one to the other.
#
+# The set of pollers to test against if a test exercises polling
+POLLERS = ['epollex', 'epollsig', 'epoll1', 'poll', 'poll-cv']
+
def grpc_cc_library(name, srcs = [], public_hdrs = [], hdrs = [],
external_deps = [], deps = [], standalone = False,
language = "C++", testonly = False, visibility = None,
@@ -33,10 +36,10 @@ def grpc_cc_library(name, srcs = [], public_hdrs = [], hdrs = [],
native.cc_library(
name = name,
srcs = srcs,
- defines = select({
- "//:grpc_no_ares": ["GRPC_ARES=0"],
- "//conditions:default": [],
- }),
+ defines = select({"//:grpc_no_ares": ["GRPC_ARES=0"],
+ "//conditions:default": [],}) +
+ select({"//:remote_execution": ["GRPC_PORT_ISOLATED_RUNTIME=1"],
+ "//conditions:default": [],}),
hdrs = hdrs + public_hdrs,
deps = deps + ["//external:" + dep for dep in external_deps],
copts = copts,
@@ -70,19 +73,35 @@ def grpc_proto_library(name, srcs = [], deps = [], well_known_protos = False,
generate_mock = generate_mock,
)
-def grpc_cc_test(name, srcs = [], deps = [], external_deps = [], args = [], data = [], language = "C++"):
+def grpc_cc_test(name, srcs = [], deps = [], external_deps = [], args = [], data = [], uses_polling = True, language = "C++"):
copts = []
if language.upper() == "C":
copts = ["-std=c99"]
- native.cc_test(
- name = name,
- srcs = srcs,
- args = args,
- data = data,
- deps = deps + ["//external:" + dep for dep in external_deps],
- copts = copts,
- linkopts = ["-pthread"],
- )
+ args = {
+ 'name': name,
+ 'srcs': srcs,
+ 'args': args,
+ 'data': data,
+ 'deps': deps + ["//external:" + dep for dep in external_deps],
+ 'copts': copts,
+ 'linkopts': ["-pthread"],
+ }
+ if uses_polling:
+ native.cc_binary(testonly=True, **args)
+ for poller in POLLERS:
+ native.sh_test(
+ name = name + '@poller=' + poller,
+ data = [name],
+ srcs = [
+ '//test/core/util:run_with_poller_sh',
+ ],
+ args = [
+ poller,
+ '$(location %s)' % name
+ ],
+ )
+ else:
+ native.cc_test(**args)
def grpc_cc_binary(name, srcs = [], deps = [], external_deps = [], args = [], data = [], language = "C++", testonly = False, linkshared = False, linkopts = []):
copts = []
diff --git a/build.yaml b/build.yaml
index 40c37dc53f..854a695acc 100644
--- a/build.yaml
+++ b/build.yaml
@@ -736,6 +736,7 @@ filegroups:
- test/core/util/parse_hexstring.cc
- test/core/util/passthru_endpoint.cc
- test/core/util/port.cc
+ - test/core/util/port_isolated_runtime_environment.cc
- test/core/util/port_server_client.cc
- test/core/util/slice_splitter.cc
- test/core/util/tracer_util.cc
diff --git a/doc/service_config.md b/doc/service_config.md
index 0abbd7f324..dd1cbc5630 100644
--- a/doc/service_config.md
+++ b/doc/service_config.md
@@ -12,7 +12,7 @@ The service config is a JSON string of the following form:
```
{
- // Load balancing policy name.
+ // Load balancing policy name (case insensitive).
// Currently, the only selectable client-side policy provided with gRPC
// is 'round_robin', but third parties may add their own policies.
// This field is optional; if unset, the default behavior is to pick
diff --git a/grpc.gyp b/grpc.gyp
index 4ceb480282..c34206b1a5 100644
--- a/grpc.gyp
+++ b/grpc.gyp
@@ -511,6 +511,7 @@
'test/core/util/parse_hexstring.cc',
'test/core/util/passthru_endpoint.cc',
'test/core/util/port.cc',
+ 'test/core/util/port_isolated_runtime_environment.cc',
'test/core/util/port_server_client.cc',
'test/core/util/slice_splitter.cc',
'test/core/util/tracer_util.cc',
@@ -722,6 +723,7 @@
'test/core/util/parse_hexstring.cc',
'test/core/util/passthru_endpoint.cc',
'test/core/util/port.cc',
+ 'test/core/util/port_isolated_runtime_environment.cc',
'test/core/util/port_server_client.cc',
'test/core/util/slice_splitter.cc',
'test/core/util/tracer_util.cc',
diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc
index 03c1b6f4bd..58496dc246 100644
--- a/src/core/ext/filters/client_channel/client_channel.cc
+++ b/src/core/ext/filters/client_channel/client_channel.cc
@@ -432,7 +432,7 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx* exec_ctx,
// once at any given time.
lb_policy_name_changed =
chand->info_lb_policy_name == nullptr ||
- strcmp(chand->info_lb_policy_name, lb_policy_name) != 0;
+ gpr_stricmp(chand->info_lb_policy_name, lb_policy_name) != 0;
if (chand->lb_policy != nullptr && !lb_policy_name_changed) {
// Continue using the same LB policy. Update with new addresses.
lb_policy_updated = true;
diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc
index 01a16955d9..5a7830b0c0 100644
--- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc
+++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc
@@ -549,6 +549,7 @@ static void init_transport(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
/* No pings allowed before receiving a header or data frame. */
t->ping_state.pings_before_data_required = 0;
t->ping_state.is_delayed_ping_timer_set = false;
+ t->ping_state.last_ping_sent_time = GRPC_MILLIS_INF_PAST;
t->ping_recv_state.last_ping_recv_time = GRPC_MILLIS_INF_PAST;
t->ping_recv_state.ping_strikes = 0;
diff --git a/src/core/ext/transport/chttp2/transport/writing.cc b/src/core/ext/transport/chttp2/transport/writing.cc
index 15869b8880..204b5a7708 100644
--- a/src/core/ext/transport/chttp2/transport/writing.cc
+++ b/src/core/ext/transport/chttp2/transport/writing.cc
@@ -81,8 +81,11 @@ static void maybe_initiate_ping(grpc_exec_ctx* exec_ctx,
/* not enough elapsed time between successive pings */
if (grpc_http_trace.enabled() || grpc_bdp_estimator_trace.enabled()) {
gpr_log(GPR_DEBUG,
- "%s: Ping delayed [%p]: not enough time elapsed since last ping",
- t->is_client ? "CLIENT" : "SERVER", t->peer_string);
+ "%s: Ping delayed [%p]: not enough time elapsed since last ping. "
+ " Last ping %f: Next ping %f: Now %f",
+ t->is_client ? "CLIENT" : "SERVER", t->peer_string,
+ (double)t->ping_state.last_ping_sent_time,
+ (double)next_allowed_ping, (double)now);
}
if (!t->ping_state.is_delayed_ping_timer_set) {
t->ping_state.is_delayed_ping_timer_set = true;
@@ -91,6 +94,7 @@ static void maybe_initiate_ping(grpc_exec_ctx* exec_ctx,
}
return;
}
+
pq->inflight_id = t->ping_ctr;
t->ping_ctr++;
GRPC_CLOSURE_LIST_SCHED(exec_ctx, &pq->lists[GRPC_CHTTP2_PCL_INITIATE]);
diff --git a/test/core/surface/concurrent_connectivity_test.cc b/test/core/surface/concurrent_connectivity_test.cc
index 8fa15ab331..c7611b0dd1 100644
--- a/test/core/surface/concurrent_connectivity_test.cc
+++ b/test/core/surface/concurrent_connectivity_test.cc
@@ -49,10 +49,11 @@
#define NUM_OUTER_LOOPS_SHORT_TIMEOUTS 10
#define NUM_INNER_LOOPS_SHORT_TIMEOUTS 100
#define DELAY_MILLIS_SHORT_TIMEOUTS 1
-// in a successful test run, POLL_MILLIS should never be reached beause all runs
-// should
-// end after the shorter delay_millis
+// in a successful test run, POLL_MILLIS should never be reached because all
+// runs should end after the shorter delay_millis
#define POLL_MILLIS_SHORT_TIMEOUTS 30000
+// it should never take longer that this to shutdown the server
+#define SERVER_SHUTDOWN_TIMEOUT 30000
static void* tag(int n) { return (void*)(uintptr_t)n; }
static int detag(void* p) { return (int)(uintptr_t)p; }
@@ -95,7 +96,8 @@ struct server_thread_args {
void server_thread(void* vargs) {
struct server_thread_args* args = (struct server_thread_args*)vargs;
grpc_event ev;
- gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC);
+ gpr_timespec deadline =
+ grpc_timeout_milliseconds_to_deadline(SERVER_SHUTDOWN_TIMEOUT);
ev = grpc_completion_queue_next(args->cq, deadline, nullptr);
GPR_ASSERT(ev.type == GRPC_OP_COMPLETE);
GPR_ASSERT(detag(ev.tag) == 0xd1e);
diff --git a/test/core/util/BUILD b/test/core/util/BUILD
index 268547f6c9..2237cfc173 100644
--- a/test/core/util/BUILD
+++ b/test/core/util/BUILD
@@ -57,6 +57,7 @@ grpc_cc_library(
"parse_hexstring.cc",
"passthru_endpoint.cc",
"port.cc",
+ "port_isolated_runtime_environment.cc",
"port_server_client.cc",
"reconnect_server.cc",
"slice_splitter.cc",
@@ -136,3 +137,8 @@ sh_library(
name = "fuzzer_one_entry_runner",
srcs = ["fuzzer_one_entry_runner.sh"],
)
+
+sh_library(
+ name = "run_with_poller_sh",
+ srcs = ["run_with_poller.sh"],
+)
diff --git a/test/core/util/port_isolated_runtime_environment.cc b/test/core/util/port_isolated_runtime_environment.cc
new file mode 100644
index 0000000000..5f0585e9fb
--- /dev/null
+++ b/test/core/util/port_isolated_runtime_environment.cc
@@ -0,0 +1,42 @@
+/*
+ *
+ * Copyright 2017 gRPC authors.
+ *
+ * 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.
+ *
+ */
+
+/* When running tests on remote machines, the framework takes a round-robin pick
+ * of a port within certain range. There is no need to recycle ports.
+ */
+#include "src/core/lib/iomgr/port.h"
+#include "test/core/util/test_config.h"
+#if defined(GRPC_PORT_ISOLATED_RUNTIME)
+
+#include "test/core/util/port.h"
+
+#define LOWER_PORT 49152
+static int s_allocated_port = LOWER_PORT;
+
+int grpc_pick_unused_port_or_die(void) {
+ int allocated_port = s_allocated_port++;
+ if (s_allocated_port == 65536) {
+ s_allocated_port = LOWER_PORT;
+ }
+
+ return allocated_port;
+}
+
+void grpc_recycle_unused_port(int port) { (void)port; }
+
+#endif /* GRPC_PORT_ISOLATED_RUNTIME */
diff --git a/test/core/util/run_with_poller.sh b/test/core/util/run_with_poller.sh
new file mode 100755
index 0000000000..05791457a2
--- /dev/null
+++ b/test/core/util/run_with_poller.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+# Copyright 2017 gRPC authors.
+#
+# 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.
+
+set -ex
+export GRPC_POLL_STRATEGY=$1
+shift
+$@
diff --git a/test/core/util/test_config.h b/test/core/util/test_config.h
index 775ffac949..5b3d34799e 100644
--- a/test/core/util/test_config.h
+++ b/test/core/util/test_config.h
@@ -33,7 +33,7 @@ gpr_timespec grpc_timeout_seconds_to_deadline(int64_t time_s);
/* Converts a given timeout (in milliseconds) to a deadline. */
gpr_timespec grpc_timeout_milliseconds_to_deadline(int64_t time_ms);
-#ifndef GRPC_TEST_CUSTOM_PICK_PORT
+#if !defined(GRPC_TEST_CUSTOM_PICK_PORT) && !defined(GRPC_PORT_ISOLATED_RUNTIME)
#define GRPC_TEST_PICK_PORT
#endif
diff --git a/third_party/zlib.BUILD b/third_party/zlib.BUILD
index 7879a81c68..a71c85fa98 100644
--- a/third_party/zlib.BUILD
+++ b/third_party/zlib.BUILD
@@ -27,7 +27,7 @@ cc_library(
"zutil.h",
],
includes = [
- "include",
+ ".",
],
linkstatic = 1,
visibility = [
diff --git a/tools/internal_ci/linux/grpc_bazel_on_foundry.sh b/tools/internal_ci/linux/grpc_bazel_on_foundry.sh
new file mode 100644
index 0000000000..e328be8aab
--- /dev/null
+++ b/tools/internal_ci/linux/grpc_bazel_on_foundry.sh
@@ -0,0 +1,55 @@
+#!/usr/bin/env bash
+# Copyright 2017 gRPC authors.
+#
+# 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.
+
+set -ex
+
+# A temporary solution to give Kokoro credentials.
+# The file name 4321_grpc-testing-service needs to match auth_credential in
+# the build config.
+mkdir -p ${KOKORO_KEYSTORE_DIR}
+cp ${KOKORO_GFILE_DIR}/GrpcTesting-d0eeee2db331.json ${KOKORO_KEYSTORE_DIR}/4321_grpc-testing-service
+
+mkdir -p /tmpfs/tmp/bazel-canary
+ln -f "${KOKORO_GFILE_DIR}/bazel-canary" /tmpfs/tmp/bazel-canary/bazel
+chmod 755 "${KOKORO_GFILE_DIR}/bazel-canary"
+export PATH="/tmpfs/tmp/bazel-canary:${PATH}"
+# This should show /tmpfs/tmp/bazel-canary/bazel
+which bazel
+chmod +x "${KOKORO_GFILE_DIR}/bazel_wrapper.py"
+
+# change to grpc repo root
+cd $(dirname $0)/../../..
+
+source tools/internal_ci/helper_scripts/prepare_build_linux_rc
+
+"${KOKORO_GFILE_DIR}/bazel_wrapper.py" \
+ --host_jvm_args=-Dbazel.DigestFunction=SHA1 \
+ test --jobs="50" \
+ --test_timeout="300,450,1200,3600" \
+ --test_output=errors \
+ --verbose_failures=true \
+ --keep_going \
+ --remote_accept_cached=true \
+ --spawn_strategy=remote \
+ --remote_local_fallback=false \
+ --remote_timeout=3600 \
+ --strategy=Javac=remote \
+ --strategy=Closure=remote \
+ --genrule_strategy=remote \
+ --experimental_strict_action_env=true \
+ --experimental_remote_platform_override='properties:{name:"container-image" value:"docker://gcr.io/asci-toolchain/nosla-debian8-clang-fl@sha256:aa20628a902f06a11a015caa94b0432eb60690de2d2525bd046b9eea046f5d8a" }' \
+ --crosstool_top=@bazel_toolchains//configs/debian8_clang/0.2.0/bazel_0.7.0:toolchain \
+ --define GRPC_PORT_ISOLATED_RUNTIME=1 \
+ -- //test/...
diff --git a/tools/interop_matrix/client_matrix.py b/tools/interop_matrix/client_matrix.py
index ee24ae7b28..c9a4996029 100644
--- a/tools/interop_matrix/client_matrix.py
+++ b/tools/interop_matrix/client_matrix.py
@@ -78,23 +78,6 @@ LANG_RELEASE_MATRIX = {
'v1.3.9',
'v1.4.2',
'v1.6.6',
- ],
- 'python': [
- 'v1.0.x',
- 'v1.1.4',
- 'v1.2.5',
- 'v1.3.9',
- 'v1.4.2',
- 'v1.6.6',
- 'v1.7.2',
- ],
- 'python': [
- 'v1.0.x',
- 'v1.1.4',
- 'v1.2.5',
- 'v1.3.9',
- 'v1.4.2',
- 'v1.6.6',
'v1.7.2',
],
'node': [
diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json
index a0ea4238e1..ae7ddb2475 100644
--- a/tools/run_tests/generated/sources_and_headers.json
+++ b/tools/run_tests/generated/sources_and_headers.json
@@ -8966,6 +8966,7 @@
"test/core/util/passthru_endpoint.h",
"test/core/util/port.cc",
"test/core/util/port.h",
+ "test/core/util/port_isolated_runtime_environment.cc",
"test/core/util/port_server_client.cc",
"test/core/util/port_server_client.h",
"test/core/util/slice_splitter.cc",