Skip to content

Commit

Permalink
Merge branch 'feature/unitcoverage_grid_map' into 'master'
Browse files Browse the repository at this point in the history
[grid_map] Added cmake code coverage macro

GitOrigin-RevId: d9e32d7a3a6e0c507a1759df2ba23e906a548e70
  • Loading branch information
YoshuaNavaANYbotics authored and anybotics-sync-runner committed Aug 11, 2020
1 parent 270a9cc commit 3517962
Show file tree
Hide file tree
Showing 25 changed files with 299 additions and 102 deletions.
27 changes: 14 additions & 13 deletions grid_map_core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ catkin_package(
## Specify additional locations of header files
include_directories(
include
${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
SYSTEM
${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
)

## Declare a cpp library
Expand Down Expand Up @@ -129,14 +130,14 @@ if(TARGET ${PROJECT_NAME}-test)
target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
endif()

##################
# Code_coverage ##
##################

find_package(cmake_code_coverage QUIET)
if(cmake_code_coverage_FOUND)
add_gtest_coverage(
TEST_BUILD_TARGETS
${PROJECT_NAME}-test
)
endif(cmake_code_coverage_FOUND)
###################
## Code_coverage ##
###################

# find_package(cmake_code_coverage QUIET)
# if(cmake_code_coverage_FOUND)
# add_gtest_coverage(
# TEST_BUILD_TARGETS
# ${PROJECT_NAME}-test
# )
# endif(cmake_code_coverage_FOUND)
2 changes: 1 addition & 1 deletion grid_map_core/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
<author email="[email protected]">Péter Fankhauser</author>
<buildtool_depend>catkin</buildtool_depend>
<depend>eigen</depend>
<test_depend>cmake_code_coverage</test_depend>
<!-- <test_depend>cmake_code_coverage</test_depend> -->
</package>
25 changes: 13 additions & 12 deletions grid_map_costmap_2d/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ catkin_package(
## Specify additional locations of header files
include_directories(
include
${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
SYSTEM
${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
)

#############
Expand Down Expand Up @@ -74,14 +75,14 @@ if(TARGET ${PROJECT_NAME}-test)
target_link_libraries(${PROJECT_NAME}-test ${catkin_LIBRARIES})
endif()

##################
# Code_coverage ##
##################
###################
## Code_coverage ##
###################

find_package(cmake_code_coverage QUIET)
if(cmake_code_coverage_FOUND)
add_gtest_coverage(
TEST_BUILD_TARGETS
${PROJECT_NAME}-test
)
endif(cmake_code_coverage_FOUND)
# find_package(cmake_code_coverage QUIET)
# if(cmake_code_coverage_FOUND)
# add_gtest_coverage(
# TEST_BUILD_TARGETS
# ${PROJECT_NAME}-test
# )
# endif(cmake_code_coverage_FOUND)
2 changes: 1 addition & 1 deletion grid_map_costmap_2d/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
<depend>grid_map_core</depend>
<depend>costmap_2d</depend>
<depend>tf</depend>
<test_depend>cmake_code_coverage</test_depend>
<!-- <test_depend>cmake_code_coverage</test_depend> -->
</package>
27 changes: 14 additions & 13 deletions grid_map_cv/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ catkin_package(
## Specify additional locations of header files
include_directories(
include
${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
SYSTEM
${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
)

## Declare a cpp library
Expand Down Expand Up @@ -105,14 +106,14 @@ if(TARGET ${PROJECT_NAME}-test)
target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
endif()

##################
# Code_coverage ##
##################

find_package(cmake_code_coverage QUIET)
if(cmake_code_coverage_FOUND)
add_gtest_coverage(
TEST_BUILD_TARGETS
${PROJECT_NAME}-test
)
endif(cmake_code_coverage_FOUND)
###################
## Code_coverage ##
###################

# find_package(cmake_code_coverage QUIET)
# if(cmake_code_coverage_FOUND)
# add_gtest_coverage(
# TEST_BUILD_TARGETS
# ${PROJECT_NAME}-test
# )
# endif(cmake_code_coverage_FOUND)
2 changes: 1 addition & 1 deletion grid_map_cv/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<depend>grid_map_core</depend>
<depend>cv_bridge</depend>
<depend>filters</depend>
<test_depend>cmake_code_coverage</test_depend>
<!-- <test_depend>cmake_code_coverage</test_depend> -->
<export>
<filters plugin="${prefix}/filter_plugins.xml" />
</export>
Expand Down
36 changes: 36 additions & 0 deletions grid_map_filters/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,39 @@ install(
FILES filter_plugins.xml
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)

#############
## Testing ##
#############

if (CATKIN_ENABLE_TESTING)
find_package(catkin REQUIRED)

include_directories(
include
SYSTEM
${catkin_INCLUDE_DIRS}
${TBB_INCLUDE_DIRS}
)

catkin_add_gtest(${PROJECT_NAME}-test
test/test_grid_map_filters.cpp
)

target_link_libraries(${PROJECT_NAME}-test
${PROJECT_NAME}
)
endif()


###################
## Code_coverage ##
###################

# find_package(cmake_code_coverage QUIET)
# if(cmake_code_coverage_FOUND)
# add_gtest_coverage(
# TEST_BUILD_TARGETS
# ${PROJECT_NAME}-test
# )
# endif(cmake_code_coverage_FOUND)
2 changes: 1 addition & 1 deletion grid_map_filters/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<depend>grid_map_msgs</depend>
<depend>filters</depend>
<depend>tbb</depend>

<!-- <test_depend>cmake_code_coverage</test_depend> -->
<export>
<filters plugin="${prefix}/filter_plugins.xml" />
</export>
Expand Down
10 changes: 10 additions & 0 deletions grid_map_filters/test/test_grid_map_filters.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

#include <gtest/gtest.h>

using ::testing::InitGoogleTest;

int main(int argc, char** argv) {
InitGoogleTest(&argc, argv);

return RUN_ALL_TESTS();
}
36 changes: 34 additions & 2 deletions grid_map_loader/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ catkin_package(
## Your package locations should be listed before other locations
include_directories(
include
${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
SYSTEM
${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
)

## Declare a cpp executable
Expand Down Expand Up @@ -66,3 +67,34 @@ install(
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

#############
## Testing ##
#############

if (CATKIN_ENABLE_TESTING)
find_package(catkin REQUIRED)

include_directories(
include
SYSTEM
${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIRS}
)

catkin_add_gtest(${PROJECT_NAME}-test
test/test_grid_map_loader.cpp
)
endif()


###################
## Code_coverage ##
###################

# find_package(cmake_code_coverage QUIET)
# if(cmake_code_coverage_FOUND)
# add_gtest_coverage(
# TEST_BUILD_TARGETS
# ${PROJECT_NAME}-test
# )
# endif(cmake_code_coverage_FOUND)
1 change: 1 addition & 0 deletions grid_map_loader/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
<depend>roscpp</depend>
<depend>grid_map_ros</depend>
<depend>grid_map_msgs</depend>
<!-- <test_depend>cmake_code_coverage</test_depend> -->
</package>
10 changes: 10 additions & 0 deletions grid_map_loader/test/test_grid_map_loader.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

#include <gtest/gtest.h>

using ::testing::InitGoogleTest;

int main(int argc, char** argv) {
InitGoogleTest(&argc, argv);

return RUN_ALL_TESTS();
}
32 changes: 17 additions & 15 deletions grid_map_octomap/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,16 @@ if(${octomap_VERSION} VERSION_LESS 1.8) # ROS Indigo and Jade.
add_definitions(-DOCTOMAP_VERSION_BEFORE_ROS_KINETIC)
include_directories(
include
${catkin_INCLUDE_DIRS}
${OCTOMAP_INCLUDE_DIR}
SYSTEM
${catkin_INCLUDE_DIRS}
${OCTOMAP_INCLUDE_DIR}
)
else() # ROS Kinetic and above.
include_directories(
include
${catkin_INCLUDE_DIRS}
${OCTOMAP_INCLUDE_DIRS}
SYSTEM
${catkin_INCLUDE_DIRS}
${OCTOMAP_INCLUDE_DIRS}
)
endif()

Expand Down Expand Up @@ -104,14 +106,14 @@ if(TARGET ${PROJECT_NAME}-test)
)
endif()

##################
# Code_coverage ##
##################

find_package(cmake_code_coverage QUIET)
if(cmake_code_coverage_FOUND)
add_gtest_coverage(
TEST_BUILD_TARGETS
${PROJECT_NAME}-test
)
endif(cmake_code_coverage_FOUND)
###################
## Code_coverage ##
###################

# find_package(cmake_code_coverage QUIET)
# if(cmake_code_coverage_FOUND)
# add_gtest_coverage(
# TEST_BUILD_TARGETS
# ${PROJECT_NAME}-test
# )
# endif(cmake_code_coverage_FOUND)
2 changes: 1 addition & 1 deletion grid_map_octomap/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
<buildtool_depend>catkin</buildtool_depend>
<depend>grid_map_core</depend>
<depend>octomap</depend>
<test_depend>cmake_code_coverage</test_depend>
<!-- <test_depend>cmake_code_coverage</test_depend> -->
</package>
22 changes: 11 additions & 11 deletions grid_map_pcl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,14 @@ if(TARGET ${PROJECT_NAME}-test)
${catkin_LIBRARIES})
endif()

##################
# Code_coverage ##
##################

find_package(cmake_code_coverage QUIET)
if(cmake_code_coverage_FOUND)
add_gtest_coverage(
TEST_BUILD_TARGETS
${PROJECT_NAME}-test
)
endif(cmake_code_coverage_FOUND)
###################
## Code_coverage ##
###################

# find_package(cmake_code_coverage QUIET)
# if(cmake_code_coverage_FOUND)
# add_gtest_coverage(
# TEST_BUILD_TARGETS
# ${PROJECT_NAME}-test
# )
# endif(cmake_code_coverage_FOUND)
2 changes: 1 addition & 1 deletion grid_map_pcl/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
<depend>pcl_ros</depend>
<depend>roscpp</depend>
<depend>yaml-cpp</depend>
<test_depend>cmake_code_coverage</test_depend>
<!-- <test_depend>cmake_code_coverage</test_depend> -->
</package>
27 changes: 14 additions & 13 deletions grid_map_ros/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ catkin_package(
## Specify additional locations of header files
include_directories(
include
${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
SYSTEM
${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
)

## Declare a cpp library
Expand Down Expand Up @@ -114,14 +115,14 @@ if(TARGET ${PROJECT_NAME}-test)
target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
endif()

##################
# Code_coverage ##
##################

find_package(cmake_code_coverage QUIET)
if(cmake_code_coverage_FOUND)
add_gtest_coverage(
TEST_BUILD_TARGETS
${PROJECT_NAME}-test
)
endif(cmake_code_coverage_FOUND)
###################
## Code_coverage ##
###################

# find_package(cmake_code_coverage QUIET)
# if(cmake_code_coverage_FOUND)
# add_gtest_coverage(
# TEST_BUILD_TARGETS
# ${PROJECT_NAME}-test
# )
# endif(cmake_code_coverage_FOUND)
Loading

0 comments on commit 3517962

Please sign in to comment.