chg: ci: Build unit tests in the unit test job

Building the unit tests in the build job ships them in the CI artifact
(+200 MB) and transfers them over the network.  Build them in the unit
test job instead.

Git checks the sources out newer than the build tree restored from the
artifact, which would make meson rebuild all of BIND 9 in the unit test
job.  Age the sources so the build is treated as up to date and only the
unit tests get compiled.

Assisted-by: Claude:claude-opus-4-8

Merge branch 'mnowak/build-unit-tests-in-unit-job' into 'main'

See merge request isc-projects/bind9!12180
This commit is contained in:
Michal Nowak 2026-06-05 16:33:17 +02:00
commit d52aea603a

View file

@ -469,7 +469,6 @@ stages:
- *check_readline_setup
- meson compile -C build
- meson compile -C build system-test-dependencies
- ninja -C build meson-test-prereq
- test -z "${RUN_MESON_INSTALL}" || meson install -C build --destdir=$INSTALL_PATH
- test -z "${RUN_MESON_INSTALL}" || DESTDIR="${INSTALL_PATH}" sh build/util/check-make-install.sh
#- test -z "${CROSS_COMPILATION}" || grep -F -A 1 "checking whether we are cross compiling" config.log | grep -q "result.*yes"
@ -614,10 +613,17 @@ stages:
- export CMOCKA_XML_FILE="$(pwd)/build/meson-logs/include-cmocka-%g.junit.xml"
- RET=0
- MESON_WRAPPER="$CI_PROJECT_DIR/bind9-qa/ci/meson_retry_if_flaky.sh 2"
# When Git checks out the sources, their modification times are newer than
# the build tree from the artifact, so meson would rebuild all of BIND 9.
# Age the tracked sources (not "build", to keep ninja's recorded mtimes) so
# only the unit tests get built. "-r" skips the tarball job, which runs
# from an untracked dir. Use BIND 9's git-birthday as the timestamp.
- git ls-files -z | xargs -0 -r touch -t 199808172205
# Build the test binaries here (rather than in the build job) and run them.
# CMocka tests: Mark Meson-generated XMLs to exclude them later with --logbase, CMocka generates better ones.
- meson test -C build --suite cmocka --wrapper "$MESON_WRAPPER" --no-rebuild --logbase "exclude-" || RET=1
- meson test -C build --suite cmocka --wrapper "$MESON_WRAPPER" --logbase "exclude-" || RET=1
# Non-CMocka test: Use Meson-generated XMLs.
- meson test -C build --no-suite cmocka --wrapper "$MESON_WRAPPER" --no-rebuild --logbase "include-" || RET=1
- meson test -C build --no-suite cmocka --wrapper "$MESON_WRAPPER" --logbase "include-" || RET=1
- >
"$PYTHON" "$CI_PROJECT_DIR"/bind9-qa/ci/postprocess_junit_files.py build/meson-logs/include-*.junit.xml --output "$CI_PROJECT_DIR/junit.xml"
- (exit $RET)