From 6942472b299f0075fba36a8a297e2c4bf1bb0d71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Thu, 17 Sep 2026 17:55:53 +0100 Subject: [PATCH] tests/docker: add container registry to configure and use MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously we had the default baked into Makefile.include but as the meson container logic will also benefit from it we update the configure machinery. For now we allow direct make invocations to override but for the normal case it is in one place now. Reviewed-by: Pierrick Bouvier Tested-by: Richard Henderson Message-ID: <20260917165602.3405537-10-alex.bennee@linaro.org> Signed-off-by: Alex Bennée --- configure | 7 +++++++ meson_options.txt | 3 +++ scripts/meson-buildoptions.sh | 4 ++++ tests/docker/Makefile.include | 4 +--- tests/tcg/meson.build | 6 ++++++ 5 files changed, 21 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 667fc7ca19..af14a9c23e 100755 --- a/configure +++ b/configure @@ -172,6 +172,7 @@ fi # some defaults, based on the host environment # default parameters +container_registry="registry.gitlab.com/qemu-project/qemu" cpu="" cross_compile="no" cross_prefix="" @@ -732,6 +733,9 @@ for opt do --container-command=*) container_command="$optarg" meson_option_add -Dcontainer_command="$optarg" ;; + --container-registry=*) container_registry="$optarg" + meson_option_add -Dcontainer_registry="$optarg" + ;; --rust-target-triple=*) rust_target_triple="$optarg" ;; --gdb=*) meson_option_add -Dgdb="$optarg" @@ -1728,6 +1732,9 @@ echo "GENISOIMAGE=$genisoimage" >> $config_host_mak echo "MESON=$meson" >> $config_host_mak echo "NINJA=$ninja" >> $config_host_mak echo "EXESUF=$EXESUF" >> $config_host_mak +if test -n "$container_registry"; then + echo "DOCKER_DEFAULT_REGISTRY=$container_registry" >> $config_host_mak +fi if test "$default_targets" = "yes"; then echo "CONFIG_DEFAULT_TARGETS=y" >> $config_host_mak fi diff --git a/meson_options.txt b/meson_options.txt index e3570a418a..6c2de6296f 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -393,6 +393,9 @@ option('containers', type: 'boolean', value: true, description: 'use containers to cross compile tcg tests') option('container_command', type: 'string', description: 'command to build/run containers') +option('container_registry', type: 'string', + value: 'registry.gitlab.com/qemu-project/qemu', + description: 'container registry to cache from') option('tcg_tests_cross_cc_aarch64', type: 'string', description: 'cc for aarch64 tcg tests') diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index 4ad8c1c5d3..08c9fbb62c 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -12,6 +12,9 @@ meson_options_help() { printf "%s\n" ' affects only QEMU, not tools like qemu-img)' printf "%s\n" ' --container-command=VALUE' printf "%s\n" ' command to build/run containers' + printf "%s\n" ' --container-registry=VALUE' + printf "%s\n" ' container registry to cache from' + printf "%s\n" ' [registry.gitlab.com/qemu-project/qemu]' printf "%s\n" ' --datadir=VALUE Data file directory [share]' printf "%s\n" ' --disable-containers use containers to cross compile tcg tests' printf "%s\n" ' --disable-coroutine-pool coroutine freelist (better performance)' @@ -286,6 +289,7 @@ _meson_option_parse() { --enable-colo-proxy) printf "%s" -Dcolo_proxy=enabled ;; --disable-colo-proxy) printf "%s" -Dcolo_proxy=disabled ;; --container-command=*) quote_sh "-Dcontainer_command=$2" ;; + --container-registry=*) quote_sh "-Dcontainer_registry=$2" ;; --enable-containers) printf "%s" -Dcontainers=true ;; --disable-containers) printf "%s" -Dcontainers=false ;; --enable-coreaudio) printf "%s" -Dcoreaudio=enabled ;; diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include index 0adddb6a5c..74bf471f17 100644 --- a/tests/docker/Makefile.include +++ b/tests/docker/Makefile.include @@ -11,9 +11,7 @@ USER = $(if $(NOUSER),,$(shell id -un)) UID = $(if $(NOUSER),,$(shell id -u)) DOCKER_FILES_DIR := $(SRC_PATH)/tests/docker/dockerfiles -ifeq ($(HOST_ARCH),x86_64) -DOCKER_DEFAULT_REGISTRY := registry.gitlab.com/qemu-project/qemu -endif +DOCKER_DEFAULT_REGISTRY ?= registry.gitlab.com/qemu-project/qemu DOCKER_REGISTRY := $(if $(REGISTRY),$(REGISTRY),$(DOCKER_DEFAULT_REGISTRY)) CONTAINER_COMMAND ?= $(shell $(SRC_PATH)/tests/docker/docker.py probe) diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build index 5819fdf0bf..482de73ac7 100644 --- a/tests/tcg/meson.build +++ b/tests/tcg/meson.build @@ -101,6 +101,9 @@ if get_option('containers') endif endif tcg_tests_summary += {'container command': container_command} +if get_option('container_registry') != '' + tcg_tests_summary += {'container registry': get_option('container_registry')} +endif # plugins come first, as we need to build the list test_plugins = {} @@ -257,6 +260,9 @@ foreach target, plan: tcg_tests if cc_dockerfile not in image_targets and has_docker cmd = [docker_wrapper, 'build', '-f', dockerfile, '-t', 'qemu/' + cc_dockerfile, '--add-current-user'] + if get_option('container_registry') != '' + cmd += ['--registry', get_option('container_registry')] + endif t = custom_target(image_name, command: cmd, build_by_default: false, output: 'no_output_' + image_name)