ros2_control icon indicating copy to clipboard operation
ros2_control copied to clipboard

Check that all packages use gmock, not gtest

Open bmagyar opened this issue 4 years ago • 7 comments

Examples:

  • here we grab both gtest and gmock, one should really be enough the the gtest tests ported to gmock: https://github.com/ros-controls/ros2_control/blob/master/controller_manager/CMakeLists.txt#L47

  • here no testing package was grabbet yet is magically works: https://github.com/ros-controls/ros2_control/blob/master/hardware_interface/CMakeLists.txt#L53 probably better to grab it explicitly

bmagyar avatar Jun 01 '20 08:06 bmagyar

hardware_interfaces uses ament_lint_auto_find_test_dependencies

Which gets the ament_cmake_gtest dependency from the package.xml The find_package it performs doesn't have the REQUIRED flag. So I believe we should add it explicitly.

Regarding controller_manager, find_package(ament_cmake_gmock REQUIRED) does not trigger a find_package(ament_cmake_gtest).

If you remove find_package(ament_cmake_gtest) from CMakeLists.txt and <test_depend>ament_cmake_gtest</test_depend> from package.xml, CMake execution will fail because ament_add_gtest command is not defined.

So IMO we need to keep find_package for ament_cmake_gtest and ament_cmake_gmock.

Unless we want to move this discussion to a higher place where this behavior can be changed.

v-lopez avatar Jun 04 '20 11:06 v-lopez

Thinking a bit more about ament_lint_auto_find_test_dependencies, I thought it could've been done to avoid all this redundancy between package.xml and CMakeLists.txt.

But checking some core packages, they have the ament_lint_auto_find_test_dependencies as well as find_package(ament_cmake_gtest REQUIRED). For instance: rclcpp and rclcpp_action

v-lopez avatar Jun 04 '20 12:06 v-lopez

I also think we shoudl only use either gtest or gmock in the repo, but at least in a single package for simplicity and cleanliness.

bmagyar avatar Jun 04 '20 13:06 bmagyar

we are using gmock in all the packages AFAIK but it could be worth a check

bmagyar avatar Feb 15 '21 18:02 bmagyar

@bmagyar , @destogl , can someone explain this?

bailaC avatar Oct 20 '21 13:10 bailaC

@GreatAlexander te gusta?

bmagyar avatar May 29 '23 13:05 bmagyar

@bmagyar is this actually still an issue?

destogl avatar May 30 '23 13:05 destogl