quiche: add epoll_server for testing#6650
Conversation
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
|
/assign @wu-bin |
| ) | ||
|
|
||
| envoy_cc_test( | ||
| name = "epoll_server_test", |
There was a problem hiding this comment.
This test is also defined in test/extensions/quic_listeners/quiche/platform/BUILD, should we delete one of them?
There was a problem hiding this comment.
Sorry, the one is //test/ is used for debugging. I removed that one instead.
bazel/external/quiche.BUILD
Outdated
| "quiche/epoll_server/fake_simple_epoll_server.h", | ||
| "quiche/epoll_server/simple_epoll_server.h", | ||
| ], | ||
| copts = envoy_copts("@envoy") + ["-Wno-error=unused-parameter"], |
There was a problem hiding this comment.
Instead of ignoring it, can we fix the unused-parameter warning in epoll_server code? We don't need to change envoy_build_system.bzl that way.
There was a problem hiding this comment.
QUICHE allows unused-parameter, so I think we will run into this warning in quic and h2 code as well. That's why I modify envoy_build_system.bzl. Suppressing this warning in Envoy seems more reasonable than adding this enforcement in QUICHE.
There was a problem hiding this comment.
SGTM, please move "-Wno-error=unused-parameter" into a global list and use it in here and epoll_server_test.
There was a problem hiding this comment.
In case you missed it, this comment still needs to be resolved. @danzh2010
There was a problem hiding this comment.
Where to put the global list? envoy_build_system.bzl?
There was a problem hiding this comment.
In this file(bazel/external/quiche.BUILD), since it's only needed by quiche build rules.
There was a problem hiding this comment.
done, and change it to -Wno-unused-parameter to suppress the warning entirely. Otherwise there will be too many warning output.
|
|
||
| int addressFamilyUnderTestHelper() { | ||
| std::vector<Envoy::Network::Address::IpVersion> versions = | ||
| Envoy::TestEnvironment::getIpVersionsForTest(); |
There was a problem hiding this comment.
How about using std::find for clarity?
if (std::find(versions.begin(), versions.end(), Envoy::Network::Address::IpVersion::v4) {
return AF_INET;
}
if (std::find(versions.begin(), versions.end(), Envoy::Network::Address::IpVersion::v6) {
return AF_INET6;
}
return -1;
There was a problem hiding this comment.
hmm, my code in comment doesn't actually work, it should be
if (std::find(versions.begin(), versions.end(), Envoy::Network::Address::IpVersion::v4) != versions.end()) {
return AF_INET;
}
// Same for v6
| } // namespace | ||
|
|
||
| int AddressFamilyUnderTestImpl() { | ||
| static const int* version = new int(addressFamilyUnderTestHelper()); |
There was a problem hiding this comment.
nit: no need to call new since int is trivial to destruct, just do:
static const int version = addressFamilyUnderTestHelper();
return version;
| #define EPOLL_PLOG_IMPL(severity) QUIC_PLOG_IMPL(severity) | ||
|
|
||
| #ifndef NDEBUG | ||
| #define EPOLL_DVLOG_IMPL(verbosity) QUIC_VLOG_IMPL(verbosity) |
There was a problem hiding this comment.
Why not
#define EPOLL_DVLOG_IMPL(verbosity) QUIC_DVLOG_IMPL(verbosity)
?
There was a problem hiding this comment.
good point. done!
|
|
||
| namespace epoll_server { | ||
|
|
||
| template <typename T, typename... Args> std::unique_ptr<T> EpollMakeUniqueImpl(Args&&... args) { |
There was a problem hiding this comment.
nit:
template <typename T, typename... Args>
using EpollMakeUniqueImpl = std::make_unique<T, Args...>;
There was a problem hiding this comment.
alias doesn't work with function template.
There was a problem hiding this comment.
Sorry about the wrong suggestion, and thanks for trying:)
| #include "gmock/gmock.h" | ||
| #include "gtest/gtest.h" | ||
|
|
||
| #define EpollTestImpl ::testing::Test |
There was a problem hiding this comment.
nit: prefer type alias to macro:
namespace epoll_server {
using EpollTestImpl = ::testing::Test;
} // namespace epoll_server
| #ifdef NDEBUG | ||
| // Release build | ||
| #define DCHECK(condition) QUIC_COMPILED_OUT_LOG() | ||
| #define DCHECK(condition) \ |
There was a problem hiding this comment.
I'm curious, what is the problem without this change?
There was a problem hiding this comment.
if we have:
{
bool a = true;
DCHECK(a)
}
In release build, w/o this change a is not used. We can supress unused-variable too. But that seems to be over-kill as QUICHE also forbids unused-variable.
There was a problem hiding this comment.
Got it. There are other macros defined to "QUIC_COMPILED_OUT_LOG" as well, maybe change "QUIC_COMPILED_OUT_LOG" to take a "condition" instead?
#define QUIC_COMPILED_OUT_LOG(condition) QUIC_LOG_IMPL_INTERNAL(false && (condition), quic::NullLogStream().stream())
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
| #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()) |
There was a problem hiding this comment.
Please add parentheses around "condition": false && (condition)
Otherwise DCHECK(false || true) will unexpectedly create a NullLogStream.
| std::vector<Envoy::Network::Address::IpVersion> versions = | ||
| Envoy::TestEnvironment::getIpVersionsForTest(); | ||
| if (std::find(versions.begin(), versions.end(), Envoy::Network::Address::IpVersion::v4) != | ||
| std::end(versions)) { |
There was a problem hiding this comment.
nit: How about we either use versions.(begin|end), or std::(begin|end)(versions), but not a mix of them?
|
|
||
| namespace epoll_server { | ||
|
|
||
| template <typename T, typename... Args> std::unique_ptr<T> EpollMakeUniqueImpl(Args&&... args) { |
There was a problem hiding this comment.
Sorry about the wrong suggestion, and thanks for trying:)
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
|
/assign @alyssawilk |
|
/assign @htuch for changes in envoy_build_system.bzl |
|
🙀 Error while processing event: |
|
|
||
| } // namespace | ||
|
|
||
| int AddressFamilyUnderTestImpl() { |
There was a problem hiding this comment.
Looks like this is confusingly named, but doing the right thing.
Possibly worth a rename or comments that this returns the "highest" supported address version of v4/v6. Given it's test code and I suspect will be unused I'm fine landing as-is.
There was a problem hiding this comment.
Renaming requires upstream change. I added a comment here for the return value.
Signed-off-by: Dan Zhang <danzh@google.com>
|
/assign @htuch |
bazel/external/quiche.BUILD
Outdated
| deps = ["@envoy//test/extensions/quic_listeners/quiche/platform:epoll_server_platform_impl_lib"], | ||
| ) | ||
|
|
||
| cc_library( |
There was a problem hiding this comment.
Why are these cc_library rather than envoy_cc_library? The latter is preferred, it simplifies Google import and removes boilerplate.
There was a problem hiding this comment.
I think the original intention was that these targets are not in the envoy workspace and to use envoy_cc_library we need to explicitly specify repository = "@envoy". But since it benefits to code import, I just switched to use envoy_cc_library.
There was a problem hiding this comment.
I guess internally we will use a different QUICHE binding actually. But, it's good either way.
Signed-off-by: Dan Zhang <danzh@google.com>
|
/retest |
|
🔨 rebuilding |
htuch
left a comment
There was a problem hiding this comment.
Looks good, one comment and needs master merge to resolve conflict.
bazel/external/quiche.BUILD
Outdated
| "quiche/epoll_server/fake_simple_epoll_server.h", | ||
| "quiche/epoll_server/simple_epoll_server.h", | ||
| ], | ||
| copts = envoy_copts("@envoy") + quiche_copt, |
There was a problem hiding this comment.
Do you need to explicitly add the envoy_copts if this is a envoy_cc_test_library?
There was a problem hiding this comment.
Not needed actually. Removed.
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
|
sync'ed with #6700 to fix thread test failure. PTAL |
* master: (35 commits) Revert "api: Add total_issued_requests to Upstream Locality and Endpoint Stats. (envoyproxy#6692)" (envoyproxy#6761) Add test for the SocketOptionFactory::buildLiteralOptions() method. (envoyproxy#6724) Add test of parsing weighted_cluster route configuration to improve test coverage. (envoyproxy#6711) test: reducing H2 test permutations, increasing coverage time (envoyproxy#6753) Support gRPC-JSON translate without the google.api.http option. (envoyproxy#6731) quiche: implement QuicEpollClock (envoyproxy#6745) http: rc details for main Envoy workflow (envoyproxy#6560) quiche: implement QuicSystemEventLoopImpl (envoyproxy#6723) http: tracking 100s from upstream in stats (envoyproxy#6746) coverage: run without deprecated option (envoyproxy#6752) quiche: Implement spdy_test_helpers_impl. (envoyproxy#6741) [test] convert listener test stubs to v2 API (envoyproxy#6735) api: Add total_issued_requests to Upstream Locality and Endpoint Stats. (envoyproxy#6692) quiche: Implement http2_reconstruct_object_impl.h. (envoyproxy#6717) build: patch protobuf for UBSAN issue. (envoyproxy#6721) router: scoped rds (2a): scoped routing configuration protos (envoyproxy#6675) tap: use move semantics for submitTrace (envoyproxy#6709) quiche: add epoll_server for testing (envoyproxy#6650) Increase timeout of the coverage test run to 3000 seconds as it is now bumping in the current 2000s limit causing coverage run to abort sometimes. (envoyproxy#6722) quiche: Update tarball to commit 43a1c0f10f2855c3cd142f500e8d19ac6d6f5a8c (envoyproxy#6718) ... Signed-off-by: Michael Puncel <mpuncel@squareup.com>
Add platform implementation for epoll_server. Build epoll_server and test it. Add more DCHECK related macros in quic_logging_impl.h which is used by simple_epoll_server.cc Update tar ball to quiche commit: 3e188a56edbcc471799499958bfd7c05ec45b9e2 Plumb through envoy_cc_test to pass in copt. Risk Level: low Testing: bring in simple_epoll_server_test.cc Part of envoyproxy#2557 Signed-off-by: Dan Zhang <danzh@google.com> Signed-off-by: Jeff Piazza <jeffpiazza@google.com>
Add platform implementation for epoll_server. Build epoll_server and test it.
Add more DCHECK related macros in quic_logging_impl.h which is used by simple_epoll_server.cc
Update tar ball to quiche commit: 3e188a56edbcc471799499958bfd7c05ec45b9e2
Plumb through envoy_cc_test to pass in copt.
Risk Level: low
Testing: bring in simple_epoll_server_test.cc
Part of #2557