Skip to content

Commit

Permalink
Replace IDYNTREE_COMPILE_TESTS with standard CMake variable BUILD_TES…
Browse files Browse the repository at this point in the history
…TING
  • Loading branch information
traversaro authored Mar 22, 2024
1 parent d6af7ff commit 0aebfb8
Show file tree
Hide file tree
Showing 21 changed files with 32 additions and 32 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ jobs:
run: |
mkdir build
cd build
cmake -GNinja -DCMAKE_INSTALL_PREFIX=${CONDA_CXX_LIBRARIES_INSTALL_PREFIX} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DMATLAB_FIND_DEBUG:BOOL=ON -DIDYNTREE_USES_MATLAB:BOOL=ON -DMatlab_ROOT_DIR=${GHA_Matlab_ROOT_DIR} -DMatlab_MEX_EXTENSION:STRING=${GHA_Matlab_MEX_EXTENSION} -DIDYNTREE_DISABLE_MATLAB_TESTS:BOOL=ON -DIDYNTREE_COMPILE_TESTS:BOOL=ON -DIDYNTREE_USES_ASSIMP:BOOL=ON -DIDYNTREE_USES_IPOPT:BOOL=ON -DIDYNTREE_USES_IRRLICHT:BOOL=ON -DIDYNTREE_USES_YARP:BOOL=ON -DIDYNTREE_USES_ICUB_MAIN:BOOL=ON -DIDYNTREE_USES_OSQPEIGEN:BOOL=ON -DIDYNTREE_USES_PYTHON:BOOL=ON -DIDYNTREE_USES_PYTHON_PYBIND11:BOOL=ON ..
cmake -GNinja -DCMAKE_INSTALL_PREFIX=${CONDA_CXX_LIBRARIES_INSTALL_PREFIX} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DMATLAB_FIND_DEBUG:BOOL=ON -DIDYNTREE_USES_MATLAB:BOOL=ON -DMatlab_ROOT_DIR=${GHA_Matlab_ROOT_DIR} -DMatlab_MEX_EXTENSION:STRING=${GHA_Matlab_MEX_EXTENSION} -DIDYNTREE_DISABLE_MATLAB_TESTS:BOOL=ON -DBUILD_TESTING:BOOL=ON -DIDYNTREE_USES_ASSIMP:BOOL=ON -DIDYNTREE_USES_IPOPT:BOOL=ON -DIDYNTREE_USES_IRRLICHT:BOOL=ON -DIDYNTREE_USES_YARP:BOOL=ON -DIDYNTREE_USES_ICUB_MAIN:BOOL=ON -DIDYNTREE_USES_OSQPEIGEN:BOOL=ON -DIDYNTREE_USES_PYTHON:BOOL=ON -DIDYNTREE_USES_PYTHON_PYBIND11:BOOL=ON ..
- name: Build [Conda]
shell: bash -l {0}
Expand Down Expand Up @@ -244,7 +244,7 @@ jobs:
run: |
mkdir -p build
cd build
cmake -DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install/deps -DIDYNTREE_COMPILE_TESTS:BOOL=ON -DIDYNTREE_USES_YARP:BOOL=ON \
cmake -DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install/deps -DBUILD_TESTING:BOOL=ON -DIDYNTREE_USES_YARP:BOOL=ON \
-DIDYNTREE_USES_ICUB_MAIN:BOOL=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DIDYNTREE_USES_ASSIMP:BOOL=ON \
-DIDYNTREE_USES_MATLAB:BOOL=ON -DMatlab_ROOT_DIR=${GHA_Matlab_ROOT_DIR} -DMatlab_MEX_EXTENSION:STRING=${GHA_Matlab_MEX_EXTENSION} -DIDYNTREE_DISABLE_MATLAB_TESTS:BOOL=ON \
-DIDYNTREE_USES_IPOPT:BOOL=ON -DIDYNTREE_USES_PYTHON:BOOL=ON -DIDYNTREE_RUN_VALGRIND_TESTS:BOOL=ON -DIDYNTREE_USES_OCTAVE:BOOL=ON -DIDYNTREE_USES_IRRLICHT:BOOL=ON -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install ..
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/matlab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ jobs:
run: |
mkdir build
cd build
cmake -GNinja -DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DMATLAB_FIND_DEBUG:BOOL=ON -DIDYNTREE_USES_MATLAB:BOOL=ON -DIDYNTREE_COMPILE_TESTS:BOOL=ON -DIDYNTREE_USES_ASSIMP:BOOL=ON -DIDYNTREE_USES_IPOPT:BOOL=ON -DIDYNTREE_USES_IRRLICHT:BOOL=ON -DIDYNTREE_USES_YARP:BOOL=OFF -DIDYNTREE_USES_ICUB_MAIN:BOOL=OFF -DIDYNTREE_USES_OSQPEIGEN:BOOL=ON ..
cmake -GNinja -DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DMATLAB_FIND_DEBUG:BOOL=ON -DIDYNTREE_USES_MATLAB:BOOL=ON -DBUILD_TESTING:BOOL=ON -DIDYNTREE_USES_ASSIMP:BOOL=ON -DIDYNTREE_USES_IPOPT:BOOL=ON -DIDYNTREE_USES_IRRLICHT:BOOL=ON -DIDYNTREE_USES_YARP:BOOL=OFF -DIDYNTREE_USES_ICUB_MAIN:BOOL=OFF -DIDYNTREE_USES_OSQPEIGEN:BOOL=ON ..
- name: Configure [Conda - Windows]
if: contains(matrix.os, 'windows')
run: |
mkdir build
cd build
cmake -G"Visual Studio 16 2019" -DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX}/Library -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DMATLAB_FIND_DEBUG:BOOL=ON -DIDYNTREE_USES_MATLAB:BOOL=ON -DIDYNTREE_COMPILE_TESTS:BOOL=ON -DIDYNTREE_USES_ASSIMP:BOOL=ON -DIDYNTREE_USES_IPOPT:BOOL=ON -DIDYNTREE_USES_IRRLICHT:BOOL=ON -DIDYNTREE_USES_YARP:BOOL=OFF -DIDYNTREE_USES_ICUB_MAIN:BOOL=OFF -DIDYNTREE_USES_OSQPEIGEN:BOOL=ON ..
cmake -G"Visual Studio 16 2019" -DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX}/Library -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DMATLAB_FIND_DEBUG:BOOL=ON -DIDYNTREE_USES_MATLAB:BOOL=ON -DBUILD_TESTING:BOOL=ON -DIDYNTREE_USES_ASSIMP:BOOL=ON -DIDYNTREE_USES_IPOPT:BOOL=ON -DIDYNTREE_USES_IRRLICHT:BOOL=ON -DIDYNTREE_USES_YARP:BOOL=OFF -DIDYNTREE_USES_ICUB_MAIN:BOOL=OFF -DIDYNTREE_USES_OSQPEIGEN:BOOL=ON ..
- name: Build
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ sure that proposed changes in the library do not cause regression. In particular
[GitHub Actions](https://travis-ci.org/robotology/idyntree) for Continuous Integration on Linux, macOS and Windows.

In all this build systems the compilation of the tests is enabled by setting to true
the `IDYNTREE_COMPILE_TESTS` CMake flag.
the `BUILD_TESTING` CMake flag.

Almost all the dependencies are enabled in the Linux build.
Furthermore on Linux builds the `IDYNTREE_RUN_VALGRIND_TESTS` flag is enabled, to
Expand Down
2 changes: 1 addition & 1 deletion bindings/matlab/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,6 @@ if(IDYNTREE_USES_OCTAVE)
endif()

# if compile tests compile also matlab/octave tests
if(IDYNTREE_COMPILE_TESTS)
if(BUILD_TESTING)
add_subdirectory(tests)
endif()
2 changes: 1 addition & 1 deletion bindings/pybind11/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ set_target_properties(pybind11_idyntree PROPERTIES
OUTPUT_NAME "pybind")

# if compile tests execute also python tests
if(IDYNTREE_COMPILE_TESTS)
if(BUILD_TESTING)
add_subdirectory(tests)
endif()

Expand Down
2 changes: 1 addition & 1 deletion bindings/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ install(
add_subdirectory(scripts)

# if compile tests execute also python tests
if(IDYNTREE_COMPILE_TESTS)
if(BUILD_TESTING)
add_subdirectory(tests)
endif()
4 changes: 2 additions & 2 deletions cmake/iDynTreeOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ option(CMAKE_POSITION_INDEPENDENT_CODE "When compiling static libraries generate

#########################################################################
# Turn on testing.
option(IDYNTREE_COMPILE_TESTS "Compile iDynTree tests" FALSE)
option(BUILD_TESTING "Compile iDynTree tests" FALSE)
option(IDYNTREE_RUN_VALGRIND_TESTS "Run iDynTree tests with Valgrind" FALSE)
mark_as_advanced(IDYNTREE_RUN_VALGRIND_TESTS)
if(IDYNTREE_COMPILE_TESTS)
if(BUILD_TESTING)
include( CTest )
enable_testing()

Expand Down
4 changes: 2 additions & 2 deletions doc/dev/faqs.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ class is used a lot. Please check [Eigen documentation](https://eigen.tuxfamily.

## How to run the tests
iDynTree uses tests to prevent regressions caused by modification in the source code of the library.
To compile and run the test locally, enable the `IDYNTREE_COMPILE_TESTS` CMake option and then compile
To compile and run the test locally, enable the `BUILD_TESTING` CMake option and then compile
iDynTree as usual. Once you have compiled the library, run the `ctest` program from the build directory
to run all the tests. If you enabled the compilation of MATLAB bindings using the `IDYNTREE_USES_MATLAB` options,
test validating the functionality of the MATLAB interface will be automatically run.

## How to run the Valgrind-based tests
[Valgrind MemCheck](http://valgrind.org/) is a tool to identify memory related software bugs (use of initialize memory, memory leaks, ...). To automatically run the iDynTree test suite under Valgrind, just enabled the `IDYNTREE_RUN_VALGRIND_TESTS` CMake option (together with the `IDYNTREE_COMPILE_TESTS` option).
[Valgrind MemCheck](http://valgrind.org/) is a tool to identify memory related software bugs (use of initialize memory, memory leaks, ...). To automatically run the iDynTree test suite under Valgrind, just enabled the `IDYNTREE_RUN_VALGRIND_TESTS` CMake option (together with the `BUILD_TESTING` option).

## What are the things that needs to be done before merging a pull request?
* Check if the GitHub Actions jobs compiles and run the test without any failure.
Expand Down
2 changes: 1 addition & 1 deletion extern/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# framework for Matlab and Octave, it is only included if testing
# is enabled in Matlab or Octave
if( (IDYNTREE_USES_OCTAVE OR IDYNTREE_USES_MATLAB OR IDYNTREE_GENERATE_MATLAB) AND
IDYNTREE_COMPILE_TESTS )
BUILD_TESTING )
# We save the location of MOxUnit in a variable that is then accessible to the test
set(IDYNTREE_INTERNAL_MOXUNIT_PATH "${CMAKE_CURRENT_LIST_DIR}/MOxUnit/MOxUnit" PARENT_SCOPE)
endif()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
cmake_configure_options=[
"-DBUILD_SHARED_LIBS:BOOL=OFF",
"-DIDYNTREE_USES_PYTHON:BOOL=ON",
"-DIDYNTREE_COMPILE_TESTS:BOOL=OFF",
"-DBUILD_TESTING:BOOL=OFF",
"-DIDYNTREE_PACKAGE_FOR_PYPI:BOOL=ON",
"-DIDYNTREE_USES_IPOPT:BOOL=OFF",
"-DIDYNTREE_USES_ASSIMP:BOOL=OFF",
Expand Down
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# include test data before everything,
# to be sure that is available to test
# of all components
if(IDYNTREE_COMPILE_TESTS)
if(BUILD_TESTING)
add_subdirectory(tests/data)
endif()

Expand Down Expand Up @@ -34,6 +34,6 @@ if(IDYNTREE_COMPILES_TOOLS)
add_subdirectory(tools)
endif()

if(IDYNTREE_COMPILE_TESTS)
if(BUILD_TESTING)
add_subdirectory(tests)
endif()
4 changes: 2 additions & 2 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,6 @@ set_property(GLOBAL APPEND PROPERTY ${VARS_PREFIX}_TARGETS ${libraryname})
install(DIRECTORY include/iDynTree/Core
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/iDynTree)

if(IDYNTREE_COMPILE_TESTS)
if(BUILD_TESTING)
add_subdirectory(tests)
endif(IDYNTREE_COMPILE_TESTS)
endif(BUILD_TESTING)
4 changes: 2 additions & 2 deletions src/estimation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,6 @@ endif()
install(DIRECTORY include/iDynTree/Estimation
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/iDynTree)

if(IDYNTREE_COMPILE_TESTS)
if(BUILD_TESTING)
add_subdirectory(tests)
endif(IDYNTREE_COMPILE_TESTS)
endif(BUILD_TESTING)
4 changes: 2 additions & 2 deletions src/high-level/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ install(TARGETS ${libraryname}

set_property(GLOBAL APPEND PROPERTY ${VARS_PREFIX}_TARGETS ${libraryname})

if(IDYNTREE_COMPILE_TESTS)
if(BUILD_TESTING)
add_subdirectory(tests)
endif(IDYNTREE_COMPILE_TESTS)
endif(BUILD_TESTING)

2 changes: 1 addition & 1 deletion src/inverse-kinematics/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ install(TARGETS ${libraryname}
set_property(GLOBAL APPEND PROPERTY ${VARS_PREFIX}_TARGETS ${libraryname})


if(IDYNTREE_COMPILE_TESTS AND IDYNTREE_USES_IPOPT)
if(BUILD_TESTING AND IDYNTREE_USES_IPOPT)
add_subdirectory(tests)
endif()

4 changes: 2 additions & 2 deletions src/model/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ install(TARGETS ${libraryname}

set_property(GLOBAL APPEND PROPERTY ${VARS_PREFIX}_TARGETS ${libraryname})

if(IDYNTREE_COMPILE_TESTS)
if(BUILD_TESTING)
add_subdirectory(tests)
endif(IDYNTREE_COMPILE_TESTS)
endif(BUILD_TESTING)

# Add deprecated target iDynTree::idyntree-sensors
add_library(idyntree-sensors INTERFACE)
Expand Down
4 changes: 2 additions & 2 deletions src/model_io/codecs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ install(TARGETS ${libraryname}

set_property(GLOBAL APPEND PROPERTY ${VARS_PREFIX}_TARGETS ${libraryname})

if(IDYNTREE_COMPILE_TESTS)
if(BUILD_TESTING)
add_subdirectory(tests)
endif(IDYNTREE_COMPILE_TESTS)
endif(BUILD_TESTING)


# Install deprecated headers
Expand Down
4 changes: 2 additions & 2 deletions src/model_io/xml/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ install(TARGETS ${libraryname}

set_property(GLOBAL APPEND PROPERTY ${VARS_PREFIX}_TARGETS ${libraryname})

if(IDYNTREE_COMPILE_TESTS)
if(BUILD_TESTING)
add_subdirectory(tests)
endif(IDYNTREE_COMPILE_TESTS)
endif(BUILD_TESTING)
2 changes: 1 addition & 1 deletion src/optimalcontrol/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,6 @@ install(FILES ${OCSOLVERS_PUBLIC_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR

set_property(GLOBAL APPEND PROPERTY ${VARS_PREFIX}_TARGETS ${libraryname})

if(IDYNTREE_COMPILE_TESTS)
if(BUILD_TESTING)
add_subdirectory(tests)
endif()
2 changes: 1 addition & 1 deletion src/solid-shapes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ install(TARGETS ${libraryname}

set_property(GLOBAL APPEND PROPERTY ${VARS_PREFIX}_TARGETS ${libraryname})

if(IDYNTREE_COMPILE_TESTS AND IDYNTREE_USES_ASSIMP)
if(BUILD_TESTING AND IDYNTREE_USES_ASSIMP)
add_subdirectory(tests)
endif()
2 changes: 1 addition & 1 deletion src/visualization/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,6 @@ install(TARGETS ${libraryname}

set_property(GLOBAL APPEND PROPERTY ${VARS_PREFIX}_TARGETS ${libraryname})

if(IDYNTREE_COMPILE_TESTS AND IDYNTREE_USES_IRRLICHT)
if(BUILD_TESTING AND IDYNTREE_USES_IRRLICHT)
add_subdirectory(tests)
endif()

0 comments on commit 0aebfb8

Please sign in to comment.