Skip to content

Commit

Permalink
Migrate from googletest 1.8 to googletest 1.10 (#67)
Browse files Browse the repository at this point in the history
Summary:
X-link: facebookincubator/hsthrift#67

Updating `googletest` from `1.8.0` to `1.10.0`

Reviewed By: mzlee, igorsugak, luciang, meyering, r-barnes

Differential Revision: D34351084

fbshipit-source-id: 939b3985ab63a06b6d511ec8711c2d5863bdfea8
  • Loading branch information
dimitribouche authored and facebook-github-bot committed Mar 3, 2022
1 parent 7ae2cc2 commit 1512856
Show file tree
Hide file tree
Showing 43 changed files with 750 additions and 940 deletions.
2 changes: 1 addition & 1 deletion build/fbcode_builder/manifests/mvfst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ folly
fizz

[dependencies.all(test=on, not(os=windows))]
googletest_1_8
googletest

[shipit.pathmap]
fbcode/quic/public_root = .
Expand Down
2 changes: 1 addition & 1 deletion build/fbcode_builder/manifests/proxygen
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ wangle
mvfst

[dependencies.test=on]
googletest_1_8
googletest

[shipit.pathmap]
fbcode/proxygen/public_tld = .
Expand Down
6 changes: 3 additions & 3 deletions cmake/ProxygenTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
option(BUILD_TESTS "Enable tests" OFF)
include(CTest)
if(BUILD_TESTS)
find_package(GMock 1.8.0 MODULE REQUIRED)
find_package(GTest 1.8.0 MODULE REQUIRED)
find_package(GMock 1.10.0 MODULE REQUIRED)
find_package(GTest 1.10.0 MODULE REQUIRED)
endif()

function(proxygen_add_test)
Expand All @@ -29,7 +29,7 @@ function(proxygen_add_test)
set(PROXYGEN_TEST_SOURCES "${PROXYGEN_TEST_TARGET}.cpp")
endif()

add_executable(${PROXYGEN_TEST_TARGET}
add_executable(${PROXYGEN_TEST_TARGET}
"${PROXYGEN_TEST_SOURCES}"
)

Expand Down
2 changes: 1 addition & 1 deletion proxygen/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ function setup_googletest() {
fi
cd "$GTEST_DIR"
git fetch --tags
git checkout release-1.8.0
git checkout release-1.10.0
echo -e "${COLOR_GREEN}Building googletest ${COLOR_OFF}"
mkdir -p "$GTEST_BUILD_DIR"
cd "$GTEST_BUILD_DIR" || exit
Expand Down
37 changes: 2 additions & 35 deletions proxygen/httpserver/Mocks.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ class MockResponseHandler : public ResponseHandler {
#endif
#endif

// googletest switched APIs between multiple versions we target
#if defined(MOCK_METHOD)
MOCK_METHOD((void), pauseIngress, (), (noexcept));
MOCK_METHOD((void), refreshTimeout, (), (noexcept));
MOCK_METHOD((void), resumeIngress, (), (noexcept));
Expand All @@ -45,26 +43,8 @@ class MockResponseHandler : public ResponseHandler {
newPushedResponse,
(PushHandler*),
(noexcept));
#else
GMOCK_METHOD0_(, noexcept, , pauseIngress, void());
GMOCK_METHOD0_(, noexcept, , refreshTimeout, void());
GMOCK_METHOD0_(, noexcept, , resumeIngress, void());
GMOCK_METHOD0_(, noexcept, , sendAbort, void());
GMOCK_METHOD0_(, noexcept, , sendChunkTerminator, void());
GMOCK_METHOD0_(, noexcept, , sendEOM, void());
GMOCK_METHOD1_(, noexcept, , sendBody, void(std::shared_ptr<folly::IOBuf>));
GMOCK_METHOD1_(, noexcept, , sendChunkHeader, void(size_t));
GMOCK_METHOD1_(, noexcept, , sendHeaders, void(HTTPMessage&));
GMOCK_METHOD1_(, noexcept, , sendTrailers, void(const HTTPHeaders&));
GMOCK_METHOD1_(
,
noexcept,
,
newPushedResponse,
folly::Expected<ResponseHandler*, ProxygenError>(PushHandler*));
#endif
MOCK_METHOD(void, getCurrentTransportInfo, (wangle::TransportInfo*), (const));

MOCK_CONST_METHOD1(getCurrentTransportInfo, void(wangle::TransportInfo*));
#ifdef __clang__
#pragma clang diagnostic pop
#endif
Expand Down Expand Up @@ -92,7 +72,6 @@ class MockRequestHandler : public RequestHandler {
#pragma clang diagnostic ignored "-Winconsistent-missing-override"
#endif
#endif
#if defined(MOCK_METHOD)
MOCK_METHOD((bool), canHandleExpect, (), (noexcept));
MOCK_METHOD((void), onBody, (std::shared_ptr<folly::IOBuf>), (noexcept));
MOCK_METHOD((void), onEOM, (), (noexcept));
Expand All @@ -104,19 +83,7 @@ class MockRequestHandler : public RequestHandler {
MOCK_METHOD((void), onUpgrade, (UpgradeProtocol), (noexcept));
MOCK_METHOD((void), requestComplete, (), (noexcept));
MOCK_METHOD((void), setResponseHandler, (ResponseHandler*), (noexcept));
#else
GMOCK_METHOD0_(, noexcept, , onEOM, void());
GMOCK_METHOD0_(, noexcept, , onEgressPaused, void());
GMOCK_METHOD0_(, noexcept, , requestComplete, void());
GMOCK_METHOD1_(, noexcept, , onBody, void(std::shared_ptr<folly::IOBuf>));
GMOCK_METHOD1_(, noexcept, , onError, void(ProxygenError));
GMOCK_METHOD1_(, noexcept, , onGoaway, void(ErrorCode));
GMOCK_METHOD1_(, noexcept, , onRequest, void(std::shared_ptr<HTTPMessage>));
GMOCK_METHOD1_(, noexcept, , onUpgrade, void(UpgradeProtocol));
GMOCK_METHOD1_(, noexcept, , setResponseHandler, void(ResponseHandler*));
GMOCK_METHOD0_(, noexcept, , onEgressResumed, void());
GMOCK_METHOD0_(, noexcept, , canHandleExpect, bool());
#endif

#ifdef __clang__
#pragma clang diagnostic pop
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ class CompressionFilterTest : public Test {

typedef ::testing::Types<ZlibTest, ZstdTest> CompressionCodecs;

TYPED_TEST_CASE(CompressionFilterTest, CompressionCodecs);
TYPED_TEST_SUITE(CompressionFilterTest, CompressionCodecs);

// Basic smoke test
TYPED_TEST(CompressionFilterTest, NonchunkedCompression) {
Expand Down
4 changes: 2 additions & 2 deletions proxygen/httpserver/samples/echo/test/EchoHandlerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ using namespace testing;

class MockEchoStats : public EchoStats {
public:
MOCK_METHOD0(recordRequest, void());
MOCK_METHOD0(getRequestCount, uint64_t());
MOCK_METHOD(void, recordRequest, ());
MOCK_METHOD(uint64_t, getRequestCount, ());
};

class EchoHandlerFixture : public testing::Test {
Expand Down
8 changes: 0 additions & 8 deletions proxygen/httpserver/tests/HTTPServerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,20 +193,12 @@ TEST(HttpServerStartStop, TestUseExistingIoExecutor) {

class MockRequestHandlerFactory : public RequestHandlerFactory {
public:
// googletest switched APIs between multiple versions we target
#if defined(MOCK_METHOD)
MOCK_METHOD((void), onServerStart, (folly::EventBase*), (noexcept));
MOCK_METHOD((void), onServerStop, (), (noexcept));
MOCK_METHOD((RequestHandler*),
onRequest,
(RequestHandler*, HTTPMessage*),
(noexcept));
#else
GMOCK_METHOD1_(, noexcept, , onServerStart, void(folly::EventBase* evb));
GMOCK_METHOD0_(, noexcept, , onServerStop, void());
GMOCK_METHOD2_(
, noexcept, , onRequest, RequestHandler*(RequestHandler*, HTTPMessage*));
#endif
};

TEST(HttpServerStartStop, TestZeroThreadsMeansNumCPUs) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,4 @@ TEST_P(HPACKQueueTests, QueueDeleted) {
}
}

INSTANTIATE_TEST_CASE_P(Queue, HPACKQueueTests, ::testing::Values(0, 1, 2, 3));
INSTANTIATE_TEST_SUITE_P(Queue, HPACKQueueTests, ::testing::Values(0, 1, 2, 3));
6 changes: 3 additions & 3 deletions proxygen/lib/http/codec/compress/test/HPACKContextTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,6 @@ TEST_P(HPACKContextTests, ContextUpdate) {
}
}

INSTANTIATE_TEST_CASE_P(Context,
HPACKContextTests,
::testing::Values(true, false));
INSTANTIATE_TEST_SUITE_P(Context,
HPACKContextTests,
::testing::Values(true, false));
4 changes: 2 additions & 2 deletions proxygen/lib/http/codec/compress/test/RFCExamplesTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ TEST_P(RFCRequestTest, RfcExampleRequest) {
EXPECT_EQ(encoder.getTable().size(), 3);
}

INSTANTIATE_TEST_CASE_P(Huffman, RFCRequestTest, ::testing::Values(d3, d4));
INSTANTIATE_TEST_SUITE_P(Huffman, RFCRequestTest, ::testing::Values(d3, d4));

TEST_P(RFCResponseTest, RfcExampleResponse) {
// this test does some evictions
Expand Down Expand Up @@ -172,4 +172,4 @@ TEST_P(RFCResponseTest, RfcExampleResponse) {
EXPECT_EQ(encoder.getTable().bytes(), 215);
}

INSTANTIATE_TEST_CASE_P(Huffman, RFCResponseTest, ::testing::Values(d5, d6));
INSTANTIATE_TEST_SUITE_P(Huffman, RFCResponseTest, ::testing::Values(d5, d6));
6 changes: 3 additions & 3 deletions proxygen/lib/http/codec/test/DefaultHTTPCodecFactoryTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ TEST_P(DefaultHTTPCodecFactoryValidationTest, StrictValidation) {
EXPECT_EQ(callbacks.streamErrors, strict ? 1 : 0);
}

INSTANTIATE_TEST_CASE_P(DefaultHTTPCodecFactoryTest,
DefaultHTTPCodecFactoryValidationTest,
::testing::Values(true, false));
INSTANTIATE_TEST_SUITE_P(DefaultHTTPCodecFactoryTest,
DefaultHTTPCodecFactoryValidationTest,
::testing::Values(true, false));
4 changes: 2 additions & 2 deletions proxygen/lib/http/codec/test/FilterTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ const uint32_t kInitialCapacity = 12345;

class MockFlowControlCallback : public FlowControlFilter::Callback {
public:
MOCK_METHOD0(onConnectionSendWindowOpen, void());
MOCK_METHOD0(onConnectionSendWindowClosed, void());
MOCK_METHOD(void, onConnectionSendWindowOpen, ());
MOCK_METHOD(void, onConnectionSendWindowClosed, ());
};

class FilterTest : public testing::Test {
Expand Down
6 changes: 3 additions & 3 deletions proxygen/lib/http/codec/test/HQCodecTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ TEST_P(HQCodecTestFrameAllowed, FrameAllowedOnCodec) {
}
}

INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
FrameAllowedTests,
HQCodecTestFrameAllowed,
Values(
Expand Down Expand Up @@ -1056,7 +1056,7 @@ TEST_P(H1QCodecTestFrameAllowed, FrameAllowedOnH1qControlCodec) {
}
}

INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
H1QFrameAllowedTests,
H1QCodecTestFrameAllowed,
Values(
Expand Down Expand Up @@ -1128,7 +1128,7 @@ TEST_P(HQCodecTestFrameBeforeSettings, FrameAllowedOnH1qControlCodec) {
}
}

INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
FrameBeforeSettingsTests,
HQCodecTestFrameBeforeSettings,
Values(
Expand Down
6 changes: 3 additions & 3 deletions proxygen/lib/http/codec/test/HQFramerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ TEST_P(HQFramerTestDataOnlyFrames, TestDataOnlyFrame) {
EXPECT_EQ(outBuf->moveToFbString(), data->moveToFbString());
}

INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
DataOnlyFrameWriteParseTests,
HQFramerTestDataOnlyFrames,
Values((DataOnlyFrameParams){proxygen::hq::FrameType::DATA,
Expand Down Expand Up @@ -278,7 +278,7 @@ TEST_P(HQFramerTestIdOnlyFrames, TestIdOnlyFrame) {
}
}

INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
IdOnlyFrameWriteParseTests,
HQFramerTestIdOnlyFrames,
Values((IdOnlyFrameParams){proxygen::hq::FrameType::CANCEL_PUSH,
Expand Down Expand Up @@ -380,7 +380,7 @@ TEST_P(HQFramerTestSettingsValues, ValueAllowed) {
}
}

INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
SettingsValuesAllowedTests,
HQFramerTestSettingsValues,
Values((SettingsValuesParams){hq::SettingId::MAX_HEADER_LIST_SIZE, 0, true},
Expand Down
2 changes: 1 addition & 1 deletion proxygen/lib/http/codec/test/HTTP1xCodecTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1476,7 +1476,7 @@ TEST_P(ConnectionHeaderTest, TestConnectionHeaders) {
EXPECT_EQ(headers.getSingleOrEmpty(HTTP_HEADER_CONNECTION), val.second);
}

INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
HTTP1xCodec,
ConnectionHeaderTest,
::testing::Values(
Expand Down
Loading

0 comments on commit 1512856

Please sign in to comment.