Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update GoogleTest to latest version #1559

Merged
merged 5 commits into from
Jun 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ find_package(gz-cmake3 REQUIRED)
#============================================================================
# Configure the project
#============================================================================
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

gz_configure_project(
REPLACE_IGNITION_INCLUDE_PATH gz/sim
VERSION_SUFFIX pre1)
set (CMAKE_CXX_STANDARD 17)

#============================================================================
# Set project-specific options
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ if (MSVC)
endif()

# Create the library target
gz_create_core_library(SOURCES ${sources} CXX_STANDARD 17)
gz_create_core_library(SOURCES ${sources})
target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME}
PUBLIC
gz-math${GZ_MATH_VER}
Expand Down
2 changes: 1 addition & 1 deletion src/ComponentFactory_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

#include <gtest/gtest.h>
#include "gz/sim/test_config.hh"
#include "test_config.hh"
#include "gz/sim/components/Component.hh"
#include "gz/sim/components/Factory.hh"
#include "gz/sim/components/Name.hh"
Expand Down
9 changes: 1 addition & 8 deletions src/ModelCommandAPI_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/sim/Server.hh"
#include "gz/sim/test_config.hh" // NOLINT(build/include)
#include "test_config.hh" // NOLINT(build/include)

static const std::string kIgnModelCommand(
std::string(BREW_RUBY) + std::string(GZ_PATH) + " model ");
Expand Down Expand Up @@ -662,10 +662,3 @@ TEST(ModelCommandAPI, GZ_UTILS_TEST_DISABLED_ON_MAC(RgbdCameraSensor))
EXPECT_EQ(expectedOutput, output);
}
}

//////////////////////////////////////////////////
int main(int argc, char **argv)
{
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
2 changes: 1 addition & 1 deletion src/SdfEntityCreator_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <sdf/Root.hh>
#include <sdf/Sphere.hh>

#include "gz/sim/test_config.hh"
#include "test_config.hh"
#include "gz/sim/components/CanonicalLink.hh"
#include "gz/sim/components/CastShadows.hh"
#include "gz/sim/components/ChildLinkName.hh"
Expand Down
2 changes: 1 addition & 1 deletion src/SdfGenerator_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include "gz/sim/components/Sensor.hh"
#include "gz/sim/components/Visual.hh"
#include "gz/sim/components/World.hh"
#include "gz/sim/test_config.hh"
#include "test_config.hh"

#include "helpers/UniqueTestDirectoryEnv.hh"
#include "helpers/EnvTestFixture.hh"
Expand Down
2 changes: 1 addition & 1 deletion src/ServerConfig_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <gz/common/Console.hh>
#include <gz/sim/ServerConfig.hh>
#include <gz/sim/Util.hh>
#include <gz/sim/test_config.hh>
#include <test_config.hh>

using namespace gz;
using namespace sim;
Expand Down
2 changes: 1 addition & 1 deletion src/Server_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include "gz/sim/Server.hh"
#include "gz/sim/Types.hh"
#include "gz/sim/Util.hh"
#include "gz/sim/test_config.hh"
#include "test_config.hh"

#include "plugins/MockSystem.hh"
#include "../test/helpers/Relay.hh"
Expand Down
2 changes: 1 addition & 1 deletion src/SimulationRunner_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include <sdf/Sphere.hh>


#include "gz/sim/test_config.hh"
#include "test_config.hh"
#include "gz/sim/components/CanonicalLink.hh"
#include "gz/sim/components/ChildLinkName.hh"
#include "gz/sim/components/Collision.hh"
Expand Down
2 changes: 1 addition & 1 deletion src/SystemLoader_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "gz/sim/System.hh"
#include "gz/sim/SystemLoader.hh"

#include "gz/sim/test_config.hh" // NOLINT(build/include)
#include "test_config.hh" // NOLINT(build/include)

using namespace gz;

Expand Down
2 changes: 1 addition & 1 deletion src/SystemManager_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "gz/sim/SystemLoader.hh"
#include "gz/sim/Types.hh"
#include "gz/sim/components/SystemPluginInfo.hh"
#include "gz/sim/test_config.hh" // NOLINT(build/include)
#include "test_config.hh" // NOLINT(build/include)

#include "SystemManager.hh"

Expand Down
2 changes: 1 addition & 1 deletion src/TestFixture_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include "gz/sim/components/Name.hh"
#include "gz/sim/ServerConfig.hh"
#include "gz/sim/test_config.hh"
#include "test_config.hh"
#include "../test/helpers/EnvTestFixture.hh"
#include "gz/sim/TestFixture.hh"

Expand Down
3 changes: 1 addition & 2 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ endif()

gz_add_component(gui
SOURCES ${gui_sources} resources/gazebo.qrc
GET_TARGET_NAME gui_target
CXX_STANDARD 17)
GET_TARGET_NAME gui_target)

target_link_libraries(${gui_target}
PUBLIC
Expand Down
2 changes: 1 addition & 1 deletion src/gui/GuiEvents_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#include <gtest/gtest.h>

#include "gz/sim/test_config.hh"
#include "test_config.hh"
#include "gz/sim/gui/GuiEvents.hh"

using namespace gz;
Expand Down
2 changes: 1 addition & 1 deletion src/gui/Gui_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <gz/utils/ExtraTestMacros.hh>

#include "gz/sim/gui/Gui.hh"
#include "gz/sim/test_config.hh"
#include "test_config.hh"

#include "../../test/helpers/EnvTestFixture.hh"

Expand Down
2 changes: 1 addition & 1 deletion src/gui/Gui_clean_exit_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "helpers/EnvTestFixture.hh"
#include "gz/sim/Server.hh"
#include "gz/sim/gui/Gui.hh"
#include "gz/sim/test_config.hh" // NOLINT(build/include)
#include "test_config.hh" // NOLINT(build/include)

using namespace gz;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include "gz/sim/components/Name.hh"
#include "gz/sim/components/ParentEntity.hh"
#include "gz/sim/EntityComponentManager.hh"
#include "gz/sim/test_config.hh"
#include "test_config.hh"
#include "../../../../test/helpers/EnvTestFixture.hh"

#include "../../GuiRunner.hh"
Expand Down
2 changes: 1 addition & 1 deletion src/gui/plugins/plot_3d/Plot3D_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include "gz/sim/components/Name.hh"
#include "gz/sim/components/ParentEntity.hh"
#include "gz/sim/EntityComponentManager.hh"
#include "gz/sim/test_config.hh"
#include "test_config.hh"
#include "../../../../test/helpers/EnvTestFixture.hh"

#include "../../GuiRunner.hh"
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/common/Util.hh>
#include <gz/utils/ExtraTestMacros.hh>

#include "gz/sim/test_config.hh" // NOLINT(build/include)
#include "test_config.hh" // NOLINT(build/include)

static const std::string kBinPath(PROJECT_BINARY_PATH);

Expand Down
3 changes: 1 addition & 2 deletions src/rendering/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ endif()

gz_add_component(rendering
SOURCES ${rendering_comp_sources}
GET_TARGET_NAME rendering_target
CXX_STANDARD 17)
GET_TARGET_NAME rendering_target)

target_link_libraries(${rendering_target}
PUBLIC
Expand Down
3 changes: 1 addition & 2 deletions src/systems/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ function(gz_add_system system_name)

gz_add_component(${system_name}
SOURCES ${sources}
GET_TARGET_NAME system_target
CXX_STANDARD 17)
GET_TARGET_NAME system_target)

target_link_libraries(${system_target}
PUBLIC
Expand Down
24 changes: 5 additions & 19 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,11 @@
configure_file (test_config.hh.in
${PROJECT_BINARY_DIR}/include/test_config.hh
)
include_directories (
${PROJECT_SOURCE_DIR}/test/gtest/include
${PROJECT_SOURCE_DIR}/test/gtest
${PROJECT_SOURCE_DIR}/test
${PROJECT_BINARY_DIR}/include/
${PROJECT_BINARY_DIR}/include
)

configure_file (test_config.hh.in ${PROJECT_BINARY_DIR}/include/gz/sim/test_config.hh)

# Build gtest
add_library(gtest STATIC gtest/src/gtest-all.cc)
add_library(gtest_main STATIC gtest/src/gtest_main.cc)
target_link_libraries(gtest_main gtest)
target_compile_features(gtest PUBLIC cxx_std_11)

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)
include_directories(${GTEST_INCLUDE_DIRS})

add_subdirectory(gtest_vendor)
add_subdirectory(benchmark)
add_subdirectory(integration)
add_subdirectory(performance)
Expand Down
9 changes: 0 additions & 9 deletions test/gtest/cmake/Config.cmake.in

This file was deleted.

10 changes: 0 additions & 10 deletions test/gtest/cmake/gtest.pc.in

This file was deleted.

11 changes: 0 additions & 11 deletions test/gtest/cmake/gtest_main.pc.in

This file was deleted.

Loading