Use select to decide the test is hermetic or not

pull/13442/head
Adele Zhou 7 years ago
parent c8bf2da1e0
commit e5df91f477
  1. 5
      BUILD
  2. 10
      bazel/grpc_build_system.bzl
  3. 3
      test/core/util/BUILD
  4. 4
      test/core/util/port_hermetic.cc
  5. 1
      tools/internal_ci/linux/grpc_bazel_on_foundry.sh

@ -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"

@ -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,

@ -74,9 +74,6 @@ grpc_cc_library(
"tracer_util.h",
"trickle_endpoint.h",
],
defines = [
"GRPC_HERMETIC_TESTS=1",
],
language = "C++",
deps = [
":gpr_test_util",

@ -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)

@ -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/...

Loading…
Cancel
Save