Skip to contentSkip to conversation

testing/next (configure, RUNC, win32|64)

PATCH Superseded Alex Bennée 3 participants 13 messages Oct 13, 2022 – Oct 18, 2022

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover testing/next (configure, RUNC, win32|64)

Hi,

OK back to hopefully a less hectic set of testing updates. This includes a number of patches from the last iteration and also an attempt to avoid using docker.py for the builds and instead call the container engine directly.

I've actually pushed the results of:

make docker-image-debian-hexagon-cross V=1 NOCACHE=1 NOUSER=1
docker tag qemu/debian-hexagon-cross:latest registry.gitlab.com/qemu-project/qemu/qemu/debian-hexagon-cross docker push registry.gitlab.com/qemu-project/qemu/qemu/debian-hexagon-cross

but sadly the build attempts to regenerate the container locally (rather than caching all the steps except the last).

Please review.

Alex Bennée (6):
tests/docker: update fedora-win[32|64]-cross with lcitool tests/docker: update test-mingw to run single build
configure: don't enable cross compilers unless in target_list
configure: fix the --enable-static --disable-pie case
configure: expose the direct container command tests/docker: use direct RUNC call in debian-toolchain

Anton Johansson (1):
tests/docker: Add flex/bison to debian-all-test

 configure                                     |  13 +-
 tests/docker/Makefile.include                 |  38 +--
 tests/docker/dockerfiles/alpine.docker        |   2 +-
 tests/docker/dockerfiles/centos8.docker       |   2 +-
 .../dockerfiles/debian-all-test-cross.docker  |   2 +
 .../dockerfiles/debian-amd64-cross.docker     | 234 ++++++++---------
 tests/docker/dockerfiles/debian-amd64.docker  | 236 +++++++++---------
 .../dockerfiles/debian-arm64-cross.docker     | 232 ++++++++---------
 .../dockerfiles/debian-armel-cross.docker     | 230 ++++++++---------
 .../dockerfiles/debian-armhf-cross.docker     | 232 ++++++++---------
 .../dockerfiles/debian-hexagon-cross.docker   |   5 +
 .../dockerfiles/debian-mips64el-cross.docker  | 226 ++++++++---------
 .../dockerfiles/debian-mipsel-cross.docker    | 226 ++++++++---------
 .../dockerfiles/debian-ppc64el-cross.docker   | 230 ++++++++---------
 .../dockerfiles/debian-s390x-cross.docker     | 228 ++++++++---------
 .../dockerfiles/debian-toolchain.docker       |   5 +
 .../dockerfiles/fedora-win32-cross.docker     | 139 ++++++++---
 .../dockerfiles/fedora-win64-cross.docker     | 138 +++++++---
 tests/docker/dockerfiles/fedora.docker        | 230 ++++++++---------
 tests/docker/dockerfiles/opensuse-leap.docker |   2 +-
 tests/docker/dockerfiles/ubuntu2004.docker    | 234 ++++++++---------
 tests/docker/test-mingw                       |  16 +-
 tests/lcitool/libvirt-ci                      |   2 +-
 tests/lcitool/refresh                         |  48 ++--
 24 files changed, 1549 insertions(+), 1401 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/7 tests/docker: update fedora-win[32|64]-cross with lcitool

Convert another two dockerfiles to lcitool and update. I renamed the helper because it is not Debian specific. We need an updated lcitool for this to deal with the weirdness of a 32bit nsis tool for both 32 and 64 bit builds. As a result there are some minor whitespace and re-order changes in a bunch of the docker files.

Message-Id: <[email protected]>

---
 tests/docker/dockerfiles/alpine.docker        |   2 +-
 tests/docker/dockerfiles/centos8.docker       |   2 +-
 .../dockerfiles/debian-amd64-cross.docker     | 234 ++++++++---------
 tests/docker/dockerfiles/debian-amd64.docker  | 236 +++++++++---------
 .../dockerfiles/debian-arm64-cross.docker     | 232 ++++++++---------
 .../dockerfiles/debian-armel-cross.docker     | 230 ++++++++---------
 .../dockerfiles/debian-armhf-cross.docker     | 232 ++++++++---------
 .../dockerfiles/debian-mips64el-cross.docker  | 226 ++++++++---------
 .../dockerfiles/debian-mipsel-cross.docker    | 226 ++++++++---------
 .../dockerfiles/debian-ppc64el-cross.docker   | 230 ++++++++---------
 .../dockerfiles/debian-s390x-cross.docker     | 228 ++++++++---------
 .../dockerfiles/fedora-win32-cross.docker     | 139 ++++++++---
 .../dockerfiles/fedora-win64-cross.docker     | 138 +++++++---
 tests/docker/dockerfiles/fedora.docker        | 230 ++++++++---------
 tests/docker/dockerfiles/opensuse-leap.docker |   2 +-
 tests/docker/dockerfiles/ubuntu2004.docker    | 234 ++++++++---------
 tests/lcitool/libvirt-ci                      |   2 +-
 tests/lcitool/refresh                         |  48 ++--
 18 files changed, 1499 insertions(+), 1372 deletions(-)
tests/docker/dockerfiles/alpine.docker +1 -1
index 9b7541261a..a854ae6b78 100644
@@ -119,8 +119,8 @@ RUN apk update && \
     ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/g++ && \
     ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc
 
+ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers"
 ENV LANG "en_US.UTF-8"
 ENV MAKE "/usr/bin/make"
 ENV NINJA "/usr/bin/ninja"
 ENV PYTHON "/usr/bin/python3"
-ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers"
tests/docker/dockerfiles/centos8.docker +1 -1
index d89113c0df..1f70d41aeb 100644
@@ -130,8 +130,8 @@ RUN dnf distro-sync -y && \
     ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/g++ && \
     ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc
 
+ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers"
 ENV LANG "en_US.UTF-8"
 ENV MAKE "/usr/bin/make"
 ENV NINJA "/usr/bin/ninja"
 ENV PYTHON "/usr/bin/python3"
-ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers"
tests/docker/dockerfiles/debian-amd64-cross.docker +117 -117

255 lines not on this page · raw message

tests/docker/dockerfiles/debian-amd64.docker +118 -118

252 lines not on this page · raw message

tests/docker/dockerfiles/debian-arm64-cross.docker +116 -116

253 lines not on this page · raw message

tests/docker/dockerfiles/debian-armel-cross.docker +115 -115

251 lines not on this page · raw message

tests/docker/dockerfiles/debian-armhf-cross.docker +116 -116

253 lines not on this page · raw message

tests/docker/dockerfiles/debian-mips64el-cross.docker +113 -113

247 lines not on this page · raw message

tests/docker/dockerfiles/debian-mipsel-cross.docker +113 -113

247 lines not on this page · raw message

tests/docker/dockerfiles/debian-ppc64el-cross.docker +115 -115

251 lines not on this page · raw message

tests/docker/dockerfiles/debian-s390x-cross.docker +114 -114

249 lines not on this page · raw message

tests/docker/dockerfiles/fedora-win32-cross.docker +98 -41

144 lines not on this page · raw message

tests/docker/dockerfiles/fedora-win64-cross.docker +99 -39

142 lines not on this page · raw message

tests/docker/dockerfiles/fedora.docker +115 -115

243 lines not on this page · raw message

tests/docker/dockerfiles/opensuse-leap.docker +1 -1
index d80064756f..361979d6b3 100644
@@ -132,8 +132,8 @@ RUN zypper update -y && \
 
 RUN /usr/bin/pip3 install meson==0.56.0
 
+ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers"
 ENV LANG "en_US.UTF-8"
 ENV MAKE "/usr/bin/make"
 ENV NINJA "/usr/bin/ninja"
 ENV PYTHON "/usr/bin/python3"
-ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers"
tests/docker/dockerfiles/ubuntu2004.docker +117 -117

186 lines not on this page · raw message

tests/lcitool/libvirt-ci +1 -1
index e3712b7912..a2633997ff 160000

Lines of this file are not shown. View the raw message.

tests/lcitool/refresh +29 -19

48 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.34.1

Part of the diff is not shown here. View the raw message.

#2 lore raw

PATCH v2 2/7 tests/docker: update test-mingw to run single build

In reply to Alex Bennée

While the test-build test happily run for mingw the test-mingw case runs more of the packaging inline with what our CI does. It however fails if we don't find both compilers and expects to be run on a docker image with both.

Remove that distinction and make it work more like the other build test scripts.

---
 tests/docker/test-mingw | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)
tests/docker/test-mingw +6 -10
index 0bc6d78872..18366972eb 100755
@@ -13,14 +13,12 @@
 
 . common.rc
 
-requires_binary x86_64-w64-mingw32-gcc
-requires_binary i686-w64-mingw32-gcc
+requires_binary x86_64-w64-mingw32-gcc i686-w64-mingw32-gcc
 
 cd "$BUILD_DIR"
 
-for prefix in x86_64-w64-mingw32- i686-w64-mingw32-; do
-    TARGET_LIST=${TARGET_LIST:-$DEF_TARGET_LIST} \
-        build_qemu --cross-prefix=$prefix \
+TARGET_LIST=${TARGET_LIST:-$DEF_TARGET_LIST} \
+build_qemu \
         --enable-trace-backends=simple \
         --enable-gnutls \
         --enable-nettle \
@@ -29,8 +27,6 @@ for prefix in x86_64-w64-mingw32- i686-w64-mingw32-; do
         --enable-bzip2 \
         --enable-guest-agent \
         --enable-docs
-    install_qemu
-    make installer
-    make clean
-
-done
+install_qemu
+make installer
+make clean
Signature · 1 line
2.34.1
Reviewed-by on v2 2/7
#3 lore raw

Re: [PATCH v2 2/7] tests/docker: update test-mingw to run single build

Quoted 5 lines · Alex Bennée

While the test-build test happily run for mingw the test-mingw case runs more of the packaging inline with what our CI does. It however fails if we don't find both compilers and expects to be run on a docker image with both.

Quoted 7 lines

Remove that distinction and make it work more like the other build test scripts.

---
  tests/docker/test-mingw | 16 ++++++----------
  1 file changed, 6 insertions(+), 10 deletions(-)
#4 lore raw

PATCH v2 3/7 tests/docker: Add flex/bison to `debian-all-test`

In reply to Alex Bennée

From: Anton Johansson <[email protected]>

Adds flex/bison to the debian-all-test-cross container which was missed in the previous CI patch. These dependencies are required by the idef-parser patchset for target/hexagon.

Message-Id: <[email protected]>

---
 tests/docker/dockerfiles/debian-all-test-cross.docker | 2 ++
 1 file changed, 2 insertions(+)
tests/docker/dockerfiles/debian-all-test-cross.docker +2 -0
index 2beb077fb4..8dc5e1b5de 100644
@@ -20,8 +20,10 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
 # Add extra build tools and as many cross compilers as we can for testing
 RUN DEBIAN_FRONTEND=noninteractive eatmydata \
         apt install -y --no-install-recommends \
+        bison \
         ccache \
         clang  \
+        flex \
         git \
         ninja-build \
         gcc-aarch64-linux-gnu \
Signature · 1 line
2.34.1
#5 lore raw

PATCH v2 4/7 configure: don't enable cross compilers unless in target_list

In reply to Alex Bennée

This avoids the unfortunate effect of always builds the pc-bios blobs for targets the user isn't interested in.

---
 configure | 5 +++++
 1 file changed, 5 insertions(+)
configure +5 -0
index 45ee6f4eb3..246651f25d 100755
@@ -1866,6 +1866,11 @@ probe_target_compiler() {
   container_cross_ranlib=
   container_cross_strip=
 
+  case " $target_list " in
+    " $1 ") ;;
+    *) return 1 ;;
+  esac
+
   target_arch=${1%%-*}
   case $target_arch in
     aarch64) container_hosts="x86_64 aarch64" ;;
Signature · 1 line
2.34.1
#6 lore raw

Re: [PATCH v2 4/7] configure: don't enable cross compilers unless in target_list

Quoted 14 lines · Alex Bennée

This avoids the unfortunate effect of always builds the pc-bios blobs for targets the user isn't interested in.

---
 configure | 5 +++++
 1 file changed, 5 insertions(+)
configure +0 -0
index 45ee6f4eb3..246651f25d 100755

configure probe_target_compiler() { · line 1873

Quoted 8 lines
configure +5 -0
@@ -1866,6 +1866,11 @@ probe_target_compiler() {
   container_cross_ranlib=
   container_cross_strip=
 
+  case " $target_list " in
+    " $1 ") ;;
+    *) return 1 ;;
+  esac
+

this of course prevents building of roms by actually disabling all target compilers...

Quoted 3 lines
configure +0 -0
   target_arch=${1%%-*}
   case $target_arch in
     aarch64) container_hosts="x86_64 aarch64" ;;
Signature · 1 line
Alex Bennée
#7 lore raw

Re: [PATCH v2 4/7] configure: don't enable cross compilers unless in target_list

Quoted 7 lines · Alex Bennée

configure probe_target_compiler() { · line 1873

Quoted 5 lines
configure +5 -0
+  case " $target_list " in
+    " $1 ") ;;
+    *) return 1 ;;
+  esac
+

this of course prevents building of roms by actually disabling all target compilers...

Yeah, two asterisks are missing. I'll send out a proper patch.

Paolo

#8 lore raw

Re: [PATCH v2 4/7] configure: don't enable cross compilers unless in target_list

Quoted 10 lines · Paolo Bonzini
Quoted 7 lines · Alex Bennée

configure probe_target_compiler() { · line 1873

Quoted 5 lines
configure +5 -0
+  case " $target_list " in
+    " $1 ") ;;
+    *) return 1 ;;
+  esac
+

this of course prevents building of roms by actually disabling all target compilers...

Yeah, two asterisks are missing. I'll send out a proper patch.

I tried this:

@@ -1866,6 +1866,15 @@ probe_target_compiler() {
container_cross_ranlib=
container_cross_strip=

+  # We shall skip configuring the target compiler if the user didn't
+  # bother enabling an appropriate guest. This avoids building
+  # extraneous firmware images and tests.
+  if test "${target_list#*$1}" != "$1"; then

+ break;
+ else
+ return 1
+ fi
+
target_arch=${1%%-*}
case $target_arch in

     aarch64) container_hosts="x86_64 aarch64" ;;
Quoted 2 lines

Paolo

Signature · 1 line
Alex Bennée
#9 lore raw

Re: [PATCH v2 4/7] configure: don't enable cross compilers unless in target_list

Quoted 6 lines · Alex Bennée
(quoted diff) +2 -0
@@ -1866,6 +1866,15 @@ probe_target_compiler() {
    container_cross_ranlib=
    container_cross_strip=
 
+  # We shall skip configuring the target compiler if the user didn't
+  # bother enabling an appropriate guest. This avoids building

Review probe_target_compiler() { · line 1880

Quoted 10 lines
(quoted diff) +7 -0
+  # extraneous firmware images and tests.
+  if test "${target_list#*$1}" != "$1"; then
+      break;
+  else
+      return 1
+  fi
+
    target_arch=${1%%-*}
    case $target_arch in
      aarch64) container_hosts="x86_64 aarch64" ;;

There's another problem with i386-softmmu/x86_64-softmmu using the same firmware (PPC too). See "[PATCH] configure: don't enable firmware for targets that are not built".

Paolo

#10 lore raw

PATCH v2 5/7 configure: fix the --enable-static --disable-pie case

In reply to Alex Bennée

The previous tweak was incomplete as it missed a leg.

Fixes abafb64b6d (configure: explicitly set cflags for --disable-pie)
---
 configure | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
configure +3 -2
index 246651f25d..bab4e6df9f 100755
@@ -1327,6 +1327,8 @@ static THREAD int tls_var;
 int main(void) { return tls_var; }
 EOF
 
+# Meson currently only handles pie as a boolean for now so if we have
+# explicitly disabled PIE we need to extend our cflags because it wont.
 if test "$static" = "yes"; then
   if test "$pie" != "no" && compile_prog "-Werror -fPIE -DPIE" "-static-pie"; then
     CONFIGURE_CFLAGS="-fPIE -DPIE $CONFIGURE_CFLAGS"
@@ -1335,13 +1337,12 @@ if test "$static" = "yes"; then
     error_exit "-static-pie not available due to missing toolchain support"
   else
     pie="no"
+    QEMU_CFLAGS="-fno-pie -no-pie $QEMU_CFLAGS"
   fi
 elif test "$pie" = "no"; then
   if compile_prog "-Werror -fno-pie" "-no-pie"; then
     CONFIGURE_CFLAGS="-fno-pie $CONFIGURE_CFLAGS"
     CONFIGURE_LDFLAGS="-no-pie $CONFIGURE_LDFLAGS"
-    # Meson currently only handles pie as a boolean for now so if we have
-    # explicitly disabled PIE we need to extend our cflags because it wont.
     QEMU_CFLAGS="-fno-pie -no-pie $QEMU_CFLAGS"
   fi
 elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then
Signature · 1 line
2.34.1
#11 lore raw

PATCH v2 6/7 configure: expose the direct container command

In reply to Alex Bennée

In the process of migrating away from using docker.py to build our containers we need to expose the command to the build environment. The script is still a useful way to probe which command works though.

---
 configure | 3 +++
 1 file changed, 3 insertions(+)
configure +3 -0
index bab4e6df9f..edac4f3577 100755
@@ -1779,6 +1779,7 @@ fi
 # functions to probe cross compilers
 
 container="no"
+runc=""
 if test $use_containers = "yes"; then
     case $($python "$source_path"/tests/docker/docker.py probe) in
         *docker) container=docker ;;
@@ -1787,6 +1788,7 @@ if test $use_containers = "yes"; then
     esac
     if test "$container" != "no"; then
         docker_py="$python $source_path/tests/docker/docker.py --engine $container"
+        runc=$($python "$source_path"/tests/docker/docker.py probe)
     fi
 fi
 
@@ -2386,6 +2388,7 @@ fi
 
 if test "$container" != no; then
     echo "ENGINE=$container" >> $config_host_mak
+    echo "RUNC=$runc" >> $config_host_mak
 fi
 echo "ROMS=$roms" >> $config_host_mak
 echo "MAKE=$make" >> $config_host_mak
Signature · 1 line
2.34.1
#12 lore raw

PATCH v2 7/7 tests/docker: use direct RUNC call in debian-toolchain

In reply to Alex Bennée

We don't really need stuff from docker.py to do the build as we have everything we need with a direct call. We do need to tweak the dockerfiles so we can redo the UID/name mapping as the last step.

---
 tests/docker/Makefile.include                 | 38 ++++++++++---------
 .../dockerfiles/debian-hexagon-cross.docker   |  5 +++
 .../dockerfiles/debian-toolchain.docker       |  5 +++
 3 files changed, 31 insertions(+), 17 deletions(-)
tests/docker/Makefile.include +21 -17
index c87f14477a..c34b3d1340 100644
@@ -7,6 +7,8 @@ SPACE := $(NULL) #
 COMMA := ,
 
 HOST_ARCH = $(if $(ARCH),$(ARCH),$(shell uname -m))
+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)
@@ -90,23 +92,25 @@ docker-image-debian-native: DOCKER_REGISTRY=
 # alpine has no adduser
 docker-image-alpine: NOUSER=1
 
-debian-toolchain-run = \
-	$(if $(NOCACHE), 						\
-		$(call quiet-command,					\
-			$(DOCKER_SCRIPT) build -t qemu/$1 -f $< 	\
-			$(if $V,,--quiet) --no-cache 			\
-			--registry $(DOCKER_REGISTRY) --extra-files	\
-			$(DOCKER_FILES_DIR)/$1.d/build-toolchain.sh,	\
-			"BUILD", $1),				        \
-		$(call quiet-command,					\
-			$(DOCKER_SCRIPT) fetch $(if $V,,--quiet)	\
-				qemu/$1 $(DOCKER_REGISTRY),		\
-			"FETCH", $1)					\
-		$(call quiet-command,					\
-			$(DOCKER_SCRIPT) update $(if $V,,--quiet) 	\
-				qemu/$1 				\
-				$(if $(NOUSER),,--add-current-user) 	\
-			"PREPARE", $1))
+debian-toolchain-run = 					\
+	$(call quiet-command,           	        \
+		$(RUNC) pull                            \
+                $(if $V,,--quiet)                       \
+                $(DOCKER_REGISTRY)/qemu/$1,             \
+                "FETCH", $1);				\
+         $(call quiet-command,                          \
+                $(RUNC) build                           \
+		$(if $V,,--quiet)                       \
+		$(if $(NOCACHE),--no-cache)		\
+		$(if $(NOUSER),,			\
+			--build-arg USER=$(USER)	\
+			--build-arg UID=$(UID))		\
+		-t qemu/$1                              \
+                -f -                                    \
+                $(DOCKER_FILES_DIR)/$1.d                \
+                <  $<,                                  \
+                "BUILD", $1)
+
 debian-toolchain = $(call debian-toolchain-run,$(patsubst docker-image-%,%,$1))
 
 docker-image-debian-hexagon-cross: $(DOCKER_FILES_DIR)/debian-hexagon-cross.docker \
tests/docker/dockerfiles/debian-hexagon-cross.docker +5 -0
index 8d219bb81d..13fab3032a 100644
@@ -48,3 +48,8 @@ RUN apt update && \
     apt build-dep -yy --arch-only qemu
 COPY --from=0 /usr/local /usr/local
 ENV PATH $PATH:/usr/local/bin/
+
+# As a final step configure the user (if env is defined)
+ARG USER
+ARG UID
+RUN if [ "${USER}" ]; then id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi
tests/docker/dockerfiles/debian-toolchain.docker +5 -0
index d3d4d3344e..85e88f1ebb 100644
@@ -35,3 +35,8 @@ RUN cd /root && ./build-toolchain.sh
 # then copying the built toolchain from stage 0.
 FROM docker.io/library/debian:bullseye-slim
 COPY --from=0 /usr/local /usr/local
+
+# As a final step configure the user (if env is defined)
+ARG USER
+ARG UID
+RUN if [ "${USER}" ]; then id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi
Signature · 1 line
2.34.1