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

Unit tests CMake and Travis refactoring #1786

Merged
merged 2 commits into from
May 30, 2017
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
457 changes: 250 additions & 207 deletions .travis.sh

Large diffs are not rendered by default.

31 changes: 21 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,27 @@ env:
- secure: PZivWbaCWFA2BFFY8n3UMxdEWjz7rBh568u9LF5LH3HgWADnfiwWzNriACqX9fhe7tSmDru5Bk978s+xPPAY9v24cfiDEX5a5MQ/XVr2rP48n3vlUDWERDhIodJ73F9F9GGZXToGdNz0MBUAHgiv7Lb0GYUfmOYzUJjWghngLBw=
matrix:
include:
- compiler: clang
env: TASK="build-examples"
- compiler: clang
env: TASK="build-tools"
- compiler: clang
env: TASK="build-apps"
- compiler: gcc
env: TASK="test"
- env: TASK="doc"
env: TASK="test-core"
- compiler: gcc
env: TASK="test-ext-1"
- compiler: gcc
env: TASK="test-ext-2"
- compiler: gcc
env: TASK="doc"
addons:
apt:
sources:
- kalakris-cmake
- boost-latest
- kubuntu-backports
- sourceline: 'ppa:kedazo/doxygen-updates-precise'
packages:
- cmake
- libboost1.55-all-dev
Expand All @@ -49,13 +61,12 @@ addons:
- doxygen-latex
- dvipng
- libusb-1.0-0-dev
cache:
directories:
- $HOME/flann
- $HOME/vtk
- $HOME/qhull
- $HOME/doxygen
before_install:
- bash .travis.sh install
- libqhull-dev
- libvtk5-dev
- libflann-dev
- doxygen
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This brings us an ancient version of Doxygen from 2011 (1.7.6 to be precise). Apart from gazillion bug fixes, one useful feature that is missing there is Markdown support. Back in the day I even made a PR (#526) to get a newer version. I'm not sure how much of PCL docstrings are actually written with Markdown, but the fact that I made that request suggests that there are at least some.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks exactly like the solution we need. Doxygen packages backported for Precise. It will bump the version to 1.8.8 which already has markdown support.

- libqt4-dev
- libvtk5-qt4-dev
- libglew-dev
script:
- bash .travis.sh $TASK
14 changes: 14 additions & 0 deletions cmake/pcl_targets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ macro(PCL_SUBSYS_DEPEND _var _name)
endif(NOT ${EXT_DEP_FOUND} OR (NOT (${EXT_DEP_FOUND} STREQUAL "TRUE")))
endforeach(_dep)
endif(SUBSYS_EXT_DEPS)
if(SUBSYS_OPT_DEPS)
foreach(_dep ${SUBSYS_OPT_DEPS})
PCL_GET_SUBSYS_INCLUDE_DIR(_include_dir ${_dep})
include_directories(${PROJECT_SOURCE_DIR}/${_include_dir}/include)
endforeach(_dep)
endif(SUBSYS_OPT_DEPS)
endif(${_var} AND (NOT ("${subsys_status}" STREQUAL "AUTO_OFF")))
endmacro(PCL_SUBSYS_DEPEND)

Expand Down Expand Up @@ -862,3 +868,11 @@ macro(PCL_ADD_GRABBER_DEPENDENCY _name _description)
endif()
endif()
endmacro(PCL_ADD_GRABBER_DEPENDENCY)

###############################################################################
# Set the dependencies for a specific test module on the provided variable
# _var The variable to be filled with the dependencies
# _module The module name
macro(PCL_SET_TEST_DEPENDENCIES _var _module)
set(${_var} global_tests ${_module} ${PCL_SUBSYS_DEPS_${_module}})
endmacro(PCL_SET_TEST_DEPENDENCIES)
4 changes: 3 additions & 1 deletion io/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ if(build)
)
PCL_ADD_LIBRARY(pcl_io_ply "${SUBSYS_NAME}" ${PLY_SOURCES} ${PLY_INCLUDES})
PCL_ADD_INCLUDES("${SUBSYS_NAME}" "${SUBSYS_NAME}/ply" ${PLY_INCLUDES})
target_include_directories(pcl_io_ply PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")


set(srcs
src/debayer.cpp
Expand Down Expand Up @@ -316,9 +318,9 @@ if(build)

set(LIB_NAME "pcl_${SUBSYS_NAME}")

include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include" ${VTK_INCLUDE_DIRECTORIES})
add_definitions(${VTK_DEFINES})
PCL_ADD_LIBRARY("${LIB_NAME}" "${SUBSYS_NAME}" ${srcs} ${incs} ${compression_incs} ${impl_incs} ${OPENNI_INCLUDES} ${OPENNI2_INCLUDES})
target_include_directories(${LIB_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ${VTK_INCLUDE_DIRECTORIES})
link_directories(${VTK_LINK_DIRECTORIES})
target_link_libraries("${LIB_NAME}" pcl_common pcl_io_ply ${VTK_LIBRARIES} )
if(PNG_FOUND)
Expand Down
2 changes: 1 addition & 1 deletion octree/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ if(build)
)

set(LIB_NAME "pcl_${SUBSYS_NAME}")
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include")
PCL_ADD_LIBRARY("${LIB_NAME}" "${SUBSYS_NAME}" ${srcs} ${incs} ${impl_incs})
target_link_libraries("${LIB_NAME}")
target_include_directories(${LIB_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
PCL_MAKE_PKGCONFIG("${LIB_NAME}" "${SUBSYS_NAME}" "${SUBSYS_DESC}"
"${SUBSYS_DEPS}" "" "" "" "")

Expand Down
40 changes: 27 additions & 13 deletions test/2d/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
PCL_ADD_TEST(test_2d test_2d FILES test_2d.cpp
LINK_WITH pcl_io pcl_gtest
ARGUMENTS "${PCL_SOURCE_DIR}/test/2d/lena.pcd"
"${PCL_SOURCE_DIR}/test/2d/gauss_smooth.pcd"
"${PCL_SOURCE_DIR}/test/2d/erosion.pcd"
"${PCL_SOURCE_DIR}/test/2d/dilation.pcd"
"${PCL_SOURCE_DIR}/test/2d/opening.pcd"
"${PCL_SOURCE_DIR}/test/2d/closing.pcd"
"${PCL_SOURCE_DIR}/test/2d/erosion_binary.pcd"
"${PCL_SOURCE_DIR}/test/2d/dilation_binary.pcd"
"${PCL_SOURCE_DIR}/test/2d/opening_binary.pcd"
"${PCL_SOURCE_DIR}/test/2d/closing_binary.pcd"
"${PCL_SOURCE_DIR}/test/2d/canny.pcd")
set(SUBSYS_NAME tests_2d)
set(SUBSYS_DESC "Point cloud library 2d module unit tests")
PCL_SET_TEST_DEPENDENCIES(SUBSYS_DEPS 2d)


set(OPT_DEPS)

set(DEFAULT ON)
set(build TRUE)
PCL_SUBSYS_OPTION(build "${SUBSYS_NAME}" "${SUBSYS_DESC}" ${DEFAULT} "${REASON}")
PCL_SUBSYS_DEPEND(build "${SUBSYS_NAME}" DEPS ${SUBSYS_DEPS} OPT_DEPS ${OPT_DEPS})

if(build)
PCL_ADD_TEST(test_2d test_2d FILES test_2d.cpp
LINK_WITH pcl_io pcl_gtest
ARGUMENTS "${PCL_SOURCE_DIR}/test/2d/lena.pcd"
"${PCL_SOURCE_DIR}/test/2d/gauss_smooth.pcd"
"${PCL_SOURCE_DIR}/test/2d/erosion.pcd"
"${PCL_SOURCE_DIR}/test/2d/dilation.pcd"
"${PCL_SOURCE_DIR}/test/2d/opening.pcd"
"${PCL_SOURCE_DIR}/test/2d/closing.pcd"
"${PCL_SOURCE_DIR}/test/2d/erosion_binary.pcd"
"${PCL_SOURCE_DIR}/test/2d/dilation_binary.pcd"
"${PCL_SOURCE_DIR}/test/2d/opening_binary.pcd"
"${PCL_SOURCE_DIR}/test/2d/closing_binary.pcd"
"${PCL_SOURCE_DIR}/test/2d/canny.pcd")
endif(build)
57 changes: 4 additions & 53 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
set(SUBSYS_NAME global_tests)
set(SUBSYS_DESC "Point cloud library global unit tests")

if(BUILD_visualization)
include("${VTK_USE_FILE}")
set(SUBSYS_DEPS 2d common sample_consensus io kdtree features filters geometry keypoints search surface registration segmentation octree recognition people outofcore visualization)
set(OPT_DEPS vtk)
else()
set(SUBSYS_DEPS 2d common sample_consensus io kdtree features filters geometry keypoints search surface registration segmentation octree recognition people outofcore)
endif()

set(DEFAULT OFF)
set(build TRUE)
PCL_SUBSYS_OPTION(build "${SUBSYS_NAME}" "${SUBSYS_DESC}" ${DEFAULT} "${REASON}")
Expand All @@ -26,8 +18,6 @@ if(build)
endif()

enable_testing()
include_directories(${PCL_INCLUDE_DIRS})

add_custom_target(tests "${CMAKE_CTEST_COMMAND}" "-V" VERBATIM)

add_subdirectory(2d)
Expand All @@ -37,55 +27,16 @@ if(build)
add_subdirectory(geometry)
add_subdirectory(io)
add_subdirectory(kdtree)
add_subdirectory(keypoints)
add_subdirectory(people)
add_subdirectory(octree)
add_subdirectory(outofcore)
add_subdirectory(recognition)
add_subdirectory(registration)
add_subdirectory(search)
add_subdirectory(keypoints)
add_subdirectory(surface)
add_subdirectory(segmentation)
add_subdirectory(sample_consensus)

PCL_ADD_TEST(a_recognition_ism_test test_recognition_ism
FILES test_recognition_ism.cpp
LINK_WITH pcl_gtest pcl_io pcl_features
ARGUMENTS "${PCL_SOURCE_DIR}/test/ism_train.pcd" "${PCL_SOURCE_DIR}/test/ism_test.pcd")

PCL_ADD_TEST(search test_search
FILES test_search.cpp
LINK_WITH pcl_gtest pcl_search pcl_io pcl_kdtree
ARGUMENTS "${PCL_SOURCE_DIR}/test/table_scene_mug_stereo_textured.pcd")

PCL_ADD_TEST(a_transforms_test test_transforms
FILES test_transforms.cpp
LINK_WITH pcl_gtest pcl_io
ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd")

PCL_ADD_TEST(a_segmentation_test test_segmentation
FILES test_segmentation.cpp
LINK_WITH pcl_gtest pcl_io pcl_segmentation pcl_features pcl_kdtree pcl_search pcl_common
ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd" "${PCL_SOURCE_DIR}/test/car6.pcd" "${PCL_SOURCE_DIR}/test/colored_cloud.pcd")

PCL_ADD_TEST(test_non_linear test_non_linear
FILES test_non_linear.cpp
LINK_WITH pcl_gtest pcl_common pcl_io pcl_sample_consensus pcl_segmentation pcl_kdtree pcl_search
ARGUMENTS "${PCL_SOURCE_DIR}/test/noisy_slice_displaced.pcd")

PCL_ADD_TEST(a_recognition_cg_test test_recognition_cg
FILES test_recognition_cg.cpp
LINK_WITH pcl_gtest pcl_common pcl_io pcl_kdtree pcl_features pcl_recognition pcl_keypoints
ARGUMENTS "${PCL_SOURCE_DIR}/test/milk.pcd" "${PCL_SOURCE_DIR}/test/milk_cartoon_all_small_clorox.pcd")

PCL_ADD_TEST(a_people_detection_test test_people_detection
FILES test_people_groundBasedPeopleDetectionApp.cpp
LINK_WITH pcl_gtest pcl_common pcl_io pcl_kdtree pcl_search pcl_features pcl_sample_consensus pcl_filters pcl_io pcl_segmentation pcl_people
ARGUMENTS "${PCL_SOURCE_DIR}/people/data/trainedLinearSVMForPeopleDetectionWithHOG.yaml" "${PCL_SOURCE_DIR}/test/five_people.pcd")

if(BUILD_visualization AND (NOT UNIX OR (UNIX AND DEFINED ENV{DISPLAY})))
PCL_ADD_TEST(a_visualization_test test_visualization
FILES test_visualization.cpp
LINK_WITH pcl_gtest pcl_io pcl_visualization pcl_features
ARGUMENTS "${PCL_SOURCE_DIR}/test/bunny.pcd")
endif()
add_subdirectory(visualization)

endif(build)
57 changes: 0 additions & 57 deletions test/boost.h

This file was deleted.

61 changes: 40 additions & 21 deletions test/common/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,41 @@
# Args: name, executable_name
PCL_ADD_TEST(common_test_wrappers test_wrappers FILES test_wrappers.cpp LINK_WITH pcl_gtest pcl_common)
PCL_ADD_TEST(common_test_macros test_macros FILES test_macros.cpp LINK_WITH pcl_gtest pcl_common)
PCL_ADD_TEST(common_vector_average test_vector_average FILES test_vector_average.cpp LINK_WITH pcl_gtest)
PCL_ADD_TEST(common_common test_common FILES test_common.cpp LINK_WITH pcl_gtest pcl_common)
PCL_ADD_TEST(common_geometry test_geometry FILES test_geometry.cpp LINK_WITH pcl_gtest pcl_common)
PCL_ADD_TEST(common_copy_point test_copy_point FILES test_copy_point.cpp LINK_WITH pcl_gtest pcl_common)
PCL_ADD_TEST(common_centroid test_centroid FILES test_centroid.cpp LINK_WITH pcl_gtest pcl_common)
PCL_ADD_TEST(common_int test_plane_intersection FILES test_plane_intersection.cpp LINK_WITH pcl_gtest pcl_common)
PCL_ADD_TEST(common_pca test_pca FILES test_pca.cpp LINK_WITH pcl_gtest pcl_common)
#PCL_ADD_TEST(common_spring test_spring FILES test_spring.cpp LINK_WITH pcl_gtest pcl_common)
PCL_ADD_TEST(common_gaussian test_gaussian FILES test_gaussian.cpp LINK_WITH pcl_gtest pcl_common)
PCL_ADD_TEST(common_operators test_operators FILES test_operators.cpp LINK_WITH pcl_gtest pcl_common)
#PCL_ADD_TEST(common_convolution test_convolution FILES test_convolution.cpp LINK_WITH pcl_gtest pcl_common)
PCL_ADD_TEST(common_eigen test_eigen FILES test_eigen.cpp LINK_WITH pcl_gtest pcl_common)
PCL_ADD_TEST(common_intensity test_intensity FILES test_intensity.cpp LINK_WITH pcl_gtest pcl_common)
PCL_ADD_TEST(common_generator test_generator FILES test_generator.cpp LINK_WITH pcl_gtest pcl_common)
PCL_ADD_TEST(common_io test_common_io FILES test_io.cpp LINK_WITH pcl_gtest pcl_common)
PCL_ADD_TEST(common_copy_make_borders test_copy_make_borders FILES test_copy_make_borders.cpp LINK_WITH pcl_gtest pcl_common)
PCL_ADD_TEST(common_bearing_angle_image test_bearing_angle_image FILES test_bearing_angle_image.cpp LINK_WITH pcl_gtest pcl_common)
set(SUBSYS_NAME tests_common)
set(SUBSYS_DESC "Point cloud library common module unit tests")
PCL_SET_TEST_DEPENDENCIES(SUBSYS_DEPS common)
set(OPT_DEPS io features search kdtree octree)

PCL_ADD_TEST(common_point_type_conversion test_common_point_type_conversion FILES test_point_type_conversion.cpp LINK_WITH pcl_gtest pcl_common)
set(DEFAULT ON)
set(build TRUE)
PCL_SUBSYS_OPTION(build "${SUBSYS_NAME}" "${SUBSYS_DESC}" ${DEFAULT} "${REASON}")
PCL_SUBSYS_DEPEND(build "${SUBSYS_NAME}" DEPS ${SUBSYS_DEPS} OPT_DEPS ${OPT_DEPS})

if (build)
# Args: name, executable_name
PCL_ADD_TEST(common_test_wrappers test_wrappers FILES test_wrappers.cpp LINK_WITH pcl_gtest pcl_common)
PCL_ADD_TEST(common_test_macros test_macros FILES test_macros.cpp LINK_WITH pcl_gtest pcl_common)
PCL_ADD_TEST(common_vector_average test_vector_average FILES test_vector_average.cpp LINK_WITH pcl_gtest)
PCL_ADD_TEST(common_common test_common FILES test_common.cpp LINK_WITH pcl_gtest pcl_common)
PCL_ADD_TEST(common_geometry test_geometry FILES test_geometry.cpp LINK_WITH pcl_gtest pcl_common)
PCL_ADD_TEST(common_copy_point test_copy_point FILES test_copy_point.cpp LINK_WITH pcl_gtest pcl_common)
PCL_ADD_TEST(common_centroid test_centroid FILES test_centroid.cpp LINK_WITH pcl_gtest pcl_common)
PCL_ADD_TEST(common_int test_plane_intersection FILES test_plane_intersection.cpp LINK_WITH pcl_gtest pcl_common)
PCL_ADD_TEST(common_pca test_pca FILES test_pca.cpp LINK_WITH pcl_gtest pcl_common)
#PCL_ADD_TEST(common_spring test_spring FILES test_spring.cpp LINK_WITH pcl_gtest pcl_common)
PCL_ADD_TEST(common_gaussian test_gaussian FILES test_gaussian.cpp LINK_WITH pcl_gtest pcl_common)
PCL_ADD_TEST(common_operators test_operators FILES test_operators.cpp LINK_WITH pcl_gtest pcl_common)
#PCL_ADD_TEST(common_convolution test_convolution FILES test_convolution.cpp LINK_WITH pcl_gtest pcl_common)
PCL_ADD_TEST(common_eigen test_eigen FILES test_eigen.cpp LINK_WITH pcl_gtest pcl_common)
PCL_ADD_TEST(common_intensity test_intensity FILES test_intensity.cpp LINK_WITH pcl_gtest pcl_common)
PCL_ADD_TEST(common_generator test_generator FILES test_generator.cpp LINK_WITH pcl_gtest pcl_common)
PCL_ADD_TEST(common_io test_common_io FILES test_io.cpp LINK_WITH pcl_gtest pcl_common)
PCL_ADD_TEST(common_copy_make_borders test_copy_make_borders FILES test_copy_make_borders.cpp LINK_WITH pcl_gtest pcl_common)
PCL_ADD_TEST(common_bearing_angle_image test_bearing_angle_image FILES test_bearing_angle_image.cpp LINK_WITH pcl_gtest pcl_common)

PCL_ADD_TEST(common_point_type_conversion test_common_point_type_conversion FILES test_point_type_conversion.cpp LINK_WITH pcl_gtest pcl_common)

if (BUILD_io AND BUILD_features)
PCL_ADD_TEST(a_transforms_test test_transforms
FILES test_transforms.cpp
LINK_WITH pcl_gtest pcl_io
ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd")
endif (BUILD_io AND BUILD_features)
endif (build)
File renamed without changes.
Loading