mirror of
https://github.com/facebookincubator/mvfst.git
synced 2025-08-08 09:42:06 +03:00
Fix open source build
Summary: Fixing four issues in open source build. First, two missing changes to `CMakeLists.cpp` changes - `handshake/TokenGenerator.cpp`, added in D31673160 (7233c55d29
) - `state/AckEvent.cpp`, added in D31221302 (7a916869ff
) The two two issues are caused by inconsistencies between our build env and open source build env, including gtest versions. We should investigate getting open source gtest on same version. --- **[D31216724 (20c17a882b
)] We cannot use lambdas with `testing::ResultOf` for older versions of gtest and/or older compilers.** ``` gmock-matchers.h:2310:29: error: no type named 'result_type' in '(lambda at /data/sandcastle/temp/fbcode_builder_getdeps/shipit/mvfst/quic/api/test/QuicTransportTest.cpp:711:19)' ``` In particular, the `decltype(f(arg))` logic in the following code from gtest is going to fail on the lambda, since a lambda has no type. I believe it would need to be a `declval(decltype(f(arg)))` for the lambda to work. ``` template <typename Functor> struct CallableTraits { typedef Functor StorageType; static void CheckIsValid(Functor /* functor */) {} template <typename T> static auto Invoke(Functor f, const T& arg) -> decltype(f(arg)) { return f(arg); } }; ``` See this for details: https://stackoverflow.com/questions/4846540/c11-lambda-in-decltype ----- **[D32772165 (e784fafb10
)] `EXPECT_CALL` does not work with the formatting used for older versions of gtest and/or older compilers (again, unclear).** Specifically ``` EXPECT_CALL(handshakeFinishedCallback, onHandshakeFinished); ``` must instead be ``` EXPECT_CALL(handshakeFinishedCallback, onHandshakeFinished()); ``` Reviewed By: kvtsoy Differential Revision: D33026131 fbshipit-source-id: 886a6165f2e217cadbe479320195abbd4895eb7c
This commit is contained in:
committed by
Facebook GitHub Bot
parent
d036d520c7
commit
fa0aa9754e
@@ -702,22 +702,31 @@ TEST_F(QuicTransportTest, ObserverPacketsWrittenCycleCheckDetails) {
|
||||
// part 3.2, we write two ACK eliciting packets, then become app limited
|
||||
// one of the ACK eliciting packets contains an ACK frame
|
||||
{
|
||||
// older versions of gtest do not seem to accept lambdas for ResultOf
|
||||
// matcher, so define an std::function
|
||||
std::function<uint64_t(const Observer::WriteEvent&)>
|
||||
countPacketsWithAckFrames =
|
||||
[](const Observer::WriteEvent& event) -> uint64_t {
|
||||
uint64_t packetsWithAckFrames = 0;
|
||||
for (auto& outstandingPacket : event.outstandingPackets) {
|
||||
bool hasAckFrame = false;
|
||||
for (auto& frame : outstandingPacket.packet.frames) {
|
||||
if (frame.asWriteAckFrame()) {
|
||||
hasAckFrame = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasAckFrame) {
|
||||
packetsWithAckFrames++;
|
||||
}
|
||||
}
|
||||
return packetsWithAckFrames;
|
||||
};
|
||||
|
||||
const auto writeEventMatcher = AllOf(
|
||||
testing::ResultOf(countPacketsWithAckFrames, 1),
|
||||
testing::Property(
|
||||
&Observer::WriteEvent::getOutstandingPackets, testing::SizeIs(9)),
|
||||
testing::Property(
|
||||
&Observer::WriteEvent::getOutstandingPackets,
|
||||
testing::Contains(testing::ResultOf(
|
||||
[](auto& outstandingPacket) {
|
||||
for (auto& frame : outstandingPacket.packet.frames) {
|
||||
auto ackFrame = frame.asWriteAckFrame();
|
||||
if (ackFrame) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
testing::Eq(true)))),
|
||||
testing::Field(
|
||||
&Observer::WriteEvent::writeCount, testing::Eq(writeNum)));
|
||||
const auto packetsWrittenEventMatcher = AllOf(
|
||||
|
Reference in New Issue
Block a user