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

How to detect launch file validation failure in a script ?

asked 2021-09-01 08:25:03 -0500

Mackou gravatar image

Hello,

I am trying to setup launch file validation within my repo's CI using roslaunch_add_file_check. My CMakeLists.txt looks like this :

cmake_minimum_required(VERSION 2.8.3)
project(package)

find_package(catkin REQUIRED)
catkin_package()

if (CATKIN_ENABLE_TESTING)
    find_package(roslaunch REQUIRED)
    find_package(rostest REQUIRED)
    roslaunch_add_file_check(launch)
endif (CATKIN_ENABLE_TESTING)

install(DIRECTORY
  config launch
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})

I have some (expected) errors in my package when running the test with :

catkin_make --only-pkg-with-deps package
catkin_make run_tests_package

And the output is very clear :

Missing package dependencies: other_package/package.xml: robot_state_publisher (notify upstream maintainer)

But when I try to check the return code of the command with :

echo $?

I get : 0. Which means the command finished successfully. Which makes it very hard to detect the failure in a script. Is there a way to force cmake to return a non zero code when the test fail ?

Thanks !

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2021-09-02 02:53:07 -0500

Mackou gravatar image

Thanks to @gvdhoorn for the answer.

Quoting the catkin tools doc :

For catkin packages and the run_tests target, failing tests will not result in an non-zero exit code. So if you want to check for failing tests, use the catkin_test_results command like this: $ catkin_test_results build/<package name="">

edit flag offensive delete link more
1

answered 2021-09-01 13:31:50 -0500

gvdhoorn gravatar image

See ros/catkin#576 and catkin/catkin_tools#245 for related discussions.

Summarising: there are people who say that you should run catkin_test_results to check whether testing was successful.

edit flag offensive delete link more

Comments

That's the right answer thanks ! I overlooked this part in the documentation.

Mackou gravatar image Mackou  ( 2021-09-02 02:51:39 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2021-09-01 08:25:03 -0500

Seen: 124 times

Last updated: Sep 02 '21