Skip to content

Diagnosing unit test fails in CICD

Roy Falk edited this page Dec 9, 2024 · 8 revisions

General

Vega Strike has facilities to build docker containers for our build system in the repo build-system-docker-images. This allows us to download a docker image, load the relevant branch on it, build and run unit tests in a fairly automated way. As a result, we can make minor modifications to the code and see the effect without running the whole CICD process, which is quite lengthy.

Steps

Clone Repo

As it says. Clone https://github.com/vegastrike/build-system-docker-images.

Download yq

The repo relies on yq, a command line parser of json, xml and yaml. On a recent system, I ran sudo snap install yq successfully. When I switched to mint, snap was no longer available. Getting the latest from github is pretty simple.

wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
sudo mv yq_linux_amd64 /usr/bin/yq
sudo chmod +x /usr/bin/yq

Download the image

Go to /build-system-docker-images/tools. Run ./vs-image.sh show-images. It should show no available images on the system.
Run ./vs-image.sh show-ci-images. It should show available images for download.
Run ./vs-image.sh --image-base <ci-image> build-base to download it.
Run ./vs-image.sh show-images again. It should show the downloaded image on the system.

Build the image

Run ./vs-image.sh --git-branch <failing branch> --image-base <base image> build.

Note: the base image name here is the one from show-images can be subtly different from the show-ci-images name. For me, it was ubuntu:noble and ubuntu_noble.

Run the CICD

Run ./vs-image.sh --image-base ubuntu_noble run.

Modify the offending file

docker cp :/home/vegastrike/Vega-Strike-Engine-Source/engine/src/dummy.cpp dummy.cpp

Edit the file.

docker cp :/home/vegastrike/Vega-Strike-Engine-Source/engine/src/dummy.cpp

Rebuild

In the engine folder, run /usr/bin/cmake .

Build the project by running /usr/bin/cmake --build .

Run the test /usr/bin/ctest -C Debug -T test --output-on-failure -R ^<File>.<Test>$

Issues

There should be an option to mount the docker drive, so people can open files using an IDE.