Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions bazel/envoy_build_system.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ def envoy_cc_test(
deps = [],
tags = [],
args = [],
copts = [],
shard_count = None,
coverage = True,
local = False,
Expand All @@ -463,10 +464,11 @@ def envoy_cc_test(
deps = deps,
repository = repository,
tags = test_lib_tags,
copts = copts,
)
native.cc_test(
name = name,
copts = envoy_copts(repository, test = True),
copts = envoy_copts(repository, test = True) + copts,
linkopts = envoy_test_linkopts(),
linkstatic = envoy_linkstatic(),
malloc = tcmalloc_external_dep(repository),
Expand Down Expand Up @@ -494,13 +496,14 @@ def envoy_cc_test_infrastructure_library(
deps = [],
repository = "",
tags = [],
include_prefix = None):
include_prefix = None,
copts = []):
native.cc_library(
name = name,
srcs = srcs,
hdrs = hdrs,
data = data,
copts = envoy_copts(repository, test = True),
copts = envoy_copts(repository, test = True) + copts,
testonly = 1,
deps = deps + [envoy_external_dep_path(dep) for dep in external_deps] + [
envoy_external_dep_path("googletest"),
Expand All @@ -523,7 +526,8 @@ def envoy_cc_test_library(
deps = [],
repository = "",
tags = [],
include_prefix = None):
include_prefix = None,
copts = []):
deps = deps + [
repository + "//test/test_common:printers_includes",
]
Expand All @@ -537,6 +541,7 @@ def envoy_cc_test_library(
repository,
tags,
include_prefix,
copts,
)

# Envoy test binaries should be specified with this function.
Expand Down
104 changes: 76 additions & 28 deletions bazel/external/quiche.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ licenses(["notice"]) # Apache 2
load(":genrule_cmd.bzl", "genrule_cmd")
load(
"@envoy//bazel:envoy_build_system.bzl",
"envoy_cc_library",
"envoy_cc_test",
"envoy_cc_test_library",
"envoy_select_quiche",
)

Expand All @@ -48,7 +50,9 @@ genrule(
visibility = ["//visibility:private"],
)

cc_library(
quiche_copt = ["-Wno-unused-parameter"]

envoy_cc_library(
name = "http2_platform",
hdrs = [
"quiche/http2/platform/api/http2_arraysize.h",
Expand All @@ -73,11 +77,12 @@ cc_library(
],
"@envoy",
),
repository = "@envoy",
visibility = ["//visibility:public"],
deps = ["@envoy//source/extensions/quic_listeners/quiche/platform:http2_platform_impl_lib"],
)

cc_library(
envoy_cc_library(
name = "spdy_platform",
hdrs = [
"quiche/spdy/platform/api/spdy_arraysize.h",
Expand All @@ -99,26 +104,29 @@ cc_library(
],
"@envoy",
),
repository = "@envoy",
visibility = ["//visibility:public"],
deps = ["@envoy//source/extensions/quic_listeners/quiche/platform:spdy_platform_impl_lib"],
)

cc_library(
envoy_cc_library(
name = "spdy_simple_arena_lib",
srcs = ["quiche/spdy/core/spdy_simple_arena.cc"],
hdrs = ["quiche/spdy/core/spdy_simple_arena.h"],
repository = "@envoy",
visibility = ["//visibility:public"],
deps = [":spdy_platform"],
)

cc_library(
envoy_cc_library(
name = "spdy_platform_unsafe_arena_lib",
hdrs = ["quiche/spdy/platform/api/spdy_unsafe_arena.h"],
repository = "@envoy",
visibility = ["//visibility:public"],
deps = ["@envoy//source/extensions/quic_listeners/quiche/platform:spdy_platform_unsafe_arena_impl_lib"],
)

cc_library(
envoy_cc_library(
name = "quic_platform",
srcs = ["quiche/quic/platform/api/quic_mutex.cc"] + envoy_select_quiche(
[
Expand All @@ -138,69 +146,65 @@ cc_library(
],
"@envoy",
),
repository = "@envoy",
visibility = ["//visibility:public"],
deps = [
":quic_platform_base",
"@envoy//source/extensions/quic_listeners/quiche/platform:quic_platform_impl_lib",
],
)

cc_library(
envoy_cc_test_library(
name = "quic_platform_expect_bug",
testonly = 1,
hdrs = ["quiche/quic/platform/api/quic_expect_bug.h"],
visibility = ["//visibility:public"],
repository = "@envoy",
deps = ["@envoy//test/extensions/quic_listeners/quiche/platform:quic_platform_expect_bug_impl_lib"],
)

cc_library(
envoy_cc_library(
name = "quic_platform_export",
hdrs = ["quiche/quic/platform/api/quic_export.h"],
repository = "@envoy",
visibility = ["//visibility:public"],
deps = ["@envoy//source/extensions/quic_listeners/quiche/platform:quic_platform_export_impl_lib"],
)

cc_library(
envoy_cc_test_library(
name = "quic_platform_mock_log",
testonly = 1,
hdrs = ["quiche/quic/platform/api/quic_mock_log.h"],
visibility = ["//visibility:public"],
repository = "@envoy",
deps = ["@envoy//test/extensions/quic_listeners/quiche/platform:quic_platform_mock_log_impl_lib"],
)

cc_library(
envoy_cc_test_library(
name = "quic_platform_port_utils",
testonly = 1,
hdrs = ["quiche/quic/platform/api/quic_port_utils.h"],
visibility = ["//visibility:public"],
repository = "@envoy",
deps = ["@envoy//test/extensions/quic_listeners/quiche/platform:quic_platform_port_utils_impl_lib"],
)

cc_library(
envoy_cc_test_library(
name = "quic_platform_test",
testonly = 1,
hdrs = ["quiche/quic/platform/api/quic_test.h"],
visibility = ["//visibility:public"],
repository = "@envoy",
deps = ["@envoy//test/extensions/quic_listeners/quiche/platform:quic_platform_test_impl_lib"],
)

cc_library(
envoy_cc_test_library(
name = "quic_platform_test_output",
testonly = 1,
hdrs = ["quiche/quic/platform/api/quic_test_output.h"],
visibility = ["//visibility:public"],
repository = "@envoy",
deps = ["@envoy//test/extensions/quic_listeners/quiche/platform:quic_platform_test_output_impl_lib"],
)

cc_library(
envoy_cc_test_library(
name = "quic_platform_thread",
testonly = 1,
hdrs = ["quiche/quic/platform/api/quic_thread.h"],
visibility = ["//visibility:public"],
repository = "@envoy",
deps = ["@envoy//test/extensions/quic_listeners/quiche/platform:quic_platform_thread_impl_lib"],
)

cc_library(
envoy_cc_library(
name = "quic_platform_base",
hdrs = [
"quiche/quic/platform/api/quic_aligned.h",
Expand Down Expand Up @@ -246,29 +250,32 @@ cc_library(
],
"@envoy",
),
repository = "@envoy",
visibility = ["//visibility:public"],
deps = [
":quic_platform_export",
"@envoy//source/extensions/quic_listeners/quiche/platform:quic_platform_base_impl_lib",
],
)

cc_library(
envoy_cc_library(
name = "quic_platform_sleep",
hdrs = ["quiche/quic/platform/api/quic_sleep.h"],
repository = "@envoy",
visibility = ["//visibility:public"],
deps = ["@envoy//source/extensions/quic_listeners/quiche/platform:quic_platform_sleep_impl_lib"],
)

cc_library(
envoy_cc_library(
name = "quic_time_lib",
srcs = ["quiche/quic/core/quic_time.cc"],
hdrs = ["quiche/quic/core/quic_time.h"],
repository = "@envoy",
visibility = ["//visibility:public"],
deps = [":quic_platform"],
)

cc_library(
envoy_cc_library(
name = "quic_buffer_allocator_lib",
srcs = [
"quiche/quic/core/quic_buffer_allocator.cc",
Expand All @@ -278,10 +285,51 @@ cc_library(
"quiche/quic/core/quic_buffer_allocator.h",
"quiche/quic/core/quic_simple_buffer_allocator.h",
],
repository = "@envoy",
visibility = ["//visibility:public"],
deps = [":quic_platform_export"],
)

envoy_cc_test_library(
name = "epoll_server_platform",
hdrs = [
"quiche/epoll_server/platform/api/epoll_address_test_utils.h",
"quiche/epoll_server/platform/api/epoll_bug.h",
"quiche/epoll_server/platform/api/epoll_expect_bug.h",
"quiche/epoll_server/platform/api/epoll_export.h",
"quiche/epoll_server/platform/api/epoll_logging.h",
"quiche/epoll_server/platform/api/epoll_ptr_util.h",
"quiche/epoll_server/platform/api/epoll_test.h",
"quiche/epoll_server/platform/api/epoll_thread.h",
"quiche/epoll_server/platform/api/epoll_time.h",
],
repository = "@envoy",
deps = ["@envoy//test/extensions/quic_listeners/quiche/platform:epoll_server_platform_impl_lib"],
)

envoy_cc_test_library(
name = "epoll_server_lib",
srcs = [
"quiche/epoll_server/fake_simple_epoll_server.cc",
"quiche/epoll_server/simple_epoll_server.cc",
],
hdrs = [
"quiche/epoll_server/fake_simple_epoll_server.h",
"quiche/epoll_server/simple_epoll_server.h",
],
copts = quiche_copt,
repository = "@envoy",
deps = [":epoll_server_platform"],
)

envoy_cc_test(
name = "epoll_server_test",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is also defined in test/extensions/quic_listeners/quiche/platform/BUILD, should we delete one of them?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, the one is //test/ is used for debugging. I removed that one instead.

srcs = ["quiche/epoll_server/simple_epoll_server_test.cc"],
copts = quiche_copt,
repository = "@envoy",
deps = [":epoll_server_lib"],
)

envoy_cc_test(
name = "http2_platform_api_test",
srcs = envoy_select_quiche(
Expand Down
3 changes: 3 additions & 0 deletions bazel/external/quiche.genrule_cmd
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ cat <<EOF >sed_commands
# Rewrite include directives for platform impl files.
/^#include/ s!net/(http2|spdy|quic)/platform/impl/!extensions/quic_listeners/quiche/platform/!

# Rewrite include directives for epoll_server platform impl files.
/^#include/ s!net/tools/epoll_server/platform/impl!test/extensions/quic_listeners/quiche/platform/!

# Strip "net/third_party" from include directives to other QUICHE files.
/^#include/ s!net/third_party/quiche/src/!quiche/!

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,24 @@
#define CHECK(condition) \
QUIC_LOG_IF_IMPL(FATAL, ABSL_PREDICT_FALSE(!(condition))) << "CHECK failed: " #condition "."

#define CHECK_GT(a, b) CHECK((a) > (b))
#define CHECK_GE(a, b) CHECK((a) >= (b))
#define CHECK_LT(a, b) CHECK((a) < (b))
#define CHECK_LE(a, b) CHECK((a) <= (b))
#define CHECK_NE(a, b) CHECK((a) != (b))
#define CHECK_EQ(a, b) CHECK((a) == (b))

#ifdef NDEBUG
// Release build
#define DCHECK(condition) QUIC_COMPILED_OUT_LOG()
#define QUIC_COMPILED_OUT_LOG() QUIC_LOG_IMPL_INTERNAL(false, quic::NullLogStream().stream())
#define QUIC_DVLOG_IMPL(verbosity) QUIC_COMPILED_OUT_LOG()
#define QUIC_DVLOG_IF_IMPL(verbosity, condition) QUIC_COMPILED_OUT_LOG()
#define QUIC_DLOG_IMPL(severity) QUIC_COMPILED_OUT_LOG()
#define QUIC_DLOG_IF_IMPL(severity, condition) QUIC_COMPILED_OUT_LOG()
#define DCHECK(condition) QUIC_COMPILED_OUT_LOG(condition)
#define QUIC_COMPILED_OUT_LOG(condition) \
QUIC_LOG_IMPL_INTERNAL(false && (condition), quic::NullLogStream().stream())
#define QUIC_DVLOG_IMPL(verbosity) QUIC_COMPILED_OUT_LOG(false)
#define QUIC_DVLOG_IF_IMPL(verbosity, condition) QUIC_COMPILED_OUT_LOG(condition)
#define QUIC_DLOG_IMPL(severity) QUIC_COMPILED_OUT_LOG(false)
#define QUIC_DLOG_IF_IMPL(severity, condition) QUIC_COMPILED_OUT_LOG(condition)
#define QUIC_DLOG_INFO_IS_ON_IMPL() 0
#define QUIC_DLOG_EVERY_N_IMPL(severity, n) QUIC_COMPILED_OUT_LOG()
#define QUIC_DLOG_EVERY_N_IMPL(severity, n) QUIC_COMPILED_OUT_LOG(false)
#define QUIC_NOTREACHED_IMPL()
#else
// Debug build
Expand All @@ -83,6 +91,11 @@
#endif

#define DCHECK_GE(a, b) DCHECK((a) >= (b))
#define DCHECK_GT(a, b) DCHECK((a) > (b))
#define DCHECK_LT(a, b) DCHECK((a) < (b))
#define DCHECK_LE(a, b) DCHECK((a) <= (b))
#define DCHECK_NE(a, b) DCHECK((a) != (b))
#define DCHECK_EQ(a, b) DCHECK((a) == (b))

#define QUIC_PREDICT_FALSE_IMPL(x) ABSL_PREDICT_FALSE(x)

Expand Down
23 changes: 23 additions & 0 deletions test/extensions/quic_listeners/quiche/platform/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,29 @@ envoy_cc_test_library(
deps = ["//source/common/common:assert_lib"],
)

envoy_cc_test_library(
name = "epoll_server_platform_impl_lib",
hdrs = [
"epoll_address_test_utils_impl.h",
"epoll_bug_impl.h",
"epoll_expect_bug_impl.h",
"epoll_export_impl.h",
"epoll_logging_impl.h",
"epoll_ptr_util_impl.h",
"epoll_test_impl.h",
"epoll_thread_impl.h",
"epoll_time_impl.h",
],
external_deps = ["abseil_time"],
deps = [
":quic_platform_expect_bug_impl_lib",
":quic_platform_thread_impl_lib",
"//include/envoy/network:address_interface",
"//source/extensions/quic_listeners/quiche/platform:quic_platform_base_impl_lib",
"//test/test_common:environment_lib",
],
)

envoy_cc_test_library(
name = "quic_platform_test_output_impl_lib",
srcs = ["quic_test_output_impl.cc"],
Expand Down
Loading