Testing and CI

Every repository runs its CI on every push. This page lists the jobs and how to run the same checks on your computer, preferably in the dev container of the workspace, which has the same ROS2 Jazzy base as the CI images.

CI Jobs

Repository

Jobs

Reproduce locally

ros2-workspace-lab

run_gtest: bash/test-ubuntu.sh on ros:jazzy-ros-base-noble (rosdep, colcon build, colcon test); build_*_nobel/build_*_jammy: Debian packages for Jazzy and Humble on amd64 and arm64; release_script_test: tests of ci/release.py

make test in the dev container, see below; python3 -m unittest discover -s ci -v

Components (src/*)

ament_lint_cmake, ament_cpplint, ament_flake8, ament_uncrustify, ament_xmllint, ament_copyright, ament_cppcheck on the repository

the VS Code tasks of the same names, or the commands in the component directory

ros2-workspace-vehicle

shellcheck, hadolint, provision-test, run_gtest (same as the lab workspace)

shellcheck/hadolint on the changed files; bash bash/test-ubuntu.sh in a ros:jazzy container

desktop, simulation

hadolint, shellcheck, image build with the smoke-test stage for amd64 and arm64

docker build --target smoke-test .

lichtblick

test-api, lint-extensions, check-extension-versions, build-extensions, image builds

./scripts/buildExtensions.sh; see its README.md

documentation-cpm-lab

build_docs, build_public_docs, test_devcontainer_image

VS Code tasks Make html and Build public HTML, see Maintaining the Documentation

All jobs keep their artifacts for 7 days. The full logs of run_gtest are in its logs/ artifact.

Running the Tests in the Dev Container

The dev container (cpm-lab-dev) contains the build and test dependencies of all packages, so the tests run as in run_gtest without installing anything. Open the workspace in VS Code with Dev Containers: Reopen in Container (see Developing in Docker), or open a shell with make terminal.

make test                                              # all packages, like run_gtest
make test PACKAGES="cpm_lab_control_flow cpm_lab_bridge"   # only these packages
colcon test-result --all --verbose                     # results of the last run

make test builds the workspace first if anything changed, runs colcon test with the output of failing tests and prints the results; its exit code is non-zero if a test failed. The ament_lint_auto tests of each package run the same linters as the component pipelines.

From the host, without opening a container:

make docker-test PACKAGES="cpm_lab_control_flow"

In VS Code, Tasks: Run Test Task runs Test workspace (like CI). Test packages asks for the packages, Test results shows the results of the last run, and the tasks ament_uncrustify, ament_cpplint, ament_flake8, ament_lint_cmake, ament_xmllint, ament_cppcheck and ament_copyright run the linters of the component pipelines on src/. Uncrustify can fix the formatting:

ament_uncrustify --reformat src/<component>

Differences to the CI

  • The CI installs the dependencies with rosdep for every run; the dev container has them in the image. After changing a package.xml, rebuild the container (Rebuild Container or make image).

  • The CI builds with colcon build without --symlink-install; make test uses the build of make build. If a test only fails in one of both, run make clean first.

  • The IPS needs the pylon SDK, which the dev container and the CI (bash/install-pylon.sh) both install.