]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Build unit tests in the unit test job 12180/head
authorMichal Nowak <mnowak@isc.org>
Wed, 3 Jun 2026 13:53:51 +0000 (13:53 +0000)
committerMichal Nowak <mnowak@isc.org>
Fri, 5 Jun 2026 13:05:08 +0000 (13:05 +0000)
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.

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

Assisted-by: Claude:claude-opus-4-8
.gitlab-ci.yml

index 2bdfd26f11083aeb70cc20463540ac1c19e7e4be..a0d412901c5b96facf2fb59bfd3a1d9df0553a17 100644 (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)