From e0e2dff486ef8d9fe03b26013eaac1d857f034c5 Mon Sep 17 00:00:00 2001 From: Michal Nowak Date: Wed, 3 Jun 2026 13:53:51 +0000 Subject: [PATCH] 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. 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 | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2bdfd26f11..a0d412901c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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)