Skip to content

Commit

Permalink
Update GoogleTest to latest version (#269)
Browse files Browse the repository at this point in the history
* Remove old gtest version
* Add new vendored Googletest version
* Move test_config H to HH
* CMake updates for new googletest version
* Test updates for new googletest version

Signed-off-by: Michael Carroll <michael@openrobotics.org>
  • Loading branch information
mjcarroll authored Jun 28, 2022
1 parent a877872 commit 6231f53
Show file tree
Hide file tree
Showing 65 changed files with 11,431 additions and 20,776 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ gz_configure_project(
#============================================================================
# Set project-specific options
#============================================================================
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

#============================================================================
# Search for project-specific dependencies
Expand Down Expand Up @@ -54,7 +56,7 @@ set(GZ_UTILS_VER ${gz-utils2_VERSION_MAJOR})

#--------------------------------------
# Find gz-common
gz_find_package(gz-common5 REQUIRED PRIVATE)
gz_find_package(gz-common5 REQUIRED PRIVATE COMPONENTS testing)
set(GZ_COMMON_VER ${gz-common5_VERSION_MAJOR})

#--------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/ClientConfig_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <gz/common/Filesystem.hh>
#include <gz/common/Util.hh>
#include "gz/fuel_tools/ClientConfig.hh"
#include "test_config.h"
#include "test_config.hh"

using namespace gz;
using namespace fuel_tools;
Expand Down
2 changes: 1 addition & 1 deletion src/FuelClient_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "gz/fuel_tools/Result.hh"
#include "gz/fuel_tools/WorldIdentifier.hh"

#include "test_config.h"
#include "test_config.hh"

#ifdef _WIN32
#include <direct.h>
Expand Down
2 changes: 1 addition & 1 deletion src/Interface_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "gz/fuel_tools/FuelClient.hh"
#include "gz/fuel_tools/Interface.hh"

#include "test_config.h"
#include "test_config.hh"

#ifdef _WIN32
#include <direct.h>
Expand Down
2 changes: 1 addition & 1 deletion src/LocalCache_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "gz/fuel_tools/WorldIdentifier.hh"

#include "LocalCache.hh"
#include "test_config.h"
#include "test_config.hh"

#ifdef _WIN32
#include <direct.h>
Expand Down
2 changes: 1 addition & 1 deletion src/RestClient_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <gtest/gtest.h>
#include <string>
#include "gz/fuel_tools/RestClient.hh"
#include "test_config.h"
#include "test_config.hh"

/////////////////////////////////////////////////
TEST(RestClient, UserAgent)
Expand Down
2 changes: 1 addition & 1 deletion src/gz_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <gz/utils/ExtraTestMacros.hh>

#include "gz/fuel_tools/config.hh"
#include "test_config.h"
#include "test_config.hh"

/////////////////////////////////////////////////
std::string custom_exec_str(std::string _cmd)
Expand Down
6 changes: 3 additions & 3 deletions src/gz_src_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <gz/utils/ExtraTestMacros.hh>

#include "gz.hh"
#include "test_config.h"
#include "test_config.hh"

using namespace gz;

Expand Down Expand Up @@ -371,8 +371,8 @@ class DownloadCollectionTest
public ::testing::WithParamInterface<int>
{};

INSTANTIATE_TEST_CASE_P(CollectionTest, DownloadCollectionTest,
::testing::Values(1, 2, 16),); // NOLINT
INSTANTIATE_TEST_SUITE_P(CollectionTest, DownloadCollectionTest,
::testing::Values(1, 2, 16));

/////////////////////////////////////////////////
// Protocol "https" not supported or disabled in libcurl for Windows
Expand Down
23 changes: 4 additions & 19 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,9 @@
configure_file(test_config.h.in ${PROJECT_BINARY_DIR}/test_config.h)

# Build gtest
add_library(gtest STATIC gtest/src/gtest-all.cc)
add_library(gtest_main STATIC gtest/src/gtest_main.cc)
target_include_directories(gtest
SYSTEM PUBLIC
${PROJECT_SOURCE_DIR}/test/gtest/include
PRIVATE
${PROJECT_SOURCE_DIR}/test/gtest
configure_file (test_config.hh.in ${PROJECT_BINARY_DIR}/include/test_config.hh)
include_directories (
${PROJECT_BINARY_DIR}/include
)

target_link_libraries(gtest_main gtest)
set_property(TARGET gtest_main PROPERTY CXX_STANDARD ${c++standard})
set_property(TARGET gtest PROPERTY CXX_STANDARD ${c++standard})
set(GTEST_LIBRARY "${PROJECT_BINARY_DIR}/test/libgtest.a")
set(GTEST_MAIN_LIBRARY "${PROJECT_BINARY_DIR}/test/libgtest_main.a")

execute_process(COMMAND cmake -E remove_directory ${CMAKE_BINARY_DIR}/test_results)
execute_process(COMMAND cmake -E make_directory ${CMAKE_BINARY_DIR}/test_results)

add_subdirectory(gtest_vendor)
add_subdirectory(integration)
add_subdirectory(performance)
add_subdirectory(regression)
Loading

0 comments on commit 6231f53

Please sign in to comment.