From d81b36e16f5990aff28472beb14769cc71d9bb97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Sun, 2 Jan 2022 22:37:39 +0100 Subject: [PATCH 1/2] Update GoogleTest version --- test/tests/CMakeLists.txt | 15 +++++++-------- test/tests/Pathfinding.cpp | 4 ++-- test/tests/ReplayTests.cpp | 2 +- test/tests/StringTest.cpp | 2 +- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/test/tests/CMakeLists.txt b/test/tests/CMakeLists.txt index 703871f2d9..772b47ab09 100644 --- a/test/tests/CMakeLists.txt +++ b/test/tests/CMakeLists.txt @@ -13,11 +13,10 @@ else (SYSTEM_GTEST) # Bootstrap GoogleTest INCLUDE(ExternalProject) - # Use googletest with https://github.com/google/googletest/pull/1045 applied ExternalProject_Add( googletest-distribution - URL https://github.com/google/googletest/archive/ad49eaa0466b98f21449efaaaae817683daa8b99.tar.gz - URL_HASH SHA1=e468bfdffe7c46c14ce06bfb48a29b6201908504 + URL https://github.com/google/googletest/archive/e2239ee6043f73722e7aa812a459f54a28552929.tar.gz # v1.11.0 release + URL_HASH SHA1=b0399e38211cc4fedd612f71bad7984ed4cbe8fe TIMEOUT 10 CONFIGURE_COMMAND "" BUILD_COMMAND "" @@ -32,10 +31,10 @@ else (SYSTEM_GTEST) googletest DEPENDS googletest-distribution DOWNLOAD_COMMAND "" - SOURCE_DIR "${GOOGLETEST_DISTRIB_SOURCE_DIR}/googletest" - CMAKE_ARGS "-DCMAKE_CXX_FLAGS=${TARGET_M}" - BUILD_BYPRODUCTS "googletest-prefix/src/googletest-build/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}" - BUILD_BYPRODUCTS "googletest-prefix/src/googletest-build/${CMAKE_STATIC_LIBRARY_PREFIX}gtest_main${CMAKE_STATIC_LIBRARY_SUFFIX}" + SOURCE_DIR "${GOOGLETEST_DISTRIB_SOURCE_DIR}" + CMAKE_ARGS "-DCMAKE_CXX_FLAGS=${TARGET_M} -DBUILD_GMOCK=off" + BUILD_BYPRODUCTS "googletest-prefix/src/googletest-build/lib/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}" + BUILD_BYPRODUCTS "googletest-prefix/src/googletest-build/lib/${CMAKE_STATIC_LIBRARY_PREFIX}gtest_main${CMAKE_STATIC_LIBRARY_SUFFIX}" # Disable install step INSTALL_COMMAND "" # Wrap download, configure and build steps in a script to log output @@ -49,7 +48,7 @@ else (SYSTEM_GTEST) # Library ExternalProject_Get_Property(googletest BINARY_DIR) - set(GOOGLETEST_BINARY_DIR "${BINARY_DIR}") + set(GOOGLETEST_BINARY_DIR "${BINARY_DIR}/lib") set(GTEST_LIBRARY_PATH ${GOOGLETEST_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}) set(GTEST_MAIN_LIBRARY_PATH ${GOOGLETEST_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest_main${CMAKE_STATIC_LIBRARY_SUFFIX}) set(GTEST_LIBRARY gtest) diff --git a/test/tests/Pathfinding.cpp b/test/tests/Pathfinding.cpp index d7e040390e..8816d2a2d1 100644 --- a/test/tests/Pathfinding.cpp +++ b/test/tests/Pathfinding.cpp @@ -211,7 +211,7 @@ TEST_P(SimplePathfindingTest, CanFindPathFromStartToGoal) EXPECT_TRUE(succeeded); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ForScenario, SimplePathfindingTest, ::testing::Values( SimplePathfindingScenario("StraightFlat", { 19, 15, 14 }, 24), SimplePathfindingScenario("SBend", { 15, 12, 14 }, 87), @@ -244,7 +244,7 @@ TEST_P(ImpossiblePathfindingTest, CannotFindPathFromStartToGoal) EXPECT_FALSE(FindPath(&pos, goal, 10000, ride->id)); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ForScenario, ImpossiblePathfindingTest, ::testing::Values( SimplePathfindingScenario("PathWithGap", { 1, 6, 14 }, 10000), diff --git a/test/tests/ReplayTests.cpp b/test/tests/ReplayTests.cpp index 9a7b8f274a..19bc9cf18d 100644 --- a/test/tests/ReplayTests.cpp +++ b/test/tests/ReplayTests.cpp @@ -115,4 +115,4 @@ struct PrintReplayParameter } }; -INSTANTIATE_TEST_CASE_P(Replay, ReplayTests, testing::ValuesIn(GetReplayFiles()), PrintReplayParameter()); +INSTANTIATE_TEST_SUITE_P(Replay, ReplayTests, testing::ValuesIn(GetReplayFiles()), PrintReplayParameter()); diff --git a/test/tests/StringTest.cpp b/test/tests/StringTest.cpp index 535af4e23c..8534918125 100644 --- a/test/tests/StringTest.cpp +++ b/test/tests/StringTest.cpp @@ -27,7 +27,7 @@ class StringTest : public testing::TestWithParam // Tests for String::Trim /////////////////////////////////////////////////////////////////////////////// -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TrimData, StringTest, testing::Values( // input after Trim after TrimStart From dfd5b4e77562b34273386f28648b8083cb040e88 Mon Sep 17 00:00:00 2001 From: Micha Janiszewski Date: Sun, 8 May 2022 13:20:26 -0700 Subject: [PATCH 2/2] Update MSVC project to use correct Google Test library --- openrct2.proj | 15 --------------- test/tests/tests.vcxproj | 7 ++++--- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/openrct2.proj b/openrct2.proj index 80ac265f3d..5aac1fb3a9 100644 --- a/openrct2.proj +++ b/openrct2.proj @@ -43,9 +43,6 @@ 6eb97a49ad30442fe6d08799a0561d7cf0c95d40 https://github.com/OpenRCT2/Dependencies/releases/download/v32/openrct2-libs-v32-arm64-windows-static.zip fa5f067fcfb5e76c4d4fb6f2211b422cbbe25f26 - 2fe3bd994b3189899d93f1d5a881e725e046fdc2 - https://github.com/google/googletest/archive/$(GtestVersion).zip - 058b9df80244c03f1633cb06e9f70471a29ebb8e https://github.com/OpenRCT2/title-sequences/releases/download/v0.4.0/title-sequences.zip 4ab0065e5a4d9f9c77d94718bbdfcfcd5a389da0 https://github.com/OpenRCT2/objects/releases/download/v1.2.7/objects.zip @@ -65,18 +62,6 @@ Sha1="$(LibsSha1)" CheckFile="$(DependenciesCheckFile)" OutputDirectory="$(RootDir)lib\$(Platform)" /> - - - - - $(RootDir)lib\googletest-$(GtestVersion) - $(RootDir)lib\googletest - - diff --git a/test/tests/tests.vcxproj b/test/tests/tests.vcxproj index 3fe3fd1406..199bb4a234 100644 --- a/test/tests/tests.vcxproj +++ b/test/tests/tests.vcxproj @@ -2,7 +2,6 @@ ..\..\ - $(SolutionDir)lib\googletest\googletest @@ -41,8 +40,9 @@ $(SolutionDir)bin\ - $(GtestDir);$(GtestDir)\include;$(IncludePath) $(SolutionDir)bin;$(LibraryPath) + $(SolutionDir)lib\$(Platform)\debug\lib;$(LibraryPath) + $(SolutionDir)lib\$(Platform)\lib;$(LibraryPath) @@ -50,6 +50,8 @@ libopenrct2.lib;%(AdditionalDependencies) + gtestd.lib;%(AdditionalDependencies) + gtest.lib;%(AdditionalDependencies) Console @@ -83,7 +85,6 @@ -