ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

rostest file layout- can't find/tries to compile/no rule to make target, existing .test file

asked 2013-01-30 15:37:31 -0500

toborguru gravatar image

updated 2013-01-30 18:11:17 -0500

If I compile my test bench using rosbuild_add_gtest then roscore is normally not running, and the test fails to connect. Which is why I'm trying to setup an rostest file.

I have written a differential_drive.test file in differential_drive/smurf/ ie. differential_drive/smurf/differential_drive.test

FYI smurf directory name used to differentiate values, only for testing/debugging.

Just FYI ls output from differential_drive dir:

$ ls
bin  build  CMakeLists.txt  launch  lib  mainpage.dox  Makefile  manifest.xml  msg  msg_gen  smurf  src  test

I can successfully run this test using:

$ rostest smurf/differential_drive.test
... logging to /home/tobor/.ros/log/rostest-meltybrain-17188.log
[ROSUNIT] Outputting test results to /home/tobor/.ros/test_results/differential_drive/rostest-smurf_differential_drive.xml
testdifferential_drive_ros_tests ... ok

[ROSTEST]-----------------------------------------------------------------------

...

SUMMARY
 * RESULT: SUCCESS
 * TESTS: 6
 * ERRORS: 0
 * FAILURES: 0

rostest log file is in /home/tobor/.ros/log/rostest-meltybrain-17188.log

However I am having trouble setting up the CMakeLists.txt file to run this automatically.

Here are the relevent CMakeLists.txt lines:

rosbuild_add_executable(
  test_2/differential_drive_ros_tests
  TestRunner.cpp
...
)
rosbuild_add_gtest_build_flags(test_2/differential_drive_ros_tests)
rosbuild_add_rostest(smurf/differential_drive.test)

Some make test output:

[100%] Built target test_2/differential_drive_ros_tests
[100%] Built target tests
make[3]: *** No rule to make target '../test/smurf/differential_drive.test', needed by 'test/CMakeFiles/rostest_smurf_differential_drive.test'.  Stop.
make[2]: *** [test/CMakeFiles/rostest_smurf_differential_drive.test.dir/all] Error 2

Any ideas?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-01-31 13:12:55 -0500

toborguru gravatar image

updated 2013-01-31 13:13:39 -0500

OK so the CMakelists.txt file was in the test directory. Basically everything got confused as to where the test file was during the build.

Solution, explicitly state where the file is in the project:

rosbuild_add_rostest(${PROJECT_SOURCE_DIR}/test/differential_drive.test)

or, per my example:

rosbuild_add_rostest(${PROJECT_SOURCE_DIR}/smurf/differential_drive.test)
edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-01-30 15:37:31 -0500

Seen: 484 times

Last updated: Jan 31 '13