Skip to contentSkip to conversation

fix building of tests/tcg

PATCH Superseded Alex Bennée 3 participants 69 messages Jun 8, 2018 – Jun 11, 2018

Subsystems (2)

v6 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v6 cover fix building of tests/tcg

Hi,

Not a super amount has changed since the last version but review comments and review tags have been added. The new patches at the end enable a .travis.yml run and try and make the image building part of check-tcg -j safe. Essentially the problem is trying to avoid re-building the images multiple times. The additional issue is wanting an upto date Debian SID image whenever we actually build an image but not forcing a rebuild every time.

Essentially I'd like to encode a conditional dependency when:
- the target image doesn't exist
- or the target image is out of date w.r.t. the dockerfike

I'm thinking this is going to involve some sort of extension to the docker.py script to feed the Makefile.

A number of the prerequisite patches have already been pulled in the docker fixes series however I think this series is ready to go in now. Unless there are any objections I'll send a pull on Monday.

Current unreviewed patches:

patch 0017/tests tcg i386 add runner for test i386 fprem.patch needs review patch 0039/docker move debian powerpc cross to sid based bui.patch needs review patch 0040/tests tcg enable building for PowerPC.patch needs review patch 0042/Makefile.target add clean build guest tests targe.patch needs review patch 0044/tests tcg add run diff and skip helper macros.patch needs review patch 0045/tests tcg override runners for broken tests.patch needs review patch 0046/target sh4 Fix translator.c assertion failure for.patch needs review patch 0047/tests add top level make dependency for docker bu.patch needs review patch 0048/tests docker prevent sub makes re building debian.patch needs review patch 0049/.travis.yml add check tcg test.patch needs review

Alex Bennée (46):
configure: add support for --cross-cc-FOO
configure: move i386_cc to cross_cc_i386
configure: allow user to specify --cross-cc-cflags-foo=
configure: set cross_cc_FOO for host compiler
docker: Add "cc" subcommand
docker: extend "cc" command to accept compiler
docker: allow "cc" command to run in user context
docker: Makefile.include introduce DOCKER_SCRIPT tests/tcg: move architecture independent tests into subdir tests/tcg/multiarch: enable additional linux-test tests tests/tcg/multiarch: move most output to stdout tests/tcg: move i386 specific tests into subdir tests/tcg: enable building for i386 tests/tcg/i386: fix test-i386
tests/tcg/i386: add runner for test-i386-fprem tests/tcg/x86_64: add Makefile.target tests/tcg/i386/test-i386: use modern vector_size attributes tests/tcg/i386/test-i386: fix printf format tests/tcg: move ARM specific tests into subdir tests/tcg: enable building for ARM
tests/tcg/arm: fix up test-arm-iwmmxt test tests/tcg: enable building for AArch64 tests/tcg/arm: add fcvt test cases for AArch32/64 tests/tcg: move MIPS specific tests into subdir tests/tcg: enable building for MIPS tests/tcg/mips: include common mips hello-mips tests/tcg: enable building for s390x
tests/tcg: enable building for ppc64
tests/tcg: enable building for Alpha tests/tcg/alpha: add Alpha specific tests tests/tcg: enable building for HPPA
tests/tcg: enable building for m68k
tests/tcg: enable building for sh4
tests/tcg: enable building for sparc64
tests/tcg: enable building for mips64
tests/tcg: enable building for RISCV64
docker: move debian-powerpc-cross to sid based build tests/tcg: enable building for PowerPC tests/tcg/Makefile: update to be called from Makefile.target Makefile.target: add (clean-/build-)guest-tests targets tests/Makefile.include: add [build|clean|check]-tcg targets tests/tcg: add run, diff, and skip helper macros tests/tcg: override runners for broken tests
tests: add top-level make dependency for docker builds tests/docker: prevent sub-makes re-building debian-sid .travis.yml: add check-tcg test

Fam Zheng (2):
tests/tcg/multiarch: Build fix for linux-test
tests/tcg/i386: Build fix for hello-i386

Richard Henderson (1):
target/sh4: Fix translator.c assertion failure for gUSA

 .travis.yml                                   |    6 +
 MAINTAINERS                                   |   14 +
 Makefile.target                               |    5 +
 configure                                     |  134 +-
 target/sh4/translate.c                        |   81 +-
 tests/Makefile.include                        |   38 +-
 tests/docker/Makefile.include                 |   31 +-
 tests/docker/docker.py                        |   31 +
 .../dockerfiles/debian-alpha-cross.docker     |   12 +
 tests/docker/dockerfiles/debian-apt-fake.sh   |   46 -
 .../dockerfiles/debian-hppa-cross.docker      |   12 +
 .../dockerfiles/debian-m68k-cross.docker      |   12 +
 .../dockerfiles/debian-mips64-cross.docker    |   12 +
 .../dockerfiles/debian-powerpc-cross.docker   |   39 +-
 .../dockerfiles/debian-riscv64-cross.docker   |   12 +
 .../dockerfiles/debian-sh4-cross.docker       |   12 +
 tests/docker/dockerfiles/debian-sid.docker    |   32 +
 .../dockerfiles/debian-sparc64-cross.docker   |   12 +
 tests/docker/dockerfiles/debian8.docker       |    3 -
 tests/tcg/Makefile                            |  219 +-
 tests/tcg/Makefile.include                    |   89 +
 tests/tcg/Makefile.probe                      |   31 +
 tests/tcg/README                              |   69 +-
 tests/tcg/aarch64/Makefile.include            |    8 +
 tests/tcg/aarch64/Makefile.target             |   17 +
 tests/tcg/aarch64/fcvt.ref                    | 3268 +++++++++++++++++
 tests/tcg/alpha/Makefile                      |   35 -
 tests/tcg/alpha/Makefile.include              |    2 +
 tests/tcg/alpha/Makefile.target               |   18 +
 tests/tcg/alpha/crt.s                         |   26 -
 tests/tcg/alpha/hello-alpha.c                 |    2 +
 tests/tcg/alpha/test-cond.c                   |    1 +
 tests/tcg/alpha/test-ovf.c                    |    2 +
 tests/tcg/arm/Makefile.include                |    8 +
 tests/tcg/arm/Makefile.target                 |   32 +
 tests/tcg/arm/README                          |   11 +
 tests/tcg/arm/fcvt.c                          |  458 +++
 tests/tcg/arm/fcvt.ref                        | 3268 +++++++++++++++++
 tests/tcg/{ => arm}/hello-arm.c               |    0
 .../test-arm-iwmmxt.S}                        |    0
 tests/tcg/hppa/Makefile.include               |    2 +
 tests/tcg/hppa/Makefile.target                |    6 +
 tests/tcg/i386/Makefile.include               |    9 +
 tests/tcg/i386/Makefile.target                |   51 +
 tests/tcg/i386/README                         |   38 +
 tests/tcg/{ => i386}/hello-i386.c             |    1 +
 tests/tcg/{ => i386}/pi_10.com                |  Bin
 tests/tcg/{ => i386}/runcom.c                 |    0
 tests/tcg/{ => i386}/test-i386-code16.S       |    0
 tests/tcg/{ => i386}/test-i386-fprem.c        |   12 +-
 tests/tcg/{ => i386}/test-i386-muldiv.h       |    0
 tests/tcg/{ => i386}/test-i386-shift.h        |    0
 tests/tcg/{ => i386}/test-i386-ssse3.c        |    0
 tests/tcg/{ => i386}/test-i386-vm86.S         |    0
 tests/tcg/{ => i386}/test-i386.c              |    7 +-
 tests/tcg/{ => i386}/test-i386.h              |    0
 tests/tcg/m68k/Makefile.include               |    2 +
 tests/tcg/m68k/Makefile.target                |    7 +
 tests/tcg/mips/Makefile.include               |   20 +
 tests/tcg/mips/Makefile.target                |   22 +
 tests/tcg/mips/README                         |    7 +
 tests/tcg/{ => mips}/hello-mips.c             |    0
 tests/tcg/multiarch/Makefile.target           |   36 +
 tests/tcg/multiarch/README                    |    1 +
 tests/tcg/{ => multiarch}/linux-test.c        |  113 +-
 tests/tcg/{ => multiarch}/sha1.c              |    0
 tests/tcg/{ => multiarch}/test-mmap.c         |   40 +-
 tests/tcg/{ => multiarch}/testthread.c        |    0
 tests/tcg/ppc/Makefile.include                |    7 +
 tests/tcg/ppc/Makefile.target                 |   12 +
 tests/tcg/riscv/Makefile.include              |   10 +
 tests/tcg/s390x/Makefile.include              |    2 +
 tests/tcg/sh4/Makefile.include                |    4 +
 tests/tcg/sh4/Makefile.target                 |    7 +
 tests/tcg/sparc64/Makefile.include            |    2 +
 tests/tcg/sparc64/Makefile.target             |   11 +
 tests/tcg/test_path.c                         |  157 -
 tests/tcg/x86_64/Makefile.target              |   15 +
 78 files changed, 8068 insertions(+), 641 deletions(-)
 create mode 100644 tests/docker/dockerfiles/debian-alpha-cross.docker
 delete mode 100755 tests/docker/dockerfiles/debian-apt-fake.sh
 create mode 100644 tests/docker/dockerfiles/debian-hppa-cross.docker
 create mode 100644 tests/docker/dockerfiles/debian-m68k-cross.docker
 create mode 100644 tests/docker/dockerfiles/debian-mips64-cross.docker
 create mode 100644 tests/docker/dockerfiles/debian-riscv64-cross.docker
 create mode 100644 tests/docker/dockerfiles/debian-sh4-cross.docker
 create mode 100644 tests/docker/dockerfiles/debian-sid.docker
 create mode 100644 tests/docker/dockerfiles/debian-sparc64-cross.docker
 create mode 100644 tests/tcg/Makefile.include
 create mode 100644 tests/tcg/Makefile.probe
 create mode 100644 tests/tcg/aarch64/Makefile.include
 create mode 100644 tests/tcg/aarch64/Makefile.target
 create mode 100644 tests/tcg/aarch64/fcvt.ref
 delete mode 100644 tests/tcg/alpha/Makefile
 create mode 100644 tests/tcg/alpha/Makefile.include
 create mode 100644 tests/tcg/alpha/Makefile.target
 delete mode 100644 tests/tcg/alpha/crt.s
 create mode 100644 tests/tcg/arm/Makefile.include
 create mode 100644 tests/tcg/arm/Makefile.target
 create mode 100644 tests/tcg/arm/README
 create mode 100644 tests/tcg/arm/fcvt.c
 create mode 100644 tests/tcg/arm/fcvt.ref
 rename tests/tcg/{ => arm}/hello-arm.c (100%)
 rename tests/tcg/{test-arm-iwmmxt.s => arm/test-arm-iwmmxt.S} (100%)
 create mode 100644 tests/tcg/hppa/Makefile.include
 create mode 100644 tests/tcg/hppa/Makefile.target
 create mode 100644 tests/tcg/i386/Makefile.include
 create mode 100644 tests/tcg/i386/Makefile.target
 create mode 100644 tests/tcg/i386/README
 rename tests/tcg/{ => i386}/hello-i386.c (96%)
 rename tests/tcg/{ => i386}/pi_10.com (100%)
 rename tests/tcg/{ => i386}/runcom.c (100%)
 rename tests/tcg/{ => i386}/test-i386-code16.S (100%)
 rename tests/tcg/{ => i386}/test-i386-fprem.c (97%)
 rename tests/tcg/{ => i386}/test-i386-muldiv.h (100%)
 rename tests/tcg/{ => i386}/test-i386-shift.h (100%)
 rename tests/tcg/{ => i386}/test-i386-ssse3.c (100%)
 rename tests/tcg/{ => i386}/test-i386-vm86.S (100%)
 rename tests/tcg/{ => i386}/test-i386.c (99%)
 rename tests/tcg/{ => i386}/test-i386.h (100%)
 create mode 100644 tests/tcg/m68k/Makefile.include
 create mode 100644 tests/tcg/m68k/Makefile.target
 create mode 100644 tests/tcg/mips/Makefile.include
 create mode 100644 tests/tcg/mips/Makefile.target
 create mode 100644 tests/tcg/mips/README
 rename tests/tcg/{ => mips}/hello-mips.c (100%)
 create mode 100644 tests/tcg/multiarch/Makefile.target
 create mode 100644 tests/tcg/multiarch/README
 rename tests/tcg/{ => multiarch}/linux-test.c (86%)
 rename tests/tcg/{ => multiarch}/sha1.c (100%)
 rename tests/tcg/{ => multiarch}/test-mmap.c (93%)
 rename tests/tcg/{ => multiarch}/testthread.c (100%)
 create mode 100644 tests/tcg/ppc/Makefile.include
 create mode 100644 tests/tcg/ppc/Makefile.target
 create mode 100644 tests/tcg/riscv/Makefile.include
 create mode 100644 tests/tcg/s390x/Makefile.include
 create mode 100644 tests/tcg/sh4/Makefile.include
 create mode 100644 tests/tcg/sh4/Makefile.target
 create mode 100644 tests/tcg/sparc64/Makefile.include
 create mode 100644 tests/tcg/sparc64/Makefile.target
 delete mode 100644 tests/tcg/test_path.c
 create mode 100644 tests/tcg/x86_64/Makefile.target
Signature · 1 line
2.17.1
#1 lore raw

PATCH v6 1/49 configure: add support for --cross-cc-FOO

This allows us to specify cross compilers for our guests. This is useful for building test images/programs. Currently we re-run the compile test for each target. I couldn't think of a way to cache the value for a given arch without getting messier configure code.

The cross compiler for the guest is visible to each target as CROSS_CC_GUEST in config-target.mak.

---
v3
- --cross-cc-*[!a-zA-Z0-9_-]*=*) error_exit...
- --cross-cc-*) cc_arch=${opt#--cross-cc-}; cc_arch=${cc_arch%%=*}
- add remaining target_compiler definitions
v4
- also set cross_cc_$cpu=$host_cc
- try a non-static build if static fails
- use write_c_skeleton
- add doc string in help

---
 configure | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 92 insertions(+)
configure +92 -0
index 14b11130a7..0121e4e9f4 100755
@@ -458,6 +458,13 @@ vxhs=""
 libxml2=""
 docker="no"
 
+# cross compilers defaults, can be overridden with --cross-cc-ARCH
+cross_cc_aarch64="aarch64-linux-gnu-gcc"
+cross_cc_arm="arm-linux-gnueabihf-gcc"
+cross_cc_powerpc="powerpc-linux-gnu-gcc"
+
+enabled_cross_compilers=""
+
 supported_cpu="no"
 supported_os="no"
 bogus_os="no"
@@ -488,6 +495,11 @@ for opt do
   ;;
   --disable-debug-info) debug_info="no"
   ;;
+  --cross-cc-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --cross-cc-FOO option"
+  ;;
+  --cross-cc-*) cc_arch=${opt#--cross-cc-}; cc_arch=${cc_arch%%=*}
+                eval "cross_cc_${cc_arch}=\$optarg"
+  ;;
   esac
 done
 # OS specific
@@ -676,30 +688,37 @@ case "$cpu" in
   ppc|ppc64|s390|s390x|sparc64|x32)
     cpu="$cpu"
     supported_cpu="yes"
+    eval "cross_cc_${cpu}=\$host_cc"
   ;;
   i386|i486|i586|i686|i86pc|BePC)
     cpu="i386"
     supported_cpu="yes"
+    cross_cc_i386=$host_cc
   ;;
   x86_64|amd64)
     cpu="x86_64"
     supported_cpu="yes"
+    cross_cc_x86_64=$host_cc
   ;;
   armv*b|armv*l|arm)
     cpu="arm"
     supported_cpu="yes"
+    cross_cc_arm=$host_cc
   ;;
   aarch64)
     cpu="aarch64"
     supported_cpu="yes"
+    cross_cc_aarch64=$host_cc
   ;;
   mips*)
     cpu="mips"
     supported_cpu="yes"
+    cross_cc_mips=$host_cc
   ;;
   sparc|sun4[cdmuv])
     cpu="sparc"
     supported_cpu="yes"
+    cross_cc_sparc=$host_cc
   ;;
   *)
     # This will result in either an error or falling back to TCI later
@@ -917,6 +936,8 @@ for opt do
   ;;
   --disable-debug-info)
   ;;
+  --cross-cc-*)
+  ;;
   --enable-modules)
       modules="yes"
   ;;
@@ -1501,6 +1522,7 @@ Advanced options (experts only):
   --extra-cflags=CFLAGS    append extra C compiler flags QEMU_CFLAGS
   --extra-cxxflags=CXXFLAGS append extra C++ compiler flags QEMU_CXXFLAGS
   --extra-ldflags=LDFLAGS  append extra linker flags LDFLAGS
+  --cross-cc-ARCH=CC       use compiler when building ARCH guest test cases
   --make=MAKE              use specified make [$make]
   --install=INSTALL        use specified install [$install]
   --python=PYTHON          use specified python [$python]
@@ -6820,6 +6842,9 @@ case "$target" in
     ;;
 esac
 
+target_compiler=""
+target_compiler_static=""
+
 mkdir -p $target_dir
 echo "# Automatically generated by configure - do not modify" > $config_target_mak
 
@@ -6835,19 +6860,23 @@ TARGET_ABI_DIR=""
 case "$target_name" in
   i386)
     gdb_xml_files="i386-32bit.xml i386-32bit-core.xml i386-32bit-sse.xml"
+    target_compiler=$cross_cc_i386
   ;;
   x86_64)
     TARGET_BASE_ARCH=i386
     gdb_xml_files="i386-64bit.xml i386-64bit-core.xml i386-64bit-sse.xml"
+    target_compiler=$cross_cc_x86_64
   ;;
   alpha)
     mttcg="yes"
+    target_compiler=$cross_cc_alpha
   ;;
   arm|armeb)
     TARGET_ARCH=arm
     bflt="yes"
     mttcg="yes"
     gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
+    target_compiler=$cross_cc_arm
   ;;
   aarch64|aarch64_be)
     TARGET_ARCH=aarch64
@@ -6855,59 +6884,74 @@ case "$target_name" in
     bflt="yes"
     mttcg="yes"
     gdb_xml_files="aarch64-core.xml aarch64-fpu.xml arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
+    target_compiler=$cross_cc_aarch64
   ;;
   cris)
+    target_compiler=$cross_cc_cris
   ;;
   hppa)
     mttcg="yes"
+    target_compiler=$cross_cc_hppa
   ;;
   lm32)
+    target_compiler=$cross_cc_lm32
   ;;
   m68k)
     bflt="yes"
     gdb_xml_files="cf-core.xml cf-fp.xml m68k-fp.xml"
+    target_compiler=$cross_cc_m68k
   ;;
   microblaze|microblazeel)
     TARGET_ARCH=microblaze
     bflt="yes"
     echo "TARGET_ABI32=y" >> $config_target_mak
+    target_compiler=$cross_cc_microblaze
   ;;
   mips|mipsel)
     TARGET_ARCH=mips
+    target_compiler=$cross_cc_mips
     echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
   ;;
   mipsn32|mipsn32el)
     TARGET_ARCH=mips64
     TARGET_BASE_ARCH=mips
+    target_compiler=$cross_cc_mipsn32
     echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
     echo "TARGET_ABI32=y" >> $config_target_mak
   ;;
   mips64|mips64el)
     TARGET_ARCH=mips64
     TARGET_BASE_ARCH=mips
+    target_compiler=$cross_cc_mips64
     echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
   ;;
   moxie)
+    target_compiler=$cross_cc_moxie
   ;;
   nios2)
+    target_compiler=$cross_cc_nios2
   ;;
   or1k)
+    target_compiler=$cross_cc_or1k
     TARGET_ARCH=openrisc
     TARGET_BASE_ARCH=openrisc
   ;;
   ppc)
     gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
+    target_compiler=$cross_cc_powerpc
   ;;
   ppcemb)
     TARGET_BASE_ARCH=ppc
     TARGET_ABI_DIR=ppc
     gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
+    target_compiler=$cross_cc_ppcemb
   ;;
   ppc64)
     TARGET_BASE_ARCH=ppc
     TARGET_ABI_DIR=ppc
     mttcg=yes
     gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
+    target_compiler=$cross_cc_ppc64
   ;;
   ppc64le)
     TARGET_ARCH=ppc64
@@ -6915,6 +6959,7 @@ case "$target_name" in
     TARGET_ABI_DIR=ppc
     mttcg=yes
     gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
+    target_compiler=$cross_cc_ppc64le
   ;;
   ppc64abi32)
     TARGET_ARCH=ppc64
@@ -6922,45 +6967,57 @@ case "$target_name" in
     TARGET_ABI_DIR=ppc
     echo "TARGET_ABI32=y" >> $config_target_mak
     gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
+    target_compiler=$cross_cc_ppc64abi32
   ;;
   riscv32)
     TARGET_BASE_ARCH=riscv
     TARGET_ABI_DIR=riscv
     mttcg=yes
+    target_compiler=$cross_cc_riscv32
   ;;
   riscv64)
     TARGET_BASE_ARCH=riscv
     TARGET_ABI_DIR=riscv
     mttcg=yes
+    target_compiler=$cross_cc_riscv64
   ;;
   sh4|sh4eb)
     TARGET_ARCH=sh4
     bflt="yes"
+    target_compiler=$cross_cc_sh4
   ;;
   sparc)
+    target_compiler=$cross_cc_sparc
   ;;
   sparc64)
     TARGET_BASE_ARCH=sparc
+    target_compiler=$cross_cc_sparc64
   ;;
   sparc32plus)
     TARGET_ARCH=sparc64
     TARGET_BASE_ARCH=sparc
     TARGET_ABI_DIR=sparc
+    target_compiler=$cross_cc_sparc32plus
     echo "TARGET_ABI32=y" >> $config_target_mak
   ;;
   s390x)
     mttcg=yes
     gdb_xml_files="s390x-core64.xml s390-acr.xml s390-fpr.xml s390-vx.xml s390-cr.xml s390-virt.xml s390-gs.xml"
+    target_compiler=$cross_cc_s390x
   ;;
   tilegx)
+    target_compiler=$cross_cc_tilegx
   ;;
   tricore)
+    target_compiler=$cross_cc_tricore
   ;;
   unicore32)
+    target_compiler=$cross_cc_unicore32
   ;;
   xtensa|xtensaeb)
     TARGET_ARCH=xtensa
     mttcg="yes"
+    target_compiler=$cross_cc_xtensa
   ;;
   *)
     error_exit "Unsupported target CPU"
@@ -6971,6 +7028,27 @@ if [ "$TARGET_BASE_ARCH" = "" ]; then
   TARGET_BASE_ARCH=$TARGET_ARCH
 fi
 
+# Do we have a cross compiler for this target?
+if has $target_compiler; then
+
+    write_c_skeleton
+
+    if ! do_compiler $target_compiler -o $TMPE $TMPC -static ; then
+        # For host systems we might get away with building without -static
+        if ! do_compiler $target_compiler -o $TMPE $TMPC ; then
+            target_compiler=""
+        else
+            enabled_cross_compilers="${enabled_cross_compilers} ${target_compiler}"
+            target_compiler_static="n"
+        fi
+    else
+        enabled_cross_compilers="${enabled_cross_compilers} ${target_compiler}"
+        target_compiler_static="y"
+    fi
+else
+    target_compiler=""
+fi
+
 symlink "$source_path/Makefile.target" "$target_dir/Makefile"
 
 upper() {
@@ -7044,6 +7122,14 @@ if test "$target_bsd_user" = "yes" ; then
   echo "CONFIG_BSD_USER=y" >> $config_target_mak
 fi
 
+if test -n "$target_compiler"; then
+  echo "CROSS_CC_GUEST=$target_compiler" >> $config_target_mak
+
+  if test -n "$target_compiler_static"; then
+      echo "CROSS_CC_GUEST_STATIC=$target_compiler_static" >> $config_target_mak
+  fi
+fi
+
 # generate QEMU_CFLAGS/LDFLAGS for targets
 
 cflags=""
@@ -7166,6 +7252,12 @@ echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
 
 done # for target in $targets
 
+if test -n "$enabled_cross_compilers"; then
+    echo
+    echo "NOTE: cross-compilers enabled:"
+    printf '%s\n' $enabled_cross_compilers | sort -u
+fi
+
 if [ "$fdt" = "git" ]; then
   echo "config-host.h: subdir-dtc" >> $config_host_mak
 fi
Signature · 1 line
2.17.1
#2 lore raw

PATCH v6 2/49 configure: move i386_cc to cross_cc_i386

In reply to Alex Bennée

Also dont assume x86_64 compiler can build i386 binaries.

---
v2
- drop using system x86_64 compiler for i386 compiles
v3
- fix cross_cc_i386 when on i386
v4
- fix merge conflicts
- sort cross_cc defines

---
 configure | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)
configure +17 -7
index 0121e4e9f4..6b59366e0d 100755
@@ -289,7 +289,6 @@ libs_softmmu=""
 libs_tools=""
 audio_pt_int=""
 audio_win_int=""
-cc_i386=i386-pc-linux-gnu-gcc
 libs_qga=""
 debug_info="yes"
 stack_protector=""
@@ -461,6 +460,8 @@ docker="no"
 # cross compilers defaults, can be overridden with --cross-cc-ARCH
 cross_cc_aarch64="aarch64-linux-gnu-gcc"
 cross_cc_arm="arm-linux-gnueabihf-gcc"
+cross_cc_i386="i386-pc-linux-gnu-gcc"
+cross_cc_cflags_i386=""
 cross_cc_powerpc="powerpc-linux-gnu-gcc"
 
 enabled_cross_compilers=""
@@ -1447,7 +1448,8 @@ case "$cpu" in
     i386)
            CPU_CFLAGS="-m32"
            LDFLAGS="-m32 $LDFLAGS"
-           cc_i386='$(CC) -m32'
+           cross_cc_i386=$cc
+           cross_cc_cflags_i386=$CPU_CFLAGS
            ;;
     x86_64)
            # ??? Only extremely old AMD cpus do not have cmpxchg16b.
@@ -1455,12 +1457,14 @@ case "$cpu" in
            # runtime and generate the fallback to serial emulation.
            CPU_CFLAGS="-m64 -mcx16"
            LDFLAGS="-m64 $LDFLAGS"
-           cc_i386='$(CC) -m32'
+           cross_cc_x86_64=$cc
+           cross_cc_cflags_x86_64=$CPU_CFLAGS
            ;;
     x32)
            CPU_CFLAGS="-mx32"
            LDFLAGS="-mx32 $LDFLAGS"
-           cc_i386='$(CC) -m32'
+           cross_cc_i386=$cc
+           cross_cc_cflags_i386="-m32"
            ;;
     # No special flags required for other host CPUs
 esac
@@ -6723,7 +6727,6 @@ echo "CC=$cc" >> $config_host_mak
 if $iasl -h > /dev/null 2>&1; then
   echo "IASL=$iasl" >> $config_host_mak
 fi
-echo "CC_I386=$cc_i386" >> $config_host_mak
 echo "HOST_CC=$host_cc" >> $config_host_mak
 echo "CXX=$cxx" >> $config_host_mak
 echo "OBJCC=$objcc" >> $config_host_mak
@@ -6844,6 +6847,7 @@ esac
 
 target_compiler=""
 target_compiler_static=""
+target_compiler_cflags=""
 
 mkdir -p $target_dir
 echo "# Automatically generated by configure - do not modify" > $config_target_mak
@@ -6861,6 +6865,7 @@ case "$target_name" in
   i386)
     gdb_xml_files="i386-32bit.xml i386-32bit-core.xml i386-32bit-sse.xml"
     target_compiler=$cross_cc_i386
+    target_compiler_cflags=$cross_cc_ccflags_i386
   ;;
   x86_64)
     TARGET_BASE_ARCH=i386
@@ -7033,9 +7038,9 @@ if has $target_compiler; then
 
     write_c_skeleton
 
-    if ! do_compiler $target_compiler -o $TMPE $TMPC -static ; then
+    if ! do_compiler $target_compiler $target_compiler_cflags -o $TMPE $TMPC -static ; then
         # For host systems we might get away with building without -static
-        if ! do_compiler $target_compiler -o $TMPE $TMPC ; then
+        if ! do_compiler $target_compiler $target_compiler_cflags -o $TMPE $TMPC ; then
             target_compiler=""
         else
             enabled_cross_compilers="${enabled_cross_compilers} ${target_compiler}"
@@ -7128,8 +7133,13 @@ if test -n "$target_compiler"; then
   if test -n "$target_compiler_static"; then
       echo "CROSS_CC_GUEST_STATIC=$target_compiler_static" >> $config_target_mak
   fi
+
+  if test -n "$target_compiler_cflags"; then
+      echo "CROSS_CC_GUEST_CFLAGS=$target_compiler_cflags" >> $config_target_mak
+  fi
 fi
 
+
 # generate QEMU_CFLAGS/LDFLAGS for targets
 
 cflags=""
Signature · 1 line
2.17.1
#3 lore raw

PATCH v6 3/49 configure: allow user to specify --cross-cc-cflags-foo=

In reply to Alex Bennée

As an individual compiler may be able to support several targets with the appropriate flags we need to expose this to the user as well.

---
v3
- fix up the cross-cc
v4
- add --help text
- sort cross_cc_foo lines

---
 configure | 10 ++++++++++
 1 file changed, 10 insertions(+)
configure +10 -0
index 6b59366e0d..2d6e095196 100755
@@ -459,10 +459,14 @@ docker="no"
 
 # cross compilers defaults, can be overridden with --cross-cc-ARCH
 cross_cc_aarch64="aarch64-linux-gnu-gcc"
+cross_cc_aarch64_be="$cross_cc_aarch64"
+cross_cc_cflags_aarch64_be="-mbig-endian"
 cross_cc_arm="arm-linux-gnueabihf-gcc"
+cross_cc_cflags_armeb="-mbig-endian"
 cross_cc_i386="i386-pc-linux-gnu-gcc"
 cross_cc_cflags_i386=""
 cross_cc_powerpc="powerpc-linux-gnu-gcc"
+cross_cc_powerpc="powerpc-linux-gnu-gcc"
 
 enabled_cross_compilers=""
 
@@ -498,6 +502,9 @@ for opt do
   ;;
   --cross-cc-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --cross-cc-FOO option"
   ;;
+  --cross-cc-cflags-*) cc_arch=${opt#--cross-cc-flags-}; cc_arch=${cc_arch%%=*}
+                      eval "cross_cc_cflags_${cc_arch}=\$optarg"
+  ;;
   --cross-cc-*) cc_arch=${opt#--cross-cc-}; cc_arch=${cc_arch%%=*}
                 eval "cross_cc_${cc_arch}=\$optarg"
   ;;
@@ -1527,6 +1534,7 @@ Advanced options (experts only):
   --extra-cxxflags=CXXFLAGS append extra C++ compiler flags QEMU_CXXFLAGS
   --extra-ldflags=LDFLAGS  append extra linker flags LDFLAGS
   --cross-cc-ARCH=CC       use compiler when building ARCH guest test cases
+  --cross-cc-flags-ARCH=   use compiler flags when building ARCH guest tests
   --make=MAKE              use specified make [$make]
   --install=INSTALL        use specified install [$install]
   --python=PYTHON          use specified python [$python]
@@ -6882,6 +6890,7 @@ case "$target_name" in
     mttcg="yes"
     gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
     target_compiler=$cross_cc_arm
+    eval "target_compiler_cflags=\$cross_cc_cflags_${target_name}"
   ;;
   aarch64|aarch64_be)
     TARGET_ARCH=aarch64
@@ -6890,6 +6899,7 @@ case "$target_name" in
     mttcg="yes"
     gdb_xml_files="aarch64-core.xml aarch64-fpu.xml arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
     target_compiler=$cross_cc_aarch64
+    eval "target_compiler_cflags=\$cross_cc_cflags_${target_name}"
   ;;
   cris)
     target_compiler=$cross_cc_cris
Signature · 1 line
2.17.1
#4 lore raw

PATCH v6 4/49 configure: set cross_cc_FOO for host compiler

In reply to Alex Bennée

We can build tests for the host system with the compiler that we have selected.

---
 configure | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
configure +13 -1
index 2d6e095196..b374868eab 100755
@@ -1431,26 +1431,38 @@ case "$cpu" in
     ppc)
            CPU_CFLAGS="-m32"
            LDFLAGS="-m32 $LDFLAGS"
+           cross_cc_powerpc=$cc
+           cross_cc_cflags_powerpc=$CPU_CFLAGS
            ;;
     ppc64)
            CPU_CFLAGS="-m64"
            LDFLAGS="-m64 $LDFLAGS"
+           cross_cc_ppc64=$cc
+           cross_cc_cflags_ppc64=$CPU_CFLAGS
            ;;
     sparc)
            CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc"
            LDFLAGS="-m32 -mv8plus $LDFLAGS"
+           cross_cc_sparc=$cc
+           cross_cc_cflags_sparc=$CPU_CFLAGS
            ;;
     sparc64)
            CPU_CFLAGS="-m64 -mcpu=ultrasparc"
            LDFLAGS="-m64 $LDFLAGS"
+           cross_cc_sparc64=$cc
+           cross_cc_cflags_sparc64=$CPU_CFLAGS
            ;;
     s390)
            CPU_CFLAGS="-m31"
            LDFLAGS="-m31 $LDFLAGS"
+           cross_cc_s390=$cc
+           cross_cc_cflags_s390=$CPU_CFLAGS
            ;;
     s390x)
            CPU_CFLAGS="-m64"
            LDFLAGS="-m64 $LDFLAGS"
+           cross_cc_s390x=$cc
+           cross_cc_cflags_s390x=$CPU_CFLAGS
            ;;
     i386)
            CPU_CFLAGS="-m32"
@@ -1471,7 +1483,7 @@ case "$cpu" in
            CPU_CFLAGS="-mx32"
            LDFLAGS="-mx32 $LDFLAGS"
            cross_cc_i386=$cc
-           cross_cc_cflags_i386="-m32"
+           cross_cc_cflags_i386=$CPU_CFLAGS
            ;;
     # No special flags required for other host CPUs
 esac
Signature · 1 line
2.17.1
#5 lore raw

PATCH v6 5/49 docker: Add "cc" subcommand

In reply to Alex Bennée

---
v2
- add if args.paths check to avoid iterating null argument

---
 tests/docker/docker.py | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
tests/docker/docker.py +25 -0
index f8267586eb..bcc3ee2dee 100755
@@ -408,6 +408,31 @@ class ProbeCommand(SubCommand):
         return
 
 
+class CcCommand(SubCommand):
+    """Compile sources with cc in images"""
+    name = "cc"
+
+    def args(self, parser):
+        parser.add_argument("--image", "-i", required=True,
+                            help="The docker image in which to run cc")
+        parser.add_argument("--source-path", "-s", nargs="*", dest="paths",
+                            help="""Extra paths to (ro) mount into container for
+                            reading sources""")
+
+    def run(self, args, argv):
+        if argv and argv[0] == "--":
+            argv = argv[1:]
+        cwd = os.getcwd()
+        cmd = ["--rm", "-w", cwd,
+               "-v", "%s:%s:rw" % (cwd, cwd)]
+        if args.paths:
+            for p in args.paths:
+                cmd += ["-v", "%s:%s:ro,z" % (p, p)]
+        cmd += [args.image, "cc"]
+        cmd += argv
+        return Docker().command("run", cmd, args.quiet)
+
+
 def main():
     parser = argparse.ArgumentParser(description="A Docker helper",
             usage="%s <subcommand> ..." % os.path.basename(sys.argv[0]))
Signature · 1 line
2.17.1
#6 lore raw

PATCH v6 6/49 docker: extend "cc" command to accept compiler

In reply to Alex Bennée

When calling our cross-compilation images we want to call something other than the default cc.

---
v2
- use arg.cc default to simplify logic

---
 tests/docker/docker.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tests/docker/docker.py +3 -1
index bcc3ee2dee..59bce9f19a 100755
@@ -415,6 +415,8 @@ class CcCommand(SubCommand):
     def args(self, parser):
         parser.add_argument("--image", "-i", required=True,
                             help="The docker image in which to run cc")
+        parser.add_argument("--cc", default="cc",
+                            help="The compiler executable to call")
         parser.add_argument("--source-path", "-s", nargs="*", dest="paths",
                             help="""Extra paths to (ro) mount into container for
                             reading sources""")
@@ -428,7 +430,7 @@ class CcCommand(SubCommand):
         if args.paths:
             for p in args.paths:
                 cmd += ["-v", "%s:%s:ro,z" % (p, p)]
-        cmd += [args.image, "cc"]
+        cmd += [args.image, args.cc]
         cmd += argv
         return Docker().command("run", cmd, args.quiet)
 
Signature · 1 line
2.17.1
#7 lore raw

PATCH v6 7/49 docker: allow "cc" command to run in user context

In reply to Alex Bennée
---
 tests/docker/docker.py | 4 ++++
 1 file changed, 4 insertions(+)
tests/docker/docker.py +4 -0
index 59bce9f19a..37bfa98005 100755
@@ -417,6 +417,8 @@ class CcCommand(SubCommand):
                             help="The docker image in which to run cc")
         parser.add_argument("--cc", default="cc",
                             help="The compiler executable to call")
+        parser.add_argument("--user",
+                            help="The user-id to run under")
         parser.add_argument("--source-path", "-s", nargs="*", dest="paths",
                             help="""Extra paths to (ro) mount into container for
                             reading sources""")
@@ -430,6 +432,8 @@ class CcCommand(SubCommand):
         if args.paths:
             for p in args.paths:
                 cmd += ["-v", "%s:%s:ro,z" % (p, p)]
+        if args.user:
+            cmd += ["-u", args.user]
         cmd += [args.image, args.cc]
         cmd += argv
         return Docker().command("run", cmd, args.quiet)
Signature · 1 line
2.17.1
#8 lore raw

PATCH v6 8/49 docker: Makefile.include introduce DOCKER_SCRIPT

In reply to Alex Bennée

Define this in one place to make it easy to re-use.

---
 tests/docker/Makefile.include | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
tests/docker/Makefile.include +6 -4
index 74fd51c22c..8afb383478 100644
@@ -15,6 +15,8 @@ DOCKER_TESTS := $(notdir $(shell \
 
 DOCKER_TOOLS := travis
 
+DOCKER_SCRIPT=$(SRC_PATH)/tests/docker/docker.py
+
 TESTS ?= %
 IMAGES ?= %
 
@@ -38,7 +40,7 @@ docker-image-%: $(DOCKER_FILES_DIR)/%.docker
 		echo WARNING: EXECUTABLE is not set, debootstrap may fail. 2>&1 ; \
 	fi
 	$(call quiet-command,\
-		$(SRC_PATH)/tests/docker/docker.py build qemu:$* $< \
+		$(DOCKER_SCRIPT) build qemu:$* $< \
 		$(if $V,,--quiet) $(if $(NOCACHE),--no-cache) \
 		$(if $(NOUSER),,--add-current-user) \
 		$(if $(EXTRA_FILES),--extra-files $(EXTRA_FILES))\
@@ -133,11 +135,11 @@ docker-run: docker-qemu-src
 	fi
 	$(if $(EXECUTABLE),						\
 		$(call quiet-command,					\
-			$(SRC_PATH)/tests/docker/docker.py update 	\
+			$(DOCKER_SCRIPT) update 			\
 			$(IMAGE) $(EXECUTABLE),				\
 			"  COPYING $(EXECUTABLE) to $(IMAGE)"))
 	$(call quiet-command,						\
-		$(SRC_PATH)/tests/docker/docker.py run 			\
+		$(DOCKER_SCRIPT) run 					\
 			$(if $(NOUSER),,-u $(shell id -u)) 		\
 			--security-opt seccomp=unconfined		\
 			$(if $V,,--rm) 					\
@@ -167,4 +169,4 @@ docker-run-%:
 	@$(MAKE) docker-run TEST=$(CMD) IMAGE=qemu:$(IMAGE)
 
 docker-clean:
-	$(call quiet-command, $(SRC_PATH)/tests/docker/docker.py clean)
+	$(call quiet-command, $(DOCKER_SCRIPT) clean)
Signature · 1 line
2.17.1
#9 lore raw

PATCH v6 9/49 tests/tcg: move architecture independent tests into subdir

In reply to Alex Bennée

We will want to build these for all supported guest architectures so lets move them all into one place. We also drop test_path at this point because it needs qemu utils and glib bits which is hard to support for cross compiling.

---
v2
- move VPATH and TESTs setup into multiarch/Makefile.target
- remove moved bits from tests/tcg/Makefile
v3
- use LDFLAGS+= for testthread linking
v4
- make myself MAINTAINER for tests/tcg/multiarch
v5
- split test-mmap into run-test-mmap and run-test-mmap-%

---
 MAINTAINERS                            |   4 +
 tests/tcg/Makefile                     |  31 -----
 tests/tcg/README                       |  10 +-
 tests/tcg/multiarch/Makefile.target    |  36 ++++++
 tests/tcg/multiarch/README             |   1 +
 tests/tcg/{ => multiarch}/linux-test.c |   0
 tests/tcg/{ => multiarch}/sha1.c       |   0
 tests/tcg/{ => multiarch}/test-mmap.c  |   0
 tests/tcg/{ => multiarch}/testthread.c |   0
 tests/tcg/test_path.c                  | 157 -------------------------
 10 files changed, 45 insertions(+), 194 deletions(-)
 create mode 100644 tests/tcg/multiarch/Makefile.target
 create mode 100644 tests/tcg/multiarch/README
 rename tests/tcg/{ => multiarch}/linux-test.c (100%)
 rename tests/tcg/{ => multiarch}/sha1.c (100%)
 rename tests/tcg/{ => multiarch}/test-mmap.c (100%)
 rename tests/tcg/{ => multiarch}/testthread.c (100%)
 delete mode 100644 tests/tcg/test_path.c
MAINTAINERS +4 -0
index 4c73c16fee..b8f6c90122 100644
@@ -303,6 +303,10 @@ F: target/tricore/
 F: hw/tricore/
 F: include/hw/tricore/
 
+Multiarch Linux User Tests
+M: Alex Bennée <[email protected]>
+F: tests/tcg/multiarch/
+
 Guest CPU Cores (KVM):
 ----------------------
 
tests/tcg/Makefile +0 -31
index 89e3342f3d..e12395117a 100644
@@ -18,12 +18,9 @@ LDFLAGS=
 # also, pi_10.com runs indefinitely
 
 I386_TESTS=hello-i386 \
-	   linux-test \
-	   testthread \
 	   sha1-i386 \
 	   test-i386 \
 	   test-i386-fprem \
-	   test-mmap \
 	   # runcom
 
 # native i386 compilers sometimes are not biarch.  assume cross-compilers are
@@ -47,8 +44,6 @@ run-%: %
 	-$(QEMU) ./$*
 
 run-hello-i386: hello-i386
-run-linux-test: linux-test
-run-testthread: testthread
 run-sha1-i386: sha1-i386
 
 run-test-i386: test-i386
@@ -66,11 +61,6 @@ run-test-x86_64: test-x86_64
 	-$(QEMU_X86_64) test-x86_64 > test-x86_64.out
 	@if diff -u test-x86_64.ref test-x86_64.out ; then echo "Auto Test OK"; fi
 
-run-test-mmap: test-mmap
-	-$(QEMU) ./test-mmap
-	-$(QEMU) -p 8192 ./test-mmap 8192
-	-$(QEMU) -p 16384 ./test-mmap 16384
-	-$(QEMU) -p 32768 ./test-mmap 32768
 
 run-runcom: runcom
 	-$(QEMU) ./runcom $(SRC_PATH)/tests/pi_10.com
@@ -80,17 +70,10 @@ run-test_path: test_path
 
 # rules to compile tests
 
-test_path: test_path.o
-
-test_path.o: test_path.c
-
 hello-i386: hello-i386.c
 	$(CC_I386) -nostdlib $(CFLAGS) -static $(LDFLAGS) -o $@ $<
 	strip $@
 
-testthread: testthread.c
-	$(CC_I386) $(CFLAGS) $(LDFLAGS) -o $@ $< -lpthread
-
 # i386/x86_64 emulation test (test various opcodes) */
 test-i386: test-i386.c test-i386-code16.S test-i386-vm86.S \
            test-i386.h test-i386-shift.h test-i386-muldiv.h
@@ -104,28 +87,14 @@ test-x86_64: test-i386.c \
            test-i386.h test-i386-shift.h test-i386-muldiv.h
 	$(CC_X86_64) $(QEMU_INCLUDES) $(CFLAGS) $(LDFLAGS) -o $@ $(<D)/test-i386.c -lm
 
-# generic Linux and CPU test
-linux-test: linux-test.c
-	$(CC_I386) $(CFLAGS) $(LDFLAGS) -o $@ $< -lm
-
 # vm86 test
 runcom: runcom.c
 	$(CC_I386) $(CFLAGS) $(LDFLAGS) -o $@ $<
 
-test-mmap: test-mmap.c
-	$(CC_I386) -m32 $(CFLAGS) -Wall -O2 $(LDFLAGS) -o $@ $<
-
 # speed test
 sha1-i386: sha1.c
 	$(CC_I386) $(CFLAGS) $(LDFLAGS) -o $@ $<
 
-sha1: sha1.c
-	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
-
-speed: sha1 sha1-i386
-	time ./sha1
-	time $(QEMU) ./sha1-i386
-
 # arm test
 hello-arm: hello-arm.o
 	arm-linux-ld -o $@ $<
tests/tcg/README +4 -6
index 5dcfb4852b..0890044cf0 100644
@@ -1,9 +1,7 @@
-This directory contains various interesting programs for
-regression testing.
-
-The target "make test" runs the programs and, if applicable,
-runs "diff" to detect mismatches between output on the host and
-output on QEMU.
+This directory contains various interesting guest programs for
+regression testing. Tests are either multi-arch, meaning they can be
+built for all guest architectures that support linux-user executable,
+or they are architecture specific.
 
 i386
 ====
tests/tcg/multiarch/Makefile.target new file +36 -0
new file mode 100644
index 0000000000..90e45a881e
@@ -0,0 +1,36 @@
+# -*- Mode: makefile -*-
+#
+# Multiarch Tests - included from tests/tcg/Makefile.target
+#
+# These tests are plain C and built without any architecture specific code.
+#
+
+MULTIARCH_SRC=$(SRC_PATH)/tests/tcg/multiarch
+
+# Set search path for all sources
+VPATH 		+= $(MULTIARCH_SRC)
+MULTIARCH_SRCS   =$(notdir $(wildcard $(MULTIARCH_SRC)/*.c))
+MULTIARCH_TESTS  =$(MULTIARCH_SRCS:.c=)
+
+# Update TESTS
+TESTS		+=$(MULTIARCH_TESTS)
+
+#
+# The following are any additional rules needed to build things
+#
+
+testthread: LDFLAGS+=-lpthread
+
+# We define the runner for test-mmap after the individual
+# architectures have defined their supported pages sizes. If no
+# additional page sizes are defined we only run the default test.
+
+# default case (host page size)
+run-test-mmap: test-mmap
+	$(call quiet-command, $(QEMU) $< > test-mmap.out, "TEST", \
+		"$< (default) on $(TARGET_NAME)")
+
+# additional page sizes (defined by each architecture adding to EXTRA_RUNS)
+run-test-mmap-%: test-mmap
+	$(call quiet-command, $(QEMU) -p $* $< > test-mmap-$*.out, "TEST", \
+		"$< ($* byte pages) on $(TARGET_NAME)")
tests/tcg/multiarch/README new file +1 -0
new file mode 100644
index 0000000000..522c9d2ea3
@@ -0,0 +1 @@
+Multi-architecture linux-user tests
tests/tcg/multiarch/linux-test.c renamed from tests/tcg/linux-test.c +0 -0
similarity index 100%
rename from tests/tcg/linux-test.c
rename to tests/tcg/multiarch/linux-test.c
tests/tcg/multiarch/sha1.c renamed from tests/tcg/sha1.c +0 -0
similarity index 100%
rename from tests/tcg/sha1.c
rename to tests/tcg/multiarch/sha1.c
tests/tcg/multiarch/test-mmap.c renamed from tests/tcg/test-mmap.c +0 -0
similarity index 100%
rename from tests/tcg/test-mmap.c
rename to tests/tcg/multiarch/test-mmap.c
tests/tcg/multiarch/testthread.c renamed from tests/tcg/testthread.c +0 -0
similarity index 100%
rename from tests/tcg/testthread.c
rename to tests/tcg/multiarch/testthread.c
tests/tcg/test_path.c deleted +0 -157

157 lines not on this page · raw message

Signature · 1 line
2.17.1
#10 lore raw

PATCH v6 10/49 tests/tcg/multiarch: Build fix for linux-test

In reply to Alex Bennée

From: Fam Zheng <[email protected]>

To keep the compiler happy, and to fit in our buildsys flags:

- Make local functions "static"
- #ifdef out unused functions
- drop cutils/osdep dependencies

---
 tests/tcg/multiarch/linux-test.c | 68 ++++++++++----------------------
 1 file changed, 21 insertions(+), 47 deletions(-)
tests/tcg/multiarch/linux-test.c +21 -47
index 5070d31446..4457bd04ba 100644
@@ -16,7 +16,6 @@
  *  You should have received a copy of the GNU General Public License
  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
-#define _GNU_SOURCE
 #include <stdarg.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -31,6 +30,7 @@
 #include <utime.h>
 #include <time.h>
 #include <sys/time.h>
+#include <sys/resource.h>
 #include <sys/uio.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
@@ -39,13 +39,12 @@
 #include <dirent.h>
 #include <setjmp.h>
 #include <sys/shm.h>
-#include "qemu/cutils.h"
 
 #define TESTPATH "/tmp/linux-test.tmp"
 #define TESTPORT 7654
 #define STACK_SIZE 16384
 
-void error1(const char *filename, int line, const char *fmt, ...)
+static void error1(const char *filename, int line, const char *fmt, ...)
 {
     va_list ap;
     va_start(ap, fmt);
@@ -56,7 +55,7 @@ void error1(const char *filename, int line, const char *fmt, ...)
     exit(1);
 }
 
-int __chk_error(const char *filename, int line, int ret)
+static int __chk_error(const char *filename, int line, int ret)
 {
     if (ret < 0) {
         error1(filename, line, "%m (ret=%d, errno=%d)",
@@ -73,7 +72,7 @@ int __chk_error(const char *filename, int line, int ret)
 
 #define FILE_BUF_SIZE 300
 
-void test_file(void)
+static void test_file(void)
 {
     int fd, i, len, ret;
     uint8_t buf[FILE_BUF_SIZE];
@@ -210,7 +209,7 @@ void test_file(void)
     chk_error(rmdir(TESTPATH));
 }
 
-void test_fork(void)
+static void test_fork(void)
 {
     int pid, status;
 
@@ -224,7 +223,7 @@ void test_fork(void)
         error("waitpid status=0x%x", status);
 }
 
-void test_time(void)
+static void test_time(void)
 {
     struct timeval tv, tv2;
     struct timespec ts, rem;
@@ -251,34 +250,7 @@ void test_time(void)
         error("getrusage");
 }
 
-void pstrcpy(char *buf, int buf_size, const char *str)
-{
-    int c;
-    char *q = buf;
-
-    if (buf_size <= 0)
-        return;
-
-    for(;;) {
-        c = *str++;
-        if (c == 0 || q >= buf + buf_size - 1)
-            break;
-        *q++ = c;
-    }
-    *q = '\0';
-}
-
-/* strcat and truncate. */
-char *pstrcat(char *buf, int buf_size, const char *s)
-{
-    int len;
-    len = strlen(buf);
-    if (len < buf_size)
-        pstrcpy(buf + len, buf_size - len, s);
-    return buf;
-}
-
-int server_socket(void)
+static int server_socket(void)
 {
     int val, fd;
     struct sockaddr_in sockaddr;
@@ -298,7 +270,7 @@ int server_socket(void)
 
 }
 
-int client_socket(void)
+static int client_socket(void)
 {
     int fd;
     struct sockaddr_in sockaddr;
@@ -312,9 +284,9 @@ int client_socket(void)
     return fd;
 }
 
-const char socket_msg[] = "hello socket\n";
+static const char socket_msg[] = "hello socket\n";
 
-void test_socket(void)
+static void test_socket(void)
 {
     int server_fd, client_fd, fd, pid, ret, val;
     struct sockaddr_in sockaddr;
@@ -348,9 +320,10 @@ void test_socket(void)
     chk_error(close(server_fd));
 }
 
+#if 0
 #define WCOUNT_MAX 512
 
-void test_pipe(void)
+static void test_pipe(void)
 {
     fd_set rfds, wfds;
     int fds[2], fd_max, ret;
@@ -391,10 +364,10 @@ void test_pipe(void)
     chk_error(close(fds[1]));
 }
 
-int thread1_res;
-int thread2_res;
+static int thread1_res;
+static int thread2_res;
 
-int thread1_func(void *arg)
+static int thread1_func(void *arg)
 {
     int i;
     for(i=0;i<5;i++) {
@@ -404,7 +377,7 @@ int thread1_func(void *arg)
     return 0;
 }
 
-int thread2_func(void *arg)
+static int thread2_func(void *arg)
 {
     int i;
     for(i=0;i<6;i++) {
@@ -435,27 +408,28 @@ void test_clone(void)
         thread2_res != 6)
         error("clone");
 }
+#endif
 
 /***********************************/
 
 volatile int alarm_count;
 jmp_buf jmp_env;
 
-void sig_alarm(int sig)
+static void sig_alarm(int sig)
 {
     if (sig != SIGALRM)
         error("signal");
     alarm_count++;
 }
 
-void sig_segv(int sig, siginfo_t *info, void *puc)
+static void sig_segv(int sig, siginfo_t *info, void *puc)
 {
     if (sig != SIGSEGV)
         error("signal");
     longjmp(jmp_env, 1);
 }
 
-void test_signal(void)
+static void test_signal(void)
 {
     struct sigaction act;
     struct itimerval it, oit;
@@ -510,7 +484,7 @@ void test_signal(void)
 
 #define SHM_SIZE 32768
 
-void test_shm(void)
+static void test_shm(void)
 {
     void *ptr;
     int shmid;
Signature · 1 line
2.17.1
#11 lore raw

PATCH v6 11/49 tests/tcg/multiarch: enable additional linux-test tests

In reply to Alex Bennée

Un-comment the remaining tests.

I removed the itimer value tests because I'm fairly sure a re-arming timer will always have a different value in it when you grab it.

I've also fixed up the clone thread flags as QEMU will only allow a clone to use flags which match glibc. However the test is still racey so it remains disabled by default - it can be run by passing any additional parameters on the command line.

---
v3
- make clone flags match CLONE_THREAD_FLAGS
v4
- disable test_clone for default case

---
 tests/tcg/multiarch/linux-test.c | 51 +++++++++++++++++++++-----------
 1 file changed, 33 insertions(+), 18 deletions(-)
tests/tcg/multiarch/linux-test.c +33 -18
index 4457bd04ba..6f2c531474 100644
@@ -16,6 +16,7 @@
  *  You should have received a copy of the GNU General Public License
  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
+#define _GNU_SOURCE
 #include <stdarg.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -58,8 +59,8 @@ static void error1(const char *filename, int line, const char *fmt, ...)
 static int __chk_error(const char *filename, int line, int ret)
 {
     if (ret < 0) {
-        error1(filename, line, "%m (ret=%d, errno=%d)",
-               ret, errno);
+        error1(filename, line, "%m (ret=%d, errno=%d/%s)",
+               ret, errno, strerror(errno));
     }
     return ret;
 }
@@ -216,6 +217,7 @@ static void test_fork(void)
     pid = chk_error(fork());
     if (pid == 0) {
         /* child */
+        sleep(2);
         exit(2);
     }
     chk_error(waitpid(pid, &status, 0));
@@ -320,7 +322,6 @@ static void test_socket(void)
     chk_error(close(server_fd));
 }
 
-#if 0
 #define WCOUNT_MAX 512
 
 static void test_pipe(void)
@@ -355,7 +356,7 @@ static void test_pipe(void)
             }
             if (FD_ISSET(fds[1], &wfds)) {
                 ch = 'a';
-                chk_error(write(fds[0], &ch, 1));
+                chk_error(write(fds[1], &ch, 1));
                 wcount++;
             }
         }
@@ -387,28 +388,41 @@ static int thread2_func(void *arg)
     return 0;
 }
 
-void test_clone(void)
+static void wait_for_child(pid_t pid)
+{
+    int status;
+    chk_error(waitpid(pid, &status, 0));
+}
+
+/* For test_clone we must match the clone flags used by glibc, see
+ * CLONE_THREAD_FLAGS in the QEMU source code.
+ */
+static void test_clone(void)
 {
     uint8_t *stack1, *stack2;
-    int pid1, pid2, status1, status2;
+    pid_t pid1, pid2;
 
     stack1 = malloc(STACK_SIZE);
     pid1 = chk_error(clone(thread1_func, stack1 + STACK_SIZE,
-                           CLONE_VM | CLONE_FS | CLONE_FILES | SIGCHLD, "hello1"));
+                           CLONE_VM | CLONE_FS | CLONE_FILES |
+                           CLONE_SIGHAND | CLONE_THREAD | CLONE_SYSVSEM,
+                            "hello1"));
 
     stack2 = malloc(STACK_SIZE);
     pid2 = chk_error(clone(thread2_func, stack2 + STACK_SIZE,
-                           CLONE_VM | CLONE_FS | CLONE_FILES | SIGCHLD, "hello2"));
+                           CLONE_VM | CLONE_FS | CLONE_FILES |
+                           CLONE_SIGHAND | CLONE_THREAD | CLONE_SYSVSEM,
+                           "hello2"));
 
-    while (waitpid(pid1, &status1, 0) != pid1);
+    wait_for_child(pid1);
     free(stack1);
-    while (waitpid(pid2, &status2, 0) != pid2);
+    wait_for_child(pid2);
     free(stack2);
+
     if (thread1_res != 5 ||
         thread2_res != 6)
         error("clone");
 }
-#endif
 
 /***********************************/
 
@@ -449,12 +463,10 @@ static void test_signal(void)
     it.it_value.tv_usec = 10 * 1000;
     chk_error(setitimer(ITIMER_REAL, &it, NULL));
     chk_error(getitimer(ITIMER_REAL, &oit));
-    if (oit.it_value.tv_sec != it.it_value.tv_sec ||
-        oit.it_value.tv_usec != it.it_value.tv_usec)
-        error("itimer");
 
     while (alarm_count < 5) {
         usleep(10 * 1000);
+        getitimer(ITIMER_REAL, &oit);
     }
 
     it.it_interval.tv_sec = 0;
@@ -463,9 +475,6 @@ static void test_signal(void)
     it.it_value.tv_usec = 0;
     memset(&oit, 0xff, sizeof(oit));
     chk_error(setitimer(ITIMER_REAL, &it, &oit));
-    if (oit.it_value.tv_sec != 0 ||
-        oit.it_value.tv_usec != 10 * 1000)
-        error("setitimer");
 
     /* SIGSEGV test */
     act.sa_sigaction = sig_segv;
@@ -503,10 +512,16 @@ static void test_shm(void)
 int main(int argc, char **argv)
 {
     test_file();
+    test_pipe();
     test_fork();
     test_time();
     test_socket();
-    //    test_clone();
+
+    if (argc > 1) {
+        printf("test_clone still considered buggy\n");
+        test_clone();
+    }
+
     test_signal();
     test_shm();
     return 0;
Signature · 1 line
2.17.1
#12 lore raw

PATCH v6 12/49 tests/tcg/multiarch: move most output to stdout

In reply to Alex Bennée

The default test run outputs to stdout so it can be re-directed. Errors are still reported to stderr.

---
v4
- remove space in fprintf () to keep checkpatch happy

---
 tests/tcg/multiarch/test-mmap.c | 40 ++++++++++++++++-----------------
 1 file changed, 20 insertions(+), 20 deletions(-)
tests/tcg/multiarch/test-mmap.c +20 -20
index cdefadfa4c..5c0afe6e49 100644
@@ -36,7 +36,7 @@
 do                                                             \
 {                                                              \
   if (!(x)) {                                                  \
-    fprintf (stderr, "FAILED at %s:%d\n", __FILE__, __LINE__); \
+    fprintf(stderr, "FAILED at %s:%d\n", __FILE__, __LINE__); \
     exit (EXIT_FAILURE);                                       \
   }                                                            \
 } while (0)
@@ -57,7 +57,7 @@ void check_aligned_anonymous_unfixed_mmaps(void)
 	uintptr_t p;
 	int i;
 
-	fprintf (stderr, "%s", __func__);
+	fprintf(stdout, "%s", __func__);
 	for (i = 0; i < 0x1fff; i++)
 	{
 		size_t len;
@@ -106,7 +106,7 @@ void check_aligned_anonymous_unfixed_mmaps(void)
 		munmap (p4, len);
 		munmap (p5, len);
 	}
-	fprintf (stderr, " passed\n");
+	fprintf(stdout, " passed\n");
 }
 
 void check_large_anonymous_unfixed_mmap(void)
@@ -115,7 +115,7 @@ void check_large_anonymous_unfixed_mmap(void)
 	uintptr_t p;
 	size_t len;
 
-	fprintf (stderr, "%s", __func__);
+	fprintf(stdout, "%s", __func__);
 
 	len = 0x02000000;
 	p1 = mmap(NULL, len, PROT_READ, 
@@ -130,7 +130,7 @@ void check_large_anonymous_unfixed_mmap(void)
 	/* Make sure we can read from the entire area.  */
 	memcpy (dummybuf, p1, pagesize);
 	munmap (p1, len);
-	fprintf (stderr, " passed\n");
+	fprintf(stdout, " passed\n");
 }
 
 void check_aligned_anonymous_unfixed_colliding_mmaps(void)
@@ -141,7 +141,7 @@ void check_aligned_anonymous_unfixed_colliding_mmaps(void)
 	uintptr_t p;
 	int i;
 
-	fprintf (stderr, "%s", __func__);
+	fprintf(stdout, "%s", __func__);
 	for (i = 0; i < 0x2fff; i++)
 	{
 		int nlen;
@@ -180,7 +180,7 @@ void check_aligned_anonymous_unfixed_colliding_mmaps(void)
 		munmap (p2, pagesize);
 		munmap (p3, nlen);
 	}
-	fprintf (stderr, " passed\n");
+	fprintf(stdout, " passed\n");
 }
 
 void check_aligned_anonymous_fixed_mmaps(void)
@@ -194,7 +194,7 @@ void check_aligned_anonymous_fixed_mmaps(void)
 	addr = mmap(NULL, pagesize * 40, PROT_READ | PROT_WRITE, 
 		    MAP_PRIVATE | MAP_ANONYMOUS,
 		    -1, 0);
-	fprintf (stderr, "%s addr=%p", __func__, addr);
+	fprintf(stdout, "%s addr=%p", __func__, addr);
 	fail_unless (addr != MAP_FAILED);
 
 	for (i = 0; i < 40; i++)
@@ -212,7 +212,7 @@ void check_aligned_anonymous_fixed_mmaps(void)
 		munmap (p1, pagesize);
 		addr += pagesize;
 	}
-	fprintf (stderr, " passed\n");
+	fprintf(stdout, " passed\n");
 }
 
 void check_aligned_anonymous_fixed_mmaps_collide_with_host(void)
@@ -225,8 +225,8 @@ void check_aligned_anonymous_fixed_mmaps_collide_with_host(void)
 	/* Find a suitable address to start with.  Right were the x86 hosts
 	 stack is.  */
 	addr = ((void *)0x80000000);
-	fprintf (stderr, "%s addr=%p", __func__, addr);
-	fprintf (stderr, "FIXME: QEMU fails to track pages used by the host.");
+	fprintf(stdout, "%s addr=%p", __func__, addr);
+	fprintf(stdout, "FIXME: QEMU fails to track pages used by the host.");
 
 	for (i = 0; i < 20; i++)
 	{
@@ -243,7 +243,7 @@ void check_aligned_anonymous_fixed_mmaps_collide_with_host(void)
 		munmap (p1, pagesize);
 		addr += pagesize;
 	}
-	fprintf (stderr, " passed\n");
+	fprintf(stdout, " passed\n");
 }
 
 void check_file_unfixed_mmaps(void)
@@ -252,7 +252,7 @@ void check_file_unfixed_mmaps(void)
 	uintptr_t p;
 	int i;
 
-	fprintf (stderr, "%s", __func__);
+	fprintf(stdout, "%s", __func__);
 	for (i = 0; i < 0x10; i++)
 	{
 		size_t len;
@@ -294,7 +294,7 @@ void check_file_unfixed_mmaps(void)
 		munmap (p2, len);
 		munmap (p3, len);
 	}
-	fprintf (stderr, " passed\n");
+	fprintf(stdout, " passed\n");
 }
 
 void check_file_unfixed_eof_mmaps(void)
@@ -304,7 +304,7 @@ void check_file_unfixed_eof_mmaps(void)
 	uintptr_t p;
 	int i;
 
-	fprintf (stderr, "%s", __func__);
+	fprintf(stdout, "%s", __func__);
 	for (i = 0; i < 0x10; i++)
 	{
 		p1 = mmap(NULL, pagesize, PROT_READ, 
@@ -327,7 +327,7 @@ void check_file_unfixed_eof_mmaps(void)
 		fail_unless (cp[pagesize - 4] == 0);
 		munmap (p1, pagesize);
 	}
-	fprintf (stderr, " passed\n");
+	fprintf(stdout, " passed\n");
 }
 
 void check_file_fixed_eof_mmaps(void)
@@ -343,7 +343,7 @@ void check_file_fixed_eof_mmaps(void)
 		    MAP_PRIVATE | MAP_ANONYMOUS,
 		    -1, 0);
 
-	fprintf (stderr, "%s addr=%p", __func__, (void *)addr);
+	fprintf(stdout, "%s addr=%p", __func__, (void *)addr);
 	fail_unless (addr != MAP_FAILED);
 
 	for (i = 0; i < 0x10; i++)
@@ -371,7 +371,7 @@ void check_file_fixed_eof_mmaps(void)
 		munmap (p1, pagesize);
 		addr += pagesize;
 	}
-	fprintf (stderr, " passed\n");
+	fprintf(stdout, " passed\n");
 }
 
 void check_file_fixed_mmaps(void)
@@ -384,7 +384,7 @@ void check_file_fixed_mmaps(void)
 	addr = mmap(NULL, pagesize * 40 * 4, PROT_READ, 
 		    MAP_PRIVATE | MAP_ANONYMOUS,
 		    -1, 0);
-	fprintf (stderr, "%s addr=%p", __func__, (void *)addr);
+	fprintf(stdout, "%s addr=%p", __func__, (void *)addr);
 	fail_unless (addr != MAP_FAILED);
 
 	for (i = 0; i < 40; i++)
@@ -426,7 +426,7 @@ void check_file_fixed_mmaps(void)
 		munmap (p4, pagesize);
 		addr += pagesize * 4;
 	}
-	fprintf (stderr, " passed\n");
+	fprintf(stdout, " passed\n");
 }
 
 void checked_write(int fd, const void *buf, size_t count)
Signature · 1 line
2.17.1
#13 lore raw

PATCH v6 13/49 tests/tcg: move i386 specific tests into subdir

In reply to Alex Bennée

These only need to be built for i386 guests. This includes a stub tests/tcg/i386/Makfile.target which absorbs some of what was in tests/tcg/Makefile.

---
v2
- move VPATH and TESTs setup into i386/Makefile.target
- set CFLAGS+=-m32 for cross building
v4
- update MAINATINERS

---
 MAINTAINERS                             |   1 +
 tests/tcg/README                        |  39 ------------------------
 tests/tcg/i386/Makefile.target          |  30 ++++++++++++++++++
 tests/tcg/i386/README                   |  38 +++++++++++++++++++++++
 tests/tcg/{ => i386}/hello-i386.c       |   0
 tests/tcg/{ => i386}/pi_10.com          | Bin
 tests/tcg/{ => i386}/runcom.c           |   0
 tests/tcg/{ => i386}/test-i386-code16.S |   0
 tests/tcg/{ => i386}/test-i386-fprem.c  |   0
 tests/tcg/{ => i386}/test-i386-muldiv.h |   0
 tests/tcg/{ => i386}/test-i386-shift.h  |   0
 tests/tcg/{ => i386}/test-i386-ssse3.c  |   0
 tests/tcg/{ => i386}/test-i386-vm86.S   |   0
 tests/tcg/{ => i386}/test-i386.c        |   0
 tests/tcg/{ => i386}/test-i386.h        |   0
 15 files changed, 69 insertions(+), 39 deletions(-)
 create mode 100644 tests/tcg/i386/Makefile.target
 create mode 100644 tests/tcg/i386/README
 rename tests/tcg/{ => i386}/hello-i386.c (100%)
 rename tests/tcg/{ => i386}/pi_10.com (100%)
 rename tests/tcg/{ => i386}/runcom.c (100%)
 rename tests/tcg/{ => i386}/test-i386-code16.S (100%)
 rename tests/tcg/{ => i386}/test-i386-fprem.c (100%)
 rename tests/tcg/{ => i386}/test-i386-muldiv.h (100%)
 rename tests/tcg/{ => i386}/test-i386-shift.h (100%)
 rename tests/tcg/{ => i386}/test-i386-ssse3.c (100%)
 rename tests/tcg/{ => i386}/test-i386-vm86.S (100%)
 rename tests/tcg/{ => i386}/test-i386.c (100%)
 rename tests/tcg/{ => i386}/test-i386.h (100%)
MAINTAINERS +1 -0
index b8f6c90122..e795b8186e 100644
@@ -283,6 +283,7 @@ M: Richard Henderson <[email protected]>
 M: Eduardo Habkost <[email protected]>
 S: Maintained
 F: target/i386/
+F: tests/tcg/i386/
 F: hw/i386/
 F: disas/i386.c
 T: git git://github.com/ehabkost/qemu.git x86-next
tests/tcg/README +0 -39
index 0890044cf0..469504c4cb 100644
@@ -3,45 +3,6 @@ regression testing. Tests are either multi-arch, meaning they can be
 built for all guest architectures that support linux-user executable,
 or they are architecture specific.
 
-i386
-====
-
-test-i386
----------
-
-This program executes most of the 16 bit and 32 bit x86 instructions and
-generates a text output, for comparison with the output obtained with
-a real CPU or another emulator.
-
-The Linux system call modify_ldt() is used to create x86 selectors
-to test some 16 bit addressing and 32 bit with segmentation cases.
-
-The Linux system call vm86() is used to test vm86 emulation.
-
-Various exceptions are raised to test most of the x86 user space
-exception reporting.
-
-linux-test
-----------
-
-This program tests various Linux system calls. It is used to verify
-that the system call parameters are correctly converted between target
-and host CPUs.
-
-test-i386-fprem
----------------
-
-runcom
-------
-
-test-mmap
----------
-
-sha1
-----
-
-hello-i386
-----------
 
 
 ARM
tests/tcg/i386/Makefile.target new file +30 -0
new file mode 100644
index 0000000000..2f27b65e2d
@@ -0,0 +1,30 @@
+# i386 cross compile notes
+
+I386_SRC=$(SRC_PATH)/tests/tcg/i386
+
+# Set search path for all sources
+VPATH 		+= $(I386_SRC)
+
+I386_SRCS=$(notdir $(wildcard $(I386_SRC)/*.c))
+I386_TESTS=$(I386_SRCS:.c=)
+
+# Update TESTS
+TESTS+=$(I386_TESTS)
+
+ifneq ($(TARGET_NAME),x86_64)
+CFLAGS+=-m32
+endif
+
+#
+# hello-i386 is a barebones app
+#
+hello-i386: CFLAGS+=-ffreestanding
+hello-i386: LDFLAGS+=-nostdlib
+
+#
+# test-386 includes a couple of additional objects that need to be linked together
+#
+
+test-i386: test-i386.c test-i386-code16.S test-i386-vm86.S test-i386.h test-i386-shift.h test-i386-muldiv.h
+	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ \
+	   $(<D)/test-i386.c $(<D)/test-i386-code16.S $(<D)/test-i386-vm86.S -lm
tests/tcg/i386/README new file +38 -0
new file mode 100644
index 0000000000..7a0a47bf27
@@ -0,0 +1,38 @@
+These are i386 specific guest programs
+
+test-i386
+---------
+
+This program executes most of the 16 bit and 32 bit x86 instructions and
+generates a text output, for comparison with the output obtained with
+a real CPU or another emulator.
+
+The Linux system call modify_ldt() is used to create x86 selectors
+to test some 16 bit addressing and 32 bit with segmentation cases.
+
+The Linux system call vm86() is used to test vm86 emulation.
+
+Various exceptions are raised to test most of the x86 user space
+exception reporting.
+
+linux-test
+----------
+
+This program tests various Linux system calls. It is used to verify
+that the system call parameters are correctly converted between target
+and host CPUs.
+
+test-i386-fprem
+---------------
+
+runcom
+------
+
+test-mmap
+---------
+
+sha1
+----
+
+hello-i386
+----------
tests/tcg/i386/hello-i386.c renamed from tests/tcg/hello-i386.c +0 -0
similarity index 100%
rename from tests/tcg/hello-i386.c
rename to tests/tcg/i386/hello-i386.c
tests/tcg/i386/pi_10.com renamed from tests/tcg/pi_10.com +0 -0
similarity index 100%
rename from tests/tcg/pi_10.com
rename to tests/tcg/i386/pi_10.com
tests/tcg/i386/runcom.c renamed from tests/tcg/runcom.c +0 -0
similarity index 100%
rename from tests/tcg/runcom.c
rename to tests/tcg/i386/runcom.c
tests/tcg/i386/test-i386-code16.S renamed from tests/tcg/test-i386-code16.S +0 -0
similarity index 100%
rename from tests/tcg/test-i386-code16.S
rename to tests/tcg/i386/test-i386-code16.S
tests/tcg/i386/test-i386-fprem.c renamed from tests/tcg/test-i386-fprem.c +0 -0
similarity index 100%
rename from tests/tcg/test-i386-fprem.c
rename to tests/tcg/i386/test-i386-fprem.c
tests/tcg/i386/test-i386-muldiv.h renamed from tests/tcg/test-i386-muldiv.h +0 -0
similarity index 100%
rename from tests/tcg/test-i386-muldiv.h
rename to tests/tcg/i386/test-i386-muldiv.h
tests/tcg/i386/test-i386-shift.h renamed from tests/tcg/test-i386-shift.h +0 -0
similarity index 100%
rename from tests/tcg/test-i386-shift.h
rename to tests/tcg/i386/test-i386-shift.h
tests/tcg/i386/test-i386-ssse3.c renamed from tests/tcg/test-i386-ssse3.c +0 -0
similarity index 100%
rename from tests/tcg/test-i386-ssse3.c
rename to tests/tcg/i386/test-i386-ssse3.c
tests/tcg/i386/test-i386-vm86.S renamed from tests/tcg/test-i386-vm86.S +0 -0
similarity index 100%
rename from tests/tcg/test-i386-vm86.S
rename to tests/tcg/i386/test-i386-vm86.S
tests/tcg/i386/test-i386.c renamed from tests/tcg/test-i386.c +0 -0
similarity index 100%
rename from tests/tcg/test-i386.c
rename to tests/tcg/i386/test-i386.c
tests/tcg/i386/test-i386.h renamed from tests/tcg/test-i386.h +0 -0
similarity index 100%
rename from tests/tcg/test-i386.h
rename to tests/tcg/i386/test-i386.h
Signature · 1 line
2.17.1
#14 lore raw

PATCH v6 14/49 tests/tcg: enable building for i386

In reply to Alex Bennée

While you can construct a compile command that does work using the x86_64 host compiler that most people use this is flakey. Different distros handle this is different ways so we default to using a known good i386 compiler via docker.

---
v3
- add runner for runcom
v4
- runcom pi10.com directly from SRC_DIR
v5
- define extra test-mmap runs

---
 tests/tcg/i386/Makefile.include | 9 +++++++++
 tests/tcg/i386/Makefile.target  | 7 +++++++
 2 files changed, 16 insertions(+)
 create mode 100644 tests/tcg/i386/Makefile.include
tests/tcg/i386/Makefile.include new file +9 -0
new file mode 100644
index 0000000000..be1c3008dd
@@ -0,0 +1,9 @@
+#
+# Makefile.include for all i386
+#
+# There is enough brokeness in x86_64 compilers that we don't default
+# to using the x86_64 system compiler for i386 binaries.
+#
+
+DOCKER_IMAGE=fedora-i386-cross
+DOCKER_CROSS_COMPILER=gcc
tests/tcg/i386/Makefile.target +7 -0
index 2f27b65e2d..8b46cc021e 100644
@@ -28,3 +28,10 @@ hello-i386: LDFLAGS+=-nostdlib
 test-i386: test-i386.c test-i386-code16.S test-i386-vm86.S test-i386.h test-i386-shift.h test-i386-muldiv.h
 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ \
 	   $(<D)/test-i386.c $(<D)/test-i386-code16.S $(<D)/test-i386-vm86.S -lm
+
+# Specialist test runners
+run-runcom: runcom pi_10.com
+	$(call quiet-command, $(QEMU) ./runcom $(I386_SRC)/pi_10.com > runcom.out, "TEST", "$< on $(TARGET_NAME)")
+
+# On i386 and x86_64 Linux only supports 4k pages (large pages are a different hack)
+EXTRA_RUNS+=run-test-mmap-4096
Signature · 1 line
2.17.1
#15 lore raw

PATCH v6 15/49 tests/tcg/i386: Build fix for hello-i386

In reply to Alex Bennée

From: Fam Zheng <[email protected]>

We have -Werror=missing-prototype, add a dummy prototype to avoid that warning.

---
 tests/tcg/i386/hello-i386.c | 1 +
 1 file changed, 1 insertion(+)
tests/tcg/i386/hello-i386.c +1 -0
index fa00380de2..cfeb24b2f5 100644
@@ -20,6 +20,7 @@ static inline int write(int fd, const char * buf, int len)
   return status;
 }
 
+void _start(void);
 void _start(void)
 {
     write(1, "Hello World\n", 12);
Signature · 1 line
2.17.1
#16 lore raw

PATCH v6 16/49 tests/tcg/i386: fix test-i386

In reply to Alex Bennée

We don't include anything from qemu itself for the build.

---
v4
- reword commit message to be more accurate

---
 tests/tcg/i386/test-i386.c | 1 -
 1 file changed, 1 deletion(-)
tests/tcg/i386/test-i386.c +0 -1
index 9599204895..cae6a7773a 100644
@@ -17,7 +17,6 @@
  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 #define _GNU_SOURCE
-#include "qemu/compiler.h"
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
Signature · 1 line
2.17.1
#17 lore raw

PATCH v6 17/49 tests/tcg/i386: add runner for test-i386-fprem

In reply to Alex Bennée

The runner needs to compare against a reference run. We also only run this test when SPEED=slow as it takes a while.

---
v5
- include test-i386-fprem.ref
v5.1
- remove the 69Mb test-i386-fprem.ref
- generate test-i386-fprem.ref on developers machine
- add TIMEOUT=60

---
 tests/tcg/i386/Makefile.target   | 16 ++++++++++++++++
 tests/tcg/i386/test-i386-fprem.c | 12 +++++++++---
 2 files changed, 25 insertions(+), 3 deletions(-)
tests/tcg/i386/Makefile.target +16 -0
index 8b46cc021e..64d241cfdf 100644
@@ -33,5 +33,21 @@ test-i386: test-i386.c test-i386-code16.S test-i386-vm86.S test-i386.h test-i386
 run-runcom: runcom pi_10.com
 	$(call quiet-command, $(QEMU) ./runcom $(I386_SRC)/pi_10.com > runcom.out, "TEST", "$< on $(TARGET_NAME)")
 
+ifeq ($(SPEED), slow)
+
+test-i386-fprem.ref: test-i386-fprem
+	$(call quiet-command, ./$< > $@,"GENREF","generating $@")
+
+run-test-i386-fprem: TIMEOUT=60
+run-test-i386-fprem: test-i386-fprem
+	$(call quiet-command, \
+		$(QEMU) $< > $<.out && \
+		diff -u $(I386_SRC)/$<.ref $<.out, \
+		"TEST", "$< (default) on $(TARGET_NAME)")
+else
+run-test-i386-fprem: test-i386-fprem
+	$(call quiet-command, /bin/true, "SLOW TEST", "$< SKIPPED on $(TARGET_NAME)")
+endif
+
 # On i386 and x86_64 Linux only supports 4k pages (large pages are a different hack)
 EXTRA_RUNS+=run-test-mmap-4096
tests/tcg/i386/test-i386-fprem.c +9 -3
index 1a71623204..66f5a9657d 100644
@@ -23,7 +23,10 @@
  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "qemu/osdep.h"
+#include <stdio.h>
+#include <stdint.h>
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 
 /*
  * Inspired by <ieee754.h>'s union ieee854_long_double, but with single
@@ -39,7 +42,7 @@ union float80u {
         unsigned int exponent:15;
         unsigned int negative:1;
         unsigned int empty:16;
-    } QEMU_PACKED ieee;
+    } __attribute__((packed)) ieee;
 
     /* This is for NaNs in the IEEE 854 double-extended-precision format.  */
     struct {
@@ -49,7 +52,7 @@ union float80u {
         unsigned int exponent:15;
         unsigned int negative:1;
         unsigned int empty:16;
-    } QEMU_PACKED ieee_nan;
+    } __attribute__((packed)) ieee_nan;
 };
 
 #define IEEE854_LONG_DOUBLE_BIAS 0x3fff
@@ -229,6 +232,7 @@ static void test_fprem_cases(void)
     do_fprem_stack_underflow();
 
     printf("= invalid operation =\n");
+    do_fprem(q_nan.d, 1.0);
     do_fprem(s_nan.d, 1.0);
     do_fprem(1.0, 0.0);
     do_fprem(pos_inf.d, 1.0);
@@ -238,6 +242,8 @@ static void test_fprem_cases(void)
     do_fprem(pos_denorm.d, 1.0);
     do_fprem(1.0, pos_denorm.d);
 
+    do_fprem(smallest_positive_norm.d, smallest_positive_norm.d);
+
     /* printf("= underflow =\n"); */
     /* TODO: Is there a case where FPREM raises underflow? */
 }
Signature · 1 line
2.17.1
Reviewed-by Tested-by on v6 17/49
#18 lore raw

Re: [Qemu-devel] [PATCH v6 17/49] tests/tcg/i386: add runner for test-i386-fprem

Quoted 4 lines · Alex Bennée

The runner needs to compare against a reference run. We also only run this test when SPEED=slow as it takes a while.

Quoted 91 lines

---
v5
- include test-i386-fprem.ref
v5.1
- remove the 69Mb test-i386-fprem.ref
- generate test-i386-fprem.ref on developers machine
- add TIMEOUT=60

---
 tests/tcg/i386/Makefile.target   | 16 ++++++++++++++++
 tests/tcg/i386/test-i386-fprem.c | 12 +++++++++---
 2 files changed, 25 insertions(+), 3 deletions(-)
tests/tcg/i386/Makefile.target +16 -0
index 8b46cc021e..64d241cfdf 100644
@@ -33,5 +33,21 @@ test-i386: test-i386.c test-i386-code16.S test-i386-vm86.S test-i386.h test-i386
 run-runcom: runcom pi_10.com
 	$(call quiet-command, $(QEMU) ./runcom $(I386_SRC)/pi_10.com > runcom.out, "TEST", "$< on $(TARGET_NAME)")
 
+ifeq ($(SPEED), slow)
+
+test-i386-fprem.ref: test-i386-fprem
+	$(call quiet-command, ./$< > $@,"GENREF","generating $@")
+
+run-test-i386-fprem: TIMEOUT=60
+run-test-i386-fprem: test-i386-fprem
+	$(call quiet-command, \
+		$(QEMU) $< > $<.out && \
+		diff -u $(I386_SRC)/$<.ref $<.out, \
+		"TEST", "$< (default) on $(TARGET_NAME)")
+else
+run-test-i386-fprem: test-i386-fprem
+	$(call quiet-command, /bin/true, "SLOW TEST", "$< SKIPPED on $(TARGET_NAME)")
+endif
+
 # On i386 and x86_64 Linux only supports 4k pages (large pages are a different hack)
 EXTRA_RUNS+=run-test-mmap-4096
tests/tcg/i386/test-i386-fprem.c +9 -3
index 1a71623204..66f5a9657d 100644
@@ -23,7 +23,10 @@
  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "qemu/osdep.h"
+#include <stdio.h>
+#include <stdint.h>
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 
 /*
  * Inspired by <ieee754.h>'s union ieee854_long_double, but with single
@@ -39,7 +42,7 @@ union float80u {
         unsigned int exponent:15;
         unsigned int negative:1;
         unsigned int empty:16;
-    } QEMU_PACKED ieee;
+    } __attribute__((packed)) ieee;
 
     /* This is for NaNs in the IEEE 854 double-extended-precision format.  */
     struct {
@@ -49,7 +52,7 @@ union float80u {
         unsigned int exponent:15;
         unsigned int negative:1;
         unsigned int empty:16;
-    } QEMU_PACKED ieee_nan;
+    } __attribute__((packed)) ieee_nan;
 };
 
 #define IEEE854_LONG_DOUBLE_BIAS 0x3fff
@@ -229,6 +232,7 @@ static void test_fprem_cases(void)
     do_fprem_stack_underflow();
 
     printf("= invalid operation =\n");
+    do_fprem(q_nan.d, 1.0);
     do_fprem(s_nan.d, 1.0);
     do_fprem(1.0, 0.0);
     do_fprem(pos_inf.d, 1.0);
@@ -238,6 +242,8 @@ static void test_fprem_cases(void)
     do_fprem(pos_denorm.d, 1.0);
     do_fprem(1.0, pos_denorm.d);
 
+    do_fprem(smallest_positive_norm.d, smallest_positive_norm.d);
+
     /* printf("= underflow =\n"); */
     /* TODO: Is there a case where FPREM raises underflow? */
 }
#19 lore raw

PATCH v6 18/49 tests/tcg/x86_64: add Makefile.target

In reply to Alex Bennée

The sources for x86_64 are shared in the i386 directory which will be included thanks to TARGET_BASE_ARCH. However not all sources build so we need to filter out the ones we can't build in the 64 bit world and those that can't be built for 32 bit.

---
v4
- update MAINTAINERS
v5
- merge with disable i386 version of test-i386-ssse

---
 MAINTAINERS                      |  1 +
 tests/tcg/i386/Makefile.target   |  4 ++--
 tests/tcg/x86_64/Makefile.target | 15 +++++++++++++++
 3 files changed, 18 insertions(+), 2 deletions(-)
 create mode 100644 tests/tcg/x86_64/Makefile.target
MAINTAINERS +1 -0
index e795b8186e..1063c4d60f 100644
@@ -284,6 +284,7 @@ M: Eduardo Habkost <[email protected]>
 S: Maintained
 F: target/i386/
 F: tests/tcg/i386/
+F: tests/tcg/x86_64/
 F: hw/i386/
 F: disas/i386.c
 T: git git://github.com/ehabkost/qemu.git x86-next
tests/tcg/i386/Makefile.target +2 -2
index 64d241cfdf..cd173363ee 100644
@@ -7,9 +7,9 @@ VPATH 		+= $(I386_SRC)
 
 I386_SRCS=$(notdir $(wildcard $(I386_SRC)/*.c))
 I386_TESTS=$(I386_SRCS:.c=)
-
+I386_ONLY_TESTS=$(filter-out test-i386-ssse3, $(I386_TESTS))
 # Update TESTS
-TESTS+=$(I386_TESTS)
+TESTS+=$(I386_ONLY_TESTS)
 
 ifneq ($(TARGET_NAME),x86_64)
 CFLAGS+=-m32
tests/tcg/x86_64/Makefile.target new file +15 -0
new file mode 100644
index 0000000000..74f170b9ed
@@ -0,0 +1,15 @@
+# -*- Mode: makefile -*-
+#
+# x86_64 tests - included from tests/tcg/Makefile.target
+#
+# Currently we only build test-x86_64 and test-i386-ssse3 from
+# $(SRC)/tests/tcg/i386/
+#
+
+X86_64_TESTS=$(filter-out $(I386_ONLY_TESTS), $(TESTS))
+X86_64_TESTS+=test-x86_64
+TESTS:=$(X86_64_TESTS)
+
+test-x86_64: LDFLAGS+=-lm -lc
+test-x86_64: test-i386.c test-i386.h test-i386-shift.h test-i386-muldiv.h
+	$(CC) $(CFLAGS) $< -o $@ $(LDFLAGS)
Signature · 1 line
2.17.1
#20 lore raw

PATCH v6 19/49 tests/tcg/i386/test-i386: use modern vector_size attributes

In reply to Alex Bennée

The compiler complains about the old __mode__ style attributes.

---
 tests/tcg/i386/test-i386.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/tcg/i386/test-i386.c +2 -2
index cae6a7773a..caef4da176 100644
@@ -2106,8 +2106,8 @@ static void test_enter(void)
 
 #ifdef TEST_SSE
 
-typedef int __m64 __attribute__ ((__mode__ (__V2SI__)));
-typedef float __m128 __attribute__ ((__mode__(__V4SF__)));
+typedef int __m64 __attribute__ ((vector_size(8)));
+typedef float __m128 __attribute__ ((vector_size(16)));
 
 typedef union {
     double d[2];
Signature · 1 line
2.17.1
#21 lore raw

PATCH v6 20/49 tests/tcg/i386/test-i386: fix printf format

In reply to Alex Bennée
---
 tests/tcg/i386/test-i386.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/tcg/i386/test-i386.c +1 -1
index caef4da176..a29b41e764 100644
@@ -2258,7 +2258,7 @@ SSE_OP(a ## sd);
         "pop %0\n"\
         : "=rm" (eflags)\
         : "x" (a.dq), "x" (b.dq));\
-    printf("%-9s: a=%f b=%f cc=%04x\n",\
+    printf("%-9s: a=%f b=%f cc=%04lx\n",\
            #op, a1, b1,\
            eflags & (CC_C | CC_P | CC_Z | CC_S | CC_O | CC_A));\
 }
Signature · 1 line
2.17.1
#22 lore raw

PATCH v6 21/49 tests/tcg: move ARM specific tests into subdir

In reply to Alex Bennée

These only need to be built for ARM guests.

---
v2
- do VPATH manipulation in tests/tcg/arm/Makefile.target
- merge with fix hello-arm test
v4
- update MAINTAINERS

---
 MAINTAINERS                           |  1 +
 tests/tcg/README                      |  9 ---------
 tests/tcg/arm/Makefile.target         | 13 +++++++++++++
 tests/tcg/arm/README                  | 11 +++++++++++
 tests/tcg/{ => arm}/hello-arm.c       |  0
 tests/tcg/{ => arm}/test-arm-iwmmxt.s |  0
 6 files changed, 25 insertions(+), 9 deletions(-)
 create mode 100644 tests/tcg/arm/Makefile.target
 create mode 100644 tests/tcg/arm/README
 rename tests/tcg/{ => arm}/hello-arm.c (100%)
 rename tests/tcg/{ => arm}/test-arm-iwmmxt.s (100%)
MAINTAINERS +1 -0
index 1063c4d60f..c9b440344e 100644
@@ -135,6 +135,7 @@ M: Peter Maydell <[email protected]>
 L: [email protected]
 S: Maintained
 F: target/arm/
+F: tests/tcg/arm/
 F: hw/arm/
 F: hw/cpu/a*mpcore.c
 F: include/hw/cpu/a*mpcore.h
tests/tcg/README +0 -9
index 469504c4cb..625f2326e6 100644
@@ -5,15 +5,6 @@ or they are architecture specific.
 
 
 
-ARM
-===
-
-hello-arm
----------
-
-test-arm-iwmmxt
----------------
-
 MIPS
 ====
 
tests/tcg/arm/Makefile.target new file +13 -0
new file mode 100644
index 0000000000..bc6962ecc6
@@ -0,0 +1,13 @@
+# -*- Mode: makefile -*-
+#
+# ARM - included from tests/tcg/Makefile.target
+#
+
+ARM_SRC=$(SRC_PATH)/tests/tcg/arm
+
+# Set search path for all sources
+VPATH 		+= $(ARM_SRC)
+
+
+hello-arm: CFLAGS+=-marm -ffreestanding
+hello-arm: LDFLAGS+=-nostdlib
tests/tcg/arm/README new file +11 -0
new file mode 100644
index 0000000000..e6307116e2
@@ -0,0 +1,11 @@
+These are ARM specific guest programs
+
+hello-arm
+---------
+
+A very simple inline assembly, write syscall based hello world
+
+test-arm-iwmmxt
+---------------
+
+A simple test case for older iwmmxt extended ARMs
tests/tcg/arm/hello-arm.c renamed from tests/tcg/hello-arm.c +0 -0
similarity index 100%
rename from tests/tcg/hello-arm.c
rename to tests/tcg/arm/hello-arm.c
tests/tcg/arm/test-arm-iwmmxt.s renamed from tests/tcg/test-arm-iwmmxt.s +0 -0
similarity index 100%
rename from tests/tcg/test-arm-iwmmxt.s
rename to tests/tcg/arm/test-arm-iwmmxt.s
Signature · 1 line
2.17.1
#23 lore raw

PATCH v6 22/49 tests/tcg: enable building for ARM

In reply to Alex Bennée

This allows us to use the docker cross compiler image to build these tests.

---
v5
- add EXTRA_RUNS for mmap tests

---
 tests/tcg/arm/Makefile.include | 8 ++++++++
 tests/tcg/arm/Makefile.target  | 5 ++++-
 2 files changed, 12 insertions(+), 1 deletion(-)
 create mode 100644 tests/tcg/arm/Makefile.include
tests/tcg/arm/Makefile.include new file +8 -0
new file mode 100644
index 0000000000..8e7eac008f
@@ -0,0 +1,8 @@
+# Makefile.include for all ARM targets
+#
+# We don't have any bigendian build tools so we only use this for armhf
+
+ifeq ($(TARGET_NAME),arm)
+DOCKER_IMAGE=debian-armhf-cross
+DOCKER_CROSS_COMPILER=arm-linux-gnueabihf-gcc
+endif
tests/tcg/arm/Makefile.target +4 -1
index bc6962ecc6..0312293dca 100644
@@ -1,6 +1,6 @@
 # -*- Mode: makefile -*-
 #
-# ARM - included from tests/tcg/Makefile.target
+# ARM - included from tests/tcg/Makefile
 #
 
 ARM_SRC=$(SRC_PATH)/tests/tcg/arm
@@ -11,3 +11,6 @@ VPATH 		+= $(ARM_SRC)
 
 hello-arm: CFLAGS+=-marm -ffreestanding
 hello-arm: LDFLAGS+=-nostdlib
+
+# On ARM Linux only supports 4k pages
+EXTRA_RUNS+=run-test-mmap-4096
Signature · 1 line
2.17.1
#24 lore raw

PATCH v6 23/49 tests/tcg/arm: fix up test-arm-iwmmxt test

In reply to Alex Bennée

We need to rename the source file to a .S so we can do a single-line assemble and link invocation. We also specify the additional CFLAGS for the compile as it's a non-standard ARM binary.

---
v4
- include rth's -mfpu=fpv4-sp-d16
v5
- merge fixes

---
 tests/tcg/arm/Makefile.target                          | 5 +++++
 tests/tcg/arm/{test-arm-iwmmxt.s => test-arm-iwmmxt.S} | 0
 2 files changed, 5 insertions(+)
 rename tests/tcg/arm/{test-arm-iwmmxt.s => test-arm-iwmmxt.S} (100%)
tests/tcg/arm/Makefile.target +5 -0
index 0312293dca..cadb385890 100644
@@ -8,9 +8,14 @@ ARM_SRC=$(SRC_PATH)/tests/tcg/arm
 # Set search path for all sources
 VPATH 		+= $(ARM_SRC)
 
+TESTS += hello-arm test-arm-iwmmxt
 
 hello-arm: CFLAGS+=-marm -ffreestanding
 hello-arm: LDFLAGS+=-nostdlib
 
+test-arm-iwmmxt: CFLAGS+=-marm -march=iwmmxt -mabi=aapcs -mfpu=fpv4-sp-d16
+test-arm-iwmmxt: test-arm-iwmmxt.S
+	$(CC) $(CFLAGS) $< -o $@ $(LDFLAGS)
+
 # On ARM Linux only supports 4k pages
 EXTRA_RUNS+=run-test-mmap-4096
tests/tcg/arm/test-arm-iwmmxt.S renamed from tests/tcg/arm/test-arm-iwmmxt.s +0 -0
similarity index 100%
rename from tests/tcg/arm/test-arm-iwmmxt.s
rename to tests/tcg/arm/test-arm-iwmmxt.S
Signature · 1 line
2.17.1
#25 lore raw

PATCH v6 24/49 tests/tcg: enable building for AArch64

In reply to Alex Bennée

We only have compilers for the (default) little endian variants.

---
v4
- update MAINTAINERS

---
 MAINTAINERS                        | 1 +
 tests/tcg/aarch64/Makefile.include | 8 ++++++++
 2 files changed, 9 insertions(+)
 create mode 100644 tests/tcg/aarch64/Makefile.include
MAINTAINERS +1 -0
index c9b440344e..b8fbef495b 100644
@@ -136,6 +136,7 @@ L: [email protected]
 S: Maintained
 F: target/arm/
 F: tests/tcg/arm/
+F: tests/tcg/aarch64/
 F: hw/arm/
 F: hw/cpu/a*mpcore.c
 F: include/hw/cpu/a*mpcore.h
tests/tcg/aarch64/Makefile.include new file +8 -0
new file mode 100644
index 0000000000..de32c91235
@@ -0,0 +1,8 @@
+# Makefile.include for AArch64 targets
+#
+# We don't have any bigendian build tools so we only use this for AArch64
+
+ifeq ($(TARGET_NAME),aarch64)
+DOCKER_IMAGE=debian-arm64-cross
+DOCKER_CROSS_COMPILER=aarch64-linux-gnu-gcc
+endif
Signature · 1 line
2.17.1
#26 lore raw

PATCH v6 25/49 tests/tcg/arm: add fcvt test cases for AArch32/64

In reply to Alex Bennée

This runs through the usual float to float conversions and crucially also runs with ARM Alternative Half Precision Format.

---
v4
- add fcvt.ref and check results against it
- fix single_to_half, single_to_double conversions
- properly toggle AHP mode (fpsr->fpcr)
- more values around the AHP margins
- add INF/NAN/SNAN inputs
- build for ARM and AArch64
- fix bug for hex literals
- add float-to-int
- checkpatch fix
v5
- merge with tests/tcg/aarch64: add Makefile.target

---
 tests/tcg/aarch64/Makefile.target |   19 +
 tests/tcg/aarch64/fcvt.ref        | 3268 +++++++++++++++++++++++++++++
 tests/tcg/arm/Makefile.target     |   15 +-
 tests/tcg/arm/fcvt.c              |  458 ++++
 tests/tcg/arm/fcvt.ref            | 3268 +++++++++++++++++++++++++++++
 5 files changed, 7027 insertions(+), 1 deletion(-)
 create mode 100644 tests/tcg/aarch64/Makefile.target
 create mode 100644 tests/tcg/aarch64/fcvt.ref
 create mode 100644 tests/tcg/arm/fcvt.c
 create mode 100644 tests/tcg/arm/fcvt.ref
tests/tcg/aarch64/Makefile.target new file +19 -0
new file mode 100644
index 0000000000..7dba32138d
@@ -0,0 +1,19 @@
+# -*- Mode: makefile -*-
+#
+# AArch64 specific tweaks
+
+AARCH64_SRC=$(SRC_PATH)/tests/tcg/aarch64
+VPATH 		+= $(AARCH64_SRC)
+
+# we don't build any of the ARM tests
+AARCH64_TESTS=$(filter-out $(ARM_TESTS), $(TESTS))
+AARCH64_TESTS+=fcvt
+TESTS:=$(AARCH64_TESTS)
+
+fcvt: LDFLAGS+=-lm
+
+run-fcvt: fcvt
+	$(call quiet-command, \
+		$(QEMU) $< > fcvt.out && \
+		diff -u $(AARCH64_SRC)/fcvt.ref fcvt.out, \
+		"TEST", "$< (default) on $(TARGET_NAME)")
tests/tcg/aarch64/fcvt.ref new file +3268 -0

2,981 lines not on this page · raw message

tests/tcg/arm/Makefile.target +14 -1
index cadb385890..14b5435fc6 100644

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

tests/tcg/arm/fcvt.c new file +458 -0

458 lines not on this page · raw message

tests/tcg/arm/fcvt.ref new file +3268 -0

3,268 lines not on this page · raw message

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

Signature · 1 line
2.17.1

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

#27 lore raw

PATCH v6 26/49 tests/tcg: move MIPS specific tests into subdir

In reply to Alex Bennée

These only need to be built for MIPS guests.

---
 tests/tcg/README                  | 11 -----------
 tests/tcg/mips/README             |  7 +++++++
 tests/tcg/{ => mips}/hello-mips.c |  0
 3 files changed, 7 insertions(+), 11 deletions(-)
 create mode 100644 tests/tcg/mips/README
 rename tests/tcg/{ => mips}/hello-mips.c (100%)
tests/tcg/README +0 -11
index 625f2326e6..a5643d33e7 100644
@@ -3,17 +3,6 @@ regression testing. Tests are either multi-arch, meaning they can be
 built for all guest architectures that support linux-user executable,
 or they are architecture specific.
 
-
-
-MIPS
-====
-
-hello-mips
-----------
-
-hello-mipsel
-------------
-
 CRIS
 ====
 The testsuite for CRIS is in tests/tcg/cris.  You can run it
tests/tcg/mips/README new file +7 -0
new file mode 100644
index 0000000000..e5bbc58ec5
@@ -0,0 +1,7 @@
+MIPS
+====
+
+hello-mips
+----------
+
+A very simple inline assembly, write syscall based hello world
tests/tcg/mips/hello-mips.c renamed from tests/tcg/hello-mips.c +0 -0
similarity index 100%
rename from tests/tcg/hello-mips.c
rename to tests/tcg/mips/hello-mips.c
Signature · 1 line
2.17.1
#28 lore raw

PATCH v6 27/49 tests/tcg: enable building for MIPS

In reply to Alex Bennée

This doesn't add any additional tests but enables building the multiarch tests for MIPS using docker cross compilers. We don't have a cross compiler for mips64 big endian though.

---
 tests/tcg/mips/Makefile.include | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 tests/tcg/mips/Makefile.include
tests/tcg/mips/Makefile.include new file +17 -0
new file mode 100644
index 0000000000..a9beceb623
@@ -0,0 +1,17 @@
+#
+# Makefile.include for all MIPs targets
+#
+# As Debian doesn't support mip64 in big endian mode the only way to
+# build BE is to pass a working cross compiler to ./configure
+#
+
+ifeq ($(TARGET_NAME),mips64el)
+DOCKER_IMAGE=debian-mips64el-cross
+DOCKER_CROSS_COMPILER=mips64el-linux-gnuabi64-gcc
+else ifeq ($(TARGET_NAME),mipsel)
+DOCKER_IMAGE=debian-mipsel-cross
+DOCKER_CROSS_COMPILER=mipsel-linux-gnu-gcc
+else ifeq ($(TARGET_NAME),mips)
+DOCKER_IMAGE=debian-mips-cross
+DOCKER_CROSS_COMPILER=mips-linux-gnu-gcc
+endif
Signature · 1 line
2.17.1
#29 lore raw

PATCH v6 28/49 tests/tcg/mips: include common mips hello-mips

In reply to Alex Bennée
---
 tests/tcg/mips/Makefile.target | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100644 tests/tcg/mips/Makefile.target
tests/tcg/mips/Makefile.target new file +19 -0
new file mode 100644
index 0000000000..71f0c2dd53
@@ -0,0 +1,19 @@
+# -*- Mode: makefile -*-
+#
+# MIPS - included from tests/tcg/Makefile.target
+#
+
+MIPS_SRC=$(SRC_PATH)/tests/tcg/mips
+
+# Set search path for all sources
+VPATH 		+= $(MIPS_SRC)
+
+MIPS_TESTS=hello-mips
+
+TESTS += $(MIPS_TESTS)
+
+hello-mips: CFLAGS+=-ffreestanding
+hello-mips: LDFLAGS+=-nostdlib
+
+# For MIPS32 and 64 we have a bunch of extra tests in sub-directories
+# however they are intended for system tests.
Signature · 1 line
2.17.1
#30 lore raw

PATCH v6 29/49 tests/tcg: enable building for s390x

In reply to Alex Bennée

This doesn't add any additional tests but enables building the multiarch tests for s390x.

---
 tests/tcg/s390x/Makefile.include | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 tests/tcg/s390x/Makefile.include
tests/tcg/s390x/Makefile.include new file +2 -0
new file mode 100644
index 0000000000..1f58115d96
@@ -0,0 +1,2 @@
+DOCKER_IMAGE=debian-s390x-cross
+DOCKER_CROSS_COMPILER=s390x-linux-gnu-gcc
Signature · 1 line
2.17.1
#31 lore raw

PATCH v6 30/49 tests/tcg: enable building for ppc64

In reply to Alex Bennée

Currently this just enables building the multiarch tests.

---
 tests/tcg/ppc64le/Makefile.include | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 tests/tcg/ppc64le/Makefile.include
tests/tcg/ppc64le/Makefile.include new file +2 -0
new file mode 100644
index 0000000000..d71cfc9aa7
@@ -0,0 +1,2 @@
+DOCKER_IMAGE=debian-ppc64el-cross
+DOCKER_CROSS_COMPILER=powerpc64le-linux-gnu-gcc
Signature · 1 line
2.17.1
#32 lore raw

PATCH v6 31/49 tests/tcg: enable building for Alpha

In reply to Alex Bennée

We can't use our normal Debian based compilers as Alpha isn't an officially supported architecture. However it is available as a port and fortunately cross compilers for all these targets are included in Debian Sid, the perpetual rolling/unstable/testing version of Debian.

---
v5
- drop the unused debian-cross-build docker image
- add note to debian-sid docker image
- echo reference to notes on build failure
- include EXTRA_RUNS for mmap tests
v6
- use NOCACHE=1 for docker-image-debian-sid to force re-builds
- this seems a little hacky

---
 tests/docker/Makefile.include                 |  7 ++++
 .../dockerfiles/debian-alpha-cross.docker     | 12 +++++++
 tests/docker/dockerfiles/debian-sid.docker    | 32 +++++++++++++++++++
 tests/tcg/alpha/Makefile.include              |  2 ++
 tests/tcg/alpha/Makefile.target               |  6 ++++
 5 files changed, 59 insertions(+)
 create mode 100644 tests/docker/dockerfiles/debian-alpha-cross.docker
 create mode 100644 tests/docker/dockerfiles/debian-sid.docker
 create mode 100644 tests/tcg/alpha/Makefile.include
 create mode 100644 tests/tcg/alpha/Makefile.target
tests/docker/Makefile.include +7 -0
index 8afb383478..1a4664c04e 100644
@@ -63,6 +63,13 @@ docker-image-debian-ppc64el-cross: docker-image-debian9
 docker-image-debian-s390x-cross: docker-image-debian9
 docker-image-debian-win32-cross: docker-image-debian8-mxe
 docker-image-debian-win64-cross: docker-image-debian8-mxe
+
+# Debian SID images - we are tracking a rolling distro so we want to
+# force a re-build of the base image if we ever need to build one of
+# its children.
+docker-image-debian-sid: NOCACHE=1
+
+docker-image-debian-alpha-cross: docker-image-debian-sid
 docker-image-travis: NOUSER=1
 
 # Specialist build images, sometimes very limited tools
tests/docker/dockerfiles/debian-alpha-cross.docker new file +12 -0
new file mode 100644
index 0000000000..29a25d0dfd
@@ -0,0 +1,12 @@
+#
+# Docker cross-compiler target
+#
+# This docker target builds on the debian sid base image which
+# contains cross compilers for Debian "ports" targets.
+#
+FROM qemu:debian-sid
+
+RUN DEBIAN_FRONTEND=noninteractive eatmydata \
+    apt-get install -y --no-install-recommends \
+        gcc-alpha-linux-gnu \
+        libc6.1-dev-alpha-cross || { echo "Failed to build - see debian-sid.docker notes"; exit 1; }
tests/docker/dockerfiles/debian-sid.docker new file +32 -0
new file mode 100644
index 0000000000..9a3d168705
@@ -0,0 +1,32 @@
+#
+# Debian Sid Base
+#
+# A number of our guests exist as ports only. We can either use the
+# ports repo or get everything from Sid. However Sid is a rolling
+# distro which may be broken at any particular time. If you are
+# unlucky and try and build your images while gcc is in the process of
+# being uploaded this can fail. Your only recourse is to try again in
+# a few hours when the repos have re-synced. Once built however you
+# won't be affected by repo changes unless the docker recipies are
+# updated and trigger a re-build.
+#
+
+FROM debian:sid-slim
+
+# Duplicate deb line as deb-src
+RUN cat /etc/apt/sources.list | sed "s/^deb\ /deb-src /" >> /etc/apt/sources.list
+
+# Install common build utilities
+RUN apt update
+RUN DEBIAN_FRONTEND=noninteractive apt install -yy eatmydata
+RUN DEBIAN_FRONTEND=noninteractive eatmydata \
+    apt install -y --no-install-recommends \
+        bison \
+        build-essential \
+        ca-certificates \
+        flex \
+        git \
+        pkg-config \
+        psmisc \
+        python \
+        texinfo || { echo "Failed to build - see debian-sid.docker notes"; exit 1; }
tests/tcg/alpha/Makefile.include new file +2 -0
new file mode 100644
index 0000000000..c7dc48eadb
@@ -0,0 +1,2 @@
+DOCKER_IMAGE=debian-alpha-cross
+DOCKER_CROSS_COMPILER=alpha-linux-gnu-gcc
tests/tcg/alpha/Makefile.target new file +6 -0
new file mode 100644
index 0000000000..bedf1b6444
@@ -0,0 +1,6 @@
+# -*- Mode: makefile -*-
+#
+# Alpha specific tweaks
+
+# On Alpha Linux only supports 8k pages
+EXTRA_RUNS+=run-test-mmap-8192
Signature · 1 line
2.17.1
#33 lore raw

PATCH v6 32/49 tests/tcg/alpha: add Alpha specific tests

In reply to Alex Bennée

These tests did use their own crt.o stub however that is a little stone age so we drop crt.S and just statically link to the cross compilers libraries.

---
v4
- drop crt.s
- drop skipping of threadtest
- drop write() hack, include unistd.h
v5
- merge fixes

---
 tests/tcg/alpha/Makefile        | 35 ---------------------------------
 tests/tcg/alpha/Makefile.target | 12 +++++++++++
 tests/tcg/alpha/crt.s           | 26 ------------------------
 tests/tcg/alpha/hello-alpha.c   |  2 ++
 tests/tcg/alpha/test-cond.c     |  1 +
 tests/tcg/alpha/test-ovf.c      |  2 ++
 6 files changed, 17 insertions(+), 61 deletions(-)
 delete mode 100644 tests/tcg/alpha/Makefile
 delete mode 100644 tests/tcg/alpha/crt.s
tests/tcg/alpha/Makefile deleted +0 -35
deleted file mode 100644
index 2b1f03d048..0000000000
@@ -1,35 +0,0 @@
-CROSS=alpha-linux-gnu-
-CC=$(CROSS)gcc
-AS=$(CROSS)as
-
-SIM=../../alpha-linux-user/qemu-alpha
-
-CFLAGS=-O
-LINK=$(CC) -o $@ crt.o $< -nostdlib
-
-TESTS=test-cond test-cmov
-
-all: hello-alpha $(TESTS)
-
-hello-alpha: hello-alpha.o crt.o
-	$(LINK)
-
-test-cond: test-cond.o crt.o
-	$(LINK)
-
-test-cmov.o: test-cond.c
-	$(CC) -c $(CFLAGS) -DTEST_CMOV -o $@ $<
-
-test-cmov: test-cmov.o crt.o
-	$(LINK)
-
-test-ovf: test-ovf.o crt.o
-	$(LINK)
-
-check: $(TESTS)
-	for f in $(TESTS); do $(SIM) $$f || exit 1; done
-
-clean:
-	$(RM) *.o *~ hello-alpha $(TESTS)
-
-.PHONY: clean all check
tests/tcg/alpha/Makefile.target +12 -0
index bedf1b6444..a585080328 100644
@@ -2,5 +2,17 @@
 #
 # Alpha specific tweaks
 
+ALPHA_SRC=$(SRC_PATH)/tests/tcg/alpha
+VPATH+=$(ALPHA_SRC)
+
+ALPHA_TESTS=hello-alpha test-cond test-cmov test-ovf
+TESTS+=$(ALPHA_TESTS)
+
+test-cmov: EXTRA_CFLAGS=-DTEST_CMOV
+test-cmov: test-cond.c
+	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
+
+run-test-cmov: test-cmov
+
 # On Alpha Linux only supports 8k pages
 EXTRA_RUNS+=run-test-mmap-8192
tests/tcg/alpha/crt.s deleted +0 -26
deleted file mode 100644
index 31af8825bc..0000000000
@@ -1,26 +0,0 @@
-	.text
-
-	.globl _start
-	.ent _start,0
-_start:
-	.frame $15,0,$15
-	br $29,1f
-1:	ldgp $29, 0($29)
-	.prologue 0
-	ldq $27,main($29) !literal!1
-	jsr $26,($27)
-	or $0,$0,$16
-	.end _start
-
-	.globl _exit
-_exit:
-	lda $0,1
-	callsys
-
-	call_pal 0
-
-	.globl write
-write:
-	lda $0,4
-	callsys
-	ret
tests/tcg/alpha/hello-alpha.c +2 -0
index 79892e6522..84e43b2fc4 100644
@@ -1,3 +1,5 @@
+#include <unistd.h>
+
 int main (void)
 {
   write (1, "hello\n", 6);
tests/tcg/alpha/test-cond.c +1 -0
index 74adffaa69..e625313b3e 100644
@@ -1,3 +1,4 @@
+#include <unistd.h>
 
 #ifdef TEST_CMOV
 
tests/tcg/alpha/test-ovf.c +2 -0
index 01c80e7525..17892f1e89 100644
@@ -1,3 +1,5 @@
+#include <unistd.h>
+
 static long test_subqv (long a, long b)
 {
   long res;
Signature · 1 line
2.17.1
#34 lore raw

PATCH v6 33/49 tests/tcg: enable building for HPPA

In reply to Alex Bennée

---
v5
- add EXTRA_RUNS for mmap tests

---
 tests/docker/Makefile.include                     |  1 +
 tests/docker/dockerfiles/debian-hppa-cross.docker | 12 ++++++++++++
 tests/tcg/hppa/Makefile.include                   |  2 ++
 tests/tcg/hppa/Makefile.target                    |  6 ++++++
 4 files changed, 21 insertions(+)
 create mode 100644 tests/docker/dockerfiles/debian-hppa-cross.docker
 create mode 100644 tests/tcg/hppa/Makefile.include
 create mode 100644 tests/tcg/hppa/Makefile.target
tests/docker/Makefile.include +1 -0
index 1a4664c04e..a83e979e6d 100644
@@ -70,6 +70,7 @@ docker-image-debian-win64-cross: docker-image-debian8-mxe
 docker-image-debian-sid: NOCACHE=1
 
 docker-image-debian-alpha-cross: docker-image-debian-sid
+docker-image-debian-hppa-cross: docker-image-debian-sid
 docker-image-travis: NOUSER=1
 
 # Specialist build images, sometimes very limited tools
tests/docker/dockerfiles/debian-hppa-cross.docker new file +12 -0
new file mode 100644
index 0000000000..ad443defac
@@ -0,0 +1,12 @@
+#
+# Docker cross-compiler target
+#
+# This docker target builds on the debian sid base image which
+# contains cross compilers for Debian "ports" targets.
+#
+FROM qemu:debian-sid
+
+RUN DEBIAN_FRONTEND=noninteractive eatmydata \
+    apt-get install -y --no-install-recommends \
+        gcc-hppa-linux-gnu \
+        libc6-dev-hppa-cross
tests/tcg/hppa/Makefile.include new file +2 -0
new file mode 100644
index 0000000000..da2353430e
@@ -0,0 +1,2 @@
+DOCKER_IMAGE=debian-hppa-cross
+DOCKER_CROSS_COMPILER=hppa-linux-gnu-gcc
tests/tcg/hppa/Makefile.target new file +6 -0
new file mode 100644
index 0000000000..8bf01966bd
@@ -0,0 +1,6 @@
+# -*- Mode: makefile -*-
+#
+# HPPA specific tweaks - specifically masking out broken tests
+
+# On parisc Linux supports 4K/16K/64K (but currently only 4k works)
+EXTRA_RUNS+=run-test-mmap-4096 # run-test-mmap-16384 run-test-mmap-65536
Signature · 1 line
2.17.1
#35 lore raw

PATCH v6 34/49 tests/tcg: enable building for m68k

In reply to Alex Bennée

As before, using Debian SID compilers.

---
v5
- add EXTRA_RUNS for mmap tests

---
 tests/docker/Makefile.include                     |  1 +
 tests/docker/dockerfiles/debian-m68k-cross.docker | 12 ++++++++++++
 tests/tcg/m68k/Makefile.include                   |  2 ++
 tests/tcg/m68k/Makefile.target                    |  7 +++++++
 4 files changed, 22 insertions(+)
 create mode 100644 tests/docker/dockerfiles/debian-m68k-cross.docker
 create mode 100644 tests/tcg/m68k/Makefile.include
 create mode 100644 tests/tcg/m68k/Makefile.target
tests/docker/Makefile.include +1 -0
index a83e979e6d..b1ae717010 100644
@@ -71,6 +71,7 @@ docker-image-debian-sid: NOCACHE=1
 
 docker-image-debian-alpha-cross: docker-image-debian-sid
 docker-image-debian-hppa-cross: docker-image-debian-sid
+docker-image-debian-m68k-cross: docker-image-debian-sid
 docker-image-travis: NOUSER=1
 
 # Specialist build images, sometimes very limited tools
tests/docker/dockerfiles/debian-m68k-cross.docker new file +12 -0
new file mode 100644
index 0000000000..21ba3b0132
@@ -0,0 +1,12 @@
+#
+# Docker cross-compiler target
+#
+# This docker target builds on the debian sid base image which
+# contains cross compilers for Debian "ports" targets.
+#
+FROM qemu:debian-sid
+
+RUN DEBIAN_FRONTEND=noninteractive eatmydata \
+    apt-get install -y --no-install-recommends \
+        gcc-m68k-linux-gnu \
+        libc6-dev-m68k-cross
tests/tcg/m68k/Makefile.include new file +2 -0
new file mode 100644
index 0000000000..cd7c6bf50d
@@ -0,0 +1,2 @@
+DOCKER_IMAGE=debian-m68k-cross
+DOCKER_CROSS_COMPILER=m68k-linux-gnu-gcc
tests/tcg/m68k/Makefile.target new file +7 -0
new file mode 100644
index 0000000000..62f109eef4
@@ -0,0 +1,7 @@
+# -*- Mode: makefile -*-
+#
+# m68k specific tweaks - specifically masking out broken tests
+#
+
+# On m68k Linux supports 4k and 8k pages (but 8k is currently broken)
+EXTRA_RUNS+=run-test-mmap-4096 # run-test-mmap-8192
Signature · 1 line
2.17.1
#36 lore raw

PATCH v6 35/49 tests/tcg: enable building for sh4

In reply to Alex Bennée

As before, using Debian SID compilers. While the compiler can be coerced into generating big-endian code it seems the linker can't deal with it so we only enable the building for little endian SH4.

---
v5
- add Makefile.target with EXTRA_RUNS for mmap tests

---
 tests/docker/Makefile.include                    |  1 +
 tests/docker/dockerfiles/debian-sh4-cross.docker | 12 ++++++++++++
 tests/tcg/sh4/Makefile.include                   |  4 ++++
 tests/tcg/sh4/Makefile.target                    |  7 +++++++
 4 files changed, 24 insertions(+)
 create mode 100644 tests/docker/dockerfiles/debian-sh4-cross.docker
 create mode 100644 tests/tcg/sh4/Makefile.include
 create mode 100644 tests/tcg/sh4/Makefile.target
tests/docker/Makefile.include +1 -0
index b1ae717010..bad3d28103 100644
@@ -72,6 +72,7 @@ docker-image-debian-sid: NOCACHE=1
 docker-image-debian-alpha-cross: docker-image-debian-sid
 docker-image-debian-hppa-cross: docker-image-debian-sid
 docker-image-debian-m68k-cross: docker-image-debian-sid
+docker-image-debian-sh4-cross: docker-image-debian-sid
 docker-image-travis: NOUSER=1
 
 # Specialist build images, sometimes very limited tools
tests/docker/dockerfiles/debian-sh4-cross.docker new file +12 -0
new file mode 100644
index 0000000000..88a2423094
@@ -0,0 +1,12 @@
+#
+# Docker cross-compiler target
+#
+# This docker target builds on the debian sid base image which
+# contains cross compilers for Debian "ports" targets.
+#
+FROM qemu:debian-sid
+
+RUN DEBIAN_FRONTEND=noninteractive eatmydata \
+    apt-get install -y --no-install-recommends \
+        gcc-sh4-linux-gnu \
+        libc6-dev-sh4-cross
tests/tcg/sh4/Makefile.include new file +4 -0
new file mode 100644
index 0000000000..ad21594d9d
@@ -0,0 +1,4 @@
+ifneq ($(TARGET_NAME), sh4eb)
+DOCKER_IMAGE=debian-sh4-cross
+DOCKER_CROSS_COMPILER=sh4-linux-gnu-gcc
+endif
tests/tcg/sh4/Makefile.target new file +7 -0
new file mode 100644
index 0000000000..9d18d44612
@@ -0,0 +1,7 @@
+# -*- Mode: makefile -*-
+#
+# SuperH specific tweaks
+#
+
+# On sh Linux supports 4k, 8k, 16k and 64k pages (but only 4k currently works)
+EXTRA_RUNS+=run-test-mmap-4096 # run-test-mmap-8192 run-test-mmap-16384 run-test-mmap-65536
Signature · 1 line
2.17.1
#37 lore raw

PATCH v6 36/49 tests/tcg: enable building for sparc64

In reply to Alex Bennée

As before, using Debian SID compilers.

---
v5
- add Makefile with EXTRA_RUNS for mmap tests

---
 tests/docker/Makefile.include                        |  1 +
 tests/docker/dockerfiles/debian-sparc64-cross.docker | 12 ++++++++++++
 tests/tcg/sparc64/Makefile.include                   |  2 ++
 tests/tcg/sparc64/Makefile.target                    |  6 ++++++
 4 files changed, 21 insertions(+)
 create mode 100644 tests/docker/dockerfiles/debian-sparc64-cross.docker
 create mode 100644 tests/tcg/sparc64/Makefile.include
 create mode 100644 tests/tcg/sparc64/Makefile.target
tests/docker/Makefile.include +1 -0
index bad3d28103..2080a528a3 100644
@@ -73,6 +73,7 @@ docker-image-debian-alpha-cross: docker-image-debian-sid
 docker-image-debian-hppa-cross: docker-image-debian-sid
 docker-image-debian-m68k-cross: docker-image-debian-sid
 docker-image-debian-sh4-cross: docker-image-debian-sid
+docker-image-debian-sparc64-cross: docker-image-debian-sid
 docker-image-travis: NOUSER=1
 
 # Specialist build images, sometimes very limited tools
tests/docker/dockerfiles/debian-sparc64-cross.docker new file +12 -0
new file mode 100644
index 0000000000..1e2c809274
@@ -0,0 +1,12 @@
+#
+# Docker cross-compiler target
+#
+# This docker target builds on the debian sid base image which
+# contains cross compilers for Debian "ports" targets.
+#
+FROM qemu:debian-sid
+
+RUN DEBIAN_FRONTEND=noninteractive eatmydata \
+    apt-get install -y --no-install-recommends \
+        gcc-sparc64-linux-gnu \
+        libc6-dev-sparc64-cross
tests/tcg/sparc64/Makefile.include new file +2 -0
new file mode 100644
index 0000000000..95fc8dee9f
@@ -0,0 +1,2 @@
+DOCKER_IMAGE=debian-sparc64-cross
+DOCKER_CROSS_COMPILER=sparc64-linux-gnu-gcc
tests/tcg/sparc64/Makefile.target new file +6 -0
new file mode 100644
index 0000000000..408dace783
@@ -0,0 +1,6 @@
+# -*- Mode: makefile -*-
+#
+# sparc specific tweaks
+
+# On Sparc64 Linux support 8k pages
+EXTRA_RUNS+=run-test-mmap-8192
Signature · 1 line
2.17.1
#38 lore raw

PATCH v6 37/49 tests/tcg: enable building for mips64

In reply to Alex Bennée

As before, using Debian SID compilers.

---
 tests/docker/Makefile.include                       |  1 +
 tests/docker/dockerfiles/debian-mips64-cross.docker | 12 ++++++++++++
 tests/tcg/mips/Makefile.include                     |  3 +++
 3 files changed, 16 insertions(+)
 create mode 100644 tests/docker/dockerfiles/debian-mips64-cross.docker
tests/docker/Makefile.include +1 -0
index 2080a528a3..654c769f9a 100644
@@ -74,6 +74,7 @@ docker-image-debian-hppa-cross: docker-image-debian-sid
 docker-image-debian-m68k-cross: docker-image-debian-sid
 docker-image-debian-sh4-cross: docker-image-debian-sid
 docker-image-debian-sparc64-cross: docker-image-debian-sid
+docker-image-debian-mips64-cross: docker-image-debian-sid
 docker-image-travis: NOUSER=1
 
 # Specialist build images, sometimes very limited tools
tests/docker/dockerfiles/debian-mips64-cross.docker new file +12 -0
new file mode 100644
index 0000000000..ed1ce0e919
@@ -0,0 +1,12 @@
+#
+# Docker cross-compiler target
+#
+# This docker target builds on the debian sid base image which
+# contains cross compilers for Debian "ports" targets.
+#
+FROM qemu:debian-sid
+
+RUN DEBIAN_FRONTEND=noninteractive eatmydata \
+    apt-get install -y --no-install-recommends \
+        gcc-mips64-linux-gnuabi64 \
+        libc6-dev-mips64-cross
tests/tcg/mips/Makefile.include +3 -0
index a9beceb623..4a14fc078d 100644
@@ -8,6 +8,9 @@
 ifeq ($(TARGET_NAME),mips64el)
 DOCKER_IMAGE=debian-mips64el-cross
 DOCKER_CROSS_COMPILER=mips64el-linux-gnuabi64-gcc
+else ifeq ($(TARGET_NAME),mips64)
+DOCKER_IMAGE=debian-mips64-cross
+DOCKER_CROSS_COMPILER=mips64-linux-gnuabi64-gcc
 else ifeq ($(TARGET_NAME),mipsel)
 DOCKER_IMAGE=debian-mipsel-cross
 DOCKER_CROSS_COMPILER=mipsel-linux-gnu-gcc
Signature · 1 line
2.17.1
#39 lore raw

PATCH v6 38/49 tests/tcg: enable building for RISCV64

In reply to Alex Bennée

As before, using Debian SID compilers.

---
 tests/docker/Makefile.include                        |  1 +
 tests/docker/dockerfiles/debian-riscv64-cross.docker | 12 ++++++++++++
 tests/tcg/riscv/Makefile.include                     | 10 ++++++++++
 3 files changed, 23 insertions(+)
 create mode 100644 tests/docker/dockerfiles/debian-riscv64-cross.docker
 create mode 100644 tests/tcg/riscv/Makefile.include
tests/docker/Makefile.include +1 -0
index 654c769f9a..10f98916f9 100644
@@ -75,6 +75,7 @@ docker-image-debian-m68k-cross: docker-image-debian-sid
 docker-image-debian-sh4-cross: docker-image-debian-sid
 docker-image-debian-sparc64-cross: docker-image-debian-sid
 docker-image-debian-mips64-cross: docker-image-debian-sid
+docker-image-debian-riscv64-cross: docker-image-debian-sid
 docker-image-travis: NOUSER=1
 
 # Specialist build images, sometimes very limited tools
tests/docker/dockerfiles/debian-riscv64-cross.docker new file +12 -0
new file mode 100644
index 0000000000..2b2e64cee6
@@ -0,0 +1,12 @@
+#
+# Docker cross-compiler target
+#
+# This docker target builds on the debian sid base image which
+# contains cross compilers for Debian "ports" targets.
+#
+FROM qemu:debian-sid
+
+RUN DEBIAN_FRONTEND=noninteractive eatmydata \
+    apt-get install -y --no-install-recommends \
+        gcc-riscv64-linux-gnu \
+        libc6-dev-riscv64-cross
tests/tcg/riscv/Makefile.include new file +10 -0
new file mode 100644
index 0000000000..d92ac6c89f
@@ -0,0 +1,10 @@
+#
+# Makefile.include for all RISCV targets
+#
+# Debian only really cares about 64 bit going forward
+#
+
+ifeq ($(TARGET_NAME),riscv64)
+DOCKER_IMAGE=debian-riscv64-cross
+DOCKER_CROSS_COMPILER=riscv64-linux-gnu-gcc
+endif
Signature · 1 line
2.17.1
#40 lore raw

PATCH v6 39/49 docker: move debian-powerpc-cross to sid based build

In reply to Alex Bennée

The original Jessie based cross builder hasn't worked for a while. The state of the libraries is still perilous for cross-building QEMU but we can use it for building TCG tests.

The debian-apt-fake.sh script can also be dropped as it is no longer used.

---
 tests/docker/Makefile.include                 |  4 +-
 tests/docker/dockerfiles/debian-apt-fake.sh   | 46 -------------------
 .../dockerfiles/debian-powerpc-cross.docker   | 39 +++-------------
 tests/docker/dockerfiles/debian8.docker       |  3 --
 4 files changed, 7 insertions(+), 85 deletions(-)
 delete mode 100755 tests/docker/dockerfiles/debian-apt-fake.sh
tests/docker/Makefile.include +1 -3
index 10f98916f9..78568d7c61 100644
@@ -47,8 +47,6 @@ docker-image-%: $(DOCKER_FILES_DIR)/%.docker
 		$(if $(EXECUTABLE),--include-executable=$(EXECUTABLE)),\
 		"BUILD","$*")
 
-docker-image-debian-powerpc-cross: EXTRA_FILES:=$(SRC_PATH)/tests/docker/dockerfiles/debian-apt-fake.sh
-
 # Enforce dependencies for composite images
 docker-image-debian: docker-image-debian9
 docker-image-debian8-mxe: docker-image-debian8
@@ -58,7 +56,6 @@ docker-image-debian-armhf-cross: docker-image-debian9
 docker-image-debian-arm64-cross: docker-image-debian9
 docker-image-debian-mips-cross: docker-image-debian9
 docker-image-debian-mips64el-cross: docker-image-debian9
-docker-image-debian-powerpc-cross: docker-image-debian8
 docker-image-debian-ppc64el-cross: docker-image-debian9
 docker-image-debian-s390x-cross: docker-image-debian9
 docker-image-debian-win32-cross: docker-image-debian8-mxe
@@ -76,6 +73,7 @@ docker-image-debian-sh4-cross: docker-image-debian-sid
 docker-image-debian-sparc64-cross: docker-image-debian-sid
 docker-image-debian-mips64-cross: docker-image-debian-sid
 docker-image-debian-riscv64-cross: docker-image-debian-sid
+docker-image-debian-powerpc-cross: docker-image-debian-sid
 docker-image-travis: NOUSER=1
 
 # Specialist build images, sometimes very limited tools
tests/docker/dockerfiles/debian-apt-fake.sh deleted +0 -46

46 lines not on this page · raw message

tests/docker/dockerfiles/debian-powerpc-cross.docker +6 -33
index a5dd46b4ac..5e62ca0df1 100644
@@ -1,40 +1,13 @@
 #
 # Docker powerpc cross-compiler target
 #
-# This docker target builds on the debian Jessie base image.
+# This docker target builds on the debian sid base image which
+# contains cross compilers for Debian "ports" targets. The original
+# Jessie based no longer builds.
 #
-FROM qemu:debian8
-MAINTAINER Philippe Mathieu-Daudé <[email protected]>
+FROM qemu:debian-sid
 
-# Add the foreign architecture we want and install dependencies
-RUN dpkg --add-architecture powerpc
-RUN apt-get update
 RUN DEBIAN_FRONTEND=noninteractive eatmydata \
     apt-get install -y --no-install-recommends \
-        crossbuild-essential-powerpc
-
-# <kludge> to fix "following packages have unmet dependencies" ...
-ADD debian-apt-fake.sh /usr/local/bin/apt-fake
-RUN apt-get install -y --no-install-recommends \
-        equivs \
-        pkg-config
-RUN apt-fake install \
-        pkg-config:powerpc=0.28-1.1-fake && \
-    ln -s pkg-config /usr/bin/powerpc-linux-gnu-pkg-config
-ENV PKG_CONFIG_PATH /usr/lib/powerpc-linux-gnu/pkgconfig
-# </kludge>
-
-# Specify the cross prefix for this image (see tests/docker/common.rc)
-ENV QEMU_CONFIGURE_OPTS --cross-prefix=powerpc-linux-gnu-
-
-RUN DEBIAN_FRONTEND=noninteractive eatmydata \
-    apt-get build-dep -yy -a powerpc qemu
-RUN DEBIAN_FRONTEND=noninteractive \
-    apt-get install -y --no-install-recommends \
-        glusterfs-common:powerpc \
-        libbz2-dev:powerpc \
-        liblzo2-dev:powerpc \
-        libncursesw5-dev:powerpc \
-        libnfs-dev:powerpc \
-        librdmacm-dev:powerpc \
-        libsnappy-dev:powerpc
+        gcc-powerpc-linux-gnu \
+        libc6-dev-powerpc-cross || { echo "Failed to build - see debian-sid.docker notes"; exit 1; }
tests/docker/dockerfiles/debian8.docker +0 -3
index 1bcf2e3d2f..52945631cd 100644
@@ -32,6 +32,3 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \
         pkg-config \
         python-minimal
 
-# Setup Emdebian [emdebian-archive-keyring]
-RUN echo "deb http://emdebian.org/tools/debian/ jessie main" > /etc/apt/sources.list.d/emdebian.list && \
-    curl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | apt-key add -
Signature · 1 line
2.17.1
Reviewed-by Tested-by on v6 39/49
#41 lore raw

Re: [Qemu-devel] [PATCH v6 39/49] docker: move debian-powerpc-cross to sid based build

Quoted 8 lines · Alex Bennée

The original Jessie based cross builder hasn't worked for a while. The state of the libraries is still perilous for cross-building QEMU but we can use it for building TCG tests.

The debian-apt-fake.sh script can also be dropped as it is no longer used.

Quoted 152 lines
---
 tests/docker/Makefile.include                 |  4 +-
 tests/docker/dockerfiles/debian-apt-fake.sh   | 46 -------------------
 .../dockerfiles/debian-powerpc-cross.docker   | 39 +++-------------
 tests/docker/dockerfiles/debian8.docker       |  3 --
 4 files changed, 7 insertions(+), 85 deletions(-)
 delete mode 100755 tests/docker/dockerfiles/debian-apt-fake.sh
tests/docker/Makefile.include +1 -3
index 10f98916f9..78568d7c61 100644
@@ -47,8 +47,6 @@ docker-image-%: $(DOCKER_FILES_DIR)/%.docker
 		$(if $(EXECUTABLE),--include-executable=$(EXECUTABLE)),\
 		"BUILD","$*")
 
-docker-image-debian-powerpc-cross: EXTRA_FILES:=$(SRC_PATH)/tests/docker/dockerfiles/debian-apt-fake.sh
-
 # Enforce dependencies for composite images
 docker-image-debian: docker-image-debian9
 docker-image-debian8-mxe: docker-image-debian8
@@ -58,7 +56,6 @@ docker-image-debian-armhf-cross: docker-image-debian9
 docker-image-debian-arm64-cross: docker-image-debian9
 docker-image-debian-mips-cross: docker-image-debian9
 docker-image-debian-mips64el-cross: docker-image-debian9
-docker-image-debian-powerpc-cross: docker-image-debian8
 docker-image-debian-ppc64el-cross: docker-image-debian9
 docker-image-debian-s390x-cross: docker-image-debian9
 docker-image-debian-win32-cross: docker-image-debian8-mxe
@@ -76,6 +73,7 @@ docker-image-debian-sh4-cross: docker-image-debian-sid
 docker-image-debian-sparc64-cross: docker-image-debian-sid
 docker-image-debian-mips64-cross: docker-image-debian-sid
 docker-image-debian-riscv64-cross: docker-image-debian-sid
+docker-image-debian-powerpc-cross: docker-image-debian-sid
 docker-image-travis: NOUSER=1
 
 # Specialist build images, sometimes very limited tools
tests/docker/dockerfiles/debian-apt-fake.sh deleted +0 -46
deleted file mode 100755
index 2ec0fdf47a..0000000000
@@ -1,46 +0,0 @@
-#! /bin/sh
-#
-# Generate fake debian package to resolve unimportant unmet dependencies held
-# by upstream multiarch broken packages.
-#
-# Copyright (c) 2017 Philippe Mathieu-Daudé <[email protected]>
-#
-# This work is licensed under the terms of the GNU GPL, version 2
-# or (at your option) any later version. See the COPYING file in
-# the top-level directory.
-
-test $1 = "install" && shift 1
-
-fake_install()
-{
-    echo "Generating fake $2 $1 $3 ..."
-    (cd /var/cache/apt/archives
-        (cat << 'EOF'
-Section: misc
-Priority: optional
-Standards-Version: 3.9.2
-
-Package: NAME
-Version: VERSION
-Maintainer: [email protected]
-Architecture: any
-Multi-Arch: same
-Description: fake NAME
-EOF
-        ) | sed s/NAME/$2/g | sed s/VERSION/$3/g > $2.control
-        equivs-build -a $1 $2.control 1>/dev/null 2>/dev/null
-        dpkg -i --force-overwrite $2_$3_$1.deb
-    )
-}
-
-try_install()
-{
-    name=$(echo $1|sed "s/\(.*\):\(.*\)=\(.*\)/\1/")
-    arch=$(echo $1|sed "s/\(.*\):\(.*\)=\(.*\)/\2/")
-    vers=$(echo $1|sed "s/\(.*\):\(.*\)=\(.*\)/\3/")
-    apt-get install -q -yy $1 || fake_install $arch $name $vers
-}
-
-for package in $*; do
-    try_install $package
-done
tests/docker/dockerfiles/debian-powerpc-cross.docker +6 -33
index a5dd46b4ac..5e62ca0df1 100644
@@ -1,40 +1,13 @@
 #
 # Docker powerpc cross-compiler target
 #
-# This docker target builds on the debian Jessie base image.
+# This docker target builds on the debian sid base image which
+# contains cross compilers for Debian "ports" targets. The original
+# Jessie based no longer builds.
 #
-FROM qemu:debian8
-MAINTAINER Philippe Mathieu-Daudé <[email protected]>
+FROM qemu:debian-sid
 
-# Add the foreign architecture we want and install dependencies
-RUN dpkg --add-architecture powerpc
-RUN apt-get update
 RUN DEBIAN_FRONTEND=noninteractive eatmydata \
     apt-get install -y --no-install-recommends \
-        crossbuild-essential-powerpc
-
-# <kludge> to fix "following packages have unmet dependencies" ...
-ADD debian-apt-fake.sh /usr/local/bin/apt-fake
-RUN apt-get install -y --no-install-recommends \
-        equivs \
-        pkg-config
-RUN apt-fake install \
-        pkg-config:powerpc=0.28-1.1-fake && \
-    ln -s pkg-config /usr/bin/powerpc-linux-gnu-pkg-config
-ENV PKG_CONFIG_PATH /usr/lib/powerpc-linux-gnu/pkgconfig
-# </kludge>
-
-# Specify the cross prefix for this image (see tests/docker/common.rc)
-ENV QEMU_CONFIGURE_OPTS --cross-prefix=powerpc-linux-gnu-
-
-RUN DEBIAN_FRONTEND=noninteractive eatmydata \
-    apt-get build-dep -yy -a powerpc qemu
-RUN DEBIAN_FRONTEND=noninteractive \
-    apt-get install -y --no-install-recommends \
-        glusterfs-common:powerpc \
-        libbz2-dev:powerpc \
-        liblzo2-dev:powerpc \
-        libncursesw5-dev:powerpc \
-        libnfs-dev:powerpc \
-        librdmacm-dev:powerpc \
-        libsnappy-dev:powerpc
+        gcc-powerpc-linux-gnu \
+        libc6-dev-powerpc-cross || { echo "Failed to build - see debian-sid.docker notes"; exit 1; }
tests/docker/dockerfiles/debian8.docker +0 -3
index 1bcf2e3d2f..52945631cd 100644
@@ -32,6 +32,3 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \
         pkg-config \
         python-minimal
 
-# Setup Emdebian [emdebian-archive-keyring]
-RUN echo "deb http://emdebian.org/tools/debian/ jessie main" > /etc/apt/sources.list.d/emdebian.list && \
-    curl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | apt-key add -
#42 lore raw

PATCH v6 40/49 tests/tcg: enable building for PowerPC

In reply to Alex Bennée

Now we have restored debian-image-powerpc-cross using Debian SID compilers we can build for 32 bit powerpc. Although PPC32 supports a range of pages sizes currently only 4k works so the others are commented out for now.

We can also merge the ppc64 support under the base architecture directory to avoid too much proliferation of directories.

---
v5
- new for v5

---
 tests/tcg/ppc/Makefile.include     |  7 +++++++
 tests/tcg/ppc/Makefile.target      | 12 ++++++++++++
 tests/tcg/ppc64le/Makefile.include |  2 --
 3 files changed, 19 insertions(+), 2 deletions(-)
 create mode 100644 tests/tcg/ppc/Makefile.include
 create mode 100644 tests/tcg/ppc/Makefile.target
 delete mode 100644 tests/tcg/ppc64le/Makefile.include
tests/tcg/ppc/Makefile.include new file +7 -0
new file mode 100644
index 0000000000..b062c30dd3
@@ -0,0 +1,7 @@
+ifeq ($(TARGET_NAME),ppc)
+DOCKER_IMAGE=debian-powerpc-cross
+DOCKER_CROSS_COMPILER=powerpc-linux-gnu-gcc
+else ifeq ($(TARGET_NAME),ppc64le)
+DOCKER_IMAGE=debian-ppc64el-cross
+DOCKER_CROSS_COMPILER=powerpc64le-linux-gnu-gcc
+endif
tests/tcg/ppc/Makefile.target new file +12 -0
new file mode 100644
index 0000000000..f5e08c7376
@@ -0,0 +1,12 @@
+# -*- Mode: makefile -*-
+#
+# PPC - included from tests/tcg/Makefile
+#
+
+ifneq (,$(findstring 64,$(TARGET_NAME)))
+# On PPC64 Linux can be configured with 4k (default) or 64k pages (currently broken)
+EXTRA_RUNS+=run-test-mmap-4096 #run-test-mmap-65536
+else
+# On PPC32 Linux supports 4K/16K/64K/256K (but currently only 4k works)
+EXTRA_RUNS+=run-test-mmap-4096 #run-test-mmap-16384 run-test-mmap-65536 run-test-mmap-262144
+endif
tests/tcg/ppc64le/Makefile.include deleted +0 -2
deleted file mode 100644
index d71cfc9aa7..0000000000
@@ -1,2 +0,0 @@
-DOCKER_IMAGE=debian-ppc64el-cross
-DOCKER_CROSS_COMPILER=powerpc64le-linux-gnu-gcc
Signature · 1 line
2.17.1
Reviewed-by Tested-by on v6 40/49
#43 lore raw

Re: [Qemu-devel] [PATCH v6 40/49] tests/tcg: enable building for PowerPC

Quoted 7 lines · Alex Bennée

Now we have restored debian-image-powerpc-cross using Debian SID compilers we can build for 32 bit powerpc. Although PPC32 supports a range of pages sizes currently only 4k works so the others are commented out for now.

We can also merge the ppc64 support under the base architecture directory to avoid too much proliferation of directories.

ppc64el doesn't seem to work:

$ make subdir-ppc64le-linux-user build-tcg-tests-ppc64el-linux-user -j1
make[1]: *** ppc64el-linux-user: No such file or directory.  Stop.
make: *** [tests/Makefile.include:947:
build-tcg-tests-ppc64el-linux-user] Error 2
Quoted 1 line

ppc32:

Quoted 53 lines

---
v5
- new for v5

---
 tests/tcg/ppc/Makefile.include     |  7 +++++++
 tests/tcg/ppc/Makefile.target      | 12 ++++++++++++
 tests/tcg/ppc64le/Makefile.include |  2 --
 3 files changed, 19 insertions(+), 2 deletions(-)
 create mode 100644 tests/tcg/ppc/Makefile.include
 create mode 100644 tests/tcg/ppc/Makefile.target
 delete mode 100644 tests/tcg/ppc64le/Makefile.include
tests/tcg/ppc/Makefile.include new file +7 -0
new file mode 100644
index 0000000000..b062c30dd3
@@ -0,0 +1,7 @@
+ifeq ($(TARGET_NAME),ppc)
+DOCKER_IMAGE=debian-powerpc-cross
+DOCKER_CROSS_COMPILER=powerpc-linux-gnu-gcc
+else ifeq ($(TARGET_NAME),ppc64le)
+DOCKER_IMAGE=debian-ppc64el-cross
+DOCKER_CROSS_COMPILER=powerpc64le-linux-gnu-gcc
+endif
tests/tcg/ppc/Makefile.target new file +12 -0
new file mode 100644
index 0000000000..f5e08c7376
@@ -0,0 +1,12 @@
+# -*- Mode: makefile -*-
+#
+# PPC - included from tests/tcg/Makefile
+#
+
+ifneq (,$(findstring 64,$(TARGET_NAME)))
+# On PPC64 Linux can be configured with 4k (default) or 64k pages (currently broken)
+EXTRA_RUNS+=run-test-mmap-4096 #run-test-mmap-65536
+else
+# On PPC32 Linux supports 4K/16K/64K/256K (but currently only 4k works)
+EXTRA_RUNS+=run-test-mmap-4096 #run-test-mmap-16384 run-test-mmap-65536 run-test-mmap-262144
+endif
tests/tcg/ppc64le/Makefile.include deleted +0 -2
deleted file mode 100644
index d71cfc9aa7..0000000000
@@ -1,2 +0,0 @@
-DOCKER_IMAGE=debian-ppc64el-cross
-DOCKER_CROSS_COMPILER=powerpc64le-linux-gnu-gcc
#44 lore raw

Re: [Qemu-devel] [PATCH v6 40/49] tests/tcg: enable building for PowerPC

Quoted 9 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Alex Bennée

Now we have restored debian-image-powerpc-cross using Debian SID compilers we can build for 32 bit powerpc. Although PPC32 supports a range of pages sizes currently only 4k works so the others are commented out for now.

We can also merge the ppc64 support under the base architecture directory to avoid too much proliferation of directories.

Quoted 6 lines

ppc64el doesn't seem to work:

$ make subdir-ppc64le-linux-user build-tcg-tests-ppc64el-linux-user -j1
make[1]: *** ppc64el-linux-user: No such file or directory.  Stop.
make: *** [tests/Makefile.include:947:
build-tcg-tests-ppc64el-linux-user] Error 2

09:17:30 [alex@zen:~/l/q/qemu.git] testing/tcg-testing-revival-v7 + make run-tcg-tests-ppc64le-linux-user
BUILD debian9
BUILD debian-ppc64el-cross
CROSS-BUILD ppc64le guest-tests with docker qemu:debian-ppc64el-cross
BUILD debian9
BUILD debian-ppc64el-cross
CROSS-BUILD ppc64le guest-tests with docker qemu:debian-ppc64el-cross
CC ppc64le-linux-user/linux-user/main.o
LINK ppc64le-linux-user/qemu-ppc64le
RUN-TESTS for ppc64le

  TEST    test-mmap (default) on ppc64le
  TEST    sha1 on ppc64le
  TEST    linux-test on ppc64le
  TEST    testthread on ppc64le
  TEST    test-mmap (4096 byte pages) on ppc64le

The Debian and QEMU naming conventions switch....

Quoted 53 lines
Quoted 2 lines

ppc32:

Quoted 45 lines

---
v5
- new for v5

---
 tests/tcg/ppc/Makefile.include     |  7 +++++++
 tests/tcg/ppc/Makefile.target      | 12 ++++++++++++
 tests/tcg/ppc64le/Makefile.include |  2 --
 3 files changed, 19 insertions(+), 2 deletions(-)
 create mode 100644 tests/tcg/ppc/Makefile.include
 create mode 100644 tests/tcg/ppc/Makefile.target
 delete mode 100644 tests/tcg/ppc64le/Makefile.include
tests/tcg/ppc/Makefile.include new file +7 -0
new file mode 100644
index 0000000000..b062c30dd3
@@ -0,0 +1,7 @@
+ifeq ($(TARGET_NAME),ppc)
+DOCKER_IMAGE=debian-powerpc-cross
+DOCKER_CROSS_COMPILER=powerpc-linux-gnu-gcc
+else ifeq ($(TARGET_NAME),ppc64le)
+DOCKER_IMAGE=debian-ppc64el-cross
+DOCKER_CROSS_COMPILER=powerpc64le-linux-gnu-gcc
+endif
tests/tcg/ppc/Makefile.target new file +12 -0
new file mode 100644
index 0000000000..f5e08c7376
@@ -0,0 +1,12 @@
+# -*- Mode: makefile -*-
+#
+# PPC - included from tests/tcg/Makefile
+#
+
+ifneq (,$(findstring 64,$(TARGET_NAME)))
+# On PPC64 Linux can be configured with 4k (default) or 64k pages (currently broken)
+EXTRA_RUNS+=run-test-mmap-4096 #run-test-mmap-65536
+else
+# On PPC32 Linux supports 4K/16K/64K/256K (but currently only 4k works)
+EXTRA_RUNS+=run-test-mmap-4096 #run-test-mmap-16384 run-test-mmap-65536 run-test-mmap-262144
+endif
tests/tcg/ppc64le/Makefile.include +0 -0
Quoted 8 lines

tests/tcg/ppc64le/Makefile.include line 2

Quoted 8 lines

deleted file mode 100644
index d71cfc9aa7..0000000000

tests/tcg/ppc64le/Makefile.include deleted +0 -2
@@ -1,2 +0,0 @@
-DOCKER_IMAGE=debian-ppc64el-cross
-DOCKER_CROSS_COMPILER=powerpc64le-linux-gnu-gcc

--
Alex Bennée

#45 lore raw

PATCH v6 41/49 tests/tcg/Makefile: update to be called from Makefile.target

In reply to Alex Bennée

This make is now invoked from each individual target make with the appropriate CC and EXTRA_CFLAGS set for each guest. It then includes additional Makefile.targets from:

- tests/tcg/multiarch (always)
- tests/tcg/$(TARGET_BASE_ARCH) (if available)
- tests/tcg/$(TARGET_NAME)

The order is important as the later Makefile's may want to suppress TESTS from its base arch profile. Each included Makefile.target is responsible for adding TESTS as well as defining any special build instructions for individual tests.

---
v2
- cleaner approach to include sub makefiles
- move TESTS/VPATH manipulation into sub-makefile
- avoid double inclusion when TARGET_BASE_ARCH==TARGET_NAME
v4
- add timeout to default runner
- clean-up comments about build flags
- update to handle BUILD_STATIC
- add MAINTAINERS entry
v5
- support EXTRA_RUNS for run variants
v6
- extend timeout for DEBUG_TCG

---
 MAINTAINERS        |   5 ++
 tests/tcg/Makefile | 183 +++++++++++++++++++--------------------------
 2 files changed, 81 insertions(+), 107 deletions(-)
MAINTAINERS +5 -0
index b8fbef495b..4761f8cab4 100644
@@ -2144,6 +2144,11 @@ W: https://travis-ci.org/qemu/qemu
 W: https://app.shippable.com/github/qemu/qemu
 W: http://patchew.org/QEMU/
 
+Guest Test Compilation Support
+M: Alex Bennée <[email protected]>
+F: tests/tcg/Makefile
+L: [email protected]
+
 Documentation
 -------------
 Build system architecture
tests/tcg/Makefile +76 -107

201 lines not on this page · raw message

Signature · 1 line
2.17.1
#46 lore raw

Re: [Qemu-devel] [PATCH v6 41/49] tests/tcg/Makefile: update to be called from Makefile.target

Quoted 41 lines · Alex Bennée

This make is now invoked from each individual target make with the appropriate CC and EXTRA_CFLAGS set for each guest. It then includes additional Makefile.targets from:

- tests/tcg/multiarch (always)
- tests/tcg/$(TARGET_BASE_ARCH) (if available)
- tests/tcg/$(TARGET_NAME)

The order is important as the later Makefile's may want to suppress TESTS from its base arch profile. Each included Makefile.target is responsible for adding TESTS as well as defining any special build instructions for individual tests.

---
v2
- cleaner approach to include sub makefiles
- move TESTS/VPATH manipulation into sub-makefile
- avoid double inclusion when TARGET_BASE_ARCH==TARGET_NAME
v4
- add timeout to default runner
- clean-up comments about build flags
- update to handle BUILD_STATIC
- add MAINTAINERS entry
v5
- support EXTRA_RUNS for run variants
v6
- extend timeout for DEBUG_TCG

---
 MAINTAINERS        |   5 ++
 tests/tcg/Makefile | 183 +++++++++++++++++++--------------------------
 2 files changed, 81 insertions(+), 107 deletions(-)
MAINTAINERS +0 -0
index b8fbef495b..4761f8cab4 100644

MAINTAINERS W: https://travis-ci.org/qemu/qemu · line 2148

Quoted 5 lines
MAINTAINERS +2 -0
@@ -2144,6 +2144,11 @@ W: https://travis-ci.org/qemu/qemu
 W: https://app.shippable.com/github/qemu/qemu
 W: http://patchew.org/QEMU/
 
+Guest Test Compilation Support
+M: Alex Bennée <[email protected]>

Since I'm interested in cross-builds and planning further testing, can you also add a R-tag for me please?

R: Philippe Mathieu-Daudé <[email protected]>

Quoted 213 lines
MAINTAINERS +3 -0
+F: tests/tcg/Makefile
+L: [email protected]
+
 Documentation
 -------------
 Build system architecture
tests/tcg/Makefile +76 -107
index e12395117a..e7dbcdb5bf 100644
@@ -1,125 +1,94 @@
+# -*- Mode: makefile -*-
+#
+# TCG tests
+#
+# These are complicated by the fact we want to build them for guest
+# systems. This requires knowing what guests we are building and which
+# ones we have cross-compilers for or docker images with
+# cross-compilers.
+#
+# The tests themselves should be as minimal as possible as
+# cross-compilers don't always have a large amount of libraries
+# available.
+#
+# We only include the host build system for SRC_PATH and we don't
+# bother with the common rules.mk. We expect the following:
+#
+#   CC - the C compiler command
+#   EXTRA_CFLAGS - any extra CFLAGS
+#   BUILD_STATIC - are we building static binaries
+#
+# By default all tests are statically compiled but some host systems
+# may not package static libraries by default. If an external
+# cross-compiler can only build dynamic libraries the user might need
+# to make extra efforts to ensure ld.so can link at runtime when the
+# tests are run.
+#
+# We also accept SPEED=slow to enable slower running tests
+#
+# We also expect to be in the tests build dir for the FOO-linux-user.
+#
+
 -include ../../config-host.mak
--include $(SRC_PATH)/rules.mak
+-include ../config-target.mak
 
-$(call set-vpath, $(SRC_PATH)/tests/tcg)
+quiet-command = $(if $(V),$1,$(if $(2),@printf "  %-7s %s\n" $2 $3 && $1, @$1))
 
-QEMU=../../i386-linux-user/qemu-i386
-QEMU_X86_64=../../x86_64-linux-user/qemu-x86_64
-CC_X86_64=$(CC_I386) -m64
+# Tests we are building
+TESTS=
 
-QEMU_INCLUDES += -I../..
-CFLAGS=-Wall -O2 -g -fno-strict-aliasing
-#CFLAGS+=-msse2
+# Start with a blank slate, the build targets get to add stuff first
+CFLAGS=
+QEMU_CFLAGS=
 LDFLAGS=
 
-# TODO: automatically detect ARM and MIPS compilers, and run those too
-
-# runcom maps page 0, so it requires root privileges
-# also, pi_10.com runs indefinitely
-
-I386_TESTS=hello-i386 \
-	   sha1-i386 \
-	   test-i386 \
-	   test-i386-fprem \
-	   # runcom
+# The QEMU for this TARGET
+QEMU=../qemu-$(TARGET_NAME)
 
-# native i386 compilers sometimes are not biarch.  assume cross-compilers are
-ifneq ($(ARCH),i386)
-I386_TESTS+=run-test-x86_64
+# If TCG debugging is enabled things are a lot slower
+ifeq ($(CONFIG_DEBUG_TCG),y)
+TIMEOUT=45
+else
+TIMEOUT=15
 endif
 
-TESTS = test_path
-ifneq ($(call find-in-path, $(CC_I386)),)
-TESTS += $(I386_TESTS)
+# The order we include is important. We include multiarch, base arch
+# and finally arch if it's not the same as base arch.
+-include $(SRC_PATH)/tests/tcg/multiarch/Makefile.target
+-include $(SRC_PATH)/tests/tcg/$(TARGET_BASE_ARCH)/Makefile.target
+ifneq ($(TARGET_BASE_ARCH),$(TARGET_NAME))
+-include $(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.target
 endif
 
-all: $(patsubst %,run-%,$(TESTS))
-test: all
-
-# rules to run tests
-
-.PHONY: $(patsubst %,run-%,$(TESTS))
-
-run-%: %
-	-$(QEMU) ./$*
-
-run-hello-i386: hello-i386
-run-sha1-i386: sha1-i386
-
-run-test-i386: test-i386
-	./test-i386 > test-i386.ref
-	-$(QEMU) test-i386 > test-i386.out
-	@if diff -u test-i386.ref test-i386.out ; then echo "Auto Test OK"; fi
-
-run-test-i386-fprem: test-i386-fprem
-	./test-i386-fprem > test-i386-fprem.ref
-	-$(QEMU) test-i386-fprem > test-i386-fprem.out
-	@if diff -u test-i386-fprem.ref test-i386-fprem.out ; then echo "Auto Test OK"; fi
-
-run-test-x86_64: test-x86_64
-	./test-x86_64 > test-x86_64.ref
-	-$(QEMU_X86_64) test-x86_64 > test-x86_64.out
-	@if diff -u test-x86_64.ref test-x86_64.out ; then echo "Auto Test OK"; fi
-
-
-run-runcom: runcom
-	-$(QEMU) ./runcom $(SRC_PATH)/tests/pi_10.com
-
-run-test_path: test_path
-	./test_path
-
-# rules to compile tests
-
-hello-i386: hello-i386.c
-	$(CC_I386) -nostdlib $(CFLAGS) -static $(LDFLAGS) -o $@ $<
-	strip $@
-
-# i386/x86_64 emulation test (test various opcodes) */
-test-i386: test-i386.c test-i386-code16.S test-i386-vm86.S \
-           test-i386.h test-i386-shift.h test-i386-muldiv.h
-	$(CC_I386) $(QEMU_INCLUDES) $(CFLAGS) $(LDFLAGS) -o $@ \
-              $(<D)/test-i386.c $(<D)/test-i386-code16.S $(<D)/test-i386-vm86.S -lm
-
-test-i386-fprem: test-i386-fprem.c
-	$(CC_I386) $(QEMU_INCLUDES) $(CFLAGS) $(LDFLAGS) -o $@ $^
-
-test-x86_64: test-i386.c \
-           test-i386.h test-i386-shift.h test-i386-muldiv.h
-	$(CC_X86_64) $(QEMU_INCLUDES) $(CFLAGS) $(LDFLAGS) -o $@ $(<D)/test-i386.c -lm
-
-# vm86 test
-runcom: runcom.c
-	$(CC_I386) $(CFLAGS) $(LDFLAGS) -o $@ $<
-
-# speed test
-sha1-i386: sha1.c
-	$(CC_I386) $(CFLAGS) $(LDFLAGS) -o $@ $<
-
-# arm test
-hello-arm: hello-arm.o
-	arm-linux-ld -o $@ $<
+# Add the common build options
+CFLAGS+=-Wall -O0 -g -fno-strict-aliasing
+ifeq ($(BUILD_STATIC),y)
+LDFLAGS+=-static
+endif
 
-hello-arm.o: hello-arm.c
-	arm-linux-gcc -Wall -g -O2 -c -o $@ $<
+%: %.c
+	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
 
-test-arm-iwmmxt: test-arm-iwmmxt.s
-	cpp < $< | arm-linux-gnu-gcc -Wall -static -march=iwmmxt -mabi=aapcs -x assembler - -o $@
+all: $(TESTS)
 
-# MIPS test
-hello-mips: hello-mips.c
-	mips-linux-gnu-gcc -nostdlib -static -mno-abicalls -fno-PIC -mabi=32 -Wall -Wextra -g -O2 -o $@ $<
+#
+# Test Runners
+#
+# By default we just run the test with the appropriate QEMU for the
+# target. More advanced tests may want to override the runner in their
+# specific make rules. Additional runners for the same binary should
+# be added to EXTRA_RUNS.
+#
 
-hello-mipsel: hello-mips.c
-	mipsel-linux-gnu-gcc -nostdlib -static -mno-abicalls -fno-PIC -mabi=32 -Wall -Wextra -g -O2 -o $@ $<
+RUN_TESTS=$(patsubst %,run-%, $(TESTS))
+RUN_TESTS+=$(EXTRA_RUNS)
 
-# testsuite for the CRIS port.
-test-cris:
-	$(MAKE) -C cris check
+run-%: %
+	$(call quiet-command, \
+		timeout $(TIMEOUT) $(QEMU) $< > $<.out, \
+		"TEST", "$< on $(TARGET_NAME)")
 
-# testsuite for the LM32 port.
-test-lm32:
-	$(MAKE) -C lm32 check
+.PHONY: run
+run: $(RUN_TESTS)
 
-clean:
-	rm -f *~ *.o test-i386.out test-i386.ref \
-           test-x86_64.log test-x86_64.ref qruncom $(TESTS)
+# There is no clean target, the calling make just rm's the tests build dir
#47 lore raw

PATCH v6 42/49 Makefile.target: add (clean-/build-)guest-tests targets

In reply to Alex Bennée

Now all the build infrastructure is in place we can build tests for each guest that we support. That support mainly depends on having cross compilers installed or docker setup. To keep all the logic for that together we put the rules in tests/tcg/Makefile.include and include it from the main Makefile.target.

---
v4
- pulled Makefile.include bits from next patch
- added qemu-$(TARGET_NAME) dependency for running tests
- accept SPEED parameter to run slow tests
- pass BUILD_STATIC
- update MAINTAINERS
v6
- bare make -> $(MAKE) for sub-makes

---
 MAINTAINERS                |  1 +
 Makefile.target            |  5 +++
 tests/tcg/Makefile.include | 88 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 94 insertions(+)
 create mode 100644 tests/tcg/Makefile.include
MAINTAINERS +1 -0
index 4761f8cab4..6c1eca3a1c 100644
@@ -2147,6 +2147,7 @@ W: http://patchew.org/QEMU/
 Guest Test Compilation Support
 M: Alex Bennée <[email protected]>
 F: tests/tcg/Makefile
+F: tests/tcg/Makefile.include
 L: [email protected]
 
 Documentation
Makefile.target +5 -0
index dad2cf8778..a9d8928f96 100644
@@ -36,6 +36,11 @@ endif
 PROGS=$(QEMU_PROG) $(QEMU_PROGW)
 STPFILES=
 
+# Makefile Tests
+ifdef CONFIG_USER_ONLY
+include $(SRC_PATH)/tests/tcg/Makefile.include
+endif
+
 config-target.h: config-target.h-timestamp
 config-target.h-timestamp: config-target.mak
 
tests/tcg/Makefile.include new file +88 -0

88 lines not on this page · raw message

Signature · 1 line
2.17.1
Reviewed-by Tested-by on v6 42/49
#48 lore raw

Re: [Qemu-devel] [PATCH v6 42/49] Makefile.target: add (clean-/build-)guest-tests targets

Quoted 133 lines · Alex Bennée

Now all the build infrastructure is in place we can build tests for each guest that we support. That support mainly depends on having cross compilers installed or docker setup. To keep all the logic for that together we put the rules in tests/tcg/Makefile.include and include it from the main Makefile.target.

---
v4
- pulled Makefile.include bits from next patch
- added qemu-$(TARGET_NAME) dependency for running tests
- accept SPEED parameter to run slow tests
- pass BUILD_STATIC
- update MAINTAINERS
v6
- bare make -> $(MAKE) for sub-makes

---
 MAINTAINERS                |  1 +
 Makefile.target            |  5 +++
 tests/tcg/Makefile.include | 88 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 94 insertions(+)
 create mode 100644 tests/tcg/Makefile.include
MAINTAINERS +1 -0
index 4761f8cab4..6c1eca3a1c 100644
@@ -2147,6 +2147,7 @@ W: http://patchew.org/QEMU/
 Guest Test Compilation Support
 M: Alex Bennée <[email protected]>
 F: tests/tcg/Makefile
+F: tests/tcg/Makefile.include
 L: [email protected]
 
 Documentation
Makefile.target +5 -0
index dad2cf8778..a9d8928f96 100644
@@ -36,6 +36,11 @@ endif
 PROGS=$(QEMU_PROG) $(QEMU_PROGW)
 STPFILES=
 
+# Makefile Tests
+ifdef CONFIG_USER_ONLY
+include $(SRC_PATH)/tests/tcg/Makefile.include
+endif
+
 config-target.h: config-target.h-timestamp
 config-target.h-timestamp: config-target.mak
 
tests/tcg/Makefile.include new file +75 -0
new file mode 100644
index 0000000000..4851df0951
@@ -0,0 +1,88 @@
+# -*- Mode: makefile -*-
+#
+# TCG tests (per-target rules)
+#
+# This Makefile fragement is included from the per-target
+# Makefile.target so will be invoked for each linux-user program we
+# build. We have two options for compiling, either using a configured
+# guest compiler or calling one of our docker images to do it for us.
+#
+
+# The per ARCH makefile, if it exists, holds extra information about
+# useful docker images or alternative compiler flags.
+
+-include $(SRC_PATH)/tests/tcg/$(TARGET_BASE_ARCH)/Makefile.include
+-include $(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.include
+
+GUEST_BUILD=
+TCG_MAKE=$(SRC_PATH)/tests/tcg/Makefile
+# Support installed Cross Compilers
+
+ifdef CROSS_CC_GUEST
+
+.PHONY: cross-build-guest-tests
+cross-build-guest-tests:
+	$(call quiet-command, \
+	   (mkdir -p tests && cd tests && \
+	    $(MAKE) -f $(TCG_MAKE) CC=$(CROSS_CC_GUEST) \
+			BUILD_STATIC=$(CROSS_CC_GUEST_STATIC) \
+			EXTRA_CFLAGS=$(CROSS_CC_GUEST_CFLAGS)), \
+	"CROSS-BUILD","$(TARGET_NAME) guest-tests with $(CROSS_CC_GUEST)")
+
+GUEST_BUILD=cross-build-guest-tests
+
+endif
+
+# Support building with Docker
+
+ifeq ($(HAVE_USER_DOCKER)$(GUEST_BUILD),y)
+ifneq ($(DOCKER_IMAGE),)
+
+# We also need the Docker make rules to depend on
+include $(SRC_PATH)/tests/docker/Makefile.include
+
+DOCKER_COMPILE_CMD="$(DOCKER_SCRIPT) cc --user $(shell id -u) \
+		--cc $(DOCKER_CROSS_COMPILER) \
+		-i qemu:$(DOCKER_IMAGE) \
+		-s $(SRC_PATH) -- "
+DOCKER_PREREQ=docker-image-$(DOCKER_IMAGE)
+
+.PHONY: docker-build-guest-tests
+docker-build-guest-tests: $(DOCKER_PREREQ)
+	$(call quiet-command, \
+	  (mkdir -p tests && cd tests && \
+	   $(MAKE) -f $(TCG_MAKE) CC=$(DOCKER_COMPILE_CMD) \
+			BUILD_STATIC=y \
+			EXTRA_CFLAGS=$(DOCKER_CROSS_COMPILER_CFLAGS)), \
+	"CROSS-BUILD","$(TARGET_NAME) guest-tests with docker qemu:$(DOCKER_IMAGE)")
+
+GUEST_BUILD=docker-build-guest-tests
+
+endif
+endif
+
+# Final targets
+.PHONY: guest-tests
+
+ifneq ($(GUEST_BUILD),)
+guest-tests: $(GUEST_BUILD)
+
+run-guest-tests: guest-tests qemu-$(TARGET_NAME)
+	$(call quiet-command, \
+	(cd tests && $(MAKE) -f $(TCG_MAKE) SPEED=$(SPEED) run), \
+	"RUN-TESTS", "for $(TARGET_NAME)")
+
+else

tests/tcg/Makefile.include line 85

Quoted 10 lines
tests/tcg/Makefile.include new file +10 -0
+guest-tests:
+	$(call quiet-command, /bin/true, "CROSS-BUILD", \
+		"$(TARGET_NAME) guest-tests SKIPPED")
+
+run-guest-tests:
+	$(call quiet-command, /bin/true, "RUN-TESTS", \
+		"for $(TARGET_NAME) SKIPPED")
+endif
+
+# It doesn't mater if these don't exits

"matter"?

tests/tcg/Makefile.include line 88

Quoted 4 lines
tests/tcg/Makefile.include new file +3 -0
+.PHONY: clean-guest-tests
+clean-guest-tests:
+	rm -rf tests || echo "no $(TARGET_NAME) tests to remove"
#49 lore raw

PATCH v6 43/49 tests/Makefile.include: add [build|clean|check]-tcg targets

In reply to Alex Bennée

This will ensure all linux-user targets build their guest test programs and ensure check-tcg will run the respective tests.

---
v2
- use -include instead of complex macro stuff
- also include TARGET_BASE_ARCH/Makefile
v3
- add build-tcg, make check-tcg actually run tests

---
 tests/Makefile.include | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)
tests/Makefile.include +25 -1
index 0eaa835b8a..ca00247e36 100644
@@ -10,6 +10,7 @@ check-help:
 	@echo " $(MAKE) check-speed          Run qobject speed tests"
 	@echo " $(MAKE) check-qapi-schema    Run QAPI schema tests"
 	@echo " $(MAKE) check-block          Run block tests"
+	@echo " $(MAKE) check-tcg            Run TCG tests"
 	@echo " $(MAKE) check-report.html    Generates an HTML test report"
 	@echo " $(MAKE) check-clean          Clean the tests"
 	@echo
@@ -923,6 +924,30 @@ check-report.xml: $(patsubst %,check-report-qtest-%.xml, $(QTEST_TARGETS)) check
 check-report.html: check-report.xml
 	$(call quiet-command,gtester-report $< > $@,"GEN","$@")
 
+# Per guest TCG tests
+
+LINUX_USER_TARGETS=$(filter %-linux-user,$(TARGET_LIST))
+BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(LINUX_USER_TARGETS))
+CLEAN_TCG_TARGET_RULES=$(patsubst %,clean-tcg-tests-%, $(LINUX_USER_TARGETS))
+RUN_TCG_TARGET_RULES=$(patsubst %,run-tcg-tests-%, $(LINUX_USER_TARGETS))
+
+build-tcg-tests-%:
+	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" guest-tests,)
+
+run-tcg-tests-%: build-tcg-tests-%
+	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" run-guest-tests,)
+
+clean-tcg-tests-%:
+	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" clean-guest-tests,)
+
+.PHONY: build-tcg
+build-tcg: $(BUILD_TCG_TARGET_RULES)
+
+.PHONY: check-tcg
+check-tcg: $(RUN_TCG_TARGET_RULES)
+
+.PHONY: clean-tcg
+clean-tcg: $(CLEAN_TCG_TARGET_RULES)
 
 # Other tests
 
@@ -965,7 +990,6 @@ check-speed: $(patsubst %,check-%, $(check-speed-y))
 check-block: $(patsubst %,check-%, $(check-block-y))
 check: check-qapi-schema check-unit check-qtest check-decodetree
 check-clean:
-	$(MAKE) -C tests/tcg clean
 	rm -rf $(check-unit-y) tests/*.o $(QEMU_IOTESTS_HELPERS-y)
 	rm -rf $(sort $(foreach target,$(SYSEMU_TARGET_LIST), $(check-qtest-$(target)-y)) $(check-qtest-generic-y))
 	rm -f tests/test-qapi-gen-timestamp
Signature · 1 line
2.17.1
#50 lore raw

PATCH v6 44/49 tests/tcg: add run, diff, and skip helper macros

In reply to Alex Bennée

As we aren't using the default runners for all the test cases it is easy to miss out things like timeouts. To help with this we add some helpers and use them so we only need to make core changes in one place.

---
v5
- new for v5
v5.1
- diff-test->diff-out

---
 tests/tcg/Makefile                  | 13 ++++++++++---
 tests/tcg/aarch64/Makefile.target   |  6 ++----
 tests/tcg/arm/Makefile.target       |  6 ++----
 tests/tcg/i386/Makefile.target      | 10 ++++------
 tests/tcg/multiarch/Makefile.target |  4 ++--
 5 files changed, 20 insertions(+), 19 deletions(-)
tests/tcg/Makefile +10 -3
index e7dbcdb5bf..d4c5140210 100644
@@ -34,6 +34,15 @@
 
 quiet-command = $(if $(V),$1,$(if $(2),@printf "  %-7s %s\n" $2 $3 && $1, @$1))
 
+# $1 = test name, $2 = cmd, $3 = desc
+run-test = $(call quiet-command, timeout $(TIMEOUT) $2 > $1.out,"TEST",$3)
+
+# $1 = test name, $2 = reference
+diff-out = $(call quiet-command, diff -u $1.out $2 | head -n 10,"DIFF","$1.out with $2")
+
+# $1 = test name, $2 = reason
+skip-test = @printf "  SKIPPED %s because %s\n" $1 $2
+
 # Tests we are building
 TESTS=
 
@@ -84,9 +93,7 @@ RUN_TESTS=$(patsubst %,run-%, $(TESTS))
 RUN_TESTS+=$(EXTRA_RUNS)
 
 run-%: %
-	$(call quiet-command, \
-		timeout $(TIMEOUT) $(QEMU) $< > $<.out, \
-		"TEST", "$< on $(TARGET_NAME)")
+	$(call run-test, $<, $(QEMU) $<, "$< on $(TARGET_NAME)")
 
 .PHONY: run
 run: $(RUN_TESTS)
tests/tcg/aarch64/Makefile.target +2 -4
index 7dba32138d..08c45b8470 100644
@@ -13,7 +13,5 @@ TESTS:=$(AARCH64_TESTS)
 fcvt: LDFLAGS+=-lm
 
 run-fcvt: fcvt
-	$(call quiet-command, \
-		$(QEMU) $< > fcvt.out && \
-		diff -u $(AARCH64_SRC)/fcvt.ref fcvt.out, \
-		"TEST", "$< (default) on $(TARGET_NAME)")
+	$(call run-test,$<,$(QEMU) $<, "$< on $(TARGET_NAME)")
+	$(call diff-out,$<,$(AARCH64_SRC)/fcvt.ref)
tests/tcg/arm/Makefile.target +2 -4
index 14b5435fc6..aa4e4e3782 100644
@@ -24,10 +24,8 @@ fcvt: LDFLAGS+=-lm
 # fcvt: CFLAGS+=-march=armv8.2-a+fp16 -mfpu=neon-fp-armv8
 
 run-fcvt: fcvt
-	$(call quiet-command, \
-		$(QEMU) $< > fcvt.out && \
-		diff -u $(ARM_SRC)/fcvt.ref fcvt.out, \
-		"TEST", "$< (default) on $(TARGET_NAME)")
+	$(call run-test,fcvt,$(QEMU) $<,"$< on $(TARGET_NAME)")
+	$(call diff-out,fcvt,$(ARM_SRC)/fcvt.ref)
 endif
 
 # On ARM Linux only supports 4k pages
tests/tcg/i386/Makefile.target +4 -6
index cd173363ee..97b7c23cf1 100644
@@ -31,7 +31,7 @@ test-i386: test-i386.c test-i386-code16.S test-i386-vm86.S test-i386.h test-i386
 
 # Specialist test runners
 run-runcom: runcom pi_10.com
-	$(call quiet-command, $(QEMU) ./runcom $(I386_SRC)/pi_10.com > runcom.out, "TEST", "$< on $(TARGET_NAME)")
+	$(call run-test,$<,$(QEMU) ./runcom $(I386_SRC)/pi_10.com,"$< on $(TARGET_NAME)")
 
 ifeq ($(SPEED), slow)
 
@@ -40,13 +40,11 @@ test-i386-fprem.ref: test-i386-fprem
 
 run-test-i386-fprem: TIMEOUT=60
 run-test-i386-fprem: test-i386-fprem
-	$(call quiet-command, \
-		$(QEMU) $< > $<.out && \
-		diff -u $(I386_SRC)/$<.ref $<.out, \
-		"TEST", "$< (default) on $(TARGET_NAME)")
+	$(call run-test,test-i386-fprem, $(QEMU) $<,"$< on $(TARGET_NAME)")
+	$(call diff-out,test-i386-fprem, $(I386_SRC)/$<.ref)
 else
 run-test-i386-fprem: test-i386-fprem
-	$(call quiet-command, /bin/true, "SLOW TEST", "$< SKIPPED on $(TARGET_NAME)")
+	$(call skip-test, $<, "SLOW")
 endif
 
 # On i386 and x86_64 Linux only supports 4k pages (large pages are a different hack)
tests/tcg/multiarch/Makefile.target +2 -2
index 90e45a881e..b77084c146 100644
@@ -27,10 +27,10 @@ testthread: LDFLAGS+=-lpthread
 
 # default case (host page size)
 run-test-mmap: test-mmap
-	$(call quiet-command, $(QEMU) $< > test-mmap.out, "TEST", \
+	$(call run-test, test-mmap, $(QEMU) $<, \
 		"$< (default) on $(TARGET_NAME)")
 
 # additional page sizes (defined by each architecture adding to EXTRA_RUNS)
 run-test-mmap-%: test-mmap
-	$(call quiet-command, $(QEMU) -p $* $< > test-mmap-$*.out, "TEST", \
+	$(call run-test, test-mmap-$*, $(QEMU) -p $* $<,\
 		"$< ($* byte pages) on $(TARGET_NAME)")
Signature · 1 line
2.17.1
Reviewed-by Tested-by on v6 44/49
#51 lore raw

Re: [PATCH v6 44/49] tests/tcg: add run, diff, and skip helper macros

Quoted 4 lines · Alex Bennée

As we aren't using the default runners for all the test cases it is easy to miss out things like timeouts. To help with this we add some helpers and use them so we only need to make core changes in one place.

Thanks, much nicer now :)

Quoted 1 line
Quoted 124 lines

---
v5
- new for v5
v5.1
- diff-test->diff-out

---
 tests/tcg/Makefile                  | 13 ++++++++++---
 tests/tcg/aarch64/Makefile.target   |  6 ++----
 tests/tcg/arm/Makefile.target       |  6 ++----
 tests/tcg/i386/Makefile.target      | 10 ++++------
 tests/tcg/multiarch/Makefile.target |  4 ++--
 5 files changed, 20 insertions(+), 19 deletions(-)
tests/tcg/Makefile +10 -3
index e7dbcdb5bf..d4c5140210 100644
@@ -34,6 +34,15 @@
 
 quiet-command = $(if $(V),$1,$(if $(2),@printf "  %-7s %s\n" $2 $3 && $1, @$1))
 
+# $1 = test name, $2 = cmd, $3 = desc
+run-test = $(call quiet-command, timeout $(TIMEOUT) $2 > $1.out,"TEST",$3)
+
+# $1 = test name, $2 = reference
+diff-out = $(call quiet-command, diff -u $1.out $2 | head -n 10,"DIFF","$1.out with $2")
+
+# $1 = test name, $2 = reason
+skip-test = @printf "  SKIPPED %s because %s\n" $1 $2
+
 # Tests we are building
 TESTS=
 
@@ -84,9 +93,7 @@ RUN_TESTS=$(patsubst %,run-%, $(TESTS))
 RUN_TESTS+=$(EXTRA_RUNS)
 
 run-%: %
-	$(call quiet-command, \
-		timeout $(TIMEOUT) $(QEMU) $< > $<.out, \
-		"TEST", "$< on $(TARGET_NAME)")
+	$(call run-test, $<, $(QEMU) $<, "$< on $(TARGET_NAME)")
 
 .PHONY: run
 run: $(RUN_TESTS)
tests/tcg/aarch64/Makefile.target +2 -4
index 7dba32138d..08c45b8470 100644
@@ -13,7 +13,5 @@ TESTS:=$(AARCH64_TESTS)
 fcvt: LDFLAGS+=-lm
 
 run-fcvt: fcvt
-	$(call quiet-command, \
-		$(QEMU) $< > fcvt.out && \
-		diff -u $(AARCH64_SRC)/fcvt.ref fcvt.out, \
-		"TEST", "$< (default) on $(TARGET_NAME)")
+	$(call run-test,$<,$(QEMU) $<, "$< on $(TARGET_NAME)")
+	$(call diff-out,$<,$(AARCH64_SRC)/fcvt.ref)
tests/tcg/arm/Makefile.target +2 -4
index 14b5435fc6..aa4e4e3782 100644
@@ -24,10 +24,8 @@ fcvt: LDFLAGS+=-lm
 # fcvt: CFLAGS+=-march=armv8.2-a+fp16 -mfpu=neon-fp-armv8
 
 run-fcvt: fcvt
-	$(call quiet-command, \
-		$(QEMU) $< > fcvt.out && \
-		diff -u $(ARM_SRC)/fcvt.ref fcvt.out, \
-		"TEST", "$< (default) on $(TARGET_NAME)")
+	$(call run-test,fcvt,$(QEMU) $<,"$< on $(TARGET_NAME)")
+	$(call diff-out,fcvt,$(ARM_SRC)/fcvt.ref)
 endif
 
 # On ARM Linux only supports 4k pages
tests/tcg/i386/Makefile.target +4 -6
index cd173363ee..97b7c23cf1 100644
@@ -31,7 +31,7 @@ test-i386: test-i386.c test-i386-code16.S test-i386-vm86.S test-i386.h test-i386
 
 # Specialist test runners
 run-runcom: runcom pi_10.com
-	$(call quiet-command, $(QEMU) ./runcom $(I386_SRC)/pi_10.com > runcom.out, "TEST", "$< on $(TARGET_NAME)")
+	$(call run-test,$<,$(QEMU) ./runcom $(I386_SRC)/pi_10.com,"$< on $(TARGET_NAME)")
 
 ifeq ($(SPEED), slow)
 
@@ -40,13 +40,11 @@ test-i386-fprem.ref: test-i386-fprem
 
 run-test-i386-fprem: TIMEOUT=60
 run-test-i386-fprem: test-i386-fprem
-	$(call quiet-command, \
-		$(QEMU) $< > $<.out && \
-		diff -u $(I386_SRC)/$<.ref $<.out, \
-		"TEST", "$< (default) on $(TARGET_NAME)")
+	$(call run-test,test-i386-fprem, $(QEMU) $<,"$< on $(TARGET_NAME)")
+	$(call diff-out,test-i386-fprem, $(I386_SRC)/$<.ref)
 else
 run-test-i386-fprem: test-i386-fprem
-	$(call quiet-command, /bin/true, "SLOW TEST", "$< SKIPPED on $(TARGET_NAME)")
+	$(call skip-test, $<, "SLOW")
 endif
 
 # On i386 and x86_64 Linux only supports 4k pages (large pages are a different hack)
tests/tcg/multiarch/Makefile.target +2 -2
index 90e45a881e..b77084c146 100644
@@ -27,10 +27,10 @@ testthread: LDFLAGS+=-lpthread
 
 # default case (host page size)
 run-test-mmap: test-mmap
-	$(call quiet-command, $(QEMU) $< > test-mmap.out, "TEST", \
+	$(call run-test, test-mmap, $(QEMU) $<, \
 		"$< (default) on $(TARGET_NAME)")
 
 # additional page sizes (defined by each architecture adding to EXTRA_RUNS)
 run-test-mmap-%: test-mmap
-	$(call quiet-command, $(QEMU) -p $* $< > test-mmap-$*.out, "TEST", \
+	$(call run-test, test-mmap-$*, $(QEMU) -p $* $<,\
 		"$< ($* byte pages) on $(TARGET_NAME)")
#52 lore raw

PATCH v6 45/49 tests/tcg: override runners for broken tests

In reply to Alex Bennée

To get a clean run of check-tcg these tests are currently skipped:

- hello-mips for mips
- linux-test for sparc

---
v4
- document broken tests in commit
- temporarily demote fcvt while fixes percolate upstream
v5
- reinstate fcvt
- remove test-mmap overrides (done with EXTRA_RUNS now)
v6
- move to after the skip-test helper

---
 tests/tcg/mips/Makefile.target    | 3 +++
 tests/tcg/sparc64/Makefile.target | 7 ++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)
tests/tcg/mips/Makefile.target +3 -0
index 71f0c2dd53..086625f533 100644
@@ -17,3 +17,6 @@ hello-mips: LDFLAGS+=-nostdlib
 
 # For MIPS32 and 64 we have a bunch of extra tests in sub-directories
 # however they are intended for system tests.
+
+run-hello-mips: hello-mips
+	$(call skip-test, $<, "BROKEN")
tests/tcg/sparc64/Makefile.target +6 -1
index 408dace783..064c7a598b 100644
@@ -1,6 +1,11 @@
 # -*- Mode: makefile -*-
 #
-# sparc specific tweaks
+# sparc specific tweaks and masking out broken tests
+
+# different from the other hangs
+# /home/alex/lsrc/qemu/qemu.git/tests/tcg/multiarch/linux-test.c:264: Value too large for defined data type (ret=-1, errno=92/Value too large for defined data type)
+run-linux-test: linux-test
+	$(call skip-test, $<, "BROKEN")
 
 # On Sparc64 Linux support 8k pages
 EXTRA_RUNS+=run-test-mmap-8192
Signature · 1 line
2.17.1
Tested-by Reviewed-by on v6 45/49
#53 lore raw

Re: [Qemu-devel] [PATCH v6 45/49] tests/tcg: override runners for broken tests

Quoted 37 lines · Alex Bennée

To get a clean run of check-tcg these tests are currently skipped:

- hello-mips for mips
- linux-test for sparc

---
v4
- document broken tests in commit
- temporarily demote fcvt while fixes percolate upstream
v5
- reinstate fcvt
- remove test-mmap overrides (done with EXTRA_RUNS now)
v6
- move to after the skip-test helper

---
 tests/tcg/mips/Makefile.target    | 3 +++
 tests/tcg/sparc64/Makefile.target | 7 ++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)
tests/tcg/mips/Makefile.target +3 -0
index 71f0c2dd53..086625f533 100644
@@ -17,3 +17,6 @@ hello-mips: LDFLAGS+=-nostdlib
 
 # For MIPS32 and 64 we have a bunch of extra tests in sub-directories
 # however they are intended for system tests.
+
+run-hello-mips: hello-mips
+	$(call skip-test, $<, "BROKEN")
tests/tcg/sparc64/Makefile.target +0 -0
index 408dace783..064c7a598b 100644

tests/tcg/sparc64/Makefile.target line 6

Quoted 7 lines
tests/tcg/sparc64/Makefile.target +4 -1
@@ -1,6 +1,11 @@
 # -*- Mode: makefile -*-
 #
-# sparc specific tweaks
+# sparc specific tweaks and masking out broken tests
+
+# different from the other hangs
+# /home/alex/lsrc/qemu/qemu.git/tests/tcg/multiarch/linux-test.c:264: Value too large for defined data type (ret=-1, errno=92/Value too large for defined data type)

Dropping "/home/alex/lsrc/qemu/qemu.git/":

Quoted 6 lines
tests/tcg/sparc64/Makefile.target +2 -0
+run-linux-test: linux-test
+	$(call skip-test, $<, "BROKEN")
 
 # On Sparc64 Linux support 8k pages
 EXTRA_RUNS+=run-test-mmap-8192
#54 lore raw

PATCH v6 46/49 target/sh4: Fix translator.c assertion failure for gUSA

In reply to Alex Bennée

From: Richard Henderson <[email protected]>

The translator loop does not allow the tb_start hook to set dc->base.is_jmp; the only hook allowed to do that is translate_insn.

Split the work between init_disas_context where we validate the gUSA parameters, and translate_insn where we emit code.

---
 target/sh4/translate.c | 81 +++++++++++++++++++++++-------------------
 1 file changed, 44 insertions(+), 37 deletions(-)
target/sh4/translate.c +44 -37
index c716b74a0f..1b9a201d6d 100644
@@ -1895,35 +1895,18 @@ static void decode_opc(DisasContext * ctx)
    any sequence via cpu_exec_step_atomic, we can recognize the "normal"
    sequences and transform them into atomic operations as seen by the host.
 */
-static int decode_gusa(DisasContext *ctx, CPUSH4State *env, int *pmax_insns)
+static void decode_gusa(DisasContext *ctx, CPUSH4State *env)
 {
     uint16_t insns[5];
     int ld_adr, ld_dst, ld_mop;
     int op_dst, op_src, op_opc;
     int mv_src, mt_dst, st_src, st_mop;
     TCGv op_arg;
-
     uint32_t pc = ctx->base.pc_next;
     uint32_t pc_end = ctx->base.tb->cs_base;
-    int backup = sextract32(ctx->tbflags, GUSA_SHIFT, 8);
     int max_insns = (pc_end - pc) / 2;
     int i;
 
-    if (pc != pc_end + backup || max_insns < 2) {
-        /* This is a malformed gUSA region.  Don't do anything special,
-           since the interpreter is likely to get confused.  */
-        ctx->envflags &= ~GUSA_MASK;
-        return 0;
-    }
-
-    if (ctx->tbflags & GUSA_EXCLUSIVE) {
-        /* Regardless of single-stepping or the end of the page,
-           we must complete execution of the gUSA region while
-           holding the exclusive lock.  */
-        *pmax_insns = max_insns;
-        return 0;
-    }
-
     /* The state machine below will consume only a few insns.
        If there are more than that in a region, fail now.  */
     if (max_insns > ARRAY_SIZE(insns)) {
@@ -2140,7 +2123,6 @@ static int decode_gusa(DisasContext *ctx, CPUSH4State *env, int *pmax_insns)
     /*
      * Emit the operation.
      */
-    tcg_gen_insn_start(pc, ctx->envflags);
     switch (op_opc) {
     case -1:
         /* No operation found.  Look for exchange pattern.  */
@@ -2235,7 +2217,8 @@ static int decode_gusa(DisasContext *ctx, CPUSH4State *env, int *pmax_insns)
     /* The entire region has been translated.  */
     ctx->envflags &= ~GUSA_MASK;
     ctx->base.pc_next = pc_end;
-    return max_insns;
+    ctx->base.num_insns += max_insns - 1;
+    return;
 
  fail:
     qemu_log_mask(LOG_UNIMP, "Unrecognized gUSA sequence %08x-%08x\n",
@@ -2243,7 +2226,6 @@ static int decode_gusa(DisasContext *ctx, CPUSH4State *env, int *pmax_insns)
 
     /* Restart with the EXCLUSIVE bit set, within a TB run via
        cpu_exec_step_atomic holding the exclusive lock.  */
-    tcg_gen_insn_start(pc, ctx->envflags);
     ctx->envflags |= GUSA_EXCLUSIVE;
     gen_save_cpu_state(ctx, false);
     gen_helper_exclusive(cpu_env);
@@ -2254,7 +2236,7 @@ static int decode_gusa(DisasContext *ctx, CPUSH4State *env, int *pmax_insns)
        entire region consumed via ctx->base.pc_next so that it's immediately
        available in the disassembly dump.  */
     ctx->base.pc_next = pc_end;
-    return 1;
+    ctx->base.num_insns += max_insns - 1;
 }
 #endif
 
@@ -2262,19 +2244,39 @@ static void sh4_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
 {
     DisasContext *ctx = container_of(dcbase, DisasContext, base);
     CPUSH4State *env = cs->env_ptr;
+    uint32_t tbflags;
     int bound;
 
-    ctx->tbflags = (uint32_t)ctx->base.tb->flags;
-    ctx->envflags = ctx->base.tb->flags & TB_FLAG_ENVFLAGS_MASK;
-    ctx->memidx = (ctx->tbflags & (1u << SR_MD)) == 0 ? 1 : 0;
+    ctx->tbflags = tbflags = ctx->base.tb->flags;
+    ctx->envflags = tbflags & TB_FLAG_ENVFLAGS_MASK;
+    ctx->memidx = (tbflags & (1u << SR_MD)) == 0 ? 1 : 0;
     /* We don't know if the delayed pc came from a dynamic or static branch,
        so assume it is a dynamic branch.  */
     ctx->delayed_pc = -1; /* use delayed pc from env pointer */
     ctx->features = env->features;
-    ctx->has_movcal = (ctx->tbflags & TB_FLAG_PENDING_MOVCA);
-    ctx->gbank = ((ctx->tbflags & (1 << SR_MD)) &&
-                  (ctx->tbflags & (1 << SR_RB))) * 0x10;
-    ctx->fbank = ctx->tbflags & FPSCR_FR ? 0x10 : 0;
+    ctx->has_movcal = (tbflags & TB_FLAG_PENDING_MOVCA);
+    ctx->gbank = ((tbflags & (1 << SR_MD)) &&
+                  (tbflags & (1 << SR_RB))) * 0x10;
+    ctx->fbank = tbflags & FPSCR_FR ? 0x10 : 0;
+
+    if (tbflags & GUSA_MASK) {
+        uint32_t pc = ctx->base.pc_next;
+        uint32_t pc_end = ctx->base.tb->cs_base;
+        int backup = sextract32(ctx->tbflags, GUSA_SHIFT, 8);
+        int max_insns = (pc_end - pc) / 2;
+
+        if (pc != pc_end + backup || max_insns < 2) {
+            /* This is a malformed gUSA region.  Don't do anything special,
+               since the interpreter is likely to get confused.  */
+            ctx->envflags &= ~GUSA_MASK;
+        } else if (tbflags & GUSA_EXCLUSIVE) {
+            /* Regardless of single-stepping or the end of the page,
+               we must complete execution of the gUSA region while
+               holding the exclusive lock.  */
+            ctx->base.max_insns = max_insns;
+            return;
+        }
+    }
 
     /* Since the ISA is fixed-width, we can bound by the number
        of instructions remaining on the page.  */
@@ -2284,14 +2286,6 @@ static void sh4_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
 
 static void sh4_tr_tb_start(DisasContextBase *dcbase, CPUState *cs)
 {
-#ifdef CONFIG_USER_ONLY
-    DisasContext *ctx = container_of(dcbase, DisasContext, base);
-    CPUSH4State *env = cs->env_ptr;
-
-    if (ctx->tbflags & GUSA_MASK) {
-        ctx->base.num_insns = decode_gusa(ctx, env, &ctx->base.max_insns);
-    }
-#endif
 }
 
 static void sh4_tr_insn_start(DisasContextBase *dcbase, CPUState *cs)
@@ -2323,6 +2317,19 @@ static void sh4_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs)
     CPUSH4State *env = cs->env_ptr;
     DisasContext *ctx = container_of(dcbase, DisasContext, base);
 
+#ifdef CONFIG_USER_ONLY
+    if (unlikely(ctx->envflags & GUSA_MASK)
+        && !(ctx->envflags & GUSA_EXCLUSIVE)) {
+        /* We're in an gUSA region, and we have not already fallen
+           back on using an exclusive region.  Attempt to parse the
+           region into a single supported atomic operation.  Failure
+           is handled within the parser by raising an exception to
+           retry using an exclusive region.  */
+        decode_gusa(ctx, env);
+        return;
+    }
+#endif
+
     ctx->opcode = cpu_lduw_code(env, ctx->base.pc_next);
     decode_opc(ctx);
     ctx->base.pc_next += 2;
Signature · 1 line
2.17.1
#55 lore raw

PATCH v6 47/49 tests: add top-level make dependency for docker builds

In reply to Alex Bennée

One problem with satisfying your docker dependencies in a sub-make it you might end up trying to satisfy the dependency multiple times. This is especially a problem with debian-sid based cross compilers and CI setups. We solve this by doing a docker build pass at the top level before any sub-makes are called.

We still need to satisfy dependencies in the Makefile.target call so people can run tests from individual target directories. We introduce a new Makefile.probe which gets called for each PROBE_TARGET and allows us to build up the list. It does require multiply including config-target.mak which shouldn't cause any issues as it shouldn't define anything that clashes with config-host.mak. However we undefine a few key variables each time around.

---
 tests/Makefile.include   | 14 +++++++++++++-
 tests/tcg/Makefile.probe | 31 +++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 1 deletion(-)
 create mode 100644 tests/tcg/Makefile.probe
tests/Makefile.include +13 -1
index ca00247e36..049a387436 100644
@@ -931,7 +931,19 @@ BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(LINUX_USER_TARGETS))
 CLEAN_TCG_TARGET_RULES=$(patsubst %,clean-tcg-tests-%, $(LINUX_USER_TARGETS))
 RUN_TCG_TARGET_RULES=$(patsubst %,run-tcg-tests-%, $(LINUX_USER_TARGETS))
 
-build-tcg-tests-%:
+# Probe for the Docker Builds we need for later
+DOCKER_BUILD_TARGETS:=
+$(foreach PROBE_TARGET,$(TARGET_LIST), 				\
+	$(eval -include $(SRC_PATH)/tests/tcg/Makefile.probe) 	\
+	$(if $(DOCKER_PREREQ), 					\
+		$(eval DOCKER_BUILD_TARGETS+=$(DOCKER_PREREQ))))
+
+$(info DOCKER_BUILD_TARGETS=$(sort $(DOCKER_BUILD_TARGETS)))
+
+.PHONY: build-docker-prereqs
+build-docker-prereqs: $(sort $(DOCKER_BUILD_TARGETS))
+
+build-tcg-tests-%: build-docker-prereqs
 	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" guest-tests,)
 
 run-tcg-tests-%: build-tcg-tests-%
tests/tcg/Makefile.probe new file +31 -0
new file mode 100644
index 0000000000..7529e203ad
@@ -0,0 +1,31 @@
+# -*- Mode: makefile -*-
+#
+# TCG Compiler Probe
+#
+# This Makefile fragement is included multiple times in the main make
+# script to probe for available compilers. This is used to build up a
+# selection of required docker targets before we invoke a sub-make for
+# each target.
+
+# First we need the target makefile which tells us the target architecture
+-include $(BUILD_DIR)/$(PROBE_TARGET)/config-target.mak
+
+# Then we load up the target architecture makefiles which tell us
+# about the compilers
+undefine CROSS_CC_GUEST
+undefine DOCKER_IMAGE
+DOCKER_PREREQ:=
+
+-include $(SRC_PATH)/tests/tcg/$(TARGET_BASE_ARCH)/Makefile.include
+-include $(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.include
+
+ifndef CROSS_CC_GUEST
+ifneq ($(DOCKER_IMAGE),)
+DOCKER_PREREQ:=docker-image-$(DOCKER_IMAGE)
+endif
+endif
+
+# Clean-up
+undefine TARGET_NAME
+undefine TARGET_BASE_ARCH
+undefine TARGET_ABI_DIR
Signature · 1 line
2.17.1
#56 lore raw

Re: [Qemu-devel] [PATCH v6 47/49] tests: add top-level make dependency for docker builds

Hi Alex,

Quoted 28 lines · Alex Bennée

One problem with satisfying your docker dependencies in a sub-make it you might end up trying to satisfy the dependency multiple times. This is especially a problem with debian-sid based cross compilers and CI setups. We solve this by doing a docker build pass at the top level before any sub-makes are called.

We still need to satisfy dependencies in the Makefile.target call so people can run tests from individual target directories. We introduce a new Makefile.probe which gets called for each PROBE_TARGET and allows us to build up the list. It does require multiply including config-target.mak which shouldn't cause any issues as it shouldn't define anything that clashes with config-host.mak. However we undefine a few key variables each time around.

---
 tests/Makefile.include   | 14 +++++++++++++-
 tests/tcg/Makefile.probe | 31 +++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 1 deletion(-)
 create mode 100644 tests/tcg/Makefile.probe
tests/Makefile.include +0 -0
index ca00247e36..049a387436 100644
@@ -931,7 +931,19 @@ BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(LINUX_USER_TARGETS))
 CLEAN_TCG_TARGET_RULES=$(patsubst %,clean-tcg-tests-%, $(LINUX_USER_TARGETS))
 RUN_TCG_TARGET_RULES=$(patsubst %,run-tcg-tests-%, $(LINUX_USER_TARGETS))

tests/Makefile.include BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(LINUX_USER_TARGETS)) · line 941

Quoted 10 lines
tests/Makefile.include +8 -1
 
-build-tcg-tests-%:
+# Probe for the Docker Builds we need for later
+DOCKER_BUILD_TARGETS:=
+$(foreach PROBE_TARGET,$(TARGET_LIST), 				\
+	$(eval -include $(SRC_PATH)/tests/tcg/Makefile.probe) 	\
+	$(if $(DOCKER_PREREQ), 					\
+		$(eval DOCKER_BUILD_TARGETS+=$(DOCKER_PREREQ))))
+
+$(info DOCKER_BUILD_TARGETS=$(sort $(DOCKER_BUILD_TARGETS)))

Is this verbose info on purpose?

Else this could be surrounded by something equiv to:

ifneq ($(V)$(DEBUG),)
...
endif

Quoted 46 lines
tests/Makefile.include +5 -0
+
+.PHONY: build-docker-prereqs
+build-docker-prereqs: $(sort $(DOCKER_BUILD_TARGETS))
+
+build-tcg-tests-%: build-docker-prereqs
 	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" guest-tests,)
 
 run-tcg-tests-%: build-tcg-tests-%
tests/tcg/Makefile.probe new file +31 -0
new file mode 100644
index 0000000000..7529e203ad
@@ -0,0 +1,31 @@
+# -*- Mode: makefile -*-
+#
+# TCG Compiler Probe
+#
+# This Makefile fragement is included multiple times in the main make
+# script to probe for available compilers. This is used to build up a
+# selection of required docker targets before we invoke a sub-make for
+# each target.
+
+# First we need the target makefile which tells us the target architecture
+-include $(BUILD_DIR)/$(PROBE_TARGET)/config-target.mak
+
+# Then we load up the target architecture makefiles which tell us
+# about the compilers
+undefine CROSS_CC_GUEST
+undefine DOCKER_IMAGE
+DOCKER_PREREQ:=
+
+-include $(SRC_PATH)/tests/tcg/$(TARGET_BASE_ARCH)/Makefile.include
+-include $(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.include
+
+ifndef CROSS_CC_GUEST
+ifneq ($(DOCKER_IMAGE),)
+DOCKER_PREREQ:=docker-image-$(DOCKER_IMAGE)
+endif
+endif
+
+# Clean-up
+undefine TARGET_NAME
+undefine TARGET_BASE_ARCH
+undefine TARGET_ABI_DIR
#57 lore raw

Re: [Qemu-devel] [PATCH v6 47/49] tests: add top-level make dependency for docker builds

Quoted 32 lines · Philippe Mathieu-Daudé

Hi Alex,

Quoted 29 lines · Alex Bennée

One problem with satisfying your docker dependencies in a sub-make it you might end up trying to satisfy the dependency multiple times. This is especially a problem with debian-sid based cross compilers and CI setups. We solve this by doing a docker build pass at the top level before any sub-makes are called.

We still need to satisfy dependencies in the Makefile.target call so people can run tests from individual target directories. We introduce a new Makefile.probe which gets called for each PROBE_TARGET and allows us to build up the list. It does require multiply including config-target.mak which shouldn't cause any issues as it shouldn't define anything that clashes with config-host.mak. However we undefine a few key variables each time around.

---
 tests/Makefile.include   | 14 +++++++++++++-
 tests/tcg/Makefile.probe | 31 +++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 1 deletion(-)
 create mode 100644 tests/tcg/Makefile.probe
tests/Makefile.include +0 -0
index ca00247e36..049a387436 100644
@@ -931,7 +931,19 @@ BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(LINUX_USER_TARGETS))
 CLEAN_TCG_TARGET_RULES=$(patsubst %,clean-tcg-tests-%, $(LINUX_USER_TARGETS))
 RUN_TCG_TARGET_RULES=$(patsubst %,run-tcg-tests-%, $(LINUX_USER_TARGETS))
 
Quoted 11 lines

tests/Makefile.include BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(LINUX_USER_TARGETS)) · line 941

Quoted 9 lines
tests/Makefile.include +8 -1
-build-tcg-tests-%:
+# Probe for the Docker Builds we need for later
+DOCKER_BUILD_TARGETS:=
+$(foreach PROBE_TARGET,$(TARGET_LIST), 				\
+	$(eval -include $(SRC_PATH)/tests/tcg/Makefile.probe) 	\
+	$(if $(DOCKER_PREREQ), 					\
+		$(eval DOCKER_BUILD_TARGETS+=$(DOCKER_PREREQ))))
+
+$(info DOCKER_BUILD_TARGETS=$(sort $(DOCKER_BUILD_TARGETS)))

Is this verbose info on purpose?

Ahh that slipped through, removed now.

Quoted 45 lines

Else this could be surrounded by something equiv to:

ifneq ($(V)$(DEBUG),)
...
endif

Quoted 38 lines
tests/Makefile.include +5 -0
+
+.PHONY: build-docker-prereqs
+build-docker-prereqs: $(sort $(DOCKER_BUILD_TARGETS))
+
+build-tcg-tests-%: build-docker-prereqs
 	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" guest-tests,)
 
 run-tcg-tests-%: build-tcg-tests-%
tests/tcg/Makefile.probe new file +24 -0
new file mode 100644
index 0000000000..7529e203ad
@@ -0,0 +1,31 @@
+# -*- Mode: makefile -*-
+#
+# TCG Compiler Probe
+#
+# This Makefile fragement is included multiple times in the main make
+# script to probe for available compilers. This is used to build up a
+# selection of required docker targets before we invoke a sub-make for
+# each target.
+
+# First we need the target makefile which tells us the target architecture
+-include $(BUILD_DIR)/$(PROBE_TARGET)/config-target.mak
+
+# Then we load up the target architecture makefiles which tell us
+# about the compilers
+undefine CROSS_CC_GUEST
+undefine DOCKER_IMAGE
+DOCKER_PREREQ:=
+
+-include $(SRC_PATH)/tests/tcg/$(TARGET_BASE_ARCH)/Makefile.include
+-include $(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.include
+
+ifndef CROSS_CC_GUEST
+ifneq ($(DOCKER_IMAGE),)
+DOCKER_PREREQ:=docker-image-$(DOCKER_IMAGE)
Quoted 8 lines

tests/tcg/Makefile.probe line 31

Quoted 8 lines
tests/tcg/Makefile.probe new file +7 -0
+endif
+endif
+
+# Clean-up
+undefine TARGET_NAME
+undefine TARGET_BASE_ARCH
+undefine TARGET_ABI_DIR

--
Alex Bennée

#58 lore raw

Re: [Qemu-devel] [PATCH v6 47/49] tests: add top-level make dependency for docker builds

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

One problem with satisfying your docker dependencies in a sub-make it you might end up trying to satisfy the dependency multiple times. This is especially a problem with debian-sid based cross compilers and CI setups. We solve this by doing a docker build pass at the top level before any sub-makes are called.

We still need to satisfy dependencies in the Makefile.target call so people can run tests from individual target directories. We introduce a new Makefile.probe which gets called for each PROBE_TARGET and allows us to build up the list. It does require multiply including config-target.mak which shouldn't cause any issues as it shouldn't define anything that clashes with config-host.mak. However we undefine a few key variables each time around.

---
 tests/Makefile.include   | 14 +++++++++++++-
 tests/tcg/Makefile.probe | 31 +++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 1 deletion(-)
 create mode 100644 tests/tcg/Makefile.probe
tests/Makefile.include +1 -1
index ca00247e36..049a387436 100644
@@ -931,7 +931,19 @@ BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(LINUX_USER_TARGETS))
 CLEAN_TCG_TARGET_RULES=$(patsubst %,clean-tcg-tests-%, $(LINUX_USER_TARGETS))
 RUN_TCG_TARGET_RULES=$(patsubst %,run-tcg-tests-%, $(LINUX_USER_TARGETS))
 
-build-tcg-tests-%:
+# Probe for the Docker Builds we need for later

tests/Makefile.include BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(LINUX_USER_TARGETS)) · line 944

Quoted 10 lines
tests/Makefile.include +10 -0
+DOCKER_BUILD_TARGETS:=
+$(foreach PROBE_TARGET,$(TARGET_LIST), 				\
+	$(eval -include $(SRC_PATH)/tests/tcg/Makefile.probe) 	\
+	$(if $(DOCKER_PREREQ), 					\
+		$(eval DOCKER_BUILD_TARGETS+=$(DOCKER_PREREQ))))
+
+$(info DOCKER_BUILD_TARGETS=$(sort $(DOCKER_BUILD_TARGETS)))
+
+.PHONY: build-docker-prereqs
+build-docker-prereqs: $(sort $(DOCKER_BUILD_TARGETS))

It seems now all docker images are built, even if you want to test a single arch... Using ~7GB of storage at once.

Quoted 43 lines
tests/Makefile.include +2 -0
+
+build-tcg-tests-%: build-docker-prereqs
 	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" guest-tests,)
 
 run-tcg-tests-%: build-tcg-tests-%
tests/tcg/Makefile.probe new file +31 -0
new file mode 100644
index 0000000000..7529e203ad
@@ -0,0 +1,31 @@
+# -*- Mode: makefile -*-
+#
+# TCG Compiler Probe
+#
+# This Makefile fragement is included multiple times in the main make
+# script to probe for available compilers. This is used to build up a
+# selection of required docker targets before we invoke a sub-make for
+# each target.
+
+# First we need the target makefile which tells us the target architecture
+-include $(BUILD_DIR)/$(PROBE_TARGET)/config-target.mak
+
+# Then we load up the target architecture makefiles which tell us
+# about the compilers
+undefine CROSS_CC_GUEST
+undefine DOCKER_IMAGE
+DOCKER_PREREQ:=
+
+-include $(SRC_PATH)/tests/tcg/$(TARGET_BASE_ARCH)/Makefile.include
+-include $(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.include
+
+ifndef CROSS_CC_GUEST
+ifneq ($(DOCKER_IMAGE),)
+DOCKER_PREREQ:=docker-image-$(DOCKER_IMAGE)
+endif
+endif
+
+# Clean-up
+undefine TARGET_NAME
+undefine TARGET_BASE_ARCH
+undefine TARGET_ABI_DIR
#59 lore raw

Re: [Qemu-devel] [PATCH v6 47/49] tests: add top-level make dependency for docker builds

Quoted 30 lines · Philippe Mathieu-Daudé
Quoted 29 lines · Alex Bennée

One problem with satisfying your docker dependencies in a sub-make it you might end up trying to satisfy the dependency multiple times. This is especially a problem with debian-sid based cross compilers and CI setups. We solve this by doing a docker build pass at the top level before any sub-makes are called.

We still need to satisfy dependencies in the Makefile.target call so people can run tests from individual target directories. We introduce a new Makefile.probe which gets called for each PROBE_TARGET and allows us to build up the list. It does require multiply including config-target.mak which shouldn't cause any issues as it shouldn't define anything that clashes with config-host.mak. However we undefine a few key variables each time around.

---
 tests/Makefile.include   | 14 +++++++++++++-
 tests/tcg/Makefile.probe | 31 +++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 1 deletion(-)
 create mode 100644 tests/tcg/Makefile.probe
tests/Makefile.include +0 -0
index ca00247e36..049a387436 100644
@@ -931,7 +931,19 @@ BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(LINUX_USER_TARGETS))
 CLEAN_TCG_TARGET_RULES=$(patsubst %,clean-tcg-tests-%, $(LINUX_USER_TARGETS))
 RUN_TCG_TARGET_RULES=$(patsubst %,run-tcg-tests-%, $(LINUX_USER_TARGETS))
 
Quoted 15 lines

tests/Makefile.include BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(LINUX_USER_TARGETS)) · line 944

Quoted 12 lines
tests/Makefile.include +11 -1
-build-tcg-tests-%:
+# Probe for the Docker Builds we need for later
+DOCKER_BUILD_TARGETS:=
+$(foreach PROBE_TARGET,$(TARGET_LIST), 				\
+	$(eval -include $(SRC_PATH)/tests/tcg/Makefile.probe) 	\
+	$(if $(DOCKER_PREREQ), 					\
+		$(eval DOCKER_BUILD_TARGETS+=$(DOCKER_PREREQ))))
+
+$(info DOCKER_BUILD_TARGETS=$(sort $(DOCKER_BUILD_TARGETS)))
+
+.PHONY: build-docker-prereqs
+build-docker-prereqs: $(sort $(DOCKER_BUILD_TARGETS))

It seems now all docker images are built, even if you want to test a single arch... Using ~7GB of storage at once.

I've moved build-docker-prereqs to build-tcg and made check-tcg depend on that. The single arch test case now relies on the sub-make building things.

Quoted 36 lines
Quoted 36 lines
tests/Makefile.include +2 -0
+
+build-tcg-tests-%: build-docker-prereqs
 	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" guest-tests,)
 
 run-tcg-tests-%: build-tcg-tests-%
tests/tcg/Makefile.probe new file +24 -0
new file mode 100644
index 0000000000..7529e203ad
@@ -0,0 +1,31 @@
+# -*- Mode: makefile -*-
+#
+# TCG Compiler Probe
+#
+# This Makefile fragement is included multiple times in the main make
+# script to probe for available compilers. This is used to build up a
+# selection of required docker targets before we invoke a sub-make for
+# each target.
+
+# First we need the target makefile which tells us the target architecture
+-include $(BUILD_DIR)/$(PROBE_TARGET)/config-target.mak
+
+# Then we load up the target architecture makefiles which tell us
+# about the compilers
+undefine CROSS_CC_GUEST
+undefine DOCKER_IMAGE
+DOCKER_PREREQ:=
+
+-include $(SRC_PATH)/tests/tcg/$(TARGET_BASE_ARCH)/Makefile.include
+-include $(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.include
+
+ifndef CROSS_CC_GUEST
+ifneq ($(DOCKER_IMAGE),)
+DOCKER_PREREQ:=docker-image-$(DOCKER_IMAGE)
Quoted 8 lines

tests/tcg/Makefile.probe line 31

Quoted 8 lines
tests/tcg/Makefile.probe new file +7 -0
+endif
+endif
+
+# Clean-up
+undefine TARGET_NAME
+undefine TARGET_BASE_ARCH
+undefine TARGET_ABI_DIR

--
Alex Bennée

#60 lore raw

PATCH v6 48/49 tests/docker: prevent sub-makes re-building debian-sid

In reply to Alex Bennée

This is a bit of a hack but having ensured Debian SID is built at least once in the top-level we don't need to do it over and over again. Perhaps a better solution would be to have docker.py spit out the dependency if a base image is too old?

---
 tests/docker/Makefile.include | 6 +++++-
 tests/tcg/Makefile.include    | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)
tests/docker/Makefile.include +5 -1
index 78568d7c61..3393e9f97d 100644
@@ -63,8 +63,12 @@ docker-image-debian-win64-cross: docker-image-debian8-mxe
 
 # Debian SID images - we are tracking a rolling distro so we want to
 # force a re-build of the base image if we ever need to build one of
-# its children.
+# its children. However when doing check-tcg we ensure everything is
+# built at top-level make so we can dispense with NOCACHE here to
+# avoid excessive re-builds.
+ifneq ($(SUBMAKE_NOCACHE_HACK),y)
 docker-image-debian-sid: NOCACHE=1
+endif
 
 docker-image-debian-alpha-cross: docker-image-debian-sid
 docker-image-debian-hppa-cross: docker-image-debian-sid
tests/tcg/Makefile.include +1 -0
index 4851df0951..951f40c28d 100644
@@ -39,6 +39,7 @@ ifeq ($(HAVE_USER_DOCKER)$(GUEST_BUILD),y)
 ifneq ($(DOCKER_IMAGE),)
 
 # We also need the Docker make rules to depend on
+SUBMAKE_NOCACHE_HACK=y
 include $(SRC_PATH)/tests/docker/Makefile.include
 
 DOCKER_COMPILE_CMD="$(DOCKER_SCRIPT) cc --user $(shell id -u) \
Signature · 1 line
2.17.1
#61 lore raw

PATCH v6 49/49 .travis.yml: add check-tcg test

In reply to Alex Bennée
---
 .travis.yml | 6 ++++++
 1 file changed, 6 insertions(+)
.travis.yml +6 -0
index 814be151f4..f1d2d9edec 100644
@@ -152,3 +152,9 @@ matrix:
         - TEST_CMD=""
       before_script:
         - ./configure ${CONFIG} --extra-cflags="-g3 -O0 -fsanitize=thread -fuse-ld=gold" || cat config.log
+    - env:
+        - CONFIG="--disable-system --disable-docs"
+        - TEST_CMD="make check-tcg"
+      sudo: required
+      dist: trusty
+      compiler: gcc
Signature · 1 line
2.17.1
Reviewed-by Tested-by on v6 49/49
#62 lore raw

Re: [Qemu-devel] [PATCH v6 49/49] .travis.yml: add check-tcg test

Hi Alex,

Quoted 10 lines · Alex Bennée
---
 .travis.yml | 6 ++++++
 1 file changed, 6 insertions(+)
.travis.yml +0 -0
index 814be151f4..f1d2d9edec 100644

.travis.yml matrix: · line 157

Quoted 6 lines
.travis.yml +3 -0
@@ -152,3 +152,9 @@ matrix:
         - TEST_CMD=""
       before_script:
         - ./configure ${CONFIG} --extra-cflags="-g3 -O0 -fsanitize=thread -fuse-ld=gold" || cat config.log
+    - env:
+        - CONFIG="--disable-system --disable-docs"
+        - TEST_CMD="make check-tcg"

Since we have default MAKEFLAGS="-j3"

I'm getting many failures:

CROSS-BUILD ppc64le guest-tests with docker qemu:debian-ppc64el-cross
BUILD debian-riscv64-cross
BUILD debian-s390x-cross
CROSS-BUILD riscv64 guest-tests with docker qemu:debian-riscv64-cross CROSS-BUILD s390x guest-tests with docker qemu:debian-s390x-cross
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs

    func(*targs, **kargs)

File "/home/travis/qemu/tests/docker/docker.py", line 174, in
_kill_instances
return self._do_kill_instances(True)
File "/home/travis/qemu/tests/docker/docker.py", line 154, in
_do_kill_instances

    resp = self._output(["inspect", i])
  File "/home/travis/qemu/tests/docker/docker.py", line 179, in _output
    **kwargs)

File "/usr/lib/python2.7/subprocess.py", line 223, in check_output
raise CalledProcessError(retcode, cmd, output=output)
CalledProcessError: Command '['docker', 'inspect', 'c71dbe973c55']' returned non-zero exit status 1
Error in sys.exitfunc:
Traceback (most recent call last):
File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs

    func(*targs, **kargs)

File "/home/travis/qemu/tests/docker/docker.py", line 174, in
_kill_instances
return self._do_kill_instances(True)
File "/home/travis/qemu/tests/docker/docker.py", line 154, in
_do_kill_instances

    resp = self._output(["inspect", i])
  File "/home/travis/qemu/tests/docker/docker.py", line 179, in _output
    **kwargs)

File "/usr/lib/python2.7/subprocess.py", line 223, in check_output
raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['docker', 'inspect', 'c71dbe973c55']' returned non-zero exit status 1
BUILD debian-sid
GEN sh4eb-linux-user/config-target.h
CROSS-BUILD sh4eb guest-tests SKIPPED
CROSS-BUILD sparc guest-tests SKIPPED
GEN sparc32plus-linux-user/config-target.h
CROSS-BUILD sparc32plus guest-tests SKIPPED
BUILD debian-sid

This works fine adding:

- MAKEFLAGS="-j1"

Adding MAKEFLAGS="-j1":

Quoted 4 lines
.travis.yml +3 -0
+      sudo: required
+      dist: trusty
+      compiler: gcc
#63 lore raw

Re: [Qemu-devel] [PATCH v6 49/49] .travis.yml: add check-tcg test

Quoted 69 lines · Philippe Mathieu-Daudé

Hi Alex,

Quoted 10 lines · Alex Bennée
---
 .travis.yml | 6 ++++++
 1 file changed, 6 insertions(+)
.travis.yml +0 -0
index 814be151f4..f1d2d9edec 100644

.travis.yml matrix: · line 157

Quoted 6 lines
.travis.yml +3 -0
@@ -152,3 +152,9 @@ matrix:
         - TEST_CMD=""
       before_script:
         - ./configure ${CONFIG} --extra-cflags="-g3 -O0 -fsanitize=thread -fuse-ld=gold" || cat config.log
+    - env:
+        - CONFIG="--disable-system --disable-docs"
+        - TEST_CMD="make check-tcg"

Since we have default MAKEFLAGS="-j3"

I'm getting many failures:

CROSS-BUILD ppc64le guest-tests with docker qemu:debian-ppc64el-cross
BUILD debian-riscv64-cross
BUILD debian-s390x-cross
CROSS-BUILD riscv64 guest-tests with docker qemu:debian-riscv64-cross CROSS-BUILD s390x guest-tests with docker qemu:debian-s390x-cross
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs

    func(*targs, **kargs)

File "/home/travis/qemu/tests/docker/docker.py", line 174, in
_kill_instances
return self._do_kill_instances(True)
File "/home/travis/qemu/tests/docker/docker.py", line 154, in
_do_kill_instances

    resp = self._output(["inspect", i])
  File "/home/travis/qemu/tests/docker/docker.py", line 179, in _output
    **kwargs)

File "/usr/lib/python2.7/subprocess.py", line 223, in check_output
raise CalledProcessError(retcode, cmd, output=output)
CalledProcessError: Command '['docker', 'inspect', 'c71dbe973c55']' returned non-zero exit status 1
Error in sys.exitfunc:
Traceback (most recent call last):
File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs

    func(*targs, **kargs)

File "/home/travis/qemu/tests/docker/docker.py", line 174, in
_kill_instances
return self._do_kill_instances(True)
File "/home/travis/qemu/tests/docker/docker.py", line 154, in
_do_kill_instances

    resp = self._output(["inspect", i])
  File "/home/travis/qemu/tests/docker/docker.py", line 179, in _output
    **kwargs)

File "/usr/lib/python2.7/subprocess.py", line 223, in check_output
raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['docker', 'inspect', 'c71dbe973c55']' returned non-zero exit status 1
BUILD debian-sid
GEN sh4eb-linux-user/config-target.h
CROSS-BUILD sh4eb guest-tests SKIPPED
CROSS-BUILD sparc guest-tests SKIPPED
GEN sparc32plus-linux-user/config-target.h
CROSS-BUILD sparc32plus guest-tests SKIPPED
BUILD debian-sid

Quoted 3 lines

This works fine adding:

- MAKEFLAGS="-j1"

Hmm I would really like to get this working properly. But I thought I did by building everything at the top level. I messed around with conditional dependencies currently in:

https://github.com/stsquad/qemu/tree/testing/tcg-testing-revival-v7

To try and make this better.

Quoted 9 lines

Adding MAKEFLAGS="-j1":

Quoted 4 lines
.travis.yml +3 -0
+      sudo: required
+      dist: trusty
+      compiler: gcc

--
Alex Bennée

#64 lore raw
In reply to Alex Bennée
This series seems to have some coding style problems. See output below for more information:

Hi,

This series seems to have some coding style problems. See output below for more information:

Type: series
Message-id: [email protected]
Subject: [Qemu-devel] [PATCH v6 00/49] fix building of tests/tcg

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram

commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do

    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))

done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
a3b42cec1c .travis.yml: add check-tcg test
9311c8f413 tests/docker: prevent sub-makes re-building debian-sid 09ca6d8e3b tests: add top-level make dependency for docker builds 2e879d658a target/sh4: Fix translator.c assertion failure for gUSA 0af702f272 tests/tcg: override runners for broken tests 7aaea5aa91 tests/tcg: add run, diff, and skip helper macros e0eaf5b9a7 tests/Makefile.include: add [build|clean|check]-tcg targets 14fd002c16 Makefile.target: add (clean-/build-)guest-tests targets 3d0926618b tests/tcg/Makefile: update to be called from Makefile.target c88f115914 tests/tcg: enable building for PowerPC
b563a10aac docker: move debian-powerpc-cross to sid based build 734d1f7ede tests/tcg: enable building for RISCV64
22bf732b43 tests/tcg: enable building for mips64
9b84cd6979 tests/tcg: enable building for sparc64
fefb20a640 tests/tcg: enable building for sh4
54483dadbf tests/tcg: enable building for m68k
605c4d05e0 tests/tcg: enable building for HPPA
39c366d478 tests/tcg/alpha: add Alpha specific tests d007a1df09 tests/tcg: enable building for Alpha
da85acf3b9 tests/tcg: enable building for ppc64
275041e496 tests/tcg: enable building for s390x
76b1b57115 tests/tcg/mips: include common mips hello-mips 3001eff269 tests/tcg: enable building for MIPS
fc2f8e7d15 tests/tcg: move MIPS specific tests into subdir 68015cff55 tests/tcg/arm: add fcvt test cases for AArch32/64 6cf0b6d54f tests/tcg: enable building for AArch64
82a59304e2 tests/tcg/arm: fix up test-arm-iwmmxt test 2d3d6eb162 tests/tcg: enable building for ARM
1010d901f6 tests/tcg: move ARM specific tests into subdir 03414050fb tests/tcg/i386/test-i386: fix printf format 18dc0dd9c2 tests/tcg/i386/test-i386: use modern vector_size attributes b1060c7415 tests/tcg/x86_64: add Makefile.target
f23ed58cdd tests/tcg/i386: add runner for test-i386-fprem 0d5ea512bb tests/tcg/i386: fix test-i386
6e69457c08 tests/tcg/i386: Build fix for hello-i386 c50f3d900e tests/tcg: enable building for i386
aab757d75e tests/tcg: move i386 specific tests into subdir d76905d84c tests/tcg/multiarch: move most output to stdout 9138f45c68 tests/tcg/multiarch: enable additional linux-test tests ced507e550 tests/tcg/multiarch: Build fix for linux-test 02861f0e01 tests/tcg: move architecture independent tests into subdir 2e91417605 docker: Makefile.include introduce DOCKER_SCRIPT 95e4639b49 docker: allow "cc" command to run in user context 638a3973fc docker: extend "cc" command to accept compiler 814faf606c docker: Add "cc" subcommand
cb7522263d configure: set cross_cc_FOO for host compiler 750b722573 configure: allow user to specify --cross-cc-cflags-foo= 00ce60af25 configure: move i386_cc to cross_cc_i386 badb0ec98b configure: add support for --cross-cc-FOO

=== OUTPUT BEGIN ===
Checking PATCH 1/49: configure: add support for --cross-cc-FOO... Checking PATCH 2/49: configure: move i386_cc to cross_cc_i386... Checking PATCH 3/49: configure: allow user to specify --cross-cc-cflags-foo=... Checking PATCH 4/49: configure: set cross_cc_FOO for host compiler... Checking PATCH 5/49: docker: Add "cc" subcommand...
Checking PATCH 6/49: docker: extend "cc" command to accept compiler... Checking PATCH 7/49: docker: allow "cc" command to run in user context... Checking PATCH 8/49: docker: Makefile.include introduce DOCKER_SCRIPT... Checking PATCH 9/49: tests/tcg: move architecture independent tests into subdir...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #138:
new file mode 100644

total: 0 errors, 1 warnings, 136 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
Checking PATCH 10/49: tests/tcg/multiarch: Build fix for linux-test...
ERROR: if this code is redundant consider removing it
#156: FILE: tests/tcg/multiarch/linux-test.c:323:
+#if 0

total: 1 errors, 0 warnings, 185 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

Checking PATCH 11/49: tests/tcg/multiarch: enable additional linux-test tests... Checking PATCH 12/49: tests/tcg/multiarch: move most output to stdout...
ERROR: code indent should never use tabs
#37: FILE: tests/tcg/multiarch/test-mmap.c:60:
+^Ifprintf(stdout, "%s", __func__);$

ERROR: code indent should never use tabs
#46: FILE: tests/tcg/multiarch/test-mmap.c:109:
+^Ifprintf(stdout, " passed\n");$

ERROR: code indent should never use tabs
#55: FILE: tests/tcg/multiarch/test-mmap.c:118:
+^Ifprintf(stdout, "%s", __func__);$

ERROR: code indent should never use tabs
#64: FILE: tests/tcg/multiarch/test-mmap.c:133:
+^Ifprintf(stdout, " passed\n");$

ERROR: code indent should never use tabs
#73: FILE: tests/tcg/multiarch/test-mmap.c:144:
+^Ifprintf(stdout, "%s", __func__);$

ERROR: code indent should never use tabs
#82: FILE: tests/tcg/multiarch/test-mmap.c:183:
+^Ifprintf(stdout, " passed\n");$

ERROR: code indent should never use tabs #91: FILE: tests/tcg/multiarch/test-mmap.c:197:
+^Ifprintf(stdout, "%s addr=%p", __func__, addr);$

ERROR: code indent should never use tabs
#100: FILE: tests/tcg/multiarch/test-mmap.c:215:
+^Ifprintf(stdout, " passed\n");$

ERROR: code indent should never use tabs #110: FILE: tests/tcg/multiarch/test-mmap.c:228:
+^Ifprintf(stdout, "%s addr=%p", __func__, addr);$

ERROR: code indent should never use tabs
#111: FILE: tests/tcg/multiarch/test-mmap.c:229:
+^Ifprintf(stdout, "FIXME: QEMU fails to track pages used by the host.");$

ERROR: code indent should never use tabs
#120: FILE: tests/tcg/multiarch/test-mmap.c:246:
+^Ifprintf(stdout, " passed\n");$

ERROR: code indent should never use tabs
#129: FILE: tests/tcg/multiarch/test-mmap.c:255:
+^Ifprintf(stdout, "%s", __func__);$

ERROR: code indent should never use tabs
#138: FILE: tests/tcg/multiarch/test-mmap.c:297:
+^Ifprintf(stdout, " passed\n");$

ERROR: code indent should never use tabs
#147: FILE: tests/tcg/multiarch/test-mmap.c:307:
+^Ifprintf(stdout, "%s", __func__);$

ERROR: code indent should never use tabs
#156: FILE: tests/tcg/multiarch/test-mmap.c:330:
+^Ifprintf(stdout, " passed\n");$

ERROR: code indent should never use tabs
#165: FILE: tests/tcg/multiarch/test-mmap.c:346:
+^Ifprintf(stdout, "%s addr=%p", __func__, (void *)addr);$

ERROR: code indent should never use tabs
#174: FILE: tests/tcg/multiarch/test-mmap.c:374:
+^Ifprintf(stdout, " passed\n");$

ERROR: code indent should never use tabs
#183: FILE: tests/tcg/multiarch/test-mmap.c:387:
+^Ifprintf(stdout, "%s addr=%p", __func__, (void *)addr);$

ERROR: code indent should never use tabs
#192: FILE: tests/tcg/multiarch/test-mmap.c:429:
+^Ifprintf(stdout, " passed\n");$

total: 19 errors, 0 warnings, 154 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

Checking PATCH 13/49: tests/tcg: move i386 specific tests into subdir...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #84:
new file mode 100644

total: 0 errors, 1 warnings, 120 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
Checking PATCH 14/49: tests/tcg: enable building for i386...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #21:
new file mode 100644

total: 0 errors, 1 warnings, 19 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
Checking PATCH 15/49: tests/tcg/i386: Build fix for hello-i386...
ERROR: externs should be avoided in .c files
#22: FILE: tests/tcg/i386/hello-i386.c:23:
+void _start(void);

total: 1 errors, 0 warnings, 7 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

Checking PATCH 16/49: tests/tcg/i386: fix test-i386... Checking PATCH 17/49: tests/tcg/i386: add runner for test-i386-fprem... Checking PATCH 18/49: tests/tcg/x86_64: add Makefile.target...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #49:
new file mode 100644

total: 0 errors, 1 warnings, 33 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
Checking PATCH 19/49: tests/tcg/i386/test-i386: use modern vector_size attributes... Checking PATCH 20/49: tests/tcg/i386/test-i386: fix printf format... Checking PATCH 21/49: tests/tcg: move ARM specific tests into subdir...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #52:
new file mode 100644

total: 0 errors, 1 warnings, 46 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
Checking PATCH 22/49: tests/tcg: enable building for ARM...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #18:
new file mode 100644

total: 0 errors, 1 warnings, 21 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
Checking PATCH 23/49: tests/tcg/arm: fix up test-arm-iwmmxt test...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #42:
rename from tests/tcg/arm/test-arm-iwmmxt.s

total: 0 errors, 1 warnings, 14 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
Checking PATCH 24/49: tests/tcg: enable building for AArch64...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #30:
new file mode 100644

total: 0 errors, 1 warnings, 15 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
Checking PATCH 25/49: tests/tcg/arm: add fcvt test cases for AArch32/64...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #19:
new file mode 100644

WARNING: architecture specific defines should be avoided #3430: FILE: tests/tcg/arm/fcvt.c:76:
+# if __GNUC_PREREQ(3, 3)

ERROR: space prohibited between function name and open parenthesis '(' #3431: FILE: tests/tcg/arm/fcvt.c:77:
+# define SNANF (__builtin_nansf (""))

ERROR: space prohibited between function name and open parenthesis '(' #3432: FILE: tests/tcg/arm/fcvt.c:78:
+# define SNAN (__builtin_nans (""))

ERROR: space prohibited between function name and open parenthesis '(' #3433: FILE: tests/tcg/arm/fcvt.c:79:
+# define SNANL (__builtin_nansl (""))

ERROR: spaces required around that '+' (ctx:VxV)
#3441: FILE: tests/tcg/arm/fcvt.c:87:
+ -1.111E+31,

                                   ^

ERROR: spaces required around that '+' (ctx:VxV)
#3442: FILE: tests/tcg/arm/fcvt.c:88:
+ -1.111E+30,

                                   ^

ERROR: spaces required around that '-' (ctx:VxV)
#3443: FILE: tests/tcg/arm/fcvt.c:89:
+ -1.08700982e-12,

                                        ^

ERROR: spaces required around that '-' (ctx:VxV)
#3444: FILE: tests/tcg/arm/fcvt.c:90:
+ -1.78051176e-20,

                                        ^

ERROR: spaces required around that '-' (ctx:VxV)
#3448: FILE: tests/tcg/arm/fcvt.c:94:
+ 2.98023224e-08,

                                       ^

ERROR: spaces required around that '-' (ctx:VxV)
#3449: FILE: tests/tcg/arm/fcvt.c:95:
+ 5.96046E-8, /* min positive FP16 subnormal */

                                    ^

ERROR: spaces required around that '-' (ctx:VxV)
#3450: FILE: tests/tcg/arm/fcvt.c:96:
+ 6.09756E-5, /* max subnormal FP16 */

                                    ^

ERROR: spaces required around that '-' (ctx:VxV)
#3451: FILE: tests/tcg/arm/fcvt.c:97:
+ 6.10352E-5, /* min positive normal FP16 */

                                    ^

ERROR: spaces required around that '+' (ctx:VxV)
#3462: FILE: tests/tcg/arm/fcvt.c:108:
+ 1.111E+30,

                                  ^

WARNING: architecture specific defines should be avoided #3480: FILE: tests/tcg/arm/fcvt.c:126:
+#if defined(__arm__)

WARNING: architecture specific defines should be avoided #3505: FILE: tests/tcg/arm/fcvt.c:151:
+#if defined(__arm__)

WARNING: architecture specific defines should be avoided #3527: FILE: tests/tcg/arm/fcvt.c:173:
+#if defined(__arm__)

ERROR: spaces required around that '-' (ctx:VxV)
#3548: FILE: tests/tcg/arm/fcvt.c:194:
+ {-FLT_MAX-1.0},

              ^

ERROR: spaces required around that '+' (ctx:VxV)
#3550: FILE: tests/tcg/arm/fcvt.c:196:
+ {-1.111E+31},

             ^

ERROR: spaces required around that '+' (ctx:VxV)
#3551: FILE: tests/tcg/arm/fcvt.c:197:
+ {-1.111E+30}, /* half prec */

             ^

ERROR: spaces required around that '-' (ctx:VxV)
#3557: FILE: tests/tcg/arm/fcvt.c:203:
+ {2.98023224e-08},

                 ^

ERROR: spaces required around that '-' (ctx:VxV)
#3558: FILE: tests/tcg/arm/fcvt.c:204:
+ {5.96046E-8}, /* min positive FP16 subnormal */

              ^

ERROR: spaces required around that '-' (ctx:VxV)
#3559: FILE: tests/tcg/arm/fcvt.c:205:
+ {6.09756E-5}, /* max subnormal FP16 */

              ^

ERROR: spaces required around that '-' (ctx:VxV)
#3560: FILE: tests/tcg/arm/fcvt.c:206:
+ {6.10352E-5}, /* min positive normal FP16 */

              ^

ERROR: spaces required around that '-' (ctx:VxV)
#3564: FILE: tests/tcg/arm/fcvt.c:210:
+ {1.3789972848607228e-308},

                         ^

ERROR: spaces required around that '-' (ctx:VxV)
#3565: FILE: tests/tcg/arm/fcvt.c:211:
+ {1.4914738736681624e-308},

                         ^

WARNING: architecture specific defines should be avoided #3599: FILE: tests/tcg/arm/fcvt.c:245:
+#if defined(__arm__)

WARNING: architecture specific defines should be avoided #3623: FILE: tests/tcg/arm/fcvt.c:269:
+#if defined(__arm__)

WARNING: architecture specific defines should be avoided #3646: FILE: tests/tcg/arm/fcvt.c:292:
+#if defined(__arm__)

WARNING: architecture specific defines should be avoided #3690: FILE: tests/tcg/arm/fcvt.c:336:
+#if defined(__arm__)

WARNING: architecture specific defines should be avoided #3713: FILE: tests/tcg/arm/fcvt.c:359:
+#if defined(__arm__)

WARNING: architecture specific defines should be avoided #3735: FILE: tests/tcg/arm/fcvt.c:381:
+#if defined(__arm__)

WARNING: architecture specific defines should be avoided #3780: FILE: tests/tcg/arm/fcvt.c:426:
+#if defined(__arm__)

ERROR: space prohibited before open square bracket '[' #3785: FILE: tests/tcg/arm/fcvt.c:431:
+ : /* no output */ : [flags] "n" (1 << 26) : "r1" );

ERROR: space prohibited before that close parenthesis ')' #3785: FILE: tests/tcg/arm/fcvt.c:431:
+ : /* no output */ : [flags] "n" (1 << 26) : "r1" );

ERROR: space prohibited before open square bracket '[' #3790: FILE: tests/tcg/arm/fcvt.c:436:
+ : /* no output */ : [flags] "n" (1 << 26) : "x1" );

ERROR: space prohibited before that close parenthesis ')' #3790: FILE: tests/tcg/arm/fcvt.c:436:
+ : /* no output */ : [flags] "n" (1 << 26) : "x1" );

total: 25 errors, 12 warnings, 7039 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

Checking PATCH 26/49: tests/tcg: move MIPS specific tests into subdir...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #39:
new file mode 100644

total: 0 errors, 1 warnings, 24 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
Checking PATCH 27/49: tests/tcg: enable building for MIPS...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #19:
new file mode 100644

total: 0 errors, 1 warnings, 17 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
Checking PATCH 28/49: tests/tcg/mips: include common mips hello-mips...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #15:
new file mode 100644

total: 0 errors, 1 warnings, 19 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
Checking PATCH 29/49: tests/tcg: enable building for s390x...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #20:
new file mode 100644

total: 0 errors, 1 warnings, 2 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
Checking PATCH 30/49: tests/tcg: enable building for ppc64...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #17:
new file mode 100644

total: 0 errors, 1 warnings, 2 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
Checking PATCH 31/49: tests/tcg: enable building for Alpha...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #38:
new file mode 100644

total: 0 errors, 1 warnings, 65 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
Checking PATCH 32/49: tests/tcg/alpha: add Alpha specific tests...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #20:
deleted file mode 100644

total: 0 errors, 1 warnings, 31 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
Checking PATCH 33/49: tests/tcg: enable building for HPPA...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #28:
new file mode 100644

total: 0 errors, 1 warnings, 27 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
Checking PATCH 34/49: tests/tcg: enable building for m68k...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #30:
new file mode 100644

total: 0 errors, 1 warnings, 28 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
Checking PATCH 35/49: tests/tcg: enable building for sh4...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #32:
new file mode 100644

total: 0 errors, 1 warnings, 30 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
Checking PATCH 36/49: tests/tcg: enable building for sparc64...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #29:
new file mode 100644

total: 0 errors, 1 warnings, 27 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
Checking PATCH 37/49: tests/tcg: enable building for mips64...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #29:
new file mode 100644

total: 0 errors, 1 warnings, 28 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
Checking PATCH 38/49: tests/tcg: enable building for RISCV64...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #29:
new file mode 100644

total: 0 errors, 1 warnings, 29 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
Checking PATCH 39/49: docker: move debian-powerpc-cross to sid based build...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #49:
deleted file mode 100755

total: 0 errors, 1 warnings, 71 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
Checking PATCH 40/49: tests/tcg: enable building for PowerPC...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #22:
new file mode 100644

total: 0 errors, 1 warnings, 19 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
Checking PATCH 41/49: tests/tcg/Makefile: update to be called from Makefile.target... Checking PATCH 42/49: Makefile.target: add (clean-/build-)guest-tests targets...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #48:
new file mode 100644

total: 0 errors, 1 warnings, 106 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
Checking PATCH 43/49: tests/Makefile.include: add [build|clean|check]-tcg targets... Checking PATCH 44/49: tests/tcg: add run, diff, and skip helper macros... Checking PATCH 45/49: tests/tcg: override runners for broken tests... Checking PATCH 46/49: target/sh4: Fix translator.c assertion failure for gUSA... Checking PATCH 47/49: tests: add top-level make dependency for docker builds...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #52:
new file mode 100644

total: 0 errors, 1 warnings, 51 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
Checking PATCH 48/49: tests/docker: prevent sub-makes re-building debian-sid... Checking PATCH 49/49: .travis.yml: add check-tcg test...
=== OUTPUT END ===

Test command exited with code: 1

---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]

#65 lore raw
In reply to Alex Bennée
Quoted 23 lines · Alex Bennée

Hi,

Not a super amount has changed since the last version but review comments and review tags have been added. The new patches at the end enable a .travis.yml run and try and make the image building part of check-tcg -j safe. Essentially the problem is trying to avoid re-building the images multiple times. The additional issue is wanting an upto date Debian SID image whenever we actually build an image but not forcing a rebuild every time.

Essentially I'd like to encode a conditional dependency when:
- the target image doesn't exist
- or the target image is out of date w.r.t. the dockerfike

I'm thinking this is going to involve some sort of extension to the docker.py script to feed the Makefile.

A number of the prerequisite patches have already been pulled in the docker fixes series however I think this series is ready to go in now. Unless there are any objections I'll send a pull on Monday.

Current unreviewed patches:

Quoted 7 lines

patch 0017/tests tcg i386 add runner for test i386 fprem.patch needs review patch 0039/docker move debian powerpc cross to sid based bui.patch needs review patch 0040/tests tcg enable building for PowerPC.patch needs review patch 0042/Makefile.target add clean build guest tests targe.patch needs review patch 0044/tests tcg add run diff and skip helper macros.patch needs review patch 0045/tests tcg override runners for broken tests.patch needs review patch 0046/target sh4 Fix translator.c assertion failure for.patch needs review

Is this patch related/required to this series?
It looks it should enter via another tree.

The SH4 tests pass without it:

$ make run-tcg-tests-sh4-linux-user -j1
  ...
  RUN-TESTS for sh4
  TEST    test-mmap (default) on sh4
  TEST    sha1 on sh4
  TEST    linux-test on sh4
  TEST    testthread on sh4
  TEST    test-mmap (4096 byte pages) on sh4
Quoted 203 lines

patch 0047/tests add top level make dependency for docker bu.patch needs review patch 0048/tests docker prevent sub makes re building debian.patch needs review patch 0049/.travis.yml add check tcg test.patch needs review

Alex Bennée (46):
configure: add support for --cross-cc-FOO
configure: move i386_cc to cross_cc_i386
configure: allow user to specify --cross-cc-cflags-foo=
configure: set cross_cc_FOO for host compiler
docker: Add "cc" subcommand
docker: extend "cc" command to accept compiler
docker: allow "cc" command to run in user context
docker: Makefile.include introduce DOCKER_SCRIPT tests/tcg: move architecture independent tests into subdir tests/tcg/multiarch: enable additional linux-test tests tests/tcg/multiarch: move most output to stdout tests/tcg: move i386 specific tests into subdir tests/tcg: enable building for i386 tests/tcg/i386: fix test-i386
tests/tcg/i386: add runner for test-i386-fprem tests/tcg/x86_64: add Makefile.target tests/tcg/i386/test-i386: use modern vector_size attributes tests/tcg/i386/test-i386: fix printf format tests/tcg: move ARM specific tests into subdir tests/tcg: enable building for ARM
tests/tcg/arm: fix up test-arm-iwmmxt test tests/tcg: enable building for AArch64 tests/tcg/arm: add fcvt test cases for AArch32/64 tests/tcg: move MIPS specific tests into subdir tests/tcg: enable building for MIPS tests/tcg/mips: include common mips hello-mips tests/tcg: enable building for s390x
tests/tcg: enable building for ppc64
tests/tcg: enable building for Alpha tests/tcg/alpha: add Alpha specific tests tests/tcg: enable building for HPPA
tests/tcg: enable building for m68k
tests/tcg: enable building for sh4
tests/tcg: enable building for sparc64
tests/tcg: enable building for mips64
tests/tcg: enable building for RISCV64
docker: move debian-powerpc-cross to sid based build tests/tcg: enable building for PowerPC tests/tcg/Makefile: update to be called from Makefile.target Makefile.target: add (clean-/build-)guest-tests targets tests/Makefile.include: add [build|clean|check]-tcg targets tests/tcg: add run, diff, and skip helper macros tests/tcg: override runners for broken tests
tests: add top-level make dependency for docker builds tests/docker: prevent sub-makes re-building debian-sid .travis.yml: add check-tcg test

Fam Zheng (2):
tests/tcg/multiarch: Build fix for linux-test
tests/tcg/i386: Build fix for hello-i386

Richard Henderson (1):
target/sh4: Fix translator.c assertion failure for gUSA

 .travis.yml                                   |    6 +
 MAINTAINERS                                   |   14 +
 Makefile.target                               |    5 +
 configure                                     |  134 +-
 target/sh4/translate.c                        |   81 +-
 tests/Makefile.include                        |   38 +-
 tests/docker/Makefile.include                 |   31 +-
 tests/docker/docker.py                        |   31 +
 .../dockerfiles/debian-alpha-cross.docker     |   12 +
 tests/docker/dockerfiles/debian-apt-fake.sh   |   46 -
 .../dockerfiles/debian-hppa-cross.docker      |   12 +
 .../dockerfiles/debian-m68k-cross.docker      |   12 +
 .../dockerfiles/debian-mips64-cross.docker    |   12 +
 .../dockerfiles/debian-powerpc-cross.docker   |   39 +-
 .../dockerfiles/debian-riscv64-cross.docker   |   12 +
 .../dockerfiles/debian-sh4-cross.docker       |   12 +
 tests/docker/dockerfiles/debian-sid.docker    |   32 +
 .../dockerfiles/debian-sparc64-cross.docker   |   12 +
 tests/docker/dockerfiles/debian8.docker       |    3 -
 tests/tcg/Makefile                            |  219 +-
 tests/tcg/Makefile.include                    |   89 +
 tests/tcg/Makefile.probe                      |   31 +
 tests/tcg/README                              |   69 +-
 tests/tcg/aarch64/Makefile.include            |    8 +
 tests/tcg/aarch64/Makefile.target             |   17 +
 tests/tcg/aarch64/fcvt.ref                    | 3268 +++++++++++++++++
 tests/tcg/alpha/Makefile                      |   35 -
 tests/tcg/alpha/Makefile.include              |    2 +
 tests/tcg/alpha/Makefile.target               |   18 +
 tests/tcg/alpha/crt.s                         |   26 -
 tests/tcg/alpha/hello-alpha.c                 |    2 +
 tests/tcg/alpha/test-cond.c                   |    1 +
 tests/tcg/alpha/test-ovf.c                    |    2 +
 tests/tcg/arm/Makefile.include                |    8 +
 tests/tcg/arm/Makefile.target                 |   32 +
 tests/tcg/arm/README                          |   11 +
 tests/tcg/arm/fcvt.c                          |  458 +++
 tests/tcg/arm/fcvt.ref                        | 3268 +++++++++++++++++
 tests/tcg/{ => arm}/hello-arm.c               |    0
 .../test-arm-iwmmxt.S}                        |    0
 tests/tcg/hppa/Makefile.include               |    2 +
 tests/tcg/hppa/Makefile.target                |    6 +
 tests/tcg/i386/Makefile.include               |    9 +
 tests/tcg/i386/Makefile.target                |   51 +
 tests/tcg/i386/README                         |   38 +
 tests/tcg/{ => i386}/hello-i386.c             |    1 +
 tests/tcg/{ => i386}/pi_10.com                |  Bin
 tests/tcg/{ => i386}/runcom.c                 |    0
 tests/tcg/{ => i386}/test-i386-code16.S       |    0
 tests/tcg/{ => i386}/test-i386-fprem.c        |   12 +-
 tests/tcg/{ => i386}/test-i386-muldiv.h       |    0
 tests/tcg/{ => i386}/test-i386-shift.h        |    0
 tests/tcg/{ => i386}/test-i386-ssse3.c        |    0
 tests/tcg/{ => i386}/test-i386-vm86.S         |    0
 tests/tcg/{ => i386}/test-i386.c              |    7 +-
 tests/tcg/{ => i386}/test-i386.h              |    0
 tests/tcg/m68k/Makefile.include               |    2 +
 tests/tcg/m68k/Makefile.target                |    7 +
 tests/tcg/mips/Makefile.include               |   20 +
 tests/tcg/mips/Makefile.target                |   22 +
 tests/tcg/mips/README                         |    7 +
 tests/tcg/{ => mips}/hello-mips.c             |    0
 tests/tcg/multiarch/Makefile.target           |   36 +
 tests/tcg/multiarch/README                    |    1 +
 tests/tcg/{ => multiarch}/linux-test.c        |  113 +-
 tests/tcg/{ => multiarch}/sha1.c              |    0
 tests/tcg/{ => multiarch}/test-mmap.c         |   40 +-
 tests/tcg/{ => multiarch}/testthread.c        |    0
 tests/tcg/ppc/Makefile.include                |    7 +
 tests/tcg/ppc/Makefile.target                 |   12 +
 tests/tcg/riscv/Makefile.include              |   10 +
 tests/tcg/s390x/Makefile.include              |    2 +
 tests/tcg/sh4/Makefile.include                |    4 +
 tests/tcg/sh4/Makefile.target                 |    7 +
 tests/tcg/sparc64/Makefile.include            |    2 +
 tests/tcg/sparc64/Makefile.target             |   11 +
 tests/tcg/test_path.c                         |  157 -
 tests/tcg/x86_64/Makefile.target              |   15 +
 78 files changed, 8068 insertions(+), 641 deletions(-)
 create mode 100644 tests/docker/dockerfiles/debian-alpha-cross.docker
 delete mode 100755 tests/docker/dockerfiles/debian-apt-fake.sh
 create mode 100644 tests/docker/dockerfiles/debian-hppa-cross.docker
 create mode 100644 tests/docker/dockerfiles/debian-m68k-cross.docker
 create mode 100644 tests/docker/dockerfiles/debian-mips64-cross.docker
 create mode 100644 tests/docker/dockerfiles/debian-riscv64-cross.docker
 create mode 100644 tests/docker/dockerfiles/debian-sh4-cross.docker
 create mode 100644 tests/docker/dockerfiles/debian-sid.docker
 create mode 100644 tests/docker/dockerfiles/debian-sparc64-cross.docker
 create mode 100644 tests/tcg/Makefile.include
 create mode 100644 tests/tcg/Makefile.probe
 create mode 100644 tests/tcg/aarch64/Makefile.include
 create mode 100644 tests/tcg/aarch64/Makefile.target
 create mode 100644 tests/tcg/aarch64/fcvt.ref
 delete mode 100644 tests/tcg/alpha/Makefile
 create mode 100644 tests/tcg/alpha/Makefile.include
 create mode 100644 tests/tcg/alpha/Makefile.target
 delete mode 100644 tests/tcg/alpha/crt.s
 create mode 100644 tests/tcg/arm/Makefile.include
 create mode 100644 tests/tcg/arm/Makefile.target
 create mode 100644 tests/tcg/arm/README
 create mode 100644 tests/tcg/arm/fcvt.c
 create mode 100644 tests/tcg/arm/fcvt.ref
 rename tests/tcg/{ => arm}/hello-arm.c (100%)
 rename tests/tcg/{test-arm-iwmmxt.s => arm/test-arm-iwmmxt.S} (100%)
 create mode 100644 tests/tcg/hppa/Makefile.include
 create mode 100644 tests/tcg/hppa/Makefile.target
 create mode 100644 tests/tcg/i386/Makefile.include
 create mode 100644 tests/tcg/i386/Makefile.target
 create mode 100644 tests/tcg/i386/README
 rename tests/tcg/{ => i386}/hello-i386.c (96%)
 rename tests/tcg/{ => i386}/pi_10.com (100%)
 rename tests/tcg/{ => i386}/runcom.c (100%)
 rename tests/tcg/{ => i386}/test-i386-code16.S (100%)
 rename tests/tcg/{ => i386}/test-i386-fprem.c (97%)
 rename tests/tcg/{ => i386}/test-i386-muldiv.h (100%)
 rename tests/tcg/{ => i386}/test-i386-shift.h (100%)
 rename tests/tcg/{ => i386}/test-i386-ssse3.c (100%)
 rename tests/tcg/{ => i386}/test-i386-vm86.S (100%)
 rename tests/tcg/{ => i386}/test-i386.c (99%)
 rename tests/tcg/{ => i386}/test-i386.h (100%)
 create mode 100644 tests/tcg/m68k/Makefile.include
 create mode 100644 tests/tcg/m68k/Makefile.target
 create mode 100644 tests/tcg/mips/Makefile.include
 create mode 100644 tests/tcg/mips/Makefile.target
 create mode 100644 tests/tcg/mips/README
 rename tests/tcg/{ => mips}/hello-mips.c (100%)
 create mode 100644 tests/tcg/multiarch/Makefile.target
 create mode 100644 tests/tcg/multiarch/README
 rename tests/tcg/{ => multiarch}/linux-test.c (86%)
 rename tests/tcg/{ => multiarch}/sha1.c (100%)
 rename tests/tcg/{ => multiarch}/test-mmap.c (93%)
 rename tests/tcg/{ => multiarch}/testthread.c (100%)
 create mode 100644 tests/tcg/ppc/Makefile.include
 create mode 100644 tests/tcg/ppc/Makefile.target
 create mode 100644 tests/tcg/riscv/Makefile.include
 create mode 100644 tests/tcg/s390x/Makefile.include
 create mode 100644 tests/tcg/sh4/Makefile.include
 create mode 100644 tests/tcg/sh4/Makefile.target
 create mode 100644 tests/tcg/sparc64/Makefile.include
 create mode 100644 tests/tcg/sparc64/Makefile.target
 delete mode 100644 tests/tcg/test_path.c
 create mode 100644 tests/tcg/x86_64/Makefile.target
#66 lore raw
Quoted 37 lines · Philippe Mathieu-Daudé
Quoted 23 lines · Alex Bennée

Hi,

Not a super amount has changed since the last version but review comments and review tags have been added. The new patches at the end enable a .travis.yml run and try and make the image building part of check-tcg -j safe. Essentially the problem is trying to avoid re-building the images multiple times. The additional issue is wanting an upto date Debian SID image whenever we actually build an image but not forcing a rebuild every time.

Essentially I'd like to encode a conditional dependency when:
- the target image doesn't exist
- or the target image is out of date w.r.t. the dockerfike

I'm thinking this is going to involve some sort of extension to the docker.py script to feed the Makefile.

A number of the prerequisite patches have already been pulled in the docker fixes series however I think this series is ready to go in now. Unless there are any objections I'll send a pull on Monday.

Current unreviewed patches:

Quoted 7 lines

patch 0017/tests tcg i386 add runner for test i386 fprem.patch needs review patch 0039/docker move debian powerpc cross to sid based bui.patch needs review patch 0040/tests tcg enable building for PowerPC.patch needs review patch 0042/Makefile.target add clean build guest tests targe.patch needs review patch 0044/tests tcg add run diff and skip helper macros.patch needs review patch 0045/tests tcg override runners for broken tests.patch needs review patch 0046/target sh4 Fix translator.c assertion failure for.patch needs review

Is this patch related/required to this series?
It looks it should enter via another tree.

The SH4 tests pass without it:

Quoted 8 lines
$ make run-tcg-tests-sh4-linux-user -j1
  ...
  RUN-TESTS for sh4
  TEST    test-mmap (default) on sh4
  TEST    sha1 on sh4
  TEST    linux-test on sh4
  TEST    testthread on sh4
  TEST    test-mmap (4096 byte pages) on sh4

Not with --enable-debug, but yeah I'll drop as it should come via Rich's TCG tree.

Quoted 196 lines
Quoted 196 lines

patch 0047/tests add top level make dependency for docker bu.patch needs review patch 0048/tests docker prevent sub makes re building debian.patch needs review patch 0049/.travis.yml add check tcg test.patch needs review

Alex Bennée (46):
configure: add support for --cross-cc-FOO
configure: move i386_cc to cross_cc_i386
configure: allow user to specify --cross-cc-cflags-foo=
configure: set cross_cc_FOO for host compiler
docker: Add "cc" subcommand
docker: extend "cc" command to accept compiler
docker: allow "cc" command to run in user context
docker: Makefile.include introduce DOCKER_SCRIPT tests/tcg: move architecture independent tests into subdir tests/tcg/multiarch: enable additional linux-test tests tests/tcg/multiarch: move most output to stdout tests/tcg: move i386 specific tests into subdir tests/tcg: enable building for i386 tests/tcg/i386: fix test-i386
tests/tcg/i386: add runner for test-i386-fprem tests/tcg/x86_64: add Makefile.target tests/tcg/i386/test-i386: use modern vector_size attributes tests/tcg/i386/test-i386: fix printf format tests/tcg: move ARM specific tests into subdir tests/tcg: enable building for ARM
tests/tcg/arm: fix up test-arm-iwmmxt test tests/tcg: enable building for AArch64 tests/tcg/arm: add fcvt test cases for AArch32/64 tests/tcg: move MIPS specific tests into subdir tests/tcg: enable building for MIPS tests/tcg/mips: include common mips hello-mips tests/tcg: enable building for s390x
tests/tcg: enable building for ppc64
tests/tcg: enable building for Alpha tests/tcg/alpha: add Alpha specific tests tests/tcg: enable building for HPPA
tests/tcg: enable building for m68k
tests/tcg: enable building for sh4
tests/tcg: enable building for sparc64
tests/tcg: enable building for mips64
tests/tcg: enable building for RISCV64
docker: move debian-powerpc-cross to sid based build tests/tcg: enable building for PowerPC tests/tcg/Makefile: update to be called from Makefile.target Makefile.target: add (clean-/build-)guest-tests targets tests/Makefile.include: add [build|clean|check]-tcg targets tests/tcg: add run, diff, and skip helper macros tests/tcg: override runners for broken tests
tests: add top-level make dependency for docker builds tests/docker: prevent sub-makes re-building debian-sid .travis.yml: add check-tcg test

Fam Zheng (2):
tests/tcg/multiarch: Build fix for linux-test
tests/tcg/i386: Build fix for hello-i386

Richard Henderson (1):
target/sh4: Fix translator.c assertion failure for gUSA

 .travis.yml                                   |    6 +
 MAINTAINERS                                   |   14 +
 Makefile.target                               |    5 +
 configure                                     |  134 +-
 target/sh4/translate.c                        |   81 +-
 tests/Makefile.include                        |   38 +-
 tests/docker/Makefile.include                 |   31 +-
 tests/docker/docker.py                        |   31 +
 .../dockerfiles/debian-alpha-cross.docker     |   12 +
 tests/docker/dockerfiles/debian-apt-fake.sh   |   46 -
 .../dockerfiles/debian-hppa-cross.docker      |   12 +
 .../dockerfiles/debian-m68k-cross.docker      |   12 +
 .../dockerfiles/debian-mips64-cross.docker    |   12 +
 .../dockerfiles/debian-powerpc-cross.docker   |   39 +-
 .../dockerfiles/debian-riscv64-cross.docker   |   12 +
 .../dockerfiles/debian-sh4-cross.docker       |   12 +
 tests/docker/dockerfiles/debian-sid.docker    |   32 +
 .../dockerfiles/debian-sparc64-cross.docker   |   12 +
 tests/docker/dockerfiles/debian8.docker       |    3 -
 tests/tcg/Makefile                            |  219 +-
 tests/tcg/Makefile.include                    |   89 +
 tests/tcg/Makefile.probe                      |   31 +
 tests/tcg/README                              |   69 +-
 tests/tcg/aarch64/Makefile.include            |    8 +
 tests/tcg/aarch64/Makefile.target             |   17 +
 tests/tcg/aarch64/fcvt.ref                    | 3268 +++++++++++++++++
 tests/tcg/alpha/Makefile                      |   35 -
 tests/tcg/alpha/Makefile.include              |    2 +
 tests/tcg/alpha/Makefile.target               |   18 +
 tests/tcg/alpha/crt.s                         |   26 -
 tests/tcg/alpha/hello-alpha.c                 |    2 +
 tests/tcg/alpha/test-cond.c                   |    1 +
 tests/tcg/alpha/test-ovf.c                    |    2 +
 tests/tcg/arm/Makefile.include                |    8 +
 tests/tcg/arm/Makefile.target                 |   32 +
 tests/tcg/arm/README                          |   11 +
 tests/tcg/arm/fcvt.c                          |  458 +++
 tests/tcg/arm/fcvt.ref                        | 3268 +++++++++++++++++
 tests/tcg/{ => arm}/hello-arm.c               |    0
 .../test-arm-iwmmxt.S}                        |    0
 tests/tcg/hppa/Makefile.include               |    2 +
 tests/tcg/hppa/Makefile.target                |    6 +
 tests/tcg/i386/Makefile.include               |    9 +
 tests/tcg/i386/Makefile.target                |   51 +
 tests/tcg/i386/README                         |   38 +
 tests/tcg/{ => i386}/hello-i386.c             |    1 +
 tests/tcg/{ => i386}/pi_10.com                |  Bin
 tests/tcg/{ => i386}/runcom.c                 |    0
 tests/tcg/{ => i386}/test-i386-code16.S       |    0
 tests/tcg/{ => i386}/test-i386-fprem.c        |   12 +-
 tests/tcg/{ => i386}/test-i386-muldiv.h       |    0
 tests/tcg/{ => i386}/test-i386-shift.h        |    0
 tests/tcg/{ => i386}/test-i386-ssse3.c        |    0
 tests/tcg/{ => i386}/test-i386-vm86.S         |    0
 tests/tcg/{ => i386}/test-i386.c              |    7 +-
 tests/tcg/{ => i386}/test-i386.h              |    0
 tests/tcg/m68k/Makefile.include               |    2 +
 tests/tcg/m68k/Makefile.target                |    7 +
 tests/tcg/mips/Makefile.include               |   20 +
 tests/tcg/mips/Makefile.target                |   22 +
 tests/tcg/mips/README                         |    7 +
 tests/tcg/{ => mips}/hello-mips.c             |    0
 tests/tcg/multiarch/Makefile.target           |   36 +
 tests/tcg/multiarch/README                    |    1 +
 tests/tcg/{ => multiarch}/linux-test.c        |  113 +-
 tests/tcg/{ => multiarch}/sha1.c              |    0
 tests/tcg/{ => multiarch}/test-mmap.c         |   40 +-
 tests/tcg/{ => multiarch}/testthread.c        |    0
 tests/tcg/ppc/Makefile.include                |    7 +
 tests/tcg/ppc/Makefile.target                 |   12 +
 tests/tcg/riscv/Makefile.include              |   10 +
 tests/tcg/s390x/Makefile.include              |    2 +
 tests/tcg/sh4/Makefile.include                |    4 +
 tests/tcg/sh4/Makefile.target                 |    7 +
 tests/tcg/sparc64/Makefile.include            |    2 +
 tests/tcg/sparc64/Makefile.target             |   11 +
 tests/tcg/test_path.c                         |  157 -
 tests/tcg/x86_64/Makefile.target              |   15 +
 78 files changed, 8068 insertions(+), 641 deletions(-)
 create mode 100644 tests/docker/dockerfiles/debian-alpha-cross.docker
 delete mode 100755 tests/docker/dockerfiles/debian-apt-fake.sh
 create mode 100644 tests/docker/dockerfiles/debian-hppa-cross.docker
 create mode 100644 tests/docker/dockerfiles/debian-m68k-cross.docker
 create mode 100644 tests/docker/dockerfiles/debian-mips64-cross.docker
 create mode 100644 tests/docker/dockerfiles/debian-riscv64-cross.docker
 create mode 100644 tests/docker/dockerfiles/debian-sh4-cross.docker
 create mode 100644 tests/docker/dockerfiles/debian-sid.docker
 create mode 100644 tests/docker/dockerfiles/debian-sparc64-cross.docker
 create mode 100644 tests/tcg/Makefile.include
 create mode 100644 tests/tcg/Makefile.probe
 create mode 100644 tests/tcg/aarch64/Makefile.include
 create mode 100644 tests/tcg/aarch64/Makefile.target
 create mode 100644 tests/tcg/aarch64/fcvt.ref
 delete mode 100644 tests/tcg/alpha/Makefile
 create mode 100644 tests/tcg/alpha/Makefile.include
 create mode 100644 tests/tcg/alpha/Makefile.target
 delete mode 100644 tests/tcg/alpha/crt.s
 create mode 100644 tests/tcg/arm/Makefile.include
 create mode 100644 tests/tcg/arm/Makefile.target
 create mode 100644 tests/tcg/arm/README
 create mode 100644 tests/tcg/arm/fcvt.c
 create mode 100644 tests/tcg/arm/fcvt.ref
 rename tests/tcg/{ => arm}/hello-arm.c (100%)
 rename tests/tcg/{test-arm-iwmmxt.s => arm/test-arm-iwmmxt.S} (100%)
 create mode 100644 tests/tcg/hppa/Makefile.include
 create mode 100644 tests/tcg/hppa/Makefile.target
 create mode 100644 tests/tcg/i386/Makefile.include
 create mode 100644 tests/tcg/i386/Makefile.target
 create mode 100644 tests/tcg/i386/README
 rename tests/tcg/{ => i386}/hello-i386.c (96%)
 rename tests/tcg/{ => i386}/pi_10.com (100%)
 rename tests/tcg/{ => i386}/runcom.c (100%)
 rename tests/tcg/{ => i386}/test-i386-code16.S (100%)
 rename tests/tcg/{ => i386}/test-i386-fprem.c (97%)
 rename tests/tcg/{ => i386}/test-i386-muldiv.h (100%)
 rename tests/tcg/{ => i386}/test-i386-shift.h (100%)
 rename tests/tcg/{ => i386}/test-i386-ssse3.c (100%)
 rename tests/tcg/{ => i386}/test-i386-vm86.S (100%)
 rename tests/tcg/{ => i386}/test-i386.c (99%)
 rename tests/tcg/{ => i386}/test-i386.h (100%)
 create mode 100644 tests/tcg/m68k/Makefile.include
 create mode 100644 tests/tcg/m68k/Makefile.target
 create mode 100644 tests/tcg/mips/Makefile.include
 create mode 100644 tests/tcg/mips/Makefile.target
 create mode 100644 tests/tcg/mips/README
 rename tests/tcg/{ => mips}/hello-mips.c (100%)
 create mode 100644 tests/tcg/multiarch/Makefile.target
 create mode 100644 tests/tcg/multiarch/README
 rename tests/tcg/{ => multiarch}/linux-test.c (86%)
 rename tests/tcg/{ => multiarch}/sha1.c (100%)
 rename tests/tcg/{ => multiarch}/test-mmap.c (93%)
 rename tests/tcg/{ => multiarch}/testthread.c (100%)
 create mode 100644 tests/tcg/ppc/Makefile.include
 create mode 100644 tests/tcg/ppc/Makefile.target
 create mode 100644 tests/tcg/riscv/Makefile.include
Quoted 8 lines
Quoted 8 lines
 create mode 100644 tests/tcg/s390x/Makefile.include
 create mode 100644 tests/tcg/sh4/Makefile.include
 create mode 100644 tests/tcg/sh4/Makefile.target
 create mode 100644 tests/tcg/sparc64/Makefile.include
 create mode 100644 tests/tcg/sparc64/Makefile.target
 delete mode 100644 tests/tcg/test_path.c
 create mode 100644 tests/tcg/x86_64/Makefile.target

--
Alex Bennée

#67 lore raw
Quoted 47 lines · Alex Bennée
Quoted 37 lines · Philippe Mathieu-Daudé
Quoted 23 lines · Alex Bennée

Hi,

Not a super amount has changed since the last version but review comments and review tags have been added. The new patches at the end enable a .travis.yml run and try and make the image building part of check-tcg -j safe. Essentially the problem is trying to avoid re-building the images multiple times. The additional issue is wanting an upto date Debian SID image whenever we actually build an image but not forcing a rebuild every time.

Essentially I'd like to encode a conditional dependency when:
- the target image doesn't exist
- or the target image is out of date w.r.t. the dockerfike

I'm thinking this is going to involve some sort of extension to the docker.py script to feed the Makefile.

A number of the prerequisite patches have already been pulled in the docker fixes series however I think this series is ready to go in now. Unless there are any objections I'll send a pull on Monday.

Current unreviewed patches:

Quoted 7 lines

patch 0017/tests tcg i386 add runner for test i386 fprem.patch needs review patch 0039/docker move debian powerpc cross to sid based bui.patch needs review patch 0040/tests tcg enable building for PowerPC.patch needs review patch 0042/Makefile.target add clean build guest tests targe.patch needs review patch 0044/tests tcg add run diff and skip helper macros.patch needs review patch 0045/tests tcg override runners for broken tests.patch needs review patch 0046/target sh4 Fix translator.c assertion failure for.patch needs review

Is this patch related/required to this series?
It looks it should enter via another tree.

The SH4 tests pass without it:

Quoted 8 lines
$ make run-tcg-tests-sh4-linux-user -j1
  ...
  RUN-TESTS for sh4
  TEST    test-mmap (default) on sh4
  TEST    sha1 on sh4
  TEST    linux-test on sh4
  TEST    testthread on sh4
  TEST    test-mmap (4096 byte pages) on sh4
Quoted 2 lines

Not with --enable-debug, but yeah I'll drop as it should come via Rich's TCG tree.

Oh I just tested the basic options, didn't go with all the matrix :/

Indeed,

RUN-TESTS for sh4

  TEST    test-mmap (default) on sh4
  TEST    sha1 on sh4
  TEST    linux-test on sh4
  TEST    testthread on sh4

qemu-sh4: accel/tcg/translator.c:66: translator_loop: Assertion `db->is_jmp == DISAS_NEXT' failed.
qemu: uncaught target signal 11 (Segmentation fault) - core dumped Segmentation fault
make: *** [tests/Makefile.include:950: run-tcg-tests-sh4-linux-user] Error 2

I'd still prefer this enter via Richard tree, and keep this PR testing-only (in case if bisection in translate.c, this might goes very slow due to your changes in ./configure triggering full rebuild).

Quoted 210 lines
Quoted 197 lines
Quoted 197 lines

patch 0047/tests add top level make dependency for docker bu.patch needs review patch 0048/tests docker prevent sub makes re building debian.patch needs review patch 0049/.travis.yml add check tcg test.patch needs review

Alex Bennée (46):
configure: add support for --cross-cc-FOO
configure: move i386_cc to cross_cc_i386
configure: allow user to specify --cross-cc-cflags-foo=
configure: set cross_cc_FOO for host compiler
docker: Add "cc" subcommand
docker: extend "cc" command to accept compiler
docker: allow "cc" command to run in user context
docker: Makefile.include introduce DOCKER_SCRIPT tests/tcg: move architecture independent tests into subdir tests/tcg/multiarch: enable additional linux-test tests tests/tcg/multiarch: move most output to stdout tests/tcg: move i386 specific tests into subdir tests/tcg: enable building for i386 tests/tcg/i386: fix test-i386
tests/tcg/i386: add runner for test-i386-fprem tests/tcg/x86_64: add Makefile.target tests/tcg/i386/test-i386: use modern vector_size attributes tests/tcg/i386/test-i386: fix printf format tests/tcg: move ARM specific tests into subdir tests/tcg: enable building for ARM
tests/tcg/arm: fix up test-arm-iwmmxt test tests/tcg: enable building for AArch64 tests/tcg/arm: add fcvt test cases for AArch32/64 tests/tcg: move MIPS specific tests into subdir tests/tcg: enable building for MIPS tests/tcg/mips: include common mips hello-mips tests/tcg: enable building for s390x
tests/tcg: enable building for ppc64
tests/tcg: enable building for Alpha tests/tcg/alpha: add Alpha specific tests tests/tcg: enable building for HPPA
tests/tcg: enable building for m68k
tests/tcg: enable building for sh4
tests/tcg: enable building for sparc64
tests/tcg: enable building for mips64
tests/tcg: enable building for RISCV64
docker: move debian-powerpc-cross to sid based build tests/tcg: enable building for PowerPC tests/tcg/Makefile: update to be called from Makefile.target Makefile.target: add (clean-/build-)guest-tests targets tests/Makefile.include: add [build|clean|check]-tcg targets tests/tcg: add run, diff, and skip helper macros tests/tcg: override runners for broken tests
tests: add top-level make dependency for docker builds tests/docker: prevent sub-makes re-building debian-sid .travis.yml: add check-tcg test

Fam Zheng (2):
tests/tcg/multiarch: Build fix for linux-test
tests/tcg/i386: Build fix for hello-i386

Richard Henderson (1):
target/sh4: Fix translator.c assertion failure for gUSA

 .travis.yml                                   |    6 +
 MAINTAINERS                                   |   14 +
 Makefile.target                               |    5 +
 configure                                     |  134 +-
 target/sh4/translate.c                        |   81 +-
 tests/Makefile.include                        |   38 +-
 tests/docker/Makefile.include                 |   31 +-
 tests/docker/docker.py                        |   31 +
 .../dockerfiles/debian-alpha-cross.docker     |   12 +
 tests/docker/dockerfiles/debian-apt-fake.sh   |   46 -
 .../dockerfiles/debian-hppa-cross.docker      |   12 +
 .../dockerfiles/debian-m68k-cross.docker      |   12 +
 .../dockerfiles/debian-mips64-cross.docker    |   12 +
 .../dockerfiles/debian-powerpc-cross.docker   |   39 +-
 .../dockerfiles/debian-riscv64-cross.docker   |   12 +
 .../dockerfiles/debian-sh4-cross.docker       |   12 +
 tests/docker/dockerfiles/debian-sid.docker    |   32 +
 .../dockerfiles/debian-sparc64-cross.docker   |   12 +
 tests/docker/dockerfiles/debian8.docker       |    3 -
 tests/tcg/Makefile                            |  219 +-
 tests/tcg/Makefile.include                    |   89 +
 tests/tcg/Makefile.probe                      |   31 +
 tests/tcg/README                              |   69 +-
 tests/tcg/aarch64/Makefile.include            |    8 +
 tests/tcg/aarch64/Makefile.target             |   17 +
 tests/tcg/aarch64/fcvt.ref                    | 3268 +++++++++++++++++
 tests/tcg/alpha/Makefile                      |   35 -
 tests/tcg/alpha/Makefile.include              |    2 +
 tests/tcg/alpha/Makefile.target               |   18 +
 tests/tcg/alpha/crt.s                         |   26 -
 tests/tcg/alpha/hello-alpha.c                 |    2 +
 tests/tcg/alpha/test-cond.c                   |    1 +
 tests/tcg/alpha/test-ovf.c                    |    2 +
 tests/tcg/arm/Makefile.include                |    8 +
 tests/tcg/arm/Makefile.target                 |   32 +
 tests/tcg/arm/README                          |   11 +
 tests/tcg/arm/fcvt.c                          |  458 +++
 tests/tcg/arm/fcvt.ref                        | 3268 +++++++++++++++++
 tests/tcg/{ => arm}/hello-arm.c               |    0
 .../test-arm-iwmmxt.S}                        |    0
 tests/tcg/hppa/Makefile.include               |    2 +
 tests/tcg/hppa/Makefile.target                |    6 +
 tests/tcg/i386/Makefile.include               |    9 +
 tests/tcg/i386/Makefile.target                |   51 +
 tests/tcg/i386/README                         |   38 +
 tests/tcg/{ => i386}/hello-i386.c             |    1 +
 tests/tcg/{ => i386}/pi_10.com                |  Bin
 tests/tcg/{ => i386}/runcom.c                 |    0
 tests/tcg/{ => i386}/test-i386-code16.S       |    0
 tests/tcg/{ => i386}/test-i386-fprem.c        |   12 +-
 tests/tcg/{ => i386}/test-i386-muldiv.h       |    0
 tests/tcg/{ => i386}/test-i386-shift.h        |    0
 tests/tcg/{ => i386}/test-i386-ssse3.c        |    0
 tests/tcg/{ => i386}/test-i386-vm86.S         |    0
 tests/tcg/{ => i386}/test-i386.c              |    7 +-
 tests/tcg/{ => i386}/test-i386.h              |    0
 tests/tcg/m68k/Makefile.include               |    2 +
 tests/tcg/m68k/Makefile.target                |    7 +
 tests/tcg/mips/Makefile.include               |   20 +
 tests/tcg/mips/Makefile.target                |   22 +
 tests/tcg/mips/README                         |    7 +
 tests/tcg/{ => mips}/hello-mips.c             |    0
 tests/tcg/multiarch/Makefile.target           |   36 +
 tests/tcg/multiarch/README                    |    1 +
 tests/tcg/{ => multiarch}/linux-test.c        |  113 +-
 tests/tcg/{ => multiarch}/sha1.c              |    0
 tests/tcg/{ => multiarch}/test-mmap.c         |   40 +-
 tests/tcg/{ => multiarch}/testthread.c        |    0
 tests/tcg/ppc/Makefile.include                |    7 +
 tests/tcg/ppc/Makefile.target                 |   12 +
 tests/tcg/riscv/Makefile.include              |   10 +
 tests/tcg/s390x/Makefile.include              |    2 +
 tests/tcg/sh4/Makefile.include                |    4 +
 tests/tcg/sh4/Makefile.target                 |    7 +
 tests/tcg/sparc64/Makefile.include            |    2 +
 tests/tcg/sparc64/Makefile.target             |   11 +
 tests/tcg/test_path.c                         |  157 -
 tests/tcg/x86_64/Makefile.target              |   15 +
 78 files changed, 8068 insertions(+), 641 deletions(-)
 create mode 100644 tests/docker/dockerfiles/debian-alpha-cross.docker
 delete mode 100755 tests/docker/dockerfiles/debian-apt-fake.sh
 create mode 100644 tests/docker/dockerfiles/debian-hppa-cross.docker
 create mode 100644 tests/docker/dockerfiles/debian-m68k-cross.docker
 create mode 100644 tests/docker/dockerfiles/debian-mips64-cross.docker
 create mode 100644 tests/docker/dockerfiles/debian-riscv64-cross.docker
 create mode 100644 tests/docker/dockerfiles/debian-sh4-cross.docker
 create mode 100644 tests/docker/dockerfiles/debian-sid.docker
 create mode 100644 tests/docker/dockerfiles/debian-sparc64-cross.docker
 create mode 100644 tests/tcg/Makefile.include
 create mode 100644 tests/tcg/Makefile.probe
 create mode 100644 tests/tcg/aarch64/Makefile.include
 create mode 100644 tests/tcg/aarch64/Makefile.target
 create mode 100644 tests/tcg/aarch64/fcvt.ref
 delete mode 100644 tests/tcg/alpha/Makefile
 create mode 100644 tests/tcg/alpha/Makefile.include
 create mode 100644 tests/tcg/alpha/Makefile.target
 delete mode 100644 tests/tcg/alpha/crt.s
 create mode 100644 tests/tcg/arm/Makefile.include
 create mode 100644 tests/tcg/arm/Makefile.target
 create mode 100644 tests/tcg/arm/README
 create mode 100644 tests/tcg/arm/fcvt.c
 create mode 100644 tests/tcg/arm/fcvt.ref
 rename tests/tcg/{ => arm}/hello-arm.c (100%)
 rename tests/tcg/{test-arm-iwmmxt.s => arm/test-arm-iwmmxt.S} (100%)
 create mode 100644 tests/tcg/hppa/Makefile.include
 create mode 100644 tests/tcg/hppa/Makefile.target
 create mode 100644 tests/tcg/i386/Makefile.include
 create mode 100644 tests/tcg/i386/Makefile.target
 create mode 100644 tests/tcg/i386/README
 rename tests/tcg/{ => i386}/hello-i386.c (96%)
 rename tests/tcg/{ => i386}/pi_10.com (100%)
 rename tests/tcg/{ => i386}/runcom.c (100%)
 rename tests/tcg/{ => i386}/test-i386-code16.S (100%)
 rename tests/tcg/{ => i386}/test-i386-fprem.c (97%)
 rename tests/tcg/{ => i386}/test-i386-muldiv.h (100%)
 rename tests/tcg/{ => i386}/test-i386-shift.h (100%)
 rename tests/tcg/{ => i386}/test-i386-ssse3.c (100%)
 rename tests/tcg/{ => i386}/test-i386-vm86.S (100%)
 rename tests/tcg/{ => i386}/test-i386.c (99%)
 rename tests/tcg/{ => i386}/test-i386.h (100%)
 create mode 100644 tests/tcg/m68k/Makefile.include
 create mode 100644 tests/tcg/m68k/Makefile.target
 create mode 100644 tests/tcg/mips/Makefile.include
 create mode 100644 tests/tcg/mips/Makefile.target
 create mode 100644 tests/tcg/mips/README
 rename tests/tcg/{ => mips}/hello-mips.c (100%)
 create mode 100644 tests/tcg/multiarch/Makefile.target
 create mode 100644 tests/tcg/multiarch/README
 rename tests/tcg/{ => multiarch}/linux-test.c (86%)
 rename tests/tcg/{ => multiarch}/sha1.c (100%)
 rename tests/tcg/{ => multiarch}/test-mmap.c (93%)
 rename tests/tcg/{ => multiarch}/testthread.c (100%)
 create mode 100644 tests/tcg/ppc/Makefile.include
 create mode 100644 tests/tcg/ppc/Makefile.target
 create mode 100644 tests/tcg/riscv/Makefile.include
Quoted 8 lines
Quoted 8 lines
 create mode 100644 tests/tcg/s390x/Makefile.include
 create mode 100644 tests/tcg/sh4/Makefile.include
 create mode 100644 tests/tcg/sh4/Makefile.target
 create mode 100644 tests/tcg/sparc64/Makefile.include
 create mode 100644 tests/tcg/sparc64/Makefile.target
 delete mode 100644 tests/tcg/test_path.c
 create mode 100644 tests/tcg/x86_64/Makefile.target

--
Alex Bennée

#68 lore raw
In reply to Alex Bennée

Hi Alex,

Quoted 21 lines · Alex Bennée

Hi,

Not a super amount has changed since the last version but review comments and review tags have been added. The new patches at the end enable a .travis.yml run and try and make the image building part of check-tcg -j safe. Essentially the problem is trying to avoid re-building the images multiple times. The additional issue is wanting an upto date Debian SID image whenever we actually build an image but not forcing a rebuild every time.

Essentially I'd like to encode a conditional dependency when:
- the target image doesn't exist
- or the target image is out of date w.r.t. the dockerfike

I'm thinking this is going to involve some sort of extension to the docker.py script to feed the Makefile.

A number of the prerequisite patches have already been pulled in the docker fixes series however I think this series is ready to go in now. Unless there are any objections I'll send a pull on Monday.

Quoted 8 lines

Current unreviewed patches:

patch 0017/tests tcg i386 add runner for test i386 fprem.patch needs review patch 0039/docker move debian powerpc cross to sid based bui.patch needs review patch 0040/tests tcg enable building for PowerPC.patch needs review patch 0042/Makefile.target add clean build guest tests targe.patch needs review patch 0044/tests tcg add run diff and skip helper macros.patch needs review patch 0045/tests tcg override runners for broken tests.patch needs review

No problem until here.

Quoted 1 line

patch 0046/target sh4 Fix translator.c assertion failure for.patch needs review

Probably unrelated.

Quoted 1 line

patch 0047/tests add top level make dependency for docker bu.patch needs review

I think you could add patch #47 (which is the last piece required to test your work) removing the 'build-docker-prereqs' rule, and fix it during the week.

Quoted 1 line

patch 0048/tests docker prevent sub makes re building debian.patch needs review

I wouldn't include this one (yet).

Quoted 1 line

patch 0049/.travis.yml add check tcg test.patch needs review

You can include this one fixed using "-j1".

Good work! :)

Regards,

Phil.

Quoted 200 lines

Alex Bennée (46):
configure: add support for --cross-cc-FOO
configure: move i386_cc to cross_cc_i386
configure: allow user to specify --cross-cc-cflags-foo=
configure: set cross_cc_FOO for host compiler
docker: Add "cc" subcommand
docker: extend "cc" command to accept compiler
docker: allow "cc" command to run in user context
docker: Makefile.include introduce DOCKER_SCRIPT tests/tcg: move architecture independent tests into subdir tests/tcg/multiarch: enable additional linux-test tests tests/tcg/multiarch: move most output to stdout tests/tcg: move i386 specific tests into subdir tests/tcg: enable building for i386 tests/tcg/i386: fix test-i386
tests/tcg/i386: add runner for test-i386-fprem tests/tcg/x86_64: add Makefile.target tests/tcg/i386/test-i386: use modern vector_size attributes tests/tcg/i386/test-i386: fix printf format tests/tcg: move ARM specific tests into subdir tests/tcg: enable building for ARM
tests/tcg/arm: fix up test-arm-iwmmxt test tests/tcg: enable building for AArch64 tests/tcg/arm: add fcvt test cases for AArch32/64 tests/tcg: move MIPS specific tests into subdir tests/tcg: enable building for MIPS tests/tcg/mips: include common mips hello-mips tests/tcg: enable building for s390x
tests/tcg: enable building for ppc64
tests/tcg: enable building for Alpha tests/tcg/alpha: add Alpha specific tests tests/tcg: enable building for HPPA
tests/tcg: enable building for m68k
tests/tcg: enable building for sh4
tests/tcg: enable building for sparc64
tests/tcg: enable building for mips64
tests/tcg: enable building for RISCV64
docker: move debian-powerpc-cross to sid based build tests/tcg: enable building for PowerPC tests/tcg/Makefile: update to be called from Makefile.target Makefile.target: add (clean-/build-)guest-tests targets tests/Makefile.include: add [build|clean|check]-tcg targets tests/tcg: add run, diff, and skip helper macros tests/tcg: override runners for broken tests
tests: add top-level make dependency for docker builds tests/docker: prevent sub-makes re-building debian-sid .travis.yml: add check-tcg test

Fam Zheng (2):
tests/tcg/multiarch: Build fix for linux-test
tests/tcg/i386: Build fix for hello-i386

Richard Henderson (1):
target/sh4: Fix translator.c assertion failure for gUSA

 .travis.yml                                   |    6 +
 MAINTAINERS                                   |   14 +
 Makefile.target                               |    5 +
 configure                                     |  134 +-
 target/sh4/translate.c                        |   81 +-
 tests/Makefile.include                        |   38 +-
 tests/docker/Makefile.include                 |   31 +-
 tests/docker/docker.py                        |   31 +
 .../dockerfiles/debian-alpha-cross.docker     |   12 +
 tests/docker/dockerfiles/debian-apt-fake.sh   |   46 -
 .../dockerfiles/debian-hppa-cross.docker      |   12 +
 .../dockerfiles/debian-m68k-cross.docker      |   12 +
 .../dockerfiles/debian-mips64-cross.docker    |   12 +
 .../dockerfiles/debian-powerpc-cross.docker   |   39 +-
 .../dockerfiles/debian-riscv64-cross.docker   |   12 +
 .../dockerfiles/debian-sh4-cross.docker       |   12 +
 tests/docker/dockerfiles/debian-sid.docker    |   32 +
 .../dockerfiles/debian-sparc64-cross.docker   |   12 +
 tests/docker/dockerfiles/debian8.docker       |    3 -
 tests/tcg/Makefile                            |  219 +-
 tests/tcg/Makefile.include                    |   89 +
 tests/tcg/Makefile.probe                      |   31 +
 tests/tcg/README                              |   69 +-
 tests/tcg/aarch64/Makefile.include            |    8 +
 tests/tcg/aarch64/Makefile.target             |   17 +
 tests/tcg/aarch64/fcvt.ref                    | 3268 +++++++++++++++++
 tests/tcg/alpha/Makefile                      |   35 -
 tests/tcg/alpha/Makefile.include              |    2 +
 tests/tcg/alpha/Makefile.target               |   18 +
 tests/tcg/alpha/crt.s                         |   26 -
 tests/tcg/alpha/hello-alpha.c                 |    2 +
 tests/tcg/alpha/test-cond.c                   |    1 +
 tests/tcg/alpha/test-ovf.c                    |    2 +
 tests/tcg/arm/Makefile.include                |    8 +
 tests/tcg/arm/Makefile.target                 |   32 +
 tests/tcg/arm/README                          |   11 +
 tests/tcg/arm/fcvt.c                          |  458 +++
 tests/tcg/arm/fcvt.ref                        | 3268 +++++++++++++++++
 tests/tcg/{ => arm}/hello-arm.c               |    0
 .../test-arm-iwmmxt.S}                        |    0
 tests/tcg/hppa/Makefile.include               |    2 +
 tests/tcg/hppa/Makefile.target                |    6 +
 tests/tcg/i386/Makefile.include               |    9 +
 tests/tcg/i386/Makefile.target                |   51 +
 tests/tcg/i386/README                         |   38 +
 tests/tcg/{ => i386}/hello-i386.c             |    1 +
 tests/tcg/{ => i386}/pi_10.com                |  Bin
 tests/tcg/{ => i386}/runcom.c                 |    0
 tests/tcg/{ => i386}/test-i386-code16.S       |    0
 tests/tcg/{ => i386}/test-i386-fprem.c        |   12 +-
 tests/tcg/{ => i386}/test-i386-muldiv.h       |    0
 tests/tcg/{ => i386}/test-i386-shift.h        |    0
 tests/tcg/{ => i386}/test-i386-ssse3.c        |    0
 tests/tcg/{ => i386}/test-i386-vm86.S         |    0
 tests/tcg/{ => i386}/test-i386.c              |    7 +-
 tests/tcg/{ => i386}/test-i386.h              |    0
 tests/tcg/m68k/Makefile.include               |    2 +
 tests/tcg/m68k/Makefile.target                |    7 +
 tests/tcg/mips/Makefile.include               |   20 +
 tests/tcg/mips/Makefile.target                |   22 +
 tests/tcg/mips/README                         |    7 +
 tests/tcg/{ => mips}/hello-mips.c             |    0
 tests/tcg/multiarch/Makefile.target           |   36 +
 tests/tcg/multiarch/README                    |    1 +
 tests/tcg/{ => multiarch}/linux-test.c        |  113 +-
 tests/tcg/{ => multiarch}/sha1.c              |    0
 tests/tcg/{ => multiarch}/test-mmap.c         |   40 +-
 tests/tcg/{ => multiarch}/testthread.c        |    0
 tests/tcg/ppc/Makefile.include                |    7 +
 tests/tcg/ppc/Makefile.target                 |   12 +
 tests/tcg/riscv/Makefile.include              |   10 +
 tests/tcg/s390x/Makefile.include              |    2 +
 tests/tcg/sh4/Makefile.include                |    4 +
 tests/tcg/sh4/Makefile.target                 |    7 +
 tests/tcg/sparc64/Makefile.include            |    2 +
 tests/tcg/sparc64/Makefile.target             |   11 +
 tests/tcg/test_path.c                         |  157 -
 tests/tcg/x86_64/Makefile.target              |   15 +
 78 files changed, 8068 insertions(+), 641 deletions(-)
 create mode 100644 tests/docker/dockerfiles/debian-alpha-cross.docker
 delete mode 100755 tests/docker/dockerfiles/debian-apt-fake.sh
 create mode 100644 tests/docker/dockerfiles/debian-hppa-cross.docker
 create mode 100644 tests/docker/dockerfiles/debian-m68k-cross.docker
 create mode 100644 tests/docker/dockerfiles/debian-mips64-cross.docker
 create mode 100644 tests/docker/dockerfiles/debian-riscv64-cross.docker
 create mode 100644 tests/docker/dockerfiles/debian-sh4-cross.docker
 create mode 100644 tests/docker/dockerfiles/debian-sid.docker
 create mode 100644 tests/docker/dockerfiles/debian-sparc64-cross.docker
 create mode 100644 tests/tcg/Makefile.include
 create mode 100644 tests/tcg/Makefile.probe
 create mode 100644 tests/tcg/aarch64/Makefile.include
 create mode 100644 tests/tcg/aarch64/Makefile.target
 create mode 100644 tests/tcg/aarch64/fcvt.ref
 delete mode 100644 tests/tcg/alpha/Makefile
 create mode 100644 tests/tcg/alpha/Makefile.include
 create mode 100644 tests/tcg/alpha/Makefile.target
 delete mode 100644 tests/tcg/alpha/crt.s
 create mode 100644 tests/tcg/arm/Makefile.include
 create mode 100644 tests/tcg/arm/Makefile.target
 create mode 100644 tests/tcg/arm/README
 create mode 100644 tests/tcg/arm/fcvt.c
 create mode 100644 tests/tcg/arm/fcvt.ref
 rename tests/tcg/{ => arm}/hello-arm.c (100%)
 rename tests/tcg/{test-arm-iwmmxt.s => arm/test-arm-iwmmxt.S} (100%)
 create mode 100644 tests/tcg/hppa/Makefile.include
 create mode 100644 tests/tcg/hppa/Makefile.target
 create mode 100644 tests/tcg/i386/Makefile.include
 create mode 100644 tests/tcg/i386/Makefile.target
 create mode 100644 tests/tcg/i386/README
 rename tests/tcg/{ => i386}/hello-i386.c (96%)
 rename tests/tcg/{ => i386}/pi_10.com (100%)
 rename tests/tcg/{ => i386}/runcom.c (100%)
 rename tests/tcg/{ => i386}/test-i386-code16.S (100%)
 rename tests/tcg/{ => i386}/test-i386-fprem.c (97%)
 rename tests/tcg/{ => i386}/test-i386-muldiv.h (100%)
 rename tests/tcg/{ => i386}/test-i386-shift.h (100%)
 rename tests/tcg/{ => i386}/test-i386-ssse3.c (100%)
 rename tests/tcg/{ => i386}/test-i386-vm86.S (100%)
 rename tests/tcg/{ => i386}/test-i386.c (99%)
 rename tests/tcg/{ => i386}/test-i386.h (100%)
 create mode 100644 tests/tcg/m68k/Makefile.include
 create mode 100644 tests/tcg/m68k/Makefile.target
 create mode 100644 tests/tcg/mips/Makefile.include
 create mode 100644 tests/tcg/mips/Makefile.target
 create mode 100644 tests/tcg/mips/README
 rename tests/tcg/{ => mips}/hello-mips.c (100%)
 create mode 100644 tests/tcg/multiarch/Makefile.target
 create mode 100644 tests/tcg/multiarch/README
 rename tests/tcg/{ => multiarch}/linux-test.c (86%)
 rename tests/tcg/{ => multiarch}/sha1.c (100%)
 rename tests/tcg/{ => multiarch}/test-mmap.c (93%)
 rename tests/tcg/{ => multiarch}/testthread.c (100%)
 create mode 100644 tests/tcg/ppc/Makefile.include
 create mode 100644 tests/tcg/ppc/Makefile.target
 create mode 100644 tests/tcg/riscv/Makefile.include
 create mode 100644 tests/tcg/s390x/Makefile.include
 create mode 100644 tests/tcg/sh4/Makefile.include
 create mode 100644 tests/tcg/sh4/Makefile.target
 create mode 100644 tests/tcg/sparc64/Makefile.include
 create mode 100644 tests/tcg/sparc64/Makefile.target
 delete mode 100644 tests/tcg/test_path.c
 create mode 100644 tests/tcg/x86_64/Makefile.target