My team is currently transitioning from Ubuntu 12.04 and ROS Fuerte to Ubuntu 14.04 and ROS Indigo. All of our software is heavily tested using gtest and gmock. The latter is proving particularly difficult during this migration.
In Ubuntu 12.04, the gtest package is source-only, so rosbuild's public.cmake is hard-coded to check for that and compile it as needed. However, gmock's package includes a compiled library, so we just needed to make sure we added it to our linker and we were good to go.
We didn't investigate any further at the time, but it turned out that this only worked out of pure luck. I've since learned that gmock is distributed with a version of gtest included, and must use that version. As luck would have it, the packages in the repos were in sync (i.e. the gtest version was the same as the version of gtest included in gmock).
I learned that because now it's biting us in Ubuntu 14.04. Gmock has changed to also be distributed as source-only, but of course it still includes a version of gtest. However, this time the version of gtest contained within gmock was not in sync with the gtest package, so I spent some time tracking that down (ended up stealing a later version of the gtest package from the next Ubuntu release). Ideally I'd just uninstall the libgtest-dev package, but half the ROS packages depend upon it.
Anyway, in Indigo, Catkin still has the hard-coded logic to look in /usr/src/gtest/src
for gtest's source, which is where the libgtest-dev installs it. However, that makes it downright impossible to link in gmock without some serious alterations to gmock. When using gmock, ideally one would simply add it to the CMakeLists.txt and use as well as gtest (since gmock pulls in gtest). However, we can't do that since Catkin automatically pulls in the libgtest-dev's version of gtest, and pulling in gmock just defines the libgtest and libgtest_main targets twice, which obviously doesn't fly.
I feel like my only option is to disable Catkin's testing and stop using Catkin's gtest macros and essentially roll my own version that uses gmock and its bundled gtest instead. Or move to another mocking framework, which would be... painful.
I know other people were using gtest and gmock in 12.04 and rosbuild, but I've seen nothing for gmock and Catkin. What is everyone else doing?
Originally posted by kyrofa on ROS Answers with karma: 347 on 2014-12-17
Post score: 2