tests/docker: add container registry to configure and use

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 <pierrick.bouvier@oss.qualcomm.com>
Tested-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260917165602.3405537-10-alex.bennee@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
This commit is contained in:
Alex Bennée committed 2026-09-18 14:02:51 +01:00
1 parent 76c22418be
commit 6942472b29
5 files changed
+21 -3

No files matched your search

Vendored
+7
View File
@@ -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
+3
View File
@@ -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')
+4
View File
@@ -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 ;;
+1 -3
View File
@@ -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)
+6
View File
@@ -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)