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

Add basic test for YarpRobotLoggerDevice #862

Merged
merged 16 commits into from
Sep 27, 2024
Merged

Add basic test for YarpRobotLoggerDevice #862

merged 16 commits into from
Sep 27, 2024

Conversation

traversaro
Copy link
Collaborator

Discussing with @GiulioRomualdi, it turns out that the YarpRobotLoggerDevice is an important and critical piece of software, that has almost zero test coverage, making it complex to make (or review) any change to it.

As an initial (and by far non complete) solution for this, in this PR I add a basic test for the YarpRobotLoggerDevice, that logs the encoders and the imu of a fake robot, and check that the value saved in the .mat files are indeed correct.

In the future, the test can be made more complex to test more functionality of the YarpRobotLoggerDevice (log of YARP ports, textual logging), but I guess we can start simple.

For what regards the technicalities, this has been implemented with this key ideas:

cc @nicktrem @xela-95 that could be interested to this PR as well.

@traversaro
Copy link
Collaborator Author

There is CI failure:

CMake Error at /usr/share/miniconda3/envs/test/lib/cmake/BipedalLocomotionFramework/BipedalLocomotionFrameworkTargets.cmake:123 (set_target_properties):
  The link interface of target "BipedalLocomotion::VectorsCollection"
  contains:

    YARP::YARP_robotinterface

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  /usr/share/miniconda3/envs/test/lib/cmake/BipedalLocomotionFramework/BipedalLocomotionFrameworkConfig.cmake:47 (include)
  CMakeLists.txt:5 (find_package)

I guess the problem is to put all ${YARP_LIBRARIES} as public dependency, let me clean that.

@traversaro
Copy link
Collaborator Author

There is CI failure:

CMake Error at /usr/share/miniconda3/envs/test/lib/cmake/BipedalLocomotionFramework/BipedalLocomotionFrameworkTargets.cmake:123 (set_target_properties):
  The link interface of target "BipedalLocomotion::VectorsCollection"
  contains:

    YARP::YARP_robotinterface

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  /usr/share/miniconda3/envs/test/lib/cmake/BipedalLocomotionFramework/BipedalLocomotionFrameworkConfig.cmake:47 (include)
  CMakeLists.txt:5 (find_package)

I guess the problem is to put all ${YARP_LIBRARIES} as public dependency, let me clean that.

Argh, that cleanup went out of hand, I will probably cleanup the PR in the next days.

@traversaro
Copy link
Collaborator Author

Argh, that cleanup went out of hand, I will probably cleanup the PR in the next days.

Fixed and rebased, CI should be happy.

@GiulioRomualdi
Copy link
Member

Thank you!! This was an important missing point!

@traversaro
Copy link
Collaborator Author

A few jobs fail, I will check them when I have a laptop.

Comment on lines 37 to 70
std::string toString(const matioCpp::VariableType& type)
{
switch(type)
{
case matioCpp::VariableType::Element:
return "Element";
case matioCpp::VariableType::Vector:
return "Vector";
case matioCpp::VariableType::MultiDimensionalArray:
return "MultiDimensionalArray";
case matioCpp::VariableType::Struct:
return "Struct";
case matioCpp::VariableType::CellArray:
return "CellArray";
case matioCpp::VariableType::StructArray:
return "StructArray";
case matioCpp::VariableType::Unsupported:
return "Unsupported";
default:
return "Unknown VariableType";
}
}
Copy link
Member

Choose a reason for hiding this comment

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

This does not seem to be used. In any case, what was the use case here? I may also add it to matioCpp

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah right, debugging leftover. Yes, I can add some helped in matio-cpp from my first time experience.

@traversaro
Copy link
Collaborator Author

Windows build is failing with:

[282/463] Building CXX object devices\VectorsCollectionWrapper\CMakeFiles\VectorsCollectionWrapper.dir\yarp_plugin_VectorsCollectionWrapper.cpp.obj
C:\Miniconda3\envs\test\Library\include\yarp/os/api.h(53) : warning:"The YARP::YARP_OS target is deprecated. Use YARP::YARP_os instead"
[283/463] Building CXX object devices\YarpRobotLoggerDevice\tests\CMakeFiles\YarpRobotLoggerDeviceUnitTests.dir\YarpRobotLoggerDeviceTest.cpp.obj
FAILED: devices/YarpRobotLoggerDevice/tests/CMakeFiles/YarpRobotLoggerDeviceUnitTests.dir/YarpRobotLoggerDeviceTest.cpp.obj 
C:\PROGRA~2\MICROS~2\2019\ENTERP~1\VC\Tools\MSVC\1429~1.301\bin\Hostx64\x64\cl.exe  /nologo /TP -DCATCH_CONFIG_DISABLE_MATCHERS -DCATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER -DCATCH_CONFIG_FAST_COMPILE -DCMAKE_BINARY_DIR=\"D:/a/bipedal-locomotion-framework/bipedal-locomotion-framework/build\" -DCMAKE_CURRENT_SOURCE_DIR=\"D:/a/bipedal-locomotion-framework/bipedal-locomotion-framework/devices/YarpRobotLoggerDevice/tests\" -D_USE_MATH_DEFINES -Dcasadi_VERSION=3.6.5 -ID:\a\bipedal-locomotion-framework\bipedal-locomotion-framework\build\_deps\catch2-src\src\catch2\.. -ID:\a\bipedal-locomotion-framework\bipedal-locomotion-framework\build\generated-includes -external:IC:\Miniconda3\envs\test\Library\include -external:IC:\Miniconda3\envs\test\Library\include\eigen3 -external:W0 /DWIN32 /D_WINDOWS /GR /EHsc /O2 /Ob2 /DNDEBUG -std:c++17 -MD /showIncludes /Fodevices\YarpRobotLoggerDevice\tests\CMakeFiles\YarpRobotLoggerDeviceUnitTests.dir\YarpRobotLoggerDeviceTest.cpp.obj /Fddevices\YarpRobotLoggerDevice\tests\CMakeFiles\YarpRobotLoggerDeviceUnitTests.dir\ /FS -c D:\a\bipedal-locomotion-framework\bipedal-locomotion-framework\devices\YarpRobotLoggerDevice\tests\YarpRobotLoggerDeviceTest.cpp
D:\a\bipedal-locomotion-framework\bipedal-locomotion-framework\devices\YarpRobotLoggerDevice\tests\YarpRobotLoggerDeviceTest.cpp(186): error C2679: binary '=': no operator found which takes a right-hand operand of type 'std::filesystem::path' (or there is no acceptable conversion)
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\xstring(3061): note: could be 'std::basic_string<char,std::char_traits<char>,std::allocator<char>> &std::basic_string<char,std::char_traits<char>,std::allocator<char>>::operator =(const _Elem)'

@traversaro
Copy link
Collaborator Author

Ubuntu 20.04 ci is failing with:

YarpRobotLoggerDeviceUnitTests is a Catch2 v3.0.1 host application.
Run with -? for options

-------------------------------------------------------------------------------
Launch simple logger
-------------------------------------------------------------------------------
/home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/devices/YarpRobotLoggerDevice/tests/YarpRobotLoggerDeviceTest.cpp:60
...............................................................................

/home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/devices/YarpRobotLoggerDevice/tests/YarpRobotLoggerDeviceTest.cpp:60: FAILED:
due to unexpected exception with message:
  basic_string::_M_construct null not valid

@traversaro
Copy link
Collaborator Author

Windows build is failing with:

[282/463] Building CXX object devices\VectorsCollectionWrapper\CMakeFiles\VectorsCollectionWrapper.dir\yarp_plugin_VectorsCollectionWrapper.cpp.obj
C:\Miniconda3\envs\test\Library\include\yarp/os/api.h(53) : warning:"The YARP::YARP_OS target is deprecated. Use YARP::YARP_os instead"
[283/463] Building CXX object devices\YarpRobotLoggerDevice\tests\CMakeFiles\YarpRobotLoggerDeviceUnitTests.dir\YarpRobotLoggerDeviceTest.cpp.obj
FAILED: devices/YarpRobotLoggerDevice/tests/CMakeFiles/YarpRobotLoggerDeviceUnitTests.dir/YarpRobotLoggerDeviceTest.cpp.obj 
C:\PROGRA~2\MICROS~2\2019\ENTERP~1\VC\Tools\MSVC\1429~1.301\bin\Hostx64\x64\cl.exe  /nologo /TP -DCATCH_CONFIG_DISABLE_MATCHERS -DCATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER -DCATCH_CONFIG_FAST_COMPILE -DCMAKE_BINARY_DIR=\"D:/a/bipedal-locomotion-framework/bipedal-locomotion-framework/build\" -DCMAKE_CURRENT_SOURCE_DIR=\"D:/a/bipedal-locomotion-framework/bipedal-locomotion-framework/devices/YarpRobotLoggerDevice/tests\" -D_USE_MATH_DEFINES -Dcasadi_VERSION=3.6.5 -ID:\a\bipedal-locomotion-framework\bipedal-locomotion-framework\build\_deps\catch2-src\src\catch2\.. -ID:\a\bipedal-locomotion-framework\bipedal-locomotion-framework\build\generated-includes -external:IC:\Miniconda3\envs\test\Library\include -external:IC:\Miniconda3\envs\test\Library\include\eigen3 -external:W0 /DWIN32 /D_WINDOWS /GR /EHsc /O2 /Ob2 /DNDEBUG -std:c++17 -MD /showIncludes /Fodevices\YarpRobotLoggerDevice\tests\CMakeFiles\YarpRobotLoggerDeviceUnitTests.dir\YarpRobotLoggerDeviceTest.cpp.obj /Fddevices\YarpRobotLoggerDevice\tests\CMakeFiles\YarpRobotLoggerDeviceUnitTests.dir\ /FS -c D:\a\bipedal-locomotion-framework\bipedal-locomotion-framework\devices\YarpRobotLoggerDevice\tests\YarpRobotLoggerDeviceTest.cpp
D:\a\bipedal-locomotion-framework\bipedal-locomotion-framework\devices\YarpRobotLoggerDevice\tests\YarpRobotLoggerDeviceTest.cpp(186): error C2679: binary '=': no operator found which takes a right-hand operand of type 'std::filesystem::path' (or there is no acceptable conversion)
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\xstring(3061): note: could be 'std::basic_string<char,std::char_traits<char>,std::allocator<char>> &std::basic_string<char,std::char_traits<char>,std::allocator<char>>::operator =(const _Elem)'

Probably fixed by @S-Dafarra suggestion in #862 (comment) .

std::string envVarListSeparator = ":";
#define blf_putenv putenv
#endif
std::string original_yarp_data_dirs = getenv("YARP_DATA_DIRS");
Copy link
Member

Choose a reason for hiding this comment

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

Maybe the problem is here. It returns a nullptr if the env variable is not found

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point!

@traversaro
Copy link
Collaborator Author

Ok, all the failures are in the non-conda case, as in that case YARP_DATA_DIRS is not set.

@traversaro
Copy link
Collaborator Author

I replicated the failure locally by unsetting YARP_DATA_DIRS :

(blfdev) root@DESKTOP-T0NQNLN:~/bipedal-locomotion-framework/build# unset YARP_DATA_DIRS
(blfdev) root@DESKTOP-T0NQNLN:~/bipedal-locomotion-framework/build# ctest -VV -R Logger
UpdateCTestConfiguration  from :/root/bipedal-locomotion-framework/build/DartConfiguration.tcl
Parse Config file:/root/bipedal-locomotion-framework/build/DartConfiguration.tcl
UpdateCTestConfiguration  from :/root/bipedal-locomotion-framework/build/DartConfiguration.tcl
Parse Config file:/root/bipedal-locomotion-framework/build/DartConfiguration.tcl
Test project /root/bipedal-locomotion-framework/build
Constructing a list of tests
Done constructing a list of tests
Updating test list for fixtures
Added 0 tests to meet fixture requirements
Checking test dependency graph...
Checking test dependency graph end
test 64
    Start 64: YarpRobotLoggerDeviceUnitTests

64: Test command: /root/bipedal-locomotion-framework/build/bin/YarpRobotLoggerDeviceUnitTests
64: Working Directory: /root/bipedal-locomotion-framework/build/devices/YarpRobotLoggerDevice/tests
64: Environment variable modifications:
64:  LD_PRELOAD=path_list_prepend:/root/bipedal-locomotion-framework/build/lib/libBipedalLocomotionFrameworkMemoryAllocationMonitorPreload.so
64: Test timeout computed to be: 1500
64: Randomness seeded to: 2082810594
64:
64: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
64: YarpRobotLoggerDeviceUnitTests is a Catch2 v3.0.1 host application.
64: Run with -? for options
64:
64: -------------------------------------------------------------------------------
64: Launch simple logger
64: -------------------------------------------------------------------------------
64: /root/bipedal-locomotion-framework/devices/YarpRobotLoggerDevice/tests/YarpRobotLoggerDeviceTest.cpp:60
64: ...............................................................................
64:
64: /root/bipedal-locomotion-framework/devices/YarpRobotLoggerDevice/tests/YarpRobotLoggerDeviceTest.cpp:60: FAILED:
64: due to unexpected exception with message:
64:   basic_string: construction from null is not valid
64:
64: ===============================================================================
64: test cases: 1 | 1 failed
64: assertions: 1 | 1 failed
64:
1/1 Test #64: YarpRobotLoggerDeviceUnitTests ...***Failed    0.01 sec

0% tests passed, 1 tests failed out of 1

Total Test time (real) =   0.02 sec

The following tests FAILED:
         64 - YarpRobotLoggerDeviceUnitTests (Failed)
Errors while running CTest
Output from these tests are in: /root/bipedal-locomotion-framework/build/Testing/Temporary/LastTest.log
Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely.

@traversaro
Copy link
Collaborator Author

Ok, all the failures are in the non-conda case, as in that case YARP_DATA_DIRS is not set.

This was fixed in 7931de9 .

@traversaro
Copy link
Collaborator Author

Last failure:

[INFO] All actions for action level 2 of shutdown phase started. Waiting for unfinished actions.
  [INFO] All actions for action level 2 of shutdown phase finished.
  [INFO] Closing device yarp-robot-logger
  Error: [matioCpp::File::Create] Failed to open the file named robot_logger_device_[202](https://github.com/ami-iit/bipedal-locomotion-framework/actions/runs/9910683283/job/27381641560?pr=862#step:19:203)4_07_12_16_37_17.mat.
  Error: [matioCpp::File::write] The file is not open.
  An error occurred while saving the data to the file.
  [INFO] Closing device sim_imu

We need to modify the logic to account for the different location of the .mat file when using multiple config generators.

@S-Dafarra
Copy link
Member

The name of the file looks weird. Maybe the issue is in https://github.com/robotology/robometry/blob/bb2ea36c90141b9a6ac2be903619786734f95a52/src/librobometry/src/BufferManager.cpp#L325 which converts the format specified in

@S-Dafarra
Copy link
Member

The name of the file looks weird. Maybe the issue is in https://github.com/robotology/robometry/blob/bb2ea36c90141b9a6ac2be903619786734f95a52/src/librobometry/src/BufferManager.cpp#L325 which converts the format specified in

Nevermind, I guess it was just a copy paste issue 😂

@traversaro
Copy link
Collaborator Author

There are some failures on valgrind also, but they are probably related to YARP:

==54315== 
  ==54315== HEAP SUMMARY:
  ==54315==     in use at exit: 731,886 bytes in 4,442 blocks
  ==54315==   total heap usage: 424,432 allocs, 419,990 frees, 40,709,641 bytes allocated
  ==54315== 
  ==54315== 1 bytes in 1 blocks are definitely lost in loss record 227 of 3,800
  ==54315==    at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
  ==54315==    by 0x4EB338E: strdup (strdup.c:42)
  ==54315==    by 0x4888A4B: yarp::robotinterface::impl::XMLReaderFileV3::Private::readRobotFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/install/deps/lib/libYARP_robotinterface.so.3.8.0)
  ==54315==    by 0x488A34A: yarp::robotinterface::impl::XMLReaderFileV3::getRobotFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, yarp::os::Searchable const&, bool) (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/install/deps/lib/libYARP_robotinterface.so.3.8.0)
  ==54315==    by 0x48690D3: yarp::robotinterface::XMLReader::getRobotFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, yarp::os::Searchable const&) (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/install/deps/lib/libYARP_robotinterface.so.3.8.0)
  ==54315==    by 0x12B646: CATCH2_INTERNAL_TEST_0() (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/build/bin/YarpRobotLoggerDeviceUnitTests)
  ==54315==    by 0x14DFBD: Catch::RunContext::invokeActiveTestCase() (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/build/bin/YarpRobotLoggerDeviceUnitTests)
  ==54315==    by 0x14E3F4: Catch::RunContext::runCurrentTest(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/build/bin/YarpRobotLoggerDeviceUnitTests)
  ==54315==    by 0x14E845: Catch::RunContext::runTest(Catch::TestCaseHandle const&) (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/build/bin/YarpRobotLoggerDeviceUnitTests)
  ==54315==    by 0x153CF2: Catch::Session::runInternal() (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/build/bin/YarpRobotLoggerDeviceUnitTests)
  ==54315==    by 0x1541CF: Catch::Session::run() (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/build/bin/YarpRobotLoggerDeviceUnitTests)
  ==54315==    by 0x12A45F: main (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/build/bin/YarpRobotLoggerDeviceUnitTests)
  ==54315== 
  {
     <insert_a_suppression_name_here>
     Memcheck:Leak
     match-leak-kinds: definite
     fun:malloc
     fun:strdup
     fun:_ZN4yarp14robotinterface4impl15XMLReaderFileV37Private17readRobotFromFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
     fun:_ZN4yarp14robotinterface4impl15XMLReaderFileV316getRobotFromFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_2os10SearchableEb
     fun:_ZN4yarp14robotinterface9XMLReader16getRobotFromFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_2os10SearchableE
     fun:_ZL22CATCH2_INTERNAL_TEST_0v
     fun:_ZN5Catch10RunContext20invokeActiveTestCaseEv
     fun:_ZN5Catch10RunContext14runCurrentTestERNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_
     fun:_ZN5Catch10RunContext7runTestERKNS_14TestCaseHandleE
     fun:_ZN5Catch7Session11runInternalEv
     fun:_ZN5Catch7Session3runEv
     fun:main
  }
  ==54315== 16 bytes in 1 blocks are possibly lost in loss record 1,359 of 3,800
  ==54315==    at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
  ==54315==    by 0x40142CF: allocate_dtv_entry (dl-tls.c:582)
  ==54315==    by 0x40142CF: allocate_and_init (dl-tls.c:607)
  ==54315==    by 0x40142CF: tls_get_addr_tail.isra.0 (dl-tls.c:787)
  ==54315==    by 0x401ADEB: __tls_get_addr (tls_get_addr.S:55)
  ==54315==    by 0x11B494C0: spdlog::details::os::thread_id() (in /usr/lib/x86_64-linux-gnu/libspdlog.so.1.5.0)
  ==54315==    by 0x11B49959: spdlog::details::log_msg::log_msg(spdlog::source_loc, fmt::v6::basic_string_view<char>, spdlog::level::level_enum, fmt::v6::basic_string_view<char>) (in /usr/lib/x86_64-linux-gnu/libspdlog.so.1.5.0)
  ==54315==    by 0x1136EC56: void spdlog::logger::log<char const*>(spdlog::source_loc, spdlog::level::level_enum, fmt::v6::basic_string_view<char>, char const* const&) (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/build/lib/yarp/YarpRobotLoggerDevice.so)
  ==54315==    by 0x11340A03: BipedalLocomotion::YarpRobotLoggerDevice::open(yarp::os::Searchable&) (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/build/lib/yarp/YarpRobotLoggerDevice.so)
  ==54315==    by 0x49592AE: yarp::dev::PolyDriver::coreOpen(yarp::os::Searchable&) (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/install/deps/lib/libYARP_dev.so.3.8.0)
  ==54315==    by 0x495A1CA: yarp::dev::PolyDriver::open(yarp::os::Searchable&) (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/install/deps/lib/libYARP_dev.so.3.8.0)
  ==54315==    by 0x485DDED: yarp::robotinterface::Device::open() (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/install/deps/lib/libYARP_robotinterface.so.3.8.0)
  ==54315==    by 0x486126C: yarp::robotinterface::Robot::Private::openDevices() (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/install/deps/lib/libYARP_robotinterface.so.3.8.0)
  ==54315==    by 0x486417B: yarp::robotinterface::Robot::enterPhase(yarp::robotinterface::ActionPhase) (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/install/deps/lib/libYARP_robotinterface.so.3.8.0)
  ==54315== 
  {
     <insert_a_suppression_name_here>
     Memcheck:Leak
     match-leak-kinds: possible
     fun:malloc
     fun:allocate_dtv_entry
     fun:allocate_and_init
     fun:tls_get_addr_tail.isra.0
     fun:__tls_get_addr
     fun:_ZN6spdlog7details2os9thread_idEv
     fun:_ZN6spdlog7details7log_msgC1ENS_10source_locEN3fmt2v617basic_string_viewIcEENS_5level10level_enumES6_
     fun:_ZN6spdlog6logger3logIJPKcEEEvNS_10source_locENS_5level10level_enumEN3fmt2v617basic_string_viewIcEEDpRKT_
     fun:_ZN17BipedalLocomotion21YarpRobotLoggerDevice4openERN4yarp2os10SearchableE
     fun:_ZN4yarp3dev10PolyDriver8coreOpenERNS_2os10SearchableE
     fun:_ZN4yarp3dev10PolyDriver4openERNS_2os10SearchableE
     fun:_ZN4yarp14robotinterface6Device4openEv
     fun:_ZN4yarp14robotinterface5Robot7Private11openDevicesEv
     fun:_ZN4yarp14robotinterface5Robot10enterPhaseENS0_11ActionPhaseE
  }
  ==54315== 16 bytes in 1 blocks are possibly lost in loss record 1,360 of 3,800
  ==54315==    at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
  ==54315==    by 0x40142CF: allocate_dtv_entry (dl-tls.c:582)
  ==54315==    by 0x40142CF: allocate_and_init (dl-tls.c:607)
  ==54315==    by 0x40142CF: tls_get_addr_tail.isra.0 (dl-tls.c:787)
  ==54315==    by 0x401ADEB: __tls_get_addr (tls_get_addr.S:55)
  ==54315==    by 0x14920BEC: ??? (in /usr/lib/x86_64-linux-gnu/libgnutls.so.30.27.0)
  ==54315==    by 0x149115E6: ??? (in /usr/lib/x86_64-linux-gnu/libgnutls.so.30.27.0)
  ==54315==    by 0x4011F6A: _dl_fini (dl-fini.c:138)
  ==54315==    by 0x4E5A8A6: __run_exit_handlers (exit.c:108)
  ==54315==    by 0x4E5AA5F: exit (exit.c:139)
  ==54315==    by 0x4E38089: (below main) (libc-start.c:342)
  ==54315== 
  {
     <insert_a_suppression_name_here>
     Memcheck:Leak
     match-leak-kinds: possible
     fun:malloc
     fun:allocate_dtv_entry
     fun:allocate_and_init
     fun:tls_get_addr_tail.isra.0
     fun:__tls_get_addr
     obj:/usr/lib/x86_64-linux-gnu/libgnutls.so.30.27.0
     obj:/usr/lib/x86_64-linux-gnu/libgnutls.so.30.27.0
     fun:_dl_fini
     fun:__run_exit_handlers
     fun:exit
     fun:(below main)
  }
  ==54315== 688 bytes in 1 blocks are possibly lost in loss record 3,707 of 3,800
  ==54315==    at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
  ==54315==    by 0x401411C: _dl_resize_dtv (dl-tls.c:411)
  ==54315==    by 0x4014B6B: _dl_update_slotinfo (dl-tls.c:701)
  ==54315==    by 0x4014CBB: update_get_addr (dl-tls.c:799)
  ==54315==    by 0x401ADEB: __tls_get_addr (tls_get_addr.S:55)
  ==54315==    by 0x11B494C0: spdlog::details::os::thread_id() (in /usr/lib/x86_64-linux-gnu/libspdlog.so.1.5.0)
  ==54315==    by 0x11B49959: spdlog::details::log_msg::log_msg(spdlog::source_loc, fmt::v6::basic_string_view<char>, spdlog::level::level_enum, fmt::v6::basic_string_view<char>) (in /usr/lib/x86_64-linux-gnu/libspdlog.so.1.5.0)
  ==54315==    by 0x1136EC56: void spdlog::logger::log<char const*>(spdlog::source_loc, spdlog::level::level_enum, fmt::v6::basic_string_view<char>, char const* const&) (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/build/lib/yarp/YarpRobotLoggerDevice.so)
  ==54315==    by 0x11340A03: BipedalLocomotion::YarpRobotLoggerDevice::open(yarp::os::Searchable&) (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/build/lib/yarp/YarpRobotLoggerDevice.so)
  ==54315==    by 0x49592AE: yarp::dev::PolyDriver::coreOpen(yarp::os::Searchable&) (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/install/deps/lib/libYARP_dev.so.3.8.0)
  ==54315==    by 0x495A1CA: yarp::dev::PolyDriver::open(yarp::os::Searchable&) (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/install/deps/lib/libYARP_dev.so.3.8.0)
  ==54315==    by 0x485DDED: yarp::robotinterface::Device::open() (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/install/deps/lib/libYARP_robotinterface.so.3.8.0)
  ==54315== 
  {
     <insert_a_suppression_name_here>
     Memcheck:Leak
     match-leak-kinds: possible
     fun:malloc
     fun:_dl_resize_dtv
     fun:_dl_update_slotinfo
     fun:update_get_addr
     fun:__tls_get_addr
     fun:_ZN6spdlog7details2os9thread_idEv
     fun:_ZN6spdlog7details7log_msgC1ENS_10source_locEN3fmt2v617basic_string_viewIcEENS_5level10level_enumES6_
     fun:_ZN6spdlog6logger3logIJPKcEEEvNS_10source_locENS_5level10level_enumEN3fmt2v617basic_string_viewIcEEDpRKT_
     fun:_ZN17BipedalLocomotion21YarpRobotLoggerDevice4openERN4yarp2os10SearchableE
     fun:_ZN4yarp3dev10PolyDriver8coreOpenERNS_2os10SearchableE
     fun:_ZN4yarp3dev10PolyDriver4openERNS_2os10SearchableE
     fun:_ZN4yarp14robotinterface6Device4openEv
  }
  ==54315== 6,408 (160 direct, 6,248 indirect) bytes in 1 blocks are definitely lost in loss record 3,791 of 3,800
  ==54315==    at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
  ==54315==    by 0x486860C: yarp::robotinterface::XMLReader::getRobotFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, yarp::os::Searchable const&) (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/install/deps/lib/libYARP_robotinterface.so.3.8.0)
  ==54315==    by 0x12B646: CATCH2_INTERNAL_TEST_0() (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/build/bin/YarpRobotLoggerDeviceUnitTests)
  ==54315==    by 0x14DFBD: Catch::RunContext::invokeActiveTestCase() (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/build/bin/YarpRobotLoggerDeviceUnitTests)
  ==54315==    by 0x14E3F4: Catch::RunContext::runCurrentTest(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/build/bin/YarpRobotLoggerDeviceUnitTests)
  ==54315==    by 0x14E845: Catch::RunContext::runTest(Catch::TestCaseHandle const&) (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/build/bin/YarpRobotLoggerDeviceUnitTests)
  ==54315==    by 0x153CF2: Catch::Session::runInternal() (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/build/bin/YarpRobotLoggerDeviceUnitTests)
  ==54315==    by 0x1541CF: Catch::Session::run() (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/build/bin/YarpRobotLoggerDeviceUnitTests)
  ==54315==    by 0x12A45F: main (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/build/bin/YarpRobotLoggerDeviceUnitTests)
  ==54315== 
  {
     <insert_a_suppression_name_here>
     Memcheck:Leak
     match-leak-kinds: definite
     fun:_Znwm
     fun:_ZN4yarp14robotinterface9XMLReader16getRobotFromFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_2os10SearchableE
     fun:_ZL22CATCH2_INTERNAL_TEST_0v
     fun:_ZN5Catch10RunContext20invokeActiveTestCaseEv
     fun:_ZN5Catch10RunContext14runCurrentTestERNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_
     fun:_ZN5Catch10RunContext7runTestERKNS_14TestCaseHandleE
     fun:_ZN5Catch7Session11runInternalEv
     fun:_ZN5Catch7Session3runEv
     fun:main
  }
  ==54315== LEAK SUMMARY:
  ==54315==    definitely lost: 161 bytes in 2 blocks
  ==54315==    indirectly lost: 6,248 bytes in 51 blocks
  ==54315==      possibly lost: 720 bytes in 3 blocks
  ==54315==    still reachable: 723,405 bytes in 4,368 blocks
  ==54315==                       of which reachable via heuristic:
  ==54315==                         newarray           : 1,536 bytes in 16 blocks
  ==54315==         suppressed: 1,352 bytes in 18 blocks
  ==54315== Reachable blocks (those to which a pointer was found) are not shown.
  ==54315== To see them, rerun with: --leak-check=full --show-leak-kinds=all
  ==54315== 
  ==54315== For lists of detected and suppressed errors, rerun with: -s
  ==54315== ERROR SUMMARY: 5 errors from 5 contexts (suppressed: 18 from 18)
  

@traversaro
Copy link
Collaborator Author

[84/464] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_case_insensitive_comparisons.cpp.o
FAILED: _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_case_insensitive_comparisons.cpp.o 
/usr/share/miniconda3/envs/test/bin/x86_64-conda-linux-gnu-c++ -Dcasadi_VERSION=3.6.6 -I/home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/build/_deps/catch2-src/src/catch2/.. -I/home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/build/generated-includes -fvisibility-inlines-hidden -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /usr/share/miniconda3/envs/test/include -O3 -DNDEBUG -std=c++17 -fPIC -ffile-prefix-map=/home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/build/_deps/catch2-src=. -MD -MT _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_case_insensitive_comparisons.cpp.o -MF _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_case_insensitive_comparisons.cpp.o.d -o _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_case_insensitive_comparisons.cpp.o -c /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/build/_deps/catch2-src/src/catch2/internal/catch_case_insensitive_comparisons.cpp
In file included from /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/build/_deps/catch2-src/src/catch2/internal/catch_case_insensitive_comparisons.cpp:10:
/home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/build/_deps/catch2-src/src/catch2/../catch2/internal/catch_string_manip.hpp:47:14: error: 'uint64_t' in namespace 'std' does not name a type; did you mean 'wint_t'?
   47 |         std::uint64_t m_count;
      |              ^~~~~~~~
      |              wint_t

I had the same failure on conda-forge, I solved de-vendoring catch2, but I guess also updating the FetchContent's catch2 should solve the problem.

@GiulioRomualdi
Copy link
Member

Hi @traversaro could you please rebase it on top of master?

@traversaro
Copy link
Collaborator Author

Hi @traversaro could you please rebase it on top of master?

Sorry, I missed this comment, I guess you merged yourself?

@GiulioRomualdi
Copy link
Member

yes don't worry :)

@GiulioRomualdi
Copy link
Member

Unfortunately the CI fails with

ERROR] Cannot write to yarp name server
  Error:  Cannot write to yarp name server

@traversaro
Copy link
Collaborator Author

traversaro commented Sep 26, 2024

I think the test passes fine, see:

        Start 149: YarpRobotLoggerDeviceUnitTests
146/151 Test #149: YarpRobotLoggerDeviceUnitTests .................................   Passed    5.09 sec

That error message is due to some code that access directly the server without respecting the setLocalMode of YARP, but it does not make the test fail.

The test fails to a leak in libYARP_manager, according to valgrind:

2024-09-25T15:00:10.3277815Z [INFO] Closing device yarp-robot-logger
2024-09-25T15:00:10.3278260Z bash: /scripts/robotologyGitStatus.sh: No such file or directory
2024-09-25T15:00:10.3278597Z 
2024-09-25T15:00:10.3278868Z WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
2024-09-25T15:00:10.3279259Z 
2024-09-25T15:00:10.3279358Z [INFO] Closing device sim_imu
2024-09-25T15:00:10.3279656Z [INFO] Closing device sim_controlboard
2024-09-25T15:00:10.3279976Z [INFO] shutdown phase finished.
2024-09-25T15:00:10.3280302Z ===============================================================================
2024-09-25T15:00:10.3280706Z All tests passed (17 assertions in 1 test case)
2024-09-25T15:00:10.3281104Z 
2024-09-25T15:00:10.3281192Z ==53249== 
2024-09-25T15:00:10.3281401Z ==53249== HEAP SUMMARY:
2024-09-25T15:00:10.3281722Z ==53249==     in use at exit: 727,626 bytes in 4,430 blocks
2024-09-25T15:00:10.3282257Z ==53249==   total heap usage: 421,414 allocs, 416,984 frees, 40,293,295 bytes allocated
2024-09-25T15:00:10.3282710Z ==53249== 
2024-09-25T15:00:10.3283064Z ==53249== 1 bytes in 1 blocks are definitely lost in loss record 227 of 3,798
2024-09-25T15:00:10.3283866Z ==53249==    at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
2024-09-25T15:00:10.3284467Z ==53249==    by 0x509338E: strdup (strdup.c:42)
2024-09-25T15:00:10.3286114Z ==53249==    by 0x488DA4B: yarp::robotinterface::impl::XMLReaderFileV3::Private::readRobotFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/install/deps/lib/libYARP_robotinterface.so.3.8.0)
2024-09-25T15:00:10.3288894Z ==53249==    by 0x488F34A: yarp::robotinterface::impl::XMLReaderFileV3::getRobotFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, yarp::os::Searchable const&, bool) (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/install/deps/lib/libYARP_robotinterface.so.3.8.0)
2024-09-25T15:00:10.3291662Z ==53249==    by 0x486E0D3: yarp::robotinterface::XMLReader::getRobotFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, yarp::os::Searchable const&) (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/install/deps/lib/libYARP_robotinterface.so.3.8.0)
2024-09-25T15:00:10.3293854Z ==53249==    by 0x1118A2: CATCH2_INTERNAL_TEST_0() (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/build/bin/YarpRobotLoggerDeviceUnitTests)
2024-09-25T15:00:10.3295429Z ==53249==    by 0x4982E0E: Catch::RunContext::invokeActiveTestCase() (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/build/lib/libCatch2.so.3.7.1)
2024-09-25T15:00:10.3296958Z ==53249==    by 0x4983C2E: Catch::RunContext::runCurrentTest() (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/build/lib/libCatch2.so.3.7.1)
2024-09-25T15:00:10.3298617Z ==53249==    by 0x4984063: Catch::RunContext::runTest(Catch::TestCaseHandle const&) (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/build/lib/libCatch2.so.3.7.1)
2024-09-25T15:00:10.3300175Z ==53249==    by 0x49592FA: Catch::Session::runInternal() (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/build/lib/libCatch2.so.3.7.1)
2024-09-25T15:00:10.3301626Z ==53249==    by 0x49597DF: Catch::Session::run() (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/build/lib/libCatch2.so.3.7.1)
2024-09-25T15:00:10.3302968Z ==53249==    by 0x484B1DF: main (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/build/lib/libCatch2Main.so.3.7.1)
2024-09-25T15:00:10.3303710Z ==53249== 
2024-09-25T15:00:10.3303905Z {
2024-09-25T15:00:10.3304359Z    <insert_a_suppression_name_here>
2024-09-25T15:00:10.3304712Z    Memcheck:Leak
2024-09-25T15:00:10.3305004Z    match-leak-kinds: definite
2024-09-25T15:00:10.3305273Z    fun:malloc
2024-09-25T15:00:10.3305484Z    fun:strdup
2024-09-25T15:00:10.3306156Z    fun:_ZN4yarp14robotinterface4impl15XMLReaderFileV37Private17readRobotFromFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
2024-09-25T15:00:10.3307386Z    fun:_ZN4yarp14robotinterface4impl15XMLReaderFileV316getRobotFromFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_2os10SearchableEb
2024-09-25T15:00:10.3308565Z    fun:_ZN4yarp14robotinterface9XMLReader16getRobotFromFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_2os10SearchableE
2024-09-25T15:00:10.3309279Z    fun:_ZL22CATCH2_INTERNAL_TEST_0v
2024-09-25T15:00:10.3309845Z    fun:_ZN5Catch10RunContext20invokeActiveTestCaseEv
2024-09-25T15:00:10.3310279Z    fun:_ZN5Catch10RunContext14runCurrentTestEv
2024-09-25T15:00:10.3310725Z    fun:_ZN5Catch10RunContext7runTestERKNS_14TestCaseHandleE
2024-09-25T15:00:10.3311142Z    fun:_ZN5Catch7Session11runInternalEv
2024-09-25T15:00:10.3311468Z    fun:_ZN5Catch7Session3runEv
2024-09-25T15:00:10.3311738Z    fun:main
2024-09-25T15:00:10.3311930Z }
2024-09-25T15:00:10.3312399Z ==53249== 6,408 (160 direct, 6,248 indirect) bytes in 1 blocks are definitely lost in loss record 3,789 of 3,798
2024-09-25T15:00:10.3313427Z ==53249==    at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
2024-09-25T15:00:10.3315401Z ==53249==    by 0x486D60C: yarp::robotinterface::XMLReader::getRobotFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, yarp::os::Searchable const&) (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/install/deps/lib/libYARP_robotinterface.so.3.8.0)
2024-09-25T15:00:10.3317478Z ==53249==    by 0x1118A2: CATCH2_INTERNAL_TEST_0() (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/build/bin/YarpRobotLoggerDeviceUnitTests)
2024-09-25T15:00:10.3319033Z ==53249==    by 0x4982E0E: Catch::RunContext::invokeActiveTestCase() (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/build/lib/libCatch2.so.3.7.1)
2024-09-25T15:00:10.3320547Z ==53249==    by 0x4983C2E: Catch::RunContext::runCurrentTest() (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/build/lib/libCatch2.so.3.7.1)
2024-09-25T15:00:10.3322235Z ==53249==    by 0x4984063: Catch::RunContext::runTest(Catch::TestCaseHandle const&) (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/build/lib/libCatch2.so.3.7.1)
2024-09-25T15:00:10.3323787Z ==53249==    by 0x49592FA: Catch::Session::runInternal() (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/build/lib/libCatch2.so.3.7.1)
2024-09-25T15:00:10.3325227Z ==53249==    by 0x49597DF: Catch::Session::run() (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/build/lib/libCatch2.so.3.7.1)
2024-09-25T15:00:10.3326631Z ==53249==    by 0x484B1DF: main (in /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/build/lib/libCatch2Main.so.3.7.1)
2024-09-25T15:00:10.3327382Z ==53249== 
2024-09-25T15:00:10.3327577Z {
2024-09-25T15:00:10.3327781Z    <insert_a_suppression_name_here>
2024-09-25T15:00:10.3328081Z    Memcheck:Leak
2024-09-25T15:00:10.3328364Z    match-leak-kinds: definite
2024-09-25T15:00:10.3328628Z    fun:_Znwm
2024-09-25T15:00:10.3329268Z    fun:_ZN4yarp14robotinterface9XMLReader16getRobotFromFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_2os10SearchableE
2024-09-25T15:00:10.3329992Z    fun:_ZL22CATCH2_INTERNAL_TEST_0v
2024-09-25T15:00:10.3330362Z    fun:_ZN5Catch10RunContext20invokeActiveTestCaseEv
2024-09-25T15:00:10.3330792Z    fun:_ZN5Catch10RunContext14runCurrentTestEv
2024-09-25T15:00:10.3331230Z    fun:_ZN5Catch10RunContext7runTestERKNS_14TestCaseHandleE
2024-09-25T15:00:10.3331645Z    fun:_ZN5Catch7Session11runInternalEv
2024-09-25T15:00:10.3331975Z    fun:_ZN5Catch7Session3runEv
2024-09-25T15:00:10.3332246Z    fun:main
2024-09-25T15:00:10.3332433Z }
2024-09-25T15:00:10.3332625Z ==53249== LEAK SUMMARY:
2024-09-25T15:00:10.3332923Z ==53249==    definitely lost: 161 bytes in 2 blocks
2024-09-25T15:00:10.3333325Z ==53249==    indirectly lost: 6,248 bytes in 51 blocks
2024-09-25T15:00:10.3333725Z ==53249==      possibly lost: 0 bytes in 0 blocks
2024-09-25T15:00:10.3334136Z ==53249==    still reachable: 719,865 bytes in 4,359 blocks
2024-09-25T15:00:10.3334568Z ==53249==                       of which reachable via heuristic:
2024-09-25T15:00:10.3335025Z ==53249==                         newarray           : 1,536 bytes in 16 blocks
2024-09-25T15:00:10.3335461Z ==53249==         suppressed: 1,352 bytes in 18 blocks
2024-09-25T15:00:10.3336094Z ==53249== Reachable blocks (those to which a pointer was found) are not shown.
2024-09-25T15:00:10.3336770Z ==53249== To see them, rerun with: --leak-check=full --show-leak-kinds=all
2024-09-25T15:00:10.3337196Z ==53249== 
2024-09-25T15:00:10.3337560Z ==53249== For lists of detected and suppressed errors, rerun with: -s
2024-09-25T15:00:10.3338132Z ==53249== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 18 from 18)
2024-09-25T15:00:10.3338491Z 
2024-09-25T15:05:33.5702440Z 151/151 Test #148: memcheck_CentroidalMPCUnitTests ................................   Passed  347.52 sec

@traversaro
Copy link
Collaborator Author

There is still a macos error:

E   ImportError: dlopen(/Users/runner/miniconda3/envs/test/lib/python3.11/site-packages/idyntree/_iDynTree.so, 0x0002): symbol not found in flat namespace '_SCOTCH_errorPrint'
_ ERROR collecting bindings/python/Contacts/tests/test_fixed_foot_detector.py __

but this is a conda-forge problem tracked in conda-forge/idyntree-feedstock#105 .

@traversaro
Copy link
Collaborator Author

traversaro commented Sep 26, 2024

Cool, now a totally unrelated test is failing with a leak, probably due to tbb.

129/151 Test #120: memcheck_ArucoDetectorTestUnitTests ............................***Failed    6.59 sec
==53154== Memcheck, a memory error detector
==53154== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==53154== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==53154== Command: /home/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/build/bin/ArucoDetectorTestUnitTests
==53154== 
Randomness seeded to: 721226125
===============================================================================
All tests passed (6 assertions in 1 test case)

==53154== 
==53154== HEAP SUMMARY:
==53154==     in use at exit: 414,121 bytes in 3,536 blocks
==53154==   total heap usage: 121,981 allocs, 118,445 frees, 29,794,923 bytes allocated
==53154== 
==53154== 512 bytes in 1 blocks are possibly lost in loss record 3,446 of 3,530
==53154==    at 0x483DD99: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==53154==    by 0x40149DA: allocate_dtv (dl-tls.c:286)
==53154==    by 0x40149DA: _dl_allocate_tls (dl-tls.c:532)
==53154==    by 0x77C1322: allocate_stack (allocatestack.c:622)
==53154==    by 0x77C1322: pthread_create@@GLIBC_2.2.5 (pthread_create.c:660)
==53154==    by 0x7819750: ??? (in /usr/lib/x86_64-linux-gnu/libtbb.so.2)
==53154==    by 0x78199EE: ??? (in /usr/lib/x86_64-linux-gnu/libtbb.so.2)
==53154==    by 0x7819A8C: ??? (in /usr/lib/x86_64-linux-gnu/libtbb.so.2)
==53154==    by 0x77C0608: start_thread (pthread_create.c:477)
==53154==    by 0x510A352: clone (clone.S:95)
==53154== 
{
   <insert_a_suppression_name_here>
   Memcheck:Leak
   match-leak-kinds: possible
   fun:calloc
   fun:allocate_dtv
   fun:_dl_allocate_tls
   fun:allocate_stack
   fun:pthread_create@@GLIBC_2.2.5
   obj:/usr/lib/x86_64-linux-gnu/libtbb.so.2
   obj:/usr/lib/x86_64-linux-gnu/libtbb.so.2
   obj:/usr/lib/x86_64-linux-gnu/libtbb.so.2
   fun:start_thread
   fun:clone
}
==53154== LEAK SUMMARY:
==53154==    definitely lost: 0 bytes in 0 blocks
==53154==    indirectly lost: 0 bytes in 0 blocks
==53154==      possibly lost: 512 bytes in 1 blocks
==53154==    still reachable: 413,609 bytes in 3,535 blocks
==53154==         suppressed: 0 bytes in 0 blocks
==53154== Reachable blocks (those to which a pointer was found) are not shown.
==53154== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==53154== 
==53154== For lists of detected and suppressed errors, rerun with: -s
==53154== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)

@GiulioRomualdi GiulioRomualdi merged commit e112ac2 into master Sep 27, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants