diff mbox series

[RFC,1/3] tests/docker: gcc-10 based images for ppc64{, le} tests

Message ID 20210415214138.563795-2-matheus.ferst@eldorado.org.br (mailing list archive)
State New, archived
Headers show
Series tests/tcg/ppc64le: paddi tests | expand

Commit Message

Matheus K. Ferst April 15, 2021, 9:41 p.m. UTC
From: Matheus Ferst <matheus.ferst@eldorado.org.br>

A newer compiler is needed to build tests for Power10 instructions. As
done for arm64 on c729a99d2701, new '-test-cross' images are created for
ppc64 and ppc64le. As done on 936fda4d771f, a test for compiler support
is added to verify that the toolchain in use has '-mpower10'.

Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br>
---
 tests/docker/Makefile.include                   |  4 ++++
 .../dockerfiles/debian-ppc64-test-cross.docker  | 13 +++++++++++++
 .../debian-ppc64el-test-cross.docker            | 17 +++++++++++++++++
 tests/tcg/configure.sh                          | 12 ++++++++----
 4 files changed, 42 insertions(+), 4 deletions(-)
 create mode 100644 tests/docker/dockerfiles/debian-ppc64-test-cross.docker
 create mode 100644 tests/docker/dockerfiles/debian-ppc64el-test-cross.docker

Comments

David Gibson April 16, 2021, 3:58 a.m. UTC | #1
On Thu, Apr 15, 2021 at 06:41:36PM -0300, matheus.ferst@eldorado.org.br wrote:
> From: Matheus Ferst <matheus.ferst@eldorado.org.br>
> 
> A newer compiler is needed to build tests for Power10 instructions. As
> done for arm64 on c729a99d2701, new '-test-cross' images are created for
> ppc64 and ppc64le. As done on 936fda4d771f, a test for compiler support
> is added to verify that the toolchain in use has '-mpower10'.
> 
> Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br>
> ---
>  tests/docker/Makefile.include                   |  4 ++++
>  .../dockerfiles/debian-ppc64-test-cross.docker  | 13 +++++++++++++
>  .../debian-ppc64el-test-cross.docker            | 17 +++++++++++++++++
>  tests/tcg/configure.sh                          | 12 ++++++++----
>  4 files changed, 42 insertions(+), 4 deletions(-)
>  create mode 100644 tests/docker/dockerfiles/debian-ppc64-test-cross.docker
>  create mode 100644 tests/docker/dockerfiles/debian-ppc64el-test-cross.docker
> 
> diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include
> index 9f464cb92c..1f8941d290 100644
> --- a/tests/docker/Makefile.include
> +++ b/tests/docker/Makefile.include
> @@ -152,10 +152,14 @@ docker-image-debian-sparc64-cross: docker-image-debian10
>  docker-image-debian-tricore-cross: docker-image-debian10
>  docker-image-debian-all-test-cross: docker-image-debian10
>  docker-image-debian-arm64-test-cross: docker-image-debian11
> +docker-image-debian-ppc64-test-cross: docker-image-debian11
> +docker-image-debian-ppc64el-test-cross: docker-image-debian11
>  
>  # These images may be good enough for building tests but not for test builds
>  DOCKER_PARTIAL_IMAGES += debian-alpha-cross
>  DOCKER_PARTIAL_IMAGES += debian-arm64-test-cross
> +DOCKER_PARTIAL_IMAGES += debian-ppc64-test-cross
> +DOCKER_PARTIAL_IMAGES += debian-ppc64el-test-cross
>  DOCKER_PARTIAL_IMAGES += debian-hppa-cross
>  DOCKER_PARTIAL_IMAGES += debian-m68k-cross debian-mips64-cross
>  DOCKER_PARTIAL_IMAGES += debian-powerpc-cross debian-ppc64-cross

Why are you adding new images, rather than updating the existing
debian-powerpc-cross image?  I don't think you should need separate
ppc64 and ppc64el images, a single image with a gcc that can target
both should suffice.  (Also, it's typically ppc64le, not ppc64el,
which, yes, is different from what the mips and arm people do for no
particularly good reason).

> diff --git a/tests/docker/dockerfiles/debian-ppc64-test-cross.docker b/tests/docker/dockerfiles/debian-ppc64-test-cross.docker
> new file mode 100644
> index 0000000000..66abfdeb47
> --- /dev/null
> +++ b/tests/docker/dockerfiles/debian-ppc64-test-cross.docker
> @@ -0,0 +1,13 @@
> +#
> +# Docker ppc64 cross-compiler target (tests only)
> +#
> +# This docker target builds on the debian Bullseye base image.
> +#
> +FROM qemu/debian11
> +
> +# Add the foreign architecture we want and install dependencies
> +RUN dpkg --add-architecture ppc64
> +RUN apt update && \
> +    DEBIAN_FRONTEND=noninteractive eatmydata \
> +        apt install -y --no-install-recommends \
> +        libc6-dev-ppc64-cross gcc-10-powerpc64-linux-gnu
> diff --git a/tests/docker/dockerfiles/debian-ppc64el-test-cross.docker b/tests/docker/dockerfiles/debian-ppc64el-test-cross.docker
> new file mode 100644
> index 0000000000..7582508467
> --- /dev/null
> +++ b/tests/docker/dockerfiles/debian-ppc64el-test-cross.docker
> @@ -0,0 +1,17 @@
> +#
> +# Docker ppc64el cross-compiler target (tests only)
> +#
> +# This docker target builds on the debian Bullseye base image.
> +#
> +FROM qemu/debian11
> +
> +# Add the foreign architecture we want and install dependencies
> +RUN dpkg --add-architecture ppc64el
> +RUN apt update && \
> +    DEBIAN_FRONTEND=noninteractive eatmydata \
> +        apt install -y --no-install-recommends \
> +        crossbuild-essential-ppc64el gcc-10-powerpc64le-linux-gnu
> +
> +# Specify the cross prefix for this image (see tests/docker/common.rc)
> +#ENV QEMU_CONFIGURE_OPTS --cross-prefix=powerpc64le-linux-gnu-
> +#ENV DEF_TARGET_LIST ppc64-softmmu,ppc64-linux-user,ppc64abi32-linux-user
> diff --git a/tests/tcg/configure.sh b/tests/tcg/configure.sh
> index fa1a4261a4..5f5db91a01 100755
> --- a/tests/tcg/configure.sh
> +++ b/tests/tcg/configure.sh
> @@ -170,13 +170,13 @@ for target in $target_list; do
>        ;;
>      ppc64-*)
>        container_hosts=x86_64
> -      container_image=debian-ppc64-cross
> -      container_cross_cc=powerpc64-linux-gnu-gcc
> +      container_image=debian-ppc64-test-cross
> +      container_cross_cc=powerpc64-linux-gnu-gcc-10
>        ;;
>      ppc64le-*)
>        container_hosts=x86_64
> -      container_image=debian-ppc64el-cross
> -      container_cross_cc=powerpc64le-linux-gnu-gcc
> +      container_image=debian-ppc64el-test-cross
> +      container_cross_cc=powerpc64le-linux-gnu-gcc-10
>        ;;
>      riscv64-*)
>        container_hosts=x86_64
> @@ -280,6 +280,10 @@ for target in $target_list; do
>                 -mpower8-vector -o $TMPE $TMPC; then
>                  echo "CROSS_CC_HAS_POWER8_VECTOR=y" >> $config_target_mak
>              fi
> +            if do_compiler "$target_compiler" $target_compiler_cflags \
> +               -mpower10 -o $TMPE $TMPC; then
> +                echo "CROSS_CC_HAS_POWER10=y" >> $config_target_mak
> +            fi
>          ;;
>          i386-linux-user)
>              if do_compiler "$target_compiler" $target_compiler_cflags \
Alex Bennée April 16, 2021, 2:07 p.m. UTC | #2
David Gibson <david@gibson.dropbear.id.au> writes:

> On Thu, Apr 15, 2021 at 06:41:36PM -0300, matheus.ferst@eldorado.org.br wrote:
>> From: Matheus Ferst <matheus.ferst@eldorado.org.br>
>> 
>> A newer compiler is needed to build tests for Power10 instructions. As
>> done for arm64 on c729a99d2701, new '-test-cross' images are created for
>> ppc64 and ppc64le. As done on 936fda4d771f, a test for compiler support
>> is added to verify that the toolchain in use has '-mpower10'.
>> 
>> Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br>
>> ---
>>  tests/docker/Makefile.include                   |  4 ++++
>>  .../dockerfiles/debian-ppc64-test-cross.docker  | 13 +++++++++++++
>>  .../debian-ppc64el-test-cross.docker            | 17 +++++++++++++++++
>>  tests/tcg/configure.sh                          | 12 ++++++++----
>>  4 files changed, 42 insertions(+), 4 deletions(-)
>>  create mode 100644 tests/docker/dockerfiles/debian-ppc64-test-cross.docker
>>  create mode 100644 tests/docker/dockerfiles/debian-ppc64el-test-cross.docker
>> 
>> diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include
>> index 9f464cb92c..1f8941d290 100644
>> --- a/tests/docker/Makefile.include
>> +++ b/tests/docker/Makefile.include
>> @@ -152,10 +152,14 @@ docker-image-debian-sparc64-cross: docker-image-debian10
>>  docker-image-debian-tricore-cross: docker-image-debian10
>>  docker-image-debian-all-test-cross: docker-image-debian10
>>  docker-image-debian-arm64-test-cross: docker-image-debian11
>> +docker-image-debian-ppc64-test-cross: docker-image-debian11
>> +docker-image-debian-ppc64el-test-cross: docker-image-debian11
>>  
>>  # These images may be good enough for building tests but not for test builds
>>  DOCKER_PARTIAL_IMAGES += debian-alpha-cross
>>  DOCKER_PARTIAL_IMAGES += debian-arm64-test-cross
>> +DOCKER_PARTIAL_IMAGES += debian-ppc64-test-cross
>> +DOCKER_PARTIAL_IMAGES += debian-ppc64el-test-cross
>>  DOCKER_PARTIAL_IMAGES += debian-hppa-cross
>>  DOCKER_PARTIAL_IMAGES += debian-m68k-cross debian-mips64-cross
>>  DOCKER_PARTIAL_IMAGES += debian-powerpc-cross debian-ppc64-cross
>
> Why are you adding new images, rather than updating the existing
> debian-powerpc-cross image?

Right - we could consider renaming the image to debian-power-test-cross
just to make it clear it's just for building tests.

The final image would essentially be:

RUN apt update && \
    DEBIAN_FRONTEND=noninteractive eatmydata \
    apt install -y --no-install-recommends \
        gcc-powerpc-linux-gnu \
        libc6-dev-powerpc-cross \
        gcc-10-powerpc64-linux-gnu \
        libc6-dev-ppc64-cross \
        gcc-10-powerpc64le-linux-gnu \
        libc6-dev-ppc64le-cross 

> I don't think you should need separate
> ppc64 and ppc64el images, a single image with a gcc that can target
> both should suffice.  (Also, it's typically ppc64le, not ppc64el,
> which, yes, is different from what the mips and arm people do for no
> particularly good reason).
>
>> diff --git a/tests/docker/dockerfiles/debian-ppc64-test-cross.docker b/tests/docker/dockerfiles/debian-ppc64-test-cross.docker
>> new file mode 100644
>> index 0000000000..66abfdeb47
>> --- /dev/null
>> +++ b/tests/docker/dockerfiles/debian-ppc64-test-cross.docker
>> @@ -0,0 +1,13 @@
>> +#
>> +# Docker ppc64 cross-compiler target (tests only)
>> +#
>> +# This docker target builds on the debian Bullseye base image.
>> +#
>> +FROM qemu/debian11
>> +
>> +# Add the foreign architecture we want and install dependencies
>> +RUN dpkg --add-architecture ppc64

Adding a foreign architecture is only really required for getting cross
libraries for more complex things like QEMU, for tcg tests directly
including the libc is enough.
>> +
>> +# Add the foreign architecture we want and install dependencies
>> +RUN dpkg --add-architecture ppc64el
>> +RUN apt update && \
>> +    DEBIAN_FRONTEND=noninteractive eatmydata \
>> +        apt install -y --no-install-recommends \
>> +        crossbuild-essential-ppc64el gcc-10-powerpc64le-linux-gnu

include the libc instead of crossbuild which brings in a lot more than
we need for tests.

>> +
>> +# Specify the cross prefix for this image (see tests/docker/common.rc)
>> +#ENV QEMU_CONFIGURE_OPTS --cross-prefix=powerpc64le-linux-gnu-
>> +#ENV DEF_TARGET_LIST ppc64-softmmu,ppc64-linux-user,ppc64abi32-linux-user
>> diff --git a/tests/tcg/configure.sh b/tests/tcg/configure.sh
>> index fa1a4261a4..5f5db91a01 100755
>> --- a/tests/tcg/configure.sh
>> +++ b/tests/tcg/configure.sh
>> @@ -170,13 +170,13 @@ for target in $target_list; do
>>        ;;
>>      ppc64-*)
>>        container_hosts=x86_64
>> -      container_image=debian-ppc64-cross
>> -      container_cross_cc=powerpc64-linux-gnu-gcc
>> +      container_image=debian-ppc64-test-cross
>> +      container_cross_cc=powerpc64-linux-gnu-gcc-10
>>        ;;
>>      ppc64le-*)
>>        container_hosts=x86_64
>> -      container_image=debian-ppc64el-cross
>> -      container_cross_cc=powerpc64le-linux-gnu-gcc
>> +      container_image=debian-ppc64el-test-cross
>> +      container_cross_cc=powerpc64le-linux-gnu-gcc-10
>>        ;;

I don't know if it's possible to nest the cases but if it's not too
ugly bringing all the cases into one place and just differentiating the
container_cross_cc would be nice.

>>      riscv64-*)
>>        container_hosts=x86_64
>> @@ -280,6 +280,10 @@ for target in $target_list; do
>>                 -mpower8-vector -o $TMPE $TMPC; then
>>                  echo "CROSS_CC_HAS_POWER8_VECTOR=y" >> $config_target_mak
>>              fi
>> +            if do_compiler "$target_compiler" $target_compiler_cflags \
>> +               -mpower10 -o $TMPE $TMPC; then
>> +                echo "CROSS_CC_HAS_POWER10=y" >> $config_target_mak
>> +            fi
>>          ;;
>>          i386-linux-user)
>>              if do_compiler "$target_compiler" $target_compiler_cflags \
diff mbox series

Patch

diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include
index 9f464cb92c..1f8941d290 100644
--- a/tests/docker/Makefile.include
+++ b/tests/docker/Makefile.include
@@ -152,10 +152,14 @@  docker-image-debian-sparc64-cross: docker-image-debian10
 docker-image-debian-tricore-cross: docker-image-debian10
 docker-image-debian-all-test-cross: docker-image-debian10
 docker-image-debian-arm64-test-cross: docker-image-debian11
+docker-image-debian-ppc64-test-cross: docker-image-debian11
+docker-image-debian-ppc64el-test-cross: docker-image-debian11
 
 # These images may be good enough for building tests but not for test builds
 DOCKER_PARTIAL_IMAGES += debian-alpha-cross
 DOCKER_PARTIAL_IMAGES += debian-arm64-test-cross
+DOCKER_PARTIAL_IMAGES += debian-ppc64-test-cross
+DOCKER_PARTIAL_IMAGES += debian-ppc64el-test-cross
 DOCKER_PARTIAL_IMAGES += debian-hppa-cross
 DOCKER_PARTIAL_IMAGES += debian-m68k-cross debian-mips64-cross
 DOCKER_PARTIAL_IMAGES += debian-powerpc-cross debian-ppc64-cross
diff --git a/tests/docker/dockerfiles/debian-ppc64-test-cross.docker b/tests/docker/dockerfiles/debian-ppc64-test-cross.docker
new file mode 100644
index 0000000000..66abfdeb47
--- /dev/null
+++ b/tests/docker/dockerfiles/debian-ppc64-test-cross.docker
@@ -0,0 +1,13 @@ 
+#
+# Docker ppc64 cross-compiler target (tests only)
+#
+# This docker target builds on the debian Bullseye base image.
+#
+FROM qemu/debian11
+
+# Add the foreign architecture we want and install dependencies
+RUN dpkg --add-architecture ppc64
+RUN apt update && \
+    DEBIAN_FRONTEND=noninteractive eatmydata \
+        apt install -y --no-install-recommends \
+        libc6-dev-ppc64-cross gcc-10-powerpc64-linux-gnu
diff --git a/tests/docker/dockerfiles/debian-ppc64el-test-cross.docker b/tests/docker/dockerfiles/debian-ppc64el-test-cross.docker
new file mode 100644
index 0000000000..7582508467
--- /dev/null
+++ b/tests/docker/dockerfiles/debian-ppc64el-test-cross.docker
@@ -0,0 +1,17 @@ 
+#
+# Docker ppc64el cross-compiler target (tests only)
+#
+# This docker target builds on the debian Bullseye base image.
+#
+FROM qemu/debian11
+
+# Add the foreign architecture we want and install dependencies
+RUN dpkg --add-architecture ppc64el
+RUN apt update && \
+    DEBIAN_FRONTEND=noninteractive eatmydata \
+        apt install -y --no-install-recommends \
+        crossbuild-essential-ppc64el gcc-10-powerpc64le-linux-gnu
+
+# Specify the cross prefix for this image (see tests/docker/common.rc)
+#ENV QEMU_CONFIGURE_OPTS --cross-prefix=powerpc64le-linux-gnu-
+#ENV DEF_TARGET_LIST ppc64-softmmu,ppc64-linux-user,ppc64abi32-linux-user
diff --git a/tests/tcg/configure.sh b/tests/tcg/configure.sh
index fa1a4261a4..5f5db91a01 100755
--- a/tests/tcg/configure.sh
+++ b/tests/tcg/configure.sh
@@ -170,13 +170,13 @@  for target in $target_list; do
       ;;
     ppc64-*)
       container_hosts=x86_64
-      container_image=debian-ppc64-cross
-      container_cross_cc=powerpc64-linux-gnu-gcc
+      container_image=debian-ppc64-test-cross
+      container_cross_cc=powerpc64-linux-gnu-gcc-10
       ;;
     ppc64le-*)
       container_hosts=x86_64
-      container_image=debian-ppc64el-cross
-      container_cross_cc=powerpc64le-linux-gnu-gcc
+      container_image=debian-ppc64el-test-cross
+      container_cross_cc=powerpc64le-linux-gnu-gcc-10
       ;;
     riscv64-*)
       container_hosts=x86_64
@@ -280,6 +280,10 @@  for target in $target_list; do
                -mpower8-vector -o $TMPE $TMPC; then
                 echo "CROSS_CC_HAS_POWER8_VECTOR=y" >> $config_target_mak
             fi
+            if do_compiler "$target_compiler" $target_compiler_cflags \
+               -mpower10 -o $TMPE $TMPC; then
+                echo "CROSS_CC_HAS_POWER10=y" >> $config_target_mak
+            fi
         ;;
         i386-linux-user)
             if do_compiler "$target_compiler" $target_compiler_cflags \