Comments (12)
I guess there is the help, but it would be nice if it was in a tutorial too.
colcon test-result --help
usage: colcon test-result [-h] [--test-result-base TEST_RESULT_BASE] [--all]
[--verbose]
Collect the jUnit results generated when testing a set of packages.
optional arguments:
-h, --help show this help message and exit
--test-result-base TEST_RESULT_BASE
The base path for all test results (default: build)
--all Show all test result file (even without errors /
failures)
--verbose Show additional information for errors / failures
from colcon-core.
Now besides
colcon test --packages-select turtle_robot
colcon test-result
echo $? # Will print 1 if test failed
this also works 😃
colcon test --packages-select turtle_robot --return-code-on-test-failure
echo $? # Will print 1 if test failed
from colcon-core.
Hi @dirk-thomas, have you ever considered return a non-zero code when colcon build
fails? For now the return code is always 0.
I made an automated tools that can build the system and monitor the time, or failure. I scanned the ./log/latest/
folder for output but that's not elegant at all. So adding a return code would be helpful.
from colcon-core.
This seems to be a separate question as this feature request is specific to the test verb.
AFAIK the build verb already returns non-zero in case of build failure. For example, this jobs has a build error: https://ci.ros2.org/job/ci_windows/5173/console
And returns 1
:
'env.bat C:\Python37\Scripts\colcon.EXE build --base-paths "src" --build-base "build" --install-base "install" --merge-install --event-handlers console_cohesion+ console_package_list+ --cmake-args -DBUILD_TESTING=ON --no-warn-unused-cli -DINSTALL_EXAMPLES=OFF -DSECURITY=ON -DBUILD_SHARED_LIBS=OFF --packages-up-to rcutils' exited with return code '1'
Can you provide an example of failing build with a zero return code ?
from colcon-core.
Yes. When I deliberately delete a header file in cpp source code of mypkg
, building fails. The output is like:
Aborted <<< rosidl_typesupport_introspection_c
Aborted <<< rosidl_generator_cpp
Aborted <<< rcutils
Summary: 82 packages finished [17.0s]
1 package failed: mypkg
3 packages aborted: rcutils rosidl_generator_cpp rosidl_typesupport_introspection_c
1 package had stderr output: mypkg
110 packages not processed
But the return code I get from $?
is still 0.
$ echo $?
0
from colcon-core.
I tried removing a header in rcutils and got a non-zero return code.
--- stderr: rcutils
/tmp/test_colcon/src/ros2/rcutils/src/filesystem.c:19:32: fatal error: rcutils/filesystem.h: No such file or directory
compilation terminated.
make[2]: *** [CMakeFiles/rcutils.dir/src/filesystem.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/rcutils.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [all] Error 2
---
Failed <<< rcutils [ Exited with code 2 ]
Summary: 0 packages finished [7.01s]
1 package failed: rcutils
1 package had stderr output: rcutils
$ echo $?
2
Can you please open a separate issue with a ready to run, reproducible example?
from colcon-core.
from colcon-core.
I have this same question / issue. I'm running colcon test in Travis and it always returns 0, even when the test fails. Is there an easy output that can be grepped? Otherwise a non-zero return code would help.
from colcon-core.
@mkhansen-intel To check if any tests failed you can use colcon test-results
after running the tests which will give you a summary of the results and an error return code if any tests failed.
from colcon-core.
To check if any tests failed you can use
colcon test-results
after running the tests ...
That will only work if the result files have been generated correctly. An option on the test
verb working in all the cases is still desired.
from colcon-core.
Yes I didn't suggest that it would resolve this issue, for the full result I would suggest that there's two semantically valuable information, one is all tests successfully ran and generated results, and the 2nd is that all tests passed. The test verb is the only one that can know if the tests successfully ran.
But as a short term workaround the second results is likely going to be easier than trying to automatically grep through the whole. It will not catch every potential error but will capture most errors.
from colcon-core.
OK, that seems to work. I don't see any documentation on that option anywhere though. You might want to add that.
from colcon-core.
Related Issues (20)
- Wildcards in .dsv files
- ERROR:colcon.colcon_core* is declared multiple times HOT 2
- `colcon build` uses the wrong Python version when inside a virtualenvironment on Windows HOT 2
- [bug] additional cmake args after CMAKE_TOOLCHAIN_FILE will clear it HOT 2
- Cache get_extension_points output
- empy version incompatibility HOT 4
- [Question] Correct way to build a ros driver which depends on a library without having to run 'sudo make install' on the library. HOT 6
- Design intent of setup.sh vs setup.bash HOT 4
- Why can data_files destinations not be absolute for ament_python packages? HOT 4
- [Question] Recommended way to invoke colcon on ubuntu noble? / request for release recent colcon in ROS APT ubuntu noble repos HOT 2
- Feature Request: Multiple `build-base` and `install-base` for multiple `base-paths`
- Colcon hangs when stdout / stderr is redirected and output line is longer than default buffer size HOT 2
- Colcon extends LD_LIBARAY_PATH with cross compiled libraries HOT 3
- Package includes directory has subdir of subdir of package name HOT 1
- Install colcon on x86 to cross compile ros2 HOT 4
- Error building after deleting a file: can't copy '<deleted-file> doesn't exist or not a regular file HOT 3
- colcon list Traceback (most recent call last): File "/usr/bin/colcon", line 33, in <module> sys.exit(load_entry_point('colcon-core==0.16.0', 'console_scripts', 'colcon')()) File "/usr/lib/python3/dist-packages/colcon_core/command.py", line 118, in main return _main(command_name=command_name, argv=argv) File "/usr/lib/python3/dist-packages/colcon_core/command.py", line 185, in _main create_log_path(args.verb_name) File "/usr/lib/python3/dist-packages/colcon_core/location.py", line 186, in create_log_path os.makedirs(str(path)) File "/usr/lib/python3.10/os.py", line 225, in makedirs mkdir(name, mode) PermissionError: [Errno 13] Permission denied: 'log/list_2024-04-06_02-45-22' HOT 2
- colcon returns with success when extension loading fails
- No executable found for scripts when using --symlink-install and install(PROGRAMS) HOT 2
- Torch shared library: libc10.so: cannot open shared object file HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from colcon-core.