Ask Your Question
2

No executables generated by building unit test cpp with catkin

asked 2013-04-20 09:03:53 -0500

130s gravatar image

updated 2013-04-20 12:16:52 -0500

I'm trying to build by using catkin my gtest testsuite.

catkin_add_gtest replaces rosbuild_add_gtest according to migrating_from_rosbuild wiki page. rosbuild_add_gtest generates executable for gtest according to this page. Therefore I expects that catkin_add_gtest also generates executable for my test cases. However, no executable is found in my catkin workspace after catkin_makeing.

Part of my CMakeLists.txt:

include_directories(${mypkg_INCLUDE_DIRECTORIES} ${catkin_INCLUDE_DIRS} ${MYDEPENDLIB_INCLUDE_DIR})
add_library(${PROJECT_NAME} ${mypkg_SRCS} ${mypkg_MOCS} ${mypkg_UIS_H})
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${MYDEPENDLIB_LIBRARIES})

## Setting Unit Test
catkin_add_gtest(testsuite_mypkg test/test_marble.cpp)
target_link_libraries(testsuite_mypkg ${PROJECT_NAME})

(A library file specified by ${PROJECT_NAME} is generated successfully).

Result of find:

~/catkin_ws$ find . -iname '*test*mypkg*'
./src/mypkg/test/test_mypkg.cpp
./build/mypkg/CMakeFiles/_run_tests_mypkg.dir
./build/mypkg/CMakeFiles/testsuite_mypkg.dir
./build/mypkg/CMakeFiles/_run_tests_mypkg_gtest.dir
./build/mypkg/CMakeFiles/run_tests_mypkg.dir
./build/mypkg/CMakeFiles/_run_tests_mypkg_gtest_testsuite_mypkg.dir
./build/mypkg/CMakeFiles/run_tests_mypkg_gtest.dir
./build/mypkg/CMakeFiles/run_tests_mypkg_gtest_testsuite_mypkg.dir

What is missing/wrong?

Also I searched an example that uses the same catkin_add_gtest to generate executable, and I found test_rosbag. But catkin_makeing it hasn't produced any executables either as far as I've tried.

Thanks!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2013-04-20 19:40:23 -0500

William gravatar image

I'm not sure about intermediate test executables, but there should be tab completable make targets for running the tests. For example:

$ make run_tests

Should build and run all of the tests.

edit flag offensive delete link more

Comments

I see. I found that my question is basically the same with this thread that you answered.

130s gravatar image 130s  ( 2013-04-21 18:34:16 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-04-20 09:03:53 -0500

Seen: 844 times

Last updated: Apr 20 '13