From d7200cbb1b079b5d16e14500e67e25077746efb2 Mon Sep 17 00:00:00 2001 From: Marco Randazzo Date: Wed, 21 Sep 2022 14:21:20 +0200 Subject: [PATCH 01/16] CI transition from Ubuntu 20.04 to Ubuntu 22.04 --- .github/workflows/ci.yml | 58 ++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ea9f90a2ff..ddab067830 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: select_environment: name: 'Prepare Environment' - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 outputs: timestamp: ${{ steps.select.outputs.timestamp }} repository_owner: ${{ steps.select.outputs.repository_owner }} @@ -102,7 +102,7 @@ jobs: check-license: name: 'Check License' needs: select_environment - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Clone repository uses: actions/checkout@v3 @@ -123,7 +123,7 @@ jobs: check-style: name: 'Check Style' needs: select_environment - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Clone repository uses: actions/checkout@v3 @@ -165,7 +165,7 @@ jobs: run-cmake: name: 'Run CMake [CMake ${{ matrix.config.cmake_version }} (${{ matrix.config.cmake_generator }}), YCM ${{ matrix.config.ycm_version }}]' needs: [select_environment, check-license, check-style] - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 strategy: fail-fast: false matrix: @@ -290,7 +290,7 @@ jobs: config: - { id: '01', - os: ubuntu-20.04, + os: ubuntu-22.04, build_type: "Release", cc: "gcc", cxx: "g++", @@ -300,7 +300,7 @@ jobs: } - { id: '02', - os: ubuntu-20.04, + os: ubuntu-22.04, build_type: "Release", cc: "clang", cxx: "clang++", @@ -311,7 +311,7 @@ jobs: - { id: '03', description: 'No ACE', - os: ubuntu-20.04, + os: ubuntu-22.04, build_type: "Release", cc: "gcc", cxx: "g++", @@ -324,7 +324,7 @@ jobs: - { id: '04', description: 'No ACE', - os: ubuntu-20.04, + os: ubuntu-22.04, build_type: "Release", cc: "clang", cxx: "clang++", @@ -337,7 +337,7 @@ jobs: - { id: '05', description: 'No YARP_math (bindings disabled)', - os: ubuntu-20.04, + os: ubuntu-22.04, build_type: "Release", cc: "gcc", cxx: "g++", @@ -351,7 +351,7 @@ jobs: - { id: '06', description: 'No YARP_math (bindings disabled)', - os: ubuntu-20.04, + os: ubuntu-22.04, build_type: "Release", cc: "clang", cxx: "clang++", @@ -365,7 +365,7 @@ jobs: - { id: '07', description: 'CLEAN_API (unit tests and bindings disabled)', - os: ubuntu-20.04, + os: ubuntu-22.04, build_type: "Release", cc: "gcc", cxx: "g++", @@ -378,7 +378,7 @@ jobs: - { id: '08', description: 'CLEAN_API (unit tests and bindings disabled)', - os: ubuntu-20.04, + os: ubuntu-22.04, build_type: "Release", cc: "clang", cxx: "clang++", @@ -391,7 +391,7 @@ jobs: - { id: '09', description: 'Static', - os: ubuntu-20.04, + os: ubuntu-22.04, build_type: "Release", cc: "gcc", cxx: "g++", @@ -402,7 +402,7 @@ jobs: - { id: '10', description: 'Static', - os: ubuntu-20.04, + os: ubuntu-22.04, build_type: "Release", cc: "clang", cxx: "clang++", @@ -413,7 +413,7 @@ jobs: - { id: '11', description: 'Static, no ACE (bindings disabled)', - os: ubuntu-20.04, + os: ubuntu-22.04, build_type: "Release", cc: "gcc", cxx: "g++", @@ -427,7 +427,7 @@ jobs: - { id: '12', description: 'Static, no ACE (bindings disabled)', - os: ubuntu-20.04, + os: ubuntu-22.04, build_type: "Release", cc: "clang", cxx: "clang++", @@ -441,7 +441,7 @@ jobs: - { id: '13', description: 'No deprecated', - os: ubuntu-20.04, + os: ubuntu-22.04, build_type: "Release", cc: "gcc", cxx: "g++", @@ -452,7 +452,7 @@ jobs: - { id: '14', description: 'No deprecated', - os: ubuntu-20.04, + os: ubuntu-22.04, build_type: "Release", cc: "clang", cxx: "clang++", @@ -463,7 +463,7 @@ jobs: - { id: '15', description: 'No executables (unit tests disabled)', - os: ubuntu-20.04, + os: ubuntu-22.04, build_type: "Release", cc: "gcc", cxx: "g++", @@ -475,7 +475,7 @@ jobs: - { id: '16', description: 'No executables (unit tests disabled)', - os: ubuntu-20.04, + os: ubuntu-22.04, build_type: "Release", cc: "clang", cxx: "clang++", @@ -487,7 +487,7 @@ jobs: - { id: '17', description: 'Build extern dependencies', - os: ubuntu-20.04, + os: ubuntu-22.04, build_type: "Release", cc: "gcc", cxx: "g++", @@ -500,7 +500,7 @@ jobs: - { id: '18', description: 'Build extern dependencies', - os: ubuntu-20.04, + os: ubuntu-22.04, build_type: "Release", cc: "clang", cxx: "clang++", @@ -512,7 +512,7 @@ jobs: } - { id: '19', - os: ubuntu-20.04, + os: ubuntu-22.04, build_type: "Release", cc: "gcc", cxx: "g++", @@ -521,7 +521,7 @@ jobs: } - { id: '20', - os: ubuntu-20.04, + os: ubuntu-22.04, build_type: "Release", cc: "clang", cxx: "clang++", @@ -531,7 +531,7 @@ jobs: - { id: '21', description: 'Valgrind (bindings, failing tests, guis and examples as tests disabled)', - os: ubuntu-20.04, + os: ubuntu-22.04, build_type: "Debug", cc: "gcc", cxx: "g++", @@ -548,7 +548,7 @@ jobs: - { id: '22', description: 'Valgrind, No ACE (bindings, failing tests, guis and examples as tests disabled)', - os: ubuntu-20.04, + os: ubuntu-22.04, build_type: "Debug", cc: "gcc", cxx: "g++", @@ -1369,7 +1369,7 @@ jobs: environment: code-analysis name: 'Codacy - clang-tidy' needs: [select_environment, run-cmake] - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Clone repository uses: actions/checkout@v3 @@ -1557,7 +1557,7 @@ jobs: environment: code-analysis name: 'Codacy - coverage' needs: [select_environment, run-cmake] - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Clone repository uses: actions/checkout@v3 @@ -1689,7 +1689,7 @@ jobs: environment: code-analysis name: 'SonarCloud' needs: [select_environment, run-cmake] - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Clone repository uses: actions/checkout@v3 From 118471678685b31bdc88c71bd4b59a77f0f0b921 Mon Sep 17 00:00:00 2001 From: Marco Randazzo Date: Wed, 15 Nov 2023 22:00:08 +0100 Subject: [PATCH 02/16] removed support for cmake 3.16 --- .github/workflows/ci.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ddab067830..4c083d5b89 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -170,11 +170,6 @@ jobs: fail-fast: false matrix: config: - - { - cmake_version: "3.16.*", - cmake_generator: "Unix Makefiles", - ycm_version: "0.15.3", - } - { cmake_version: "3.17.*", cmake_generator: "Unix Makefiles", @@ -699,9 +694,12 @@ jobs: if: runner.os == 'Linux' shell: bash run: | + sudo apt-get update + # Install Robotology dependencies from robotology ppa sudo apt-add-repository -y ppa:robotology/ppa sudo apt-get install -qq -y librobottestingframework-dev + sudo apt-get update # Install cmake sudo apt-get install -qq -y cmake @@ -718,7 +716,7 @@ jobs: ninja-build \ valgrind - sudo apt-get install -y libace-dev \ + sudo apt-get install -y libace-dev sudo apt-get install -qq -y libsqlite3-dev \ libtinyxml-dev \ From 4112d0814b0cd7257cdc5bdae8c9de239eca8d47 Mon Sep 17 00:00:00 2001 From: Marco Randazzo Date: Thu, 16 Nov 2023 08:33:29 +0100 Subject: [PATCH 03/16] test --- .github/workflows/ci.yml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4c083d5b89..4d29c66be6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -696,6 +696,9 @@ jobs: run: | sudo apt-get update + sudo apt-get install libunwind-dev + + # Install Robotology dependencies from robotology ppa sudo apt-add-repository -y ppa:robotology/ppa sudo apt-get install -qq -y librobottestingframework-dev @@ -718,7 +721,7 @@ jobs: sudo apt-get install -y libace-dev - sudo apt-get install -qq -y libsqlite3-dev \ + sudo apt-get install -y libsqlite3-dev \ libtinyxml-dev \ libedit-dev \ qtbase5-dev \ @@ -729,8 +732,6 @@ jobs: libopencv-dev \ libeigen3-dev \ libgraphviz-dev \ - libgstreamer1.0-dev \ - libgstreamer-plugins-base1.0-dev \ libpng-dev \ libv4l-dev \ libavcodec-dev \ @@ -746,6 +747,9 @@ jobs: libpcl-dev \ libsoxr-dev + sudo apt-get install -y libgstreamer1.0-dev \ + libgstreamer-plugins-base1.0-dev + # Install SWIG and bindings dependencies sudo apt-get install -qq -y swig \ mono-mcs \ @@ -1381,6 +1385,8 @@ jobs: if: runner.os == 'Linux' shell: bash run: | + sudo apt-get install libunwind-dev + # Install Robotology dependencies from robotology ppa sudo apt-add-repository -y ppa:robotology/ppa sudo apt-get install -qq -y librobottestingframework-dev @@ -1414,8 +1420,6 @@ jobs: libopencv-dev \ libeigen3-dev \ libgraphviz-dev \ - libgstreamer1.0-dev \ - libgstreamer-plugins-base1.0-dev \ libpng-dev \ libv4l-dev \ libavcodec-dev \ @@ -1430,6 +1434,9 @@ jobs: libjpeg-dev \ libpcl-dev + sudo apt-get install -y libgstreamer1.0-dev \ + libgstreamer-plugins-base1.0-dev + # Install SWIG and bindings dependencies sudo apt-get install -qq -y swig \ mono-mcs \ From 201883ac6b295c14fe92ae68f98a5f79e0d176d3 Mon Sep 17 00:00:00 2001 From: Marco Randazzo Date: Fri, 17 Nov 2023 00:11:12 +0100 Subject: [PATCH 04/16] catch2 fix --- extern/catch2/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/extern/catch2/CMakeLists.txt b/extern/catch2/CMakeLists.txt index f61cd9d1da..5de4dc6743 100644 --- a/extern/catch2/CMakeLists.txt +++ b/extern/catch2/CMakeLists.txt @@ -3,6 +3,10 @@ project(YARP_catch2) +set(CMAKE_CXX_EXTENSIONS OFF) +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + add_library(YARP_catch2 STATIC) add_library(YARP::YARP_catch2 ALIAS YARP_catch2) From 1ba4e35bc265e801377fe3ae65ded871e39548d3 Mon Sep 17 00:00:00 2001 From: Marco Randazzo Date: Fri, 17 Nov 2023 02:03:55 +0100 Subject: [PATCH 05/16] Octave bindings disabled because of https://github.com/robotology/yarp/issues/3022 --- .ci/bindings-cache.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/bindings-cache.cmake b/.ci/bindings-cache.cmake index ea39f1effa..a39e79c384 100644 --- a/.ci/bindings-cache.cmake +++ b/.ci/bindings-cache.cmake @@ -9,4 +9,4 @@ set(CREATE_TCL ON CACHE BOOL "") set(CREATE_JAVA ON CACHE BOOL "") set(CREATE_CSHARP ON CACHE BOOL "") set(CREATE_PERL ON CACHE BOOL "") -set(CREATE_OCTAVE ON CACHE BOOL "") +set(CREATE_OCTAVE OFF CACHE BOOL "") From c791185c5b514a7c798b4a44aab4606b5fea4716 Mon Sep 17 00:00:00 2001 From: Marco Randazzo Date: Fri, 17 Nov 2023 02:06:30 +0100 Subject: [PATCH 06/16] libunwind dependency fix for gstreamer installation --- .github/workflows/ci.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4d29c66be6..dfc7605948 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -694,10 +694,9 @@ jobs: if: runner.os == 'Linux' shell: bash run: | + # Install dep for gstreamer. It must be the first one. sudo apt-get update - - sudo apt-get install libunwind-dev - + sudo apt-get install -y libunwind-dev # Install Robotology dependencies from robotology ppa sudo apt-add-repository -y ppa:robotology/ppa @@ -1385,7 +1384,9 @@ jobs: if: runner.os == 'Linux' shell: bash run: | - sudo apt-get install libunwind-dev + # Install dep for gstreamer. It must be the first one. + sudo apt-get update + sudo apt-get install -y libunwind-dev # Install Robotology dependencies from robotology ppa sudo apt-add-repository -y ppa:robotology/ppa @@ -1576,6 +1577,10 @@ jobs: if: runner.os == 'Linux' shell: bash run: | + # Install dep for gstreamer. It must be the first one. + sudo apt-get update + sudo apt-get install -y libunwind-dev + # Install Robotology dependencies from robotology ppa sudo apt-add-repository -y ppa:robotology/ppa sudo apt-get install -qq -y librobottestingframework-dev @@ -1784,6 +1789,10 @@ jobs: if: runner.os == 'Linux' shell: bash run: | + # Install dep for gstreamer. It must be the first one. + sudo apt-get update + sudo apt-get install -y libunwind-dev + # Install Robotology dependencies from robotology ppa sudo apt-add-repository -y ppa:robotology/ppa sudo apt-get install -qq -y librobottestingframework-dev From 6b60ad56fae468a9fc6ad599a53493225564a765 Mon Sep 17 00:00:00 2001 From: Marco Randazzo Date: Fri, 17 Nov 2023 08:41:42 +0100 Subject: [PATCH 07/16] Updated clang version --- .github/workflows/ci.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dfc7605948..12ee156654 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -770,8 +770,8 @@ jobs: gcovr \ wget \ curl \ - clang-11 \ - clang-tidy-11 \ + clang-15 \ + clang-tidy-15 \ xsltproc \ libxml2-utils \ source-highlight @@ -1459,8 +1459,8 @@ jobs: gcovr \ wget \ curl \ - clang-11 \ - clang-tidy-11 \ + clang-15 \ + clang-tidy-15 \ xsltproc \ libxml2-utils \ source-highlight @@ -1471,8 +1471,8 @@ jobs: - name: Prepare environment env: CODACY_TOKEN: ${{ secrets.CODACY_TOKEN }} - CLANG_VERSION: 10 - CODACY_CLANG_TIDY_VERSION: 1.2.1 + CLANG_VERSION: 15 + CODACY_CLANG_TIDY_VERSION: 1.3.8 run: | echo "CLANG_VERSION=${CLANG_VERSION}" >> $GITHUB_ENV echo "CC=/usr/bin/clang-${CLANG_VERSION}" >> $GITHUB_ENV @@ -1651,8 +1651,8 @@ jobs: gcovr \ wget \ curl \ - clang-11 \ - clang-tidy-11 \ + clang-15 \ + clang-tidy-15 \ xsltproc \ libxml2-utils \ source-highlight @@ -1863,8 +1863,8 @@ jobs: gcovr \ wget \ curl \ - clang-11 \ - clang-tidy-11 \ + clang-15 \ + clang-tidy-15 \ xsltproc \ libxml2-utils \ source-highlight From 23c573f8f48a2588284559a6546a2a2252f839a0 Mon Sep 17 00:00:00 2001 From: Marco Randazzo Date: Fri, 17 Nov 2023 10:50:59 +0100 Subject: [PATCH 08/16] YARP_catch2 is now built only is YARP_COMPILE_TESTS option is on --- extern/CMakeLists.txt | 4 +- src/libYARP_dev/CMakeLists.txt | 5 - src/libYARP_dev/src/CMakeLists.txt | 136 +---------------- .../src/yarp/dev/tests/CMakeLists.txt | 143 ++++++++++++++++++ 4 files changed, 148 insertions(+), 140 deletions(-) create mode 100644 src/libYARP_dev/src/yarp/dev/tests/CMakeLists.txt diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt index fc60178dd8..1eaa001e13 100644 --- a/extern/CMakeLists.txt +++ b/extern/CMakeLists.txt @@ -9,8 +9,10 @@ set(CMAKE_C_FLAGS "-w ${_USER_CMAKE_C_FLAGS}") set(CMAKE_CXX_FLAGS "-w ${_USER_CMAKE_CXX_FLAGS}") # Catch2 +if(YARP_COMPILE_TESTS) add_subdirectory(catch2) - +endif() + # TinyXML if(YARP_BUILD_TinyXML) add_subdirectory(tinyxml) diff --git a/src/libYARP_dev/CMakeLists.txt b/src/libYARP_dev/CMakeLists.txt index 2646ab9466..edd998af00 100644 --- a/src/libYARP_dev/CMakeLists.txt +++ b/src/libYARP_dev/CMakeLists.txt @@ -11,11 +11,6 @@ yarp_install_basic_package_files(YARP_dev PRIVATE_DEPENDENCIES ${YARP_dev_PRIVATE_DEPS} ) -yarp_install_basic_package_files(YARP_dev_tests - DEPENDENCIES ${YARP_dev_tests_PUBLIC_DEPS} - PRIVATE_DEPENDENCIES ${YARP_dev_tests_PRIVATE_DEPS} -) - if(YARP_COMPILE_TESTS) add_subdirectory(tests) endif() diff --git a/src/libYARP_dev/src/CMakeLists.txt b/src/libYARP_dev/src/CMakeLists.txt index b471293461..959ce26d58 100644 --- a/src/libYARP_dev/src/CMakeLists.txt +++ b/src/libYARP_dev/src/CMakeLists.txt @@ -402,138 +402,6 @@ set(YARP_dev_PRIVATE_DEPS ${YARP_dev_PRIVATE_DEPS} PARENT_SCOPE) ################################################################### -add_library(YARP_dev_tests) -add_library(YARP::YARP_dev_tests ALIAS YARP_dev_tests) - -set(YARP_dev_test_HDRS - yarp/dev/tests/IDummyTest.h - yarp/dev/tests/IEncodersTimedTest.h - yarp/dev/tests/IPositionControlTest.h - yarp/dev/tests/ITorqueControlTest.h - yarp/dev/tests/IAxisInfoTest.h - yarp/dev/tests/IRGBDSensorTest.h - yarp/dev/tests/IBatteryTest.h - yarp/dev/tests/IJoypadControllerTest.h - yarp/dev/tests/ILLMTest.h - yarp/dev/tests/IChatBotTest.h - yarp/dev/tests/IVelocityControlTest.h - yarp/dev/tests/IControlModeTest.h - yarp/dev/tests/IInteractionModeTest.h - yarp/dev/tests/ICurrentControlTest.h - yarp/dev/tests/IPWMControlTest.h - yarp/dev/tests/IPidControlTest.h - yarp/dev/tests/IMotorTest.h - yarp/dev/tests/IMotorEncodersTest.h - yarp/dev/tests/IRemoteCalibratorTest.h -) - -set(YARP_dev_test_SRCS - yarp/dev/tests/IDummyTest.cpp - yarp/dev/tests/IEncodersTimedTest.cpp - yarp/dev/tests/IPositionControlTest.cpp - yarp/dev/tests/ITorqueControlTest.cpp - yarp/dev/tests/IAxisInfoTest.cpp - yarp/dev/tests/IRGBDSensorTest.cpp - yarp/dev/tests/IBatteryTest.cpp - yarp/dev/tests/IJoypadControllerTest.cpp - yarp/dev/tests/ILLMTest.cpp - yarp/dev/tests/IChatBotTest.cpp - yarp/dev/tests/IVelocityControlTest.cpp - yarp/dev/tests/IControlModeTest.cpp - yarp/dev/tests/IInteractionModeTest.cpp - yarp/dev/tests/ICurrentControlTest.cpp - yarp/dev/tests/IPWMControlTest.cpp - yarp/dev/tests/IPidControlTest.cpp - yarp/dev/tests/IMotorTest.cpp - yarp/dev/tests/IMotorEncodersTest.cpp - yarp/dev/tests/IRemoteCalibratorTest.cpp -) - -if(TARGET YARP::YARP_math) - list(APPEND YARP_dev_test_HDRS - yarp/dev/tests/IFrameGrabberImageTest.h - yarp/dev/tests/IRgbVisualParamsTest.h - yarp/dev/tests/IFrameTransformTest.h - yarp/dev/tests/IMap2DTest.h - yarp/dev/tests/INavigation2DTest.h - yarp/dev/tests/IDummyTest.h - yarp/dev/tests/IRangefinder2DTest.h - yarp/dev/tests/IPositionControlTest.h - yarp/dev/tests/ITorqueControlTest.h - yarp/dev/tests/IAxisInfoTest.h - yarp/dev/tests/IPositionSensorsTest.h - yarp/dev/tests/IOrientationSensorsTest.h - yarp/dev/tests/IOdometry2DTest.h - yarp/dev/tests/IRGBDSensorTest.h - yarp/dev/tests/ILocalization2DTest.h - yarp/dev/tests/IFrameTransformStorageTest.h - ) - list(APPEND YARP_dev_test_SRCS - yarp/dev/tests/IFrameGrabberImageTest.cpp - yarp/dev/tests/IRgbVisualParamsTest.cpp - yarp/dev/tests/IFrameTransformTest.cpp - yarp/dev/tests/INavigation2DTest.cpp - yarp/dev/tests/IDummyTest.cpp - yarp/dev/tests/IRangefinder2DTest.cpp - yarp/dev/tests/IPositionControlTest.cpp - yarp/dev/tests/ITorqueControlTest.cpp - yarp/dev/tests/IAxisInfoTest.cpp - yarp/dev/tests/IPositionSensorsTest.cpp - yarp/dev/tests/IOrientationSensorsTest.cpp - yarp/dev/tests/IOdometry2DTest.cpp - yarp/dev/tests/IRGBDSensorTest.cpp - yarp/dev/tests/IMap2DTest.cpp - yarp/dev/tests/ILocalization2DTest.cpp - yarp/dev/tests/IFrameTransformStorageTest.cpp - ) +if(YARP_COMPILE_TESTS) + add_subdirectory(yarp/dev/tests) endif() - -target_sources(YARP_dev_tests - PRIVATE - ${YARP_dev_test_SRCS} - ${YARP_dev_test_HDRS} -) - -target_compile_definitions(YARP_dev_tests PUBLIC YARP_dev_EXPORTS=1) - -target_link_libraries (YARP_dev_tests - PRIVATE - YARP::YARP_dev - YARP::YARP_catch2) - -target_compile_features(YARP_dev_tests PRIVATE cxx_std_17) - -set_property ( - TARGET YARP_dev_tests - PROPERTY FOLDER "Test" -) - -set_property( - TARGET YARP_dev_tests - PROPERTY - PUBLIC_HEADER - ${YARP_dev_HDRS} - ${YARP_dev_test_HDRS} -) - -set_property(TARGET YARP_dev_tests PROPERTY VERSION ${YARP_VERSION_SHORT}) -set_property(TARGET YARP_dev_tests PROPERTY SOVERSION ${YARP_SOVERSION}) -set_property(TARGET YARP_dev_tests PROPERTY FOLDER "Test") - - install( - TARGETS YARP_dev_tests - EXPORT YARP_dev_tests - RUNTIME - DESTINATION "${CMAKE_INSTALL_BINDIR}" - COMPONENT YARP_dev_tests - LIBRARY - DESTINATION "${CMAKE_INSTALL_LIBDIR}" - COMPONENT YARP_dev_tests - NAMELINK_COMPONENT YARP_dev_tests-dev - ARCHIVE - DESTINATION "${CMAKE_INSTALL_LIBDIR}" - COMPONENT YARP_dev_tests-dev - PUBLIC_HEADER - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/yarp/dev/tests" - COMPONENT YARP_dev_tests-dev -) diff --git a/src/libYARP_dev/src/yarp/dev/tests/CMakeLists.txt b/src/libYARP_dev/src/yarp/dev/tests/CMakeLists.txt new file mode 100644 index 0000000000..9ab88976d4 --- /dev/null +++ b/src/libYARP_dev/src/yarp/dev/tests/CMakeLists.txt @@ -0,0 +1,143 @@ +# SPDX-FileCopyrightText: 2023-2023 Istituto Italiano di Tecnologia (IIT) +# SPDX-License-Identifier: BSD-3-Clause + +add_library(YARP_dev_tests) +add_library(YARP::YARP_dev_tests ALIAS YARP_dev_tests) + +set(YARP_dev_test_HDRS + IDummyTest.h + IEncodersTimedTest.h + IPositionControlTest.h + ITorqueControlTest.h + IAxisInfoTest.h + IRGBDSensorTest.h + IBatteryTest.h + IJoypadControllerTest.h + ILLMTest.h + IChatBotTest.h + IVelocityControlTest.h + IControlModeTest.h + IInteractionModeTest.h + ICurrentControlTest.h + IPWMControlTest.h + IPidControlTest.h + IMotorTest.h + IMotorEncodersTest.h + IRemoteCalibratorTest.h +) + +set(YARP_dev_test_SRCS + IDummyTest.cpp + IEncodersTimedTest.cpp + IPositionControlTest.cpp + ITorqueControlTest.cpp + IAxisInfoTest.cpp + IRGBDSensorTest.cpp + IBatteryTest.cpp + IJoypadControllerTest.cpp + ILLMTest.cpp + IChatBotTest.cpp + IVelocityControlTest.cpp + IControlModeTest.cpp + IInteractionModeTest.cpp + ICurrentControlTest.cpp + IPWMControlTest.cpp + IPidControlTest.cpp + IMotorTest.cpp + IMotorEncodersTest.cpp + IRemoteCalibratorTest.cpp +) + +if(TARGET YARP::YARP_math) + list(APPEND YARP_dev_test_HDRS + IFrameGrabberImageTest.h + IRgbVisualParamsTest.h + IFrameTransformTest.h + IMap2DTest.h + INavigation2DTest.h + IDummyTest.h + IRangefinder2DTest.h + IPositionControlTest.h + ITorqueControlTest.h + IAxisInfoTest.h + IPositionSensorsTest.h + IOrientationSensorsTest.h + IOdometry2DTest.h + IRGBDSensorTest.h + ILocalization2DTest.h + IFrameTransformStorageTest.h + ) + list(APPEND YARP_dev_test_SRCS + IFrameGrabberImageTest.cpp + IRgbVisualParamsTest.cpp + IFrameTransformTest.cpp + INavigation2DTest.cpp + IDummyTest.cpp + IRangefinder2DTest.cpp + IPositionControlTest.cpp + ITorqueControlTest.cpp + IAxisInfoTest.cpp + IPositionSensorsTest.cpp + IOrientationSensorsTest.cpp + IOdometry2DTest.cpp + IRGBDSensorTest.cpp + IMap2DTest.cpp + ILocalization2DTest.cpp + IFrameTransformStorageTest.cpp + ) +endif() + +target_sources(YARP_dev_tests + PRIVATE + ${YARP_dev_test_SRCS} + ${YARP_dev_test_HDRS} +) + +target_compile_definitions(YARP_dev_tests PUBLIC YARP_dev_EXPORTS=1) + +target_link_libraries (YARP_dev_tests + PRIVATE + YARP::YARP_dev + YARP::YARP_catch2) + +target_compile_features(YARP_dev_tests PRIVATE cxx_std_17) + +set_property ( + TARGET YARP_dev_tests + PROPERTY FOLDER "Test" +) + +set_property( + TARGET YARP_dev_tests + PROPERTY + PUBLIC_HEADER + ${YARP_dev_HDRS} + ${YARP_dev_test_HDRS} +) + +set_property(TARGET YARP_dev_tests PROPERTY VERSION ${YARP_VERSION_SHORT}) +set_property(TARGET YARP_dev_tests PROPERTY SOVERSION ${YARP_SOVERSION}) +set_property(TARGET YARP_dev_tests PROPERTY FOLDER "Test") + + install( + TARGETS YARP_dev_tests + EXPORT YARP_dev_tests + RUNTIME + DESTINATION "${CMAKE_INSTALL_BINDIR}" + COMPONENT YARP_dev_tests + LIBRARY + DESTINATION "${CMAKE_INSTALL_LIBDIR}" + COMPONENT YARP_dev_tests + NAMELINK_COMPONENT YARP_dev_tests-dev + ARCHIVE + DESTINATION "${CMAKE_INSTALL_LIBDIR}" + COMPONENT YARP_dev_tests-dev + PUBLIC_HEADER + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/yarp/dev/tests" + COMPONENT YARP_dev_tests-dev +) + +yarp_install_basic_package_files(YARP_dev_tests + DEPENDENCIES ${YARP_dev_tests_PUBLIC_DEPS} + PRIVATE_DEPENDENCIES ${YARP_dev_tests_PRIVATE_DEPS} +) From 89c9af80a399c46026d2bc9d6609def065f984df Mon Sep 17 00:00:00 2001 From: Marco Randazzo Date: Fri, 17 Nov 2023 13:21:59 +0100 Subject: [PATCH 09/16] clang update to version 17 --- .github/workflows/ci.yml | 84 ++++++++++++++++++++-------------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 12ee156654..22b57d4a01 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -297,8 +297,8 @@ jobs: id: '02', os: ubuntu-22.04, build_type: "Release", - cc: "clang", - cxx: "clang++", + cc: "clang-17", + cxx: "clang++-17", cmake_generator: "Unix Makefiles", cmake_initial_cache_file: ".ci/initial-cache.gh.linux.cmake", test_external_bindings: true, @@ -321,8 +321,8 @@ jobs: description: 'No ACE', os: ubuntu-22.04, build_type: "Release", - cc: "clang", - cxx: "clang++", + cc: "clang-17", + cxx: "clang++-17", cmake_generator: "Unix Makefiles", cmake_initial_cache_file: ".ci/initial-cache.gh.linux.cmake", cmake_extra_options: "-DCMAKE_DISABLE_FIND_PACKAGE_ACE:BOOL=ON @@ -348,8 +348,8 @@ jobs: description: 'No YARP_math (bindings disabled)', os: ubuntu-22.04, build_type: "Release", - cc: "clang", - cxx: "clang++", + cc: "clang-17", + cxx: "clang++-17", cmake_generator: "Unix Makefiles", cmake_initial_cache_file: ".ci/initial-cache.gh.linux.cmake", cmake_extra_options: "-DCMAKE_DISABLE_FIND_PACKAGE_Eigen:BOOL=ON @@ -375,8 +375,8 @@ jobs: description: 'CLEAN_API (unit tests and bindings disabled)', os: ubuntu-22.04, build_type: "Release", - cc: "clang", - cxx: "clang++", + cc: "clang-17", + cxx: "clang++-17", cmake_generator: "Unix Makefiles", cmake_initial_cache_file: ".ci/initial-cache.gh.linux.cmake", cmake_extra_options: "-DYARP_CLEAN_API:BOOL=ON @@ -399,8 +399,8 @@ jobs: description: 'Static', os: ubuntu-22.04, build_type: "Release", - cc: "clang", - cxx: "clang++", + cc: "clang-17", + cxx: "clang++-17", cmake_generator: "Unix Makefiles", cmake_initial_cache_file: ".ci/initial-cache.gh.linux.cmake", cmake_extra_options: "-DBUILD_SHARED_LIBS:BOOL=OFF", @@ -424,8 +424,8 @@ jobs: description: 'Static, no ACE (bindings disabled)', os: ubuntu-22.04, build_type: "Release", - cc: "clang", - cxx: "clang++", + cc: "clang-17", + cxx: "clang++-17", cmake_generator: "Unix Makefiles", cmake_initial_cache_file: ".ci/initial-cache.gh.linux.cmake", cmake_extra_options: "-DBUILD_SHARED_LIBS:BOOL=OFF @@ -449,8 +449,8 @@ jobs: description: 'No deprecated', os: ubuntu-22.04, build_type: "Release", - cc: "clang", - cxx: "clang++", + cc: "clang-17", + cxx: "clang++-17", cmake_generator: "Unix Makefiles", cmake_initial_cache_file: ".ci/initial-cache.gh.linux.cmake", cmake_extra_options: "-DYARP_NO_DEPRECATED:BOOL=ON", @@ -472,8 +472,8 @@ jobs: description: 'No executables (unit tests disabled)', os: ubuntu-22.04, build_type: "Release", - cc: "clang", - cxx: "clang++", + cc: "clang-17", + cxx: "clang++-17", cmake_generator: "Unix Makefiles", cmake_initial_cache_file: ".ci/initial-cache.gh.linux.cmake", cmake_extra_options: "-DYARP_COMPILE_EXECUTABLES:BOOL=OFF @@ -497,8 +497,8 @@ jobs: description: 'Build extern dependencies', os: ubuntu-22.04, build_type: "Release", - cc: "clang", - cxx: "clang++", + cc: "clang-17", + cxx: "clang++-17", cmake_generator: "Unix Makefiles", cmake_initial_cache_file: ".ci/initial-cache.gh.linux.cmake", cmake_extra_options: "-DCMAKE_DISABLE_FIND_PACKAGE_SQLite:BOOL=ON @@ -518,8 +518,8 @@ jobs: id: '20', os: ubuntu-22.04, build_type: "Release", - cc: "clang", - cxx: "clang++", + cc: "clang-17", + cxx: "clang++-17", cmake_generator: "Ninja", cmake_initial_cache_file: ".ci/initial-cache.gh.linux.cmake", } @@ -639,8 +639,8 @@ jobs: id: '29', os: macos-13, build_type: "Release", - cc: "clang", - cxx: "clang++", + cc: "clang-17", + cxx: "clang++-17", cmake_generator: "Unix Makefiles", cmake_initial_cache_file: ".ci/initial-cache.gh.macos.cmake", } @@ -648,8 +648,8 @@ jobs: id: '30', os: macos-13, build_type: "Release", - cc: "clang", - cxx: "clang++", + cc: "clang-17", + cxx: "clang++-17", cmake_generator: "Xcode", cmake_initial_cache_file: ".ci/initial-cache.gh.macos.cmake", } @@ -657,8 +657,8 @@ jobs: id: '31', os: macos-12, build_type: "Release", - cc: "clang", - cxx: "clang++", + cc: "clang-17", + cxx: "clang++-17", cmake_generator: "Unix Makefiles", cmake_initial_cache_file: ".ci/initial-cache.gh.macos.cmake", } @@ -666,8 +666,8 @@ jobs: id: '32', os: macos-12, build_type: "Release", - cc: "clang", - cxx: "clang++", + cc: "clang-17", + cxx: "clang++-17", cmake_generator: "Xcode", cmake_initial_cache_file: ".ci/initial-cache.gh.macos.cmake", } @@ -698,6 +698,12 @@ jobs: sudo apt-get update sudo apt-get install -y libunwind-dev + #Install clang 17 + sudo apt-get purge -y llvm* clang* + wget -nv https://apt.llvm.org/llvm.sh + sudo chmod +x llvm.sh + sudo ./llvm.sh 17 + # Install Robotology dependencies from robotology ppa sudo apt-add-repository -y ppa:robotology/ppa sudo apt-get install -qq -y librobottestingframework-dev @@ -770,8 +776,6 @@ jobs: gcovr \ wget \ curl \ - clang-15 \ - clang-tidy-15 \ xsltproc \ libxml2-utils \ source-highlight @@ -883,7 +887,7 @@ jobs: if("${{ matrix.config.cc }}" MATCHES "gcc") file(APPEND "${_env_script}" "set(ENV{CFLAGS} -fdiagnostics-color=always)\n") file(APPEND "${_env_script}" "set(ENV{CXXFLAGS} -fdiagnostics-color=always)\n") - elseif("${{ matrix.config.cc }}" MATCHES "clang") + elseif("${{ matrix.config.cc }}" MATCHES "^clang.*") file(APPEND "${_env_script}" "set(ENV{CFLAGS} -fcolor-diagnostics)\n") file(APPEND "${_env_script}" "set(ENV{CXXFLAGS} -fcolor-diagnostics)\n") endif() @@ -1459,8 +1463,6 @@ jobs: gcovr \ wget \ curl \ - clang-15 \ - clang-tidy-15 \ xsltproc \ libxml2-utils \ source-highlight @@ -1471,7 +1473,7 @@ jobs: - name: Prepare environment env: CODACY_TOKEN: ${{ secrets.CODACY_TOKEN }} - CLANG_VERSION: 15 + CLANG_VERSION: 17 CODACY_CLANG_TIDY_VERSION: 1.3.8 run: | echo "CLANG_VERSION=${CLANG_VERSION}" >> $GITHUB_ENV @@ -1494,12 +1496,14 @@ jobs: if: runner.os == 'Linux' shell: bash run: | - # Download extra packages required - sudo apt-get install -qq -y clang-${CLANG_VERSION} \ - clang-tidy-${CLANG_VERSION} + #Install clang 17 + sudo apt-get purge -y llvm* clang* + wget -nv https://apt.llvm.org/llvm.sh + sudo chmod +x llvm.sh + sudo ./llvm.sh 17 # Download codacy-clang-tidy - sudo wget https://github.com/codacy/codacy-clang-tidy/releases/download/${CODACY_CLANG_TIDY_VERSION}/codacy-clang-tidy-${CODACY_CLANG_TIDY_VERSION} -O /usr/local/bin/codacy-clang-tidy-${CODACY_CLANG_TIDY_VERSION} + sudo wget https://github.com/codacy/codacy-clang-tidy/releases/download/${CODACY_CLANG_TIDY_VERSION}/codacy-clang-tidy-linux-${CODACY_CLANG_TIDY_VERSION} -O /usr/local/bin/codacy-clang-tidy-${CODACY_CLANG_TIDY_VERSION} sudo chmod -v +x /usr/local/bin/codacy-clang-tidy-${CODACY_CLANG_TIDY_VERSION} - name: Run CMake @@ -1651,8 +1655,6 @@ jobs: gcovr \ wget \ curl \ - clang-15 \ - clang-tidy-15 \ xsltproc \ libxml2-utils \ source-highlight @@ -1863,8 +1865,6 @@ jobs: gcovr \ wget \ curl \ - clang-15 \ - clang-tidy-15 \ xsltproc \ libxml2-utils \ source-highlight From 2c1e1e70710b53cc29c2894756517b6883976b2d Mon Sep 17 00:00:00 2001 From: Marco Randazzo Date: Sun, 19 Nov 2023 12:19:19 +0100 Subject: [PATCH 10/16] macos clang fix --- .github/workflows/ci.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 22b57d4a01..72056751fe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -639,8 +639,8 @@ jobs: id: '29', os: macos-13, build_type: "Release", - cc: "clang-17", - cxx: "clang++-17", + cc: "clang", + cxx: "clang++", cmake_generator: "Unix Makefiles", cmake_initial_cache_file: ".ci/initial-cache.gh.macos.cmake", } @@ -648,8 +648,8 @@ jobs: id: '30', os: macos-13, build_type: "Release", - cc: "clang-17", - cxx: "clang++-17", + cc: "clang", + cxx: "clang++", cmake_generator: "Xcode", cmake_initial_cache_file: ".ci/initial-cache.gh.macos.cmake", } @@ -657,8 +657,8 @@ jobs: id: '31', os: macos-12, build_type: "Release", - cc: "clang-17", - cxx: "clang++-17", + cc: "clang", + cxx: "clang++", cmake_generator: "Unix Makefiles", cmake_initial_cache_file: ".ci/initial-cache.gh.macos.cmake", } @@ -666,8 +666,8 @@ jobs: id: '32', os: macos-12, build_type: "Release", - cc: "clang-17", - cxx: "clang++-17", + cc: "clang", + cxx: "clang++", cmake_generator: "Xcode", cmake_initial_cache_file: ".ci/initial-cache.gh.macos.cmake", } From 07eb2b2bc3f760210b7a44208c66c1a000c80fcd Mon Sep 17 00:00:00 2001 From: Marco Randazzo Date: Sun, 19 Nov 2023 13:41:24 +0100 Subject: [PATCH 11/16] YARP_dev_tests installation fix --- src/libYARP_dev/src/yarp/dev/tests/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libYARP_dev/src/yarp/dev/tests/CMakeLists.txt b/src/libYARP_dev/src/yarp/dev/tests/CMakeLists.txt index 9ab88976d4..d90dccaa90 100644 --- a/src/libYARP_dev/src/yarp/dev/tests/CMakeLists.txt +++ b/src/libYARP_dev/src/yarp/dev/tests/CMakeLists.txt @@ -111,7 +111,6 @@ set_property( TARGET YARP_dev_tests PROPERTY PUBLIC_HEADER - ${YARP_dev_HDRS} ${YARP_dev_test_HDRS} ) From 73caf5a893f0ac0a89d392604ad5c34596410cad Mon Sep 17 00:00:00 2001 From: Marco Randazzo Date: Mon, 20 Nov 2023 10:27:21 +0100 Subject: [PATCH 12/16] valgrind fixes --- .github/workflows/ci.yml | 16 ++- src/carriers/mjpeg_carrier/tests/mjpeg.cpp | 8 +- src/devices/usbCamera/common/USBcamera.h | 126 +----------------- src/libYARP_os/tests/CMakeLists.txt | 3 +- ...insTest.cpp => ListPluginsAndOpenTest.cpp} | 5 +- src/libYARP_os/tests/ListPluginsOnlyTest.cpp | 60 +++++++++ 6 files changed, 87 insertions(+), 131 deletions(-) rename src/libYARP_os/tests/{ListPluginsTest.cpp => ListPluginsAndOpenTest.cpp} (89%) create mode 100644 src/libYARP_os/tests/ListPluginsOnlyTest.cpp diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 72056751fe..d035aef002 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -538,7 +538,13 @@ jobs: -DYARP_ENABLE_EXAMPLES_AS_TESTS:BOOL=OFF -DYARP_COMPILE_BINDINGS:BOOL=OFF -DCMAKE_DISABLE_FIND_PACKAGE_FFMPEG=ON - -DYARP_COMPILE_GUIS:BOOL=OFF", + -DYARP_COMPILE_GUIS:BOOL=OFF + -DENABLE_yarpmod_usbCamera:BOOL=OFF + -DENABLE_yarpmod_usbCameraRaw:BOOL=OFF + -DENABLE_yarpmod_portaudio:BOOL=OFF + -DENABLE_yarpmod_portaudioPlayer:BOOL=OFF + -DENABLE_yarpmod_portaudioRecorder:BOOL=OFF + -DENABLE_yarpmod_opencv_grabber:BOOL=OFF", } - { id: '22', @@ -557,7 +563,13 @@ jobs: -DYARP_ENABLE_EXAMPLES_AS_TESTS:BOOL=OFF -DYARP_COMPILE_BINDINGS:BOOL=OFF -DCMAKE_DISABLE_FIND_PACKAGE_FFMPEG=ON - -DYARP_COMPILE_GUIS:BOOL=OFF", + -DYARP_COMPILE_GUIS:BOOL=OFF + -DENABLE_yarpmod_usbCamera:BOOL=OFF + -DENABLE_yarpmod_usbCameraRaw:BOOL=OFF + -DENABLE_yarpmod_portaudio:BOOL=OFF + -DENABLE_yarpmod_portaudioPlayer:BOOL=OFF + -DENABLE_yarpmod_portaudioRecorder:BOOL=OFF + -DENABLE_yarpmod_opencv_grabber:BOOL=OFF", } - { id: '23', diff --git a/src/carriers/mjpeg_carrier/tests/mjpeg.cpp b/src/carriers/mjpeg_carrier/tests/mjpeg.cpp index 5c82ffe177..6c55c70462 100644 --- a/src/carriers/mjpeg_carrier/tests/mjpeg.cpp +++ b/src/carriers/mjpeg_carrier/tests/mjpeg.cpp @@ -17,6 +17,10 @@ TEST_CASE("carriers::mjpeg", "[carriers]") { YARP_REQUIRE_PLUGIN("mjpeg", "carrier"); +#if defined(DISABLE_FAILING_VALGRIND_TESTS) + YARP_SKIP_TEST("Skipping failing tests under valgrind") +#endif + Network::setLocalMode(true); SECTION("test compression-decompression") @@ -31,8 +35,8 @@ TEST_CASE("carriers::mjpeg", "[carriers]") REQUIRE(out.open(outName)); REQUIRE(Network::connect(out.getName(), in.getName(), "mjpeg")); - size_t width {320}; - size_t height {240}; + size_t width {160}; + size_t height {120}; ImageOf& outImg = out.prepare(); outImg.resize(width, height); diff --git a/src/devices/usbCamera/common/USBcamera.h b/src/devices/usbCamera/common/USBcamera.h index a9bbe2a0a4..0109966b95 100644 --- a/src/devices/usbCamera/common/USBcamera.h +++ b/src/devices/usbCamera/common/USBcamera.h @@ -58,26 +58,12 @@ class USBCameraDriver : */ ~USBCameraDriver() override; - /** - * Open the device driver. - * @param config configuration for the device driver - * @return returns true on success, false on failure. - */ bool open(yarp::os::Searchable& config) override; - - /** - * Closes the device driver. - * @return returns true/false on success/failure. - */ bool close() override; int height() const; int width() const; - /** - * Implements the IPreciselyTimed interface. - * @return the yarp::os::Stamp of the last image acquired - */ yarp::os::Stamp getLastInputStamp() override; /** @@ -100,85 +86,16 @@ class USBCameraDriver : bool setMode(int feature, FeatureMode mode) override; bool getMode(int feature, FeatureMode* mode) override; bool setOnePush(int feature) override; - /** - * Return the height of each frame. - * @return rgb image height - */ - int getRgbHeight() override; - /** - * Return the width of each frame. - * @return rgb image width - */ + int getRgbHeight() override; int getRgbWidth() override; - - /** - * Get the possible configurations of the camera - * @param configurations list of camera supported configurations as CameraConfig type - * @return true on success - */ - bool getRgbSupportedConfigurations(yarp::sig::VectorOf& configurations) override; - /** - * Get the resolution of the rgb image from the camera - * @param width image width - * @param height image height - * @return true on success - */ - bool getRgbResolution(int& width, int& height) override; - - /** - * Set the resolution of the rgb image from the camera - * @param width image width - * @param height image height - * @return true on success - */ - bool setRgbResolution(int width, int height) override; - - /** - * Get the field of view (FOV) of the rgb camera. - * - * @param horizontalFov will return the value of the horizontal fov in degrees - * @param verticalFov will return the value of the vertical fov in degrees - * @return true on success - */ bool getRgbFOV(double& horizontalFov, double& verticalFov) override; - - /** - * Set the field of view (FOV) of the rgb camera. - * - * @param horizontalFov will set the value of the horizontal fov in degrees - * @param verticalFov will set the value of the vertical fov in degrees - * @return true on success - */ bool setRgbFOV(double horizontalFov, double verticalFov) override; - - /** - * Get the intrinsic parameters of the rgb camera - * @param intrinsic return a Property containing intrinsic parameters - * of the optical model of the camera. - * @return true if success - * - * Look at IVisualParams.h for more details - */ bool getRgbIntrinsicParam(yarp::os::Property& intrinsic) override; - - /** - * Get the mirroring setting of the sensor - * - * @param mirror: true if image is mirrored, false otherwise - * @return true if success - */ bool getRgbMirroring(bool& mirror) override; - - /** - * Set the mirroring setting of the sensor - * - * @param mirror: true if image should be mirrored, false otherwise - * @return true if success - */ bool setRgbMirroring(bool mirror) override; }; @@ -196,33 +113,9 @@ class USBCameraDriverRgb : USBCameraDriverRgb(); ~USBCameraDriverRgb() override; - /** - * FrameGrabber image interface, returns the last acquired frame as - * an rgb image. A demosaicking method is applied to - * reconstuct the color from the Bayer pattern of the sensor. - * @param image that will store the last frame. - * @return true/false upon success/failure - */ bool getImage(yarp::sig::ImageOf& image) override; - - /** - * FrameGrabber image interface, returns the last acquired frame as - * a raw image. - * @param image that will store the last frame. - * @return true/false upon success/failure - */ bool getImage(yarp::sig::ImageOf& image) override; - - /** - * Return the height of each frame. - * @return image height - */ int height() const override; - - /** - * Return the width of each frame. - * @return image width - */ int width() const override; }; @@ -243,25 +136,8 @@ class USBCameraDriverRaw : USBCameraDriverRaw(); ~USBCameraDriverRaw() override; - /** - * FrameGrabber image interface, returns the last acquired frame as - * an rgb image. A demosaicking method is applied to - * reconstuct the color from the Bayer pattern of the sensor. - * @param image that will store the last frame. - * @return true/false upon success/failure - */ bool getImage(yarp::sig::ImageOf& image) override; - - /** - * Return the height of each frame. - * @return image height - */ int height() const override; - - /** - * Return the width of each frame. - * @return image width - */ int width() const override; }; diff --git a/src/libYARP_os/tests/CMakeLists.txt b/src/libYARP_os/tests/CMakeLists.txt index 35ea768c7a..95405be88f 100644 --- a/src/libYARP_os/tests/CMakeLists.txt +++ b/src/libYARP_os/tests/CMakeLists.txt @@ -9,7 +9,8 @@ target_sources(harness_os PRIVATE BinPortableTest.cpp BottleTest.cpp ListCarriersTest.cpp - ListPluginsTest.cpp + ListPluginsAndOpenTest.cpp + ListPluginsOnlyTest.cpp ContactTest.cpp ElectionTest.cpp EventTest.cpp diff --git a/src/libYARP_os/tests/ListPluginsTest.cpp b/src/libYARP_os/tests/ListPluginsAndOpenTest.cpp similarity index 89% rename from src/libYARP_os/tests/ListPluginsTest.cpp rename to src/libYARP_os/tests/ListPluginsAndOpenTest.cpp index 901eddf492..0c20b16784 100644 --- a/src/libYARP_os/tests/ListPluginsTest.cpp +++ b/src/libYARP_os/tests/ListPluginsAndOpenTest.cpp @@ -11,7 +11,7 @@ #include using namespace yarp::os; -TEST_CASE("os::ListPluginsTest", "[yarp::os]") +TEST_CASE("os::ListPluginsAndOpenTest", "[yarp::os]") { NetworkBase::setLocalMode(true); @@ -40,6 +40,9 @@ TEST_CASE("os::ListPluginsTest", "[yarp::os]") //CHECK(b); b = settings.readFromSearchable(options, name); //CHECK(b); + + //Beware: a leaky dynamic library may cause valgrind to fail this test. + //Check also `ListPluginsOnlyTest`. SharedLibraryFactory lib; b = settings.open(lib); CHECK(b); diff --git a/src/libYARP_os/tests/ListPluginsOnlyTest.cpp b/src/libYARP_os/tests/ListPluginsOnlyTest.cpp new file mode 100644 index 0000000000..eb0a987cdc --- /dev/null +++ b/src/libYARP_os/tests/ListPluginsOnlyTest.cpp @@ -0,0 +1,60 @@ +/* + * SPDX-FileCopyrightText: 2023-2023 Istituto Italiano di Tecnologia (IIT) + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include +#include +#include + +#include +#include + +using namespace yarp::os; +TEST_CASE("os::ListPluginsOnlyTest", "[yarp::os]") +{ + NetworkBase::setLocalMode(true); + + SECTION("Checking generic plugin methods") + { +#ifdef YARP_IS_STATIC + //The following code is copied from command: yarp plugin --all + YarpPluginSelector selector; + selector.scan(); + Bottle lst = selector.getSelectedPlugins(); + CHECK(lst.size() == 0); +#else + //The following code is copied from command: yarp plugin --all + YarpPluginSelector selector; + selector.scan(); + Bottle lst = selector.getSelectedPlugins(); + Bottle search_path = selector.getSearchPath(); + CHECK (lst.size()!=0); + for (size_t i = 0; i < lst.size(); i++) + { + Value& options = lst.get(i); + std::string name = options.check("name", Value("untitled")).asString(); + std::string type = options.check("type", Value("unknown type")).asString(); + yarp::os::YarpPluginSettings settings; + bool b; + b = settings.setSelector(selector); + yarp::os::YarpPluginSelector* selector2 = settings.getSelector(); + //CHECK(b); + b = settings.readFromSearchable(options, name); + //CHECK(b); + + //Here I am not intentionally opening the plugin in order + //to have a 'pure' valgrind test where leaky dynamic libraries are not involved. + //Check also the test ListPluginsAndOpenTest. + std::string baseClassName = settings.getBaseClassName(); + std::string ClassName = settings.getClassName(); + std::string LibraryName = settings.getLibraryName(); + std::string MethodName = settings.getMethodName(); + std::string PluginName = settings.getPluginName(); + std::string WrapperName = settings.getWrapperName(); + } +#endif + } + + NetworkBase::setLocalMode(false); +} From 6a2d04bab39daf378e355d86648aa98a86a1fa8d Mon Sep 17 00:00:00 2001 From: Marco Randazzo Date: Mon, 20 Nov 2023 11:37:25 +0100 Subject: [PATCH 13/16] Improved coverage for motion control tests --- .../fakeMotionControl/fakeMotionControl.cpp | 6 +- .../src/yarp/dev/tests/IPositionControlTest.h | 106 ++++++++++++++++-- .../src/yarp/dev/tests/ITorqueControlTest.h | 2 +- .../src/yarp/dev/tests/IVelocityControlTest.h | 2 +- 4 files changed, 103 insertions(+), 13 deletions(-) diff --git a/src/devices/fakeMotionControl/fakeMotionControl.cpp b/src/devices/fakeMotionControl/fakeMotionControl.cpp index d65e825095..83e21a426b 100644 --- a/src/devices/fakeMotionControl/fakeMotionControl.cpp +++ b/src/devices/fakeMotionControl/fakeMotionControl.cpp @@ -2002,7 +2002,7 @@ bool FakeMotionControl::relativeMoveRaw(int j, double delta) yCError(FAKEMOTIONCONTROL) << "relativeMoveRaw: skipping command because joint " << j << " is not in VOCAB_CM_POSITION mode"; } _posCtrl_references[j] += delta; - return false; + return true; } bool FakeMotionControl::relativeMoveRaw(const double *deltas) @@ -2027,7 +2027,7 @@ bool FakeMotionControl::checkMotionDoneRaw(int j, bool *flag) } *flag = false; - return false; + return true; } bool FakeMotionControl::checkMotionDoneRaw(bool *flag) @@ -2041,7 +2041,7 @@ bool FakeMotionControl::checkMotionDoneRaw(bool *flag) for(int j=0, index=0; j< _njoints; j++, index++) { - ret &= checkMotionDoneRaw(&val); + ret &= checkMotionDoneRaw(j, &val); tot_res &= val; } *flag = tot_res; diff --git a/src/libYARP_dev/src/yarp/dev/tests/IPositionControlTest.h b/src/libYARP_dev/src/yarp/dev/tests/IPositionControlTest.h index bd01369789..8321164f5d 100644 --- a/src/libYARP_dev/src/yarp/dev/tests/IPositionControlTest.h +++ b/src/libYARP_dev/src/yarp/dev/tests/IPositionControlTest.h @@ -17,6 +17,8 @@ namespace yarp::dev::tests { inline void exec_iPositionControl_test_1(IPositionControl* ipos, IControlMode* icmd) { + const int nr_ax = 2; + REQUIRE(ipos != nullptr); REQUIRE(icmd != nullptr); @@ -25,7 +27,7 @@ namespace yarp::dev::tests b = ipos->getAxes(&ax); CHECK(b); - REQUIRE(ax > 0); + REQUIRE(ax == nr_ax); for (size_t i = 0; i < ax; i++) { @@ -33,15 +35,103 @@ namespace yarp::dev::tests CHECK(b); } - double ref = 0; - b = ipos->getRefSpeed(0,&ref); - CHECK(b); + { + double ref = 0; + double refs[nr_ax]; + int joints[nr_ax] = { 0,1 }; - b = ipos->getRefAcceleration(0, &ref); - CHECK(b); + b = ipos->setRefSpeed(0, ref); + CHECK(b); - b = ipos->getTargetPosition(0, &ref); - CHECK(b); + b = ipos->setRefSpeeds(refs); + CHECK(b); + + b = ipos->setRefSpeeds(nr_ax, joints, refs); + CHECK(b); + + b = ipos->setRefAcceleration(0, ref); + CHECK(b); + + b = ipos->setRefAccelerations(refs); + CHECK(b); + + b = ipos->setRefAccelerations(nr_ax, joints, refs); + CHECK(b); + } + { + double ref = 0; + double refs[nr_ax]; + int joints[nr_ax] = { 0,1 }; + + b = ipos->getRefSpeed(0,&ref); + CHECK(b); + + b = ipos->getRefSpeeds(refs); + CHECK(b); + + b = ipos->getRefSpeeds(nr_ax, joints, refs); + CHECK(b); + + b = ipos->getRefAcceleration(0, &ref); + CHECK(b); + + b = ipos->getRefAccelerations(refs); + CHECK(b); + + b = ipos->getRefAccelerations(nr_ax, joints, refs); + CHECK(b); + + b = ipos->getTargetPosition(0, &ref); + CHECK(b); + + b = ipos->getTargetPositions(refs); + CHECK(b); + + b = ipos->getTargetPositions(nr_ax, joints, refs); + CHECK(b); + } + + { + double ref = 0; + double refs[nr_ax]; + int joints[nr_ax] = { 0,1 }; + b = ipos->positionMove(0, ref); + CHECK(b); + + b = ipos->positionMove(refs); + CHECK(b); + + b = ipos->positionMove(nr_ax, joints, refs); + CHECK(b); + + b = ipos->relativeMove(0, ref); + CHECK(b); + + b = ipos->relativeMove(refs); + CHECK(b); + + b = ipos->relativeMove(nr_ax, joints, refs); + CHECK(b); + } + + { + bool flag; + bool flags[nr_ax]; + int joints[nr_ax] = {0,1}; + b = ipos->checkMotionDone(0,&flag); + CHECK(b); + + b = ipos->checkMotionDone(flags); + CHECK(b); + + b = ipos->checkMotionDone(nr_ax,joints,flags); + CHECK(b); + } + + { + b = ipos->stop(); + CHECK(b); + } } inline void exec_iPositionControl_test_unimplemented_interface(IPositionControl* ipos, IControlMode* icmd) diff --git a/src/libYARP_dev/src/yarp/dev/tests/ITorqueControlTest.h b/src/libYARP_dev/src/yarp/dev/tests/ITorqueControlTest.h index 187ec64ca2..3910112346 100644 --- a/src/libYARP_dev/src/yarp/dev/tests/ITorqueControlTest.h +++ b/src/libYARP_dev/src/yarp/dev/tests/ITorqueControlTest.h @@ -25,7 +25,7 @@ namespace yarp::dev::tests int ax; b = itrq->getAxes(&ax); CHECK(b); - REQUIRE(ax > 0); + REQUIRE(ax == 2); for (size_t i = 0; i < ax; i++) { diff --git a/src/libYARP_dev/src/yarp/dev/tests/IVelocityControlTest.h b/src/libYARP_dev/src/yarp/dev/tests/IVelocityControlTest.h index dbc4d53c18..4394638c70 100644 --- a/src/libYARP_dev/src/yarp/dev/tests/IVelocityControlTest.h +++ b/src/libYARP_dev/src/yarp/dev/tests/IVelocityControlTest.h @@ -26,7 +26,7 @@ namespace yarp::dev::tests b = ivel->getAxes(&ax); CHECK(b); - REQUIRE(ax > 0); + REQUIRE(ax == 2); for (size_t i = 0; i< ax; i++) { From 4f052d79ab8786ae4b5f4ec4da8be62cd245ab0c Mon Sep 17 00:00:00 2001 From: Marco Randazzo Date: Mon, 20 Nov 2023 12:06:54 +0100 Subject: [PATCH 14/16] clang-tidy enabled --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d035aef002..521ab791d0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1508,11 +1508,11 @@ jobs: if: runner.os == 'Linux' shell: bash run: | - #Install clang 17 + #Install clang 17. `all` option is required for clang-tidy sudo apt-get purge -y llvm* clang* wget -nv https://apt.llvm.org/llvm.sh sudo chmod +x llvm.sh - sudo ./llvm.sh 17 + sudo ./llvm.sh 17 all # Download codacy-clang-tidy sudo wget https://github.com/codacy/codacy-clang-tidy/releases/download/${CODACY_CLANG_TIDY_VERSION}/codacy-clang-tidy-linux-${CODACY_CLANG_TIDY_VERSION} -O /usr/local/bin/codacy-clang-tidy-${CODACY_CLANG_TIDY_VERSION} From 1ae8fa45547f8716b3ec1106c64315bba8933f0b Mon Sep 17 00:00:00 2001 From: Marco Randazzo Date: Mon, 20 Nov 2023 13:22:23 +0100 Subject: [PATCH 15/16] some motioncontrol tests fixes --- .../fakeLaserWithMotor_motors.cpp | 2 +- .../src/yarp/dev/tests/IPositionControlTest.h | 60 ++++++++++--------- .../src/yarp/dev/tests/ITorqueControlTest.h | 25 ++++---- .../src/yarp/dev/tests/IVelocityControlTest.h | 17 +++--- 4 files changed, 56 insertions(+), 48 deletions(-) diff --git a/src/devices/fakeLaserWithMotor/fakeLaserWithMotor_motors.cpp b/src/devices/fakeLaserWithMotor/fakeLaserWithMotor_motors.cpp index 424272fafc..1146b1e2c2 100644 --- a/src/devices/fakeLaserWithMotor/fakeLaserWithMotor_motors.cpp +++ b/src/devices/fakeLaserWithMotor/fakeLaserWithMotor_motors.cpp @@ -148,7 +148,7 @@ bool FakeLaserWithMotor::checkMotionDoneRaw(bool* flag) for (int j = 0, index = 0; j < m_njoints; j++, index++) { - ret &= checkMotionDoneRaw(&val); + ret &= checkMotionDoneRaw(j, &val); tot_res &= val; } *flag = tot_res; diff --git a/src/libYARP_dev/src/yarp/dev/tests/IPositionControlTest.h b/src/libYARP_dev/src/yarp/dev/tests/IPositionControlTest.h index 8321164f5d..1930f3488e 100644 --- a/src/libYARP_dev/src/yarp/dev/tests/IPositionControlTest.h +++ b/src/libYARP_dev/src/yarp/dev/tests/IPositionControlTest.h @@ -6,6 +6,10 @@ #ifndef IPOSITIONCONTROLTEST_H #define IPOSITIONCONTROLTEST_H +#include +#include +#include + #include #include #include @@ -17,8 +21,6 @@ namespace yarp::dev::tests { inline void exec_iPositionControl_test_1(IPositionControl* ipos, IControlMode* icmd) { - const int nr_ax = 2; - REQUIRE(ipos != nullptr); REQUIRE(icmd != nullptr); @@ -27,7 +29,7 @@ namespace yarp::dev::tests b = ipos->getAxes(&ax); CHECK(b); - REQUIRE(ax == nr_ax); + REQUIRE(ax > 0); for (size_t i = 0; i < ax; i++) { @@ -37,94 +39,98 @@ namespace yarp::dev::tests { double ref = 0; - double refs[nr_ax]; - int joints[nr_ax] = { 0,1 }; + auto refs = std::vector(ax); + auto joints = std::vector(ax); + std::iota(joints.begin(), joints.end(), 0); b = ipos->setRefSpeed(0, ref); CHECK(b); - b = ipos->setRefSpeeds(refs); + b = ipos->setRefSpeeds(refs.data()); CHECK(b); - b = ipos->setRefSpeeds(nr_ax, joints, refs); + b = ipos->setRefSpeeds(ax, joints.data(), refs.data()); CHECK(b); b = ipos->setRefAcceleration(0, ref); CHECK(b); - b = ipos->setRefAccelerations(refs); + b = ipos->setRefAccelerations(refs.data()); CHECK(b); - b = ipos->setRefAccelerations(nr_ax, joints, refs); + b = ipos->setRefAccelerations(ax, joints.data(), refs.data()); CHECK(b); } { double ref = 0; - double refs[nr_ax]; - int joints[nr_ax] = { 0,1 }; + auto refs = std::vector(ax); + auto joints = std::vector(ax); + std::iota(joints.begin(), joints.end(), 0); b = ipos->getRefSpeed(0,&ref); CHECK(b); - b = ipos->getRefSpeeds(refs); + b = ipos->getRefSpeeds(refs.data()); CHECK(b); - b = ipos->getRefSpeeds(nr_ax, joints, refs); + b = ipos->getRefSpeeds(ax, joints.data(), refs.data()); CHECK(b); b = ipos->getRefAcceleration(0, &ref); CHECK(b); - b = ipos->getRefAccelerations(refs); + b = ipos->getRefAccelerations(refs.data()); CHECK(b); - b = ipos->getRefAccelerations(nr_ax, joints, refs); + b = ipos->getRefAccelerations(ax, joints.data(), refs.data()); CHECK(b); b = ipos->getTargetPosition(0, &ref); CHECK(b); - b = ipos->getTargetPositions(refs); + b = ipos->getTargetPositions(refs.data()); CHECK(b); - b = ipos->getTargetPositions(nr_ax, joints, refs); + b = ipos->getTargetPositions(ax, joints.data(), refs.data()); CHECK(b); } { double ref = 0; - double refs[nr_ax]; - int joints[nr_ax] = { 0,1 }; + auto refs = std::vector(ax); + auto joints = std::vector(ax); + std::iota(joints.begin(), joints.end(), 0); b = ipos->positionMove(0, ref); CHECK(b); - b = ipos->positionMove(refs); + b = ipos->positionMove(refs.data()); CHECK(b); - b = ipos->positionMove(nr_ax, joints, refs); + b = ipos->positionMove(ax, joints.data(), refs.data()); CHECK(b); b = ipos->relativeMove(0, ref); CHECK(b); - b = ipos->relativeMove(refs); + b = ipos->relativeMove(refs.data()); CHECK(b); - b = ipos->relativeMove(nr_ax, joints, refs); + b = ipos->relativeMove(ax, joints.data(), refs.data()); CHECK(b); } { bool flag; - bool flags[nr_ax]; - int joints[nr_ax] = {0,1}; + auto flags = std::make_unique(ax); + auto joints = std::vector(ax); + std::iota(joints.begin(), joints.end(), 0); b = ipos->checkMotionDone(0,&flag); CHECK(b); - b = ipos->checkMotionDone(flags); + b = ipos->checkMotionDone(flags.get()); CHECK(b); - b = ipos->checkMotionDone(nr_ax,joints,flags); + b = ipos->checkMotionDone(ax,joints.data(),flags.get()); CHECK(b); } diff --git a/src/libYARP_dev/src/yarp/dev/tests/ITorqueControlTest.h b/src/libYARP_dev/src/yarp/dev/tests/ITorqueControlTest.h index 3910112346..9727de223d 100644 --- a/src/libYARP_dev/src/yarp/dev/tests/ITorqueControlTest.h +++ b/src/libYARP_dev/src/yarp/dev/tests/ITorqueControlTest.h @@ -6,6 +6,9 @@ #ifndef ITORQUECONTROLTEST_H #define ITORQUECONTROLTEST_H +#include +#include + #include #include #include @@ -25,7 +28,7 @@ namespace yarp::dev::tests int ax; b = itrq->getAxes(&ax); CHECK(b); - REQUIRE(ax == 2); + REQUIRE(ax > 0); for (size_t i = 0; i < ax; i++) { @@ -80,10 +83,10 @@ namespace yarp::dev::tests //CHECK(b); //this will fail } - double* vals = new double [ax]; - double* refvals = new double[ax]; - double* vals1 = new double[ax]; - double* vals2 = new double[ax]; + auto vals = std::vector(ax); + auto refvals = std::vector(ax); + auto vals1 = std::vector(ax); + auto vals2 = std::vector(ax); b = itrq->setMotorTorqueParams(0, param); CHECK(!b); @@ -94,7 +97,7 @@ namespace yarp::dev::tests b = itrq->getRefTorque(0, &val); CHECK(!b); - b = itrq->getRefTorques(refvals); + b = itrq->getRefTorques(refvals.data()); CHECK(!b); b = itrq->getTorque(0,&val); @@ -103,22 +106,18 @@ namespace yarp::dev::tests b = itrq->getTorqueRange(0, &val1, &val2); CHECK(!b); - b = itrq->getTorqueRanges(vals1, vals2); + b = itrq->getTorqueRanges(vals1.data(), vals2.data()); CHECK(!b); - b = itrq->getTorques(vals); //streaming + b = itrq->getTorques(vals.data()); //streaming // CHECK(!b); //this is streaming, it will return true if data is arrived in time b = itrq->setRefTorque(0,val); //streaming // CHECK(!b); //this is streaming, it will return true always - b = itrq->setRefTorques(refvals); //streaming + b = itrq->setRefTorques(refvals.data()); //streaming // CHECK(!b); //this is streaming, it will return true always - delete[] vals; - delete[] refvals; - delete[] vals1; - delete[] vals2; } } diff --git a/src/libYARP_dev/src/yarp/dev/tests/IVelocityControlTest.h b/src/libYARP_dev/src/yarp/dev/tests/IVelocityControlTest.h index 4394638c70..6f01bf55bc 100644 --- a/src/libYARP_dev/src/yarp/dev/tests/IVelocityControlTest.h +++ b/src/libYARP_dev/src/yarp/dev/tests/IVelocityControlTest.h @@ -6,6 +6,9 @@ #ifndef IVELOCITYCONTROLTEST_H #define IVELOCITYCONTROLTEST_H +#include +#include + #include #include #include @@ -26,7 +29,7 @@ namespace yarp::dev::tests b = ivel->getAxes(&ax); CHECK(b); - REQUIRE(ax == 2); + REQUIRE(ax > 0); for (size_t i = 0; i< ax; i++) { @@ -60,13 +63,13 @@ namespace yarp::dev::tests bool b; int ax; - double ref = 0; - double refs [1] = {0.0}; - b = ivel->getAxes(&ax); CHECK(b); REQUIRE(ax > 0); + double ref = 0; + auto refs = std::vector(ax); + for (size_t i = 0; i < ax; i++) { b = icmd->setControlMode(i, VOCAB_CM_VELOCITY); @@ -77,9 +80,9 @@ namespace yarp::dev::tests CHECK(!b); b = ivel->getRefAcceleration(0, &ref); CHECK(!b); - b = ivel->setRefAccelerations( refs); + b = ivel->setRefAccelerations( refs.data()); CHECK(!b); - b = ivel->getRefAccelerations( refs); + b = ivel->getRefAccelerations( refs.data()); CHECK(!b); b = ivel->velocityMove(0, ref); @@ -87,7 +90,7 @@ namespace yarp::dev::tests b = ivel->getRefVelocity(0, &ref); CHECK(!b); - b = ivel->getRefVelocities(refs); + b = ivel->getRefVelocities(refs.data()); CHECK(!b); b = ivel->stop(); From 06d8ada0b0c2204663e15d88e70198ac39ed9f7f Mon Sep 17 00:00:00 2001 From: Marco Randazzo Date: Mon, 20 Nov 2023 19:53:20 +0100 Subject: [PATCH 16/16] fakeLaserWithMotor test fix --- .../fakeLaserWithMotor/fakeLaserWithMotor_motors.cpp | 6 +++--- src/libYARP_dev/src/yarp/dev/tests/IControlModeTest.h | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/devices/fakeLaserWithMotor/fakeLaserWithMotor_motors.cpp b/src/devices/fakeLaserWithMotor/fakeLaserWithMotor_motors.cpp index 1146b1e2c2..fc81dbe449 100644 --- a/src/devices/fakeLaserWithMotor/fakeLaserWithMotor_motors.cpp +++ b/src/devices/fakeLaserWithMotor/fakeLaserWithMotor_motors.cpp @@ -121,7 +121,7 @@ bool FakeLaserWithMotor::relativeMoveRaw(int j, double delta) yCError(FAKE_LASER_MOTORS) << "relativeMoveRaw: skipping command because joint " << j << " is not in VOCAB_CM_POSITION mode"; } _posCtrl_references[j] += delta; - return false; + return true; } bool FakeLaserWithMotor::relativeMoveRaw(const double* deltas) @@ -138,7 +138,7 @@ bool FakeLaserWithMotor::relativeMoveRaw(const double* deltas) bool FakeLaserWithMotor::checkMotionDoneRaw(int j, bool* flag) { *flag = false; - return false; + return true; } bool FakeLaserWithMotor::checkMotionDoneRaw(bool* flag) @@ -244,7 +244,7 @@ bool FakeLaserWithMotor::getRefAccelerationsRaw(double* accs) bool FakeLaserWithMotor::stopRaw(int j) { - return false; + return true; } bool FakeLaserWithMotor::stopRaw() diff --git a/src/libYARP_dev/src/yarp/dev/tests/IControlModeTest.h b/src/libYARP_dev/src/yarp/dev/tests/IControlModeTest.h index caf1a81609..3f8017f860 100644 --- a/src/libYARP_dev/src/yarp/dev/tests/IControlModeTest.h +++ b/src/libYARP_dev/src/yarp/dev/tests/IControlModeTest.h @@ -14,13 +14,15 @@ using namespace yarp::dev; using namespace yarp::os; +#define COMMAND_DELAY 1.0 + void test_single_joint(IControlMode* icmd, IAxisInfo* iinfo, int mode) { REQUIRE(icmd != nullptr); bool b = false; b = icmd->setControlMode(0, mode); CHECK(b); - yarp::os::SystemClock::delaySystem(0.1); + yarp::os::SystemClock::delaySystem(COMMAND_DELAY); int ret=0; b = icmd->getControlMode(0, &ret); CHECK(b); @@ -42,7 +44,7 @@ void test_all_joints(IControlMode* icmd, IAxisInfo* iinfo, int mode) modes[1]=mode; b = icmd->setControlModes(modes); CHECK(b); - yarp::os::SystemClock::delaySystem(0.1); + yarp::os::SystemClock::delaySystem(COMMAND_DELAY); int rets[2] = {0,-0}; b = icmd->getControlModes(rets); CHECK(b); @@ -68,7 +70,7 @@ void test_multi_joint(IControlMode* icmd, IAxisInfo* iinfo, int mode) joints[1] = 1; b = icmd->setControlModes(2,joints,modes); CHECK(b); - yarp::os::SystemClock::delaySystem(0.1); + yarp::os::SystemClock::delaySystem(COMMAND_DELAY); int rets[2] = { 0,-0 }; b = icmd->getControlModes(2,joints,rets); CHECK(b);