catkin_tools icon indicating copy to clipboard operation
catkin_tools copied to clipboard

Tests too verbose

Open davetcoleman opened this issue 9 years ago • 14 comments

MoveIt! is using the following alias for running its tests on Travis via Docker:

run_tests: build --verbose --catkin-make-args run_tests --

However the verbose argument results in really long log files that get cut off by Travis' limit. e.g. from this build a small snippet of the noise:

make[3]: Leaving directory '/root/ws_moveit/build/moveit_ikfast'
/usr/bin/make -f CMakeFiles/run_tests.dir/build.make CMakeFiles/run_tests.dir/build
make[3]: Entering directory '/root/ws_moveit/build/moveit_ikfast'
make[3]: Nothing to be done for 'CMakeFiles/run_tests.dir/build'.
make[3]: Leaving directory '/root/ws_moveit/build/moveit_ikfast'
Built target run_tests
make[2]: Leaving directory '/root/ws_moveit/build/moveit_ikfast'
/usr/bin/cmake -E cmake_progress_start /root/ws_moveit/build/moveit_ikfast/CMakeFiles 0
make[1]: Leaving directory '/root/ws_moveit/build/moveit_ikfast'
cd /root/ws_moveit/build/moveit_ikfast; catkin build --get-env moveit_ikfast | catkin env -si  /usr/bin/make run_tests --jobserver-fds=6,7 -j; cd -
Finished << moveit_ikfast:make
Starting >> moveit_ikfast:symlink
Output << moveit_ikfast:symlink /root/ws_moveit/logs/moveit_ikfast/build.symlink.002.log
Linked: (/root/ws_moveit/devel/.private/moveit_ikfast/share/moveit_ikfast/cmake/moveit_ikfastConfig-version.cmake, /root/ws_moveit/devel/share/moveit_ikfast/cmake/moveit_ikfastConfig-version.cmake)
Linked: (/root/ws_moveit/devel/.private/moveit_ikfast/share/moveit_ikfast/cmake/moveit_ikfastConfig.cmake, /root/ws_moveit/devel/share/moveit_ikfast/cmake/moveit_ikfastConfig.cmake)
Linked: (/root/ws_moveit/devel/.private/moveit_ikfast/lib/pkgconfig/moveit_ikfast.pc, /root/ws_moveit/devel/lib/pkgconfig/moveit_ikfast.pc)

I tried removing the --verbose flag but then I also lose the important test results data, e.g. from this build it is missing the output that looks like:

[==========] Running 6 tests from 2 test cases.
[----------] Global test environment set-up.
[----------] 1 test from TestPropagationDistanceField
[ RUN      ] TestPropagationDistanceField.TestAddRemovePoints
[==========] Running 2 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 2 tests from LoadPlanningModelsPr2
[ RUN      ] LoadPlanningModelsPr2.InitOK
[       OK ] TestPropagationDistanceField.TestAddRemovePoints (11 ms)
[----------] 1 test from TestPropagationDistanceField (11 ms total)

How can I hide the build noise but still show the test results? catkin_test_results will give you a one line summary of failures, but not tell you which tests failed.

I suspect a new verb proposed in https://github.com/catkin/catkin_tools/issues/397 might address this issue.

davetcoleman avatar Oct 06 '16 15:10 davetcoleman

:+1: the verbose arguments results in test being hidden in dozens of lines. This is un-readable. @davetcoleman have you found a "trick" to make things better? I didn't!

I'm sticking to catkin_make when I want to read test results because of this issue.

VictorLamoine avatar Jan 06 '17 14:01 VictorLamoine

I have not found a good solution, but in moveit we are using this: https://github.com/ros-planning/moveit_ci/blob/master/travis.sh#L164

davetcoleman avatar Jan 08 '17 06:01 davetcoleman

Is there a solution to this issue? I'm encountering it too at the moment. The MoveIt! solution is not sufficient for my needs as it only shows the summary of how many tests have succeeded, failed and so on, but not which and why.

HWiese1980 avatar Oct 20 '17 07:10 HWiese1980

@HWiese1980 I'm still sticking to catkin_make when reading failed tests. I did not find a solution to this issue.

VictorLamoine avatar Oct 20 '17 09:10 VictorLamoine

A 2018 ping: I finally decided to test something and this is pretty rough. @VictorLamoine or @davetcoleman, did you guys find a solution ultimately?

Jmeyer1292 avatar Jun 23 '18 23:06 Jmeyer1292

No I'm relying on catkin_make for the tests.

VictorLamoine avatar Jun 25 '18 14:06 VictorLamoine

A workaround is to pipe the output through sed:

$ catkin run_tests | sed -En '/^-- run_tests.py/,/^-- run_tests.py/p'

This filters out everything besides the output produced by the commands executed via run_tests.py script.

taketwo avatar Jan 13 '20 16:01 taketwo

Love it!

davetcoleman avatar Jan 22 '20 19:01 davetcoleman

thanks @taketwo

arpitg1304 avatar Mar 30 '20 23:03 arpitg1304

Thanks @taketwo

UniverseHan avatar Jun 17 '20 19:06 UniverseHan

Don't we have a plan to fix this unwanted default behavior or not?

Is there any idea of whether we should fix this or not?

UniverseHan avatar Jun 17 '20 19:06 UniverseHan

Another workaround that I find helpful in having more control over gtest is to first build the test target and then run the tests manually. So assuming I have a test target defined in my CMakeLists.txt file catkin_add_gtest(${PROJECT_NAME}_test ...` I can do something like this:

export PACKAGE=my_package
catkin build --no-deps $PACKAGE --catkin-make-args ${PACKAGE}_test
rosrun $PACKAGE ${PACKAGE}_test

I like this because I can interact with gtest for example to get a list of tests or to filter tests. Get a list of available tests:

catkin build --no-deps $PACKAGE --catkin-make-args ${PACKAGE}_test \
&& rosrun $PACKAGE ${PACKAGE}_test --gtest_list_tests

zflat avatar Sep 17 '20 14:09 zflat

Will Just ping this. Its still very annoying to try and debug tests with the current output. You only get the error output and none of the prior ros_info / debug / error

bren-dusty avatar Apr 15 '21 18:04 bren-dusty

Thank you for the ping. I started implementing the catkin test verb in #676. Please test it on your setup and report any problems or requests in the linked pull request. Since I myself don't have that many tests (shame on me), I rely on your participation!

timonegk avatar Apr 17 '21 15:04 timonegk