Skip to contentSkip to conversation

testing: various docker clean-ups post meson tcg conversion

PATCH Superseded Alex Bennée 7 participants 37 messages Sep 10 – Sep 15 Arm/Amlogic Meson SoC support

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

cover testing: various docker clean-ups post meson tcg conversion

This cleans up a few bits and pieces although doesn't totally solve the issue of an apparent stall while meson builds the docker image. However with these changes there should be no difference between the meson build and the equivalent "make docker-image-foo" invocation.

We also finally get rid of the ill-advised magic caching support in docker.py.

Please review.

Alex.

Alex Bennée (8):
scripts/meson-buildoptions.sh: update missing options tests/tcg: prefix meson built docker tags with qemu/ tests/tcg: use --add-current-user when building containers tests/docker: add container registry to configure and use tests/docker: remove used _read_qemu_dockerfile tests/docker: strip remaining caching logic from docker.py tests/docker: add specific command to parser tests/docker: swap --quiet for --verbose

Daniel P. Berrangé (1):
tests/tcg: improve check for working cross compilers

 configure                               |   8 +
 tests/tcg/test_cc.c                     |   6 +-
 meson_options.txt                       |   3 +
 scripts/coverity-scan/run-coverity-scan |   2 +-
 scripts/meson-buildoptions.sh           | 142 ++++++++++++++++++
 tests/docker/Makefile.include           |  14 +-
 tests/docker/docker.py                  | 188 +++++++++---------------
 tests/lcitool/libvirt-ci                |   2 +-
 tests/tcg/meson.build                   |  15 +-
 9 files changed, 243 insertions(+), 137 deletions(-)
Signature · 1 line
2.47.3
#1 lore raw

PATCH 1/9 scripts/meson-buildoptions.sh: update missing options

This should have been updated when the meson check-tcg changes where made. Include it now.

---
 scripts/meson-buildoptions.sh | 142 ++++++++++++++++++++++++++++++++++
 1 file changed, 142 insertions(+)
scripts/meson-buildoptions.sh +142 -0
index 5a67e59a167..67c5e33b011 100644
@@ -10,7 +10,13 @@ meson_options_help() {
   printf "%s\n" '  --block-drv-rw-whitelist=VALUE'
   printf "%s\n" '                           set block driver read-write whitelist (by default'
   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)'
   printf "%s\n" '  --disable-debug-info     Enable debug symbols and other information'
   printf "%s\n" '  --disable-hexagon-idef-parser'
@@ -77,6 +83,94 @@ meson_options_help() {
   printf "%s\n" '  --rtsig-map=VALUE        default value of QEMU_RTSIG_MAP [NULL]'
   printf "%s\n" '  --smbd=VALUE             Path to smbd for slirp networking'
   printf "%s\n" '  --sysconfdir=VALUE       Sysconf data directory [etc]'
+  printf "%s\n" '  --tcg-tests-cross-cc-aarch64=VALUE'
+  printf "%s\n" '                           cc for aarch64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-aarch64-be=VALUE'
+  printf "%s\n" '                           cc for aarch64_be tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-alpha=VALUE'
+  printf "%s\n" '                           cc for alpha tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-arm=VALUE'
+  printf "%s\n" '                           cc for arm tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-hexagon=VALUE'
+  printf "%s\n" '                           cc for hexagon tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-hppa=VALUE'
+  printf "%s\n" '                           cc for hppa tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-i386=VALUE'
+  printf "%s\n" '                           cc for i386 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-loongarch64=VALUE'
+  printf "%s\n" '                           cc for loongarch64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-m68k=VALUE'
+  printf "%s\n" '                           cc for m68k tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-mips=VALUE'
+  printf "%s\n" '                           cc for mips tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-mips64=VALUE'
+  printf "%s\n" '                           cc for mips64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-mips64el=VALUE'
+  printf "%s\n" '                           cc for mips64el tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-or1k=VALUE'
+  printf "%s\n" '                           cc for or1k tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-ppc64=VALUE'
+  printf "%s\n" '                           cc for ppc64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-ppc64le=VALUE'
+  printf "%s\n" '                           cc for ppc64le tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-riscv64=VALUE'
+  printf "%s\n" '                           cc for riscv64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-s390x=VALUE'
+  printf "%s\n" '                           cc for s390x tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-sh4=VALUE'
+  printf "%s\n" '                           cc for sh4 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-tricore=VALUE'
+  printf "%s\n" '                           cc for tricore tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-x86-64=VALUE'
+  printf "%s\n" '                           cc for x86_64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-xtensa=VALUE'
+  printf "%s\n" '                           cc for xtensa tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-xtensaeb=VALUE'
+  printf "%s\n" '                           cc for xtensaeb tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-aarch64=VALUE'
+  printf "%s\n" '                           cflags for aarch64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-aarch64-be=VALUE'
+  printf "%s\n" '                           cflags for aarch64_be tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-alpha=VALUE'
+  printf "%s\n" '                           cflags for alpha tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-arm=VALUE'
+  printf "%s\n" '                           cflags for arm tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-hexagon=VALUE'
+  printf "%s\n" '                           cflags for hexagon tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-hppa=VALUE'
+  printf "%s\n" '                           cflags for hppa tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-i386=VALUE'
+  printf "%s\n" '                           cflags for i386 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-loongarch64=VALUE'
+  printf "%s\n" '                           cflags for loongarch64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-m68k=VALUE'
+  printf "%s\n" '                           cflags for m68k tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-mips=VALUE'
+  printf "%s\n" '                           cflags for mips tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-mips64=VALUE'
+  printf "%s\n" '                           cflags for mips64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-mips64el=VALUE'
+  printf "%s\n" '                           cflags for mips64el tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-or1k=VALUE'
+  printf "%s\n" '                           cflags for or1k tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-ppc64=VALUE'
+  printf "%s\n" '                           cflags for ppc64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-ppc64le=VALUE'
+  printf "%s\n" '                           cflags for ppc64le tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-riscv64=VALUE'
+  printf "%s\n" '                           cflags for riscv64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-s390x=VALUE'
+  printf "%s\n" '                           cflags for s390x tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-sh4=VALUE'
+  printf "%s\n" '                           cflags for sh4 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-tricore=VALUE'
+  printf "%s\n" '                           cflags for tricore tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-x86-64=VALUE'
+  printf "%s\n" '                           cflags for x86_64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-xtensa=VALUE'
+  printf "%s\n" '                           cflags for xtensa tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-xtensaeb=VALUE'
+  printf "%s\n" '                           cflags for xtensaeb tcg tests'
   printf "%s\n" '  --tls-priority=VALUE     Default TLS protocol/cipher priority string'
   printf "%s\n" '                           [NORMAL]'
   printf "%s\n" '  --with-coroutine=CHOICE  coroutine backend to use (choices:'
@@ -281,6 +375,10 @@ _meson_option_parse() {
     --disable-cocoa) printf "%s" -Dcocoa=disabled ;;
     --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 ;;
     --disable-coreaudio) printf "%s" -Dcoreaudio=disabled ;;
     --with-coroutine=*) quote_sh "-Dcoroutine_backend=$2" ;;
@@ -517,6 +615,50 @@ _meson_option_parse() {
     --disable-tcg) printf "%s" -Dtcg=disabled ;;
     --enable-tcg-interpreter) printf "%s" -Dtcg_interpreter=true ;;
     --disable-tcg-interpreter) printf "%s" -Dtcg_interpreter=false ;;
+    --tcg-tests-cross-cc-aarch64=*) quote_sh "-Dtcg_tests_cross_cc_aarch64=$2" ;;
+    --tcg-tests-cross-cc-aarch64-be=*) quote_sh "-Dtcg_tests_cross_cc_aarch64_be=$2" ;;
+    --tcg-tests-cross-cc-alpha=*) quote_sh "-Dtcg_tests_cross_cc_alpha=$2" ;;
+    --tcg-tests-cross-cc-arm=*) quote_sh "-Dtcg_tests_cross_cc_arm=$2" ;;
+    --tcg-tests-cross-cc-hexagon=*) quote_sh "-Dtcg_tests_cross_cc_hexagon=$2" ;;
+    --tcg-tests-cross-cc-hppa=*) quote_sh "-Dtcg_tests_cross_cc_hppa=$2" ;;
+    --tcg-tests-cross-cc-i386=*) quote_sh "-Dtcg_tests_cross_cc_i386=$2" ;;
+    --tcg-tests-cross-cc-loongarch64=*) quote_sh "-Dtcg_tests_cross_cc_loongarch64=$2" ;;
+    --tcg-tests-cross-cc-m68k=*) quote_sh "-Dtcg_tests_cross_cc_m68k=$2" ;;
+    --tcg-tests-cross-cc-mips=*) quote_sh "-Dtcg_tests_cross_cc_mips=$2" ;;
+    --tcg-tests-cross-cc-mips64=*) quote_sh "-Dtcg_tests_cross_cc_mips64=$2" ;;
+    --tcg-tests-cross-cc-mips64el=*) quote_sh "-Dtcg_tests_cross_cc_mips64el=$2" ;;
+    --tcg-tests-cross-cc-or1k=*) quote_sh "-Dtcg_tests_cross_cc_or1k=$2" ;;
+    --tcg-tests-cross-cc-ppc64=*) quote_sh "-Dtcg_tests_cross_cc_ppc64=$2" ;;
+    --tcg-tests-cross-cc-ppc64le=*) quote_sh "-Dtcg_tests_cross_cc_ppc64le=$2" ;;
+    --tcg-tests-cross-cc-riscv64=*) quote_sh "-Dtcg_tests_cross_cc_riscv64=$2" ;;
+    --tcg-tests-cross-cc-s390x=*) quote_sh "-Dtcg_tests_cross_cc_s390x=$2" ;;
+    --tcg-tests-cross-cc-sh4=*) quote_sh "-Dtcg_tests_cross_cc_sh4=$2" ;;
+    --tcg-tests-cross-cc-tricore=*) quote_sh "-Dtcg_tests_cross_cc_tricore=$2" ;;
+    --tcg-tests-cross-cc-x86-64=*) quote_sh "-Dtcg_tests_cross_cc_x86_64=$2" ;;
+    --tcg-tests-cross-cc-xtensa=*) quote_sh "-Dtcg_tests_cross_cc_xtensa=$2" ;;
+    --tcg-tests-cross-cc-xtensaeb=*) quote_sh "-Dtcg_tests_cross_cc_xtensaeb=$2" ;;
+    --tcg-tests-cross-cflags-aarch64=*) quote_sh "-Dtcg_tests_cross_cflags_aarch64=$2" ;;
+    --tcg-tests-cross-cflags-aarch64-be=*) quote_sh "-Dtcg_tests_cross_cflags_aarch64_be=$2" ;;
+    --tcg-tests-cross-cflags-alpha=*) quote_sh "-Dtcg_tests_cross_cflags_alpha=$2" ;;
+    --tcg-tests-cross-cflags-arm=*) quote_sh "-Dtcg_tests_cross_cflags_arm=$2" ;;
+    --tcg-tests-cross-cflags-hexagon=*) quote_sh "-Dtcg_tests_cross_cflags_hexagon=$2" ;;
+    --tcg-tests-cross-cflags-hppa=*) quote_sh "-Dtcg_tests_cross_cflags_hppa=$2" ;;
+    --tcg-tests-cross-cflags-i386=*) quote_sh "-Dtcg_tests_cross_cflags_i386=$2" ;;
+    --tcg-tests-cross-cflags-loongarch64=*) quote_sh "-Dtcg_tests_cross_cflags_loongarch64=$2" ;;
+    --tcg-tests-cross-cflags-m68k=*) quote_sh "-Dtcg_tests_cross_cflags_m68k=$2" ;;
+    --tcg-tests-cross-cflags-mips=*) quote_sh "-Dtcg_tests_cross_cflags_mips=$2" ;;
+    --tcg-tests-cross-cflags-mips64=*) quote_sh "-Dtcg_tests_cross_cflags_mips64=$2" ;;
+    --tcg-tests-cross-cflags-mips64el=*) quote_sh "-Dtcg_tests_cross_cflags_mips64el=$2" ;;
+    --tcg-tests-cross-cflags-or1k=*) quote_sh "-Dtcg_tests_cross_cflags_or1k=$2" ;;
+    --tcg-tests-cross-cflags-ppc64=*) quote_sh "-Dtcg_tests_cross_cflags_ppc64=$2" ;;
+    --tcg-tests-cross-cflags-ppc64le=*) quote_sh "-Dtcg_tests_cross_cflags_ppc64le=$2" ;;
+    --tcg-tests-cross-cflags-riscv64=*) quote_sh "-Dtcg_tests_cross_cflags_riscv64=$2" ;;
+    --tcg-tests-cross-cflags-s390x=*) quote_sh "-Dtcg_tests_cross_cflags_s390x=$2" ;;
+    --tcg-tests-cross-cflags-sh4=*) quote_sh "-Dtcg_tests_cross_cflags_sh4=$2" ;;
+    --tcg-tests-cross-cflags-tricore=*) quote_sh "-Dtcg_tests_cross_cflags_tricore=$2" ;;
+    --tcg-tests-cross-cflags-x86-64=*) quote_sh "-Dtcg_tests_cross_cflags_x86_64=$2" ;;
+    --tcg-tests-cross-cflags-xtensa=*) quote_sh "-Dtcg_tests_cross_cflags_xtensa=$2" ;;
+    --tcg-tests-cross-cflags-xtensaeb=*) quote_sh "-Dtcg_tests_cross_cflags_xtensaeb=$2" ;;
     --tls-priority=*) quote_sh "-Dtls_priority=$2" ;;
     --enable-tools) printf "%s" -Dtools=enabled ;;
     --disable-tools) printf "%s" -Dtools=disabled ;;
Signature · 1 line
2.47.3
#2 lore raw

Re: [PATCH 1/9] scripts/meson-buildoptions.sh: update missing options

Quoted 4 lines · Alex Bennée

This should have been updated when the meson check-tcg changes where made. Include it now.

There's this previous change by Daniel doing this already:

https://lore.kernel.org/r/[email protected]

Quoted 179 lines
---
 scripts/meson-buildoptions.sh | 142 ++++++++++++++++++++++++++++++++++
 1 file changed, 142 insertions(+)
scripts/meson-buildoptions.sh +142 -0
index 5a67e59a167..67c5e33b011 100644
@@ -10,7 +10,13 @@ meson_options_help() {
   printf "%s\n" '  --block-drv-rw-whitelist=VALUE'
   printf "%s\n" '                           set block driver read-write whitelist (by default'
   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)'
   printf "%s\n" '  --disable-debug-info     Enable debug symbols and other information'
   printf "%s\n" '  --disable-hexagon-idef-parser'
@@ -77,6 +83,94 @@ meson_options_help() {
   printf "%s\n" '  --rtsig-map=VALUE        default value of QEMU_RTSIG_MAP [NULL]'
   printf "%s\n" '  --smbd=VALUE             Path to smbd for slirp networking'
   printf "%s\n" '  --sysconfdir=VALUE       Sysconf data directory [etc]'
+  printf "%s\n" '  --tcg-tests-cross-cc-aarch64=VALUE'
+  printf "%s\n" '                           cc for aarch64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-aarch64-be=VALUE'
+  printf "%s\n" '                           cc for aarch64_be tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-alpha=VALUE'
+  printf "%s\n" '                           cc for alpha tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-arm=VALUE'
+  printf "%s\n" '                           cc for arm tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-hexagon=VALUE'
+  printf "%s\n" '                           cc for hexagon tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-hppa=VALUE'
+  printf "%s\n" '                           cc for hppa tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-i386=VALUE'
+  printf "%s\n" '                           cc for i386 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-loongarch64=VALUE'
+  printf "%s\n" '                           cc for loongarch64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-m68k=VALUE'
+  printf "%s\n" '                           cc for m68k tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-mips=VALUE'
+  printf "%s\n" '                           cc for mips tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-mips64=VALUE'
+  printf "%s\n" '                           cc for mips64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-mips64el=VALUE'
+  printf "%s\n" '                           cc for mips64el tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-or1k=VALUE'
+  printf "%s\n" '                           cc for or1k tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-ppc64=VALUE'
+  printf "%s\n" '                           cc for ppc64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-ppc64le=VALUE'
+  printf "%s\n" '                           cc for ppc64le tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-riscv64=VALUE'
+  printf "%s\n" '                           cc for riscv64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-s390x=VALUE'
+  printf "%s\n" '                           cc for s390x tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-sh4=VALUE'
+  printf "%s\n" '                           cc for sh4 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-tricore=VALUE'
+  printf "%s\n" '                           cc for tricore tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-x86-64=VALUE'
+  printf "%s\n" '                           cc for x86_64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-xtensa=VALUE'
+  printf "%s\n" '                           cc for xtensa tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-xtensaeb=VALUE'
+  printf "%s\n" '                           cc for xtensaeb tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-aarch64=VALUE'
+  printf "%s\n" '                           cflags for aarch64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-aarch64-be=VALUE'
+  printf "%s\n" '                           cflags for aarch64_be tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-alpha=VALUE'
+  printf "%s\n" '                           cflags for alpha tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-arm=VALUE'
+  printf "%s\n" '                           cflags for arm tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-hexagon=VALUE'
+  printf "%s\n" '                           cflags for hexagon tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-hppa=VALUE'
+  printf "%s\n" '                           cflags for hppa tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-i386=VALUE'
+  printf "%s\n" '                           cflags for i386 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-loongarch64=VALUE'
+  printf "%s\n" '                           cflags for loongarch64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-m68k=VALUE'
+  printf "%s\n" '                           cflags for m68k tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-mips=VALUE'
+  printf "%s\n" '                           cflags for mips tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-mips64=VALUE'
+  printf "%s\n" '                           cflags for mips64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-mips64el=VALUE'
+  printf "%s\n" '                           cflags for mips64el tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-or1k=VALUE'
+  printf "%s\n" '                           cflags for or1k tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-ppc64=VALUE'
+  printf "%s\n" '                           cflags for ppc64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-ppc64le=VALUE'
+  printf "%s\n" '                           cflags for ppc64le tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-riscv64=VALUE'
+  printf "%s\n" '                           cflags for riscv64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-s390x=VALUE'
+  printf "%s\n" '                           cflags for s390x tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-sh4=VALUE'
+  printf "%s\n" '                           cflags for sh4 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-tricore=VALUE'
+  printf "%s\n" '                           cflags for tricore tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-x86-64=VALUE'
+  printf "%s\n" '                           cflags for x86_64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-xtensa=VALUE'
+  printf "%s\n" '                           cflags for xtensa tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-xtensaeb=VALUE'
+  printf "%s\n" '                           cflags for xtensaeb tcg tests'
   printf "%s\n" '  --tls-priority=VALUE     Default TLS protocol/cipher priority string'
   printf "%s\n" '                           [NORMAL]'
   printf "%s\n" '  --with-coroutine=CHOICE  coroutine backend to use (choices:'
@@ -281,6 +375,10 @@ _meson_option_parse() {
     --disable-cocoa) printf "%s" -Dcocoa=disabled ;;
     --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 ;;
     --disable-coreaudio) printf "%s" -Dcoreaudio=disabled ;;
     --with-coroutine=*) quote_sh "-Dcoroutine_backend=$2" ;;
@@ -517,6 +615,50 @@ _meson_option_parse() {
     --disable-tcg) printf "%s" -Dtcg=disabled ;;
     --enable-tcg-interpreter) printf "%s" -Dtcg_interpreter=true ;;
     --disable-tcg-interpreter) printf "%s" -Dtcg_interpreter=false ;;
+    --tcg-tests-cross-cc-aarch64=*) quote_sh "-Dtcg_tests_cross_cc_aarch64=$2" ;;
+    --tcg-tests-cross-cc-aarch64-be=*) quote_sh "-Dtcg_tests_cross_cc_aarch64_be=$2" ;;
+    --tcg-tests-cross-cc-alpha=*) quote_sh "-Dtcg_tests_cross_cc_alpha=$2" ;;
+    --tcg-tests-cross-cc-arm=*) quote_sh "-Dtcg_tests_cross_cc_arm=$2" ;;
+    --tcg-tests-cross-cc-hexagon=*) quote_sh "-Dtcg_tests_cross_cc_hexagon=$2" ;;
+    --tcg-tests-cross-cc-hppa=*) quote_sh "-Dtcg_tests_cross_cc_hppa=$2" ;;
+    --tcg-tests-cross-cc-i386=*) quote_sh "-Dtcg_tests_cross_cc_i386=$2" ;;
+    --tcg-tests-cross-cc-loongarch64=*) quote_sh "-Dtcg_tests_cross_cc_loongarch64=$2" ;;
+    --tcg-tests-cross-cc-m68k=*) quote_sh "-Dtcg_tests_cross_cc_m68k=$2" ;;
+    --tcg-tests-cross-cc-mips=*) quote_sh "-Dtcg_tests_cross_cc_mips=$2" ;;
+    --tcg-tests-cross-cc-mips64=*) quote_sh "-Dtcg_tests_cross_cc_mips64=$2" ;;
+    --tcg-tests-cross-cc-mips64el=*) quote_sh "-Dtcg_tests_cross_cc_mips64el=$2" ;;
+    --tcg-tests-cross-cc-or1k=*) quote_sh "-Dtcg_tests_cross_cc_or1k=$2" ;;
+    --tcg-tests-cross-cc-ppc64=*) quote_sh "-Dtcg_tests_cross_cc_ppc64=$2" ;;
+    --tcg-tests-cross-cc-ppc64le=*) quote_sh "-Dtcg_tests_cross_cc_ppc64le=$2" ;;
+    --tcg-tests-cross-cc-riscv64=*) quote_sh "-Dtcg_tests_cross_cc_riscv64=$2" ;;
+    --tcg-tests-cross-cc-s390x=*) quote_sh "-Dtcg_tests_cross_cc_s390x=$2" ;;
+    --tcg-tests-cross-cc-sh4=*) quote_sh "-Dtcg_tests_cross_cc_sh4=$2" ;;
+    --tcg-tests-cross-cc-tricore=*) quote_sh "-Dtcg_tests_cross_cc_tricore=$2" ;;
+    --tcg-tests-cross-cc-x86-64=*) quote_sh "-Dtcg_tests_cross_cc_x86_64=$2" ;;
+    --tcg-tests-cross-cc-xtensa=*) quote_sh "-Dtcg_tests_cross_cc_xtensa=$2" ;;
+    --tcg-tests-cross-cc-xtensaeb=*) quote_sh "-Dtcg_tests_cross_cc_xtensaeb=$2" ;;
+    --tcg-tests-cross-cflags-aarch64=*) quote_sh "-Dtcg_tests_cross_cflags_aarch64=$2" ;;
+    --tcg-tests-cross-cflags-aarch64-be=*) quote_sh "-Dtcg_tests_cross_cflags_aarch64_be=$2" ;;
+    --tcg-tests-cross-cflags-alpha=*) quote_sh "-Dtcg_tests_cross_cflags_alpha=$2" ;;
+    --tcg-tests-cross-cflags-arm=*) quote_sh "-Dtcg_tests_cross_cflags_arm=$2" ;;
+    --tcg-tests-cross-cflags-hexagon=*) quote_sh "-Dtcg_tests_cross_cflags_hexagon=$2" ;;
+    --tcg-tests-cross-cflags-hppa=*) quote_sh "-Dtcg_tests_cross_cflags_hppa=$2" ;;
+    --tcg-tests-cross-cflags-i386=*) quote_sh "-Dtcg_tests_cross_cflags_i386=$2" ;;
+    --tcg-tests-cross-cflags-loongarch64=*) quote_sh "-Dtcg_tests_cross_cflags_loongarch64=$2" ;;
+    --tcg-tests-cross-cflags-m68k=*) quote_sh "-Dtcg_tests_cross_cflags_m68k=$2" ;;
+    --tcg-tests-cross-cflags-mips=*) quote_sh "-Dtcg_tests_cross_cflags_mips=$2" ;;
+    --tcg-tests-cross-cflags-mips64=*) quote_sh "-Dtcg_tests_cross_cflags_mips64=$2" ;;
+    --tcg-tests-cross-cflags-mips64el=*) quote_sh "-Dtcg_tests_cross_cflags_mips64el=$2" ;;
+    --tcg-tests-cross-cflags-or1k=*) quote_sh "-Dtcg_tests_cross_cflags_or1k=$2" ;;
+    --tcg-tests-cross-cflags-ppc64=*) quote_sh "-Dtcg_tests_cross_cflags_ppc64=$2" ;;
+    --tcg-tests-cross-cflags-ppc64le=*) quote_sh "-Dtcg_tests_cross_cflags_ppc64le=$2" ;;
+    --tcg-tests-cross-cflags-riscv64=*) quote_sh "-Dtcg_tests_cross_cflags_riscv64=$2" ;;
+    --tcg-tests-cross-cflags-s390x=*) quote_sh "-Dtcg_tests_cross_cflags_s390x=$2" ;;
+    --tcg-tests-cross-cflags-sh4=*) quote_sh "-Dtcg_tests_cross_cflags_sh4=$2" ;;
+    --tcg-tests-cross-cflags-tricore=*) quote_sh "-Dtcg_tests_cross_cflags_tricore=$2" ;;
+    --tcg-tests-cross-cflags-x86-64=*) quote_sh "-Dtcg_tests_cross_cflags_x86_64=$2" ;;
+    --tcg-tests-cross-cflags-xtensa=*) quote_sh "-Dtcg_tests_cross_cflags_xtensa=$2" ;;
+    --tcg-tests-cross-cflags-xtensaeb=*) quote_sh "-Dtcg_tests_cross_cflags_xtensaeb=$2" ;;
     --tls-priority=*) quote_sh "-Dtls_priority=$2" ;;
     --enable-tools) printf "%s" -Dtools=enabled ;;
     --disable-tools) printf "%s" -Dtools=disabled ;;
#3 lore raw

Re: [PATCH 1/9] scripts/meson-buildoptions.sh: update missing options

Quoted 10 lines · Fabiano Rosas
Quoted 4 lines · Alex Bennée

This should have been updated when the meson check-tcg changes where made. Include it now.

There's this previous change by Daniel doing this already:

https://lore.kernel.org/r/[email protected]

I've grabbed that (and noticed this update has extra bits from later in it)

Quoted 180 lines
Quoted 180 lines
---
 scripts/meson-buildoptions.sh | 142 ++++++++++++++++++++++++++++++++++
 1 file changed, 142 insertions(+)
scripts/meson-buildoptions.sh +142 -0
index 5a67e59a167..67c5e33b011 100644
@@ -10,7 +10,13 @@ meson_options_help() {
   printf "%s\n" '  --block-drv-rw-whitelist=VALUE'
   printf "%s\n" '                           set block driver read-write whitelist (by default'
   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)'
   printf "%s\n" '  --disable-debug-info     Enable debug symbols and other information'
   printf "%s\n" '  --disable-hexagon-idef-parser'
@@ -77,6 +83,94 @@ meson_options_help() {
   printf "%s\n" '  --rtsig-map=VALUE        default value of QEMU_RTSIG_MAP [NULL]'
   printf "%s\n" '  --smbd=VALUE             Path to smbd for slirp networking'
   printf "%s\n" '  --sysconfdir=VALUE       Sysconf data directory [etc]'
+  printf "%s\n" '  --tcg-tests-cross-cc-aarch64=VALUE'
+  printf "%s\n" '                           cc for aarch64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-aarch64-be=VALUE'
+  printf "%s\n" '                           cc for aarch64_be tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-alpha=VALUE'
+  printf "%s\n" '                           cc for alpha tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-arm=VALUE'
+  printf "%s\n" '                           cc for arm tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-hexagon=VALUE'
+  printf "%s\n" '                           cc for hexagon tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-hppa=VALUE'
+  printf "%s\n" '                           cc for hppa tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-i386=VALUE'
+  printf "%s\n" '                           cc for i386 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-loongarch64=VALUE'
+  printf "%s\n" '                           cc for loongarch64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-m68k=VALUE'
+  printf "%s\n" '                           cc for m68k tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-mips=VALUE'
+  printf "%s\n" '                           cc for mips tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-mips64=VALUE'
+  printf "%s\n" '                           cc for mips64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-mips64el=VALUE'
+  printf "%s\n" '                           cc for mips64el tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-or1k=VALUE'
+  printf "%s\n" '                           cc for or1k tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-ppc64=VALUE'
+  printf "%s\n" '                           cc for ppc64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-ppc64le=VALUE'
+  printf "%s\n" '                           cc for ppc64le tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-riscv64=VALUE'
+  printf "%s\n" '                           cc for riscv64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-s390x=VALUE'
+  printf "%s\n" '                           cc for s390x tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-sh4=VALUE'
+  printf "%s\n" '                           cc for sh4 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-tricore=VALUE'
+  printf "%s\n" '                           cc for tricore tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-x86-64=VALUE'
+  printf "%s\n" '                           cc for x86_64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-xtensa=VALUE'
+  printf "%s\n" '                           cc for xtensa tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-xtensaeb=VALUE'
+  printf "%s\n" '                           cc for xtensaeb tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-aarch64=VALUE'
+  printf "%s\n" '                           cflags for aarch64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-aarch64-be=VALUE'
+  printf "%s\n" '                           cflags for aarch64_be tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-alpha=VALUE'
+  printf "%s\n" '                           cflags for alpha tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-arm=VALUE'
+  printf "%s\n" '                           cflags for arm tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-hexagon=VALUE'
+  printf "%s\n" '                           cflags for hexagon tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-hppa=VALUE'
+  printf "%s\n" '                           cflags for hppa tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-i386=VALUE'
+  printf "%s\n" '                           cflags for i386 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-loongarch64=VALUE'
+  printf "%s\n" '                           cflags for loongarch64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-m68k=VALUE'
+  printf "%s\n" '                           cflags for m68k tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-mips=VALUE'
+  printf "%s\n" '                           cflags for mips tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-mips64=VALUE'
+  printf "%s\n" '                           cflags for mips64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-mips64el=VALUE'
+  printf "%s\n" '                           cflags for mips64el tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-or1k=VALUE'
+  printf "%s\n" '                           cflags for or1k tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-ppc64=VALUE'
+  printf "%s\n" '                           cflags for ppc64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-ppc64le=VALUE'
+  printf "%s\n" '                           cflags for ppc64le tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-riscv64=VALUE'
+  printf "%s\n" '                           cflags for riscv64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-s390x=VALUE'
+  printf "%s\n" '                           cflags for s390x tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-sh4=VALUE'
+  printf "%s\n" '                           cflags for sh4 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-tricore=VALUE'
+  printf "%s\n" '                           cflags for tricore tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-x86-64=VALUE'
+  printf "%s\n" '                           cflags for x86_64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-xtensa=VALUE'
+  printf "%s\n" '                           cflags for xtensa tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-xtensaeb=VALUE'
+  printf "%s\n" '                           cflags for xtensaeb tcg tests'
   printf "%s\n" '  --tls-priority=VALUE     Default TLS protocol/cipher priority string'
   printf "%s\n" '                           [NORMAL]'
   printf "%s\n" '  --with-coroutine=CHOICE  coroutine backend to use (choices:'
@@ -281,6 +375,10 @@ _meson_option_parse() {
     --disable-cocoa) printf "%s" -Dcocoa=disabled ;;
     --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 ;;
     --disable-coreaudio) printf "%s" -Dcoreaudio=disabled ;;
     --with-coroutine=*) quote_sh "-Dcoroutine_backend=$2" ;;
@@ -517,6 +615,50 @@ _meson_option_parse() {
     --disable-tcg) printf "%s" -Dtcg=disabled ;;
     --enable-tcg-interpreter) printf "%s" -Dtcg_interpreter=true ;;
     --disable-tcg-interpreter) printf "%s" -Dtcg_interpreter=false ;;
+    --tcg-tests-cross-cc-aarch64=*) quote_sh "-Dtcg_tests_cross_cc_aarch64=$2" ;;
+    --tcg-tests-cross-cc-aarch64-be=*) quote_sh "-Dtcg_tests_cross_cc_aarch64_be=$2" ;;
+    --tcg-tests-cross-cc-alpha=*) quote_sh "-Dtcg_tests_cross_cc_alpha=$2" ;;
+    --tcg-tests-cross-cc-arm=*) quote_sh "-Dtcg_tests_cross_cc_arm=$2" ;;
+    --tcg-tests-cross-cc-hexagon=*) quote_sh "-Dtcg_tests_cross_cc_hexagon=$2" ;;
+    --tcg-tests-cross-cc-hppa=*) quote_sh "-Dtcg_tests_cross_cc_hppa=$2" ;;
+    --tcg-tests-cross-cc-i386=*) quote_sh "-Dtcg_tests_cross_cc_i386=$2" ;;
+    --tcg-tests-cross-cc-loongarch64=*) quote_sh "-Dtcg_tests_cross_cc_loongarch64=$2" ;;
+    --tcg-tests-cross-cc-m68k=*) quote_sh "-Dtcg_tests_cross_cc_m68k=$2" ;;
+    --tcg-tests-cross-cc-mips=*) quote_sh "-Dtcg_tests_cross_cc_mips=$2" ;;
+    --tcg-tests-cross-cc-mips64=*) quote_sh "-Dtcg_tests_cross_cc_mips64=$2" ;;
+    --tcg-tests-cross-cc-mips64el=*) quote_sh "-Dtcg_tests_cross_cc_mips64el=$2" ;;
+    --tcg-tests-cross-cc-or1k=*) quote_sh "-Dtcg_tests_cross_cc_or1k=$2" ;;
+    --tcg-tests-cross-cc-ppc64=*) quote_sh "-Dtcg_tests_cross_cc_ppc64=$2" ;;
+    --tcg-tests-cross-cc-ppc64le=*) quote_sh "-Dtcg_tests_cross_cc_ppc64le=$2" ;;
+    --tcg-tests-cross-cc-riscv64=*) quote_sh "-Dtcg_tests_cross_cc_riscv64=$2" ;;
+    --tcg-tests-cross-cc-s390x=*) quote_sh "-Dtcg_tests_cross_cc_s390x=$2" ;;
+    --tcg-tests-cross-cc-sh4=*) quote_sh "-Dtcg_tests_cross_cc_sh4=$2" ;;
+    --tcg-tests-cross-cc-tricore=*) quote_sh "-Dtcg_tests_cross_cc_tricore=$2" ;;
+    --tcg-tests-cross-cc-x86-64=*) quote_sh "-Dtcg_tests_cross_cc_x86_64=$2" ;;
+    --tcg-tests-cross-cc-xtensa=*) quote_sh "-Dtcg_tests_cross_cc_xtensa=$2" ;;
+    --tcg-tests-cross-cc-xtensaeb=*) quote_sh "-Dtcg_tests_cross_cc_xtensaeb=$2" ;;
+    --tcg-tests-cross-cflags-aarch64=*) quote_sh "-Dtcg_tests_cross_cflags_aarch64=$2" ;;
+    --tcg-tests-cross-cflags-aarch64-be=*) quote_sh "-Dtcg_tests_cross_cflags_aarch64_be=$2" ;;
+    --tcg-tests-cross-cflags-alpha=*) quote_sh "-Dtcg_tests_cross_cflags_alpha=$2" ;;
+    --tcg-tests-cross-cflags-arm=*) quote_sh "-Dtcg_tests_cross_cflags_arm=$2" ;;
+    --tcg-tests-cross-cflags-hexagon=*) quote_sh "-Dtcg_tests_cross_cflags_hexagon=$2" ;;
+    --tcg-tests-cross-cflags-hppa=*) quote_sh "-Dtcg_tests_cross_cflags_hppa=$2" ;;
+    --tcg-tests-cross-cflags-i386=*) quote_sh "-Dtcg_tests_cross_cflags_i386=$2" ;;
+    --tcg-tests-cross-cflags-loongarch64=*) quote_sh "-Dtcg_tests_cross_cflags_loongarch64=$2" ;;
+    --tcg-tests-cross-cflags-m68k=*) quote_sh "-Dtcg_tests_cross_cflags_m68k=$2" ;;
+    --tcg-tests-cross-cflags-mips=*) quote_sh "-Dtcg_tests_cross_cflags_mips=$2" ;;
+    --tcg-tests-cross-cflags-mips64=*) quote_sh "-Dtcg_tests_cross_cflags_mips64=$2" ;;
+    --tcg-tests-cross-cflags-mips64el=*) quote_sh "-Dtcg_tests_cross_cflags_mips64el=$2" ;;
+    --tcg-tests-cross-cflags-or1k=*) quote_sh "-Dtcg_tests_cross_cflags_or1k=$2" ;;
+    --tcg-tests-cross-cflags-ppc64=*) quote_sh "-Dtcg_tests_cross_cflags_ppc64=$2" ;;
+    --tcg-tests-cross-cflags-ppc64le=*) quote_sh "-Dtcg_tests_cross_cflags_ppc64le=$2" ;;
+    --tcg-tests-cross-cflags-riscv64=*) quote_sh "-Dtcg_tests_cross_cflags_riscv64=$2" ;;
+    --tcg-tests-cross-cflags-s390x=*) quote_sh "-Dtcg_tests_cross_cflags_s390x=$2" ;;
+    --tcg-tests-cross-cflags-sh4=*) quote_sh "-Dtcg_tests_cross_cflags_sh4=$2" ;;
+    --tcg-tests-cross-cflags-tricore=*) quote_sh "-Dtcg_tests_cross_cflags_tricore=$2" ;;
+    --tcg-tests-cross-cflags-x86-64=*) quote_sh "-Dtcg_tests_cross_cflags_x86_64=$2" ;;
+    --tcg-tests-cross-cflags-xtensa=*) quote_sh "-Dtcg_tests_cross_cflags_xtensa=$2" ;;
+    --tcg-tests-cross-cflags-xtensaeb=*) quote_sh "-Dtcg_tests_cross_cflags_xtensaeb=$2" ;;
     --tls-priority=*) quote_sh "-Dtls_priority=$2" ;;
     --enable-tools) printf "%s" -Dtools=enabled ;;
     --disable-tools) printf "%s" -Dtools=disabled ;;
Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro
Reviewed-by on v1 1/9
#4 lore raw

Re: [PATCH 1/9] scripts/meson-buildoptions.sh: update missing options

In reply to Alex Bennée
Quoted 8 lines · Alex Bennée

This should have been updated when the meson check-tcg changes where made. Include it now.

---
  scripts/meson-buildoptions.sh | 142 ++++++++++++++++++++++++++++++++++
  1 file changed, 142 insertions(+)

Thanks for this fix.
I can confirm I didn't see this needed to be updated, simply because I only ran make check-tcg (which didn't retrigger it), and use ninja/meson test for everything else.

Maybe the best place to generate this file would be from meson itself, as a custom_target run by default.

What do concerned folks think?

Regards,
Pierrick

#5 lore raw

Re: [PATCH 1/9] scripts/meson-buildoptions.sh: update missing options

In reply to Alex Bennée

Il gio 10 set 2026, 20:15 Alex Bennée <[email protected]> ha scritto:

Quoted 3 lines

This should have been updated when the meson check-tcg changes where made. Include it now.

No, please revert the moving of containers out of configure.

Paolo

Quoted 240 lines
---
 scripts/meson-buildoptions.sh | 142 ++++++++++++++++++++++++++++++++++
 1 file changed, 142 insertions(+)
scripts/meson-buildoptions.sh +0 -0
index 5a67e59a167..67c5e33b011 100644
@@ -10,7 +10,13 @@ meson_options_help() {
   printf "%s\n" '  --block-drv-rw-whitelist=VALUE'
   printf "%s\n" '                           set block driver read-write

whitelist (by default'
printf "%s\n" ' affects only QEMU, not tools
like qemu-img)'

scripts/meson-buildoptions.sh +2 -0
+  printf "%s\n" '  --container-command=VALUE'
+  printf "%s\n" '                           command to build/run

containers'

scripts/meson-buildoptions.sh +2 -0
+  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)'
printf "%s\n" ' --disable-debug-info Enable debug symbols and
other information'
printf "%s\n" ' --disable-hexagon-idef-parser'

scripts/meson-buildoptions.sh +0 -0
@@ -77,6 +83,94 @@ meson_options_help() {
   printf "%s\n" '  --rtsig-map=VALUE        default value of

QEMU_RTSIG_MAP [NULL]'
printf "%s\n" ' --smbd=VALUE Path to smbd for slirp
networking'
printf "%s\n" ' --sysconfdir=VALUE Sysconf data directory [etc]'

scripts/meson-buildoptions.sh +48 -0
+  printf "%s\n" '  --tcg-tests-cross-cc-aarch64=VALUE'
+  printf "%s\n" '                           cc for aarch64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-aarch64-be=VALUE'
+  printf "%s\n" '                           cc for aarch64_be tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-alpha=VALUE'
+  printf "%s\n" '                           cc for alpha tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-arm=VALUE'
+  printf "%s\n" '                           cc for arm tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-hexagon=VALUE'
+  printf "%s\n" '                           cc for hexagon tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-hppa=VALUE'
+  printf "%s\n" '                           cc for hppa tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-i386=VALUE'
+  printf "%s\n" '                           cc for i386 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-loongarch64=VALUE'
+  printf "%s\n" '                           cc for loongarch64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-m68k=VALUE'
+  printf "%s\n" '                           cc for m68k tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-mips=VALUE'
+  printf "%s\n" '                           cc for mips tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-mips64=VALUE'
+  printf "%s\n" '                           cc for mips64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-mips64el=VALUE'
+  printf "%s\n" '                           cc for mips64el tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-or1k=VALUE'
+  printf "%s\n" '                           cc for or1k tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-ppc64=VALUE'
+  printf "%s\n" '                           cc for ppc64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-ppc64le=VALUE'
+  printf "%s\n" '                           cc for ppc64le tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-riscv64=VALUE'
+  printf "%s\n" '                           cc for riscv64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-s390x=VALUE'
+  printf "%s\n" '                           cc for s390x tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-sh4=VALUE'
+  printf "%s\n" '                           cc for sh4 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-tricore=VALUE'
+  printf "%s\n" '                           cc for tricore tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-x86-64=VALUE'
+  printf "%s\n" '                           cc for x86_64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-xtensa=VALUE'
+  printf "%s\n" '                           cc for xtensa tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cc-xtensaeb=VALUE'
+  printf "%s\n" '                           cc for xtensaeb tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-aarch64=VALUE'
+  printf "%s\n" '                           cflags for aarch64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-aarch64-be=VALUE'
+  printf "%s\n" '                           cflags for aarch64_be tcg

tests'

scripts/meson-buildoptions.sh +12 -0
+  printf "%s\n" '  --tcg-tests-cross-cflags-alpha=VALUE'
+  printf "%s\n" '                           cflags for alpha tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-arm=VALUE'
+  printf "%s\n" '                           cflags for arm tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-hexagon=VALUE'
+  printf "%s\n" '                           cflags for hexagon tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-hppa=VALUE'
+  printf "%s\n" '                           cflags for hppa tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-i386=VALUE'
+  printf "%s\n" '                           cflags for i386 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-loongarch64=VALUE'
+  printf "%s\n" '                           cflags for loongarch64 tcg

tests'

scripts/meson-buildoptions.sh +28 -0
+  printf "%s\n" '  --tcg-tests-cross-cflags-m68k=VALUE'
+  printf "%s\n" '                           cflags for m68k tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-mips=VALUE'
+  printf "%s\n" '                           cflags for mips tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-mips64=VALUE'
+  printf "%s\n" '                           cflags for mips64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-mips64el=VALUE'
+  printf "%s\n" '                           cflags for mips64el tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-or1k=VALUE'
+  printf "%s\n" '                           cflags for or1k tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-ppc64=VALUE'
+  printf "%s\n" '                           cflags for ppc64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-ppc64le=VALUE'
+  printf "%s\n" '                           cflags for ppc64le tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-riscv64=VALUE'
+  printf "%s\n" '                           cflags for riscv64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-s390x=VALUE'
+  printf "%s\n" '                           cflags for s390x tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-sh4=VALUE'
+  printf "%s\n" '                           cflags for sh4 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-tricore=VALUE'
+  printf "%s\n" '                           cflags for tricore tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-x86-64=VALUE'
+  printf "%s\n" '                           cflags for x86_64 tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-xtensa=VALUE'
+  printf "%s\n" '                           cflags for xtensa tcg tests'
+  printf "%s\n" '  --tcg-tests-cross-cflags-xtensaeb=VALUE'
+  printf "%s\n" '                           cflags for xtensaeb tcg tests'
   printf "%s\n" '  --tls-priority=VALUE     Default TLS protocol/cipher

priority string'
printf "%s\n" ' [NORMAL]'
printf "%s\n" ' --with-coroutine=CHOICE coroutine backend to use
(choices:'

scripts/meson-buildoptions.sh +9 -0
@@ -281,6 +375,10 @@ _meson_option_parse() {
     --disable-cocoa) printf "%s" -Dcocoa=disabled ;;
     --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 ;;
     --disable-coreaudio) printf "%s" -Dcoreaudio=disabled ;;
     --with-coroutine=*) quote_sh "-Dcoroutine_backend=$2" ;;
@@ -517,6 +615,50 @@ _meson_option_parse() {
     --disable-tcg) printf "%s" -Dtcg=disabled ;;
     --enable-tcg-interpreter) printf "%s" -Dtcg_interpreter=true ;;
     --disable-tcg-interpreter) printf "%s" -Dtcg_interpreter=false ;;
+    --tcg-tests-cross-cc-aarch64=*) quote_sh
 "-Dtcg_tests_cross_cc_aarch64=$2" ;;
+    --tcg-tests-cross-cc-aarch64-be=*) quote_sh
 "-Dtcg_tests_cross_cc_aarch64_be=$2" ;;
+    --tcg-tests-cross-cc-alpha=*) quote_sh
 "-Dtcg_tests_cross_cc_alpha=$2" ;;
+    --tcg-tests-cross-cc-arm=*) quote_sh "-Dtcg_tests_cross_cc_arm=$2" ;;
+    --tcg-tests-cross-cc-hexagon=*) quote_sh

"-Dtcg_tests_cross_cc_hexagon=$2" ;;
+ --tcg-tests-cross-cc-hppa=*) quote_sh "-Dtcg_tests_cross_cc_hppa=$2"
;;
+ --tcg-tests-cross-cc-i386=*) quote_sh "-Dtcg_tests_cross_cc_i386=$2"
;;
+ --tcg-tests-cross-cc-loongarch64=*) quote_sh
"-Dtcg_tests_cross_cc_loongarch64=$2" ;;
+ --tcg-tests-cross-cc-m68k=*) quote_sh "-Dtcg_tests_cross_cc_m68k=$2"
;;
+ --tcg-tests-cross-cc-mips=*) quote_sh "-Dtcg_tests_cross_cc_mips=$2"
;;
+ --tcg-tests-cross-cc-mips64=*) quote_sh
"-Dtcg_tests_cross_cc_mips64=$2" ;;
+ --tcg-tests-cross-cc-mips64el=*) quote_sh
"-Dtcg_tests_cross_cc_mips64el=$2" ;;
+ --tcg-tests-cross-cc-or1k=*) quote_sh "-Dtcg_tests_cross_cc_or1k=$2"
;;
+ --tcg-tests-cross-cc-ppc64=*) quote_sh
"-Dtcg_tests_cross_cc_ppc64=$2" ;;
+ --tcg-tests-cross-cc-ppc64le=*) quote_sh
"-Dtcg_tests_cross_cc_ppc64le=$2" ;;
+ --tcg-tests-cross-cc-riscv64=*) quote_sh
"-Dtcg_tests_cross_cc_riscv64=$2" ;;
+ --tcg-tests-cross-cc-s390x=*) quote_sh
"-Dtcg_tests_cross_cc_s390x=$2" ;;

scripts/meson-buildoptions.sh +2 -0
+    --tcg-tests-cross-cc-sh4=*) quote_sh "-Dtcg_tests_cross_cc_sh4=$2" ;;
+    --tcg-tests-cross-cc-tricore=*) quote_sh

"-Dtcg_tests_cross_cc_tricore=$2" ;;
+ --tcg-tests-cross-cc-x86-64=*) quote_sh
"-Dtcg_tests_cross_cc_x86_64=$2" ;;
+ --tcg-tests-cross-cc-xtensa=*) quote_sh
"-Dtcg_tests_cross_cc_xtensa=$2" ;;
+ --tcg-tests-cross-cc-xtensaeb=*) quote_sh
"-Dtcg_tests_cross_cc_xtensaeb=$2" ;;
+ --tcg-tests-cross-cflags-aarch64=*) quote_sh
"-Dtcg_tests_cross_cflags_aarch64=$2" ;;
+ --tcg-tests-cross-cflags-aarch64-be=*) quote_sh
"-Dtcg_tests_cross_cflags_aarch64_be=$2" ;;
+ --tcg-tests-cross-cflags-alpha=*) quote_sh
"-Dtcg_tests_cross_cflags_alpha=$2" ;;
+ --tcg-tests-cross-cflags-arm=*) quote_sh
"-Dtcg_tests_cross_cflags_arm=$2" ;;
+ --tcg-tests-cross-cflags-hexagon=*) quote_sh
"-Dtcg_tests_cross_cflags_hexagon=$2" ;;
+ --tcg-tests-cross-cflags-hppa=*) quote_sh
"-Dtcg_tests_cross_cflags_hppa=$2" ;;
+ --tcg-tests-cross-cflags-i386=*) quote_sh
"-Dtcg_tests_cross_cflags_i386=$2" ;;
+ --tcg-tests-cross-cflags-loongarch64=*) quote_sh
"-Dtcg_tests_cross_cflags_loongarch64=$2" ;;
+ --tcg-tests-cross-cflags-m68k=*) quote_sh
"-Dtcg_tests_cross_cflags_m68k=$2" ;;
+ --tcg-tests-cross-cflags-mips=*) quote_sh
"-Dtcg_tests_cross_cflags_mips=$2" ;;
+ --tcg-tests-cross-cflags-mips64=*) quote_sh
"-Dtcg_tests_cross_cflags_mips64=$2" ;;
+ --tcg-tests-cross-cflags-mips64el=*) quote_sh
"-Dtcg_tests_cross_cflags_mips64el=$2" ;;
+ --tcg-tests-cross-cflags-or1k=*) quote_sh
"-Dtcg_tests_cross_cflags_or1k=$2" ;;
+ --tcg-tests-cross-cflags-ppc64=*) quote_sh
"-Dtcg_tests_cross_cflags_ppc64=$2" ;;
+ --tcg-tests-cross-cflags-ppc64le=*) quote_sh
"-Dtcg_tests_cross_cflags_ppc64le=$2" ;;
+ --tcg-tests-cross-cflags-riscv64=*) quote_sh
"-Dtcg_tests_cross_cflags_riscv64=$2" ;;
+ --tcg-tests-cross-cflags-s390x=*) quote_sh
"-Dtcg_tests_cross_cflags_s390x=$2" ;;
+ --tcg-tests-cross-cflags-sh4=*) quote_sh
"-Dtcg_tests_cross_cflags_sh4=$2" ;;
+ --tcg-tests-cross-cflags-tricore=*) quote_sh
"-Dtcg_tests_cross_cflags_tricore=$2" ;;
+ --tcg-tests-cross-cflags-x86-64=*) quote_sh
"-Dtcg_tests_cross_cflags_x86_64=$2" ;;
+ --tcg-tests-cross-cflags-xtensa=*) quote_sh
"-Dtcg_tests_cross_cflags_xtensa=$2" ;;
+ --tcg-tests-cross-cflags-xtensaeb=*) quote_sh

"-Dtcg_tests_cross_cflags_xtensaeb=$2" ;;
     --tls-priority=*) quote_sh "-Dtls_priority=$2" ;;
     --enable-tools) printf "%s" -Dtools=enabled ;;
     --disable-tools) printf "%s" -Dtools=disabled ;;

--
2.47.3

#6 lore raw

PATCH 2/9 tests/tcg: improve check for working cross compilers

In reply to Alex Bennée

From: Daniel P. Berrangé <[email protected]>

When it finds a cross compiler, tests/tcg/meson.build tries building test_cc.c to validate that the compiler works. This includes "stdint.h" as a witness for working C library, however, that is not a good choice as it can be provided by the toolchain alone:

  $ rpm -ql gcc-s390x-linux-gnu  | grep /stdint.h
  /usr/lib/gcc/s390x-linux-gnu/16/include/stdint.h

As a result, if you install the s390x GCC cross compiler, but not any C library, meson decides to use the host compiler instead of the container:

    cc for aarch64-softmmu          : aarch64-linux-gnu-gcc (from 'debian-all-test-cross' container)
    cc for loongarch64-softmmu      : loongarch64-unknown-linux-gnu-gcc (from 'debian-loongarch-cross' container)
    cc for riscv64-softmmu          : riscv64-linux-gnu-gcc (from 'debian-all-test-cross' container)
    cc for s390x-softmmu            : s390x-linux-gnu-gcc
    cc for x86_64-softmmu           : x86_64-linux-gnu-gcc (from 'debian-amd64-cross' container)

Eventually this results in failure to run 'make check':

[33/40] Generating tests/tcg/s390x-softmmu-hello with a custom command
FAILED: [code=1] tests/tcg/s390x-softmmu-hello.test
/usr/bin/s390x-linux-gnu-gcc /home/berrange/src/virt/qemu/tests/tcg/multiarch/system/hello.c -o tests/tcg/s390x-softmmu-hello.test -static -MMD -MF tests/tcg/s390x-softmmu-hello.d -Wall -Werror -O0 -g -fno-strict-aliasing -nostdlib -ffreestanding -Wa,--noexecstack -I /home/berrange/src/virt/qemu/tests/tcg/s390x/system/../../minilib /home/berrange/src/virt/qemu/tests/tcg/s390x/system/../../minilib/printf.c -I /home/berrange/src/virt/qemu/include/hw/s390x/ipl -march=z13 ../tests/tcg/s390x/system/../head64.S ../tests/tcg/s390x/system/../console.c In file included from ../tests/tcg/s390x/system/../console.c:8:
../tests/tcg/s390x/system/../../../../pc-bios/s390-ccw/sclp.c:11:10: fatal error: string.h: No such file or directory
11 | #include <string.h>

      |          ^~~~~~~~~~

compilation terminated.

Adding more include files to the test program ensures the meson probe makes a better decision.

Fixes e5d084d622b1 (tests/tcg/meson.build: check host cross cc is working)

Message-ID: <[email protected]>

---
 tests/tcg/test_cc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
tests/tcg/test_cc.c +5 -1
index d3614a01fe6..fafee055b40 100644
@@ -1,7 +1,11 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
 
-/* Include a standard header to make sure cross compiler provides them */
+/* Use some standard headers to ensure the cross compiler provides them */
 #include <stdint.h>
+#include <string.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdio.h>
 
 int main(void)
 {
Signature · 1 line
2.47.3
Reviewed-by on v1 2/9
#7 lore raw

Re: [PATCH 2/9] tests/tcg: improve check for working cross compilers

Quoted 50 lines · Alex Bennée

From: Daniel P. Berrangé <[email protected]>

When it finds a cross compiler, tests/tcg/meson.build tries building test_cc.c to validate that the compiler works. This includes "stdint.h" as a witness for working C library, however, that is not a good choice as it can be provided by the toolchain alone:

   $ rpm -ql gcc-s390x-linux-gnu  | grep /stdint.h
   /usr/lib/gcc/s390x-linux-gnu/16/include/stdint.h

As a result, if you install the s390x GCC cross compiler, but not any C library, meson decides to use the host compiler instead of the container:

     cc for aarch64-softmmu          : aarch64-linux-gnu-gcc (from 'debian-all-test-cross' container)
     cc for loongarch64-softmmu      : loongarch64-unknown-linux-gnu-gcc (from 'debian-loongarch-cross' container)
     cc for riscv64-softmmu          : riscv64-linux-gnu-gcc (from 'debian-all-test-cross' container)
     cc for s390x-softmmu            : s390x-linux-gnu-gcc
     cc for x86_64-softmmu           : x86_64-linux-gnu-gcc (from 'debian-amd64-cross' container)

Eventually this results in failure to run 'make check':

[33/40] Generating tests/tcg/s390x-softmmu-hello with a custom command
FAILED: [code=1] tests/tcg/s390x-softmmu-hello.test
/usr/bin/s390x-linux-gnu-gcc /home/berrange/src/virt/qemu/tests/tcg/multiarch/system/hello.c -o tests/tcg/s390x-softmmu-hello.test -static -MMD -MF tests/tcg/s390x-softmmu-hello.d -Wall -Werror -O0 -g -fno-strict-aliasing -nostdlib -ffreestanding -Wa,--noexecstack -I /home/berrange/src/virt/qemu/tests/tcg/s390x/system/../../minilib /home/berrange/src/virt/qemu/tests/tcg/s390x/system/../../minilib/printf.c -I /home/berrange/src/virt/qemu/include/hw/s390x/ipl -march=z13 ../tests/tcg/s390x/system/../head64.S ../tests/tcg/s390x/system/../console.c In file included from ../tests/tcg/s390x/system/../console.c:8:
../tests/tcg/s390x/system/../../../../pc-bios/s390-ccw/sclp.c:11:10: fatal error: string.h: No such file or directory

    11 | #include <string.h>
       |          ^~~~~~~~~~

compilation terminated.

Adding more include files to the test program ensures the meson probe makes a better decision.

Fixes e5d084d622b1 (tests/tcg/meson.build: check host cross cc is working)

Message-ID: <[email protected]>

---
  tests/tcg/test_cc.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
tests/tcg/test_cc.c +0 -0
index d3614a01fe6..fafee055b40 100644
@@ -1,7 +1,11 @@
  /* SPDX-License-Identifier: GPL-2.0-or-later */
 

tests/tcg/test_cc.c line 11

Quoted 10 lines
tests/tcg/test_cc.c +5 -1
-/* Include a standard header to make sure cross compiler provides them */
+/* Use some standard headers to ensure the cross compiler provides them */
  #include <stdint.h>
+#include <string.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdio.h>
 
  int main(void)
  {

Ideally, we should do separate tests for system vs user tests.
System ones are always compiled with -ffreestanding, while user ones should provide a C library.

From this standard:

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2338r3.html

```
A freestanding C implementation is required to provide the entirety of the following headers:

<float.h>
<iso646.h>
<limits.h>
<stdalign.h>
<stdarg.h>
<stdbool.h>
<stddef.h>
<stdint.h>
<stdnoreturn.h>
Most of <string.h> is required (strdup, strndup, strcoll, strxfrm, and strerror are excluded). This includes strtok, which requires global data.
```

Maybe for now we can just remove stdio.h from current patch, as it's not supposed to be provided in a freestanding environment.

Regards,
Pierrick

#8 lore raw

Re: [PATCH 2/9] tests/tcg: improve check for working cross compilers

Quoted 84 lines · Pierrick Bouvier
Quoted 48 lines · Alex Bennée

From: Daniel P. Berrangé <[email protected]>

When it finds a cross compiler, tests/tcg/meson.build tries building test_cc.c to validate that the compiler works. This includes "stdint.h" as a witness for working C library, however, that is not a good choice as it can be provided by the toolchain alone:

   $ rpm -ql gcc-s390x-linux-gnu  | grep /stdint.h
   /usr/lib/gcc/s390x-linux-gnu/16/include/stdint.h

As a result, if you install the s390x GCC cross compiler, but not any C library, meson decides to use the host compiler instead of the container:

     cc for aarch64-softmmu          : aarch64-linux-gnu-gcc (from 'debian-all-test-cross' container)
     cc for loongarch64-softmmu      : loongarch64-unknown-linux-gnu-gcc (from 'debian-loongarch-cross' container)
     cc for riscv64-softmmu          : riscv64-linux-gnu-gcc (from 'debian-all-test-cross' container)
     cc for s390x-softmmu            : s390x-linux-gnu-gcc
     cc for x86_64-softmmu           : x86_64-linux-gnu-gcc (from 'debian-amd64-cross' container)

Eventually this results in failure to run 'make check':

[33/40] Generating tests/tcg/s390x-softmmu-hello with a custom command
FAILED: [code=1] tests/tcg/s390x-softmmu-hello.test
/usr/bin/s390x-linux-gnu-gcc /home/berrange/src/virt/qemu/tests/tcg/multiarch/system/hello.c -o tests/tcg/s390x-softmmu-hello.test -static -MMD -MF tests/tcg/s390x-softmmu-hello.d -Wall -Werror -O0 -g -fno-strict-aliasing -nostdlib -ffreestanding -Wa,--noexecstack -I /home/berrange/src/virt/qemu/tests/tcg/s390x/system/../../minilib /home/berrange/src/virt/qemu/tests/tcg/s390x/system/../../minilib/printf.c -I /home/berrange/src/virt/qemu/include/hw/s390x/ipl -march=z13 ../tests/tcg/s390x/system/../head64.S ../tests/tcg/s390x/system/../console.c In file included from ../tests/tcg/s390x/system/../console.c:8:
../tests/tcg/s390x/system/../../../../pc-bios/s390-ccw/sclp.c:11:10: fatal error: string.h: No such file or directory

    11 | #include <string.h>
       |          ^~~~~~~~~~

compilation terminated.

Adding more include files to the test program ensures the meson probe makes a better decision.

Fixes e5d084d622b1 (tests/tcg/meson.build: check host cross cc is working)

Message-ID: <[email protected]>

---
  tests/tcg/test_cc.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
tests/tcg/test_cc.c +0 -0
index d3614a01fe6..fafee055b40 100644

tests/tcg/test_cc.c line 9

Quoted 10 lines
tests/tcg/test_cc.c +5 -1
@@ -1,7 +1,11 @@
  /* SPDX-License-Identifier: GPL-2.0-or-later */
-/* Include a standard header to make sure cross compiler provides them */
+/* Use some standard headers to ensure the cross compiler provides them */
  #include <stdint.h>
+#include <string.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdio.h>
  int main(void)
  {

Ideally, we should do separate tests for system vs user tests. System ones are always compiled with -ffreestanding, while user ones should provide a C library.

From this standard:

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2338r3.html

```
A freestanding C implementation is required to provide the entirety of the
following headers:

<float.h>
<iso646.h>
<limits.h>
<stdalign.h>
<stdarg.h>
<stdbool.h>
<stddef.h>
<stdint.h>
<stdnoreturn.h>
Most of <string.h> is required (strdup, strndup, strcoll, strxfrm, and
strerror are excluded). This includes strtok, which requires global data.
```
Quoted 2 lines

Maybe for now we can just remove stdio.h from current patch, as it's not supposed to be provided in a freestanding environment.

A huge number of files under tests/tcg/ have a #include <stdio.h> currently.

In the example build failure in the commit message, we have

tests/tcg/s390x/system/../console.c

which does

  #include "../../../pc-bios/s390-ccw/sclp.c"

and sclp.c has

  #include "s390-ccw.h"

and that header has:

  #include <stdbool.h>
  #include <stddef.h>
  #include <stdint.h>
  #include <stdio.h>

hence the 4 headers I added to the meson check.

So AFAICT, our code is expecting stdio.h to be provided in a -ffreestanding build. Have we got a more fundamental mistake wrt our use of -ffreestanding, such that it is relying on unintended functionality ?

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
#9 lore raw

Re: [PATCH 2/9] tests/tcg: improve check for working cross compilers

Quoted 110 lines · Daniel P. Berrangé
Quoted 84 lines · Pierrick Bouvier
Quoted 48 lines · Alex Bennée

From: Daniel P. Berrangé <[email protected]>

When it finds a cross compiler, tests/tcg/meson.build tries building test_cc.c to validate that the compiler works. This includes "stdint.h" as a witness for working C library, however, that is not a good choice as it can be provided by the toolchain alone:

   $ rpm -ql gcc-s390x-linux-gnu  | grep /stdint.h
   /usr/lib/gcc/s390x-linux-gnu/16/include/stdint.h

As a result, if you install the s390x GCC cross compiler, but not any C library, meson decides to use the host compiler instead of the container:

     cc for aarch64-softmmu          : aarch64-linux-gnu-gcc (from 'debian-all-test-cross' container)
     cc for loongarch64-softmmu      : loongarch64-unknown-linux-gnu-gcc (from 'debian-loongarch-cross' container)
     cc for riscv64-softmmu          : riscv64-linux-gnu-gcc (from 'debian-all-test-cross' container)
     cc for s390x-softmmu            : s390x-linux-gnu-gcc
     cc for x86_64-softmmu           : x86_64-linux-gnu-gcc (from 'debian-amd64-cross' container)

Eventually this results in failure to run 'make check':

[33/40] Generating tests/tcg/s390x-softmmu-hello with a custom command
FAILED: [code=1] tests/tcg/s390x-softmmu-hello.test
/usr/bin/s390x-linux-gnu-gcc /home/berrange/src/virt/qemu/tests/tcg/multiarch/system/hello.c -o tests/tcg/s390x-softmmu-hello.test -static -MMD -MF tests/tcg/s390x-softmmu-hello.d -Wall -Werror -O0 -g -fno-strict-aliasing -nostdlib -ffreestanding -Wa,--noexecstack -I /home/berrange/src/virt/qemu/tests/tcg/s390x/system/../../minilib /home/berrange/src/virt/qemu/tests/tcg/s390x/system/../../minilib/printf.c -I /home/berrange/src/virt/qemu/include/hw/s390x/ipl -march=z13 ../tests/tcg/s390x/system/../head64.S ../tests/tcg/s390x/system/../console.c In file included from ../tests/tcg/s390x/system/../console.c:8:
../tests/tcg/s390x/system/../../../../pc-bios/s390-ccw/sclp.c:11:10: fatal error: string.h: No such file or directory

    11 | #include <string.h>
       |          ^~~~~~~~~~

compilation terminated.

Adding more include files to the test program ensures the meson probe makes a better decision.

Fixes e5d084d622b1 (tests/tcg/meson.build: check host cross cc is working)

Message-ID: <[email protected]>

---
  tests/tcg/test_cc.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
tests/tcg/test_cc.c +0 -0
index d3614a01fe6..fafee055b40 100644

tests/tcg/test_cc.c line 9

Quoted 10 lines
tests/tcg/test_cc.c +5 -1
@@ -1,7 +1,11 @@
  /* SPDX-License-Identifier: GPL-2.0-or-later */
-/* Include a standard header to make sure cross compiler provides them */
+/* Use some standard headers to ensure the cross compiler provides them */
  #include <stdint.h>
+#include <string.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdio.h>
  int main(void)
  {

Ideally, we should do separate tests for system vs user tests. System ones are always compiled with -ffreestanding, while user ones should provide a C library.

From this standard:

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2338r3.html

```
A freestanding C implementation is required to provide the entirety of the
following headers:

<float.h>
<iso646.h>
<limits.h>
<stdalign.h>
<stdarg.h>
<stdbool.h>
<stddef.h>
<stdint.h>
<stdnoreturn.h>
Most of <string.h> is required (strdup, strndup, strcoll, strxfrm, and
strerror are excluded). This includes strtok, which requires global data.
```
Quoted 2 lines

Maybe for now we can just remove stdio.h from current patch, as it's not supposed to be provided in a freestanding environment.

A huge number of files under tests/tcg/ have a #include <stdio.h> currently.

In the example build failure in the commit message, we have

tests/tcg/s390x/system/../console.c

which does

  #include "../../../pc-bios/s390-ccw/sclp.c"

and sclp.c has

  #include "s390-ccw.h"

and that header has:

  #include <stdbool.h>
  #include <stddef.h>
  #include <stdint.h>
  #include <stdio.h>
Quoted 7 lines

hence the 4 headers I added to the meson check.

So AFAICT, our code is expecting stdio.h to be provided in a -ffreestanding build. Have we got a more fundamental mistake wrt our use of -ffreestanding, such that it is relying on unintended functionality ?

Looking a bit further, it seems that this is the only example of system code pulling this header (through pc-bios), which might be a specificity of s390x firmware.
That said, it's not the end of the world, and as we mostly use -linux-gcc variants of cross compilers, it should be safe to expect them to come with a libc. Let's keep the patch as it is.

Quoted 2 lines

With regards,
Daniel

Thanks,
Pierrick

#10 lore raw

Re: [PATCH 2/9] tests/tcg: improve check for working cross compilers

In reply to Daniel P. Berrangé

Daniel P. Berrangé <[email protected]> writes:

(trimed cc list, add Ilya)

Quoted 85 lines · Pierrick Bouvier
Quoted 84 lines · Alex Bennée
Quoted 48 lines

From: Daniel P. Berrangé <[email protected]>

When it finds a cross compiler, tests/tcg/meson.build tries building test_cc.c to validate that the compiler works. This includes "stdint.h" as a witness for working C library, however, that is not a good choice as it can be provided by the toolchain alone:

   $ rpm -ql gcc-s390x-linux-gnu  | grep /stdint.h
   /usr/lib/gcc/s390x-linux-gnu/16/include/stdint.h

As a result, if you install the s390x GCC cross compiler, but not any C library, meson decides to use the host compiler instead of the container:

     cc for aarch64-softmmu          : aarch64-linux-gnu-gcc (from 'debian-all-test-cross' container)
     cc for loongarch64-softmmu      : loongarch64-unknown-linux-gnu-gcc (from 'debian-loongarch-cross' container)
     cc for riscv64-softmmu          : riscv64-linux-gnu-gcc (from 'debian-all-test-cross' container)
     cc for s390x-softmmu            : s390x-linux-gnu-gcc
     cc for x86_64-softmmu           : x86_64-linux-gnu-gcc (from 'debian-amd64-cross' container)

Eventually this results in failure to run 'make check':

[33/40] Generating tests/tcg/s390x-softmmu-hello with a custom command
FAILED: [code=1] tests/tcg/s390x-softmmu-hello.test
/usr/bin/s390x-linux-gnu-gcc /home/berrange/src/virt/qemu/tests/tcg/multiarch/system/hello.c -o tests/tcg/s390x-softmmu-hello.test -static -MMD -MF tests/tcg/s390x-softmmu-hello.d -Wall -Werror -O0 -g -fno-strict-aliasing -nostdlib -ffreestanding -Wa,--noexecstack -I /home/berrange/src/virt/qemu/tests/tcg/s390x/system/../../minilib /home/berrange/src/virt/qemu/tests/tcg/s390x/system/../../minilib/printf.c -I /home/berrange/src/virt/qemu/include/hw/s390x/ipl -march=z13 ../tests/tcg/s390x/system/../head64.S ../tests/tcg/s390x/system/../console.c In file included from ../tests/tcg/s390x/system/../console.c:8:
../tests/tcg/s390x/system/../../../../pc-bios/s390-ccw/sclp.c:11:10: fatal error: string.h: No such file or directory

    11 | #include <string.h>
       |          ^~~~~~~~~~

compilation terminated.

Adding more include files to the test program ensures the meson probe makes a better decision.

Fixes e5d084d622b1 (tests/tcg/meson.build: check host cross cc is working)

Message-ID: <[email protected]>

---
  tests/tcg/test_cc.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
tests/tcg/test_cc.c +0 -0
index d3614a01fe6..fafee055b40 100644

tests/tcg/test_cc.c line 9

Quoted 10 lines
tests/tcg/test_cc.c +5 -1
@@ -1,7 +1,11 @@
  /* SPDX-License-Identifier: GPL-2.0-or-later */
-/* Include a standard header to make sure cross compiler provides them */
+/* Use some standard headers to ensure the cross compiler provides them */
  #include <stdint.h>
+#include <string.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdio.h>
  int main(void)
  {

Ideally, we should do separate tests for system vs user tests. System ones are always compiled with -ffreestanding, while user ones should provide a C library.

From this standard:

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2338r3.html

```
A freestanding C implementation is required to provide the entirety of the
following headers:

<float.h>
<iso646.h>
<limits.h>
<stdalign.h>
<stdarg.h>
<stdbool.h>
<stddef.h>
<stdint.h>
<stdnoreturn.h>
Most of <string.h> is required (strdup, strndup, strcoll, strxfrm, and
strerror are excluded). This includes strtok, which requires global data.
```
Quoted 5 lines
Quoted 2 lines

Maybe for now we can just remove stdio.h from current patch, as it's not supposed to be provided in a freestanding environment.

A huge number of files under tests/tcg/ have a #include <stdio.h> currently.

They are all *-user mode tests though, which do need a proper libc.

Quoted 20 lines

In the example build failure in the commit message, we have

tests/tcg/s390x/system/../console.c

which does

  #include "../../../pc-bios/s390-ccw/sclp.c"

and sclp.c has

  #include "s390-ccw.h"

and that header has:

  #include <stdbool.h>
  #include <stddef.h>
  #include <stdint.h>
  #include <stdio.h>
Quoted 6 lines

hence the 4 headers I added to the meson check.

So AFAICT, our code is expecting stdio.h to be provided in a -ffreestanding build. Have we got a more fundamental mistake wrt our use of -ffreestanding, such that it is relying on unintended functionality ?

They shouldn't - but s390x seems to be doing something funky here. Ilya can you explain what s390x is trying to do here?

Quoted 3 lines

With regards,
Daniel

Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro
#11 lore raw

Re: [PATCH 2/9] tests/tcg: improve check for working cross compilers

Quoted 119 lines · Alex Bennée

Daniel P. Berrangé <[email protected]> writes:

(trimed cc list, add Ilya)

Quoted 85 lines · Pierrick Bouvier
Quoted 84 lines · Alex Bennée
Quoted 48 lines

From: Daniel P. Berrangé <[email protected]>

When it finds a cross compiler, tests/tcg/meson.build tries building test_cc.c to validate that the compiler works. This includes "stdint.h" as a witness for working C library, however, that is not a good choice as it can be provided by the toolchain alone:

    $ rpm -ql gcc-s390x-linux-gnu  | grep /stdint.h
    /usr/lib/gcc/s390x-linux-gnu/16/include/stdint.h

As a result, if you install the s390x GCC cross compiler, but not any C library, meson decides to use the host compiler instead of the container:

      cc for aarch64-softmmu          : aarch64-linux-gnu-gcc (from 'debian-all-test-cross' container)
      cc for loongarch64-softmmu      : loongarch64-unknown-linux-gnu-gcc (from 'debian-loongarch-cross' container)
      cc for riscv64-softmmu          : riscv64-linux-gnu-gcc (from 'debian-all-test-cross' container)
      cc for s390x-softmmu            : s390x-linux-gnu-gcc
      cc for x86_64-softmmu           : x86_64-linux-gnu-gcc (from 'debian-amd64-cross' container)

Eventually this results in failure to run 'make check':

[33/40] Generating tests/tcg/s390x-softmmu-hello with a custom command
FAILED: [code=1] tests/tcg/s390x-softmmu-hello.test
/usr/bin/s390x-linux-gnu-gcc /home/berrange/src/virt/qemu/tests/tcg/multiarch/system/hello.c -o tests/tcg/s390x-softmmu-hello.test -static -MMD -MF tests/tcg/s390x-softmmu-hello.d -Wall -Werror -O0 -g -fno-strict-aliasing -nostdlib -ffreestanding -Wa,--noexecstack -I /home/berrange/src/virt/qemu/tests/tcg/s390x/system/../../minilib /home/berrange/src/virt/qemu/tests/tcg/s390x/system/../../minilib/printf.c -I /home/berrange/src/virt/qemu/include/hw/s390x/ipl -march=z13 ../tests/tcg/s390x/system/../head64.S ../tests/tcg/s390x/system/../console.c In file included from ../tests/tcg/s390x/system/../console.c:8:
../tests/tcg/s390x/system/../../../../pc-bios/s390-ccw/sclp.c:11:10: fatal error: string.h: No such file or directory

     11 | #include <string.h>
        |          ^~~~~~~~~~

compilation terminated.

Adding more include files to the test program ensures the meson probe makes a better decision.

Fixes e5d084d622b1 (tests/tcg/meson.build: check host cross cc is working)

Message-ID: <[email protected]>

---
   tests/tcg/test_cc.c | 6 +++++-
   1 file changed, 5 insertions(+), 1 deletion(-)
tests/tcg/test_cc.c +0 -0
index d3614a01fe6..fafee055b40 100644

tests/tcg/test_cc.c line 9

Quoted 10 lines
tests/tcg/test_cc.c +5 -1
@@ -1,7 +1,11 @@
   /* SPDX-License-Identifier: GPL-2.0-or-later */
-/* Include a standard header to make sure cross compiler provides them */
+/* Use some standard headers to ensure the cross compiler provides them */
   #include <stdint.h>
+#include <string.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdio.h>
   int main(void)
   {

Ideally, we should do separate tests for system vs user tests. System ones are always compiled with -ffreestanding, while user ones should provide a C library.

From this standard:

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2338r3.html

```
A freestanding C implementation is required to provide the entirety of the
following headers:

<float.h>
<iso646.h>
<limits.h>
<stdalign.h>
<stdarg.h>
<stdbool.h>
<stddef.h>
<stdint.h>
<stdnoreturn.h>
Most of <string.h> is required (strdup, strndup, strcoll, strxfrm, and
strerror are excluded). This includes strtok, which requires global data.
```
Quoted 5 lines
Quoted 2 lines

Maybe for now we can just remove stdio.h from current patch, as it's not supposed to be provided in a freestanding environment.

A huge number of files under tests/tcg/ have a #include <stdio.h> currently.

They are all *-user mode tests though, which do need a proper libc.

Quoted 22 lines

In the example build failure in the commit message, we have

   tests/tcg/s390x/system/../console.c

which does

   #include "../../../pc-bios/s390-ccw/sclp.c"

and sclp.c has

   #include "s390-ccw.h"

and that header has:

   #include <stdbool.h>
   #include <stddef.h>
   #include <stdint.h>
   #include <stdio.h>

hence the 4 headers I added to the meson check.

Quoted 7 lines
Quoted 4 lines

So AFAICT, our code is expecting stdio.h to be provided in a -ffreestanding build. Have we got a more fundamental mistake wrt our use of -ffreestanding, such that it is relying on unintended functionality ?

They shouldn't - but s390x seems to be doing something funky here. Ilya can you explain what s390x is trying to do here?

s390x used to use SLOF headers before the meson rework.
I remember that Pierrick mentioned there were issues with checking out the SLOF submodule, but it seems to work for me.
So I've posted my version of the fix [1], please take a look.

[1] https://lore.kernel.org/qemu-devel/[email protected]/

Quoted 5 lines
Quoted 4 lines

With regards,
Daniel

#12 lore raw

Re: [PATCH 2/9] tests/tcg: improve check for working cross compilers

Quoted 147 lines · Ilya Leoshkevich
Quoted 144 lines · Alex Bennée

Daniel P. Berrangé <[email protected]> writes:

(trimed cc list, add Ilya)

Quoted 104 lines · Pierrick Bouvier
Quoted 103 lines · Alex Bennée
Quoted 72 lines

From: Daniel P. Berrangé <[email protected]>

When it finds a cross compiler, tests/tcg/meson.build tries building test_cc.c to validate that the compiler works. This includes "stdint.h" as a witness for working C library, however, that is not a good choice as it can be provided by the toolchain alone:

    $ rpm -ql gcc-s390x-linux-gnu  | grep /stdint.h
    /usr/lib/gcc/s390x-linux-gnu/16/include/stdint.h

As a result, if you install the s390x GCC cross compiler, but not any C library, meson decides to use the host compiler instead of the container:

      cc for aarch64-softmmu          : aarch64-linux-gnu-gcc (from 'debian-all-test-cross' container)
      cc for loongarch64-softmmu      : loongarch64-unknown-linux- gnu-gcc (from 'debian-loongarch-cross' container)
      cc for riscv64-softmmu          : riscv64-linux-gnu-gcc (from 'debian-all-test-cross' container)
      cc for s390x-softmmu            : s390x-linux-gnu-gcc cc for x86_64-softmmu           : x86_64-linux-gnu-gcc (from 'debian-amd64-cross' container)

Eventually this results in failure to run 'make check':

[33/40] Generating tests/tcg/s390x-softmmu-hello with a custom command
FAILED: [code=1] tests/tcg/s390x-softmmu-hello.test /usr/bin/s390x-linux-gnu-gcc /home/berrange/src/virt/qemu/tests/ tcg/multiarch/system/hello.c -o tests/tcg/s390x-softmmu-hello.test

(quoted diff) +0 -3
-static -MMD -MF tests/tcg/s390x-softmmu-hello.d -Wall -Werror -O0
-g -fno-strict-aliasing -nostdlib -ffreestanding -Wa,--noexecstack
-I /home/berrange/src/virt/qemu/tests/tcg/s390x/system/../../

minilib /home/berrange/src/virt/qemu/tests/tcg/s390x/system/../../ minilib/printf.c -I /home/berrange/src/virt/qemu/include/hw/s390x/ ipl -march=z13 ../tests/tcg/s390x/system/../head64.S ../tests/tcg/ s390x/system/../console.c
In file included from ../tests/tcg/s390x/system/../console.c:8:
../tests/tcg/s390x/system/../../../../pc-bios/s390-ccw/ sclp.c:11:10: fatal error: string.h: No such file or directory 11 | #include <string.h>
        |          ^~~~~~~~~~
compilation terminated.

Adding more include files to the test program ensures the meson probe makes a better decision.

Fixes e5d084d622b1 (tests/tcg/meson.build: check host cross cc is

working)

Message-ID: <[email protected]>

---
   tests/tcg/test_cc.c | 6 +++++-

   1 file changed, 5 insertions(+), 1 deletion(-)
tests/tcg/test_cc.c +0 -1
index d3614a01fe6..fafee055b40 100644
@@ -1,7 +1,11 @@
    /* SPDX-License-Identifier: GPL-2.0-or-later */
-/* Include a standard header to make sure cross compiler provides

them */
+/* Use some standard headers to ensure the cross compiler provides them */
   #include <stdint.h>

tests/tcg/test_cc.c +4 -0
+#include <string.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdio.h>
Quoted 2 lines

   int main(void)
   {

Ideally, we should do separate tests for system vs user tests. System ones are always compiled with -ffreestanding, while user ones should
provide a C library.

 From this standard:

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2338r3.html

```
A freestanding C implementation is required to provide the entirety
of the
following headers:

<float.h>
<iso646.h>
<limits.h>
<stdalign.h>
<stdarg.h>
<stdbool.h>
<stddef.h>
<stdint.h>
<stdnoreturn.h>
Most of <string.h> is required (strdup, strndup, strcoll, strxfrm, and
strerror are excluded). This includes strtok, which requires global
data.
```
Quoted 6 lines
Quoted 3 lines

Maybe for now we can just remove stdio.h from current patch, as it's not
supposed to be provided in a freestanding environment.

A huge number of files under tests/tcg/ have a #include <stdio.h> currently.

They are all *-user mode tests though, which do need a proper libc.

Quoted 26 lines

In the example build failure in the commit message, we have

   tests/tcg/s390x/system/../console.c

which does

   #include "../../../pc-bios/s390-ccw/sclp.c"

and sclp.c has

   #include "s390-ccw.h"

and that header has:

   #include <stdbool.h>
   #include <stddef.h>
   #include <stdint.h>
   #include <stdio.h>

hence the 4 headers I added to the meson check.

So AFAICT, our code is expecting stdio.h to be provided in a -ffreestanding build. Have we got a more fundamental mistake wrt our use of -ffreestanding, such that it is relying on unintended functionality ?

Quoted 8 lines
Quoted 2 lines

They shouldn't - but s390x seems to be doing something funky here. Ilya can you explain what s390x is trying to do here?

s390x used to use SLOF headers before the meson rework.
I remember that Pierrick mentioned there were issues with checking out the SLOF submodule, but it seems to work for me.
So I've posted my version of the fix [1], please take a look.

There is no problem to checkout SLOF submodule, but I simply thought it would be cleaner to not have tests transitively trigger a git submodule update.
If it's not a problem for anyone else except me, I'm fine with seeing it reintroduced (see further comments on your patch).

With the right test Daniel added here, we should skip host compiler, and rely on cross containers instead, which provide a libc.

Quoted 9 lines

[1] https://lore.kernel.org/qemu-devel/20260914235113.272992-1-
[email protected]/

Quoted 5 lines
Quoted 4 lines

With regards,
Daniel

Thanks,
Pierrick

#13 lore raw

PATCH 3/9 tests/tcg: prefix meson built docker tags with qemu/

In reply to Alex Bennée

With the meson changes we now build the images directly by calling docker.py. However the Makefile.include builds prefix all the images with qemu/:

  # General rule for building docker images.
  docker-image-%: $(DOCKER_FILES_DIR)/%.docker
            $(call quiet-command,			\
                  DOCKER_BUILDKIT=1 $(CONTAINER_COMMAND) build \
                  $(if $(DOCKER_V),,--quiet)		\
                  $(if $(NOCACHE),--no-cache,		\
                          $(if $(DOCKER_REGISTRY),--cache-from $(DOCKER_REGISTRY)/qemu/$*)) \
                  --build-arg BUILDKIT_INLINE_CACHE=1 	\
                  $(if $(NOUSER),,			\
                          --build-arg USER=$(USER)	\
                          --build-arg UID=$(UID))		\
                  -t qemu/$* - < $< $(if $(DOCKER_V),,> /dev/null),\
                  "BUILD", $*)

So to ensure we don't end up building every container twice make sure the naming conventions line up.

---
 tests/tcg/meson.build | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tests/tcg/meson.build +3 -3
index d41a228fb3d..0604c4b90b9 100644
@@ -255,7 +255,7 @@ foreach target, plan: tcg_tests
     image_name = 'image-' + cc_dockerfile
     has_docker = docker_host_arch_supported and docker_supported
     if cc_dockerfile not in image_targets and has_docker
-      cmd = [docker_wrapper, 'build', '-f', dockerfile, '-t', cc_dockerfile]
+      cmd = [docker_wrapper, 'build', '-f', dockerfile, '-t', 'qemu/' + cc_dockerfile]
       t = custom_target(image_name, command: cmd,
                         build_by_default: false,
                         output: 'no_output_' + image_name)
@@ -270,7 +270,7 @@ foreach target, plan: tcg_tests
       here = meson.project_build_root()
       cc = [docker_wrapper, 'run', '--run-as-current-user',
             '-w', here, '-v', mount,
-            cc_dockerfile, plan['cc']]
+            'qemu/' + cc_dockerfile, plan['cc']]
       has_cc = true
     endif
   endif
@@ -279,7 +279,7 @@ foreach target, plan: tcg_tests
   if has_cc
     summary_cc = plan['cc']
     if not cc_from_system
-      summary_cc += ' (from \'' + plan['cc_dockerfile'] + '\' container)'
+      summary_cc += ' (from \'qemu/' + plan['cc_dockerfile'] + '\' container)'
     endif
   endif
   tcg_tests_summary += {'cc for ' + target: summary_cc}
Signature · 1 line
2.47.3
Reviewed-by on v1 3/9
#14 lore raw

Re: [PATCH 3/9] tests/tcg: prefix meson built docker tags with qemu/

Quoted 18 lines · Alex Bennée

With the meson changes we now build the images directly by calling docker.py. However the Makefile.include builds prefix all the images with qemu/:

   # General rule for building docker images.
   docker-image-%: $(DOCKER_FILES_DIR)/%.docker
             $(call quiet-command,			\
                   DOCKER_BUILDKIT=1 $(CONTAINER_COMMAND) build \
                   $(if $(DOCKER_V),,--quiet)		\
                   $(if $(NOCACHE),--no-cache,		\
                           $(if $(DOCKER_REGISTRY),--cache-from $(DOCKER_REGISTRY)/qemu/$*)) \
                   --build-arg BUILDKIT_INLINE_CACHE=1 	\
                   $(if $(NOUSER),,			\
                           --build-arg USER=$(USER)	\
                           --build-arg UID=$(UID))		\
                   -t qemu/$* - < $< $(if $(DOCKER_V),,> /dev/null),\
                   "BUILD", $*)
Quoted 8 lines

So to ensure we don't end up building every container twice make sure the naming conventions line up.

---
  tests/tcg/meson.build | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
#15 lore raw

PATCH 4/9 tests/tcg: use --add-current-user when building containers

In reply to Alex Bennée

As the meson tcg build routes the container builds through docker.py we can also clean up its hack which involved appending a RUN line to the dockerfile. All the dockerfiles that care will work with the --build-arg.

---
 tests/docker/docker.py | 13 ++++++-------
 tests/tcg/meson.build  |  3 ++-
 2 files changed, 8 insertions(+), 8 deletions(-)
tests/docker/docker.py +6 -7
index 315fa2ff848..6090a9dc957 100755
@@ -297,13 +297,6 @@ def build_image(self, tag, docker_dir, dockerfile,
                                              dir=docker_dir, suffix=".docker")
         tmp_df.write(dockerfile)
 
-        if user:
-            uid = os.getuid()
-            uname = getpass.getuser()
-            tmp_df.write("\n")
-            tmp_df.write("RUN id %s 2>/dev/null || useradd -u %d -U %s" %
-                         (uname, uid, uname))
-
         tmp_df.write("\n")
         tmp_df.write("LABEL com.qemu.dockerfile-checksum=%s\n" % (checksum))
         for f, c in extra_files_cksum:
@@ -315,6 +308,12 @@ def build_image(self, tag, docker_dir, dockerfile,
         if self._buildkit:
             build_args += ["--build-arg", "BUILDKIT_INLINE_CACHE=1"]
 
+        if user:
+            uid = os.getuid()
+            uname = getpass.getuser()
+            build_args += ["--build-arg", "USER=%s" % uname,
+                           "--build-arg", "UID=%s" % uid]
+
         if registry is not None:
             pull_args = ["pull", "%s/%s" % (registry, tag)]
             self._do(pull_args, quiet=quiet)
tests/tcg/meson.build +2 -1
index 0604c4b90b9..814f2f8cd8c 100644
@@ -255,7 +255,8 @@ foreach target, plan: tcg_tests
     image_name = 'image-' + cc_dockerfile
     has_docker = docker_host_arch_supported and docker_supported
     if cc_dockerfile not in image_targets and has_docker
-      cmd = [docker_wrapper, 'build', '-f', dockerfile, '-t', 'qemu/' + cc_dockerfile]
+      cmd = [docker_wrapper, 'build', '-f', dockerfile, '-t', 'qemu/' + cc_dockerfile,
+             '--add-current-user']
       t = custom_target(image_name, command: cmd,
                         build_by_default: false,
                         output: 'no_output_' + image_name)
Signature · 1 line
2.47.3
#16 lore raw

Re: [PATCH 4/9] tests/tcg: use --add-current-user when building containers

Quoted 11 lines · Alex Bennée

As the meson tcg build routes the container builds through docker.py we can also clean up its hack which involved appending a RUN line to the dockerfile. All the dockerfiles that care will work with the --build-arg.

---
  tests/docker/docker.py | 13 ++++++-------
  tests/tcg/meson.build  |  3 ++-
  2 files changed, 8 insertions(+), 8 deletions(-)

I'm not sure why this was added in the first place.
Technically, running the container with a specific uid (whether or not a user is declared for it) is enough. The only errors you can have is if some specific commands ran expect to check if user exist on the machine, like sudo for instance. For our need (cross compilation), it's not needed, as a compiler will never check who is $USER. Files written will still have the correct uid on host fs anyway.

Do you have more info on this?

Regards,
Pierrick

#17 lore raw

Re: [PATCH 4/9] tests/tcg: use --add-current-user when building containers

Quoted 12 lines · Pierrick Bouvier
Quoted 10 lines · Alex Bennée

As the meson tcg build routes the container builds through docker.py we can also clean up its hack which involved appending a RUN line to the dockerfile. All the dockerfiles that care will work with the --build-arg.

---
  tests/docker/docker.py | 13 ++++++-------
  tests/tcg/meson.build  |  3 ++-
  2 files changed, 8 insertions(+), 8 deletions(-)
Quoted 8 lines

I'm not sure why this was added in the first place. Technically, running the container with a specific uid (whether or not a user is declared for it) is enough. The only errors you can have is if some specific commands ran expect to check if user exist on the machine, like sudo for instance.
For our need (cross compilation), it's not needed, as a compiler will never check who is $USER. Files written will still have the correct uid on host fs anyway.

That's why you do the mapping. Before I was seeing a whole bunch of the test files with a random group ownership.

Quoted 5 lines

Do you have more info on this?

Regards,
Pierrick

Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro
#18 lore raw

Re: [PATCH 4/9] tests/tcg: use --add-current-user when building containers

Quoted 23 lines · Alex Bennée
Quoted 12 lines · Pierrick Bouvier
Quoted 10 lines · Alex Bennée

As the meson tcg build routes the container builds through docker.py we can also clean up its hack which involved appending a RUN line to the dockerfile. All the dockerfiles that care will work with the --build-arg.

---
  tests/docker/docker.py | 13 ++++++-------
  tests/tcg/meson.build  |  3 ++-
  2 files changed, 8 insertions(+), 8 deletions(-)
Quoted 8 lines

I'm not sure why this was added in the first place. Technically, running the container with a specific uid (whether or not a user is declared for it) is enough. The only errors you can have is if some specific commands ran expect to check if user exist on the machine, like sudo for instance.
For our need (cross compilation), it's not needed, as a compiler will never check who is $USER. Files written will still have the correct uid on host fs anyway.

Quoted 3 lines

That's why you do the mapping. Before I was seeing a whole bunch of the test files with a random group ownership.

I was talking about the adduser part in the container themselves. Mapping users with container run -u is needed, but having a matching user is not strictly needed.

Quoted 6 lines
Quoted 5 lines

Do you have more info on this?

Regards,
Pierrick

#19 lore raw

PATCH 5/9 tests/docker: add container registry to configure and use

In reply to Alex Bennée

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.

---
 configure                     | 8 ++++++++
 meson_options.txt             | 3 +++
 tests/docker/Makefile.include | 4 +---
 tests/tcg/meson.build         | 6 ++++++
 4 files changed, 18 insertions(+), 3 deletions(-)
configure +8 -0
index aaa41fe47aa..7d6b11ddd35 100755
@@ -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=""
@@ -728,6 +729,9 @@ for opt do
   ;;
   --container-command=*) 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"
@@ -862,6 +866,7 @@ Advanced options (experts only):
   --cpu=CPU                Build for host CPU [$cpu]
   --disable-containers     don't use containers for cross-building
   --container-command=CMD  which container command to use [autodetect]
+  --container-registry=URL which container registry to cache from [$container_registry]
   --gdb=GDB-path           gdb to use for gdbstub tests [autodetect]
   --wasm64-32bit-address-limit Restrict wasm64 address space to 32-bit (default
                                is to use the whole 64-bit range).
@@ -1318,6 +1323,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
meson_options.txt +3 -0
index 292625af08a..030231492e1 100644
@@ -391,6 +391,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')
tests/docker/Makefile.include +1 -3
index 0adddb6a5c6..74bf471f171 100644
@@ -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)
tests/tcg/meson.build +6 -0
index 814f2f8cd8c..22157a47c96 100644
@@ -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)
Signature · 1 line
2.47.3
#20 lore raw

Re: [PATCH 5/9] tests/docker: add container registry to configure and use

Quoted 74 lines · Alex Bennée

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.

---
  configure                     | 8 ++++++++
  meson_options.txt             | 3 +++
  tests/docker/Makefile.include | 4 +---
  tests/tcg/meson.build         | 6 ++++++
  4 files changed, 18 insertions(+), 3 deletions(-)
configure +8 -0
index aaa41fe47aa..7d6b11ddd35 100755
@@ -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=""
@@ -728,6 +729,9 @@ for opt do
    ;;
    --container-command=*) 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"
@@ -862,6 +866,7 @@ Advanced options (experts only):
    --cpu=CPU                Build for host CPU [$cpu]
    --disable-containers     don't use containers for cross-building
    --container-command=CMD  which container command to use [autodetect]
+  --container-registry=URL which container registry to cache from [$container_registry]
    --gdb=GDB-path           gdb to use for gdbstub tests [autodetect]
    --wasm64-32bit-address-limit Restrict wasm64 address space to 32-bit (default
                                 is to use the whole 64-bit range).
@@ -1318,6 +1323,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
meson_options.txt +3 -0
index 292625af08a..030231492e1 100644
@@ -391,6 +391,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')
tests/docker/Makefile.include +0 -0
index 0adddb6a5c6..74bf471f171 100644

tests/docker/Makefile.include USER = $(if $(NOUSER),,$(shell id -un)) · line 16

Quoted 9 lines
tests/docker/Makefile.include +1 -3
@@ -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))
 

Couldn't we read the default from config_host_mak generated by configure instead?

Quoted 16 lines
tests/docker/Makefile.include +0 -0
  CONTAINER_COMMAND ?= $(shell $(SRC_PATH)/tests/docker/docker.py probe)
tests/tcg/meson.build +3 -0
index 814f2f8cd8c..22157a47c96 100644
@@ -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 = {}

tests/tcg/meson.build foreach target, plan: tcg_tests · line 268

Quoted 9 lines
tests/tcg/meson.build +3 -0
@@ -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)

Do user benefit from this, or is it mostly for CI need?

The effect is to use --cache-from $registry, which I'm not sure is what we want by default, given all the "caching issues" we had previously with dockerfiles already. If that's for CI, maybe it could simply set with --container-command in our CI only.

Regards,
Pierrick

#21 lore raw

Re: [PATCH 5/9] tests/docker: add container registry to configure and use

Quoted 100 lines · Pierrick Bouvier
Quoted 69 lines · Alex Bennée

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.

---
  configure                     | 8 ++++++++
  meson_options.txt             | 3 +++
  tests/docker/Makefile.include | 4 +---
  tests/tcg/meson.build         | 6 ++++++
  4 files changed, 18 insertions(+), 3 deletions(-)
configure +8 -0
index aaa41fe47aa..7d6b11ddd35 100755
@@ -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=""
@@ -728,6 +729,9 @@ for opt do
    ;;
    --container-command=*) 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"
@@ -862,6 +866,7 @@ Advanced options (experts only):
    --cpu=CPU                Build for host CPU [$cpu]
    --disable-containers     don't use containers for cross-building
    --container-command=CMD  which container command to use [autodetect]
+  --container-registry=URL which container registry to cache from [$container_registry]
    --gdb=GDB-path           gdb to use for gdbstub tests [autodetect]
    --wasm64-32bit-address-limit Restrict wasm64 address space to 32-bit (default
                                 is to use the whole 64-bit range).
@@ -1318,6 +1323,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
meson_options.txt +3 -0
index 292625af08a..030231492e1 100644
@@ -391,6 +391,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')
tests/docker/Makefile.include +0 -0
index 0adddb6a5c6..74bf471f171 100644

tests/docker/Makefile.include USER = $(if $(NOUSER),,$(shell id -un)) · line 15

Quoted 8 lines
tests/docker/Makefile.include +1 -3
@@ -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))
 

Couldn't we read the default from config_host_mak generated by configure instead?

Quoted 18 lines
tests/docker/Makefile.include +0 -0
  CONTAINER_COMMAND ?= $(shell $(SRC_PATH)/tests/docker/docker.py probe)
tests/tcg/meson.build +3 -0
index 814f2f8cd8c..22157a47c96 100644
@@ -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']
Quoted 8 lines

tests/tcg/meson.build foreach target, plan: tcg_tests · line 268

Quoted 6 lines
tests/tcg/meson.build +3 -0
+      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)

Do user benefit from this, or is it mostly for CI need?

The aim is for faster image builds because the CI registry should always be up to date. Most of the time the images don't change.

Quoted 9 lines

The effect is to use --cache-from $registry, which I'm not sure is what we want by default, given all the "caching issues" we had previously with dockerfiles already.
If that's for CI, maybe it could simply set with --container-command in our CI only.

Regards,
Pierrick

Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro
Reviewed-by
#22 lore raw

Re: [PATCH 5/9] tests/docker: add container registry to configure and use

Quoted 15 lines · Alex Bennée
Quoted 13 lines · Pierrick Bouvier
Quoted 5 lines · Alex Bennée

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.

Quoted 7 lines
---
  configure                     | 8 ++++++++
  meson_options.txt             | 3 +++
  tests/docker/Makefile.include | 4 +---
  tests/tcg/meson.build         | 6 ++++++
  4 files changed, 18 insertions(+), 3 deletions(-)
#23 lore raw

Re: [PATCH 5/9] tests/docker: add container registry to configure and use

In reply to Alex Bennée
Quoted 111 lines · Alex Bennée
Quoted 100 lines · Pierrick Bouvier
Quoted 69 lines · Alex Bennée

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.

---
  configure                     | 8 ++++++++
  meson_options.txt             | 3 +++
  tests/docker/Makefile.include | 4 +---
  tests/tcg/meson.build         | 6 ++++++
  4 files changed, 18 insertions(+), 3 deletions(-)
configure +8 -0
index aaa41fe47aa..7d6b11ddd35 100755
@@ -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=""
@@ -728,6 +729,9 @@ for opt do
    ;;
    --container-command=*) 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"
@@ -862,6 +866,7 @@ Advanced options (experts only):
    --cpu=CPU                Build for host CPU [$cpu]
    --disable-containers     don't use containers for cross-building
    --container-command=CMD  which container command to use [autodetect]
+  --container-registry=URL which container registry to cache from [$container_registry]
    --gdb=GDB-path           gdb to use for gdbstub tests [autodetect]
    --wasm64-32bit-address-limit Restrict wasm64 address space to 32-bit (default
                                 is to use the whole 64-bit range).
@@ -1318,6 +1323,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
meson_options.txt +3 -0
index 292625af08a..030231492e1 100644
@@ -391,6 +391,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')
tests/docker/Makefile.include +0 -0
index 0adddb6a5c6..74bf471f171 100644

tests/docker/Makefile.include USER = $(if $(NOUSER),,$(shell id -un)) · line 15

Quoted 8 lines
tests/docker/Makefile.include +1 -3
@@ -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))
 

Couldn't we read the default from config_host_mak generated by configure instead?

Quoted 18 lines
tests/docker/Makefile.include +0 -0
  CONTAINER_COMMAND ?= $(shell $(SRC_PATH)/tests/docker/docker.py probe)
tests/tcg/meson.build +3 -0
index 814f2f8cd8c..22157a47c96 100644
@@ -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']
Quoted 8 lines

tests/tcg/meson.build foreach target, plan: tcg_tests · line 268

Quoted 6 lines
tests/tcg/meson.build +3 -0
+      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)

Do user benefit from this, or is it mostly for CI need?

Quoted 3 lines

The aim is for faster image builds because the CI registry should always be up to date. Most of the time the images don't change.

Ok. In this case, you need to add --timestamp 0 (that's enough in what I tested) to original build command that generates those layers from our CI, and use it here also. Else --cache-from does not work as intended and you'll see have some duplication because timestamp is part of hash for each layer.

See this guide for more info:
https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/10/html/building_running_and_managing_containers/introduction-to-reproducible-container-builds

Quoted 10 lines
Quoted 9 lines

The effect is to use --cache-from $registry, which I'm not sure is what we want by default, given all the "caching issues" we had previously with dockerfiles already.
If that's for CI, maybe it could simply set with --container-command in our CI only.

Regards,
Pierrick

#24 lore raw

Re: [PATCH 5/9] tests/docker: add container registry to configure and use

Quoted 116 lines · Pierrick Bouvier
Quoted 111 lines · Alex Bennée
Quoted 100 lines · Pierrick Bouvier
Quoted 69 lines · Alex Bennée

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.

---
  configure                     | 8 ++++++++
  meson_options.txt             | 3 +++
  tests/docker/Makefile.include | 4 +---
  tests/tcg/meson.build         | 6 ++++++
  4 files changed, 18 insertions(+), 3 deletions(-)
configure +8 -0
index aaa41fe47aa..7d6b11ddd35 100755
@@ -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=""
@@ -728,6 +729,9 @@ for opt do
    ;;
    --container-command=*) 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"
@@ -862,6 +866,7 @@ Advanced options (experts only):
    --cpu=CPU                Build for host CPU [$cpu]
    --disable-containers     don't use containers for cross-building
    --container-command=CMD  which container command to use [autodetect]
+  --container-registry=URL which container registry to cache from [$container_registry]
    --gdb=GDB-path           gdb to use for gdbstub tests [autodetect]
    --wasm64-32bit-address-limit Restrict wasm64 address space to 32-bit (default
                                 is to use the whole 64-bit range).
@@ -1318,6 +1323,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
meson_options.txt +3 -0
index 292625af08a..030231492e1 100644
@@ -391,6 +391,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')
tests/docker/Makefile.include +0 -0
index 0adddb6a5c6..74bf471f171 100644

tests/docker/Makefile.include USER = $(if $(NOUSER),,$(shell id -un)) · line 15

Quoted 8 lines
tests/docker/Makefile.include +1 -3
@@ -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))
 

Couldn't we read the default from config_host_mak generated by configure instead?

Quoted 18 lines
tests/docker/Makefile.include +0 -0
  CONTAINER_COMMAND ?= $(shell $(SRC_PATH)/tests/docker/docker.py probe)
tests/tcg/meson.build +3 -0
index 814f2f8cd8c..22157a47c96 100644
@@ -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']
Quoted 8 lines

tests/tcg/meson.build foreach target, plan: tcg_tests · line 268

Quoted 6 lines
tests/tcg/meson.build +3 -0
+      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)

Do user benefit from this, or is it mostly for CI need?

Quoted 3 lines

The aim is for faster image builds because the CI registry should always be up to date. Most of the time the images don't change.

Quoted 8 lines

Ok. In this case, you need to add --timestamp 0 (that's enough in what I tested) to original build command that generates those layers from our CI, and use it here also. Else --cache-from does not work as intended and you'll see have some duplication because timestamp is part of hash for each layer.

See this guide for more info:
https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/10/html/building_running_and_managing_containers/introduction-to-reproducible-container-builds

Hmm is that a podman only option?

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines

The effect is to use --cache-from $registry, which I'm not sure is what we want by default, given all the "caching issues" we had previously with dockerfiles already.
If that's for CI, maybe it could simply set with --container-command in our CI only.

Regards,
Pierrick

Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro
#25 lore raw

Re: [PATCH 5/9] tests/docker: add container registry to configure and use

Quoted 124 lines · Alex Bennée
Quoted 122 lines · Pierrick Bouvier
Quoted 111 lines · Alex Bennée
Quoted 100 lines · Pierrick Bouvier
Quoted 69 lines · Alex Bennée

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.

---
  configure                     | 8 ++++++++
  meson_options.txt             | 3 +++
  tests/docker/Makefile.include | 4 +---
  tests/tcg/meson.build         | 6 ++++++
  4 files changed, 18 insertions(+), 3 deletions(-)
configure +8 -0
index aaa41fe47aa..7d6b11ddd35 100755
@@ -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=""
@@ -728,6 +729,9 @@ for opt do
    ;;
    --container-command=*) 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"
@@ -862,6 +866,7 @@ Advanced options (experts only):
    --cpu=CPU                Build for host CPU [$cpu]
    --disable-containers     don't use containers for cross-building
    --container-command=CMD  which container command to use [autodetect]
+  --container-registry=URL which container registry to cache from [$container_registry]
    --gdb=GDB-path           gdb to use for gdbstub tests [autodetect]
    --wasm64-32bit-address-limit Restrict wasm64 address space to 32-bit (default
                                 is to use the whole 64-bit range).
@@ -1318,6 +1323,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
meson_options.txt +3 -0
index 292625af08a..030231492e1 100644
@@ -391,6 +391,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')
tests/docker/Makefile.include +0 -0
index 0adddb6a5c6..74bf471f171 100644

tests/docker/Makefile.include USER = $(if $(NOUSER),,$(shell id -un)) · line 15

Quoted 8 lines
tests/docker/Makefile.include +1 -3
@@ -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))
 

Couldn't we read the default from config_host_mak generated by configure instead?

Quoted 18 lines
tests/docker/Makefile.include +0 -0
  CONTAINER_COMMAND ?= $(shell $(SRC_PATH)/tests/docker/docker.py probe)
tests/tcg/meson.build +3 -0
index 814f2f8cd8c..22157a47c96 100644
@@ -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']
Quoted 8 lines

tests/tcg/meson.build foreach target, plan: tcg_tests · line 268

Quoted 6 lines
tests/tcg/meson.build +3 -0
+      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)

Do user benefit from this, or is it mostly for CI need?

Quoted 3 lines

The aim is for faster image builds because the CI registry should always be up to date. Most of the time the images don't change.

Ok. In this case, you need to add --timestamp 0 (that's enough in what I tested) to original build command that generates those layers from our CI, and use it here also. Else --cache-from does not work as intended and you'll see have some duplication because timestamp is part of hash for each layer.

Quoted 5 lines
Quoted 2 lines

See this guide for more info:
https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/10/html/building_running_and_managing_containers/introduction-to-reproducible-container-builds

Hmm is that a podman only option?

Yes, indeed.
Portable option seems to be: --build-arg SOURCE_DATE_EPOCH=0.

You can experiment with this using a personal registry (like dockerhub).

1. Build an image with:
--cache-to myregistry --build-arg SOURCE_DATE_EPOCH=0.
2. Then purge image and all its layers.
3. Rebuild it using:
--cache-from myregistry --build-arg SOURCE_DATE_EPOCH=0. => You should observe that all layers are effectively cached.

See a concrete example here:
original build:
https://github.com/p-b-o/qemu-ci/actions/runs/34837577836/job/103954828254#step:4:3170
cached build:
https://github.com/p-b-o/qemu-ci/actions/runs/34806642832/job/103859733976#step:6:9

Disclaimer: I exclusively use podman (for years), so not sure if docker has its own idiosyncrasies on top.

Quoted 10 lines
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines

The effect is to use --cache-from $registry, which I'm not sure is what we want by default, given all the "caching issues" we had previously with dockerfiles already.
If that's for CI, maybe it could simply set with --container-command in our CI only.

Regards,
Pierrick

#26 lore raw

PATCH 6/9 tests/docker: remove used _read_qemu_dockerfile

In reply to Alex Bennée

This is no longer needed since the functionality using it was removed.

Fixes 07056db1b50 (tests/docker: remove FROM qemu/ support from docker.py)
---
 tests/docker/docker.py | 10 ----------
 1 file changed, 10 deletions(-)
tests/docker/docker.py +0 -10
index 6090a9dc957..fd0cbdfe856 100755
@@ -175,16 +175,6 @@ def _check_binfmt_misc(executable):
     return interp, True
 
 
-def _read_qemu_dockerfile(img_name):
-    # special case for Debian linux-user images
-    if img_name.startswith("debian") and img_name.endswith("user"):
-        img_name = "debian-bootstrap"
-
-    df = os.path.join(os.path.dirname(__file__), "dockerfiles",
-                      img_name + ".docker")
-    return _read_dockerfile(df)
-
-
 def _dockerfile_verify_flat(df):
     "Verify we do not include other qemu/ layers"
     for l in df.splitlines():
Signature · 1 line
2.47.3
Reviewed-by on v1 6/9
#27 lore raw

Re: [PATCH 6/9] tests/docker: remove used _read_qemu_dockerfile

Quoted 8 lines · Alex Bennée

This is no longer needed since the functionality using it was removed.

Fixes 07056db1b50 (tests/docker: remove FROM qemu/ support from docker.py)
---
  tests/docker/docker.py | 10 ----------
  1 file changed, 10 deletions(-)
#28 lore raw

PATCH 7/9 tests/docker: strip remaining caching logic from docker.py

In reply to Alex Bennée

The caching logic was a remnant of an older time when we had multiple shared layers building that went into the final image. It was arguable that it worked back then but it is definitely not needed now so into the bin it goes.

---
 tests/docker/docker.py | 148 ++++++++++++++---------------------------
 1 file changed, 49 insertions(+), 99 deletions(-)
tests/docker/docker.py +49 -99
index fd0cbdfe856..a2e97061240 100755
@@ -15,7 +15,6 @@
 import sys
 import subprocess
 import json
-import hashlib
 import atexit
 import uuid
 import argparse
@@ -27,7 +26,6 @@
 from tarfile import TarFile, TarInfo
 from io import StringIO, BytesIO
 from shutil import copy, rmtree
-from datetime import datetime, timedelta
 
 
 FILTERED_ENV_NAMES = ['ftp_proxy', 'http_proxy', 'https_proxy']
@@ -35,20 +33,9 @@
 
 DEVNULL = open(os.devnull, 'wb')
 
-def _bytes_checksum(bytes):
-    """Calculate a digest string unique to the text content"""
-    return hashlib.sha1(bytes).hexdigest()
-
-def _text_checksum(text):
-    """Calculate a digest string unique to the text content"""
-    return _bytes_checksum(text.encode('utf-8'))
-
 def _read_dockerfile(path):
     return open(path, 'rt', encoding='utf-8').read()
 
-def _file_checksum(filename):
-    return _bytes_checksum(open(filename, 'rb').read())
-
 
 def _guess_engine_command():
     """ Guess a working engine command or raise exception if not found"""
@@ -263,38 +250,15 @@ def inspect_tag(self, tag):
         except subprocess.CalledProcessError:
             return None
 
-    def get_image_creation_time(self, info):
-        return json.loads(info)[0]["Created"]
-
-    def get_image_dockerfile_checksum(self, tag):
-        resp = self.inspect_tag(tag)
-        labels = json.loads(resp)[0]["Config"].get("Labels", {})
-        return labels.get("com.qemu.dockerfile-checksum", "")
-
-    def build_image(self, tag, docker_dir, dockerfile,
-                    quiet=True, user=False, argv=None, registry=None,
-                    extra_files_cksum=[]):
+    def build_image(self, tag, docker_dir, dockerfile_path,
+                    quiet=True, user=False, argv=None, registry=None):
         if argv is None:
             argv = []
 
-        if not _dockerfile_verify_flat(dockerfile):
+        if not _dockerfile_verify_flat(_read_dockerfile(dockerfile_path)):
             return -1
 
-        checksum = _text_checksum(dockerfile)
-
-        tmp_df = tempfile.NamedTemporaryFile(mode="w+t",
-                                             encoding='utf-8',
-                                             dir=docker_dir, suffix=".docker")
-        tmp_df.write(dockerfile)
-
-        tmp_df.write("\n")
-        tmp_df.write("LABEL com.qemu.dockerfile-checksum=%s\n" % (checksum))
-        for f, c in extra_files_cksum:
-            tmp_df.write("LABEL com.qemu.%s-checksum=%s\n" % (f, c))
-
-        tmp_df.flush()
-
-        build_args = ["build", "-t", tag, "-f", tmp_df.name]
+        build_args = ["build", "-t", tag, "-f", dockerfile_path]
         if self._buildkit:
             build_args += ["--build-arg", "BUILDKIT_INLINE_CACHE=1"]
 
@@ -320,13 +284,6 @@ def update_image(self, tag, tarball, quiet=True):
 
         self._do_check(["build", "-t", tag, "-"], quiet=quiet, stdin=tarball)
 
-    def image_matches_dockerfile(self, tag, dockerfile):
-        try:
-            checksum = self.get_image_dockerfile_checksum(tag)
-        except Exception:
-            return False
-        return checksum == _text_checksum(dockerfile)
-
     def run(self, cmd, keep, quiet, as_user=False):
         label = uuid.uuid4().hex
         if not keep:
@@ -412,61 +369,54 @@ def args(self, parser):
                             help="Dockerfile name")
 
     def run(self, args, argv):
-        dockerfile = _read_dockerfile(args.dockerfile)
         tag = args.tag
 
         dkr = Docker(args.command)
-        if "--no-cache" not in argv and \
-           dkr.image_matches_dockerfile(tag, dockerfile):
-            pass
-        else:
-            # Create a docker context directory for the build
-            docker_dir = tempfile.mkdtemp(prefix="docker_build")
-
-            # Validate binfmt_misc will work
-            if args.skip_binfmt:
-                qpath = args.include_executable
-            elif args.include_executable:
-                qpath, enabled = _check_binfmt_misc(args.include_executable)
-                if not enabled:
-                    return 1
-
-            # Is there a .pre file to run in the build context?
-            docker_pre = os.path.splitext(args.dockerfile)[0]+".pre"
-            if os.path.exists(docker_pre):
-                stdout = DEVNULL if args.quiet else None
-                rc = subprocess.call(os.path.realpath(docker_pre),
-                                     cwd=docker_dir, stdout=stdout)
-                if rc == 3:
-                    print("Skip")
-                    return 0
-                elif rc != 0:
-                    print("%s exited with code %d" % (docker_pre, rc))
-                    return 1
-
-            # Copy any extra files into the Docker context. These can be
-            # included by the use of the ADD directive in the Dockerfile.
-            cksum = []
-            if args.include_executable:
-                # FIXME: there is no checksum of this executable and the linked
-                # libraries, once the image built any change of this executable
-                # or any library won't trigger another build.
-                _copy_binary_with_libs(args.include_executable,
-                                       qpath, docker_dir)
-
-            for filename in args.extra_files or []:
-                _copy_with_mkdir(filename, docker_dir)
-                cksum += [(filename, _file_checksum(filename))]
-
-            argv += ["--build-arg=" + k.lower() + "=" + v
-                     for k, v in os.environ.items()
-                     if k.lower() in FILTERED_ENV_NAMES]
-            dkr.build_image(tag, docker_dir, dockerfile,
-                            quiet=args.quiet, user=args.user,
-                            argv=argv, registry=args.registry,
-                            extra_files_cksum=cksum)
-
-            rmtree(docker_dir)
+
+        # Create a docker context directory for the build
+        docker_dir = tempfile.mkdtemp(prefix="docker_build")
+
+        # Validate binfmt_misc will work
+        if args.skip_binfmt:
+            qpath = args.include_executable
+        elif args.include_executable:
+            qpath, enabled = _check_binfmt_misc(args.include_executable)
+            if not enabled:
+                return 1
+
+        # Is there a .pre file to run in the build context?
+        docker_pre = os.path.splitext(args.dockerfile)[0]+".pre"
+        if os.path.exists(docker_pre):
+            stdout = DEVNULL if args.quiet else None
+            rc = subprocess.call(os.path.realpath(docker_pre),
+                                 cwd=docker_dir, stdout=stdout)
+            if rc == 3:
+                print("Skip")
+                return 0
+            elif rc != 0:
+                print("%s exited with code %d" % (docker_pre, rc))
+                return 1
+
+        # Copy any extra files into the Docker context. These can be
+        # included by the use of the ADD directive in the Dockerfile.
+        if args.include_executable:
+            # FIXME: there is no checksum of this executable and the linked
+            # libraries, once the image built any change of this executable
+            # or any library won't trigger another build.
+            _copy_binary_with_libs(args.include_executable,
+                                   qpath, docker_dir)
+
+        for filename in args.extra_files or []:
+            _copy_with_mkdir(filename, docker_dir)
+
+        argv += ["--build-arg=" + k.lower() + "=" + v
+                 for k, v in os.environ.items()
+                 if k.lower() in FILTERED_ENV_NAMES]
+        dkr.build_image(tag, docker_dir, args.dockerfile,
+                        quiet=args.quiet, user=args.user,
+                        argv=argv, registry=args.registry)
+
+        rmtree(docker_dir)
 
         return 0
 
Signature · 1 line
2.47.3
Reviewed-by on v1 7/9
#29 lore raw

Re: [PATCH 7/9] tests/docker: strip remaining caching logic from docker.py

Quoted 10 lines · Alex Bennée

The caching logic was a remnant of an older time when we had multiple shared layers building that went into the final image. It was arguable that it worked back then but it is definitely not needed now so into the bin it goes.

---
  tests/docker/docker.py | 148 ++++++++++++++---------------------------
  1 file changed, 49 insertions(+), 99 deletions(-)
#30 lore raw

PATCH 8/9 tests/docker: add specific command to parser

In reply to Alex Bennée

A future change will want to use additional flags which clash with docker/podman command lines. Currently they would get snarfed up by argparser. Make the pass-through commands explicit to avoid this.

---
 scripts/coverity-scan/run-coverity-scan | 2 +-
 tests/docker/docker.py                  | 5 ++++-
 tests/tcg/meson.build                   | 2 +-
 3 files changed, 6 insertions(+), 3 deletions(-)
scripts/coverity-scan/run-coverity-scan +1 -1
index 2f9ccd5e44b..0e1361606e0 100755
@@ -381,7 +381,7 @@ if [ "$DOCKER" = yes ]; then
     # Arrange for this docker run to get access to the sources with -v.
     # We pass through all the configuration from the outer script to the inner.
     export COVERITY_EMAIL COVERITY_BUILD_CMD
-    tests/docker/docker.py run -it --env COVERITY_EMAIL --env COVERITY_BUILD_CMD \
+    tests/docker/docker.py run -- -it --env COVERITY_EMAIL --env COVERITY_BUILD_CMD \
            -v "$SECRETDIR:/work" coverity-scanner \
            ./run-coverity-scan --version "$VERSION" \
            --description "$DESCRIPTION" $ARGS --tokenfile /work/token \
tests/docker/docker.py +4 -1
index a2e97061240..d7eb4cf6811 100755
@@ -336,9 +336,12 @@ def args(self, parser):
                             help="Don't remove image when command completes")
         parser.add_argument("--run-as-current-user", action="store_true",
                             help="Run container using the current user's uid")
+        parser.add_argument('cmd', nargs='*',
+                            help="""The command to run. You should precede with
+                            -- to avoid confusion about its flags""")
 
     def run(self, args, argv):
-        return Docker(args.command).run(argv, args.keep, quiet=args.quiet,
+        return Docker(args.command).run(args.cmd, args.keep, quiet=args.quiet,
                                         as_user=args.run_as_current_user)
 
 
tests/tcg/meson.build +1 -1
index 22157a47c96..57e3870ac8a 100644
@@ -275,7 +275,7 @@ foreach target, plan: tcg_tests
       mount = meson.project_source_root()
       mount = mount + ':' + mount
       here = meson.project_build_root()
-      cc = [docker_wrapper, 'run', '--run-as-current-user',
+      cc = [docker_wrapper, 'run', '--run-as-current-user', '--',
             '-w', here, '-v', mount,
             'qemu/' + cc_dockerfile, plan['cc']]
       has_cc = true
Signature · 1 line
2.47.3
Reviewed-by on v1 8/9
#31 lore raw

Re: [PATCH 8/9] tests/docker: add specific command to parser

Quoted 11 lines · Alex Bennée

A future change will want to use additional flags which clash with docker/podman command lines. Currently they would get snarfed up by argparser. Make the pass-through commands explicit to avoid this.

---
  scripts/coverity-scan/run-coverity-scan | 2 +-
  tests/docker/docker.py                  | 5 ++++-
  tests/tcg/meson.build                   | 2 +-
  3 files changed, 6 insertions(+), 3 deletions(-)
#32 lore raw

PATCH 9/9 tests/docker: swap --quiet for --verbose

In reply to Alex Bennée

Running the docker build in meson spams the output so default to quiet and make --verbose the options. If we want to expose verbosity in meson we can deal with that later.

---
 tests/docker/Makefile.include | 10 +++++-----
 tests/docker/docker.py        | 22 ++++++++++++----------
 tests/lcitool/libvirt-ci      |  2 +-
 3 files changed, 18 insertions(+), 16 deletions(-)
tests/docker/Makefile.include +5 -5
index 74bf471f171..85825d74dfb 100644
@@ -72,13 +72,13 @@ docker-binfmt-image-debian-%: $(DOCKER_FILES_DIR)/debian-bootstrap.docker
 			DEB_TYPE=$(DEB_TYPE) 					\
 			$(if $(DEB_URL),DEB_URL=$(DEB_URL),)			\
 			$(DOCKER_SCRIPT) build -t qemu/debian-$* -f $< 		\
-			$(if $(DOCKER_V),,--quiet) $(if $(NOCACHE),--no-cache) 	\
+			$(if $(DOCKER_V),--verbose) $(if $(NOCACHE),--no-cache) \
 			$(if $(NOUSER),,--add-current-user) 			\
 			$(if $(EXTRA_FILES),--extra-files $(EXTRA_FILES))	\
 			$(if $(EXECUTABLE),--include-executable=$(EXECUTABLE)), \
 			"BUILD","binfmt debian-$* (debootstrapped)"),		\
 		$(call quiet-command,						\
-			$(DOCKER_SCRIPT) check --quiet qemu/debian-$* $< || 	\
+			$(DOCKER_SCRIPT) check qemu/debian-$* $< || 		\
 			{ echo "You will need to build $(EXECUTABLE)"; exit 1;},\
 			"CHECK", "debian-$* exists"))
 
@@ -103,17 +103,17 @@ debian-toolchain-run = \
 	$(if $(NOCACHE)$(NOFETCH),					\
 		$(call quiet-command,					\
 			$(DOCKER_SCRIPT) build -t qemu/$1 -f $< 	\
-			$(if $(DOCKER_V),,--quiet) 			\
+			$(if $(DOCKER_V),--verbose) 			\
 			$(if $(NOCACHE),--no-cache)			\
 			--registry $(DOCKER_REGISTRY) --extra-files	\
 			$(DOCKER_FILES_DIR)/$1.d/build-toolchain.sh,	\
 			"BUILD", $1),				        \
 		$(call quiet-command,					\
-			$(DOCKER_SCRIPT) fetch $(if $(DOCKER_V),,--quiet) \
+			$(DOCKER_SCRIPT) fetch $(if $(DOCKER_V),--verbose) \
 				qemu/$1 $(DOCKER_REGISTRY),		\
 			"FETCH", $1)					\
 		$(call quiet-command,					\
-			$(DOCKER_SCRIPT) update $(if $(DOCKER_V),,--quiet) \
+			$(DOCKER_SCRIPT) update $(if $(DOCKER_V),--verbose) \
 				qemu/$1 				\
 				$(if $(NOUSER),,--add-current-user) 	\
 			"PREPARE", $1))
tests/docker/docker.py +12 -10
index d7eb4cf6811..10cb4cbde11 100755
@@ -312,8 +312,8 @@ class SubCommand(object):
     name = None  # Subcommand name
 
     def shared_args(self, parser):
-        parser.add_argument("--quiet", action="store_true",
-                            help="Run quietly unless an error occurred")
+        parser.add_argument("--verbose", "-v", action="store_true",
+                            help="Run verbosely (default is quiet)")
 
     def args(self, parser):
         """Setup argument parser"""
@@ -341,7 +341,8 @@ def args(self, parser):
                             -- to avoid confusion about its flags""")
 
     def run(self, args, argv):
-        return Docker(args.command).run(args.cmd, args.keep, quiet=args.quiet,
+        return Docker(args.command).run(args.cmd, args.keep,
+                                        quiet=not args.verbose,
                                         as_user=args.run_as_current_user)
 
 
@@ -390,7 +391,7 @@ def run(self, args, argv):
         # Is there a .pre file to run in the build context?
         docker_pre = os.path.splitext(args.dockerfile)[0]+".pre"
         if os.path.exists(docker_pre):
-            stdout = DEVNULL if args.quiet else None
+            stdout = None if args.verbose else DEVNULL
             rc = subprocess.call(os.path.realpath(docker_pre),
                                  cwd=docker_dir, stdout=stdout)
             if rc == 3:
@@ -416,7 +417,7 @@ def run(self, args, argv):
                  for k, v in os.environ.items()
                  if k.lower() in FILTERED_ENV_NAMES]
         dkr.build_image(tag, docker_dir, args.dockerfile,
-                        quiet=args.quiet, user=args.user,
+                        quiet=not args.verbose, user=args.user,
                         argv=argv, registry=args.registry)
 
         rmtree(docker_dir)
@@ -435,9 +436,9 @@ def args(self, parser):
 
     def run(self, args, argv):
         dkr = Docker(args.command)
-        dkr.command(cmd="pull", quiet=args.quiet,
+        dkr.command(cmd="pull", quiet=not args.verbose,
                     argv=["%s/%s" % (args.registry, args.tag)])
-        dkr.command(cmd="tag", quiet=args.quiet,
+        dkr.command(cmd="tag", quiet=not args.verbose,
                     argv=["%s/%s" % (args.registry, args.tag), args.tag])
 
 
@@ -513,7 +514,7 @@ def run(self, args, argv):
 
         # Run the build with our tarball context
         dkr = Docker(args.command)
-        dkr.update_image(args.tag, tmp, quiet=args.quiet)
+        dkr.update_image(args.tag, tmp, quiet=not args.verbose)
 
         return 0
 
@@ -532,7 +533,8 @@ class ImagesCommand(SubCommand):
     name = "images"
 
     def run(self, args, argv):
-        return Docker(args.command).command("images", argv, args.quiet)
+        return Docker(args.command).command("images", argv,
+                                            quiet=not args.verbose)
 
 
 class ProbeCommand(SubCommand):
@@ -574,7 +576,7 @@ def run(self, args, argv):
                 cmd += ["-v", "%s:%s:ro,z" % (p, p)]
         cmd += [args.image, args.cc]
         cmd += argv
-        return Docker(args.command).run(cmd, False, quiet=args.quiet,
+        return Docker(args.command).run(cmd, False, quiet=not args.verbose,
                                         as_user=True)
 
 
tests/lcitool/libvirt-ci +1 -1
index 76b5dd5b5c8..5176e136ab1 160000
@@ -1 +1 @@
-Subproject commit 76b5dd5b5c84511e2e799c2b3d6a2a9b9f6a081d
+Subproject commit 5176e136ab11e275eb9f57c3d5c80e77af6507cb
Signature · 1 line
2.47.3
#33 lore raw
In reply to Alex Bennée
Quoted 12 lines · Alex Bennée

This cleans up a few bits and pieces although doesn't totally solve the issue of an apparent stall while meson builds the docker image. However with these changes there should be no difference between the meson build and the equivalent "make docker-image-foo" invocation.

We also finally get rid of the ill-advised magic caching support in docker.py.

Please review.

Alex.

Quoted 9 lines

Alex Bennée (8):
scripts/meson-buildoptions.sh: update missing options tests/tcg: prefix meson built docker tags with qemu/ tests/tcg: use --add-current-user when building containers tests/docker: add container registry to configure and use tests/docker: remove used _read_qemu_dockerfile tests/docker: strip remaining caching logic from docker.py tests/docker: add specific command to parser tests/docker: swap --quiet for --verbose

I haven't had time to pull this into a local branch, but I don't suppose something in here fixes

Quoted 15 lines

[6/572] Generating tests/tcg/alpha-softmmu-hello with a custom command
FAILED: [code=1] tests/tcg/alpha-softmmu-hello.test /home/rth/qemu/src/tests/tcg/../docker/docker.py --command podman run --run-as-current-user -w /home/rth/qemu/bld-g -v /home/rth/qemu/src:/home/rth/qemu/src debian-all-test-cross alpha-linux-gnu-gcc /home/rth/qemu/src/tests/tcg/multiarch/system/hello.c -o tests/tcg/alpha-softmmu-hello.test -static -MMD -MF tests/tcg/alpha-softmmu-hello.d -Wall -Werror -O0 -g -fno-strict-aliasing -nostdlib -ffreestanding -Wa,--noexecstack -I /home/rth/qemu/src/tests/tcg/alpha/system/../../minilib /home/rth/qemu/src/tests/tcg/alpha/system/../../minilib/printf.c ../src/tests/tcg/alpha/system/boot.S -Wl,-T ../src/tests/tcg/alpha/system/kernel.ld -mcpu=ev6 -Wl,--no-warn-rwx-segments -lgcc
Error: workdir "/home/rth/qemu/bld-g" does not exist on container 7670fc4a955a94d801b57dc0a6f6cd13ece35536a09b40634a37a83d733af942
Traceback (most recent call last):
File "/home/rth/qemu/src/tests/tcg/../docker/docker.py", line 657, in <module>

    sys.exit(main())
             ~~~~^^
  File "/home/rth/qemu/src/tests/tcg/../docker/docker.py", line 653, in main
    return args.cmdobj.run(args, argv)
           ~~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "/home/rth/qemu/src/tests/tcg/../docker/docker.py", line 395, in run
    return Docker(args.command).run(argv, args.keep, quiet=args.quiet,
           ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                    as_user=args.run_as_current_user)
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Quoted 13 lines

File "/home/rth/qemu/src/tests/tcg/../docker/docker.py", line 353, in run
ret = self._do_check(["run", "--rm", "--label",
"com.qemu.instance.uuid=" + label] + cmd,
quiet=quiet)
File "/home/rth/qemu/src/tests/tcg/../docker/docker.py", line 230, in _do_check
return subprocess.check_call(self._command + cmd, **kwargs)
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.14/subprocess.py", line 420, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['podman', 'run', '--rm', '--label', 'com.qemu.instance.uuid=9ca55b05b3e540f7a0cda353bf6f1086', '--userns=keep-id', '-u', '1000', '-w', '/home/rth/qemu/bld-g', '-v', '/home/rth/qemu/src:/home/rth/qemu/src', 'debian-all-test-cross', 'alpha-linux-gnu-gcc', '/home/rth/qemu/src/tests/tcg/multiarch/system/hello.c', '-o', 'tests/tcg/alpha-softmmu-hello.test', '-static', '-MMD', '-MF', 'tests/tcg/alpha-softmmu-hello.d', '-Wall', '-Werror', '-O0', '-g', '-fno-strict-aliasing', '-nostdlib', '-ffreestanding', '-Wa,--noexecstack', '-I', '/home/rth/qemu/src/tests/tcg/alpha/system/../../minilib', '/home/rth/qemu/src/tests/tcg/alpha/system/../../minilib/printf.c', '../src/tests/tcg/alpha/system/boot.S', '-Wl,-T', '../src/tests/tcg/alpha/system/kernel.ld', '-mcpu=ev6', '-Wl,--no-warn-rwx-segments', '-lgcc']' returned non-zero exit status 126. filter=--filter=label=com.qemu.instance.uuid=9ca55b05b3e540f7a0cda353bf6f1086
ninja: build stopped: subcommand failed.
make: *** [Makefile:170: run-ninja] Error 1

For avoidance of doubt, this is immediately after

make docker-image-debian-all-test-cross NOCACHE=1 V=1

r~

#34 lore raw
Quoted 18 lines · Richard Henderson
Quoted 9 lines · Alex Bennée

This cleans up a few bits and pieces although doesn't totally solve the issue of an apparent stall while meson builds the docker image. However with these changes there should be no difference between the meson build and the equivalent "make docker-image-foo" invocation. We also finally get rid of the ill-advised magic caching support in docker.py.
Please review.
Alex.
Alex Bennée (8):

Quoted 8 lines

scripts/meson-buildoptions.sh: update missing options tests/tcg: prefix meson built docker tags with qemu/ tests/tcg: use --add-current-user when building containers tests/docker: add container registry to configure and use tests/docker: remove used _read_qemu_dockerfile tests/docker: strip remaining caching logic from docker.py tests/docker: add specific command to parser tests/docker: swap --quiet for --verbose

Quoted 7 lines

I haven't had time to pull this into a local branch, but I don't suppose something in here fixes

Quoted 4 lines

[6/572] Generating tests/tcg/alpha-softmmu-hello with a custom command
FAILED: [code=1] tests/tcg/alpha-softmmu-hello.test /home/rth/qemu/src/tests/tcg/../docker/docker.py --command podman run --run-as-current-user -w /home/rth/qemu/bld-g -v

yes - the -v is missing it's args which is fixed by the argparse patch before I switched --quiet and --verbose which exposed the latent bug.

Quoted 44 lines
Quoted 24 lines

/home/rth/qemu/src:/home/rth/qemu/src debian-all-test-cross
alpha-linux-gnu-gcc
/home/rth/qemu/src/tests/tcg/multiarch/system/hello.c -o
tests/tcg/alpha-softmmu-hello.test -static -MMD -MF
tests/tcg/alpha-softmmu-hello.d -Wall -Werror -O0 -g
-fno-strict-aliasing -nostdlib -ffreestanding -Wa,--noexecstack -I /home/rth/qemu/src/tests/tcg/alpha/system/../../minilib /home/rth/qemu/src/tests/tcg/alpha/system/../../minilib/printf.c
../src/tests/tcg/alpha/system/boot.S -Wl,-T
../src/tests/tcg/alpha/system/kernel.ld -mcpu=ev6
-Wl,--no-warn-rwx-segments -lgcc
Error: workdir "/home/rth/qemu/bld-g" does not exist on container 7670fc4a955a94d801b57dc0a6f6cd13ece35536a09b40634a37a83d733af942 Traceback (most recent call last):
File "/home/rth/qemu/src/tests/tcg/../docker/docker.py", line 657, in <module>

    sys.exit(main())
             ~~~~^^
  File "/home/rth/qemu/src/tests/tcg/../docker/docker.py", line 653, in main
    return args.cmdobj.run(args, argv)
           ~~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "/home/rth/qemu/src/tests/tcg/../docker/docker.py", line 395, in run
    return Docker(args.command).run(argv, args.keep, quiet=args.quiet,
           ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                    as_user=args.run_as_current_user)
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Quoted 13 lines

File "/home/rth/qemu/src/tests/tcg/../docker/docker.py", line 353, in run
ret = self._do_check(["run", "--rm", "--label",
"com.qemu.instance.uuid=" + label] + cmd,
quiet=quiet)
File "/home/rth/qemu/src/tests/tcg/../docker/docker.py", line 230, in _do_check
return subprocess.check_call(self._command + cmd, **kwargs)
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.14/subprocess.py", line 420, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['podman', 'run', '--rm', '--label', 'com.qemu.instance.uuid=9ca55b05b3e540f7a0cda353bf6f1086', '--userns=keep-id', '-u', '1000', '-w', '/home/rth/qemu/bld-g', '-v', '/home/rth/qemu/src:/home/rth/qemu/src', 'debian-all-test-cross', 'alpha-linux-gnu-gcc', '/home/rth/qemu/src/tests/tcg/multiarch/system/hello.c', '-o', 'tests/tcg/alpha-softmmu-hello.test', '-static', '-MMD', '-MF', 'tests/tcg/alpha-softmmu-hello.d', '-Wall', '-Werror', '-O0', '-g', '-fno-strict-aliasing', '-nostdlib', '-ffreestanding', '-Wa,--noexecstack', '-I', '/home/rth/qemu/src/tests/tcg/alpha/system/../../minilib', '/home/rth/qemu/src/tests/tcg/alpha/system/../../minilib/printf.c', '../src/tests/tcg/alpha/system/boot.S', '-Wl,-T', '../src/tests/tcg/alpha/system/kernel.ld', '-mcpu=ev6', '-Wl,--no-warn-rwx-segments', '-lgcc']' returned non-zero exit status 126. filter=--filter=label=com.qemu.instance.uuid=9ca55b05b3e540f7a0cda353bf6f1086
ninja: build stopped: subcommand failed.
make: *** [Makefile:170: run-ninja] Error 1

For avoidance of doubt, this is immediately after

make docker-image-debian-all-test-cross NOCACHE=1 V=1

r~

Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro
#35 lore raw
In reply to Alex Bennée
Quoted 12 lines · Alex Bennée

This cleans up a few bits and pieces although doesn't totally solve the issue of an apparent stall while meson builds the docker image. However with these changes there should be no difference between the meson build and the equivalent "make docker-image-foo" invocation.

We also finally get rid of the ill-advised magic caching support in docker.py.

Please review.

Alex.

Quoted 9 lines

Alex Bennée (8):
scripts/meson-buildoptions.sh: update missing options tests/tcg: prefix meson built docker tags with qemu/ tests/tcg: use --add-current-user when building containers tests/docker: add container registry to configure and use tests/docker: remove used _read_qemu_dockerfile tests/docker: strip remaining caching logic from docker.py tests/docker: add specific command to parser tests/docker: swap --quiet for --verbose

Something in here breaks things badly:

$ make
/home/rth/qemu/bld/pyvenv/bin/meson introspect --buildoptions /home/rth/qemu/src/meson.build | /home/rth/qemu/bld/pyvenv/bin/python3 -B \
  scripts/meson-buildoptions.py > 
/home/rth/qemu/src/scripts/meson-buildoptions.sh.tmp && mv /home/rth/qemu/src/scripts/meson-buildoptions.sh.tmp /home/rth/qemu/src/scripts/meson-buildoptions.sh
Failure in scripts/meson-buildoptions.py parsing stdin as json

../src/meson.build:96:12: ERROR: Unknown compiler(s): [['rustc']] The following exception(s) were encountered:
Running rustc --version gave "[Errno 2] No such file or directory: 'rustc'"

make: *** [Makefile:134: /home/rth/qemu/src/scripts/meson-buildoptions.sh] Error 1

r~

#36 lore raw
Quoted 31 lines · Richard Henderson
Quoted 9 lines · Alex Bennée

This cleans up a few bits and pieces although doesn't totally solve the issue of an apparent stall while meson builds the docker image. However with these changes there should be no difference between the meson build and the equivalent "make docker-image-foo" invocation. We also finally get rid of the ill-advised magic caching support in docker.py.
Please review.
Alex.
Alex Bennée (8):

Quoted 8 lines

scripts/meson-buildoptions.sh: update missing options tests/tcg: prefix meson built docker tags with qemu/ tests/tcg: use --add-current-user when building containers tests/docker: add container registry to configure and use tests/docker: remove used _read_qemu_dockerfile tests/docker: strip remaining caching logic from docker.py tests/docker: add specific command to parser tests/docker: swap --quiet for --verbose

Something in here breaks things badly:

$ make
/home/rth/qemu/bld/pyvenv/bin/meson introspect --buildoptions
/home/rth/qemu/src/meson.build | /home/rth/qemu/bld/pyvenv/bin/python3
-B \
  scripts/meson-buildoptions.py >
  /home/rth/qemu/src/scripts/meson-buildoptions.sh.tmp && mv
  /home/rth/qemu/src/scripts/meson-buildoptions.sh.tmp
  /home/rth/qemu/src/scripts/meson-buildoptions.sh
Failure in scripts/meson-buildoptions.py parsing stdin as json
Quoted 7 lines

../src/meson.build:96:12: ERROR: Unknown compiler(s): [['rustc']] The following exception(s) were encountered:
Running rustc --version gave "[Errno 2] No such file or directory:
'rustc'"

make: *** [Makefile:134:
/home/rth/qemu/src/scripts/meson-buildoptions.sh] Error 1

I think this goes away with a clean reconfigure to trigger a newer meson.

Quoted 3 lines

r~

Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro