ros2_control
ros2_control copied to clipboard
Check that all packages use gmock, not gtest
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
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.
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
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.
we are using gmock in all the packages AFAIK but it could be worth a check
@bmagyar , @destogl , can someone explain this?
@GreatAlexander te gusta?
@bmagyar is this actually still an issue?