From 052269a357a11ab230cef2a26c69fb216f310a35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0pa=C4=8Dek?= Date: Wed, 25 Jun 2025 17:53:25 +0200 Subject: [PATCH] Simplify maintenance of NO_BUILD_TEST_PREREQ CI hack Our split between build and test phases in CI triggers odd corner case in Meson: - Newer Meson versions (1.7.0+) do not build test targets as part of "all" target. - We copy build artifacts from build phase into test container. - meson test --no-rebuild does not build test artifacts even if they are missing. - To build these test binaries Meson has special target "meson-test-prereq". This target exists only in Meson >= 0.63. - Ubuntu 22.04 has only Meson 0.61.2 so this target does not exist. To counter this problem, we introduced BUILD_TEST_PREREQ variable in CI to explicitly build "meson-test-prereq" target in the "build" phase only inside images with new-enough Meson versions. This worked, but it forced us to keep track of Meson versions on various distros and update the variable accordingly. This commit inverts the logic so we build the special target by default (in the build phase) and skip building it only if Meson version is too old. So once we drop the old image, the variable (or rather it's usage) will be gone and we don't need to touch it for newer images. We have also considered installing newer Meson into the test image, but decided to keep the old version around so we can test minimal Meson version specified in meson.build file. --- .gitlab-ci.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bb4fc8b29c..ca6d4661f2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -336,7 +336,7 @@ stages: - *check_readline_setup - meson compile -C build - meson compile -C build system-test-dependencies - - test -z "${BUILD_TEST_PREREQ}" || ninja -C build meson-test-prereq + - test -z "${NO_BUILD_TEST_PREREQ}" && 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 #- test -z "${CROSS_COMPILATION}" || grep -F -A 1 "checking whether we are cross compiling" config.log | grep -q "result.*yes" @@ -753,7 +753,6 @@ docs:tarball: gcc:alpine3.22:amd64: variables: - BUILD_TEST_PREREQ: 1 CC: gcc CFLAGS: "${CFLAGS_COMMON}" EXTRA_CONFIGURE: "${WITHOUT_LIBEDIT}" @@ -828,7 +827,6 @@ unit:gcc:almalinux9:amd64: gcc:8fips:amd64: variables: - BUILD_TEST_PREREQ: 1 CC: gcc CFLAGS: "${CFLAGS_COMMON}" EXTRA_CONFIGURE: "-Didn=enabled -Dfips=enabled -Dtracing=disabled" @@ -975,7 +973,6 @@ gcc:ossl3:sid:amd64: <<: *debian_sid_amd64_image <<: *build_job variables: - BUILD_TEST_PREREQ: 1 CC: gcc CFLAGS: "${CFLAGS_COMMON} -DOPENSSL_NO_DEPRECATED=1 -DOPENSSL_API_COMPAT=30000" # See https://gitlab.isc.org/isc-projects/bind9/-/issues/3444 @@ -1011,7 +1008,6 @@ gcc:sid:amd64: CFLAGS: "${CFLAGS_COMMON}" EXTRA_CONFIGURE: "-Doptimization=3 -Didn=enabled -Dlmdb=disabled ${WITH_LIBEDIT}" RUN_MESON_INSTALL: 1 - BUILD_TEST_PREREQ: 1 system:gcc:sid:amd64: <<: *debian_sid_amd64_image @@ -1075,7 +1071,6 @@ gcc:tumbleweed:amd64: CC: gcc CFLAGS: "${CFLAGS_COMMON} -DDEBUG" EXTRA_CONFIGURE: "-Didn=enabled -Dgssapi=disabled ${WITH_LIBEDIT}" - BUILD_TEST_PREREQ: 1 system:gcc:tumbleweed:amd64: <<: *tumbleweed_latest_amd64_image @@ -1098,6 +1093,7 @@ gcc:jammy:amd64: CC: gcc CFLAGS: "${CFLAGS_COMMON}" EXTRA_CONFIGURE: "-Dgeoip=disabled -Didn=enabled -Ddoh=disabled -Dcmocka=disabled -Ddnstap=disabled -Dgssapi=disabled" + NO_BUILD_TEST_PREREQ: 1 # remove this variable after removing this particular distro <<: *ubuntu_jammy_amd64_image <<: *build_job @@ -1148,7 +1144,6 @@ gcc:asan: CC: gcc CFLAGS: "${CFLAGS_COMMON}" EXTRA_CONFIGURE: "-Db_sanitize=address,undefined -Didn=enabled -Djemalloc=disabled -Dtracing=disabled" - BUILD_TEST_PREREQ: 1 <<: *fedora_42_amd64_image <<: *build_job @@ -1202,7 +1197,6 @@ gcc:tsan: CFLAGS: "${CFLAGS_COMMON} -Wno-stringop-overread" LDFLAGS: "-Wl,--disable-new-dtags" EXTRA_CONFIGURE: "${TSAN_CONFIGURE_FLAGS_COMMON}" - BUILD_TEST_PREREQ: 1 <<: *tsan_fedora_42_amd64_image <<: *build_job