aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Adele Zhou <adelez@google.com>2017-11-29 14:37:18 -0800
committerGravatar Adele Zhou <adelez@google.com>2017-11-30 17:10:28 -0800
commite5df91f477a27ce71a39bca928677b2f08649615 (patch)
treee07c0034feae455bcac7fff11dabdcc0304a3bf0
parentc8bf2da1e0f36fe3a6f271140153fad8e9df8dbd (diff)
Use select to decide the test is hermetic or not
-rw-r--r--BUILD5
-rw-r--r--bazel/grpc_build_system.bzl10
-rw-r--r--test/core/util/BUILD3
-rw-r--r--test/core/util/port_hermetic.cc4
-rw-r--r--tools/internal_ci/linux/grpc_bazel_on_foundry.sh1
5 files changed, 15 insertions, 8 deletions
diff --git a/BUILD b/BUILD
index 30b410a2bd..d997dc253c 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_HERMETIC_TESTS=1"},
+)
+
# This should be updated along with build.yaml
g_stands_for = "generous"
diff --git a/bazel/grpc_build_system.bzl b/bazel/grpc_build_system.bzl
index 591fdb5936..a6da377248 100644
--- a/bazel/grpc_build_system.bzl
+++ b/bazel/grpc_build_system.bzl
@@ -26,17 +26,17 @@
def grpc_cc_library(name, srcs = [], public_hdrs = [], hdrs = [],
external_deps = [], deps = [], standalone = False,
language = "C++", testonly = False, visibility = None,
- alwayslink = 0, defines = []):
+ alwayslink = 0):
copts = []
if language.upper() == "C":
copts = ["-std=c99"]
native.cc_library(
name = name,
srcs = srcs,
- defines = select({
- "//:grpc_no_ares": ["GRPC_ARES=0"],
- "//conditions:default": defines,
- }),
+ defines = select({"//:grpc_no_ares": ["GRPC_ARES=0"],
+ "//conditions:default": [],}) +
+ select({"//:remote_execution": ["GRPC_HERMETIC_TESTS=1"],
+ "//conditions:default": [],}),
hdrs = hdrs + public_hdrs,
deps = deps + ["//external:" + dep for dep in external_deps],
copts = copts,
diff --git a/test/core/util/BUILD b/test/core/util/BUILD
index 9884e04627..f92c0ff548 100644
--- a/test/core/util/BUILD
+++ b/test/core/util/BUILD
@@ -74,9 +74,6 @@ grpc_cc_library(
"tracer_util.h",
"trickle_endpoint.h",
],
- defines = [
- "GRPC_HERMETIC_TESTS=1",
- ],
language = "C++",
deps = [
":gpr_test_util",
diff --git a/test/core/util/port_hermetic.cc b/test/core/util/port_hermetic.cc
index 3650816763..b4d097f650 100644
--- a/test/core/util/port_hermetic.cc
+++ b/test/core/util/port_hermetic.cc
@@ -16,6 +16,10 @@
*
*/
+/* When running tests hermeticly, i.e. running 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_HERMETIC_TESTS)
diff --git a/tools/internal_ci/linux/grpc_bazel_on_foundry.sh b/tools/internal_ci/linux/grpc_bazel_on_foundry.sh
index c45d43a386..dc6df47ac8 100644
--- a/tools/internal_ci/linux/grpc_bazel_on_foundry.sh
+++ b/tools/internal_ci/linux/grpc_bazel_on_foundry.sh
@@ -48,4 +48,5 @@ source tools/internal_ci/helper_scripts/prepare_build_linux_rc
--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_HERMETIC_TESTS=1 \
-- //test/...