diff --git a/bazel/envoy_build_system.bzl b/bazel/envoy_build_system.bzl index 437b12c086a2..ed64bdada2bf 100644 --- a/bazel/envoy_build_system.bzl +++ b/bazel/envoy_build_system.bzl @@ -416,9 +416,9 @@ def envoy_cc_test( shard_count = shard_count, ) -# Envoy C++ test related libraries (that want gtest, gmock) should be specified -# with this function. -def envoy_cc_test_library( +# Envoy C++ related test infrastructure (that want gtest, gmock, but may be +# relied on by envoy_cc_test_library) should use this function. +def envoy_cc_test_infrastructure_library( name, srcs = [], hdrs = [], @@ -436,14 +436,38 @@ def envoy_cc_test_library( testonly = 1, deps = deps + [envoy_external_dep_path(dep) for dep in external_deps] + [ envoy_external_dep_path("googletest"), - repository + "//test/test_common:printers_includes", - repository + "//test/test_common:test_base", ], tags = tags, alwayslink = 1, linkstatic = 1, ) +# Envoy C++ test related libraries (that want gtest, gmock) should be specified +# with this function. +def envoy_cc_test_library( + name, + srcs = [], + hdrs = [], + data = [], + external_deps = [], + deps = [], + repository = "", + tags = []): + deps = deps + [ + repository + "//test/test_common:printers_includes", + repository + "//test/test_common:test_base", + ] + envoy_cc_test_infrastructure_library( + name, + srcs, + hdrs, + data, + external_deps, + deps, + repository, + tags, + ) + # Envoy test binaries should be specified with this function. def envoy_cc_test_binary( name, diff --git a/test/test_common/BUILD b/test/test_common/BUILD index b314e54f0c13..7e16e76c0d01 100644 --- a/test/test_common/BUILD +++ b/test/test_common/BUILD @@ -5,6 +5,7 @@ load( "envoy_basic_cc_library", "envoy_cc_library", "envoy_cc_test", + "envoy_cc_test_infrastructure_library", "envoy_cc_test_library", "envoy_package", ) @@ -156,12 +157,11 @@ envoy_cc_test( ], ) -envoy_cc_library( +envoy_cc_test_infrastructure_library( name = "test_base", srcs = ["test_base.cc"], hdrs = ["test_base.h"], deps = [ - "//external:googletest", "//test/test_common:global_lib", ], )