Skip to contentSkip to conversation

fix building of tests/tcg

PATCH Superseded Alex Bennée 9 participants 102 messages Apr 24, 2018 – May 16, 2018 Kbuild

v3 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v3 cover fix building of tests/tcg

Hi,

This is starting to shape up pretty nicely. I was able to add a whole bunch of additional architectures thanks to cross compilers in Debian Sid which are there to support the Debian "ports". These may not be around for ever, most "ports" are on the way out, but they will be the last thing to drop out of the Sid repo. Maybe when Debian stops caring (and no other distro does) maybe we should to?

However compiling big-endian targets continues to be a massive pain as even if compilers support switching endianess with flags you are usually let down by a partial set of headers or the linker not being able to link against wrong-endian crt.o or libgcc files. Ultimately any guests that are not supported by any distro are probably going to be stuck with bare metal or hand crafted tests like in tests/tcg/alpha.

The final patch (tests/tcg: override runners for broken tests) suppresses a bunch of tests that fail on different guest setups. This was to allow me to test "make check-tcg" could make it all the way through. I'm sure some of them are bugs that need fixing so it would be cool if maintainers could look through and see if there are any easy wins.

Major Changes:
- check-tcg now runs the tests (c.f build-tcg/clean-tcg)
- clean use of quiet-command for CROSS-BUILD/RUN-TESTS and TEST
- bunch of additional targets (alpha, hppa, m68k, sh4, sparc64, mips64)
- review comments and tags
- dropped fp-test and additional aarch64 tests for now

As usual detailed notes are bellow the --- in the commit messages.

Currently un-reviewed:

patch 0002/configure add test for docker availability.patch needs review patch 0003/configure add support for cross cc FOO.patch needs review patch 0004/configure move i386_cc to cross_cc_i386.patch needs review patch 0005/configure allow user to specify cross cc cflags f.patch needs review patch 0014/tests tcg multiarch enable additional linux test .patch needs review patch 0015/tests tcg multiarch move most output to stdout.patch needs review patch 0017/docker Add fedora i386 cross image.patch needs review patch 0018/tests tcg enable building for i386.patch needs review patch 0021/tests tcg i386 fix test i386 fprem.patch needs review patch 0022/tests tcg i386 disable i386 version of test i386 .patch needs review patch 0023/tests tcg x86_64 add Makefile.target.patch needs review patch 0025/tests tcg i386 test i386 fix printf format.patch needs review patch 0027/tests tcg arm fix up test arm iwmmxt test.patch needs review patch 0028/tests tcg aarch64 add Makefile.target.patch needs review patch 0029/tests tcg aarch64 add fcvt test cases for AArch64.patch needs review patch 0031/tests tcg enable building for MIPS.patch needs review patch 0032/tests tcg mips include common mips hello mips.patch needs review patch 0035/tests tcg enable building for Alpha.patch needs review patch 0036/tests tcg alpha add Alpha specific tests.patch needs review patch 0037/tests tcg alpha fix warnings about write.patch needs review patch 0038/tests tcg enable building for HPPA.patch needs review patch 0039/tests tcg enable building for m68k.patch needs review patch 0040/tests tcg enable building for sh4.patch needs review patch 0041/tests tcg enable building for sparc64.patch needs review patch 0042/tests tcg enable building for mips64.patch needs review patch 0043/tests tcg Makefile update to be called from Makef.patch needs review patch 0044/Makefile.target add clean guest tests targets.patch needs review patch 0046/tests tcg override runners for broken tests UPSTR.patch needs review

Alex Bennée (41):
configure: add test for docker availability
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: fix test-i386-fprem tests/tcg/i386: disable i386 version of test-i386-ssse 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/arm: fix up test-arm-iwmmxt test tests/tcg/aarch64: add Makefile.target tests/tcg/aarch64: add fcvt test cases for AArch64 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/alpha: fix warnings about write() 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/Makefile: update to be called from Makefile.target Makefile.target: add (clean-)guest-tests targets tests/Makefile.include: add [build|clean|check]-tcg targets tests/tcg: override runners for broken tests (!UPSTREAM)

Fam Zheng (4):
Makefile: Rename TARGET_DIRS to TARGET_LIST
tests/tcg/multiarch: Build fix for linux-test
docker: Add fedora-i386-cross image
tests/tcg/i386: Build fix for hello-i386

Peter Maydell (1):
docker: add "probe" command for configure

 Makefile                                      |   20 +-
 Makefile.target                               |    5 +
 configure                                     |  136 +-
 scripts/create_config                         |    2 +-
 tests/Makefile.include                        |   28 +-
 tests/docker/Makefile.include                 |   16 +-
 tests/docker/docker.py                        |   49 +
 .../dockerfiles/debian-alpha-cross.docker     |   12 +
 .../dockerfiles/debian-cross-build.docker     |   36 +
 .../dockerfiles/debian-hppa-cross.docker      |   12 +
 .../dockerfiles/debian-m68k-cross.docker      |   12 +
 .../dockerfiles/debian-mips64-cross.docker    |   12 +
 .../dockerfiles/debian-sh4-cross.docker       |   12 +
 tests/docker/dockerfiles/debian-sid.docker    |   23 +
 .../dockerfiles/debian-sparc64-cross.docker   |   12 +
 .../dockerfiles/fedora-i386-cross.docker      |   14 +
 tests/tcg/Makefile                            |  193 +--
 tests/tcg/Makefile.include                    |   86 ++
 tests/tcg/README                              |   69 +-
 tests/tcg/aarch64/Makefile.target             |   13 +
 tests/tcg/aarch64/fcvt.c                      |  260 ++++
 tests/tcg/aarch64/fcvt.out                    | 1305 +++++++++++++++++
 tests/tcg/alpha/Makefile                      |   35 -
 tests/tcg/alpha/Makefile.include              |    2 +
 tests/tcg/alpha/Makefile.target               |   36 +
 tests/tcg/alpha/{crt.s => crt.S}              |    0
 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.target                 |   20 +
 tests/tcg/arm/README                          |   11 +
 tests/tcg/{ => arm}/hello-arm.c               |    0
 .../test-arm-iwmmxt.S}                        |    0
 tests/tcg/hppa/Makefile.include               |    2 +
 tests/tcg/hppa/Makefile.target                |   10 +
 tests/tcg/i386/Makefile.include               |    9 +
 tests/tcg/i386/Makefile.target                |   52 +
 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                |   11 +
 tests/tcg/mips/Makefile.include               |   20 +
 tests/tcg/mips/Makefile.target                |   29 +
 tests/tcg/mips/README                         |    7 +
 tests/tcg/{ => mips}/hello-mips.c             |    0
 tests/tcg/multiarch/Makefile.target           |   29 +
 tests/tcg/multiarch/README                    |    1 +
 tests/tcg/{ => multiarch}/linux-test.c        |   93 +-
 tests/tcg/{ => multiarch}/sha1.c              |    0
 tests/tcg/{ => multiarch}/test-mmap.c         |   38 +-
 tests/tcg/{ => multiarch}/testthread.c        |    0
 tests/tcg/ppc64le/Makefile.include            |    2 +
 tests/tcg/s390x/Makefile.include              |    2 +
 tests/tcg/s390x/Makefile.target               |    6 +
 tests/tcg/sh4/Makefile.include                |    4 +
 tests/tcg/sh4/Makefile.target                 |    6 +
 tests/tcg/sparc64/Makefile.include            |    2 +
 tests/tcg/sparc64/Makefile.target             |    8 +
 tests/tcg/test_path.c                         |  157 --
 tests/tcg/x86_64/Makefile.target              |   15 +
 70 files changed, 2495 insertions(+), 504 deletions(-)
 create mode 100644 tests/docker/dockerfiles/debian-alpha-cross.docker
 create mode 100644 tests/docker/dockerfiles/debian-cross-build.docker
 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-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/docker/dockerfiles/fedora-i386-cross.docker
 create mode 100644 tests/tcg/Makefile.include
 create mode 100644 tests/tcg/aarch64/Makefile.target
 create mode 100644 tests/tcg/aarch64/fcvt.c
 create mode 100644 tests/tcg/aarch64/fcvt.out
 delete mode 100644 tests/tcg/alpha/Makefile
 create mode 100644 tests/tcg/alpha/Makefile.include
 create mode 100644 tests/tcg/alpha/Makefile.target
 rename tests/tcg/alpha/{crt.s => crt.S} (100%)
 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/{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 (87%)
 rename tests/tcg/{ => multiarch}/sha1.c (100%)
 rename tests/tcg/{ => multiarch}/test-mmap.c (94%)
 rename tests/tcg/{ => multiarch}/testthread.c (100%)
 create mode 100644 tests/tcg/ppc64le/Makefile.include
 create mode 100644 tests/tcg/s390x/Makefile.include
 create mode 100644 tests/tcg/s390x/Makefile.target
 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.0
#1 lore raw

PATCH v3 1/46 docker: add "probe" command for configure

From: Peter Maydell <[email protected]>

This is a helper function for the configure script. It replies yes, sudo or no to inform the user if non-interactive docker support is available. We trap the Exception to fail gracefully.

---
 tests/docker/docker.py | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
tests/docker/docker.py +18 -0
index 1246ba9578..f8267586eb 100755
@@ -390,6 +390,24 @@ class ImagesCommand(SubCommand):
     def run(self, args, argv):
         return Docker().command("images", argv, args.quiet)
 
+
+class ProbeCommand(SubCommand):
+    """Probe if we can run docker automatically"""
+    name = "probe"
+
+    def run(self, args, argv):
+        try:
+            docker = Docker()
+            if docker._command[0] == "docker":
+                print "yes"
+            elif docker._command[0] == "sudo":
+                print "sudo"
+        except Exception:
+            print "no"
+
+        return
+
+
 def main():
     parser = argparse.ArgumentParser(description="A Docker helper",
             usage="%s <subcommand> ..." % os.path.basename(sys.argv[0]))
Signature · 1 line
2.17.0
#2 lore raw

PATCH v3 2/46 configure: add test for docker availability

In reply to Alex Bennée

This tests for a working docker installation without sudo and sets up config-host.mak accordingly. This will be useful from cross compiling things in the future.

---
 configure | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
configure +17 -0
index 0a19b033bc..b0ae632ee4 100755
@@ -451,6 +451,7 @@ jemalloc="no"
 replication="yes"
 vxhs=""
 libxml2=""
+docker="no"
 
 supported_cpu="no"
 supported_os="no"
@@ -5413,6 +5414,17 @@ EOF
   fi
 fi
 
+##########################################
+# Docker and cross-compiler support
+#
+# This is specifically for building test
+# cases for foreign architectures, not
+# cross-compiling QEMU itself.
+
+if has "docker"; then
+    docker=$($python $source_path/tests/docker/docker.py probe)
+fi
+
 ##########################################
 # End of CC checks
 # After here, no more $cc or $ld runs
@@ -5874,6 +5886,7 @@ echo "avx2 optimization $avx2_opt"
 echo "replication support $replication"
 echo "VxHS block device $vxhs"
 echo "capstone          $capstone"
+echo "docker            $docker"
 
 if test "$sdl_too_old" = "yes"; then
 echo "-> Your SDL version is too old - please upgrade to have SDL support"
@@ -6697,6 +6710,10 @@ if test "$gcov" = "yes" ; then
   echo "GCOV=$gcov_tool" >> $config_host_mak
 fi
 
+if test "$docker" != "no"; then
+    echo "HAVE_USER_DOCKER=y" >> $config_host_mak
+fi
+
 # use included Linux headers
 if test "$linux" = "yes" ; then
   mkdir -p linux-headers
Signature · 1 line
2.17.0
Reviewed-by on v3 2/46
#3 lore raw

Re: [Qemu-devel] [PATCH v3 02/46] configure: add test for docker availability

Quoted 8 lines · Alex Bennée

This tests for a working docker installation without sudo and sets up config-host.mak accordingly. This will be useful from cross compiling things in the future.

---
 configure | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

r~

#4 lore raw

PATCH v3 3/46 configure: add support for --cross-cc-FOO

In reply to Alex Bennée

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

---
 configure | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 79 insertions(+)
configure +79 -0
index b0ae632ee4..caa838a0d0 100755
@@ -453,6 +453,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"
@@ -483,6 +490,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
@@ -675,10 +687,12 @@ case "$cpu" in
   i386|i486|i586|i686|i86pc|BePC)
     cpu="i386"
     supported_cpu="yes"
+    cross_cc_i386=gcc
   ;;
   x86_64|amd64)
     cpu="x86_64"
     supported_cpu="yes"
+    cross_cc_x86_64=gcc
   ;;
   armv*b|armv*l|arm)
     cpu="arm"
@@ -912,6 +926,8 @@ for opt do
   ;;
   --disable-debug-info)
   ;;
+  --cross-cc-*)
+  ;;
   --enable-modules)
       modules="yes"
   ;;
@@ -6777,6 +6793,8 @@ case "$target" in
     ;;
 esac
 
+target_compiler=""
+
 mkdir -p $target_dir
 echo "# Automatically generated by configure - do not modify" > $config_target_mak
 
@@ -6792,19 +6810,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
@@ -6812,58 +6834,73 @@ 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"
+    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
@@ -6871,6 +6908,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
@@ -6878,45 +6916,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"
@@ -6927,6 +6977,25 @@ 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
+
+    cat > $TMPC << EOF
+#include <stdio.h>
+int main(void) {
+    printf("Hello World!\n");
+}
+EOF
+
+    if ! do_compiler $target_compiler -o $TMPE $TMPC -static ; then
+        target_compiler=""
+    else
+        enabled_cross_compilers="${enabled_cross_compilers} ${target_compiler}"
+    fi
+else
+    target_compiler=""
+fi
+
 symlink "$source_path/Makefile.target" "$target_dir/Makefile"
 
 upper() {
@@ -7000,6 +7069,10 @@ 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
+fi
+
 # generate QEMU_CFLAGS/LDFLAGS for targets
 
 cflags=""
@@ -7122,6 +7195,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 [ "$dtc_internal" = "yes" ]; then
   echo "config-host.h: subdir-dtc" >> $config_host_mak
 fi
Signature · 1 line
2.17.0
Reviewed-by on v3 3/46
#5 lore raw

Re: [Qemu-devel] [PATCH v3 03/46] configure: add support for --cross-cc-FOO

configure case "$cpu" in · line 698

Quoted 13 lines · Alex Bennée
configure +2 -0
@@ -675,10 +687,12 @@ case "$cpu" in
   i386|i486|i586|i686|i86pc|BePC)
     cpu="i386"
     supported_cpu="yes"
+    cross_cc_i386=gcc
   ;;
   x86_64|amd64)
     cpu="x86_64"
     supported_cpu="yes"
+    cross_cc_x86_64=gcc
   ;;
   armv*b|armv*l|arm)
     cpu="arm"

Isn't this hunk taken care of in the next patch, where you set these to $cc? And if not, surely bare "gcc" isn't correct...

Otherwise,

r~

#6 lore raw

Re: [Qemu-devel] [PATCH v3 03/46] configure: add support for --cross-cc-FOO

Quoted 17 lines · Richard Henderson

configure case "$cpu" in · line 698

Quoted 13 lines · Alex Bennée
configure +2 -0
@@ -675,10 +687,12 @@ case "$cpu" in
   i386|i486|i586|i686|i86pc|BePC)
     cpu="i386"
     supported_cpu="yes"
+    cross_cc_i386=gcc
   ;;
   x86_64|amd64)
     cpu="x86_64"
     supported_cpu="yes"
+    cross_cc_x86_64=gcc
   ;;
   armv*b|armv*l|arm)
     cpu="arm"

Isn't this hunk taken care of in the next patch, where you set these to $cc? And if not, surely bare "gcc" isn't correct...

Woops, I'll fix that.

Quoted 6 lines

Otherwise,

r~

--
Alex Bennée

#7 lore raw

Re: [Qemu-devel] [PATCH v3 03/46] configure: add support for --cross-cc-FOO

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

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

---
 configure | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 79 insertions(+)
configure +0 -0
index b0ae632ee4..caa838a0d0 100755

configure vxhs="" · line 459

Quoted 7 lines
configure +4 -0
@@ -453,6 +453,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"

Do we need to have default values for all targets?

Quoted 7 lines
configure +3 -0
+
+enabled_cross_compilers=""
+
 supported_cpu="no"
 supported_os="no"
 bogus_os="no"

configure for opt do · line 497

Quoted 8 lines
configure +5 -0
@@ -483,6 +490,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"
+  ;;

Do we need to verify if a valid --cross-cc-FOO was passed, in case of a typo?

Quoted 201 lines
configure +38 -0
   esac
 done
 # OS specific
@@ -675,10 +687,12 @@ case "$cpu" in
   i386|i486|i586|i686|i86pc|BePC)
     cpu="i386"
     supported_cpu="yes"
+    cross_cc_i386=gcc
   ;;
   x86_64|amd64)
     cpu="x86_64"
     supported_cpu="yes"
+    cross_cc_x86_64=gcc
   ;;
   armv*b|armv*l|arm)
     cpu="arm"
@@ -912,6 +926,8 @@ for opt do
   ;;
   --disable-debug-info)
   ;;
+  --cross-cc-*)
+  ;;
   --enable-modules)
       modules="yes"
   ;;
@@ -6777,6 +6793,8 @@ case "$target" in
     ;;
 esac
 
+target_compiler=""
+
 mkdir -p $target_dir
 echo "# Automatically generated by configure - do not modify" > $config_target_mak
 
@@ -6792,19 +6810,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
@@ -6812,58 +6834,73 @@ 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"
+    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
@@ -6871,6 +6908,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
@@ -6878,45 +6916,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"
@@ -6927,6 +6977,25 @@ if [ "$TARGET_BASE_ARCH" = "" ]; then
   TARGET_BASE_ARCH=$TARGET_ARCH
 fi

configure if [ "$TARGET_BASE_ARCH" = "" ]; then · line 6988

Quoted 10 lines
configure +9 -0
 
+# Do we have a cross compiler for this target?
+if has $target_compiler; then
+
+    cat > $TMPC << EOF
+#include <stdio.h>
+int main(void) {
+    printf("Hello World!\n");
+}
+EOF

Can this be replaced by write_c_skeleton?

Quoted 38 lines
configure +20 -0
+
+    if ! do_compiler $target_compiler -o $TMPE $TMPC -static ; then
+        target_compiler=""
+    else
+        enabled_cross_compilers="${enabled_cross_compilers} ${target_compiler}"
+    fi
+else
+    target_compiler=""
+fi
+
 symlink "$source_path/Makefile.target" "$target_dir/Makefile"
 
 upper() {
@@ -7000,6 +7069,10 @@ 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
+fi
+
 # generate QEMU_CFLAGS/LDFLAGS for targets
 
 cflags=""
@@ -7122,6 +7195,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 [ "$dtc_internal" = "yes" ]; then
   echo "config-host.h: subdir-dtc" >> $config_host_mak
 fi
#8 lore raw

Re: [Qemu-devel] [PATCH v3 03/46] configure: add support for --cross-cc-FOO

Quoted 45 lines · Murilo Opsfelder Araujo
Quoted 24 lines · Alex Bennée

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

---
 configure | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 79 insertions(+)
configure +0 -0
index b0ae632ee4..caa838a0d0 100755

configure vxhs="" · line 459

Quoted 7 lines
configure +4 -0
@@ -453,6 +453,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"

Do we need to have default values for all targets?

Quoted 10 lines
configure +3 -0
+
+enabled_cross_compilers=""
+
 supported_cpu="no"
 supported_os="no"
 bogus_os="no"
@@ -483,6 +490,11 @@ for opt do
   ;;
   --disable-debug-info) debug_info="no"
   ;;
Quoted 8 lines

configure for opt do · line 497

Quoted 5 lines
configure +5 -0
+  --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"
+  ;;

Do we need to verify if a valid --cross-cc-FOO was passed, in case of a typo?

How so? We do attempt to build with these options later.

Quoted 12 lines

configure if [ "$TARGET_BASE_ARCH" = "" ]; then · line 6988

Quoted 10 lines
configure +9 -0
+# Do we have a cross compiler for this target?
+if has $target_compiler; then
+
+    cat > $TMPC << EOF
+#include <stdio.h>
+int main(void) {
+    printf("Hello World!\n");
+}
+EOF

Can this be replaced by write_c_skeleton?

Sure. Thanks.

--
Alex Bennée

#9 lore raw

Re: [Qemu-devel] [PATCH v3 03/46] configure: add support for --cross-cc-FOO

Quoted 57 lines · Alex Bennée
Quoted 45 lines · Murilo Opsfelder Araujo
Quoted 24 lines · Alex Bennée

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

---
 configure | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 79 insertions(+)
configure +0 -0
index b0ae632ee4..caa838a0d0 100755

configure vxhs="" · line 459

Quoted 7 lines
configure +4 -0
@@ -453,6 +453,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"

Do we need to have default values for all targets?

Quoted 10 lines
configure +3 -0
+
+enabled_cross_compilers=""
+
 supported_cpu="no"
 supported_os="no"
 bogus_os="no"
@@ -483,6 +490,11 @@ for opt do
   ;;
   --disable-debug-info) debug_info="no"
   ;;
Quoted 8 lines

configure for opt do · line 497

Quoted 5 lines
configure +5 -0
+  --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"
+  ;;

Do we need to verify if a valid --cross-cc-FOO was passed, in case of a typo?

Quoted 1 line

How so? We do attempt to build with these options later.

Hi, Alex.

User can mistakenly pass, for example, --cross-cc-ppc64el= instead of the expected --cross-cc-ppc64le=. I was wondering if we need to validate this kind of input (inexistent $cross_cc_* variable) and consider --cross-cc-ppc64el= an invalid option, in this example.

By the way, are you updating the --help text explaining these new --cross-cc-* options?

Signature · 1 line
Murilo
#10 lore raw

Re: [Qemu-devel] [PATCH v3 03/46] configure: add support for --cross-cc-FOO

Quoted 58 lines · Murilo Opsfelder Araujo
Quoted 57 lines · Alex Bennée
Quoted 53 lines · Murilo Opsfelder Araujo
Quoted 24 lines · Alex Bennée

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

---
 configure | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 79 insertions(+)
configure +0 -0
index b0ae632ee4..caa838a0d0 100755

configure vxhs="" · line 459

Quoted 7 lines
configure +4 -0
@@ -453,6 +453,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"

Do we need to have default values for all targets?

Quoted 7 lines
configure +3 -0
+
+enabled_cross_compilers=""
+
 supported_cpu="no"
 supported_os="no"
 bogus_os="no"

configure for opt do · line 497

Quoted 8 lines
configure +5 -0
@@ -483,6 +490,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"
+  ;;

Do we need to verify if a valid --cross-cc-FOO was passed, in case of a typo?

Quoted 8 lines
Quoted 1 line

How so? We do attempt to build with these options later.

Hi, Alex.

User can mistakenly pass, for example, --cross-cc-ppc64el= instead of the expected --cross-cc-ppc64le=. I was wondering if we need to validate this kind of input (inexistent $cross_cc_* variable) and consider --cross-cc-ppc64el= an invalid option, in this example.

OK I understand. I'm not sure how to do this without having a whole bunch of additional boilerplate code though. I guess there is likely to be churn each time a new guest architecture is added though.

We do currently dump the list of enabled compilers at the end of configure so that at least should give the user some indication of what didn't work?

Quoted 2 lines

By the way, are you updating the --help text explaining these new --cross-cc-* options?

Yes.

--
Alex Bennée

#11 lore raw

Re: [Qemu-devel] [PATCH v3 03/46] configure: add support for --cross-cc-FOO

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

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

---
 configure | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 79 insertions(+)
configure +7 -0
index b0ae632ee4..caa838a0d0 100755
@@ -453,6 +453,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"

configure for opt do · line 497

Quoted 8 lines
configure +5 -0
@@ -483,6 +490,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"
+  ;;

Could we have --help text for the new configure options, please?

thanks
-- PMM

#12 lore raw

PATCH v3 4/46 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

---
 configure | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)
configure +16 -8
index caa838a0d0..ffd96d930f 100755
@@ -284,7 +284,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=""
@@ -457,6 +456,8 @@ docker="no"
 cross_cc_aarch64="aarch64-linux-gnu-gcc"
 cross_cc_arm="arm-linux-gnueabihf-gcc"
 cross_cc_powerpc="powerpc-linux-gnu-gcc"
+cross_cc_i386="i386-pc-linux-gnu-gcc"
+cross_cc_cflags_i386=""
 
 enabled_cross_compilers=""
 
@@ -687,12 +688,10 @@ case "$cpu" in
   i386|i486|i586|i686|i86pc|BePC)
     cpu="i386"
     supported_cpu="yes"
-    cross_cc_i386=gcc
   ;;
   x86_64|amd64)
     cpu="x86_64"
     supported_cpu="yes"
-    cross_cc_x86_64=gcc
   ;;
   armv*b|armv*l|arm)
     cpu="arm"
@@ -1435,7 +1434,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.
@@ -1443,12 +1443,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
@@ -6675,7 +6677,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
@@ -6794,6 +6795,7 @@ case "$target" in
 esac
 
 target_compiler=""
+target_compiler_cflags=""
 
 mkdir -p $target_dir
 echo "# Automatically generated by configure - do not modify" > $config_target_mak
@@ -6811,6 +6813,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_cflags_i386
   ;;
   x86_64)
     TARGET_BASE_ARCH=i386
@@ -6987,7 +6990,7 @@ int main(void) {
 }
 EOF
 
-    if ! do_compiler $target_compiler -o $TMPE $TMPC -static ; then
+    if ! do_compiler $target_compiler $target_compiler_cflags -o $TMPE $TMPC -static ; then
         target_compiler=""
     else
         enabled_cross_compilers="${enabled_cross_compilers} ${target_compiler}"
@@ -7071,8 +7074,13 @@ fi
 
 if test -n "$target_compiler"; then
   echo "CROSS_CC_GUEST=$target_compiler" >> $config_target_mak
+
+  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.0
Reviewed-by on v3 4/46
#13 lore raw

Re: [Qemu-devel] [PATCH v3 04/46] configure: move i386_cc to cross_cc_i386

Quoted 5 lines · Alex Bennée

Also dont assume x86_64 compiler can build i386 binaries.

Quoted 8 lines

---
v2
- drop using system x86_64 compiler for i386 compiles
v3
- fix cross_cc_i386 when on i386

---
 configure | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

r~

#14 lore raw

PATCH v3 5/46 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

---
 configure | 8 ++++++++
 1 file changed, 8 insertions(+)
configure +8 -0
index ffd96d930f..282e1f1e2b 100755
@@ -454,7 +454,10 @@ 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_powerpc="powerpc-linux-gnu-gcc"
 cross_cc_i386="i386-pc-linux-gnu-gcc"
 cross_cc_cflags_i386=""
@@ -493,6 +496,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"
   ;;
@@ -6830,6 +6836,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
@@ -6838,6 +6845,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.0
Reviewed-by on v3 5/46
#15 lore raw

Re: [Qemu-devel] [PATCH v3 05/46] configure: allow user to specify --cross-cc-cflags-foo=

Quoted 17 lines · 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

---
 configure | 8 ++++++++
 1 file changed, 8 insertions(+)
configure +0 -0
index ffd96d930f..282e1f1e2b 100755

configure docker="no" · line 454

Quoted 1 line
configure +0 -0
@@ -454,7 +454,10 @@ docker="no"
 

r~

#16 lore raw

PATCH v3 6/46 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 282e1f1e2b..0100545695 100755
@@ -1416,26 +1416,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"
@@ -1456,7 +1468,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.0
#17 lore raw

PATCH v3 7/46 Makefile: Rename TARGET_DIRS to TARGET_LIST

In reply to Alex Bennée

From: Fam Zheng <[email protected]>

To be more accurate on its purpose and make code that looks for a certain target out of this variable more readable.

---
 Makefile               | 20 ++++++++++----------
 configure              |  2 +-
 scripts/create_config  |  2 +-
 tests/Makefile.include |  2 +-
 4 files changed, 13 insertions(+), 13 deletions(-)
Makefile +10 -10
index d71dd5bea4..e894431a89 100644
@@ -62,8 +62,8 @@ seems to have been used for an in-tree build. You can fix this by running \
 endif
 endif
 
-CONFIG_SOFTMMU := $(if $(filter %-softmmu,$(TARGET_DIRS)),y)
-CONFIG_USER_ONLY := $(if $(filter %-user,$(TARGET_DIRS)),y)
+CONFIG_SOFTMMU := $(if $(filter %-softmmu,$(TARGET_LIST)),y)
+CONFIG_USER_ONLY := $(if $(filter %-user,$(TARGET_LIST)),y)
 CONFIG_XEN := $(CONFIG_XEN_BACKEND)
 CONFIG_ALL=y
 -include config-all-devices.mak
@@ -362,8 +362,8 @@ DOCS=
 endif
 
 SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory --quiet) BUILD_DIR=$(BUILD_DIR)
-SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_DIRS))
-SUBDIR_DEVICES_MAK_DEP=$(patsubst %, %-config-devices.mak.d, $(TARGET_DIRS))
+SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_LIST))
+SUBDIR_DEVICES_MAK_DEP=$(patsubst %, %-config-devices.mak.d, $(TARGET_LIST))
 
 ifeq ($(SUBDIR_DEVICES_MAK),)
 config-all-devices.mak:
@@ -466,7 +466,7 @@ config-host.h-timestamp: config-host.mak
 qemu-options.def: $(SRC_PATH)/qemu-options.hx $(SRC_PATH)/scripts/hxtool
 	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"GEN","$@")
 
-SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
+SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_LIST))
 SOFTMMU_SUBDIR_RULES=$(filter %-softmmu,$(SUBDIR_RULES))
 
 $(SOFTMMU_SUBDIR_RULES): $(block-obj-y)
@@ -510,7 +510,7 @@ ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS))
 romsubdir-%:
 	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C pc-bios/$* V="$(V)" TARGET_DIR="$*/" CFLAGS="$(filter -O% -g%,$(CFLAGS))",)
 
-ALL_SUBDIRS=$(TARGET_DIRS) $(patsubst %,pc-bios/%, $(ROMS))
+ALL_SUBDIRS=$(TARGET_LIST) $(patsubst %,pc-bios/%, $(ROMS))
 
 recurse-all: $(SUBDIR_RULES) $(ROMSUBDIR_RULES)
 
@@ -763,7 +763,7 @@ distclean: clean
 	rm -f docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf
 	rm -f docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html
 	rm -f docs/qemu-block-drivers.7
-	for d in $(TARGET_DIRS); do \
+	for d in $(TARGET_LIST); do \
 	rm -rf $$d || exit 1 ; \
         done
 	rm -Rf .sdk
@@ -864,7 +864,7 @@ endif
 		$(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \
 	done
 	$(INSTALL_DATA) $(BUILD_DIR)/trace-events-all "$(DESTDIR)$(qemu_datadir)/trace-events-all"
-	for d in $(TARGET_DIRS); do \
+	for d in $(TARGET_LIST); do \
 	$(MAKE) $(SUBDIR_MAKEFLAGS) TARGET_DIR=$$d/ -C $$d $@ || exit 1 ; \
         done
 
@@ -1062,9 +1062,9 @@ endif
 	@echo  '  ctags/TAGS      - Generate tags file for editors'
 	@echo  '  cscope          - Generate cscope index'
 	@echo  ''
-	@$(if $(TARGET_DIRS), \
+	@$(if $(TARGET_LIST), \
 		echo 'Architecture specific targets:'; \
-		$(foreach t, $(TARGET_DIRS), \
+		$(foreach t, $(TARGET_LIST), \
 		printf "  %-30s - Build for %s\\n" $(patsubst %,subdir-%,$(t)) $(t);) \
 		echo '')
 	@echo  'Cleaning targets:'
configure +1 -1
index 0100545695..6d99d538cd 100755
@@ -6125,7 +6125,7 @@ qemu_version=$(head $source_path/VERSION)
 echo "VERSION=$qemu_version" >>$config_host_mak
 echo "PKGVERSION=$pkgversion" >>$config_host_mak
 echo "SRC_PATH=$source_path" >> $config_host_mak
-echo "TARGET_DIRS=$target_list" >> $config_host_mak
+echo "TARGET_LIST=$target_list" >> $config_host_mak
 if [ "$docs" = "yes" ] ; then
   echo "BUILD_DOCS=yes" >> $config_host_mak
 fi
scripts/create_config +1 -1
index d727e5e36e..58948a67a4 100755
@@ -107,7 +107,7 @@ case $line in
     target_name=${line#*=}
     echo "#define TARGET_NAME \"$target_name\""
     ;;
- TARGET_DIRS=*)
+ TARGET_LIST=*)
     # do nothing
     ;;
  TARGET_*=y) # configuration
tests/Makefile.include +1 -1
index 3b9a5e31a2..3d2f0458ab 100644
@@ -854,7 +854,7 @@ endif
 
 # QTest rules
 
-TARGETS=$(patsubst %-softmmu,%, $(filter %-softmmu,$(TARGET_DIRS)))
+TARGETS=$(patsubst %-softmmu,%, $(filter %-softmmu,$(TARGET_LIST)))
 ifeq ($(CONFIG_POSIX),y)
 QTEST_TARGETS = $(TARGETS)
 check-qtest-y=$(foreach TARGET,$(TARGETS), $(check-qtest-$(TARGET)-y))
Signature · 1 line
2.17.0
#18 lore raw

PATCH v3 8/46 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.0
#19 lore raw

PATCH v3 9/46 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.0
#20 lore raw

PATCH v3 10/46 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.0
#21 lore raw

PATCH v3 11/46 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 de87341528..6a5aa9ec71 100644
@@ -14,6 +14,8 @@ DOCKER_TESTS := $(notdir $(shell \
 
 DOCKER_TOOLS := travis
 
+DOCKER_SCRIPT=$(SRC_PATH)/tests/docker/docker.py
+
 TESTS ?= %
 IMAGES ?= %
 
@@ -37,7 +39,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))\
@@ -129,11 +131,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) 					\
@@ -163,4 +165,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.0
#22 lore raw

PATCH v3 12/46 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

---
 tests/tcg/Makefile                     |  31 -----
 tests/tcg/README                       |  10 +-
 tests/tcg/multiarch/Makefile.target    |  29 +++++
 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 -------------------------
 9 files changed, 34 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
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 +29 -0
new file mode 100644
index 0000000000..0a6307b8a3
@@ -0,0 +1,29 @@
+# -*- 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
+
+# Specialist Runners
+run-test-mmap: test-mmap
+	$(call quiet-command, $(QEMU) $< > test-mmap.out, "TEST", "$< (default) on $(TARGET_NAME)")
+	$(call quiet-command, $(QEMU) -p 8192 $< 8192 > test-mmap-8192.out, "TEST", "$< (8k pages) on $(TARGET_NAME)")
+	$(call quiet-command, $(QEMU) -p 16384 $< 16384 > test-mmap-16384.out, "TEST", "$< (16k pages) on $(TARGET_NAME)")
+	$(call quiet-command, $(QEMU) -p 32768 $< 32768 > test-mmap-32768.out, "TEST", "$< (32k 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.0
#23 lore raw

PATCH v3 13/46 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

[AJB: 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.0
Reviewed-by on v3 13/46
#24 lore raw

Re: [Qemu-devel] [PATCH v3 13/46] tests/tcg/multiarch: Build fix for linux-test

Quoted 8 lines · 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

Quoted 7 lines
[AJB: drop cutils/osdep dependencies]
---
 tests/tcg/multiarch/linux-test.c | 68 ++++++++++----------------------
 1 file changed, 21 insertions(+), 47 deletions(-)

r~

#25 lore raw

PATCH v3 14/46 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.

---
v3
- make clone flags match CLONE_THREAD_FLAGS

---
 tests/tcg/multiarch/linux-test.c | 31 +++++++++++++++++--------------
 1 file changed, 17 insertions(+), 14 deletions(-)
tests/tcg/multiarch/linux-test.c +17 -14
index 4457bd04ba..754edf9910 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>
@@ -39,6 +40,7 @@
 #include <dirent.h>
 #include <setjmp.h>
 #include <sys/shm.h>
+#include <sched.h>
 
 #define TESTPATH "/tmp/linux-test.tmp"
 #define TESTPORT 7654
@@ -58,8 +60,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;
 }
@@ -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,6 +388,9 @@ static int thread2_func(void *arg)
     return 0;
 }
 
+/* For test_clone we must match the clone flags used by glibc, see
+ * CLONE_THREAD_FLAGS in the QEMU source code.
+ */
 void test_clone(void)
 {
     uint8_t *stack1, *stack2;
@@ -394,11 +398,15 @@ void test_clone(void)
 
     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);
     free(stack1);
@@ -408,7 +416,6 @@ void test_clone(void)
         thread2_res != 6)
         error("clone");
 }
-#endif
 
 /***********************************/
 
@@ -449,12 +456,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 +468,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 +505,11 @@ static void test_shm(void)
 int main(int argc, char **argv)
 {
     test_file();
+    test_pipe();
     test_fork();
     test_time();
     test_socket();
-    //    test_clone();
+    test_clone();
     test_signal();
     test_shm();
     return 0;
Signature · 1 line
2.17.0
Reviewed-by on v3 14/46
#26 lore raw

Re: [Qemu-devel] [PATCH v3 14/46] tests/tcg/multiarch: enable additional linux-test tests

Quoted 8 lines · 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.

Quoted 8 lines

---
v3
- make clone flags match CLONE_THREAD_FLAGS

---
 tests/tcg/multiarch/linux-test.c | 31 +++++++++++++++++--------------
 1 file changed, 17 insertions(+), 14 deletions(-)

r~

Tested-by on v3 14/46
#27 lore raw

Re: [Qemu-devel] [PATCH v3 14/46] tests/tcg/multiarch: enable additional linux-test tests

In reply to Alex Bennée
Quoted 9 lines · 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.

Quoted 130 lines

---
v3
- make clone flags match CLONE_THREAD_FLAGS

---
 tests/tcg/multiarch/linux-test.c | 31 +++++++++++++++++--------------
 1 file changed, 17 insertions(+), 14 deletions(-)
tests/tcg/multiarch/linux-test.c +17 -14
index 4457bd04ba..754edf9910 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>
@@ -39,6 +40,7 @@
 #include <dirent.h>
 #include <setjmp.h>
 #include <sys/shm.h>
+#include <sched.h>
 
 #define TESTPATH "/tmp/linux-test.tmp"
 #define TESTPORT 7654
@@ -58,8 +60,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;
 }
@@ -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,6 +388,9 @@ static int thread2_func(void *arg)
     return 0;
 }
 
+/* For test_clone we must match the clone flags used by glibc, see
+ * CLONE_THREAD_FLAGS in the QEMU source code.
+ */
 void test_clone(void)
 {
     uint8_t *stack1, *stack2;
@@ -394,11 +398,15 @@ void test_clone(void)
 
     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);
     free(stack1);
@@ -408,7 +416,6 @@ void test_clone(void)
         thread2_res != 6)
         error("clone");
 }
-#endif
 
 /***********************************/
 
@@ -449,12 +456,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 +468,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 +505,11 @@ static void test_shm(void)
 int main(int argc, char **argv)
 {
     test_file();
+    test_pipe();
     test_fork();
     test_time();
     test_socket();
-    //    test_clone();
+    test_clone();
     test_signal();
     test_shm();
     return 0;
#28 lore raw

PATCH v3 15/46 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.

---
 tests/tcg/multiarch/test-mmap.c | 38 ++++++++++++++++-----------------
 1 file changed, 19 insertions(+), 19 deletions(-)
tests/tcg/multiarch/test-mmap.c +19 -19
index cdefadfa4c..fd6ecc4880 100644
@@ -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.0
Reviewed-by on v3 15/46
#29 lore raw

Re: [Qemu-devel] [PATCH v3 15/46] tests/tcg/multiarch: move most output to stdout

Quoted 7 lines · Alex Bennée

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

---
 tests/tcg/multiarch/test-mmap.c | 38 ++++++++++++++++-----------------
 1 file changed, 19 insertions(+), 19 deletions(-)

r~

Reviewed-by Tested-by on v3 15/46
#30 lore raw

Re: [Qemu-devel] [PATCH v3 15/46] tests/tcg/multiarch: move most output to stdout

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

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

Quoted 173 lines
---
 tests/tcg/multiarch/test-mmap.c | 38 ++++++++++++++++-----------------
 1 file changed, 19 insertions(+), 19 deletions(-)
tests/tcg/multiarch/test-mmap.c +19 -19
index cdefadfa4c..fd6ecc4880 100644
@@ -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)
#31 lore raw

PATCH v3 16/46 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

---
 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
 14 files changed, 68 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%)
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.0
Reviewed-by on v3 16/46
#32 lore raw

Re: [Qemu-devel] [PATCH v3 16/46] tests/tcg: move i386 specific tests into subdir

Quoted 8 lines · 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.

Quoted 5 lines

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

r~

#33 lore raw

Re: [Qemu-devel] [PATCH v3 16/46] tests/tcg: move i386 specific tests into subdir

In reply to Alex Bennée
Quoted 140 lines · 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

---
 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
 14 files changed, 68 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%)
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 +6 -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

tests/tcg/i386/README line 16

Quoted 10 lines
tests/tcg/i386/README new file +10 -0
+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.

So I suppose this is expected:

$ make -j1 run-tcg-tests-i386-linux-user
  BUILD   fedora-i386-cross
  [...]
  TEST    test-i386 on i386
ASAN:DEADLYSIGNAL
=================================================================
==8721==ERROR: AddressSanitizer: SEGV on unknown address 0x7fe768f01234
(pc 0x5560b3382e2d bp 0x000000001234 sp 0x7ffcb44a7ef0 T0)
==8721==The signal is caused by a WRITE memory access.
    #0 0x5560b3382e2c in static_code_gen_buffer
(/source/qemu/build/full/i386-linux-user/qemu-i386+0xf64e2c)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/source/qemu/build/full/i386-linux-user/qemu-i386+0xf64e2c) in static_code_gen_buffer
==8721==ABORTING
make[2]: *** [/source/qemu/tests/tcg/Makefile:64: run-test-i386] Error 1
TEST hello-i386 on i386
SLOW TEST test-i386-fprem SKIPPED on i386

tests/tcg/i386/README line 29

Quoted 13 lines
tests/tcg/i386/README new file +13 -0
+
+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
+------

Also expected:

$ make -j1 run-tcg-tests-i386-linux-user -k
  BUILD   fedora-i386-cross
  [...]
  TEST    runcom on i386
ASAN:DEADLYSIGNAL
=================================================================
==8730==ERROR: AddressSanitizer: SEGV on unknown address 0x7f7d0a8108fe
(pc 0x562c94475f23 bp 0x0000000108fe sp 0x7ffd036dd590 T0)
==8730==The signal is caused by a WRITE memory access.
    #0 0x562c94475f22 in static_code_gen_buffer
(/source/qemu/build/full/i386-linux-user/qemu-i386+0xe5ff22)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/source/qemu/build/full/i386-linux-user/qemu-i386+0xe5ff22) in static_code_gen_buffer
==8730==ABORTING
make[2]: *** [/source/qemu/tests/tcg/i386/Makefile.target:38:
run-runcom] Error 1
make[2]: Target 'run' not remade because of errors. make[1]: *** [/source/qemu/tests/tcg/Makefile.include:69:
run-guest-tests] Error 2

tests/tcg/i386/README line 32

Quoted 3 lines
tests/tcg/i386/README new file +3 -0
+
+test-mmap
+---------

Any idea how to remove this "ignoring old recipe" warning?

$ make -j1 run-tcg-tests-i386-linux-user -k
  BUILD   fedora-i386-cross
  CROSS-BUILD i386 guest-tests with docker qemu:fedora-i386-cross
/source/qemu/tests/tcg/i386/Makefile.target:50: warning: overriding
recipe for target 'run-test-mmap'
/source/qemu/tests/tcg/multiarch/Makefile.target:26: warning: ignoring
old recipe for target 'run-test-mmap'
  BUILD   fedora-i386-cross
  CROSS-BUILD i386 guest-tests with docker qemu:fedora-i386-cross
/source/qemu/tests/tcg/i386/Makefile.target:50: warning: overriding
recipe for target 'run-test-mmap'
/source/qemu/tests/tcg/multiarch/Makefile.target:26: warning: ignoring
old recipe for target 'run-test-mmap'
  RUN-TESTS for i386
/source/qemu/tests/tcg/i386/Makefile.target:50: warning: overriding
recipe for target 'run-test-mmap'
/source/qemu/tests/tcg/multiarch/Makefile.target:26: warning: ignoring
old recipe for target 'run-test-mmap'
  TEST    test-mmap (default) on i386
Quoted 51 lines
tests/tcg/i386/README new file +6 -0
+
+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
#34 lore raw

Re: [Qemu-devel] [PATCH v3 16/46] tests/tcg: move i386 specific tests into subdir

Quoted 166 lines · Philippe Mathieu-Daudé
Quoted 140 lines · 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

---
 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
 14 files changed, 68 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%)
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 +6 -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

tests/tcg/i386/README line 16

Quoted 10 lines
tests/tcg/i386/README new file +10 -0
+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.

So I suppose this is expected:

$ make -j1 run-tcg-tests-i386-linux-user
  BUILD   fedora-i386-cross
  [...]
  TEST    test-i386 on i386
ASAN:DEADLYSIGNAL
=================================================================
==8721==ERROR: AddressSanitizer: SEGV on unknown address 0x7fe768f01234
(pc 0x5560b3382e2d bp 0x000000001234 sp 0x7ffcb44a7ef0 T0)
==8721==The signal is caused by a WRITE memory access.
    #0 0x5560b3382e2c in static_code_gen_buffer
(/source/qemu/build/full/i386-linux-user/qemu-i386+0xf64e2c)
Quoted 7 lines

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/source/qemu/build/full/i386-linux-user/qemu-i386+0xf64e2c) in static_code_gen_buffer
==8721==ABORTING
make[2]: *** [/source/qemu/tests/tcg/Makefile:64: run-test-i386] Error 1

Not sure - shouldn't ASAN be able to deal with caught exceptions?

Quoted 42 lines

TEST hello-i386 on i386
SLOW TEST test-i386-fprem SKIPPED on i386

tests/tcg/i386/README line 29

Quoted 13 lines
tests/tcg/i386/README new file +13 -0
+
+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
+------

Also expected:

$ make -j1 run-tcg-tests-i386-linux-user -k
  BUILD   fedora-i386-cross
  [...]
  TEST    runcom on i386
ASAN:DEADLYSIGNAL
=================================================================
==8730==ERROR: AddressSanitizer: SEGV on unknown address 0x7f7d0a8108fe
(pc 0x562c94475f23 bp 0x0000000108fe sp 0x7ffd036dd590 T0)
==8730==The signal is caused by a WRITE memory access.
    #0 0x562c94475f22 in static_code_gen_buffer
(/source/qemu/build/full/i386-linux-user/qemu-i386+0xe5ff22)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/source/qemu/build/full/i386-linux-user/qemu-i386+0xe5ff22) in static_code_gen_buffer
==8730==ABORTING
make[2]: *** [/source/qemu/tests/tcg/i386/Makefile.target:38:
run-runcom] Error 1
make[2]: Target 'run' not remade because of errors. make[1]: *** [/source/qemu/tests/tcg/Makefile.include:69:
run-guest-tests] Error 2

Quoted 5 lines

tests/tcg/i386/README line 32

Quoted 3 lines
tests/tcg/i386/README new file +3 -0
+
+test-mmap
+---------

Any idea how to remove this "ignoring old recipe" warning?

Fix the various qemu's to not crash or expose a variable to modify a single run-test-mmap for each architecture.

Quoted 64 lines
$ make -j1 run-tcg-tests-i386-linux-user -k
  BUILD   fedora-i386-cross
  CROSS-BUILD i386 guest-tests with docker qemu:fedora-i386-cross
/source/qemu/tests/tcg/i386/Makefile.target:50: warning: overriding
recipe for target 'run-test-mmap'
/source/qemu/tests/tcg/multiarch/Makefile.target:26: warning: ignoring
old recipe for target 'run-test-mmap'
  BUILD   fedora-i386-cross
  CROSS-BUILD i386 guest-tests with docker qemu:fedora-i386-cross
/source/qemu/tests/tcg/i386/Makefile.target:50: warning: overriding
recipe for target 'run-test-mmap'
/source/qemu/tests/tcg/multiarch/Makefile.target:26: warning: ignoring
old recipe for target 'run-test-mmap'
  RUN-TESTS for i386
/source/qemu/tests/tcg/i386/Makefile.target:50: warning: overriding
recipe for target 'run-test-mmap'
/source/qemu/tests/tcg/multiarch/Makefile.target:26: warning: ignoring
old recipe for target 'run-test-mmap'
  TEST    test-mmap (default) on i386
Quoted 43 lines
tests/tcg/i386/README new file +6 -0
+
+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
Quoted 8 lines

tests/tcg/i386/test-i386.h

Quoted 8 lines

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

--
Alex Bennée

#35 lore raw

Re: [Qemu-devel] [PATCH v3 16/46] tests/tcg: move i386 specific tests into subdir

Quoted 175 lines · Alex Bennée
Quoted 166 lines · Philippe Mathieu-Daudé
Quoted 140 lines · 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

---
 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
 14 files changed, 68 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%)
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 +6 -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

tests/tcg/i386/README line 16

Quoted 10 lines
tests/tcg/i386/README new file +10 -0
+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.

So I suppose this is expected:

$ make -j1 run-tcg-tests-i386-linux-user
  BUILD   fedora-i386-cross
  [...]
  TEST    test-i386 on i386
ASAN:DEADLYSIGNAL
=================================================================
==8721==ERROR: AddressSanitizer: SEGV on unknown address 0x7fe768f01234
(pc 0x5560b3382e2d bp 0x000000001234 sp 0x7ffcb44a7ef0 T0)
==8721==The signal is caused by a WRITE memory access.
    #0 0x5560b3382e2c in static_code_gen_buffer
(/source/qemu/build/full/i386-linux-user/qemu-i386+0xf64e2c)
Quoted 7 lines

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/source/qemu/build/full/i386-linux-user/qemu-i386+0xf64e2c) in static_code_gen_buffer
==8721==ABORTING
make[2]: *** [/source/qemu/tests/tcg/Makefile:64: run-test-i386] Error 1

Quoted 1 line

Not sure - shouldn't ASAN be able to deal with caught exceptions?

Oh I'm not asking you to fix this ASan problem :)
At least not in this series :P

Quoted 43 lines
Quoted 43 lines

TEST hello-i386 on i386
SLOW TEST test-i386-fprem SKIPPED on i386

tests/tcg/i386/README line 29

Quoted 13 lines
tests/tcg/i386/README new file +13 -0
+
+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
+------

Also expected:

$ make -j1 run-tcg-tests-i386-linux-user -k
  BUILD   fedora-i386-cross
  [...]
  TEST    runcom on i386
ASAN:DEADLYSIGNAL
=================================================================
==8730==ERROR: AddressSanitizer: SEGV on unknown address 0x7f7d0a8108fe
(pc 0x562c94475f23 bp 0x0000000108fe sp 0x7ffd036dd590 T0)
==8730==The signal is caused by a WRITE memory access.
    #0 0x562c94475f22 in static_code_gen_buffer
(/source/qemu/build/full/i386-linux-user/qemu-i386+0xe5ff22)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/source/qemu/build/full/i386-linux-user/qemu-i386+0xe5ff22) in static_code_gen_buffer
==8730==ABORTING
make[2]: *** [/source/qemu/tests/tcg/i386/Makefile.target:38:
run-runcom] Error 1
make[2]: Target 'run' not remade because of errors. make[1]: *** [/source/qemu/tests/tcg/Makefile.include:69:
run-guest-tests] Error 2

Quoted 8 lines
Quoted 5 lines

tests/tcg/i386/README line 32

Quoted 3 lines
tests/tcg/i386/README new file +3 -0
+
+test-mmap
+---------

Any idea how to remove this "ignoring old recipe" warning?

Fix the various qemu's to not crash or expose a variable to modify a single run-test-mmap for each architecture.

OK, this is annoying but only a warning.

Quoted 73 lines
Quoted 73 lines

$ make -j1 run-tcg-tests-i386-linux-user -k
  BUILD   fedora-i386-cross
  CROSS-BUILD i386 guest-tests with docker qemu:fedora-i386-cross
/source/qemu/tests/tcg/i386/Makefile.target:50: warning: overriding
recipe for target 'run-test-mmap'
/source/qemu/tests/tcg/multiarch/Makefile.target:26: warning: ignoring
old recipe for target 'run-test-mmap'
  BUILD   fedora-i386-cross
  CROSS-BUILD i386 guest-tests with docker qemu:fedora-i386-cross
/source/qemu/tests/tcg/i386/Makefile.target:50: warning: overriding
recipe for target 'run-test-mmap'
/source/qemu/tests/tcg/multiarch/Makefile.target:26: warning: ignoring
old recipe for target 'run-test-mmap'
  RUN-TESTS for i386
/source/qemu/tests/tcg/i386/Makefile.target:50: warning: overriding
recipe for target 'run-test-mmap'
/source/qemu/tests/tcg/multiarch/Makefile.target:26: warning: ignoring
old recipe for target 'run-test-mmap'
  TEST    test-mmap (default) on i386
Quoted 51 lines
tests/tcg/i386/README new file +6 -0
+
+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
#36 lore raw

PATCH v3 17/46 docker: Add fedora-i386-cross image

In reply to Alex Bennée

From: Fam Zheng <[email protected]>

It has some basic *-devel.i686 packages to be used with "gcc -m32" as a 32 bit cross build environment.

[AJB: add glibc-static]

---
v2
- include static glibc package as well

---
 tests/docker/dockerfiles/fedora-i386-cross.docker | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 tests/docker/dockerfiles/fedora-i386-cross.docker
tests/docker/dockerfiles/fedora-i386-cross.docker new file +14 -0
new file mode 100644
index 0000000000..8fbef2fa53
@@ -0,0 +1,14 @@
+FROM fedora:latest
+ENV PACKAGES \
+    gcc \
+    glibc-static.i686 \
+    glibc-devel.i686 \
+    glib2-devel.i686 \
+    zlib-devel.i686 \
+    glib2-devel.i686 \
+    nettle-devel.i686 \
+    pixman-devel.i686 \
+    gnutls-devel.i686
+
+RUN dnf install -y $PACKAGES
+RUN rpm -q $PACKAGES | sort > /packages.txt
Signature · 1 line
2.17.0
Tested-by on v3 17/46
#37 lore raw

Re: [Qemu-devel] [PATCH v3 17/46] docker: Add fedora-i386-cross image

Quoted 8 lines · Alex Bennée

From: Fam Zheng <[email protected]>

It has some basic *-devel.i686 packages to be used with "gcc -m32" as a 32 bit cross build environment.

[AJB: add glibc-static]
Quoted 30 lines

---
v2
- include static glibc package as well

---
 tests/docker/dockerfiles/fedora-i386-cross.docker | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 tests/docker/dockerfiles/fedora-i386-cross.docker
tests/docker/dockerfiles/fedora-i386-cross.docker new file +14 -0
new file mode 100644
index 0000000000..8fbef2fa53
@@ -0,0 +1,14 @@
+FROM fedora:latest
+ENV PACKAGES \
+    gcc \
+    glibc-static.i686 \
+    glibc-devel.i686 \
+    glib2-devel.i686 \
+    zlib-devel.i686 \
+    glib2-devel.i686 \
+    nettle-devel.i686 \
+    pixman-devel.i686 \
+    gnutls-devel.i686
+
+RUN dnf install -y $PACKAGES
+RUN rpm -q $PACKAGES | sort > /packages.txt
#38 lore raw

PATCH v3 18/46 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

---
 tests/tcg/i386/Makefile.include | 9 +++++++++
 tests/tcg/i386/Makefile.target  | 9 +++++++++
 2 files changed, 18 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 +9 -0
index 2f27b65e2d..39a1627650 100644
@@ -28,3 +28,12 @@ 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
+.PHONY: pi_10.com
+pi_10.com:
+	cp $(I386_SRC)/pi_10.com .
+
+run-runcom: runcom pi_10.com
+	$(call quiet-command, $(QEMU) ./runcom ./pi_10.com > runcom.out, "TEST", "$< on $(TARGET_NAME)")
+
Signature · 1 line
2.17.0
Reviewed-by Tested-by on v3 18/46
#39 lore raw

Re: [Qemu-devel] [PATCH v3 18/46] tests/tcg: enable building for i386

Quoted 38 lines · 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

---
 tests/tcg/i386/Makefile.include | 9 +++++++++
 tests/tcg/i386/Makefile.target  | 9 +++++++++
 2 files changed, 18 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 +0 -0
index 2f27b65e2d..39a1627650 100644
@@ -28,3 +28,12 @@ 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 $@ \

tests/tcg/i386/Makefile.target hello-i386: LDFLAGS+=-nostdlib · line 39

Quoted 10 lines
tests/tcg/i386/Makefile.target +9 -0
 	   $(<D)/test-i386.c $(<D)/test-i386-code16.S $(<D)/test-i386-vm86.S -lm
+
+# Specialist test runners
+.PHONY: pi_10.com
+pi_10.com:
+	cp $(I386_SRC)/pi_10.com .
+
+run-runcom: runcom pi_10.com
+	$(call quiet-command, $(QEMU) ./runcom ./pi_10.com > runcom.out, "TEST", "$< on $(TARGET_NAME)")
+

"make run-tcg-tests-i386-linux-user" without ASan:

#40 lore raw

PATCH v3 19/46 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.0
Reviewed-by on v3 19/46
#41 lore raw

Re: [Qemu-devel] [PATCH v3 19/46] tests/tcg/i386: Build fix for hello-i386

Quoted 10 lines · 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(+)

r~

#42 lore raw

PATCH v3 20/46 tests/tcg/i386: fix test-i386

In reply to Alex Bennée

The test-i386 test case is a little special as it includes assembler files. Add the additional compile magic to assemble these bits and link them to the final binary.

---
 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.0
#43 lore raw

PATCH v3 21/46 tests/tcg/i386: fix test-i386-fprem

In reply to Alex Bennée

Remove dependencies on QEMU's source tree and build directly.

---
 tests/tcg/i386/test-i386-fprem.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
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.0
Reviewed-by on v3 21/46
#45 lore raw

Re: [Qemu-devel] [PATCH v3 21/46] tests/tcg/i386: fix test-i386-fprem

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

Remove dependencies on QEMU's source tree and build directly.

---
 tests/tcg/i386/test-i386-fprem.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
tests/tcg/i386/test-i386-fprem.c +7 -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);

tests/tcg/i386/test-i386-fprem.c static void test_fprem_cases(void) · line 245

Quoted 4 lines
tests/tcg/i386/test-i386-fprem.c +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);

How's that change related to the patch description? ... i.e. maybe you should mention these changes in the patch description, too?

Apart from that:

#46 lore raw

Re: [Qemu-devel] [PATCH v3 21/46] tests/tcg/i386: fix test-i386-fprem

Quoted 54 lines · Thomas Huth
Quoted 53 lines · Alex Bennée

Remove dependencies on QEMU's source tree and build directly.

---
 tests/tcg/i386/test-i386-fprem.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
tests/tcg/i386/test-i386-fprem.c +7 -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);
 
Quoted 4 lines

tests/tcg/i386/test-i386-fprem.c static void test_fprem_cases(void) · line 245

Quoted 1 line
tests/tcg/i386/test-i386-fprem.c +1 -0
+    do_fprem(smallest_positive_norm.d, smallest_positive_norm.d);

How's that change related to the patch description? ... i.e. maybe you should mention these changes in the patch description, too?

Yeah I'll fix that up - they got added to stop the compiler bithing about un-used things.

Quoted 4 lines

Apart from that:

--
Alex Bennée

Reviewed-by Tested-by on v3 21/46
#47 lore raw

Re: [Qemu-devel] [PATCH v3 21/46] tests/tcg/i386: fix test-i386-fprem

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

Remove dependencies on QEMU's source tree and build directly.

---
 tests/tcg/i386/test-i386-fprem.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
tests/tcg/i386/test-i386-fprem.c +7 -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);

tests/tcg/i386/test-i386-fprem.c static void test_fprem_cases(void) · line 249

Quoted 8 lines
tests/tcg/i386/test-i386-fprem.c +2 -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? */
 }

This test is disabled in tests/tcg/i386/Makefile.target and it would be nice to be able to run it without having to modify the Makefile, like running "make SLOW=1" or "SPEED=slow" like for iotests maybe?

This test is too verbose and I wonder if we should redirect stdout to /dev/null even for V=1.

Enabled via tcg/i386/Makefile.target:

#48 lore raw

Re: [Qemu-devel] [PATCH v3 21/46] tests/tcg/i386: fix test-i386-fprem

Quoted 54 lines · Philippe Mathieu-Daudé
Quoted 53 lines · Alex Bennée

Remove dependencies on QEMU's source tree and build directly.

---
 tests/tcg/i386/test-i386-fprem.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
tests/tcg/i386/test-i386-fprem.c +7 -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);
 
Quoted 10 lines

tests/tcg/i386/test-i386-fprem.c static void test_fprem_cases(void) · line 249

Quoted 6 lines
tests/tcg/i386/test-i386-fprem.c +2 -0
+    do_fprem(smallest_positive_norm.d, smallest_positive_norm.d);
+
     /* printf("= underflow =\n"); */
     /* TODO: Is there a case where FPREM raises underflow? */
 }

This test is disabled in tests/tcg/i386/Makefile.target and it would be nice to be able to run it without having to modify the Makefile, like running "make SLOW=1" or "SPEED=slow" like for iotests maybe?

Sounds like a good idea.

Quoted 3 lines

This test is too verbose and I wonder if we should redirect stdout to /dev/null even for V=1.

I think the original intention was to compare against a reference. Needless to say I think at the moment it's broken.

Quoted 4 lines

Enabled via tcg/i386/Makefile.target:

--
Alex Bennée

#49 lore raw

PATCH v3 22/46 tests/tcg/i386: disable i386 version of test-i386-ssse

In reply to Alex Bennée

It doesn't build for i386 easily and we probably need a better more methodical test for SSE et all in QEMU.

---
 tests/tcg/i386/Makefile.target | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/tcg/i386/Makefile.target +1 -1
index 39a1627650..80ccad3d7b 100644
@@ -9,7 +9,7 @@ I386_SRCS=$(notdir $(wildcard $(I386_SRC)/*.c))
 I386_TESTS=$(I386_SRCS:.c=)
 
 # Update TESTS
-TESTS+=$(I386_TESTS)
+TESTS+=$(I386_ONLY_TESTS)
 
 ifneq ($(TARGET_NAME),x86_64)
 CFLAGS+=-m32
Signature · 1 line
2.17.0
#50 lore raw

Re: [Qemu-devel] [PATCH v3 22/46] tests/tcg/i386: disable i386 version of test-i386-ssse

tests/tcg/i386/Makefile.target I386_SRCS=$(notdir $(wildcard $(I386_SRC)/*.c)) · line 12

Quoted 3 lines · Alex Bennée

# Update TESTS

tests/tcg/i386/Makefile.target +1 -1
-TESTS+=$(I386_TESTS)
+TESTS+=$(I386_ONLY_TESTS)

Doesn't this depend on a variable you introduce in the next patch?

r~

#51 lore raw

Re: [Qemu-devel] [PATCH v3 22/46] tests/tcg/i386: disable i386 version of test-i386-ssse

Quoted 6 lines · Richard Henderson

tests/tcg/i386/Makefile.target I386_SRCS=$(notdir $(wildcard $(I386_SRC)/*.c)) · line 12

Quoted 3 lines · Alex Bennée

# Update TESTS

tests/tcg/i386/Makefile.target +1 -1
-TESTS+=$(I386_TESTS)
+TESTS+=$(I386_ONLY_TESTS)

Doesn't this depend on a variable you introduce in the next patch?

<snip>

Hmm, it should probably be merged.

--
Alex Bennée

#52 lore raw

PATCH v3 23/46 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.

---
 tests/tcg/i386/Makefile.target   |  2 +-
 tests/tcg/x86_64/Makefile.target | 15 +++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)
 create mode 100644 tests/tcg/x86_64/Makefile.target
tests/tcg/i386/Makefile.target +1 -1
index 80ccad3d7b..27086c3f2b 100644
@@ -7,7 +7,7 @@ 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_ONLY_TESTS)
 
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.0
Reviewed-by Tested-by on v3 23/46
#53 lore raw

Re: [Qemu-devel] [PATCH v3 23/46] tests/tcg/x86_64: add Makefile.target

Quoted 30 lines · 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.

---
 tests/tcg/i386/Makefile.target   |  2 +-
 tests/tcg/x86_64/Makefile.target | 15 +++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)
 create mode 100644 tests/tcg/x86_64/Makefile.target
tests/tcg/i386/Makefile.target +1 -1
index 80ccad3d7b..27086c3f2b 100644
@@ -7,7 +7,7 @@ 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_ONLY_TESTS)
 
tests/tcg/x86_64/Makefile.target new file +0 -0
new file mode 100644
index 0000000000..74f170b9ed

tests/tcg/x86_64/Makefile.target line 10

Quoted 10 lines
tests/tcg/x86_64/Makefile.target new file +10 -0
@@ -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

The linux-test is taking looooong... I canceled it after ~15min on a i7 2GHz. Maybe it also belongs to the "BROKEN TEST" series on x86_64? Currently it is only skipped if $(TARGET_NAME) == i386.

tests/tcg/x86_64/Makefile.target line 15

Quoted 6 lines
tests/tcg/x86_64/Makefile.target new file +5 -0
+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)
$ make run-tcg-tests-x86_64-linux-user
  RUN-TESTS for x86_64
  TEST    test-mmap (default) on x86_64
  TEST    test-mmap (8k pages) on x86_64
ASAN:DEADLYSIGNAL
=================================================================
==5717==ERROR: AddressSanitizer: SEGV on unknown address 0x7fcba47fc000
(pc 0x7fcba8a3bf4d bp 0x7ffd19d74700 sp 0x7ffd19d73e88 T0)
==5717==The signal is caused by a WRITE memory access.
    #0 0x7fcba8a3bf4c  (/lib/x86_64-linux-gnu/libc.so.6+0x159f4c)
    #1 0x7fcbab33f891  (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x5c891)
    #2 0x55dd3ae4a7e0 in mmap_frag /source/qemu/linux-user/mmap.c:189
    #3 0x55dd3ae4bbce in target_mmap /source/qemu/linux-user/mmap.c:533
    #4 0x55dd3ae4b8cb in target_mmap /source/qemu/linux-user/mmap.c:501
    #5 0x55dd3ae3895c in do_syscall /source/qemu/linux-user/syscall.c:9448
    #6 0x55dd3adfaa57 in cpu_loop /source/qemu/linux-user/main.c:258
    #7 0x55dd3ae005f5 in main /source/qemu/linux-user/main.c:5147
    #8 0x7fcba8903a86 in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x21a86)
    #9 0x55dd3ad34a89 in _start
(/source/qemu/build/full/x86_64-linux-user/qemu-x86_64+0x350a89)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/lib/x86_64-linux-gnu/libc.so.6+0x159f4c)
==5717==ABORTING
make[2]: ***
[/home/phil/source/qemu/tests/tcg/multiarch/Makefile.target:27:
run-test-mmap] Error 1
#54 lore raw

Re: [Qemu-devel] [PATCH v3 23/46] tests/tcg/x86_64: add Makefile.target

Quoted 37 lines · Philippe Mathieu-Daudé
Quoted 36 lines · 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.

---
 tests/tcg/i386/Makefile.target   |  2 +-
 tests/tcg/x86_64/Makefile.target | 15 +++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)
 create mode 100644 tests/tcg/x86_64/Makefile.target
tests/tcg/i386/Makefile.target +1 -1
index 80ccad3d7b..27086c3f2b 100644
@@ -7,7 +7,7 @@ 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_ONLY_TESTS)
 
tests/tcg/x86_64/Makefile.target new file +6 -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/
Quoted 8 lines

tests/tcg/x86_64/Makefile.target line 10

Quoted 4 lines
tests/tcg/x86_64/Makefile.target new file +4 -0
+#
+
+X86_64_TESTS=$(filter-out $(I386_ONLY_TESTS), $(TESTS))
+X86_64_TESTS+=test-x86_64

The linux-test is taking looooong... I canceled it after ~15min on a i7 2GHz. Maybe it also belongs to the "BROKEN TEST" series on x86_64? Currently it is only skipped if $(TARGET_NAME) == i386.

Hmm it runs pretty quickly for me:

time ./qemu-x86_64 ./tests/linux-test
0.02user 0.03system 0:00.08elapsed 72%CPU (0avgtext+0avgdata 7384maxresident)k 0inputs+0outputs (0major+1207minor)pagefaults 0swaps

I wonder if the failure mode you are seeing is the same as the others which basically hang, which is why I added them to the broken test patch.

Quoted 38 lines

tests/tcg/x86_64/Makefile.target line 15

Quoted 6 lines
tests/tcg/x86_64/Makefile.target new file +5 -0
+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)
$ make run-tcg-tests-x86_64-linux-user
  RUN-TESTS for x86_64
  TEST    test-mmap (default) on x86_64
  TEST    test-mmap (8k pages) on x86_64
ASAN:DEADLYSIGNAL
=================================================================
==5717==ERROR: AddressSanitizer: SEGV on unknown address 0x7fcba47fc000
(pc 0x7fcba8a3bf4d bp 0x7ffd19d74700 sp 0x7ffd19d73e88 T0)
==5717==The signal is caused by a WRITE memory access.
    #0 0x7fcba8a3bf4c  (/lib/x86_64-linux-gnu/libc.so.6+0x159f4c)
    #1 0x7fcbab33f891  (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x5c891)
    #2 0x55dd3ae4a7e0 in mmap_frag /source/qemu/linux-user/mmap.c:189
    #3 0x55dd3ae4bbce in target_mmap /source/qemu/linux-user/mmap.c:533
    #4 0x55dd3ae4b8cb in target_mmap /source/qemu/linux-user/mmap.c:501
    #5 0x55dd3ae3895c in do_syscall /source/qemu/linux-user/syscall.c:9448
    #6 0x55dd3adfaa57 in cpu_loop /source/qemu/linux-user/main.c:258
    #7 0x55dd3ae005f5 in main /source/qemu/linux-user/main.c:5147
    #8 0x7fcba8903a86 in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x21a86)
    #9 0x55dd3ad34a89 in _start
(/source/qemu/build/full/x86_64-linux-user/qemu-x86_64+0x350a89)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/lib/x86_64-linux-gnu/libc.so.6+0x159f4c)
==5717==ABORTING
make[2]: ***
[/home/phil/source/qemu/tests/tcg/multiarch/Makefile.target:27:
run-test-mmap] Error 1
Quoted 1 line

This is only with ASAN enabled right?

--
Alex Bennée

#55 lore raw

Re: [Qemu-devel] [PATCH v3 23/46] tests/tcg/x86_64: add Makefile.target

Quoted 49 lines · Alex Bennée
Quoted 37 lines · Philippe Mathieu-Daudé
Quoted 36 lines · 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.

---
 tests/tcg/i386/Makefile.target   |  2 +-
 tests/tcg/x86_64/Makefile.target | 15 +++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)
 create mode 100644 tests/tcg/x86_64/Makefile.target
tests/tcg/i386/Makefile.target +1 -1
index 80ccad3d7b..27086c3f2b 100644
@@ -7,7 +7,7 @@ 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_ONLY_TESTS)
 
tests/tcg/x86_64/Makefile.target new file +6 -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/
Quoted 8 lines

tests/tcg/x86_64/Makefile.target line 10

Quoted 4 lines
tests/tcg/x86_64/Makefile.target new file +4 -0
+#
+
+X86_64_TESTS=$(filter-out $(I386_ONLY_TESTS), $(TESTS))
+X86_64_TESTS+=test-x86_64

The linux-test is taking looooong... I canceled it after ~15min on a i7 2GHz. Maybe it also belongs to the "BROKEN TEST" series on x86_64? Currently it is only skipped if $(TARGET_NAME) == i386.

Quoted 8 lines

Hmm it runs pretty quickly for me:

time ./qemu-x86_64 ./tests/linux-test
0.02user 0.03system 0:00.08elapsed 72%CPU (0avgtext+0avgdata 7384maxresident)k 0inputs+0outputs (0major+1207minor)pagefaults 0swaps

I wonder if the failure mode you are seeing is the same as the others which basically hang, which is why I added them to the broken test patch.

The test_clone() hangs here:

    while (waitpid(pid1, &status1, 0) != pid1);

32107 wait4(32109, 0x7ffdd2814a50, 0, NULL) = -1 ECHILD (No child processes) 32107 wait4(32109, <unfinished ...>
32109 nanosleep({tv_sec=0, tv_nsec=10000000}, <unfinished ...> 32107 <... wait4 resumed> 0x7ffdd2814a50, 0, NULL) = -1 ECHILD (No child processes)
32107 wait4(32109, 0x7ffdd2814a50, 0, NULL) = -1 ECHILD (No child processes)

Quoted 39 lines
Quoted 39 lines

tests/tcg/x86_64/Makefile.target line 15

Quoted 6 lines
tests/tcg/x86_64/Makefile.target new file +5 -0
+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)
$ make run-tcg-tests-x86_64-linux-user
  RUN-TESTS for x86_64
  TEST    test-mmap (default) on x86_64
  TEST    test-mmap (8k pages) on x86_64
ASAN:DEADLYSIGNAL
=================================================================
==5717==ERROR: AddressSanitizer: SEGV on unknown address 0x7fcba47fc000
(pc 0x7fcba8a3bf4d bp 0x7ffd19d74700 sp 0x7ffd19d73e88 T0)
==5717==The signal is caused by a WRITE memory access.
    #0 0x7fcba8a3bf4c  (/lib/x86_64-linux-gnu/libc.so.6+0x159f4c)
    #1 0x7fcbab33f891  (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x5c891)
    #2 0x55dd3ae4a7e0 in mmap_frag /source/qemu/linux-user/mmap.c:189
    #3 0x55dd3ae4bbce in target_mmap /source/qemu/linux-user/mmap.c:533
    #4 0x55dd3ae4b8cb in target_mmap /source/qemu/linux-user/mmap.c:501
    #5 0x55dd3ae3895c in do_syscall /source/qemu/linux-user/syscall.c:9448
    #6 0x55dd3adfaa57 in cpu_loop /source/qemu/linux-user/main.c:258
    #7 0x55dd3ae005f5 in main /source/qemu/linux-user/main.c:5147
    #8 0x7fcba8903a86 in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x21a86)
    #9 0x55dd3ad34a89 in _start
(/source/qemu/build/full/x86_64-linux-user/qemu-x86_64+0x350a89)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/lib/x86_64-linux-gnu/libc.so.6+0x159f4c)
==5717==ABORTING
make[2]: ***
[/home/phil/source/qemu/tests/tcg/multiarch/Makefile.target:27:
run-test-mmap] Error 1
Quoted 3 lines
Quoted 1 line

This is only with ASAN enabled right?

Yes, but even without ASan test_clone() hangs.

Commenting test_clone():

$ make -j1 run-tcg-tests-x86_64-linux-user
  CROSS-BUILD x86_64 guest-tests with gcc-7
  CROSS-BUILD x86_64 guest-tests with gcc-7
  RUN-TESTS for x86_64
  TEST    test-mmap (default) on x86_64
  TEST    test-mmap (8k pages) on x86_64
  TEST    test-mmap (16k pages) on x86_64
  TEST    test-mmap (32k pages) on x86_64
  TEST    sha1 on x86_64
  TEST    linux-test on x86_64
  TEST    testthread on x86_64
  TEST    test-x86_64 on x86_64
$
#56 lore raw

PATCH v3 24/46 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.0
Reviewed-by Tested-by on v3 24/46
#57 lore raw

Re: [Qemu-devel] [PATCH v3 24/46] tests/tcg/i386/test-i386: use modern vector_size attributes

Quoted 1 line · Alex Bennée

The compiler complains about the old __mode__ style attributes.

old [school]

Quoted 3 lines
Quoted 20 lines
---
 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];
#58 lore raw

PATCH v3 25/46 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.0
Reviewed-by Tested-by on v3 25/46
#59 lore raw

Re: [Qemu-devel] [PATCH v3 25/46] tests/tcg/i386/test-i386: fix printf format

Quoted 1 line · Alex Bennée
Quoted 18 lines
---
 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));\
 }
#60 lore raw

PATCH v3 26/46 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

---
 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
 5 files changed, 24 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%)
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.0
#61 lore raw

PATCH v3 27/46 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.

---
 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 bc6962ecc6..be9d3fb4a1 100644
@@ -8,6 +8,11 @@ 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
+test-arm-iwmmxt: test-arm-iwmmxt.S
+	$(CC) $(CFLAGS) $< -o $@ $(LDFLAGS)
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.0
Reviewed-by Tested-by on v3 27/46
#62 lore raw

Re: [Qemu-devel] [PATCH v3 27/46] tests/tcg/arm: fix up test-arm-iwmmxt test

Quoted 5 lines · 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.

Quoted 27 lines
---
 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 bc6962ecc6..be9d3fb4a1 100644
@@ -8,6 +8,11 @@ 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
+test-arm-iwmmxt: test-arm-iwmmxt.S
+	$(CC) $(CFLAGS) $< -o $@ $(LDFLAGS)
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
#63 lore raw

PATCH v3 28/46 tests/tcg/aarch64: add Makefile.target

In reply to Alex Bennée

Nothing much here yet.

---
 tests/tcg/aarch64/Makefile.target | 5 +++++
 1 file changed, 5 insertions(+)
 create mode 100644 tests/tcg/aarch64/Makefile.target
tests/tcg/aarch64/Makefile.target new file +5 -0
new file mode 100644
index 0000000000..4ac8fbe73f
@@ -0,0 +1,5 @@
+# -*- Mode: makefile -*-
+#
+# AArch64 specific tweaks
+
+fcvt: LDFLAGS+=-lm
Signature · 1 line
2.17.0
#64 lore raw

Re: [Qemu-devel] [PATCH v3 28/46] tests/tcg/aarch64: add Makefile.target

Quoted 15 lines · Alex Bennée

Nothing much here yet.

---
 tests/tcg/aarch64/Makefile.target | 5 +++++
 1 file changed, 5 insertions(+)
 create mode 100644 tests/tcg/aarch64/Makefile.target
tests/tcg/aarch64/Makefile.target new file +0 -0
new file mode 100644
index 0000000000..4ac8fbe73f

tests/tcg/aarch64/Makefile.target line 5

Quoted 5 lines
tests/tcg/aarch64/Makefile.target new file +5 -0
@@ -0,0 +1,5 @@
+# -*- Mode: makefile -*-
+#
+# AArch64 specific tweaks
+
+fcvt: LDFLAGS+=-lm

You missed tests/tcg/aarch64/Makefile.include with:

DOCKER_IMAGE=debian-arm64-cross
DOCKER_CROSS_COMPILER=aarch64-linux-gnueabi-gcc

#65 lore raw

Re: [Qemu-devel] [PATCH v3 28/46] tests/tcg/aarch64: add Makefile.target

Quoted 24 lines · Philippe Mathieu-Daudé
Quoted 15 lines · Alex Bennée

Nothing much here yet.

---
 tests/tcg/aarch64/Makefile.target | 5 +++++
 1 file changed, 5 insertions(+)
 create mode 100644 tests/tcg/aarch64/Makefile.target
tests/tcg/aarch64/Makefile.target new file +0 -0
new file mode 100644
index 0000000000..4ac8fbe73f

tests/tcg/aarch64/Makefile.target line 5

Quoted 5 lines
tests/tcg/aarch64/Makefile.target new file +5 -0
@@ -0,0 +1,5 @@
+# -*- Mode: makefile -*-
+#
+# AArch64 specific tweaks
+
+fcvt: LDFLAGS+=-lm

You missed tests/tcg/aarch64/Makefile.include with:

Quoted 2 lines

DOCKER_IMAGE=debian-arm64-cross
DOCKER_CROSS_COMPILER=aarch64-linux-gnueabi-gcc

Doh.. of course I was testing with my cross-compiler and forgot about this ;-)

--
Alex Bennée

#66 lore raw

Re: [Qemu-devel] [PATCH v3 28/46] tests/tcg/aarch64: add Makefile.target

Quoted 25 lines · Alex Bennée
Quoted 24 lines · Philippe Mathieu-Daudé
Quoted 15 lines · Alex Bennée

Nothing much here yet.

---
 tests/tcg/aarch64/Makefile.target | 5 +++++
 1 file changed, 5 insertions(+)
 create mode 100644 tests/tcg/aarch64/Makefile.target
tests/tcg/aarch64/Makefile.target new file +0 -0
new file mode 100644
index 0000000000..4ac8fbe73f

tests/tcg/aarch64/Makefile.target line 5

Quoted 5 lines
tests/tcg/aarch64/Makefile.target new file +5 -0
@@ -0,0 +1,5 @@
+# -*- Mode: makefile -*-
+#
+# AArch64 specific tweaks
+
+fcvt: LDFLAGS+=-lm

You missed tests/tcg/aarch64/Makefile.include with:

Quoted 2 lines
Quoted 2 lines

DOCKER_IMAGE=debian-arm64-cross
DOCKER_CROSS_COMPILER=aarch64-linux-gnueabi-gcc

Err this is not gnueabi, the correct line is:

DOCKER_CROSS_COMPILER=aarch64-linux-gnu-gcc

Quoted 3 lines

Doh.. of course I was testing with my cross-compiler and forgot about this ;-)

#67 lore raw

PATCH v3 29/46 tests/tcg/aarch64: add fcvt test cases for AArch64

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.

---
 tests/tcg/aarch64/Makefile.target |    8 +
 tests/tcg/aarch64/fcvt.c          |  260 ++++++
 tests/tcg/aarch64/fcvt.out        | 1305 +++++++++++++++++++++++++++++
 tests/tcg/arm/Makefile.target     |    4 +-
 4 files changed, 1576 insertions(+), 1 deletion(-)
 create mode 100644 tests/tcg/aarch64/fcvt.c
 create mode 100644 tests/tcg/aarch64/fcvt.out
tests/tcg/aarch64/Makefile.target +8 -0
index 4ac8fbe73f..26be1c58ef 100644
@@ -2,4 +2,12 @@
 #
 # 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
tests/tcg/aarch64/fcvt.c new file +260 -0

260 lines not on this page · raw message

tests/tcg/aarch64/fcvt.out new file +1305 -0

1,305 lines not on this page · raw message

tests/tcg/arm/Makefile.target +3 -1
index be9d3fb4a1..f1c7ec46b5 100644
@@ -8,7 +8,9 @@ ARM_SRC=$(SRC_PATH)/tests/tcg/arm
 # Set search path for all sources
 VPATH 		+= $(ARM_SRC)
 
-TESTS += hello-arm test-arm-iwmmxt
+ARM_TESTS=hello-arm test-arm-iwmmxt
+
+TESTS += $(ARM_TESTS)
 
 hello-arm: CFLAGS+=-marm -ffreestanding
 hello-arm: LDFLAGS+=-nostdlib
Signature · 1 line
2.17.0
Tested-by on v3 29/46
#68 lore raw

Re: [Qemu-devel] [PATCH v3 29/46] tests/tcg/aarch64: add fcvt test cases for AArch64

Quoted 4 lines · Alex Bennée

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

tested with "tests/tcg/aarch64/Makefile.include" containing:
DOCKER_IMAGE=debian-arm64-cross DOCKER_CROSS_COMPILER=aarch64-linux-gnu-gcc

Quoted 1,619 lines
---
 tests/tcg/aarch64/Makefile.target |    8 +
 tests/tcg/aarch64/fcvt.c          |  260 ++++++
 tests/tcg/aarch64/fcvt.out        | 1305 +++++++++++++++++++++++++++++
 tests/tcg/arm/Makefile.target     |    4 +-
 4 files changed, 1576 insertions(+), 1 deletion(-)
 create mode 100644 tests/tcg/aarch64/fcvt.c
 create mode 100644 tests/tcg/aarch64/fcvt.out
tests/tcg/aarch64/Makefile.target +8 -0
index 4ac8fbe73f..26be1c58ef 100644
@@ -2,4 +2,12 @@
 #
 # 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
tests/tcg/aarch64/fcvt.c new file +260 -0
new file mode 100644
index 0000000000..e8d322e0bd
@@ -0,0 +1,260 @@
+/*
+ * Test Floating Point Conversion
+ */
+
+#include <stdio.h>
+#include <inttypes.h>
+#include <math.h>
+#include <float.h>
+#include <fenv.h>
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
+static char flag_str[256];
+
+static char *get_flag_state(int flags)
+{
+    if (flags) {
+        snprintf(flag_str, sizeof(flag_str), "%s %s %s %s %s",
+                 flags & FE_OVERFLOW ? "OVERFLOW" : "",
+                 flags & FE_UNDERFLOW ? "UNDERFLOW" : "",
+                 flags & FE_DIVBYZERO ? "DIV0" : "",
+                 flags & FE_INEXACT ? "INEXACT" : "",
+                 flags & FE_INVALID ? "INVALID" : "");
+    } else {
+        snprintf(flag_str, sizeof(flag_str), "OK");
+    }
+
+    return flag_str;
+}
+
+static void print_double_number(int i, double num)
+{
+    uint64_t double_as_hex = *(uint64_t *) &num;
+    int flags = fetestexcept(FE_ALL_EXCEPT);
+    char *fstr = get_flag_state(flags);
+
+    printf("%02d DOUBLE: %02.20e / %#020lx  (%#x => %s)\n",
+           i, num, double_as_hex, flags, fstr);
+}
+
+static void print_single_number(int i, float num)
+{
+    uint32_t single_as_hex = *(uint32_t *) &num;
+    int flags = fetestexcept(FE_ALL_EXCEPT);
+    char *fstr = get_flag_state(flags);
+
+    printf("%02d SINGLE: %02.20e / %#010x  (%#x => %s)\n",
+           i, num, single_as_hex, flags, fstr);
+}
+
+static void print_half_number(int i, uint16_t num)
+{
+    int flags = fetestexcept(FE_ALL_EXCEPT);
+    char *fstr = get_flag_state(flags);
+
+    printf("%02d   HALF: %#04x  (%#x => %s)\n",
+           i, num, flags, fstr);
+}
+
+float single_numbers[] = { -FLT_MAX, -FLT_MIN,
+                           0.0,
+                           FLT_MIN,
+                           1.0, 2.0,
+                           M_E, M_PI,
+                           0x9EA82A22,
+                           0xAB98FBA8,
+                           FLT_MAX };
+
+static void convert_single_to_half(void)
+{
+    int i;
+
+    printf("Converting single-precision to half-precision\n");
+
+    for (i = 0; i < ARRAY_SIZE(single_numbers); ++i) {
+        float input = single_numbers[i];
+        uint16_t output;
+
+        feclearexcept(FE_ALL_EXCEPT);
+
+        print_single_number(i, input);
+        asm("fcvt %h0, %d1" : "=w" (output) : "x" (input));
+        print_half_number(i, output);
+    }
+}
+
+static void convert_single_to_double(void)
+{
+    int i;
+
+    printf("Converting single-precision to double-precision\n");
+
+    for (i = 0; i < ARRAY_SIZE(single_numbers); ++i) {
+        float input = single_numbers[i];
+        uint64_t output;
+
+        feclearexcept(FE_ALL_EXCEPT);
+
+        print_single_number(i, input);
+        asm("fcvt %h0, %d1" : "=w" (output) : "x" (input));
+        print_double_number(i, output);
+    }
+}
+
+double double_numbers[] = { -DBL_MAX,
+                            -2.0, -1.0,
+                            -DBL_MIN,
+                            0.0,
+                            DBL_MIN,
+                            1.0, 2.0,
+                            M_E, M_PI,
+                            0x9EA82A2287680UL,
+                            0xAB98FBA843210UL,
+                            DBL_MAX };
+
+static void convert_double_to_half(void)
+{
+    int i;
+
+    printf("Converting double-precision to half-precision\n");
+
+    for (i = 0; i < ARRAY_SIZE(single_numbers); ++i) {
+        double input = double_numbers[i];
+        uint16_t output;
+
+        feclearexcept(FE_ALL_EXCEPT);
+
+        print_double_number(i, input);
+
+        /* as we don't have _Float16 support */
+        asm("fcvt %h0, %d1" : "=w" (output) : "x" (input));
+        print_half_number(i, output);
+    }
+}
+
+static void convert_double_to_single(void)
+{
+    int i;
+
+    printf("Converting double-precision to single-precision\n");
+
+    for (i = 0; i < ARRAY_SIZE(single_numbers); ++i) {
+        double input = double_numbers[i];
+        uint32_t output;
+
+        feclearexcept(FE_ALL_EXCEPT);
+
+        print_double_number(i, input);
+
+        asm("fcvt %s0, %d1" : "=w" (output) : "x" (input));
+
+        print_single_number(i, output);
+    }
+}
+
+/* no handy defines for these numbers */
+uint16_t half_numbers[] = {
+    0xffff, /* -NaN / AHP -Max */
+    0xfcff, /* -NaN / AHP */
+    0xfc01, /* -NaN / AHP */
+    0xfc00, /* -Inf */
+    0xfbff, /* -Max */
+    0xc000, /* -2 */
+    0xbc00, /* -1 */
+    0x8001, /* -MIN subnormal */
+    0x8000, /* -0 */
+    0x0000, /* +0 */
+    0x0001, /* MIN subnormal */
+    0x3c00, /* 1 */
+    0x7bff, /* Max */
+    0x7c00, /* Inf */
+    0x7c01, /* NaN / AHP */
+    0x7cff, /* NaN / AHP */
+    0x7fff, /* NaN / AHP +Max*/
+};
+
+static void convert_half_to_double(void)
+{
+    int i;
+
+    printf("Converting half-precision to double-precision\n");
+
+    for (i = 0; i < ARRAY_SIZE(half_numbers); ++i) {
+        uint16_t input = half_numbers[i];
+        double output;
+
+        feclearexcept(FE_ALL_EXCEPT);
+
+        print_half_number(i, input);
+        asm("fcvt %d0, %h1" : "=w" (output) : "x" (input));
+        print_double_number(i, output);
+    }
+}
+
+static void convert_half_to_single(void)
+{
+    int i;
+
+    printf("Converting half-precision to single-precision\n");
+
+    for (i = 0; i < ARRAY_SIZE(half_numbers); ++i) {
+        uint16_t input = half_numbers[i];
+        float output;
+
+        feclearexcept(FE_ALL_EXCEPT);
+
+        print_half_number(i, input);
+        asm("fcvt %s0, %h1" : "=w" (output) : "x" (input));
+        print_single_number(i, output);
+    }
+}
+
+typedef struct {
+    int flag;
+    char *desc;
+} float_mapping;
+
+float_mapping round_flags[] = {
+    { FE_TONEAREST, "to nearest" },
+    { FE_UPWARD, "upwards" },
+    { FE_DOWNWARD, "downwards" },
+    { FE_TOWARDZERO, "to zero" }
+};
+
+int main(int argc, char *argv[argc])
+{
+    int i;
+
+    for (i = 0; i < ARRAY_SIZE(round_flags); ++i) {
+        fesetround(round_flags[i].flag);
+        printf("### Rounding %s\n", round_flags[i].desc);
+        convert_single_to_half();
+        convert_single_to_double();
+        convert_double_to_half();
+        convert_double_to_single();
+        convert_half_to_single();
+        convert_half_to_double();
+    }
+
+    /* And now with ARM alternative FP16 */
+    asm("msr fpsr, x1\n\t"
+        "orr x1, x1, %[flags]\n\t"
+        "mrs x1, fpsr\n\t"
+        : /* no output */ : [flags] "n" (1 << 26) : "x1" );
+
+    printf("#### Enabling ARM Alternative Half Precision\n");
+
+    for (i = 0; i < ARRAY_SIZE(round_flags); ++i) {
+        fesetround(round_flags[i].flag);
+        printf("### Rounding %s\n", round_flags[i].desc);
+        convert_single_to_half();
+        convert_single_to_double();
+        convert_double_to_half();
+        convert_double_to_single();
+        convert_half_to_single();
+        convert_half_to_double();
+    }
+
+    return 0;
+}
tests/tcg/aarch64/fcvt.out new file +1305 -0
new file mode 100644
index 0000000000..48e62ac955
@@ -0,0 +1,1305 @@
+### Rounding to nearest
+Converting single-precision to half-precision
+00 SINGLE: -3.40282346638528859812e+38 / 0xff7fffff  (0 => OK)
+00   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+01 SINGLE: -1.17549435082228750797e-38 / 0x80800000  (0 => OK)
+01   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+02 SINGLE: 0.00000000000000000000e+00 / 0000000000  (0 => OK)
+02   HALF: 0000000000  (0 => OK)
+03 SINGLE: 1.17549435082228750797e-38 / 0x00800000  (0 => OK)
+03   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+04 SINGLE: 1.00000000000000000000e+00 / 0x3f800000  (0 => OK)
+04   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+05 SINGLE: 2.00000000000000000000e+00 / 0x40000000  (0 => OK)
+05   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+06 SINGLE: 2.71828174591064453125e+00 / 0x402df854  (0 => OK)
+06   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+07 SINGLE: 3.14159274101257324219e+00 / 0x40490fdb  (0 => OK)
+07   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+08 SINGLE: 2.66182092800000000000e+09 / 0x4f1ea82a  (0 => OK)
+08   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+09 SINGLE: 2.87892992000000000000e+09 / 0x4f2b98fc  (0 => OK)
+09   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+10 SINGLE: 3.40282346638528859812e+38 / 0x7f7fffff  (0 => OK)
+10   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+Converting single-precision to double-precision
+00 SINGLE: -3.40282346638528859812e+38 / 0xff7fffff  (0 => OK)
+00 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+01 SINGLE: -1.17549435082228750797e-38 / 0x80800000  (0 => OK)
+01 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+02 SINGLE: 0.00000000000000000000e+00 / 0000000000  (0 => OK)
+02 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+03 SINGLE: 1.17549435082228750797e-38 / 0x00800000  (0 => OK)
+03 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+04 SINGLE: 1.00000000000000000000e+00 / 0x3f800000  (0 => OK)
+04 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+05 SINGLE: 2.00000000000000000000e+00 / 0x40000000  (0 => OK)
+05 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+06 SINGLE: 2.71828174591064453125e+00 / 0x402df854  (0 => OK)
+06 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+07 SINGLE: 3.14159274101257324219e+00 / 0x40490fdb  (0 => OK)
+07 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+08 SINGLE: 2.66182092800000000000e+09 / 0x4f1ea82a  (0 => OK)
+08 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+09 SINGLE: 2.87892992000000000000e+09 / 0x4f2b98fc  (0 => OK)
+09 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+10 SINGLE: 3.40282346638528859812e+38 / 0x7f7fffff  (0 => OK)
+10 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+Converting double-precision to half-precision
+00 DOUBLE: -1.79769313486231570815e+308 / 0x00ffefffffffffffff  (0 => OK)
+00   HALF: 0x0000fc00  (0x14 => OVERFLOW   INEXACT )
+01 DOUBLE: -2.00000000000000000000e+00 / 0x00c000000000000000  (0 => OK)
+01   HALF: 0x0000c000  (0 => OK)
+02 DOUBLE: -1.00000000000000000000e+00 / 0x00bff0000000000000  (0 => OK)
+02   HALF: 0x0000bc00  (0 => OK)
+03 DOUBLE: -2.22507385850720138309e-308 / 0x008010000000000000  (0 => OK)
+03   HALF: 0x00008000  (0x18 =>  UNDERFLOW  INEXACT )
+04 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+04   HALF: 0000000000  (0 => OK)
+05 DOUBLE: 2.22507385850720138309e-308 / 0x000010000000000000  (0 => OK)
+05   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+06 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0 => OK)
+06   HALF: 0x00003c00  (0 => OK)
+07 DOUBLE: 2.00000000000000000000e+00 / 0x004000000000000000  (0 => OK)
+07   HALF: 0x00004000  (0 => OK)
+08 DOUBLE: 2.71828182845904509080e+00 / 0x004005bf0a8b145769  (0 => OK)
+08   HALF: 0x00004170  (0x10 =>    INEXACT )
+09 DOUBLE: 3.14159265358979311600e+00 / 0x00400921fb54442d18  (0 => OK)
+09   HALF: 0x00004248  (0x10 =>    INEXACT )
+10 DOUBLE: 2.79112157760473600000e+15 / 0x004323d5054450ed00  (0 => OK)
+10   HALF: 0x00007c00  (0x14 => OVERFLOW   INEXACT )
+Converting double-precision to single-precision
+00 DOUBLE: -1.79769313486231570815e+308 / 0x00ffefffffffffffff  (0 => OK)
+00 SINGLE: 4.28657868800000000000e+09 / 0x4f7f8000  (0x14 => OVERFLOW   INEXACT )
+01 DOUBLE: -2.00000000000000000000e+00 / 0x00c000000000000000  (0 => OK)
+01 SINGLE: 3.22122547200000000000e+09 / 0x4f400000  (0 => OK)
+02 DOUBLE: -1.00000000000000000000e+00 / 0x00bff0000000000000  (0 => OK)
+02 SINGLE: 3.21283686400000000000e+09 / 0x4f3f8000  (0 => OK)
+03 DOUBLE: -2.22507385850720138309e-308 / 0x008010000000000000  (0 => OK)
+03 SINGLE: 2.14748364800000000000e+09 / 0x4f000000  (0x18 =>  UNDERFLOW  INEXACT )
+04 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+04 SINGLE: 0.00000000000000000000e+00 / 0000000000  (0 => OK)
+05 DOUBLE: 2.22507385850720138309e-308 / 0x000010000000000000  (0 => OK)
+05 SINGLE: 0.00000000000000000000e+00 / 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+06 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0 => OK)
+06 SINGLE: 1.06535321600000000000e+09 / 0x4e7e0000  (0 => OK)
+07 DOUBLE: 2.00000000000000000000e+00 / 0x004000000000000000  (0 => OK)
+07 SINGLE: 1.07374182400000000000e+09 / 0x4e800000  (0 => OK)
+08 DOUBLE: 2.71828182845904509080e+00 / 0x004005bf0a8b145769  (0 => OK)
+08 SINGLE: 1.07675456000000000000e+09 / 0x4e805bf1  (0x10 =>    INEXACT )
+09 DOUBLE: 3.14159265358979311600e+00 / 0x00400921fb54442d18  (0 => OK)
+09 SINGLE: 1.07853004800000000000e+09 / 0x4e809220  (0x10 =>    INEXACT )
+10 DOUBLE: 2.79112157760473600000e+15 / 0x004323d5054450ed00  (0 => OK)
+10 SINGLE: 1.49518131200000000000e+09 / 0x4eb23d50  (0x10 =>    INEXACT )
+Converting half-precision to single-precision
+00   HALF: 0x0000ffff  (0 => OK)
+00 DOUBLE: -nan / 0x00fffffc0000000000  (0 => OK)
+01   HALF: 0x0000fcff  (0 => OK)
+01 DOUBLE: -nan / 0x00fffbfc0000000000  (0x1 =>     INVALID)
+02   HALF: 0x0000fc01  (0 => OK)
+02 DOUBLE: -nan / 0x00fff8040000000000  (0x1 =>     INVALID)
+03   HALF: 0x0000fc00  (0 => OK)
+03 DOUBLE: -inf / 0x00fff0000000000000  (0 => OK)
+04   HALF: 0x0000fbff  (0 => OK)
+04 DOUBLE: -6.55040000000000000000e+04 / 0x00c0effc0000000000  (0 => OK)
+05   HALF: 0x0000c000  (0 => OK)
+05 DOUBLE: -2.00000000000000000000e+00 / 0x00c000000000000000  (0 => OK)
+06   HALF: 0x0000bc00  (0 => OK)
+06 DOUBLE: -1.00000000000000000000e+00 / 0x00bff0000000000000  (0 => OK)
+07   HALF: 0x00008001  (0 => OK)
+07 DOUBLE: -5.96046447753906250000e-08 / 0x00be70000000000000  (0 => OK)
+08   HALF: 0x00008000  (0 => OK)
+08 DOUBLE: -0.00000000000000000000e+00 / 0x008000000000000000  (0 => OK)
+09   HALF: 0000000000  (0 => OK)
+09 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+10   HALF: 0x00000001  (0 => OK)
+10 DOUBLE: 5.96046447753906250000e-08 / 0x003e70000000000000  (0 => OK)
+11   HALF: 0x00003c00  (0 => OK)
+11 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0 => OK)
+12   HALF: 0x00007bff  (0 => OK)
+12 DOUBLE: 6.55040000000000000000e+04 / 0x0040effc0000000000  (0 => OK)
+13   HALF: 0x00007c00  (0 => OK)
+13 DOUBLE: inf / 0x007ff0000000000000  (0 => OK)
+14   HALF: 0x00007c01  (0 => OK)
+14 DOUBLE: nan / 0x007ff8040000000000  (0x1 =>     INVALID)
+15   HALF: 0x00007cff  (0 => OK)
+15 DOUBLE: nan / 0x007ffbfc0000000000  (0x1 =>     INVALID)
+16   HALF: 0x00007fff  (0 => OK)
+16 DOUBLE: nan / 0x007ffffc0000000000  (0 => OK)
+Converting half-precision to double-precision
+00   HALF: 0x0000ffff  (0 => OK)
+00 DOUBLE: -nan / 0x00fffffc0000000000  (0 => OK)
+01   HALF: 0x0000fcff  (0 => OK)
+01 DOUBLE: -nan / 0x00fffbfc0000000000  (0x1 =>     INVALID)
+02   HALF: 0x0000fc01  (0 => OK)
+02 DOUBLE: -nan / 0x00fff8040000000000  (0x1 =>     INVALID)
+03   HALF: 0x0000fc00  (0 => OK)
+03 DOUBLE: -inf / 0x00fff0000000000000  (0 => OK)
+04   HALF: 0x0000fbff  (0 => OK)
+04 DOUBLE: -6.55040000000000000000e+04 / 0x00c0effc0000000000  (0 => OK)
+05   HALF: 0x0000c000  (0 => OK)
+05 DOUBLE: -2.00000000000000000000e+00 / 0x00c000000000000000  (0 => OK)
+06   HALF: 0x0000bc00  (0 => OK)
+06 DOUBLE: -1.00000000000000000000e+00 / 0x00bff0000000000000  (0 => OK)
+07   HALF: 0x00008001  (0 => OK)
+07 DOUBLE: -5.96046447753906250000e-08 / 0x00be70000000000000  (0 => OK)
+08   HALF: 0x00008000  (0 => OK)
+08 DOUBLE: -0.00000000000000000000e+00 / 0x008000000000000000  (0 => OK)
+09   HALF: 0000000000  (0 => OK)
+09 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+10   HALF: 0x00000001  (0 => OK)
+10 DOUBLE: 5.96046447753906250000e-08 / 0x003e70000000000000  (0 => OK)
+11   HALF: 0x00003c00  (0 => OK)
+11 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0 => OK)
+12   HALF: 0x00007bff  (0 => OK)
+12 DOUBLE: 6.55040000000000000000e+04 / 0x0040effc0000000000  (0 => OK)
+13   HALF: 0x00007c00  (0 => OK)
+13 DOUBLE: inf / 0x007ff0000000000000  (0 => OK)
+14   HALF: 0x00007c01  (0 => OK)
+14 DOUBLE: nan / 0x007ff8040000000000  (0x1 =>     INVALID)
+15   HALF: 0x00007cff  (0 => OK)
+15 DOUBLE: nan / 0x007ffbfc0000000000  (0x1 =>     INVALID)
+16   HALF: 0x00007fff  (0 => OK)
+16 DOUBLE: nan / 0x007ffffc0000000000  (0 => OK)
+### Rounding upwards
+Converting single-precision to half-precision
+00 SINGLE: -3.40282346638528859811e+38 / 0xff7fffff  (0 => OK)
+00   HALF: 0x00000001  (0x18 =>  UNDERFLOW  INEXACT )
+01 SINGLE: -1.17549435082228750796e-38 / 0x80800000  (0 => OK)
+01   HALF: 0x00000001  (0x18 =>  UNDERFLOW  INEXACT )
+02 SINGLE: 0.00000000000000000000e+00 / 0000000000  (0 => OK)
+02   HALF: 0000000000  (0 => OK)
+03 SINGLE: 1.17549435082228750797e-38 / 0x00800000  (0 => OK)
+03   HALF: 0x00000001  (0x18 =>  UNDERFLOW  INEXACT )
+04 SINGLE: 1.00000000000000000000e+00 / 0x3f800000  (0 => OK)
+04   HALF: 0x00000001  (0x18 =>  UNDERFLOW  INEXACT )
+05 SINGLE: 2.00000000000000000000e+00 / 0x40000000  (0 => OK)
+05   HALF: 0x00000001  (0x18 =>  UNDERFLOW  INEXACT )
+06 SINGLE: 2.71828174591064453125e+00 / 0x402df854  (0 => OK)
+06   HALF: 0x00000001  (0x18 =>  UNDERFLOW  INEXACT )
+07 SINGLE: 3.14159274101257324219e+00 / 0x40490fdb  (0 => OK)
+07   HALF: 0x00000001  (0x18 =>  UNDERFLOW  INEXACT )
+08 SINGLE: 2.66182092800000000000e+09 / 0x4f1ea82a  (0 => OK)
+08   HALF: 0x00000001  (0x18 =>  UNDERFLOW  INEXACT )
+09 SINGLE: 2.87892992000000000000e+09 / 0x4f2b98fc  (0 => OK)
+09   HALF: 0x00000001  (0x18 =>  UNDERFLOW  INEXACT )
+10 SINGLE: 3.40282346638528859812e+38 / 0x7f7fffff  (0 => OK)
+10   HALF: 0x00000001  (0x18 =>  UNDERFLOW  INEXACT )
+Converting single-precision to double-precision
+00 SINGLE: -3.40282346638528859811e+38 / 0xff7fffff  (0 => OK)
+00 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+01 SINGLE: -1.17549435082228750796e-38 / 0x80800000  (0 => OK)
+01 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+02 SINGLE: 0.00000000000000000000e+00 / 0000000000  (0 => OK)
+02 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+03 SINGLE: 1.17549435082228750797e-38 / 0x00800000  (0 => OK)
+03 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+04 SINGLE: 1.00000000000000000000e+00 / 0x3f800000  (0 => OK)
+04 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+05 SINGLE: 2.00000000000000000000e+00 / 0x40000000  (0 => OK)
+05 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+06 SINGLE: 2.71828174591064453125e+00 / 0x402df854  (0 => OK)
+06 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+07 SINGLE: 3.14159274101257324219e+00 / 0x40490fdb  (0 => OK)
+07 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+08 SINGLE: 2.66182092800000000000e+09 / 0x4f1ea82a  (0 => OK)
+08 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+09 SINGLE: 2.87892992000000000000e+09 / 0x4f2b98fc  (0 => OK)
+09 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+10 SINGLE: 3.40282346638528859812e+38 / 0x7f7fffff  (0 => OK)
+10 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+Converting double-precision to half-precision
+00 DOUBLE: -1.79769313486231570814e+308 / 0x00ffefffffffffffff  (0 => OK)
+00   HALF: 0x0000fbff  (0x14 => OVERFLOW   INEXACT )
+01 DOUBLE: -2.00000000000000000000e+00 / 0x00c000000000000000  (0 => OK)
+01   HALF: 0x0000c000  (0 => OK)
+02 DOUBLE: -1.00000000000000000000e+00 / 0x00bff0000000000000  (0 => OK)
+02   HALF: 0x0000bc00  (0 => OK)
+03 DOUBLE: -2.22507385850720138309e-308 / 0x008010000000000000  (0 => OK)
+03   HALF: 0x00008000  (0x18 =>  UNDERFLOW  INEXACT )
+04 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+04   HALF: 0000000000  (0 => OK)
+05 DOUBLE: 2.22507385850720138310e-308 / 0x000010000000000000  (0 => OK)
+05   HALF: 0x00000001  (0x18 =>  UNDERFLOW  INEXACT )
+06 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0 => OK)
+06   HALF: 0x00003c00  (0 => OK)
+07 DOUBLE: 2.00000000000000000000e+00 / 0x004000000000000000  (0 => OK)
+07   HALF: 0x00004000  (0 => OK)
+08 DOUBLE: 2.71828182845904509080e+00 / 0x004005bf0a8b145769  (0 => OK)
+08   HALF: 0x00004170  (0x10 =>    INEXACT )
+09 DOUBLE: 3.14159265358979311600e+00 / 0x00400921fb54442d18  (0 => OK)
+09   HALF: 0x00004249  (0x10 =>    INEXACT )
+10 DOUBLE: 2.79112157760473600000e+15 / 0x004323d5054450ed00  (0 => OK)
+10   HALF: 0x00007c00  (0x14 => OVERFLOW   INEXACT )
+Converting double-precision to single-precision
+00 DOUBLE: -1.79769313486231570814e+308 / 0x00ffefffffffffffff  (0 => OK)
+00 SINGLE: 4.28657868800000000000e+09 / 0x4f7f8000  (0x14 => OVERFLOW   INEXACT )
+01 DOUBLE: -2.00000000000000000000e+00 / 0x00c000000000000000  (0 => OK)
+01 SINGLE: 3.22122547200000000000e+09 / 0x4f400000  (0 => OK)
+02 DOUBLE: -1.00000000000000000000e+00 / 0x00bff0000000000000  (0 => OK)
+02 SINGLE: 3.21283686400000000000e+09 / 0x4f3f8000  (0 => OK)
+03 DOUBLE: -2.22507385850720138309e-308 / 0x008010000000000000  (0 => OK)
+03 SINGLE: 2.14748364800000000000e+09 / 0x4f000000  (0x18 =>  UNDERFLOW  INEXACT )
+04 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+04 SINGLE: 0.00000000000000000000e+00 / 0000000000  (0 => OK)
+05 DOUBLE: 2.22507385850720138310e-308 / 0x000010000000000000  (0 => OK)
+05 SINGLE: 1.00000000000000000000e+00 / 0x3f800000  (0x18 =>  UNDERFLOW  INEXACT )
+06 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0 => OK)
+06 SINGLE: 1.06535321600000000000e+09 / 0x4e7e0000  (0 => OK)
+07 DOUBLE: 2.00000000000000000000e+00 / 0x004000000000000000  (0 => OK)
+07 SINGLE: 1.07374182400000000000e+09 / 0x4e800000  (0 => OK)
+08 DOUBLE: 2.71828182845904509080e+00 / 0x004005bf0a8b145769  (0 => OK)
+08 SINGLE: 1.07675456000000000000e+09 / 0x4e805bf1  (0x10 =>    INEXACT )
+09 DOUBLE: 3.14159265358979311600e+00 / 0x00400921fb54442d18  (0 => OK)
+09 SINGLE: 1.07853004800000000000e+09 / 0x4e809220  (0x10 =>    INEXACT )
+10 DOUBLE: 2.79112157760473600000e+15 / 0x004323d5054450ed00  (0 => OK)
+10 SINGLE: 1.49518144000000000000e+09 / 0x4eb23d51  (0x10 =>    INEXACT )
+Converting half-precision to single-precision
+00   HALF: 0x0000ffff  (0 => OK)
+00 DOUBLE: -nan / 0x00fffffc0000000000  (0 => OK)
+01   HALF: 0x0000fcff  (0 => OK)
+01 DOUBLE: -nan / 0x00fffbfc0000000000  (0x1 =>     INVALID)
+02   HALF: 0x0000fc01  (0 => OK)
+02 DOUBLE: -nan / 0x00fff8040000000000  (0x1 =>     INVALID)
+03   HALF: 0x0000fc00  (0 => OK)
+03 DOUBLE: -inf / 0x00fff0000000000000  (0 => OK)
+04   HALF: 0x0000fbff  (0 => OK)
+04 DOUBLE: -6.55040000000000000000e+04 / 0x00c0effc0000000000  (0 => OK)
+05   HALF: 0x0000c000  (0 => OK)
+05 DOUBLE: -2.00000000000000000000e+00 / 0x00c000000000000000  (0 => OK)
+06   HALF: 0x0000bc00  (0 => OK)
+06 DOUBLE: -1.00000000000000000000e+00 / 0x00bff0000000000000  (0 => OK)
+07   HALF: 0x00008001  (0 => OK)
+07 DOUBLE: -5.96046447753906250000e-08 / 0x00be70000000000000  (0 => OK)
+08   HALF: 0x00008000  (0 => OK)
+08 DOUBLE: -0.00000000000000000000e+00 / 0x008000000000000000  (0 => OK)
+09   HALF: 0000000000  (0 => OK)
+09 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+10   HALF: 0x00000001  (0 => OK)
+10 DOUBLE: 5.96046447753906250000e-08 / 0x003e70000000000000  (0 => OK)
+11   HALF: 0x00003c00  (0 => OK)
+11 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0 => OK)
+12   HALF: 0x00007bff  (0 => OK)
+12 DOUBLE: 6.55040000000000000000e+04 / 0x0040effc0000000000  (0 => OK)
+13   HALF: 0x00007c00  (0 => OK)
+13 DOUBLE: inf / 0x007ff0000000000000  (0 => OK)
+14   HALF: 0x00007c01  (0 => OK)
+14 DOUBLE: nan / 0x007ff8040000000000  (0x1 =>     INVALID)
+15   HALF: 0x00007cff  (0 => OK)
+15 DOUBLE: nan / 0x007ffbfc0000000000  (0x1 =>     INVALID)
+16   HALF: 0x00007fff  (0 => OK)
+16 DOUBLE: nan / 0x007ffffc0000000000  (0 => OK)
+Converting half-precision to double-precision
+00   HALF: 0x0000ffff  (0 => OK)
+00 DOUBLE: -nan / 0x00fffffc0000000000  (0 => OK)
+01   HALF: 0x0000fcff  (0 => OK)
+01 DOUBLE: -nan / 0x00fffbfc0000000000  (0x1 =>     INVALID)
+02   HALF: 0x0000fc01  (0 => OK)
+02 DOUBLE: -nan / 0x00fff8040000000000  (0x1 =>     INVALID)
+03   HALF: 0x0000fc00  (0 => OK)
+03 DOUBLE: -inf / 0x00fff0000000000000  (0 => OK)
+04   HALF: 0x0000fbff  (0 => OK)
+04 DOUBLE: -6.55040000000000000000e+04 / 0x00c0effc0000000000  (0 => OK)
+05   HALF: 0x0000c000  (0 => OK)
+05 DOUBLE: -2.00000000000000000000e+00 / 0x00c000000000000000  (0 => OK)
+06   HALF: 0x0000bc00  (0 => OK)
+06 DOUBLE: -1.00000000000000000000e+00 / 0x00bff0000000000000  (0 => OK)
+07   HALF: 0x00008001  (0 => OK)
+07 DOUBLE: -5.96046447753906250000e-08 / 0x00be70000000000000  (0 => OK)
+08   HALF: 0x00008000  (0 => OK)
+08 DOUBLE: -0.00000000000000000000e+00 / 0x008000000000000000  (0 => OK)
+09   HALF: 0000000000  (0 => OK)
+09 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+10   HALF: 0x00000001  (0 => OK)
+10 DOUBLE: 5.96046447753906250000e-08 / 0x003e70000000000000  (0 => OK)
+11   HALF: 0x00003c00  (0 => OK)
+11 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0 => OK)
+12   HALF: 0x00007bff  (0 => OK)
+12 DOUBLE: 6.55040000000000000000e+04 / 0x0040effc0000000000  (0 => OK)
+13   HALF: 0x00007c00  (0 => OK)
+13 DOUBLE: inf / 0x007ff0000000000000  (0 => OK)
+14   HALF: 0x00007c01  (0 => OK)
+14 DOUBLE: nan / 0x007ff8040000000000  (0x1 =>     INVALID)
+15   HALF: 0x00007cff  (0 => OK)
+15 DOUBLE: nan / 0x007ffbfc0000000000  (0x1 =>     INVALID)
+16   HALF: 0x00007fff  (0 => OK)
+16 DOUBLE: nan / 0x007ffffc0000000000  (0 => OK)
+### Rounding downwards
+Converting single-precision to half-precision
+00 SINGLE: -3.40282346638528859812e+38 / 0xff7fffff  (0 => OK)
+00   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+01 SINGLE: -1.17549435082228750797e-38 / 0x80800000  (0 => OK)
+01   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+02 SINGLE: 0.00000000000000000000e+00 / 0000000000  (0 => OK)
+02   HALF: 0000000000  (0 => OK)
+03 SINGLE: 1.17549435082228750796e-38 / 0x00800000  (0 => OK)
+03   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+04 SINGLE: 1.00000000000000000000e+00 / 0x3f800000  (0 => OK)
+04   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+05 SINGLE: 2.00000000000000000000e+00 / 0x40000000  (0 => OK)
+05   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+06 SINGLE: 2.71828174591064453125e+00 / 0x402df854  (0 => OK)
+06   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+07 SINGLE: 3.14159274101257324218e+00 / 0x40490fdb  (0 => OK)
+07   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+08 SINGLE: 2.66182092800000000000e+09 / 0x4f1ea82a  (0 => OK)
+08   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+09 SINGLE: 2.87892992000000000000e+09 / 0x4f2b98fc  (0 => OK)
+09   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+10 SINGLE: 3.40282346638528859811e+38 / 0x7f7fffff  (0 => OK)
+10   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+Converting single-precision to double-precision
+00 SINGLE: -3.40282346638528859812e+38 / 0xff7fffff  (0 => OK)
+00 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+01 SINGLE: -1.17549435082228750797e-38 / 0x80800000  (0 => OK)
+01 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+02 SINGLE: 0.00000000000000000000e+00 / 0000000000  (0 => OK)
+02 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+03 SINGLE: 1.17549435082228750796e-38 / 0x00800000  (0 => OK)
+03 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+04 SINGLE: 1.00000000000000000000e+00 / 0x3f800000  (0 => OK)
+04 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+05 SINGLE: 2.00000000000000000000e+00 / 0x40000000  (0 => OK)
+05 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+06 SINGLE: 2.71828174591064453125e+00 / 0x402df854  (0 => OK)
+06 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+07 SINGLE: 3.14159274101257324218e+00 / 0x40490fdb  (0 => OK)
+07 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+08 SINGLE: 2.66182092800000000000e+09 / 0x4f1ea82a  (0 => OK)
+08 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+09 SINGLE: 2.87892992000000000000e+09 / 0x4f2b98fc  (0 => OK)
+09 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+10 SINGLE: 3.40282346638528859811e+38 / 0x7f7fffff  (0 => OK)
+10 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+Converting double-precision to half-precision
+00 DOUBLE: -1.79769313486231570815e+308 / 0x00ffefffffffffffff  (0 => OK)
+00   HALF: 0x0000fc00  (0x14 => OVERFLOW   INEXACT )
+01 DOUBLE: -2.00000000000000000000e+00 / 0x00c000000000000000  (0 => OK)
+01   HALF: 0x0000c000  (0 => OK)
+02 DOUBLE: -1.00000000000000000000e+00 / 0x00bff0000000000000  (0 => OK)
+02   HALF: 0x0000bc00  (0 => OK)
+03 DOUBLE: -2.22507385850720138310e-308 / 0x008010000000000000  (0 => OK)
+03   HALF: 0x00008001  (0x18 =>  UNDERFLOW  INEXACT )
+04 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+04   HALF: 0000000000  (0 => OK)
+05 DOUBLE: 2.22507385850720138309e-308 / 0x000010000000000000  (0 => OK)
+05   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+06 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0 => OK)
+06   HALF: 0x00003c00  (0 => OK)
+07 DOUBLE: 2.00000000000000000000e+00 / 0x004000000000000000  (0 => OK)
+07   HALF: 0x00004000  (0 => OK)
+08 DOUBLE: 2.71828182845904509079e+00 / 0x004005bf0a8b145769  (0 => OK)
+08   HALF: 0x0000416f  (0x10 =>    INEXACT )
+09 DOUBLE: 3.14159265358979311599e+00 / 0x00400921fb54442d18  (0 => OK)
+09   HALF: 0x00004248  (0x10 =>    INEXACT )
+10 DOUBLE: 2.79112157760473600000e+15 / 0x004323d5054450ed00  (0 => OK)
+10   HALF: 0x00007bff  (0x14 => OVERFLOW   INEXACT )
+Converting double-precision to single-precision
+00 DOUBLE: -1.79769313486231570815e+308 / 0x00ffefffffffffffff  (0 => OK)
+00 SINGLE: 4.28657868800000000000e+09 / 0x4f7f8000  (0x14 => OVERFLOW   INEXACT )
+01 DOUBLE: -2.00000000000000000000e+00 / 0x00c000000000000000  (0 => OK)
+01 SINGLE: 3.22122547200000000000e+09 / 0x4f400000  (0 => OK)
+02 DOUBLE: -1.00000000000000000000e+00 / 0x00bff0000000000000  (0 => OK)
+02 SINGLE: 3.21283686400000000000e+09 / 0x4f3f8000  (0 => OK)
+03 DOUBLE: -2.22507385850720138310e-308 / 0x008010000000000000  (0 => OK)
+03 SINGLE: 2.14748364800000000000e+09 / 0x4f000000  (0x18 =>  UNDERFLOW  INEXACT )
+04 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+04 SINGLE: 0.00000000000000000000e+00 / 0000000000  (0 => OK)
+05 DOUBLE: 2.22507385850720138309e-308 / 0x000010000000000000  (0 => OK)
+05 SINGLE: 0.00000000000000000000e+00 / 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+06 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0 => OK)
+06 SINGLE: 1.06535321600000000000e+09 / 0x4e7e0000  (0 => OK)
+07 DOUBLE: 2.00000000000000000000e+00 / 0x004000000000000000  (0 => OK)
+07 SINGLE: 1.07374182400000000000e+09 / 0x4e800000  (0 => OK)
+08 DOUBLE: 2.71828182845904509079e+00 / 0x004005bf0a8b145769  (0 => OK)
+08 SINGLE: 1.07675443200000000000e+09 / 0x4e805bf0  (0x10 =>    INEXACT )
+09 DOUBLE: 3.14159265358979311599e+00 / 0x00400921fb54442d18  (0 => OK)
+09 SINGLE: 1.07852992000000000000e+09 / 0x4e80921f  (0x10 =>    INEXACT )
+10 DOUBLE: 2.79112157760473600000e+15 / 0x004323d5054450ed00  (0 => OK)
+10 SINGLE: 1.49518131200000000000e+09 / 0x4eb23d50  (0x10 =>    INEXACT )
+Converting half-precision to single-precision
+00   HALF: 0x0000ffff  (0 => OK)
+00 DOUBLE: -nan / 0x00fffffc0000000000  (0 => OK)
+01   HALF: 0x0000fcff  (0 => OK)
+01 DOUBLE: -nan / 0x00fffbfc0000000000  (0x1 =>     INVALID)
+02   HALF: 0x0000fc01  (0 => OK)
+02 DOUBLE: -nan / 0x00fff8040000000000  (0x1 =>     INVALID)
+03   HALF: 0x0000fc00  (0 => OK)
+03 DOUBLE: -inf / 0x00fff0000000000000  (0 => OK)
+04   HALF: 0x0000fbff  (0 => OK)
+04 DOUBLE: -6.55040000000000000000e+04 / 0x00c0effc0000000000  (0 => OK)
+05   HALF: 0x0000c000  (0 => OK)
+05 DOUBLE: -2.00000000000000000000e+00 / 0x00c000000000000000  (0 => OK)
+06   HALF: 0x0000bc00  (0 => OK)
+06 DOUBLE: -1.00000000000000000000e+00 / 0x00bff0000000000000  (0 => OK)
+07   HALF: 0x00008001  (0 => OK)
+07 DOUBLE: -5.96046447753906250000e-08 / 0x00be70000000000000  (0 => OK)
+08   HALF: 0x00008000  (0 => OK)
+08 DOUBLE: -0.00000000000000000000e+00 / 0x008000000000000000  (0 => OK)
+09   HALF: 0000000000  (0 => OK)
+09 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+10   HALF: 0x00000001  (0 => OK)
+10 DOUBLE: 5.96046447753906250000e-08 / 0x003e70000000000000  (0 => OK)
+11   HALF: 0x00003c00  (0 => OK)
+11 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0 => OK)
+12   HALF: 0x00007bff  (0 => OK)
+12 DOUBLE: 6.55040000000000000000e+04 / 0x0040effc0000000000  (0 => OK)
+13   HALF: 0x00007c00  (0 => OK)
+13 DOUBLE: inf / 0x007ff0000000000000  (0 => OK)
+14   HALF: 0x00007c01  (0 => OK)
+14 DOUBLE: nan / 0x007ff8040000000000  (0x1 =>     INVALID)
+15   HALF: 0x00007cff  (0 => OK)
+15 DOUBLE: nan / 0x007ffbfc0000000000  (0x1 =>     INVALID)
+16   HALF: 0x00007fff  (0 => OK)
+16 DOUBLE: nan / 0x007ffffc0000000000  (0 => OK)
+Converting half-precision to double-precision
+00   HALF: 0x0000ffff  (0 => OK)
+00 DOUBLE: -nan / 0x00fffffc0000000000  (0 => OK)
+01   HALF: 0x0000fcff  (0 => OK)
+01 DOUBLE: -nan / 0x00fffbfc0000000000  (0x1 =>     INVALID)
+02   HALF: 0x0000fc01  (0 => OK)
+02 DOUBLE: -nan / 0x00fff8040000000000  (0x1 =>     INVALID)
+03   HALF: 0x0000fc00  (0 => OK)
+03 DOUBLE: -inf / 0x00fff0000000000000  (0 => OK)
+04   HALF: 0x0000fbff  (0 => OK)
+04 DOUBLE: -6.55040000000000000000e+04 / 0x00c0effc0000000000  (0 => OK)
+05   HALF: 0x0000c000  (0 => OK)
+05 DOUBLE: -2.00000000000000000000e+00 / 0x00c000000000000000  (0 => OK)
+06   HALF: 0x0000bc00  (0 => OK)
+06 DOUBLE: -1.00000000000000000000e+00 / 0x00bff0000000000000  (0 => OK)
+07   HALF: 0x00008001  (0 => OK)
+07 DOUBLE: -5.96046447753906250000e-08 / 0x00be70000000000000  (0 => OK)
+08   HALF: 0x00008000  (0 => OK)
+08 DOUBLE: -0.00000000000000000000e+00 / 0x008000000000000000  (0 => OK)
+09   HALF: 0000000000  (0 => OK)
+09 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+10   HALF: 0x00000001  (0 => OK)
+10 DOUBLE: 5.96046447753906250000e-08 / 0x003e70000000000000  (0 => OK)
+11   HALF: 0x00003c00  (0 => OK)
+11 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0 => OK)
+12   HALF: 0x00007bff  (0 => OK)
+12 DOUBLE: 6.55040000000000000000e+04 / 0x0040effc0000000000  (0 => OK)
+13   HALF: 0x00007c00  (0 => OK)
+13 DOUBLE: inf / 0x007ff0000000000000  (0 => OK)
+14   HALF: 0x00007c01  (0 => OK)
+14 DOUBLE: nan / 0x007ff8040000000000  (0x1 =>     INVALID)
+15   HALF: 0x00007cff  (0 => OK)
+15 DOUBLE: nan / 0x007ffbfc0000000000  (0x1 =>     INVALID)
+16   HALF: 0x00007fff  (0 => OK)
+16 DOUBLE: nan / 0x007ffffc0000000000  (0 => OK)
+### Rounding to zero
+Converting single-precision to half-precision
+00 SINGLE: -3.40282346638528859811e+38 / 0xff7fffff  (0 => OK)
+00   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+01 SINGLE: -1.17549435082228750796e-38 / 0x80800000  (0 => OK)
+01   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+02 SINGLE: 0.00000000000000000000e+00 / 0000000000  (0 => OK)
+02   HALF: 0000000000  (0 => OK)
+03 SINGLE: 1.17549435082228750796e-38 / 0x00800000  (0 => OK)
+03   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+04 SINGLE: 1.00000000000000000000e+00 / 0x3f800000  (0 => OK)
+04   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+05 SINGLE: 2.00000000000000000000e+00 / 0x40000000  (0 => OK)
+05   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+06 SINGLE: 2.71828174591064453125e+00 / 0x402df854  (0 => OK)
+06   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+07 SINGLE: 3.14159274101257324218e+00 / 0x40490fdb  (0 => OK)
+07   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+08 SINGLE: 2.66182092800000000000e+09 / 0x4f1ea82a  (0 => OK)
+08   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+09 SINGLE: 2.87892992000000000000e+09 / 0x4f2b98fc  (0 => OK)
+09   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+10 SINGLE: 3.40282346638528859811e+38 / 0x7f7fffff  (0 => OK)
+10   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+Converting single-precision to double-precision
+00 SINGLE: -3.40282346638528859811e+38 / 0xff7fffff  (0 => OK)
+00 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+01 SINGLE: -1.17549435082228750796e-38 / 0x80800000  (0 => OK)
+01 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+02 SINGLE: 0.00000000000000000000e+00 / 0000000000  (0 => OK)
+02 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+03 SINGLE: 1.17549435082228750796e-38 / 0x00800000  (0 => OK)
+03 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+04 SINGLE: 1.00000000000000000000e+00 / 0x3f800000  (0 => OK)
+04 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+05 SINGLE: 2.00000000000000000000e+00 / 0x40000000  (0 => OK)
+05 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+06 SINGLE: 2.71828174591064453125e+00 / 0x402df854  (0 => OK)
+06 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+07 SINGLE: 3.14159274101257324218e+00 / 0x40490fdb  (0 => OK)
+07 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+08 SINGLE: 2.66182092800000000000e+09 / 0x4f1ea82a  (0 => OK)
+08 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+09 SINGLE: 2.87892992000000000000e+09 / 0x4f2b98fc  (0 => OK)
+09 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+10 SINGLE: 3.40282346638528859811e+38 / 0x7f7fffff  (0 => OK)
+10 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+Converting double-precision to half-precision
+00 DOUBLE: -1.79769313486231570814e+308 / 0x00ffefffffffffffff  (0 => OK)
+00   HALF: 0x0000fbff  (0x14 => OVERFLOW   INEXACT )
+01 DOUBLE: -2.00000000000000000000e+00 / 0x00c000000000000000  (0 => OK)
+01   HALF: 0x0000c000  (0 => OK)
+02 DOUBLE: -1.00000000000000000000e+00 / 0x00bff0000000000000  (0 => OK)
+02   HALF: 0x0000bc00  (0 => OK)
+03 DOUBLE: -2.22507385850720138309e-308 / 0x008010000000000000  (0 => OK)
+03   HALF: 0x00008000  (0x18 =>  UNDERFLOW  INEXACT )
+04 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+04   HALF: 0000000000  (0 => OK)
+05 DOUBLE: 2.22507385850720138309e-308 / 0x000010000000000000  (0 => OK)
+05   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+06 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0 => OK)
+06   HALF: 0x00003c00  (0 => OK)
+07 DOUBLE: 2.00000000000000000000e+00 / 0x004000000000000000  (0 => OK)
+07   HALF: 0x00004000  (0 => OK)
+08 DOUBLE: 2.71828182845904509079e+00 / 0x004005bf0a8b145769  (0 => OK)
+08   HALF: 0x0000416f  (0x10 =>    INEXACT )
+09 DOUBLE: 3.14159265358979311599e+00 / 0x00400921fb54442d18  (0 => OK)
+09   HALF: 0x00004248  (0x10 =>    INEXACT )
+10 DOUBLE: 2.79112157760473600000e+15 / 0x004323d5054450ed00  (0 => OK)
+10   HALF: 0x00007bff  (0x14 => OVERFLOW   INEXACT )
+Converting double-precision to single-precision
+00 DOUBLE: -1.79769313486231570814e+308 / 0x00ffefffffffffffff  (0 => OK)
+00 SINGLE: 4.28657843200000000000e+09 / 0x4f7f7fff  (0x14 => OVERFLOW   INEXACT )
+01 DOUBLE: -2.00000000000000000000e+00 / 0x00c000000000000000  (0 => OK)
+01 SINGLE: 3.22122547200000000000e+09 / 0x4f400000  (0 => OK)
+02 DOUBLE: -1.00000000000000000000e+00 / 0x00bff0000000000000  (0 => OK)
+02 SINGLE: 3.21283686400000000000e+09 / 0x4f3f8000  (0 => OK)
+03 DOUBLE: -2.22507385850720138309e-308 / 0x008010000000000000  (0 => OK)
+03 SINGLE: 2.14748364800000000000e+09 / 0x4f000000  (0x18 =>  UNDERFLOW  INEXACT )
+04 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+04 SINGLE: 0.00000000000000000000e+00 / 0000000000  (0 => OK)
+05 DOUBLE: 2.22507385850720138309e-308 / 0x000010000000000000  (0 => OK)
+05 SINGLE: 0.00000000000000000000e+00 / 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+06 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0 => OK)
+06 SINGLE: 1.06535321600000000000e+09 / 0x4e7e0000  (0 => OK)
+07 DOUBLE: 2.00000000000000000000e+00 / 0x004000000000000000  (0 => OK)
+07 SINGLE: 1.07374182400000000000e+09 / 0x4e800000  (0 => OK)
+08 DOUBLE: 2.71828182845904509079e+00 / 0x004005bf0a8b145769  (0 => OK)
+08 SINGLE: 1.07675443200000000000e+09 / 0x4e805bf0  (0x10 =>    INEXACT )
+09 DOUBLE: 3.14159265358979311599e+00 / 0x00400921fb54442d18  (0 => OK)
+09 SINGLE: 1.07852992000000000000e+09 / 0x4e80921f  (0x10 =>    INEXACT )
+10 DOUBLE: 2.79112157760473600000e+15 / 0x004323d5054450ed00  (0 => OK)
+10 SINGLE: 1.49518131200000000000e+09 / 0x4eb23d50  (0x10 =>    INEXACT )
+Converting half-precision to single-precision
+00   HALF: 0x0000ffff  (0 => OK)
+00 DOUBLE: -nan / 0x00fffffc0000000000  (0 => OK)
+01   HALF: 0x0000fcff  (0 => OK)
+01 DOUBLE: -nan / 0x00fffbfc0000000000  (0x1 =>     INVALID)
+02   HALF: 0x0000fc01  (0 => OK)
+02 DOUBLE: -nan / 0x00fff8040000000000  (0x1 =>     INVALID)
+03   HALF: 0x0000fc00  (0 => OK)
+03 DOUBLE: -inf / 0x00fff0000000000000  (0 => OK)
+04   HALF: 0x0000fbff  (0 => OK)
+04 DOUBLE: -6.55040000000000000000e+04 / 0x00c0effc0000000000  (0 => OK)
+05   HALF: 0x0000c000  (0 => OK)
+05 DOUBLE: -2.00000000000000000000e+00 / 0x00c000000000000000  (0 => OK)
+06   HALF: 0x0000bc00  (0 => OK)
+06 DOUBLE: -1.00000000000000000000e+00 / 0x00bff0000000000000  (0 => OK)
+07   HALF: 0x00008001  (0 => OK)
+07 DOUBLE: -5.96046447753906250000e-08 / 0x00be70000000000000  (0 => OK)
+08   HALF: 0x00008000  (0 => OK)
+08 DOUBLE: -0.00000000000000000000e+00 / 0x008000000000000000  (0 => OK)
+09   HALF: 0000000000  (0 => OK)
+09 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+10   HALF: 0x00000001  (0 => OK)
+10 DOUBLE: 5.96046447753906250000e-08 / 0x003e70000000000000  (0 => OK)
+11   HALF: 0x00003c00  (0 => OK)
+11 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0 => OK)
+12   HALF: 0x00007bff  (0 => OK)
+12 DOUBLE: 6.55040000000000000000e+04 / 0x0040effc0000000000  (0 => OK)
+13   HALF: 0x00007c00  (0 => OK)
+13 DOUBLE: inf / 0x007ff0000000000000  (0 => OK)
+14   HALF: 0x00007c01  (0 => OK)
+14 DOUBLE: nan / 0x007ff8040000000000  (0x1 =>     INVALID)
+15   HALF: 0x00007cff  (0 => OK)
+15 DOUBLE: nan / 0x007ffbfc0000000000  (0x1 =>     INVALID)
+16   HALF: 0x00007fff  (0 => OK)
+16 DOUBLE: nan / 0x007ffffc0000000000  (0 => OK)
+Converting half-precision to double-precision
+00   HALF: 0x0000ffff  (0 => OK)
+00 DOUBLE: -nan / 0x00fffffc0000000000  (0 => OK)
+01   HALF: 0x0000fcff  (0 => OK)
+01 DOUBLE: -nan / 0x00fffbfc0000000000  (0x1 =>     INVALID)
+02   HALF: 0x0000fc01  (0 => OK)
+02 DOUBLE: -nan / 0x00fff8040000000000  (0x1 =>     INVALID)
+03   HALF: 0x0000fc00  (0 => OK)
+03 DOUBLE: -inf / 0x00fff0000000000000  (0 => OK)
+04   HALF: 0x0000fbff  (0 => OK)
+04 DOUBLE: -6.55040000000000000000e+04 / 0x00c0effc0000000000  (0 => OK)
+05   HALF: 0x0000c000  (0 => OK)
+05 DOUBLE: -2.00000000000000000000e+00 / 0x00c000000000000000  (0 => OK)
+06   HALF: 0x0000bc00  (0 => OK)
+06 DOUBLE: -1.00000000000000000000e+00 / 0x00bff0000000000000  (0 => OK)
+07   HALF: 0x00008001  (0 => OK)
+07 DOUBLE: -5.96046447753906250000e-08 / 0x00be70000000000000  (0 => OK)
+08   HALF: 0x00008000  (0 => OK)
+08 DOUBLE: -0.00000000000000000000e+00 / 0x008000000000000000  (0 => OK)
+09   HALF: 0000000000  (0 => OK)
+09 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+10   HALF: 0x00000001  (0 => OK)
+10 DOUBLE: 5.96046447753906250000e-08 / 0x003e70000000000000  (0 => OK)
+11   HALF: 0x00003c00  (0 => OK)
+11 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0 => OK)
+12   HALF: 0x00007bff  (0 => OK)
+12 DOUBLE: 6.55040000000000000000e+04 / 0x0040effc0000000000  (0 => OK)
+13   HALF: 0x00007c00  (0 => OK)
+13 DOUBLE: inf / 0x007ff0000000000000  (0 => OK)
+14   HALF: 0x00007c01  (0 => OK)
+14 DOUBLE: nan / 0x007ff8040000000000  (0x1 =>     INVALID)
+15   HALF: 0x00007cff  (0 => OK)
+15 DOUBLE: nan / 0x007ffbfc0000000000  (0x1 =>     INVALID)
+16   HALF: 0x00007fff  (0 => OK)
+16 DOUBLE: nan / 0x007ffffc0000000000  (0 => OK)
+#### Enabling ARM Alternative Half Precision
+### Rounding to nearest
+Converting single-precision to half-precision
+00 SINGLE: -3.40282346638528859812e+38 / 0xff7fffff  (0 => OK)
+00   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+01 SINGLE: -1.17549435082228750797e-38 / 0x80800000  (0 => OK)
+01   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+02 SINGLE: 0.00000000000000000000e+00 / 0000000000  (0 => OK)
+02   HALF: 0000000000  (0 => OK)
+03 SINGLE: 1.17549435082228750797e-38 / 0x00800000  (0 => OK)
+03   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+04 SINGLE: 1.00000000000000000000e+00 / 0x3f800000  (0 => OK)
+04   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+05 SINGLE: 2.00000000000000000000e+00 / 0x40000000  (0 => OK)
+05   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+06 SINGLE: 2.71828174591064453125e+00 / 0x402df854  (0 => OK)
+06   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+07 SINGLE: 3.14159274101257324219e+00 / 0x40490fdb  (0 => OK)
+07   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+08 SINGLE: 2.66182092800000000000e+09 / 0x4f1ea82a  (0 => OK)
+08   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+09 SINGLE: 2.87892992000000000000e+09 / 0x4f2b98fc  (0 => OK)
+09   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+10 SINGLE: 3.40282346638528859812e+38 / 0x7f7fffff  (0 => OK)
+10   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+Converting single-precision to double-precision
+00 SINGLE: -3.40282346638528859812e+38 / 0xff7fffff  (0 => OK)
+00 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+01 SINGLE: -1.17549435082228750797e-38 / 0x80800000  (0 => OK)
+01 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+02 SINGLE: 0.00000000000000000000e+00 / 0000000000  (0 => OK)
+02 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+03 SINGLE: 1.17549435082228750797e-38 / 0x00800000  (0 => OK)
+03 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+04 SINGLE: 1.00000000000000000000e+00 / 0x3f800000  (0 => OK)
+04 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+05 SINGLE: 2.00000000000000000000e+00 / 0x40000000  (0 => OK)
+05 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+06 SINGLE: 2.71828174591064453125e+00 / 0x402df854  (0 => OK)
+06 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+07 SINGLE: 3.14159274101257324219e+00 / 0x40490fdb  (0 => OK)
+07 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+08 SINGLE: 2.66182092800000000000e+09 / 0x4f1ea82a  (0 => OK)
+08 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+09 SINGLE: 2.87892992000000000000e+09 / 0x4f2b98fc  (0 => OK)
+09 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+10 SINGLE: 3.40282346638528859812e+38 / 0x7f7fffff  (0 => OK)
+10 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+Converting double-precision to half-precision
+00 DOUBLE: -1.79769313486231570815e+308 / 0x00ffefffffffffffff  (0 => OK)
+00   HALF: 0x0000fc00  (0x14 => OVERFLOW   INEXACT )
+01 DOUBLE: -2.00000000000000000000e+00 / 0x00c000000000000000  (0 => OK)
+01   HALF: 0x0000c000  (0 => OK)
+02 DOUBLE: -1.00000000000000000000e+00 / 0x00bff0000000000000  (0 => OK)
+02   HALF: 0x0000bc00  (0 => OK)
+03 DOUBLE: -2.22507385850720138309e-308 / 0x008010000000000000  (0 => OK)
+03   HALF: 0x00008000  (0x18 =>  UNDERFLOW  INEXACT )
+04 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+04   HALF: 0000000000  (0 => OK)
+05 DOUBLE: 2.22507385850720138309e-308 / 0x000010000000000000  (0 => OK)
+05   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+06 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0 => OK)
+06   HALF: 0x00003c00  (0 => OK)
+07 DOUBLE: 2.00000000000000000000e+00 / 0x004000000000000000  (0 => OK)
+07   HALF: 0x00004000  (0 => OK)
+08 DOUBLE: 2.71828182845904509080e+00 / 0x004005bf0a8b145769  (0 => OK)
+08   HALF: 0x00004170  (0x10 =>    INEXACT )
+09 DOUBLE: 3.14159265358979311600e+00 / 0x00400921fb54442d18  (0 => OK)
+09   HALF: 0x00004248  (0x10 =>    INEXACT )
+10 DOUBLE: 2.79112157760473600000e+15 / 0x004323d5054450ed00  (0 => OK)
+10   HALF: 0x00007c00  (0x14 => OVERFLOW   INEXACT )
+Converting double-precision to single-precision
+00 DOUBLE: -1.79769313486231570815e+308 / 0x00ffefffffffffffff  (0 => OK)
+00 SINGLE: 4.28657868800000000000e+09 / 0x4f7f8000  (0x14 => OVERFLOW   INEXACT )
+01 DOUBLE: -2.00000000000000000000e+00 / 0x00c000000000000000  (0 => OK)
+01 SINGLE: 3.22122547200000000000e+09 / 0x4f400000  (0 => OK)
+02 DOUBLE: -1.00000000000000000000e+00 / 0x00bff0000000000000  (0 => OK)
+02 SINGLE: 3.21283686400000000000e+09 / 0x4f3f8000  (0 => OK)
+03 DOUBLE: -2.22507385850720138309e-308 / 0x008010000000000000  (0 => OK)
+03 SINGLE: 2.14748364800000000000e+09 / 0x4f000000  (0x18 =>  UNDERFLOW  INEXACT )
+04 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+04 SINGLE: 0.00000000000000000000e+00 / 0000000000  (0 => OK)
+05 DOUBLE: 2.22507385850720138309e-308 / 0x000010000000000000  (0 => OK)
+05 SINGLE: 0.00000000000000000000e+00 / 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+06 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0 => OK)
+06 SINGLE: 1.06535321600000000000e+09 / 0x4e7e0000  (0 => OK)
+07 DOUBLE: 2.00000000000000000000e+00 / 0x004000000000000000  (0 => OK)
+07 SINGLE: 1.07374182400000000000e+09 / 0x4e800000  (0 => OK)
+08 DOUBLE: 2.71828182845904509080e+00 / 0x004005bf0a8b145769  (0 => OK)
+08 SINGLE: 1.07675456000000000000e+09 / 0x4e805bf1  (0x10 =>    INEXACT )
+09 DOUBLE: 3.14159265358979311600e+00 / 0x00400921fb54442d18  (0 => OK)
+09 SINGLE: 1.07853004800000000000e+09 / 0x4e809220  (0x10 =>    INEXACT )
+10 DOUBLE: 2.79112157760473600000e+15 / 0x004323d5054450ed00  (0 => OK)
+10 SINGLE: 1.49518131200000000000e+09 / 0x4eb23d50  (0x10 =>    INEXACT )
+Converting half-precision to single-precision
+00   HALF: 0x0000ffff  (0 => OK)
+00 DOUBLE: -nan / 0x00fffffc0000000000  (0 => OK)
+01   HALF: 0x0000fcff  (0 => OK)
+01 DOUBLE: -nan / 0x00fffbfc0000000000  (0x1 =>     INVALID)
+02   HALF: 0x0000fc01  (0 => OK)
+02 DOUBLE: -nan / 0x00fff8040000000000  (0x1 =>     INVALID)
+03   HALF: 0x0000fc00  (0 => OK)
+03 DOUBLE: -inf / 0x00fff0000000000000  (0 => OK)
+04   HALF: 0x0000fbff  (0 => OK)
+04 DOUBLE: -6.55040000000000000000e+04 / 0x00c0effc0000000000  (0 => OK)
+05   HALF: 0x0000c000  (0 => OK)
+05 DOUBLE: -2.00000000000000000000e+00 / 0x00c000000000000000  (0 => OK)
+06   HALF: 0x0000bc00  (0 => OK)
+06 DOUBLE: -1.00000000000000000000e+00 / 0x00bff0000000000000  (0 => OK)
+07   HALF: 0x00008001  (0 => OK)
+07 DOUBLE: -5.96046447753906250000e-08 / 0x00be70000000000000  (0 => OK)
+08   HALF: 0x00008000  (0 => OK)
+08 DOUBLE: -0.00000000000000000000e+00 / 0x008000000000000000  (0 => OK)
+09   HALF: 0000000000  (0 => OK)
+09 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+10   HALF: 0x00000001  (0 => OK)
+10 DOUBLE: 5.96046447753906250000e-08 / 0x003e70000000000000  (0 => OK)
+11   HALF: 0x00003c00  (0 => OK)
+11 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0 => OK)
+12   HALF: 0x00007bff  (0 => OK)
+12 DOUBLE: 6.55040000000000000000e+04 / 0x0040effc0000000000  (0 => OK)
+13   HALF: 0x00007c00  (0 => OK)
+13 DOUBLE: inf / 0x007ff0000000000000  (0 => OK)
+14   HALF: 0x00007c01  (0 => OK)
+14 DOUBLE: nan / 0x007ff8040000000000  (0x1 =>     INVALID)
+15   HALF: 0x00007cff  (0 => OK)
+15 DOUBLE: nan / 0x007ffbfc0000000000  (0x1 =>     INVALID)
+16   HALF: 0x00007fff  (0 => OK)
+16 DOUBLE: nan / 0x007ffffc0000000000  (0 => OK)
+Converting half-precision to double-precision
+00   HALF: 0x0000ffff  (0 => OK)
+00 DOUBLE: -nan / 0x00fffffc0000000000  (0 => OK)
+01   HALF: 0x0000fcff  (0 => OK)
+01 DOUBLE: -nan / 0x00fffbfc0000000000  (0x1 =>     INVALID)
+02   HALF: 0x0000fc01  (0 => OK)
+02 DOUBLE: -nan / 0x00fff8040000000000  (0x1 =>     INVALID)
+03   HALF: 0x0000fc00  (0 => OK)
+03 DOUBLE: -inf / 0x00fff0000000000000  (0 => OK)
+04   HALF: 0x0000fbff  (0 => OK)
+04 DOUBLE: -6.55040000000000000000e+04 / 0x00c0effc0000000000  (0 => OK)
+05   HALF: 0x0000c000  (0 => OK)
+05 DOUBLE: -2.00000000000000000000e+00 / 0x00c000000000000000  (0 => OK)
+06   HALF: 0x0000bc00  (0 => OK)
+06 DOUBLE: -1.00000000000000000000e+00 / 0x00bff0000000000000  (0 => OK)
+07   HALF: 0x00008001  (0 => OK)
+07 DOUBLE: -5.96046447753906250000e-08 / 0x00be70000000000000  (0 => OK)
+08   HALF: 0x00008000  (0 => OK)
+08 DOUBLE: -0.00000000000000000000e+00 / 0x008000000000000000  (0 => OK)
+09   HALF: 0000000000  (0 => OK)
+09 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+10   HALF: 0x00000001  (0 => OK)
+10 DOUBLE: 5.96046447753906250000e-08 / 0x003e70000000000000  (0 => OK)
+11   HALF: 0x00003c00  (0 => OK)
+11 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0 => OK)
+12   HALF: 0x00007bff  (0 => OK)
+12 DOUBLE: 6.55040000000000000000e+04 / 0x0040effc0000000000  (0 => OK)
+13   HALF: 0x00007c00  (0 => OK)
+13 DOUBLE: inf / 0x007ff0000000000000  (0 => OK)
+14   HALF: 0x00007c01  (0 => OK)
+14 DOUBLE: nan / 0x007ff8040000000000  (0x1 =>     INVALID)
+15   HALF: 0x00007cff  (0 => OK)
+15 DOUBLE: nan / 0x007ffbfc0000000000  (0x1 =>     INVALID)
+16   HALF: 0x00007fff  (0 => OK)
+16 DOUBLE: nan / 0x007ffffc0000000000  (0 => OK)
+### Rounding upwards
+Converting single-precision to half-precision
+00 SINGLE: -3.40282346638528859811e+38 / 0xff7fffff  (0 => OK)
+00   HALF: 0x00000001  (0x18 =>  UNDERFLOW  INEXACT )
+01 SINGLE: -1.17549435082228750796e-38 / 0x80800000  (0 => OK)
+01   HALF: 0x00000001  (0x18 =>  UNDERFLOW  INEXACT )
+02 SINGLE: 0.00000000000000000000e+00 / 0000000000  (0 => OK)
+02   HALF: 0000000000  (0 => OK)
+03 SINGLE: 1.17549435082228750797e-38 / 0x00800000  (0 => OK)
+03   HALF: 0x00000001  (0x18 =>  UNDERFLOW  INEXACT )
+04 SINGLE: 1.00000000000000000000e+00 / 0x3f800000  (0 => OK)
+04   HALF: 0x00000001  (0x18 =>  UNDERFLOW  INEXACT )
+05 SINGLE: 2.00000000000000000000e+00 / 0x40000000  (0 => OK)
+05   HALF: 0x00000001  (0x18 =>  UNDERFLOW  INEXACT )
+06 SINGLE: 2.71828174591064453125e+00 / 0x402df854  (0 => OK)
+06   HALF: 0x00000001  (0x18 =>  UNDERFLOW  INEXACT )
+07 SINGLE: 3.14159274101257324219e+00 / 0x40490fdb  (0 => OK)
+07   HALF: 0x00000001  (0x18 =>  UNDERFLOW  INEXACT )
+08 SINGLE: 2.66182092800000000000e+09 / 0x4f1ea82a  (0 => OK)
+08   HALF: 0x00000001  (0x18 =>  UNDERFLOW  INEXACT )
+09 SINGLE: 2.87892992000000000000e+09 / 0x4f2b98fc  (0 => OK)
+09   HALF: 0x00000001  (0x18 =>  UNDERFLOW  INEXACT )
+10 SINGLE: 3.40282346638528859812e+38 / 0x7f7fffff  (0 => OK)
+10   HALF: 0x00000001  (0x18 =>  UNDERFLOW  INEXACT )
+Converting single-precision to double-precision
+00 SINGLE: -3.40282346638528859811e+38 / 0xff7fffff  (0 => OK)
+00 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+01 SINGLE: -1.17549435082228750796e-38 / 0x80800000  (0 => OK)
+01 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+02 SINGLE: 0.00000000000000000000e+00 / 0000000000  (0 => OK)
+02 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+03 SINGLE: 1.17549435082228750797e-38 / 0x00800000  (0 => OK)
+03 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+04 SINGLE: 1.00000000000000000000e+00 / 0x3f800000  (0 => OK)
+04 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+05 SINGLE: 2.00000000000000000000e+00 / 0x40000000  (0 => OK)
+05 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+06 SINGLE: 2.71828174591064453125e+00 / 0x402df854  (0 => OK)
+06 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+07 SINGLE: 3.14159274101257324219e+00 / 0x40490fdb  (0 => OK)
+07 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+08 SINGLE: 2.66182092800000000000e+09 / 0x4f1ea82a  (0 => OK)
+08 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+09 SINGLE: 2.87892992000000000000e+09 / 0x4f2b98fc  (0 => OK)
+09 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+10 SINGLE: 3.40282346638528859812e+38 / 0x7f7fffff  (0 => OK)
+10 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+Converting double-precision to half-precision
+00 DOUBLE: -1.79769313486231570814e+308 / 0x00ffefffffffffffff  (0 => OK)
+00   HALF: 0x0000fbff  (0x14 => OVERFLOW   INEXACT )
+01 DOUBLE: -2.00000000000000000000e+00 / 0x00c000000000000000  (0 => OK)
+01   HALF: 0x0000c000  (0 => OK)
+02 DOUBLE: -1.00000000000000000000e+00 / 0x00bff0000000000000  (0 => OK)
+02   HALF: 0x0000bc00  (0 => OK)
+03 DOUBLE: -2.22507385850720138309e-308 / 0x008010000000000000  (0 => OK)
+03   HALF: 0x00008000  (0x18 =>  UNDERFLOW  INEXACT )
+04 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+04   HALF: 0000000000  (0 => OK)
+05 DOUBLE: 2.22507385850720138310e-308 / 0x000010000000000000  (0 => OK)
+05   HALF: 0x00000001  (0x18 =>  UNDERFLOW  INEXACT )
+06 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0 => OK)
+06   HALF: 0x00003c00  (0 => OK)
+07 DOUBLE: 2.00000000000000000000e+00 / 0x004000000000000000  (0 => OK)
+07   HALF: 0x00004000  (0 => OK)
+08 DOUBLE: 2.71828182845904509080e+00 / 0x004005bf0a8b145769  (0 => OK)
+08   HALF: 0x00004170  (0x10 =>    INEXACT )
+09 DOUBLE: 3.14159265358979311600e+00 / 0x00400921fb54442d18  (0 => OK)
+09   HALF: 0x00004249  (0x10 =>    INEXACT )
+10 DOUBLE: 2.79112157760473600000e+15 / 0x004323d5054450ed00  (0 => OK)
+10   HALF: 0x00007c00  (0x14 => OVERFLOW   INEXACT )
+Converting double-precision to single-precision
+00 DOUBLE: -1.79769313486231570814e+308 / 0x00ffefffffffffffff  (0 => OK)
+00 SINGLE: 4.28657868800000000000e+09 / 0x4f7f8000  (0x14 => OVERFLOW   INEXACT )
+01 DOUBLE: -2.00000000000000000000e+00 / 0x00c000000000000000  (0 => OK)
+01 SINGLE: 3.22122547200000000000e+09 / 0x4f400000  (0 => OK)
+02 DOUBLE: -1.00000000000000000000e+00 / 0x00bff0000000000000  (0 => OK)
+02 SINGLE: 3.21283686400000000000e+09 / 0x4f3f8000  (0 => OK)
+03 DOUBLE: -2.22507385850720138309e-308 / 0x008010000000000000  (0 => OK)
+03 SINGLE: 2.14748364800000000000e+09 / 0x4f000000  (0x18 =>  UNDERFLOW  INEXACT )
+04 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+04 SINGLE: 0.00000000000000000000e+00 / 0000000000  (0 => OK)
+05 DOUBLE: 2.22507385850720138310e-308 / 0x000010000000000000  (0 => OK)
+05 SINGLE: 1.00000000000000000000e+00 / 0x3f800000  (0x18 =>  UNDERFLOW  INEXACT )
+06 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0 => OK)
+06 SINGLE: 1.06535321600000000000e+09 / 0x4e7e0000  (0 => OK)
+07 DOUBLE: 2.00000000000000000000e+00 / 0x004000000000000000  (0 => OK)
+07 SINGLE: 1.07374182400000000000e+09 / 0x4e800000  (0 => OK)
+08 DOUBLE: 2.71828182845904509080e+00 / 0x004005bf0a8b145769  (0 => OK)
+08 SINGLE: 1.07675456000000000000e+09 / 0x4e805bf1  (0x10 =>    INEXACT )
+09 DOUBLE: 3.14159265358979311600e+00 / 0x00400921fb54442d18  (0 => OK)
+09 SINGLE: 1.07853004800000000000e+09 / 0x4e809220  (0x10 =>    INEXACT )
+10 DOUBLE: 2.79112157760473600000e+15 / 0x004323d5054450ed00  (0 => OK)
+10 SINGLE: 1.49518144000000000000e+09 / 0x4eb23d51  (0x10 =>    INEXACT )
+Converting half-precision to single-precision
+00   HALF: 0x0000ffff  (0 => OK)
+00 DOUBLE: -nan / 0x00fffffc0000000000  (0 => OK)
+01   HALF: 0x0000fcff  (0 => OK)
+01 DOUBLE: -nan / 0x00fffbfc0000000000  (0x1 =>     INVALID)
+02   HALF: 0x0000fc01  (0 => OK)
+02 DOUBLE: -nan / 0x00fff8040000000000  (0x1 =>     INVALID)
+03   HALF: 0x0000fc00  (0 => OK)
+03 DOUBLE: -inf / 0x00fff0000000000000  (0 => OK)
+04   HALF: 0x0000fbff  (0 => OK)
+04 DOUBLE: -6.55040000000000000000e+04 / 0x00c0effc0000000000  (0 => OK)
+05   HALF: 0x0000c000  (0 => OK)
+05 DOUBLE: -2.00000000000000000000e+00 / 0x00c000000000000000  (0 => OK)
+06   HALF: 0x0000bc00  (0 => OK)
+06 DOUBLE: -1.00000000000000000000e+00 / 0x00bff0000000000000  (0 => OK)
+07   HALF: 0x00008001  (0 => OK)
+07 DOUBLE: -5.96046447753906250000e-08 / 0x00be70000000000000  (0 => OK)
+08   HALF: 0x00008000  (0 => OK)
+08 DOUBLE: -0.00000000000000000000e+00 / 0x008000000000000000  (0 => OK)
+09   HALF: 0000000000  (0 => OK)
+09 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+10   HALF: 0x00000001  (0 => OK)
+10 DOUBLE: 5.96046447753906250000e-08 / 0x003e70000000000000  (0 => OK)
+11   HALF: 0x00003c00  (0 => OK)
+11 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0 => OK)
+12   HALF: 0x00007bff  (0 => OK)
+12 DOUBLE: 6.55040000000000000000e+04 / 0x0040effc0000000000  (0 => OK)
+13   HALF: 0x00007c00  (0 => OK)
+13 DOUBLE: inf / 0x007ff0000000000000  (0 => OK)
+14   HALF: 0x00007c01  (0 => OK)
+14 DOUBLE: nan / 0x007ff8040000000000  (0x1 =>     INVALID)
+15   HALF: 0x00007cff  (0 => OK)
+15 DOUBLE: nan / 0x007ffbfc0000000000  (0x1 =>     INVALID)
+16   HALF: 0x00007fff  (0 => OK)
+16 DOUBLE: nan / 0x007ffffc0000000000  (0 => OK)
+Converting half-precision to double-precision
+00   HALF: 0x0000ffff  (0 => OK)
+00 DOUBLE: -nan / 0x00fffffc0000000000  (0 => OK)
+01   HALF: 0x0000fcff  (0 => OK)
+01 DOUBLE: -nan / 0x00fffbfc0000000000  (0x1 =>     INVALID)
+02   HALF: 0x0000fc01  (0 => OK)
+02 DOUBLE: -nan / 0x00fff8040000000000  (0x1 =>     INVALID)
+03   HALF: 0x0000fc00  (0 => OK)
+03 DOUBLE: -inf / 0x00fff0000000000000  (0 => OK)
+04   HALF: 0x0000fbff  (0 => OK)
+04 DOUBLE: -6.55040000000000000000e+04 / 0x00c0effc0000000000  (0 => OK)
+05   HALF: 0x0000c000  (0 => OK)
+05 DOUBLE: -2.00000000000000000000e+00 / 0x00c000000000000000  (0 => OK)
+06   HALF: 0x0000bc00  (0 => OK)
+06 DOUBLE: -1.00000000000000000000e+00 / 0x00bff0000000000000  (0 => OK)
+07   HALF: 0x00008001  (0 => OK)
+07 DOUBLE: -5.96046447753906250000e-08 / 0x00be70000000000000  (0 => OK)
+08   HALF: 0x00008000  (0 => OK)
+08 DOUBLE: -0.00000000000000000000e+00 / 0x008000000000000000  (0 => OK)
+09   HALF: 0000000000  (0 => OK)
+09 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+10   HALF: 0x00000001  (0 => OK)
+10 DOUBLE: 5.96046447753906250000e-08 / 0x003e70000000000000  (0 => OK)
+11   HALF: 0x00003c00  (0 => OK)
+11 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0 => OK)
+12   HALF: 0x00007bff  (0 => OK)
+12 DOUBLE: 6.55040000000000000000e+04 / 0x0040effc0000000000  (0 => OK)
+13   HALF: 0x00007c00  (0 => OK)
+13 DOUBLE: inf / 0x007ff0000000000000  (0 => OK)
+14   HALF: 0x00007c01  (0 => OK)
+14 DOUBLE: nan / 0x007ff8040000000000  (0x1 =>     INVALID)
+15   HALF: 0x00007cff  (0 => OK)
+15 DOUBLE: nan / 0x007ffbfc0000000000  (0x1 =>     INVALID)
+16   HALF: 0x00007fff  (0 => OK)
+16 DOUBLE: nan / 0x007ffffc0000000000  (0 => OK)
+### Rounding downwards
+Converting single-precision to half-precision
+00 SINGLE: -3.40282346638528859812e+38 / 0xff7fffff  (0 => OK)
+00   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+01 SINGLE: -1.17549435082228750797e-38 / 0x80800000  (0 => OK)
+01   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+02 SINGLE: 0.00000000000000000000e+00 / 0000000000  (0 => OK)
+02   HALF: 0000000000  (0 => OK)
+03 SINGLE: 1.17549435082228750796e-38 / 0x00800000  (0 => OK)
+03   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+04 SINGLE: 1.00000000000000000000e+00 / 0x3f800000  (0 => OK)
+04   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+05 SINGLE: 2.00000000000000000000e+00 / 0x40000000  (0 => OK)
+05   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+06 SINGLE: 2.71828174591064453125e+00 / 0x402df854  (0 => OK)
+06   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+07 SINGLE: 3.14159274101257324218e+00 / 0x40490fdb  (0 => OK)
+07   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+08 SINGLE: 2.66182092800000000000e+09 / 0x4f1ea82a  (0 => OK)
+08   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+09 SINGLE: 2.87892992000000000000e+09 / 0x4f2b98fc  (0 => OK)
+09   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+10 SINGLE: 3.40282346638528859811e+38 / 0x7f7fffff  (0 => OK)
+10   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+Converting single-precision to double-precision
+00 SINGLE: -3.40282346638528859812e+38 / 0xff7fffff  (0 => OK)
+00 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+01 SINGLE: -1.17549435082228750797e-38 / 0x80800000  (0 => OK)
+01 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+02 SINGLE: 0.00000000000000000000e+00 / 0000000000  (0 => OK)
+02 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+03 SINGLE: 1.17549435082228750796e-38 / 0x00800000  (0 => OK)
+03 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+04 SINGLE: 1.00000000000000000000e+00 / 0x3f800000  (0 => OK)
+04 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+05 SINGLE: 2.00000000000000000000e+00 / 0x40000000  (0 => OK)
+05 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+06 SINGLE: 2.71828174591064453125e+00 / 0x402df854  (0 => OK)
+06 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+07 SINGLE: 3.14159274101257324218e+00 / 0x40490fdb  (0 => OK)
+07 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+08 SINGLE: 2.66182092800000000000e+09 / 0x4f1ea82a  (0 => OK)
+08 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+09 SINGLE: 2.87892992000000000000e+09 / 0x4f2b98fc  (0 => OK)
+09 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+10 SINGLE: 3.40282346638528859811e+38 / 0x7f7fffff  (0 => OK)
+10 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+Converting double-precision to half-precision
+00 DOUBLE: -1.79769313486231570815e+308 / 0x00ffefffffffffffff  (0 => OK)
+00   HALF: 0x0000fc00  (0x14 => OVERFLOW   INEXACT )
+01 DOUBLE: -2.00000000000000000000e+00 / 0x00c000000000000000  (0 => OK)
+01   HALF: 0x0000c000  (0 => OK)
+02 DOUBLE: -1.00000000000000000000e+00 / 0x00bff0000000000000  (0 => OK)
+02   HALF: 0x0000bc00  (0 => OK)
+03 DOUBLE: -2.22507385850720138310e-308 / 0x008010000000000000  (0 => OK)
+03   HALF: 0x00008001  (0x18 =>  UNDERFLOW  INEXACT )
+04 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+04   HALF: 0000000000  (0 => OK)
+05 DOUBLE: 2.22507385850720138309e-308 / 0x000010000000000000  (0 => OK)
+05   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+06 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0 => OK)
+06   HALF: 0x00003c00  (0 => OK)
+07 DOUBLE: 2.00000000000000000000e+00 / 0x004000000000000000  (0 => OK)
+07   HALF: 0x00004000  (0 => OK)
+08 DOUBLE: 2.71828182845904509079e+00 / 0x004005bf0a8b145769  (0 => OK)
+08   HALF: 0x0000416f  (0x10 =>    INEXACT )
+09 DOUBLE: 3.14159265358979311599e+00 / 0x00400921fb54442d18  (0 => OK)
+09   HALF: 0x00004248  (0x10 =>    INEXACT )
+10 DOUBLE: 2.79112157760473600000e+15 / 0x004323d5054450ed00  (0 => OK)
+10   HALF: 0x00007bff  (0x14 => OVERFLOW   INEXACT )
+Converting double-precision to single-precision
+00 DOUBLE: -1.79769313486231570815e+308 / 0x00ffefffffffffffff  (0 => OK)
+00 SINGLE: 4.28657868800000000000e+09 / 0x4f7f8000  (0x14 => OVERFLOW   INEXACT )
+01 DOUBLE: -2.00000000000000000000e+00 / 0x00c000000000000000  (0 => OK)
+01 SINGLE: 3.22122547200000000000e+09 / 0x4f400000  (0 => OK)
+02 DOUBLE: -1.00000000000000000000e+00 / 0x00bff0000000000000  (0 => OK)
+02 SINGLE: 3.21283686400000000000e+09 / 0x4f3f8000  (0 => OK)
+03 DOUBLE: -2.22507385850720138310e-308 / 0x008010000000000000  (0 => OK)
+03 SINGLE: 2.14748364800000000000e+09 / 0x4f000000  (0x18 =>  UNDERFLOW  INEXACT )
+04 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+04 SINGLE: 0.00000000000000000000e+00 / 0000000000  (0 => OK)
+05 DOUBLE: 2.22507385850720138309e-308 / 0x000010000000000000  (0 => OK)
+05 SINGLE: 0.00000000000000000000e+00 / 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+06 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0 => OK)
+06 SINGLE: 1.06535321600000000000e+09 / 0x4e7e0000  (0 => OK)
+07 DOUBLE: 2.00000000000000000000e+00 / 0x004000000000000000  (0 => OK)
+07 SINGLE: 1.07374182400000000000e+09 / 0x4e800000  (0 => OK)
+08 DOUBLE: 2.71828182845904509079e+00 / 0x004005bf0a8b145769  (0 => OK)
+08 SINGLE: 1.07675443200000000000e+09 / 0x4e805bf0  (0x10 =>    INEXACT )
+09 DOUBLE: 3.14159265358979311599e+00 / 0x00400921fb54442d18  (0 => OK)
+09 SINGLE: 1.07852992000000000000e+09 / 0x4e80921f  (0x10 =>    INEXACT )
+10 DOUBLE: 2.79112157760473600000e+15 / 0x004323d5054450ed00  (0 => OK)
+10 SINGLE: 1.49518131200000000000e+09 / 0x4eb23d50  (0x10 =>    INEXACT )
+Converting half-precision to single-precision
+00   HALF: 0x0000ffff  (0 => OK)
+00 DOUBLE: -nan / 0x00fffffc0000000000  (0 => OK)
+01   HALF: 0x0000fcff  (0 => OK)
+01 DOUBLE: -nan / 0x00fffbfc0000000000  (0x1 =>     INVALID)
+02   HALF: 0x0000fc01  (0 => OK)
+02 DOUBLE: -nan / 0x00fff8040000000000  (0x1 =>     INVALID)
+03   HALF: 0x0000fc00  (0 => OK)
+03 DOUBLE: -inf / 0x00fff0000000000000  (0 => OK)
+04   HALF: 0x0000fbff  (0 => OK)
+04 DOUBLE: -6.55040000000000000000e+04 / 0x00c0effc0000000000  (0 => OK)
+05   HALF: 0x0000c000  (0 => OK)
+05 DOUBLE: -2.00000000000000000000e+00 / 0x00c000000000000000  (0 => OK)
+06   HALF: 0x0000bc00  (0 => OK)
+06 DOUBLE: -1.00000000000000000000e+00 / 0x00bff0000000000000  (0 => OK)
+07   HALF: 0x00008001  (0 => OK)
+07 DOUBLE: -5.96046447753906250000e-08 / 0x00be70000000000000  (0 => OK)
+08   HALF: 0x00008000  (0 => OK)
+08 DOUBLE: -0.00000000000000000000e+00 / 0x008000000000000000  (0 => OK)
+09   HALF: 0000000000  (0 => OK)
+09 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+10   HALF: 0x00000001  (0 => OK)
+10 DOUBLE: 5.96046447753906250000e-08 / 0x003e70000000000000  (0 => OK)
+11   HALF: 0x00003c00  (0 => OK)
+11 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0 => OK)
+12   HALF: 0x00007bff  (0 => OK)
+12 DOUBLE: 6.55040000000000000000e+04 / 0x0040effc0000000000  (0 => OK)
+13   HALF: 0x00007c00  (0 => OK)
+13 DOUBLE: inf / 0x007ff0000000000000  (0 => OK)
+14   HALF: 0x00007c01  (0 => OK)
+14 DOUBLE: nan / 0x007ff8040000000000  (0x1 =>     INVALID)
+15   HALF: 0x00007cff  (0 => OK)
+15 DOUBLE: nan / 0x007ffbfc0000000000  (0x1 =>     INVALID)
+16   HALF: 0x00007fff  (0 => OK)
+16 DOUBLE: nan / 0x007ffffc0000000000  (0 => OK)
+Converting half-precision to double-precision
+00   HALF: 0x0000ffff  (0 => OK)
+00 DOUBLE: -nan / 0x00fffffc0000000000  (0 => OK)
+01   HALF: 0x0000fcff  (0 => OK)
+01 DOUBLE: -nan / 0x00fffbfc0000000000  (0x1 =>     INVALID)
+02   HALF: 0x0000fc01  (0 => OK)
+02 DOUBLE: -nan / 0x00fff8040000000000  (0x1 =>     INVALID)
+03   HALF: 0x0000fc00  (0 => OK)
+03 DOUBLE: -inf / 0x00fff0000000000000  (0 => OK)
+04   HALF: 0x0000fbff  (0 => OK)
+04 DOUBLE: -6.55040000000000000000e+04 / 0x00c0effc0000000000  (0 => OK)
+05   HALF: 0x0000c000  (0 => OK)
+05 DOUBLE: -2.00000000000000000000e+00 / 0x00c000000000000000  (0 => OK)
+06   HALF: 0x0000bc00  (0 => OK)
+06 DOUBLE: -1.00000000000000000000e+00 / 0x00bff0000000000000  (0 => OK)
+07   HALF: 0x00008001  (0 => OK)
+07 DOUBLE: -5.96046447753906250000e-08 / 0x00be70000000000000  (0 => OK)
+08   HALF: 0x00008000  (0 => OK)
+08 DOUBLE: -0.00000000000000000000e+00 / 0x008000000000000000  (0 => OK)
+09   HALF: 0000000000  (0 => OK)
+09 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+10   HALF: 0x00000001  (0 => OK)
+10 DOUBLE: 5.96046447753906250000e-08 / 0x003e70000000000000  (0 => OK)
+11   HALF: 0x00003c00  (0 => OK)
+11 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0 => OK)
+12   HALF: 0x00007bff  (0 => OK)
+12 DOUBLE: 6.55040000000000000000e+04 / 0x0040effc0000000000  (0 => OK)
+13   HALF: 0x00007c00  (0 => OK)
+13 DOUBLE: inf / 0x007ff0000000000000  (0 => OK)
+14   HALF: 0x00007c01  (0 => OK)
+14 DOUBLE: nan / 0x007ff8040000000000  (0x1 =>     INVALID)
+15   HALF: 0x00007cff  (0 => OK)
+15 DOUBLE: nan / 0x007ffbfc0000000000  (0x1 =>     INVALID)
+16   HALF: 0x00007fff  (0 => OK)
+16 DOUBLE: nan / 0x007ffffc0000000000  (0 => OK)
+### Rounding to zero
+Converting single-precision to half-precision
+00 SINGLE: -3.40282346638528859811e+38 / 0xff7fffff  (0 => OK)
+00   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+01 SINGLE: -1.17549435082228750796e-38 / 0x80800000  (0 => OK)
+01   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+02 SINGLE: 0.00000000000000000000e+00 / 0000000000  (0 => OK)
+02   HALF: 0000000000  (0 => OK)
+03 SINGLE: 1.17549435082228750796e-38 / 0x00800000  (0 => OK)
+03   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+04 SINGLE: 1.00000000000000000000e+00 / 0x3f800000  (0 => OK)
+04   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+05 SINGLE: 2.00000000000000000000e+00 / 0x40000000  (0 => OK)
+05   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+06 SINGLE: 2.71828174591064453125e+00 / 0x402df854  (0 => OK)
+06   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+07 SINGLE: 3.14159274101257324218e+00 / 0x40490fdb  (0 => OK)
+07   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+08 SINGLE: 2.66182092800000000000e+09 / 0x4f1ea82a  (0 => OK)
+08   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+09 SINGLE: 2.87892992000000000000e+09 / 0x4f2b98fc  (0 => OK)
+09   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+10 SINGLE: 3.40282346638528859811e+38 / 0x7f7fffff  (0 => OK)
+10   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+Converting single-precision to double-precision
+00 SINGLE: -3.40282346638528859811e+38 / 0xff7fffff  (0 => OK)
+00 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+01 SINGLE: -1.17549435082228750796e-38 / 0x80800000  (0 => OK)
+01 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+02 SINGLE: 0.00000000000000000000e+00 / 0000000000  (0 => OK)
+02 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+03 SINGLE: 1.17549435082228750796e-38 / 0x00800000  (0 => OK)
+03 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+04 SINGLE: 1.00000000000000000000e+00 / 0x3f800000  (0 => OK)
+04 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+05 SINGLE: 2.00000000000000000000e+00 / 0x40000000  (0 => OK)
+05 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+06 SINGLE: 2.71828174591064453125e+00 / 0x402df854  (0 => OK)
+06 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+07 SINGLE: 3.14159274101257324218e+00 / 0x40490fdb  (0 => OK)
+07 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+08 SINGLE: 2.66182092800000000000e+09 / 0x4f1ea82a  (0 => OK)
+08 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+09 SINGLE: 2.87892992000000000000e+09 / 0x4f2b98fc  (0 => OK)
+09 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+10 SINGLE: 3.40282346638528859811e+38 / 0x7f7fffff  (0 => OK)
+10 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0x18 =>  UNDERFLOW  INEXACT )
+Converting double-precision to half-precision
+00 DOUBLE: -1.79769313486231570814e+308 / 0x00ffefffffffffffff  (0 => OK)
+00   HALF: 0x0000fbff  (0x14 => OVERFLOW   INEXACT )
+01 DOUBLE: -2.00000000000000000000e+00 / 0x00c000000000000000  (0 => OK)
+01   HALF: 0x0000c000  (0 => OK)
+02 DOUBLE: -1.00000000000000000000e+00 / 0x00bff0000000000000  (0 => OK)
+02   HALF: 0x0000bc00  (0 => OK)
+03 DOUBLE: -2.22507385850720138309e-308 / 0x008010000000000000  (0 => OK)
+03   HALF: 0x00008000  (0x18 =>  UNDERFLOW  INEXACT )
+04 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+04   HALF: 0000000000  (0 => OK)
+05 DOUBLE: 2.22507385850720138309e-308 / 0x000010000000000000  (0 => OK)
+05   HALF: 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+06 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0 => OK)
+06   HALF: 0x00003c00  (0 => OK)
+07 DOUBLE: 2.00000000000000000000e+00 / 0x004000000000000000  (0 => OK)
+07   HALF: 0x00004000  (0 => OK)
+08 DOUBLE: 2.71828182845904509079e+00 / 0x004005bf0a8b145769  (0 => OK)
+08   HALF: 0x0000416f  (0x10 =>    INEXACT )
+09 DOUBLE: 3.14159265358979311599e+00 / 0x00400921fb54442d18  (0 => OK)
+09   HALF: 0x00004248  (0x10 =>    INEXACT )
+10 DOUBLE: 2.79112157760473600000e+15 / 0x004323d5054450ed00  (0 => OK)
+10   HALF: 0x00007bff  (0x14 => OVERFLOW   INEXACT )
+Converting double-precision to single-precision
+00 DOUBLE: -1.79769313486231570814e+308 / 0x00ffefffffffffffff  (0 => OK)
+00 SINGLE: 4.28657843200000000000e+09 / 0x4f7f7fff  (0x14 => OVERFLOW   INEXACT )
+01 DOUBLE: -2.00000000000000000000e+00 / 0x00c000000000000000  (0 => OK)
+01 SINGLE: 3.22122547200000000000e+09 / 0x4f400000  (0 => OK)
+02 DOUBLE: -1.00000000000000000000e+00 / 0x00bff0000000000000  (0 => OK)
+02 SINGLE: 3.21283686400000000000e+09 / 0x4f3f8000  (0 => OK)
+03 DOUBLE: -2.22507385850720138309e-308 / 0x008010000000000000  (0 => OK)
+03 SINGLE: 2.14748364800000000000e+09 / 0x4f000000  (0x18 =>  UNDERFLOW  INEXACT )
+04 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+04 SINGLE: 0.00000000000000000000e+00 / 0000000000  (0 => OK)
+05 DOUBLE: 2.22507385850720138309e-308 / 0x000010000000000000  (0 => OK)
+05 SINGLE: 0.00000000000000000000e+00 / 0000000000  (0x18 =>  UNDERFLOW  INEXACT )
+06 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0 => OK)
+06 SINGLE: 1.06535321600000000000e+09 / 0x4e7e0000  (0 => OK)
+07 DOUBLE: 2.00000000000000000000e+00 / 0x004000000000000000  (0 => OK)
+07 SINGLE: 1.07374182400000000000e+09 / 0x4e800000  (0 => OK)
+08 DOUBLE: 2.71828182845904509079e+00 / 0x004005bf0a8b145769  (0 => OK)
+08 SINGLE: 1.07675443200000000000e+09 / 0x4e805bf0  (0x10 =>    INEXACT )
+09 DOUBLE: 3.14159265358979311599e+00 / 0x00400921fb54442d18  (0 => OK)
+09 SINGLE: 1.07852992000000000000e+09 / 0x4e80921f  (0x10 =>    INEXACT )
+10 DOUBLE: 2.79112157760473600000e+15 / 0x004323d5054450ed00  (0 => OK)
+10 SINGLE: 1.49518131200000000000e+09 / 0x4eb23d50  (0x10 =>    INEXACT )
+Converting half-precision to single-precision
+00   HALF: 0x0000ffff  (0 => OK)
+00 DOUBLE: -nan / 0x00fffffc0000000000  (0 => OK)
+01   HALF: 0x0000fcff  (0 => OK)
+01 DOUBLE: -nan / 0x00fffbfc0000000000  (0x1 =>     INVALID)
+02   HALF: 0x0000fc01  (0 => OK)
+02 DOUBLE: -nan / 0x00fff8040000000000  (0x1 =>     INVALID)
+03   HALF: 0x0000fc00  (0 => OK)
+03 DOUBLE: -inf / 0x00fff0000000000000  (0 => OK)
+04   HALF: 0x0000fbff  (0 => OK)
+04 DOUBLE: -6.55040000000000000000e+04 / 0x00c0effc0000000000  (0 => OK)
+05   HALF: 0x0000c000  (0 => OK)
+05 DOUBLE: -2.00000000000000000000e+00 / 0x00c000000000000000  (0 => OK)
+06   HALF: 0x0000bc00  (0 => OK)
+06 DOUBLE: -1.00000000000000000000e+00 / 0x00bff0000000000000  (0 => OK)
+07   HALF: 0x00008001  (0 => OK)
+07 DOUBLE: -5.96046447753906250000e-08 / 0x00be70000000000000  (0 => OK)
+08   HALF: 0x00008000  (0 => OK)
+08 DOUBLE: -0.00000000000000000000e+00 / 0x008000000000000000  (0 => OK)
+09   HALF: 0000000000  (0 => OK)
+09 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+10   HALF: 0x00000001  (0 => OK)
+10 DOUBLE: 5.96046447753906250000e-08 / 0x003e70000000000000  (0 => OK)
+11   HALF: 0x00003c00  (0 => OK)
+11 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0 => OK)
+12   HALF: 0x00007bff  (0 => OK)
+12 DOUBLE: 6.55040000000000000000e+04 / 0x0040effc0000000000  (0 => OK)
+13   HALF: 0x00007c00  (0 => OK)
+13 DOUBLE: inf / 0x007ff0000000000000  (0 => OK)
+14   HALF: 0x00007c01  (0 => OK)
+14 DOUBLE: nan / 0x007ff8040000000000  (0x1 =>     INVALID)
+15   HALF: 0x00007cff  (0 => OK)
+15 DOUBLE: nan / 0x007ffbfc0000000000  (0x1 =>     INVALID)
+16   HALF: 0x00007fff  (0 => OK)
+16 DOUBLE: nan / 0x007ffffc0000000000  (0 => OK)
+Converting half-precision to double-precision
+00   HALF: 0x0000ffff  (0 => OK)
+00 DOUBLE: -nan / 0x00fffffc0000000000  (0 => OK)
+01   HALF: 0x0000fcff  (0 => OK)
+01 DOUBLE: -nan / 0x00fffbfc0000000000  (0x1 =>     INVALID)
+02   HALF: 0x0000fc01  (0 => OK)
+02 DOUBLE: -nan / 0x00fff8040000000000  (0x1 =>     INVALID)
+03   HALF: 0x0000fc00  (0 => OK)
+03 DOUBLE: -inf / 0x00fff0000000000000  (0 => OK)
+04   HALF: 0x0000fbff  (0 => OK)
+04 DOUBLE: -6.55040000000000000000e+04 / 0x00c0effc0000000000  (0 => OK)
+05   HALF: 0x0000c000  (0 => OK)
+05 DOUBLE: -2.00000000000000000000e+00 / 0x00c000000000000000  (0 => OK)
+06   HALF: 0x0000bc00  (0 => OK)
+06 DOUBLE: -1.00000000000000000000e+00 / 0x00bff0000000000000  (0 => OK)
+07   HALF: 0x00008001  (0 => OK)
+07 DOUBLE: -5.96046447753906250000e-08 / 0x00be70000000000000  (0 => OK)
+08   HALF: 0x00008000  (0 => OK)
+08 DOUBLE: -0.00000000000000000000e+00 / 0x008000000000000000  (0 => OK)
+09   HALF: 0000000000  (0 => OK)
+09 DOUBLE: 0.00000000000000000000e+00 / 00000000000000000000  (0 => OK)
+10   HALF: 0x00000001  (0 => OK)
+10 DOUBLE: 5.96046447753906250000e-08 / 0x003e70000000000000  (0 => OK)
+11   HALF: 0x00003c00  (0 => OK)
+11 DOUBLE: 1.00000000000000000000e+00 / 0x003ff0000000000000  (0 => OK)
+12   HALF: 0x00007bff  (0 => OK)
+12 DOUBLE: 6.55040000000000000000e+04 / 0x0040effc0000000000  (0 => OK)
+13   HALF: 0x00007c00  (0 => OK)
+13 DOUBLE: inf / 0x007ff0000000000000  (0 => OK)
+14   HALF: 0x00007c01  (0 => OK)
+14 DOUBLE: nan / 0x007ff8040000000000  (0x1 =>     INVALID)
+15   HALF: 0x00007cff  (0 => OK)
+15 DOUBLE: nan / 0x007ffbfc0000000000  (0x1 =>     INVALID)
+16   HALF: 0x00007fff  (0 => OK)
+16 DOUBLE: nan / 0x007ffffc0000000000  (0 => OK)
tests/tcg/arm/Makefile.target +3 -1
index be9d3fb4a1..f1c7ec46b5 100644
@@ -8,7 +8,9 @@ ARM_SRC=$(SRC_PATH)/tests/tcg/arm
 # Set search path for all sources
 VPATH 		+= $(ARM_SRC)
 
-TESTS += hello-arm test-arm-iwmmxt
+ARM_TESTS=hello-arm test-arm-iwmmxt
+
+TESTS += $(ARM_TESTS)
 
 hello-arm: CFLAGS+=-marm -ffreestanding
 hello-arm: LDFLAGS+=-nostdlib
#69 lore raw

PATCH v3 30/46 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.0
#70 lore raw

PATCH v3 31/46 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.0
#71 lore raw

PATCH v3 32/46 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.0
#72 lore raw

PATCH v3 33/46 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.0
#73 lore raw

PATCH v3 34/46 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.0
#74 lore raw

PATCH v3 35/46 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.

---
 tests/docker/Makefile.include                 |  1 +
 .../dockerfiles/debian-alpha-cross.docker     | 12 +++++++
 .../dockerfiles/debian-cross-build.docker     | 36 +++++++++++++++++++
 tests/docker/dockerfiles/debian-sid.docker    | 23 ++++++++++++
 tests/tcg/alpha/Makefile.include              |  2 ++
 5 files changed, 74 insertions(+)
 create mode 100644 tests/docker/dockerfiles/debian-alpha-cross.docker
 create mode 100644 tests/docker/dockerfiles/debian-cross-build.docker
 create mode 100644 tests/docker/dockerfiles/debian-sid.docker
 create mode 100644 tests/tcg/alpha/Makefile.include
tests/docker/Makefile.include +1 -0
index 6a5aa9ec71..bcf44e80c4 100644
@@ -62,6 +62,7 @@ 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
+docker-image-debian-alpha-cross: docker-image-debian-sid
 docker-image-travis: NOUSER=1
 
 # Expand all the pre-requistes for each docker image and test combination
tests/docker/dockerfiles/debian-alpha-cross.docker new file +12 -0
new file mode 100644
index 0000000000..e446f7af3f
@@ -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
tests/docker/dockerfiles/debian-cross-build.docker new file +36 -0
new file mode 100644
index 0000000000..c3611a7d3a
@@ -0,0 +1,36 @@
+#
+# Docker multiarch cross-compiler target
+#
+# This docker target is builds on Debian cross compiler targets to build distro
+# with a selection of cross compilers for building test binaries.
+#
+# On its own you can't build much but the docker-foo-cross targets
+# build on top of the base debian image.
+#
+FROM debian:stretch
+
+# 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 \
+        gettext \
+        git \
+        libgmp-dev \
+        libmpfr-dev \
+        libmpc-dev \
+        pkg-config \
+        psmisc \
+        python \
+        texinfo \
+        wget \
+        $(apt-get -s build-dep binutils | egrep ^Inst | cut -d\  -f2) \
+        $(apt-get -s build-dep gcc | egrep ^Inst | cut -d\  -f2) \
+        $(apt-get -s build-dep glibc | egrep ^Inst | cut -d\  -f2)
tests/docker/dockerfiles/debian-sid.docker new file +23 -0
new file mode 100644
index 0000000000..adeb7134ca
@@ -0,0 +1,23 @@
+#
+# A number of our guests exist as ports only. We can either use the ports repo or get everything from SID
+#
+
+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
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
Signature · 1 line
2.17.0
#75 lore raw

PATCH v3 36/46 tests/tcg/alpha: add Alpha specific tests

In reply to Alex Bennée

These tests are a little strange as they use their own crt.o stub instead of the system supplied one. We also disable the multiarch testthread test as that requires a dynamically linked build.

---
 tests/tcg/alpha/Makefile         | 35 --------------------------------
 tests/tcg/alpha/Makefile.target  | 32 +++++++++++++++++++++++++++++
 tests/tcg/alpha/{crt.s => crt.S} |  0
 3 files changed, 32 insertions(+), 35 deletions(-)
 delete mode 100644 tests/tcg/alpha/Makefile
 create mode 100644 tests/tcg/alpha/Makefile.target
 rename tests/tcg/alpha/{crt.s => crt.S} (100%)
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 new file +32 -0
new file mode 100644
index 0000000000..5b573f145e
@@ -0,0 +1,32 @@
+# -*- Mode: makefile -*-
+#
+# 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)
+
+# Our own minimal crt.o, bypassing gcc's version
+crt.o: CFLAGS+=-ffreestanding
+crt.o: crt.S
+	$(CC) $(CFLAGS) -c $< -o $@
+
+# Alternative build, linking against local crt.o
+ALPHA_BUILD=$(CC) -o $@ crt.o $< -nostdlib
+
+hello-alpha: hello-alpha.c crt.o
+	$(ALPHA_BUILD)
+
+test-cond: test-cond.c crt.o
+	$(ALPHA_BUILD)
+
+test-cmov.o: test-cond.c
+	$(CC) $(CFLAGS) -DTEST_CMOV -c $< -o $@
+
+test-cmov: test-cmov.o crt.o
+	$(ALPHA_BUILD)
+
+test-ovf: test-ovf.c crt.o
+	$(ALPHA_BUILD)
tests/tcg/alpha/crt.S renamed from tests/tcg/alpha/crt.s +0 -0
similarity index 100%
rename from tests/tcg/alpha/crt.s
rename to tests/tcg/alpha/crt.S
Signature · 1 line
2.17.0
#76 lore raw

Re: [Qemu-devel] [PATCH v3 36/46] tests/tcg/alpha: add Alpha specific tests

Quoted 5 lines · Alex Bennée

These tests are a little strange as they use their own crt.o stub instead of the system supplied one. We also disable the multiarch testthread test as that requires a dynamically linked build.

Quoted 8 lines
---
 tests/tcg/alpha/Makefile         | 35 --------------------------------
 tests/tcg/alpha/Makefile.target  | 32 +++++++++++++++++++++++++++++
 tests/tcg/alpha/{crt.s => crt.S} |  0
 3 files changed, 32 insertions(+), 35 deletions(-)
 delete mode 100644 tests/tcg/alpha/Makefile
 create mode 100644 tests/tcg/alpha/Makefile.target
 rename tests/tcg/alpha/{crt.s => crt.S} (100%)

Now that you have a cross-environment, you could simply drop the crt.o.

There's nothing special in there at all; it was just someone's attempt to produce tests *without* a fill cross-environment.

r~

#77 lore raw

Re: [Qemu-devel] [PATCH v3 36/46] tests/tcg/alpha: add Alpha specific tests

Quoted 15 lines · Richard Henderson
Quoted 5 lines · Alex Bennée

These tests are a little strange as they use their own crt.o stub instead of the system supplied one. We also disable the multiarch testthread test as that requires a dynamically linked build.

Quoted 8 lines
---
 tests/tcg/alpha/Makefile         | 35 --------------------------------
 tests/tcg/alpha/Makefile.target  | 32 +++++++++++++++++++++++++++++
 tests/tcg/alpha/{crt.s => crt.S} |  0
 3 files changed, 32 insertions(+), 35 deletions(-)
 delete mode 100644 tests/tcg/alpha/Makefile
 create mode 100644 tests/tcg/alpha/Makefile.target
 rename tests/tcg/alpha/{crt.s => crt.S} (100%)
Quoted 4 lines

Now that you have a cross-environment, you could simply drop the crt.o.

There's nothing special in there at all; it was just someone's attempt to produce tests *without* a fill cross-environment.

Fair enough, I'll fix it up to be more normal.

--
Alex Bennée

#78 lore raw

PATCH v3 37/46 tests/tcg/alpha: fix warnings about write()

In reply to Alex Bennée

Although we are not linking to libc we still need a function prototype for the write we have defined in crt.S.

---
 tests/tcg/alpha/hello-alpha.c | 2 ++
 tests/tcg/alpha/test-cond.c   | 1 +
 tests/tcg/alpha/test-ovf.c    | 2 ++
 3 files changed, 5 insertions(+)
tests/tcg/alpha/hello-alpha.c +2 -0
index 79892e6522..f1207a2411 100644
@@ -1,3 +1,5 @@
+void write(int, char*, int);
+
 int main (void)
 {
   write (1, "hello\n", 6);
tests/tcg/alpha/test-cond.c +1 -0
index 74adffaa69..b5774e4d6d 100644
@@ -1,3 +1,4 @@
+void write(int, char*, int);
 
 #ifdef TEST_CMOV
 
tests/tcg/alpha/test-ovf.c +2 -0
index 01c80e7525..7ecf7e4bce 100644
@@ -1,3 +1,5 @@
+void write(int, char*, int);
+
 static long test_subqv (long a, long b)
 {
   long res;
Signature · 1 line
2.17.0
#79 lore raw

PATCH v3 38/46 tests/tcg: enable building for HPPA

In reply to Alex Bennée
---
 tests/docker/Makefile.include                     |  1 +
 tests/docker/dockerfiles/debian-hppa-cross.docker | 12 ++++++++++++
 tests/tcg/hppa/Makefile.include                   |  2 ++
 3 files changed, 15 insertions(+)
 create mode 100644 tests/docker/dockerfiles/debian-hppa-cross.docker
 create mode 100644 tests/tcg/hppa/Makefile.include
tests/docker/Makefile.include +1 -0
index bcf44e80c4..2471c4f30a 100644
@@ -63,6 +63,7 @@ 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
 docker-image-debian-alpha-cross: docker-image-debian-sid
+docker-image-debian-hppa-cross: docker-image-debian-sid
 docker-image-travis: NOUSER=1
 
 # Expand all the pre-requistes for each docker image and test combination
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
Signature · 1 line
2.17.0
Reviewed-by Tested-by on v3 38/46
#80 lore raw

Re: [Qemu-devel] [PATCH v3 38/46] tests/tcg: enable building for HPPA

Quoted 1 line · Alex Bennée
Quoted 47 lines
---
 tests/docker/Makefile.include                     |  1 +
 tests/docker/dockerfiles/debian-hppa-cross.docker | 12 ++++++++++++
 tests/tcg/hppa/Makefile.include                   |  2 ++
 3 files changed, 15 insertions(+)
 create mode 100644 tests/docker/dockerfiles/debian-hppa-cross.docker
 create mode 100644 tests/tcg/hppa/Makefile.include
tests/docker/Makefile.include +1 -0
index bcf44e80c4..2471c4f30a 100644
@@ -63,6 +63,7 @@ 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
 docker-image-debian-alpha-cross: docker-image-debian-sid
+docker-image-debian-hppa-cross: docker-image-debian-sid
 docker-image-travis: NOUSER=1
 
 # Expand all the pre-requistes for each docker image and test combination
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
#81 lore raw

PATCH v3 39/46 tests/tcg: enable building for m68k

In reply to Alex Bennée

As before, using Debian SID compilers.

---
 tests/docker/Makefile.include                     |  1 +
 tests/docker/dockerfiles/debian-m68k-cross.docker | 12 ++++++++++++
 tests/tcg/m68k/Makefile.include                   |  2 ++
 3 files changed, 15 insertions(+)
 create mode 100644 tests/docker/dockerfiles/debian-m68k-cross.docker
 create mode 100644 tests/tcg/m68k/Makefile.include
tests/docker/Makefile.include +1 -0
index 2471c4f30a..15c52127c7 100644
@@ -64,6 +64,7 @@ docker-image-debian-win32-cross: docker-image-debian8-mxe
 docker-image-debian-win64-cross: docker-image-debian8-mxe
 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
 
 # Expand all the pre-requistes for each docker image and test combination
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
Signature · 1 line
2.17.0
Reviewed-by Tested-by on v3 39/46
#82 lore raw

Re: [Qemu-devel] [PATCH v3 39/46] tests/tcg: enable building for m68k

Quoted 47 lines · Alex Bennée

As before, using Debian SID compilers.

---
 tests/docker/Makefile.include                     |  1 +
 tests/docker/dockerfiles/debian-m68k-cross.docker | 12 ++++++++++++
 tests/tcg/m68k/Makefile.include                   |  2 ++
 3 files changed, 15 insertions(+)
 create mode 100644 tests/docker/dockerfiles/debian-m68k-cross.docker
 create mode 100644 tests/tcg/m68k/Makefile.include
tests/docker/Makefile.include +1 -0
index 2471c4f30a..15c52127c7 100644
@@ -64,6 +64,7 @@ docker-image-debian-win32-cross: docker-image-debian8-mxe
 docker-image-debian-win64-cross: docker-image-debian8-mxe
 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
 
 # Expand all the pre-requistes for each docker image and test combination
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 +0 -0
new file mode 100644
index 0000000000..cd7c6bf50d

tests/tcg/m68k/Makefile.include line 2

Quoted 2 lines
tests/tcg/m68k/Makefile.include new file +2 -0
@@ -0,0 +1,2 @@
+DOCKER_IMAGE=debian-m68k-cross
+DOCKER_CROSS_COMPILER=m68k-linux-gnu-gcc
$ make -j1 run-tcg-tests-m68k-linux-user
  BUILD   debian-sid
  BUILD   debian-m68k-cross
  CROSS-BUILD m68k guest-tests with docker qemu:debian-m68k-cross
/source/qemu/tests/tcg/m68k/Makefile.target:8: warning: overriding
recipe for target 'run-test-mmap'
/source/qemu/tests/tcg/multiarch/Makefile.target:26: warning: ignoring
old recipe for target 'run-test-mmap'
  BUILD   debian-sid
  BUILD   debian-m68k-cross
  CROSS-BUILD m68k guest-tests with docker qemu:debian-m68k-cross
/source/qemu/tests/tcg/m68k/Makefile.target:8: warning: overriding
recipe for target 'run-test-mmap'
/source/qemu/tests/tcg/multiarch/Makefile.target:26: warning: ignoring
old recipe for target 'run-test-mmap'
  RUN-TESTS for m68k
/source/qemu/tests/tcg/m68k/Makefile.target:8: warning: overriding
recipe for target 'run-test-mmap'
/source/qemu/tests/tcg/multiarch/Makefile.target:26: warning: ignoring
old recipe for target 'run-test-mmap'
  TEST    test-mmap (default) on m68k
  TEST    sha1 on m68k
  BROKEN TEST linux-test SKIPPED on m68k
  TEST    testthread on m68k
#83 lore raw

PATCH v3 40/46 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.

---
 tests/docker/Makefile.include                    |  1 +
 tests/docker/dockerfiles/debian-sh4-cross.docker | 12 ++++++++++++
 tests/tcg/sh4/Makefile.include                   |  4 ++++
 3 files changed, 17 insertions(+)
 create mode 100644 tests/docker/dockerfiles/debian-sh4-cross.docker
 create mode 100644 tests/tcg/sh4/Makefile.include
tests/docker/Makefile.include +1 -0
index 15c52127c7..c08f32ca58 100644
@@ -65,6 +65,7 @@ docker-image-debian-win64-cross: docker-image-debian8-mxe
 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
 
 # Expand all the pre-requistes for each docker image and test combination
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
Signature · 1 line
2.17.0
Reviewed-by Tested-by on v3 40/46
#84 lore raw

Re: [Qemu-devel] [PATCH v3 40/46] tests/tcg: enable building for sh4

Quoted 50 lines · 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.

---
 tests/docker/Makefile.include                    |  1 +
 tests/docker/dockerfiles/debian-sh4-cross.docker | 12 ++++++++++++
 tests/tcg/sh4/Makefile.include                   |  4 ++++
 3 files changed, 17 insertions(+)
 create mode 100644 tests/docker/dockerfiles/debian-sh4-cross.docker
 create mode 100644 tests/tcg/sh4/Makefile.include
tests/docker/Makefile.include +1 -0
index 15c52127c7..c08f32ca58 100644
@@ -65,6 +65,7 @@ docker-image-debian-win64-cross: docker-image-debian8-mxe
 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
 
 # Expand all the pre-requistes for each docker image and test combination
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 +0 -0
new file mode 100644
index 0000000000..ad21594d9d

tests/tcg/sh4/Makefile.include line 4

Quoted 4 lines
tests/tcg/sh4/Makefile.include new file +4 -0
@@ -0,0 +1,4 @@
+ifneq ($(TARGET_NAME), sh4eb)
+DOCKER_IMAGE=debian-sh4-cross
+DOCKER_CROSS_COMPILER=sh4-linux-gnu-gcc
+endif
$ make -j1 run-tcg-tests-sh4-linux-user
  GEN     sh4-linux-user/config-target.h
  BUILD   debian-sid
  BUILD   debian-sh4-cross
  CROSS-BUILD sh4 guest-tests with docker qemu:debian-sh4-cross
  BUILD   debian-sid
  BUILD   debian-sh4-cross
  CROSS-BUILD sh4 guest-tests with docker qemu:debian-sh4-cross
  RUN-TESTS for sh4
  TEST    test-mmap (default) on sh4
  TEST    test-mmap (8k pages) on sh4
  TEST    test-mmap (16k pages) on sh4
  TEST    test-mmap (32k pages) on sh4
  TEST    sha1 on sh4
  BROKEN TEST linux-test SKIPPED on sh4
  TEST    testthread on sh4
#85 lore raw

PATCH v3 41/46 tests/tcg: enable building for sparc64

In reply to Alex Bennée

As before, using Debian SID compilers.

---
 tests/docker/Makefile.include                        |  1 +
 tests/docker/dockerfiles/debian-sparc64-cross.docker | 12 ++++++++++++
 tests/tcg/sparc64/Makefile.include                   |  2 ++
 3 files changed, 15 insertions(+)
 create mode 100644 tests/docker/dockerfiles/debian-sparc64-cross.docker
 create mode 100644 tests/tcg/sparc64/Makefile.include
tests/docker/Makefile.include +1 -0
index c08f32ca58..62d1f4dec0 100644
@@ -66,6 +66,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
 
 # Expand all the pre-requistes for each docker image and test combination
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
Signature · 1 line
2.17.0
#86 lore raw

PATCH v3 42/46 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 62d1f4dec0..f58afb8c5d 100644
@@ -67,6 +67,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
 
 # Expand all the pre-requistes for each docker image and test combination
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.0
#87 lore raw

PATCH v3 43/46 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 it's 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

---
 tests/tcg/Makefile | 162 +++++++++++++++------------------------------
 1 file changed, 53 insertions(+), 109 deletions(-)
tests/tcg/Makefile +53 -109
index e12395117a..2116fea915 100644
@@ -1,125 +1,69 @@
+# -*- 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 CC/LD to have been set for
+# us from the parent make as well as being passed EXTRA_CFLAGS.
+#
+# 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
+# The QEMU for this TARGET
+QEMU=../qemu-$(TARGET_NAME)
 
-I386_TESTS=hello-i386 \
-	   sha1-i386 \
-	   test-i386 \
-	   test-i386-fprem \
-	   # runcom
-
-# native i386 compilers sometimes are not biarch.  assume cross-compilers are
-ifneq ($(ARCH),i386)
-I386_TESTS+=run-test-x86_64
+# The order we include is important. We include multiarch, base arch and finally 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
 
-TESTS = test_path
-ifneq ($(call find-in-path, $(CC_I386)),)
-TESTS += $(I386_TESTS)
-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
+# Add the common build options
+CFLAGS+=-Wall -O0 -g -fno-strict-aliasing
+LDFLAGS+=-static
 
+%: %.c
+	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
 
-run-runcom: runcom
-	-$(QEMU) ./runcom $(SRC_PATH)/tests/pi_10.com
+all: $(TESTS)
 
-run-test_path: test_path
-	./test_path
+#
+# 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.
+#
 
-# rules to compile tests
+RUN_TESTS=$(patsubst %,run-%, $(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 $@ $<
-
-hello-arm.o: hello-arm.c
-	arm-linux-gcc -Wall -g -O2 -c -o $@ $<
-
-test-arm-iwmmxt: test-arm-iwmmxt.s
-	cpp < $< | arm-linux-gnu-gcc -Wall -static -march=iwmmxt -mabi=aapcs -x assembler - -o $@
-
-# MIPS test
-hello-mips: hello-mips.c
-	mips-linux-gnu-gcc -nostdlib -static -mno-abicalls -fno-PIC -mabi=32 -Wall -Wextra -g -O2 -o $@ $<
-
-hello-mipsel: hello-mips.c
-	mipsel-linux-gnu-gcc -nostdlib -static -mno-abicalls -fno-PIC -mabi=32 -Wall -Wextra -g -O2 -o $@ $<
-
-# testsuite for the CRIS port.
-test-cris:
-	$(MAKE) -C cris check
+run-%: %
+	$(call quiet-command, $(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
Signature · 1 line
2.17.0
#88 lore raw

Re: [Qemu-devel] [PATCH v3 43/46] tests/tcg/Makefile: update to be called from Makefile.target

tests/tcg/Makefile line 64

Quoted 2 lines · Alex Bennée
tests/tcg/Makefile +2 -0
+run-%: %
+	$(call quiet-command, $(QEMU) $< > $<.out, "TEST", "$< on $(TARGET_NAME)")

I've just had an x86_64 guest test run for 70 minutes. We need to limit the amount of time spent here in some way, with excessive time reported as test failure.

One potential way would be to add "ulimit -t $TIMEOUT" to the subshell before running qemu. A default TIMEOUT might be e.g. 15 seconds. I'm not sure what we should expect for the largest test on the smallest hosts...

r~

#89 lore raw

Re: [Qemu-devel] [PATCH v3 43/46] tests/tcg/Makefile: update to be called from Makefile.target

Quoted 11 lines · Richard Henderson

tests/tcg/Makefile line 64

Quoted 2 lines · Alex Bennée
tests/tcg/Makefile +2 -0
+run-%: %
+	$(call quiet-command, $(QEMU) $< > $<.out, "TEST", "$< on $(TARGET_NAME)")

I've just had an x86_64 guest test run for 70 minutes. We need to limit the amount of time spent here in some way, with excessive time reported as test failure.

One potential way would be to add "ulimit -t $TIMEOUT" to the subshell before running qemu. A default TIMEOUT might be e.g. 15 seconds. I'm not sure what we should expect for the largest test on the smallest hosts...

Sounds reasonable - test-i386-fprem is probably the longest - I'm not sure it needs to be so exhaustive.

Quoted 3 lines

r~

--
Alex Bennée

#90 lore raw

Re: [Qemu-devel] [PATCH v3 43/46] tests/tcg/Makefile: update to be called from Makefile.target

Quoted 11 lines · Alex Bennée
Quoted 8 lines · Richard Henderson

tests/tcg/Makefile line 64

Quoted 2 lines · Alex Bennée
tests/tcg/Makefile +2 -0
+run-%: %
+	$(call quiet-command, $(QEMU) $< > $<.out, "TEST", "$< on $(TARGET_NAME)")

I've just had an x86_64 guest test run for 70 minutes. We need to limit the amount of time spent here in some way, with excessive time reported as test failure.

Quoted 6 lines
Quoted 3 lines

One potential way would be to add "ulimit -t $TIMEOUT" to the subshell before running qemu. A default TIMEOUT might be e.g. 15 seconds. I'm not sure what we should expect for the largest test on the smallest hosts...

Sounds reasonable - test-i386-fprem is probably the longest - I'm not sure it needs to be so exhaustive.

Better, not via ulimit but via something that measures wall time. That way we don't stall on e.g. a locked mutex when the child isn't spinning in a loop as it was here.

I'd guess a small python script would be most maintainable...

r~

#91 lore raw

PATCH v3 44/46 Makefile.target: add (clean-)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.

---
 Makefile.target            |  5 +++
 tests/tcg/Makefile.include | 79 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 84 insertions(+)
 create mode 100644 tests/tcg/Makefile.include
Makefile.target +5 -0
index d0ec77a307..a30fd40257 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 +79 -0

79 lines not on this page · raw message

Signature · 1 line
2.17.0
#92 lore raw

PATCH v3 45/46 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 ++++++++++++++++++++++-
 tests/tcg/Makefile.include | 43 ++++++++++++++++++++++----------------
 2 files changed, 50 insertions(+), 19 deletions(-)
tests/Makefile.include +25 -1
index 3d2f0458ab..310ccefdd9 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
@@ -916,6 +917,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
 
@@ -958,7 +983,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
tests/tcg/Makefile.include +25 -18

72 lines not on this page · raw message

Signature · 1 line
2.17.0
#93 lore raw

Re: [Qemu-devel] [PATCH v3 45/46] tests/Makefile.include: add [build|clean|check]-tcg targets

Hi Alex,

Quoted 113 lines · 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 ++++++++++++++++++++++-
 tests/tcg/Makefile.include | 43 ++++++++++++++++++++++----------------
 2 files changed, 50 insertions(+), 19 deletions(-)
tests/Makefile.include +25 -1
index 3d2f0458ab..310ccefdd9 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
@@ -916,6 +917,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
 
@@ -958,7 +983,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
tests/tcg/Makefile.include +9 -14
index cb8bb36026..67e89ecb67 100644
@@ -8,19 +8,14 @@
 # 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 it if it
-# exists
+# The per ARCH makefile, if it exists, holds extra information about
+# useful docker images or alternative compiler flags.
 
-ARCH_MAKEFILE=$(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.include
-CHECK_INCLUDE=$(wildcard $(ARCH_MAKEFILE))
-
-ifeq ($(ARCH_MAKEFILE),$(CHECK_INCLUDE))
-include $(ARCH_MAKEFILE)
-endif
+-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
@@ -28,10 +23,10 @@ ifdef CROSS_CC_GUEST
 .PHONY: cross-build-guest-tests
 cross-build-guest-tests:
 	$(call quiet-command, \
-          (mkdir -p tests && cd tests && \
-	   make -f $(SRC_PATH)/tests/tcg/Makefile ARCH=$(TARGET_NAME) CC=$(CROSS_CC_GUEST)), \
-	  "CROSS-BUILD","$(TARGET_NAME) guest-tests with $(CROSS_CC_GUEST)")
-
+	   (mkdir -p tests && cd tests && \
+	    make -f $(TCG_MAKE) CC=$(CROSS_CC_GUEST) \
+				EXTRA_CFLAGS=$(CROSS_CC_GUEST_CFLAGS)), \
+	"CROSS-BUILD","$(TARGET_NAME) guest-tests with $(CROSS_CC_GUEST)")
 
 GUEST_BUILD=cross-build-guest-tests
 

tests/tcg/Makefile.include DOCKER_PREREQ=docker-image-$(DOCKER_IMAGE) · line 55

Quoted 10 lines
tests/tcg/Makefile.include +4 -3
@@ -54,9 +49,10 @@ 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 $(SRC_PATH)/tests/tcg/Makefile ARCH=$(TARGET_NAME) CC=$(DOCKER_COMPILE_CMD)), \
-	  "CROSS-BUILD","$(TARGET_NAME) guest-tests with docker qemu:$(DOCKER_IMAGE)")
+	  (mkdir -p tests && cd tests && \
+	   make -f $(TCG_MAKE) CC=$(DOCKER_COMPILE_CMD) \
+			       EXTRA_CFLAGS=$(DOCKER_CROSS_COMPILER_CFLAGS)), \
+	"CROSS-BUILD","$(TARGET_NAME) guest-tests with docker qemu:$(DOCKER_IMAGE)")

I'm not sure this is working as expected, for some reason "make build-tcg-tests-aarch64-linux-user" try to use the debian-armel-cross image:

/build$ make build-tcg-tests-aarch64-linux-user V=1 -j1
make BUILD_DIR=/build -C aarch64-linux-user V="1" TARGET_DIR="aarch64-linux-user/" guest-tests
make[1]: Entering directory '/build/aarch64-linux-user' /source/qemu/tests/docker/docker.py build qemu:debian9
/source/qemu/tests/docker/dockerfiles/debian9.docker --add-current-user
[...]
/source/qemu/tests/docker/docker.py build qemu:debian-armel-cross /source/qemu/tests/docker/dockerfiles/debian-armel-cross.docker --add-current-user
[...]
(mkdir -p tests && cd tests && make -f /source/qemu/tests/tcg/Makefile CC="/source/qemu/tests/docker/docker.py cc --user 1000 --cc arm-linux-gnueabi-gcc -i qemu:debian-armel-cross -s /source/qemu -- " EXTRA_CFLAGS=)
make[2]: Entering directory '/home/phil/build/aarch64-linux-user/tests' /source/qemu/tests/docker/docker.py cc --user 1000 --cc arm-linux-gnueabi-gcc -i qemu:debian-armel-cross -s /source/qemu -- -Wall -O0 -g -fno-strict-aliasing /source/qemu/tests/tcg/aarch64/fcvt.c -o fcvt -static -lm
/source/qemu/tests/tcg/aarch64/fcvt.c: In function 'print_double_number':
/source/qemu/tests/tcg/aarch64/fcvt.c:37:42: warning: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'uint64_t {aka long long unsigned int}' [-Wformat=]

     printf("%02d DOUBLE: %02.20e / %#020lx  (%#x => %s)\n",
                                          ^
/source/qemu/tests/tcg/aarch64/fcvt.c: In function 'convert_single_to_half':
/source/qemu/tests/tcg/aarch64/fcvt.c:82:9: error: inconsistent operand
constraints in an 'asm'
         asm("fcvt %h0, %d1" : "=w" (output) : "x" (input));
         ^~~
/source/qemu/tests/tcg/aarch64/fcvt.c: In function 'main':
/source/qemu/tests/tcg/aarch64/fcvt.c:241:5: error: unknown register
name 'x1' in 'asm'
     asm("msr fpsr, x1\n\t"
     ^~~

make[2]: *** [/source/qemu/tests/tcg/Makefile:49: fcvt] Error 1 make[2]: Leaving directory '/home/phil/build/aarch64-linux-user/tests' make[1]: *** [/source/qemu/tests/tcg/Makefile.include:51:
docker-build-guest-tests] Error 2
make[1]: Leaving directory '/home/phil/build/aarch64-linux-user'
make: *** [/source/qemu/tests/Makefile.include:928:
build-tcg-tests-aarch64-linux-user] Error 2

Note this:

Entering directory '/build/aarch64-linux-user'
[...]
docker.py build qemu:debian-armel-cross ...

I'm not sure this is related to this patch or the previous (44).

Quoted 26 lines
tests/tcg/Makefile.include +12 -1
 GUEST_BUILD=docker-build-guest-tests
 
@@ -68,9 +64,20 @@ endif
 
 ifneq ($(GUEST_BUILD),)
 guest-tests: $(GUEST_BUILD)
+
+run-guest-tests: guest-tests
+	$(call quiet-command, \
+	(cd tests && make -f $(TCG_MAKE) run), \
+	"RUN-TESTS", "for $(TARGET_NAME)")
+
 else
 guest-tests:
-	$(call quiet-command, /bin/true, "CROSS-BUILD", "$(TARGET_NAME) guest-tests SKIPPED")
+	$(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
#94 lore raw

Re: [Qemu-devel] [PATCH v3 45/46] tests/Makefile.include: add [build|clean|check]-tcg targets

Quoted 172 lines · Philippe Mathieu-Daudé
Quoted 113 lines · 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 ++++++++++++++++++++++-
 tests/tcg/Makefile.include | 43 ++++++++++++++++++++++----------------
 2 files changed, 50 insertions(+), 19 deletions(-)
tests/Makefile.include +25 -1
index 3d2f0458ab..310ccefdd9 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
@@ -916,6 +917,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
 
@@ -958,7 +983,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
tests/tcg/Makefile.include +9 -14
index cb8bb36026..67e89ecb67 100644
@@ -8,19 +8,14 @@
 # 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 it if it
-# exists
+# The per ARCH makefile, if it exists, holds extra information about
+# useful docker images or alternative compiler flags.
 
-ARCH_MAKEFILE=$(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.include
-CHECK_INCLUDE=$(wildcard $(ARCH_MAKEFILE))
-
-ifeq ($(ARCH_MAKEFILE),$(CHECK_INCLUDE))
-include $(ARCH_MAKEFILE)
-endif
+-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
@@ -28,10 +23,10 @@ ifdef CROSS_CC_GUEST
 .PHONY: cross-build-guest-tests
 cross-build-guest-tests:
 	$(call quiet-command, \
-          (mkdir -p tests && cd tests && \
-	   make -f $(SRC_PATH)/tests/tcg/Makefile ARCH=$(TARGET_NAME) CC=$(CROSS_CC_GUEST)), \
-	  "CROSS-BUILD","$(TARGET_NAME) guest-tests with $(CROSS_CC_GUEST)")
-
+	   (mkdir -p tests && cd tests && \
+	    make -f $(TCG_MAKE) CC=$(CROSS_CC_GUEST) \
+				EXTRA_CFLAGS=$(CROSS_CC_GUEST_CFLAGS)), \
+	"CROSS-BUILD","$(TARGET_NAME) guest-tests with $(CROSS_CC_GUEST)")
 
 GUEST_BUILD=cross-build-guest-tests
 

tests/tcg/Makefile.include DOCKER_PREREQ=docker-image-$(DOCKER_IMAGE) · line 55

Quoted 10 lines
tests/tcg/Makefile.include +4 -3
@@ -54,9 +49,10 @@ 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 $(SRC_PATH)/tests/tcg/Makefile ARCH=$(TARGET_NAME) CC=$(DOCKER_COMPILE_CMD)), \
-	  "CROSS-BUILD","$(TARGET_NAME) guest-tests with docker qemu:$(DOCKER_IMAGE)")
+	  (mkdir -p tests && cd tests && \
+	   make -f $(TCG_MAKE) CC=$(DOCKER_COMPILE_CMD) \
+			       EXTRA_CFLAGS=$(DOCKER_CROSS_COMPILER_CFLAGS)), \
+	"CROSS-BUILD","$(TARGET_NAME) guest-tests with docker qemu:$(DOCKER_IMAGE)")

I'm not sure this is working as expected, for some reason "make build-tcg-tests-aarch64-linux-user" try to use the debian-armel-cross image:

/build$ make build-tcg-tests-aarch64-linux-user V=1 -j1
make BUILD_DIR=/build -C aarch64-linux-user V="1" TARGET_DIR="aarch64-linux-user/" guest-tests
make[1]: Entering directory '/build/aarch64-linux-user' /source/qemu/tests/docker/docker.py build qemu:debian9
/source/qemu/tests/docker/dockerfiles/debian9.docker --add-current-user
[...]
/source/qemu/tests/docker/docker.py build qemu:debian-armel-cross /source/qemu/tests/docker/dockerfiles/debian-armel-cross.docker --add-current-user
[...]
(mkdir -p tests && cd tests && make -f /source/qemu/tests/tcg/Makefile CC="/source/qemu/tests/docker/docker.py cc --user 1000 --cc arm-linux-gnueabi-gcc -i qemu:debian-armel-cross -s /source/qemu -- " EXTRA_CFLAGS=)
make[2]: Entering directory '/home/phil/build/aarch64-linux-user/tests' /source/qemu/tests/docker/docker.py cc --user 1000 --cc arm-linux-gnueabi-gcc -i qemu:debian-armel-cross -s /source/qemu --

(quoted diff) +0 -2
-Wall -O0 -g -fno-strict-aliasing  /source/qemu/tests/tcg/aarch64/fcvt.c
-o fcvt  -static -lm

/source/qemu/tests/tcg/aarch64/fcvt.c: In function 'print_double_number':
/source/qemu/tests/tcg/aarch64/fcvt.c:37:42: warning: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'uint64_t {aka long long unsigned int}' [-Wformat=]

     printf("%02d DOUBLE: %02.20e / %#020lx  (%#x => %s)\n",
                                          ^
/source/qemu/tests/tcg/aarch64/fcvt.c: In function 'convert_single_to_half':
/source/qemu/tests/tcg/aarch64/fcvt.c:82:9: error: inconsistent operand
constraints in an 'asm'
         asm("fcvt %h0, %d1" : "=w" (output) : "x" (input));
         ^~~
/source/qemu/tests/tcg/aarch64/fcvt.c: In function 'main':
/source/qemu/tests/tcg/aarch64/fcvt.c:241:5: error: unknown register
name 'x1' in 'asm'
     asm("msr fpsr, x1\n\t"
     ^~~

make[2]: *** [/source/qemu/tests/tcg/Makefile:49: fcvt] Error 1 make[2]: Leaving directory '/home/phil/build/aarch64-linux-user/tests' make[1]: *** [/source/qemu/tests/tcg/Makefile.include:51:
docker-build-guest-tests] Error 2
make[1]: Leaving directory '/home/phil/build/aarch64-linux-user'
make: *** [/source/qemu/tests/Makefile.include:928:
build-tcg-tests-aarch64-linux-user] Error 2

Quoted 7 lines

Note this:

Entering directory '/build/aarch64-linux-user'
[...]
docker.py build qemu:debian-armel-cross ...

I'm not sure this is related to this patch or the previous (44).

This is due to the missing tests/tcg/aarch64/Makefile.include in patch 28/46.

Quoted 24 lines
Quoted 24 lines
tests/tcg/Makefile.include +12 -1
 GUEST_BUILD=docker-build-guest-tests
 
@@ -68,9 +64,20 @@ endif
 
 ifneq ($(GUEST_BUILD),)
 guest-tests: $(GUEST_BUILD)
+
+run-guest-tests: guest-tests
+	$(call quiet-command, \
+	(cd tests && make -f $(TCG_MAKE) run), \
+	"RUN-TESTS", "for $(TARGET_NAME)")
+
 else
 guest-tests:
-	$(call quiet-command, /bin/true, "CROSS-BUILD", "$(TARGET_NAME) guest-tests SKIPPED")
+	$(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
 
Quoted 2 lines

tests/tcg/Makefile.include endif · line 83

Quoted 2 lines
tests/tcg/Makefile.include +0 -0
 # It doesn't mater if these don't exits

There is still some rule missing:

$ make -j1 run-tcg-tests-sh4-linux-user  -k
  BUILD   debian-sid
  BUILD   debian-sh4-cross
  CROSS-BUILD sh4 guest-tests with docker qemu:debian-sh4-cross
  BUILD   debian-sid
  BUILD   debian-sh4-cross
  CROSS-BUILD sh4 guest-tests with docker qemu:debian-sh4-cross
  RUN-TESTS for sh4
  TEST    test-mmap (default) on sh4
/bin/sh: 1: ../qemu-sh4: not found
make[2]: *** [/source/qemu/tests/tcg/multiarch/Makefile.target:26:
run-test-mmap] Error 127
  TEST    sha1 on sh4
/bin/sh: 1: ../qemu-sh4: not found
make[2]: *** [/source/qemu/tests/tcg/Makefile:64: run-sha1] Error 127
  BROKEN TEST linux-test SKIPPED on sh4
  TEST    testthread on sh4
/bin/sh: 1: ../qemu-sh4: not found
make[2]: *** [/source/qemu/tests/tcg/Makefile:64: run-testthread] Error 127
make[2]: Target 'run' not remade because of errors.
make[1]: *** [/source/qemu/tests/tcg/Makefile.include:69:
run-guest-tests] Error 2
make: *** [/source/qemu/tests/Makefile.include:931:
run-tcg-tests-sh4-linux-user] Error 2

Works with:

$ make -j1 subdir-sh4-linux-user run-tcg-tests-sh4-linux-user
#95 lore raw

Re: [Qemu-devel] [PATCH v3 45/46] tests/Makefile.include: add [build|clean|check]-tcg targets

Quoted 238 lines · Philippe Mathieu-Daudé
Quoted 172 lines · Philippe Mathieu-Daudé
Quoted 113 lines · 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 ++++++++++++++++++++++-
 tests/tcg/Makefile.include | 43 ++++++++++++++++++++++----------------
 2 files changed, 50 insertions(+), 19 deletions(-)
tests/Makefile.include +25 -1
index 3d2f0458ab..310ccefdd9 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
@@ -916,6 +917,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
 
@@ -958,7 +983,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
tests/tcg/Makefile.include +9 -14
index cb8bb36026..67e89ecb67 100644
@@ -8,19 +8,14 @@
 # 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 it if it
-# exists
+# The per ARCH makefile, if it exists, holds extra information about
+# useful docker images or alternative compiler flags.
 
-ARCH_MAKEFILE=$(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.include
-CHECK_INCLUDE=$(wildcard $(ARCH_MAKEFILE))
-
-ifeq ($(ARCH_MAKEFILE),$(CHECK_INCLUDE))
-include $(ARCH_MAKEFILE)
-endif
+-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
@@ -28,10 +23,10 @@ ifdef CROSS_CC_GUEST
 .PHONY: cross-build-guest-tests
 cross-build-guest-tests:
 	$(call quiet-command, \
-          (mkdir -p tests && cd tests && \
-	   make -f $(SRC_PATH)/tests/tcg/Makefile ARCH=$(TARGET_NAME) CC=$(CROSS_CC_GUEST)), \
-	  "CROSS-BUILD","$(TARGET_NAME) guest-tests with $(CROSS_CC_GUEST)")
-
+	   (mkdir -p tests && cd tests && \
+	    make -f $(TCG_MAKE) CC=$(CROSS_CC_GUEST) \
+				EXTRA_CFLAGS=$(CROSS_CC_GUEST_CFLAGS)), \
+	"CROSS-BUILD","$(TARGET_NAME) guest-tests with $(CROSS_CC_GUEST)")
 
 GUEST_BUILD=cross-build-guest-tests
 

tests/tcg/Makefile.include DOCKER_PREREQ=docker-image-$(DOCKER_IMAGE) · line 55

Quoted 10 lines
tests/tcg/Makefile.include +4 -3
@@ -54,9 +49,10 @@ 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 $(SRC_PATH)/tests/tcg/Makefile ARCH=$(TARGET_NAME) CC=$(DOCKER_COMPILE_CMD)), \
-	  "CROSS-BUILD","$(TARGET_NAME) guest-tests with docker qemu:$(DOCKER_IMAGE)")
+	  (mkdir -p tests && cd tests && \
+	   make -f $(TCG_MAKE) CC=$(DOCKER_COMPILE_CMD) \
+			       EXTRA_CFLAGS=$(DOCKER_CROSS_COMPILER_CFLAGS)), \
+	"CROSS-BUILD","$(TARGET_NAME) guest-tests with docker qemu:$(DOCKER_IMAGE)")

I'm not sure this is working as expected, for some reason "make build-tcg-tests-aarch64-linux-user" try to use the debian-armel-cross image:

/build$ make build-tcg-tests-aarch64-linux-user V=1 -j1
make BUILD_DIR=/build -C aarch64-linux-user V="1" TARGET_DIR="aarch64-linux-user/" guest-tests
make[1]: Entering directory '/build/aarch64-linux-user' /source/qemu/tests/docker/docker.py build qemu:debian9
/source/qemu/tests/docker/dockerfiles/debian9.docker --add-current-user
[...]
/source/qemu/tests/docker/docker.py build qemu:debian-armel-cross /source/qemu/tests/docker/dockerfiles/debian-armel-cross.docker --add-current-user
[...]
(mkdir -p tests && cd tests && make -f /source/qemu/tests/tcg/Makefile CC="/source/qemu/tests/docker/docker.py cc --user 1000 --cc arm-linux-gnueabi-gcc -i qemu:debian-armel-cross -s /source/qemu -- " EXTRA_CFLAGS=)
make[2]: Entering directory '/home/phil/build/aarch64-linux-user/tests' /source/qemu/tests/docker/docker.py cc --user 1000 --cc arm-linux-gnueabi-gcc -i qemu:debian-armel-cross -s /source/qemu --

(quoted diff) +0 -2
-Wall -O0 -g -fno-strict-aliasing  /source/qemu/tests/tcg/aarch64/fcvt.c
-o fcvt  -static -lm

/source/qemu/tests/tcg/aarch64/fcvt.c: In function 'print_double_number':
/source/qemu/tests/tcg/aarch64/fcvt.c:37:42: warning: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'uint64_t {aka long long unsigned int}' [-Wformat=]

     printf("%02d DOUBLE: %02.20e / %#020lx  (%#x => %s)\n",
                                          ^
/source/qemu/tests/tcg/aarch64/fcvt.c: In function 'convert_single_to_half':
/source/qemu/tests/tcg/aarch64/fcvt.c:82:9: error: inconsistent operand
constraints in an 'asm'
         asm("fcvt %h0, %d1" : "=w" (output) : "x" (input));
         ^~~
/source/qemu/tests/tcg/aarch64/fcvt.c: In function 'main':
/source/qemu/tests/tcg/aarch64/fcvt.c:241:5: error: unknown register
name 'x1' in 'asm'
     asm("msr fpsr, x1\n\t"
     ^~~

make[2]: *** [/source/qemu/tests/tcg/Makefile:49: fcvt] Error 1 make[2]: Leaving directory '/home/phil/build/aarch64-linux-user/tests' make[1]: *** [/source/qemu/tests/tcg/Makefile.include:51:
docker-build-guest-tests] Error 2
make[1]: Leaving directory '/home/phil/build/aarch64-linux-user'
make: *** [/source/qemu/tests/Makefile.include:928:
build-tcg-tests-aarch64-linux-user] Error 2

Quoted 7 lines

Note this:

Entering directory '/build/aarch64-linux-user'
[...]
docker.py build qemu:debian-armel-cross ...

I'm not sure this is related to this patch or the previous (44).

This is due to the missing tests/tcg/aarch64/Makefile.include in patch 28/46.

Quoted 24 lines
Quoted 24 lines
tests/tcg/Makefile.include +12 -1
 GUEST_BUILD=docker-build-guest-tests
 
@@ -68,9 +64,20 @@ endif
 
 ifneq ($(GUEST_BUILD),)
 guest-tests: $(GUEST_BUILD)
+
+run-guest-tests: guest-tests
+	$(call quiet-command, \
+	(cd tests && make -f $(TCG_MAKE) run), \
+	"RUN-TESTS", "for $(TARGET_NAME)")
+
 else
 guest-tests:
-	$(call quiet-command, /bin/true, "CROSS-BUILD", "$(TARGET_NAME) guest-tests SKIPPED")
+	$(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
 
Quoted 2 lines

tests/tcg/Makefile.include endif · line 83

Quoted 2 lines
tests/tcg/Makefile.include +0 -0
 # It doesn't mater if these don't exits

There is still some rule missing:

$ make -j1 run-tcg-tests-sh4-linux-user  -k
  BUILD   debian-sid
  BUILD   debian-sh4-cross
  CROSS-BUILD sh4 guest-tests with docker qemu:debian-sh4-cross
  BUILD   debian-sid
  BUILD   debian-sh4-cross
  CROSS-BUILD sh4 guest-tests with docker qemu:debian-sh4-cross
  RUN-TESTS for sh4
  TEST    test-mmap (default) on sh4
/bin/sh: 1: ../qemu-sh4: not found
make[2]: *** [/source/qemu/tests/tcg/multiarch/Makefile.target:26:
run-test-mmap] Error 127
  TEST    sha1 on sh4
/bin/sh: 1: ../qemu-sh4: not found
make[2]: *** [/source/qemu/tests/tcg/Makefile:64: run-sha1] Error 127
  BROKEN TEST linux-test SKIPPED on sh4
  TEST    testthread on sh4
/bin/sh: 1: ../qemu-sh4: not found
make[2]: *** [/source/qemu/tests/tcg/Makefile:64: run-testthread] Error 127
make[2]: Target 'run' not remade because of errors.
make[1]: *** [/source/qemu/tests/tcg/Makefile.include:69:
run-guest-tests] Error 2
make: *** [/source/qemu/tests/Makefile.include:931:
run-tcg-tests-sh4-linux-user] Error 2
Quoted 3 lines

Works with:

$ make -j1 subdir-sh4-linux-user run-tcg-tests-sh4-linux-user

I've added:

run-guest-tests: guest-tests qemu-$(TARGET_NAME)

	$(call quiet-command, \
	(cd tests && make -f $(TCG_MAKE) run), \
	"RUN-TESTS", "for $(TARGET_NAME)")

to tests/tcg/Makefile.include

--
Alex Bennée

#96 lore raw

Re: [Qemu-devel] [PATCH v3 45/46] tests/Makefile.include: add [build|clean|check]-tcg targets

In reply to Alex Bennée
Quoted 138 lines · 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 ++++++++++++++++++++++-
 tests/tcg/Makefile.include | 43 ++++++++++++++++++++++----------------
 2 files changed, 50 insertions(+), 19 deletions(-)
tests/Makefile.include +25 -1
index 3d2f0458ab..310ccefdd9 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
@@ -916,6 +917,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
 
@@ -958,7 +983,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
tests/tcg/Makefile.include +19 -17
index cb8bb36026..67e89ecb67 100644
@@ -8,19 +8,14 @@
 # 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 it if it
-# exists
+# The per ARCH makefile, if it exists, holds extra information about
+# useful docker images or alternative compiler flags.
 
-ARCH_MAKEFILE=$(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.include
-CHECK_INCLUDE=$(wildcard $(ARCH_MAKEFILE))
-
-ifeq ($(ARCH_MAKEFILE),$(CHECK_INCLUDE))
-include $(ARCH_MAKEFILE)
-endif
+-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
@@ -28,10 +23,10 @@ ifdef CROSS_CC_GUEST
 .PHONY: cross-build-guest-tests
 cross-build-guest-tests:
 	$(call quiet-command, \
-          (mkdir -p tests && cd tests && \
-	   make -f $(SRC_PATH)/tests/tcg/Makefile ARCH=$(TARGET_NAME) CC=$(CROSS_CC_GUEST)), \
-	  "CROSS-BUILD","$(TARGET_NAME) guest-tests with $(CROSS_CC_GUEST)")
-
+	   (mkdir -p tests && cd tests && \
+	    make -f $(TCG_MAKE) CC=$(CROSS_CC_GUEST) \
+				EXTRA_CFLAGS=$(CROSS_CC_GUEST_CFLAGS)), \
+	"CROSS-BUILD","$(TARGET_NAME) guest-tests with $(CROSS_CC_GUEST)")
 
 GUEST_BUILD=cross-build-guest-tests
 
@@ -54,9 +49,10 @@ 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 $(SRC_PATH)/tests/tcg/Makefile ARCH=$(TARGET_NAME) CC=$(DOCKER_COMPILE_CMD)), \
-	  "CROSS-BUILD","$(TARGET_NAME) guest-tests with docker qemu:$(DOCKER_IMAGE)")
+	  (mkdir -p tests && cd tests && \
+	   make -f $(TCG_MAKE) CC=$(DOCKER_COMPILE_CMD) \
+			       EXTRA_CFLAGS=$(DOCKER_CROSS_COMPILER_CFLAGS)), \
+	"CROSS-BUILD","$(TARGET_NAME) guest-tests with docker qemu:$(DOCKER_IMAGE)")
 
 GUEST_BUILD=docker-build-guest-tests
 
@@ -68,9 +64,20 @@ endif
 
 ifneq ($(GUEST_BUILD),)
 guest-tests: $(GUEST_BUILD)
+
+run-guest-tests: guest-tests
+	$(call quiet-command, \
+	(cd tests && make -f $(TCG_MAKE) run), \
+	"RUN-TESTS", "for $(TARGET_NAME)")
+
 else
 guest-tests:

tests/tcg/Makefile.include endif · line 83

Quoted 10 lines
tests/tcg/Makefile.include +6 -1
-	$(call quiet-command, /bin/true, "CROSS-BUILD", "$(TARGET_NAME) guest-tests SKIPPED")
+	$(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

I forgot I switched to this default:

$ alias make
alias make='make -j$(nproc) -l$(bc<<<"scale=2;$(nproc)*.94")'

with which this script is very unhappy :)

$ make -j4 check-tcg
  BUILD   debian9
  BUILD   debian-sid
  BUILD   debian9
  BUILD   debian9
^CTraceback (most recent call last):
  File "/source/qemu/tests/docker/docker.py", line 456, in <module>
    sys.exit(main())
  File "/source/qemu/tests/docker/docker.py", line 453, in main
    return args.cmdobj.run(args, argv)
  File "/source/qemu/tests/docker/docker.py", line 326, in run
Traceback (most recent call last):
  File "/source/qemu/tests/docker/docker.py", line 456, in <module>
    extra_files_cksum=cksum)
  File "/source/qemu/tests/docker/docker.py", line 209, in build_image
    sys.exit(main())
  File "/source/qemu/tests/docker/docker.py", line 453, in main
Traceback (most recent call last):
  File "/source/qemu/tests/docker/docker.py", line 456, in <module>
    return args.cmdobj.run(args, argv)
  File "/source/qemu/tests/docker/docker.py", line 326, in run
Traceback (most recent call last):
    sys.exit(main())
  File "/source/qemu/tests/docker/docker.py", line 456, in <module>
    sys.exit(main())
  File "/source/qemu/tests/docker/docker.py", line 453, in main
    return args.cmdobj.run(args, argv)
  File "/source/qemu/tests/docker/docker.py", line 326, in run
    extra_files_cksum=cksum)
  File "/source/qemu/tests/docker/docker.py", line 209, in build_image
    quiet=quiet)
  File "/source/qemu/tests/docker/docker.py", line 147, in _do_check
    return subprocess.check_call(self._command + cmd, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 185, in check_call
        extra_files_cksum=cksum)
  File "/source/qemu/tests/docker/docker.py", line 209, in build_image
    quiet=quiet)
  File "/source/qemu/tests/docker/docker.py", line 147, in _do_check
quiet=quiet)
      File "/source/qemu/tests/docker/docker.py", line 147, in _do_check
    retcode = call(*popenargs, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 172, in call
    return subprocess.check_call(self._command + cmd, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 185, in check_call
    return Popen(*popenargs, **kwargs).wait()
  File "/usr/lib/python2.7/subprocess.py", line 1099, in wait
      File "/source/qemu/tests/docker/docker.py", line 453, in main
retcode = call(*popenargs, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 172, in call
    return args.cmdobj.run(args, argv)
  File "/source/qemu/tests/docker/docker.py", line 326, in run
    extra_files_cksum=cksum)
  File "/source/qemu/tests/docker/docker.py", line 209, in build_image
        quiet=quiet)
  File "/source/qemu/tests/docker/docker.py", line 147, in _do_check
return Popen(*popenargs, **kwargs).wait()
        return subprocess.check_call(self._command + cmd, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 185, in check_call
  File "/usr/lib/python2.7/subprocess.py", line 1099, in wait
    retcode = call(*popenargs, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 172, in call
pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0)
  File "/usr/lib/python2.7/subprocess.py", line 125, in _eintr_retry_call
    return func(*args)
KeyboardInterrupt
    pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0)
  File "/usr/lib/python2.7/subprocess.py", line 125, in _eintr_retry_call
    return func(*args)
KeyboardInterrupt
return subprocess.check_call(self._command + cmd, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 185, in check_call
        return Popen(*popenargs, **kwargs).wait()
  File "/usr/lib/python2.7/subprocess.py", line 1099, in wait
    retcode = call(*popenargs, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 172, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/usr/lib/python2.7/subprocess.py", line 1099, in wait
    pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0)
  File "/usr/lib/python2.7/subprocess.py", line 125, in _eintr_retry_call
    return func(*args)
KeyboardInterruptpid, sts = _eintr_retry_call(os.waitpid, self.pid, 0)

File "/usr/lib/python2.7/subprocess.py", line 125, in _eintr_retry_call
return func(*args)
KeyboardInterrupt
^[[AError 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 "/source/qemu/tests/docker/docker.py", line 174, in _kill_instances
return self._do_kill_instances(True)
File "/source/qemu/tests/docker/docker.py", line 154, in
_do_kill_instances

    resp = self._output(["inspect", i])
  File "/source/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', '9fc7dac8cd07']' 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 "/source/qemu/tests/docker/docker.py", line 174, in _kill_instances
return self._do_kill_instances(True)
File "/source/qemu/tests/docker/docker.py", line 154, in
_do_kill_instances

    resp = self._output(["inspect", i])
  File "/source/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', '9fc7dac8cd07']' returned non-zero exit status 1
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 "/source/qemu/tests/docker/docker.py", line 174, in _kill_instances
return self._do_kill_instances(True)
File "/source/qemu/tests/docker/docker.py", line 154, in
_do_kill_instances

    resp = self._output(["inspect", i])
  File "/source/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', '9fc7dac8cd07']' 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 "/source/qemu/tests/docker/docker.py", line 174, in _kill_instances
return self._do_kill_instances(True)
File "/source/qemu/tests/docker/docker.py", line 154, in
_do_kill_instances

    resp = self._output(["inspect", i])
  File "/source/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', '9fc7dac8cd07']' returned non-zero exit status 1
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 "/source/qemu/tests/docker/docker.py", line 174, in _kill_instances
return self._do_kill_instances(True)
File "/source/qemu/tests/docker/docker.py", line 154, in
_do_kill_instances

    resp = self._output(["inspect", i])
  File "/source/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)
make[1]: *** [/source/qemu/tests/docker/Makefile.include:39:
docker-image-debian9] Interrupt
CalledProcessError: Command '['docker', 'inspect', '9fc7dac8cd07']' 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 "/source/qemu/tests/docker/docker.py", line 174, in _kill_instances
return self._do_kill_instances(True)
File "/source/qemu/tests/docker/docker.py", line 154, in
_do_kill_instances

    resp = self._output(["inspect", i])
  File "/source/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', '9fc7dac8cd07']' returned non-zero exit status 1
make: *** [/source/qemu/tests/Makefile.include:928:
build-tcg-tests-aarch64_be-linux-user] Interrupt
make[1]: *** [/source/qemu/tests/docker/Makefile.include:39:
docker-image-debian9] Interrupt
make: *** [/source/qemu/tests/Makefile.include:928:
build-tcg-tests-aarch64-linux-user] Interrupt
make[1]: *** [/source/qemu/tests/docker/Makefile.include:39:
docker-image-debian9] Interrupt
make: *** [/source/qemu/tests/Makefile.include:928:
build-tcg-tests-arm-linux-user] Interrupt
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 "/source/qemu/tests/docker/docker.py", line 174, in _kill_instances
return self._do_kill_instances(True)
File "/source/qemu/tests/docker/docker.py", line 154, in
_do_kill_instances

    resp = self._output(["inspect", i])
  File "/source/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', '9fc7dac8cd07']' 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 "/source/qemu/tests/docker/docker.py", line 174, in _kill_instances
return self._do_kill_instances(True)
File "/source/qemu/tests/docker/docker.py", line 154, in
_do_kill_instances

    resp = self._output(["inspect", i])
  File "/source/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', '9fc7dac8cd07']' returned non-zero exit status 1
make[1]: *** [/source/qemu/tests/docker/Makefile.include:39:
docker-image-debian-sid] Interrupt
make: *** [/source/qemu/tests/Makefile.include:928:
build-tcg-tests-alpha-linux-user] Interrupt

#97 lore raw

PATCH v3 46/46 tests/tcg: override runners for broken tests (!UPSTREAM)

In reply to Alex Bennée

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

---
 tests/tcg/alpha/Makefile.target   |  4 ++++
 tests/tcg/hppa/Makefile.target    | 10 ++++++++++
 tests/tcg/i386/Makefile.target    | 13 +++++++++++++
 tests/tcg/m68k/Makefile.target    | 11 +++++++++++
 tests/tcg/mips/Makefile.target    | 10 ++++++++++
 tests/tcg/s390x/Makefile.target   |  6 ++++++
 tests/tcg/sh4/Makefile.target     |  6 ++++++
 tests/tcg/sparc64/Makefile.target |  8 ++++++++
 8 files changed, 68 insertions(+)
 create mode 100644 tests/tcg/hppa/Makefile.target
 create mode 100644 tests/tcg/m68k/Makefile.target
 create mode 100644 tests/tcg/s390x/Makefile.target
 create mode 100644 tests/tcg/sh4/Makefile.target
 create mode 100644 tests/tcg/sparc64/Makefile.target
tests/tcg/alpha/Makefile.target +4 -0
index 5b573f145e..a075b0e25e 100644
@@ -30,3 +30,7 @@ test-cmov: test-cmov.o crt.o
 
 test-ovf: test-ovf.c crt.o
 	$(ALPHA_BUILD)
+
+# Currently broken
+run-linux-test: linux-test
+	$(call quiet-command, /bin/true, "BROKEN TEST", "$< SKIPPED on $(TARGET_NAME)")
tests/tcg/hppa/Makefile.target new file +10 -0
new file mode 100644
index 0000000000..25b6b5d819
@@ -0,0 +1,10 @@
+# -*- Mode: makefile -*-
+#
+# HPPA specific tweaks - specifically masking out broken tests
+
+run-linux-test: linux-test
+	$(call quiet-command, /bin/true, "BROKEN TEST", "$< SKIPPED on $(TARGET_NAME)")
+
+# Currently broken for -p
+run-test-mmap: test-mmap
+	$(call quiet-command, $(QEMU) $< > test-mmap.out, "TEST", "$< (default) on $(TARGET_NAME)")
tests/tcg/i386/Makefile.target +13 -0
index 27086c3f2b..a01309d5f4 100644
@@ -37,3 +37,16 @@ pi_10.com:
 run-runcom: runcom pi_10.com
 	$(call quiet-command, $(QEMU) ./runcom ./pi_10.com > runcom.out, "TEST", "$< on $(TARGET_NAME)")
 
+# Currently broken tests on i386
+ifeq ($(TARGET_NAME), i386)
+run-linux-test: linux-test
+	$(call quiet-command, /bin/true, "BROKEN TEST", "$< SKIPPED on $(TARGET_NAME)")
+
+run-test-i386-fprem: test-i386-fprem
+	$(call quiet-command, /bin/true, "SLOW TEST", "$< SKIPPED on $(TARGET_NAME)")
+
+# Currently broken for -p
+run-test-mmap: test-mmap
+	$(call quiet-command, $(QEMU) $< > test-mmap.out, "TEST", "$< (default) on $(TARGET_NAME)")
+
+endif
tests/tcg/m68k/Makefile.target new file +11 -0
new file mode 100644
index 0000000000..97bc0c9d07
@@ -0,0 +1,11 @@
+# -*- Mode: makefile -*-
+#
+# m68k specific tweaks - specifically masking out broken tests
+#
+
+# Currently broken for -p
+run-test-mmap: test-mmap
+	$(call quiet-command, $(QEMU) $< > test-mmap.out, "TEST", "$< (default) on $(TARGET_NAME)")
+
+run-linux-test: linux-test
+	$(call quiet-command, /bin/true, "BROKEN TEST", "$< SKIPPED on $(TARGET_NAME)")
tests/tcg/mips/Makefile.target +10 -0
index 71f0c2dd53..1f673fce2e 100644
@@ -17,3 +17,13 @@ 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 quiet-command, /bin/true, "BROKEN TEST", "$< SKIPPED on $(TARGET_NAME)")
+
+ifeq ($(TARGET_NAME), mips64)
+
+run-linux-test: linux-test
+	$(call quiet-command, /bin/true, "BROKEN TEST", "$< SKIPPED on $(TARGET_NAME)")
+
+endif
tests/tcg/s390x/Makefile.target new file +6 -0
new file mode 100644
index 0000000000..10e61c422b
@@ -0,0 +1,6 @@
+# -*- Mode: makefile -*-
+#
+# s390x specific tweaks - specifically masking out broken tests
+
+run-linux-test: linux-test
+	$(call quiet-command, /bin/true, "BROKEN TEST", "$< SKIPPED on $(TARGET_NAME)")
tests/tcg/sh4/Makefile.target new file +6 -0
new file mode 100644
index 0000000000..c57f398017
@@ -0,0 +1,6 @@
+# -*- Mode: makefile -*-
+#
+# SH4 specific tweaks - specifically masking out broken tests
+
+run-linux-test: linux-test
+	$(call quiet-command, /bin/true, "BROKEN TEST", "$< SKIPPED on $(TARGET_NAME)")
tests/tcg/sparc64/Makefile.target new file +8 -0
new file mode 100644
index 0000000000..e971a5c818
@@ -0,0 +1,8 @@
+# -*- Mode: makefile -*-
+#
+# sparc specific tweaks - specifically 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 quiet-command, /bin/true, "BROKEN TEST", "$< SKIPPED on $(TARGET_NAME)")
Signature · 1 line
2.17.0
#98 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 v3 00/46] 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'
ff876b3ed2 tests/tcg: override runners for broken tests (!UPSTREAM) 45dafe5224 tests/Makefile.include: add [build|clean|check]-tcg targets bd27be19a8 Makefile.target: add (clean-)guest-tests targets cec6f937da tests/tcg/Makefile: update to be called from Makefile.target 67fe064c30 tests/tcg: enable building for mips64
3baf3c795e tests/tcg: enable building for sparc64
ab08564ecf tests/tcg: enable building for sh4
15d108f077 tests/tcg: enable building for m68k
8a42b8e70c tests/tcg: enable building for HPPA
4481298d23 tests/tcg/alpha: fix warnings about write() d8eac0851c tests/tcg/alpha: add Alpha specific tests de7f346110 tests/tcg: enable building for Alpha
1bbaaf0ea5 tests/tcg: enable building for ppc64
272347cf05 tests/tcg: enable building for s390x
759cb1da53 tests/tcg/mips: include common mips hello-mips 8808039b55 tests/tcg: enable building for MIPS
1c496b7264 tests/tcg: move MIPS specific tests into subdir 9f41829c5b tests/tcg/aarch64: add fcvt test cases for AArch64 a567adc375 tests/tcg/aarch64: add Makefile.target
aba36f4232 tests/tcg/arm: fix up test-arm-iwmmxt test 2607ac3ef8 tests/tcg: move ARM specific tests into subdir 4e1168cef4 tests/tcg/i386/test-i386: fix printf format ae1eebb683 tests/tcg/i386/test-i386: use modern vector_size attributes 163409da89 tests/tcg/x86_64: add Makefile.target
f4916925ae tests/tcg/i386: disable i386 version of test-i386-ssse 5366eee797 tests/tcg/i386: fix test-i386-fprem
ee864a5517 tests/tcg/i386: fix test-i386
1fcf9f7e22 tests/tcg/i386: Build fix for hello-i386 c62ad0105a tests/tcg: enable building for i386
08440c24e8 docker: Add fedora-i386-cross image
7f3f03647d tests/tcg: move i386 specific tests into subdir c71c9d8d20 tests/tcg/multiarch: move most output to stdout 945092fc3f tests/tcg/multiarch: enable additional linux-test tests 01814df5f5 tests/tcg/multiarch: Build fix for linux-test 709eb7201d tests/tcg: move architecture independent tests into subdir 4d12ac26c0 docker: Makefile.include introduce DOCKER_SCRIPT a2790883a1 docker: allow "cc" command to run in user context 25e49baf0a docker: extend "cc" command to accept compiler 4e7d4ee7a2 docker: Add "cc" subcommand
1a895c1c6c Makefile: Rename TARGET_DIRS to TARGET_LIST aa6bbbf1be configure: set cross_cc_FOO for host compiler 33f6f01ee9 configure: allow user to specify --cross-cc-cflags-foo= 2a07647761 configure: move i386_cc to cross_cc_i386 7af0f78d24 configure: add support for --cross-cc-FOO a55d00f935 configure: add test for docker availability ed713feee4 docker: add "probe" command for configure

=== OUTPUT BEGIN ===
Checking PATCH 1/46: docker: add "probe" command for configure... Checking PATCH 2/46: configure: add test for docker availability... Checking PATCH 3/46: configure: add support for --cross-cc-FOO... Checking PATCH 4/46: configure: move i386_cc to cross_cc_i386... Checking PATCH 5/46: configure: allow user to specify --cross-cc-cflags-foo=... Checking PATCH 6/46: configure: set cross_cc_FOO for host compiler... Checking PATCH 7/46: Makefile: Rename TARGET_DIRS to TARGET_LIST... Checking PATCH 8/46: docker: Add "cc" subcommand...
Checking PATCH 9/46: docker: extend "cc" command to accept compiler... Checking PATCH 10/46: docker: allow "cc" command to run in user context... Checking PATCH 11/46: docker: Makefile.include introduce DOCKER_SCRIPT... Checking PATCH 12/46: tests/tcg: move architecture independent tests into subdir... Checking PATCH 13/46: tests/tcg/multiarch: Build fix for linux-test...
ERROR: if this code is redundant consider removing it
#153: 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 14/46: tests/tcg/multiarch: enable additional linux-test tests... Checking PATCH 15/46: tests/tcg/multiarch: move most output to stdout...
ERROR: code indent should never use tabs
#24: FILE: tests/tcg/multiarch/test-mmap.c:60:
+^Ifprintf (stdout, "%s", __func__);$

ERROR: space prohibited between function name and open parenthesis '(' #24: FILE: tests/tcg/multiarch/test-mmap.c:60:
+ fprintf (stdout, "%s", __func__);

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

ERROR: space prohibited between function name and open parenthesis '(' #33: FILE: tests/tcg/multiarch/test-mmap.c:109:
+ fprintf (stdout, " passed\n");

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

ERROR: space prohibited between function name and open parenthesis '(' #42: FILE: tests/tcg/multiarch/test-mmap.c:118:
+ fprintf (stdout, "%s", __func__);

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

ERROR: space prohibited between function name and open parenthesis '(' #51: FILE: tests/tcg/multiarch/test-mmap.c:133:
+ fprintf (stdout, " passed\n");

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

ERROR: space prohibited between function name and open parenthesis '(' #60: FILE: tests/tcg/multiarch/test-mmap.c:144:
+ fprintf (stdout, "%s", __func__);

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

ERROR: space prohibited between function name and open parenthesis '(' #69: FILE: tests/tcg/multiarch/test-mmap.c:183:
+ fprintf (stdout, " passed\n");

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

ERROR: space prohibited between function name and open parenthesis '(' #78: FILE: tests/tcg/multiarch/test-mmap.c:197:
+ fprintf (stdout, "%s addr=%p", __func__, addr);

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

ERROR: space prohibited between function name and open parenthesis '(' #87: FILE: tests/tcg/multiarch/test-mmap.c:215:
+ fprintf (stdout, " passed\n");

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

ERROR: space prohibited between function name and open parenthesis '(' #97: FILE: tests/tcg/multiarch/test-mmap.c:228:
+ fprintf (stdout, "%s addr=%p", __func__, addr);

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

ERROR: space prohibited between function name and open parenthesis '(' #98: FILE: tests/tcg/multiarch/test-mmap.c:229:
+ fprintf (stdout, "FIXME: QEMU fails to track pages used by the host.");

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

ERROR: space prohibited between function name and open parenthesis '(' #107: FILE: tests/tcg/multiarch/test-mmap.c:246:
+ fprintf (stdout, " passed\n");

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

ERROR: space prohibited between function name and open parenthesis '(' #116: FILE: tests/tcg/multiarch/test-mmap.c:255:
+ fprintf (stdout, "%s", __func__);

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

ERROR: space prohibited between function name and open parenthesis '(' #125: FILE: tests/tcg/multiarch/test-mmap.c:297:
+ fprintf (stdout, " passed\n");

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

ERROR: space prohibited between function name and open parenthesis '(' #134: FILE: tests/tcg/multiarch/test-mmap.c:307:
+ fprintf (stdout, "%s", __func__);

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

ERROR: space prohibited between function name and open parenthesis '(' #143: FILE: tests/tcg/multiarch/test-mmap.c:330:
+ fprintf (stdout, " passed\n");

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

ERROR: space prohibited between function name and open parenthesis '(' #152: FILE: tests/tcg/multiarch/test-mmap.c:346:
+ fprintf (stdout, "%s addr=%p", __func__, (void *)addr);

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

ERROR: space prohibited between function name and open parenthesis '(' #161: FILE: tests/tcg/multiarch/test-mmap.c:374:
+ fprintf (stdout, " passed\n");

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

ERROR: space prohibited between function name and open parenthesis '(' #170: FILE: tests/tcg/multiarch/test-mmap.c:387:
+ fprintf (stdout, "%s addr=%p", __func__, (void *)addr);

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

ERROR: space prohibited between function name and open parenthesis '(' #179: FILE: tests/tcg/multiarch/test-mmap.c:429:
+ fprintf (stdout, " passed\n");

total: 38 errors, 0 warnings, 146 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/46: tests/tcg: move i386 specific tests into subdir... Checking PATCH 17/46: docker: Add fedora-i386-cross image... Checking PATCH 18/46: tests/tcg: enable building for i386... Checking PATCH 19/46: tests/tcg/i386: Build fix for hello-i386...
ERROR: externs should be avoided in .c files
#21: 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 20/46: tests/tcg/i386: fix test-i386...
Checking PATCH 21/46: tests/tcg/i386: fix test-i386-fprem...
Checking PATCH 22/46: tests/tcg/i386: disable i386 version of test-i386-ssse... Checking PATCH 23/46: tests/tcg/x86_64: add Makefile.target... Checking PATCH 24/46: tests/tcg/i386/test-i386: use modern vector_size attributes... Checking PATCH 25/46: tests/tcg/i386/test-i386: fix printf format... Checking PATCH 26/46: tests/tcg: move ARM specific tests into subdir... Checking PATCH 27/46: tests/tcg/arm: fix up test-arm-iwmmxt test... Checking PATCH 28/46: tests/tcg/aarch64: add Makefile.target... Checking PATCH 29/46: tests/tcg/aarch64: add fcvt test cases for AArch64...
ERROR: space prohibited before open square bracket '['
#281: FILE: tests/tcg/aarch64/fcvt.c:244:
+ : /* no output */ : [flags] "n" (1 << 26) : "x1" );

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

total: 2 errors, 0 warnings, 1587 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/46: tests/tcg: move MIPS specific tests into subdir... Checking PATCH 31/46: tests/tcg: enable building for MIPS... Checking PATCH 32/46: tests/tcg/mips: include common mips hello-mips... Checking PATCH 33/46: tests/tcg: enable building for s390x... Checking PATCH 34/46: tests/tcg: enable building for ppc64... Checking PATCH 35/46: tests/tcg: enable building for Alpha... Checking PATCH 36/46: tests/tcg/alpha: add Alpha specific tests... Checking PATCH 37/46: tests/tcg/alpha: fix warnings about write()...
ERROR: externs should be avoided in .c files
#20: FILE: tests/tcg/alpha/hello-alpha.c:1:
+void write(int, char*, int);

ERROR: externs should be avoided in .c files
#30: FILE: tests/tcg/alpha/test-cond.c:1:
+void write(int, char*, int);

ERROR: externs should be avoided in .c files
#39: FILE: tests/tcg/alpha/test-ovf.c:1:
+void write(int, char*, int);

total: 3 errors, 0 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 38/46: tests/tcg: enable building for HPPA...
Checking PATCH 39/46: tests/tcg: enable building for m68k...
Checking PATCH 40/46: tests/tcg: enable building for sh4...
Checking PATCH 41/46: tests/tcg: enable building for sparc64... Checking PATCH 42/46: tests/tcg: enable building for mips64...
Checking PATCH 43/46: tests/tcg/Makefile: update to be called from Makefile.target... Checking PATCH 44/46: Makefile.target: add (clean-)guest-tests targets... Checking PATCH 45/46: tests/Makefile.include: add [build|clean|check]-tcg targets... Checking PATCH 46/46: tests/tcg: override runners for broken tests (!UPSTREAM)... === OUTPUT END ===

Test command exited with code: 1

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

#99 lore raw
In reply to Alex Bennée
Quoted 6 lines

This is starting to shape up pretty nicely. I was able to add a whole bunch of additional architectures thanks to cross compilers in Debian Sid which are there to support the Debian "ports". These may not be around for ever, most "ports" are on the way out, but they will be the last thing to drop out of the Sid repo. Maybe when Debian stops caring (and no other distro does) maybe we should to?

I *think* working with Sid is not recommended as very unstable and not reproducible. A reproducible way is to use the Debian Snapshot Archive
(http://snapshot.debian.org/) eventually using package specific version and holding packages at this version.

I found an example in the following post:
https://blog.sleeplessbeastie.eu/2017/07/17/how-to-install-packages-using-repository-snapshot/

(I Cc'ed Debian experts who might have a better idea).

For stable releases, this shouldn't be a problem since End of Life Debian versions stay on archive.debian.org; as for Docker images:

https://hub.docker.com/r/debian/eol/

Quoted 4 lines

However compiling big-endian targets continues to be a massive pain as even if compilers support switching endianess with flags you are usually let down by a partial set of headers or the linker not being able to link against wrong-endian crt.o or libgcc files. Ultimately

¯\_(ツ)_/¯ https://bugs.launchpad.net/gcc-arm-embedded/+bug/1718206

Quoted 234 lines

any guests that are not supported by any distro are probably going to be stuck with bare metal or hand crafted tests like in tests/tcg/alpha.

The final patch (tests/tcg: override runners for broken tests) suppresses a bunch of tests that fail on different guest setups. This was to allow me to test "make check-tcg" could make it all the way through. I'm sure some of them are bugs that need fixing so it would be cool if maintainers could look through and see if there are any easy wins.

Major Changes:
- check-tcg now runs the tests (c.f build-tcg/clean-tcg)
- clean use of quiet-command for CROSS-BUILD/RUN-TESTS and TEST
- bunch of additional targets (alpha, hppa, m68k, sh4, sparc64, mips64)
- review comments and tags
- dropped fp-test and additional aarch64 tests for now

As usual detailed notes are bellow the --- in the commit messages.

Currently un-reviewed:

patch 0002/configure add test for docker availability.patch needs review patch 0003/configure add support for cross cc FOO.patch needs review patch 0004/configure move i386_cc to cross_cc_i386.patch needs review patch 0005/configure allow user to specify cross cc cflags f.patch needs review patch 0014/tests tcg multiarch enable additional linux test .patch needs review patch 0015/tests tcg multiarch move most output to stdout.patch needs review patch 0017/docker Add fedora i386 cross image.patch needs review patch 0018/tests tcg enable building for i386.patch needs review patch 0021/tests tcg i386 fix test i386 fprem.patch needs review patch 0022/tests tcg i386 disable i386 version of test i386 .patch needs review patch 0023/tests tcg x86_64 add Makefile.target.patch needs review patch 0025/tests tcg i386 test i386 fix printf format.patch needs review patch 0027/tests tcg arm fix up test arm iwmmxt test.patch needs review patch 0028/tests tcg aarch64 add Makefile.target.patch needs review patch 0029/tests tcg aarch64 add fcvt test cases for AArch64.patch needs review patch 0031/tests tcg enable building for MIPS.patch needs review patch 0032/tests tcg mips include common mips hello mips.patch needs review patch 0035/tests tcg enable building for Alpha.patch needs review patch 0036/tests tcg alpha add Alpha specific tests.patch needs review patch 0037/tests tcg alpha fix warnings about write.patch needs review patch 0038/tests tcg enable building for HPPA.patch needs review patch 0039/tests tcg enable building for m68k.patch needs review patch 0040/tests tcg enable building for sh4.patch needs review patch 0041/tests tcg enable building for sparc64.patch needs review patch 0042/tests tcg enable building for mips64.patch needs review patch 0043/tests tcg Makefile update to be called from Makef.patch needs review patch 0044/Makefile.target add clean guest tests targets.patch needs review patch 0046/tests tcg override runners for broken tests UPSTR.patch needs review

Alex Bennée (41):
configure: add test for docker availability
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: fix test-i386-fprem tests/tcg/i386: disable i386 version of test-i386-ssse 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/arm: fix up test-arm-iwmmxt test tests/tcg/aarch64: add Makefile.target tests/tcg/aarch64: add fcvt test cases for AArch64 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/alpha: fix warnings about write() 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/Makefile: update to be called from Makefile.target Makefile.target: add (clean-)guest-tests targets tests/Makefile.include: add [build|clean|check]-tcg targets tests/tcg: override runners for broken tests (!UPSTREAM)

Fam Zheng (4):
Makefile: Rename TARGET_DIRS to TARGET_LIST
tests/tcg/multiarch: Build fix for linux-test
docker: Add fedora-i386-cross image
tests/tcg/i386: Build fix for hello-i386

Peter Maydell (1):
docker: add "probe" command for configure

 Makefile                                      |   20 +-
 Makefile.target                               |    5 +
 configure                                     |  136 +-
 scripts/create_config                         |    2 +-
 tests/Makefile.include                        |   28 +-
 tests/docker/Makefile.include                 |   16 +-
 tests/docker/docker.py                        |   49 +
 .../dockerfiles/debian-alpha-cross.docker     |   12 +
 .../dockerfiles/debian-cross-build.docker     |   36 +
 .../dockerfiles/debian-hppa-cross.docker      |   12 +
 .../dockerfiles/debian-m68k-cross.docker      |   12 +
 .../dockerfiles/debian-mips64-cross.docker    |   12 +
 .../dockerfiles/debian-sh4-cross.docker       |   12 +
 tests/docker/dockerfiles/debian-sid.docker    |   23 +
 .../dockerfiles/debian-sparc64-cross.docker   |   12 +
 .../dockerfiles/fedora-i386-cross.docker      |   14 +
 tests/tcg/Makefile                            |  193 +--
 tests/tcg/Makefile.include                    |   86 ++
 tests/tcg/README                              |   69 +-
 tests/tcg/aarch64/Makefile.target             |   13 +
 tests/tcg/aarch64/fcvt.c                      |  260 ++++
 tests/tcg/aarch64/fcvt.out                    | 1305 +++++++++++++++++
 tests/tcg/alpha/Makefile                      |   35 -
 tests/tcg/alpha/Makefile.include              |    2 +
 tests/tcg/alpha/Makefile.target               |   36 +
 tests/tcg/alpha/{crt.s => crt.S}              |    0
 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.target                 |   20 +
 tests/tcg/arm/README                          |   11 +
 tests/tcg/{ => arm}/hello-arm.c               |    0
 .../test-arm-iwmmxt.S}                        |    0
 tests/tcg/hppa/Makefile.include               |    2 +
 tests/tcg/hppa/Makefile.target                |   10 +
 tests/tcg/i386/Makefile.include               |    9 +
 tests/tcg/i386/Makefile.target                |   52 +
 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                |   11 +
 tests/tcg/mips/Makefile.include               |   20 +
 tests/tcg/mips/Makefile.target                |   29 +
 tests/tcg/mips/README                         |    7 +
 tests/tcg/{ => mips}/hello-mips.c             |    0
 tests/tcg/multiarch/Makefile.target           |   29 +
 tests/tcg/multiarch/README                    |    1 +
 tests/tcg/{ => multiarch}/linux-test.c        |   93 +-
 tests/tcg/{ => multiarch}/sha1.c              |    0
 tests/tcg/{ => multiarch}/test-mmap.c         |   38 +-
 tests/tcg/{ => multiarch}/testthread.c        |    0
 tests/tcg/ppc64le/Makefile.include            |    2 +
 tests/tcg/s390x/Makefile.include              |    2 +
 tests/tcg/s390x/Makefile.target               |    6 +
 tests/tcg/sh4/Makefile.include                |    4 +
 tests/tcg/sh4/Makefile.target                 |    6 +
 tests/tcg/sparc64/Makefile.include            |    2 +
 tests/tcg/sparc64/Makefile.target             |    8 +
 tests/tcg/test_path.c                         |  157 --
 tests/tcg/x86_64/Makefile.target              |   15 +
 70 files changed, 2495 insertions(+), 504 deletions(-)
 create mode 100644 tests/docker/dockerfiles/debian-alpha-cross.docker
 create mode 100644 tests/docker/dockerfiles/debian-cross-build.docker
 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-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/docker/dockerfiles/fedora-i386-cross.docker
 create mode 100644 tests/tcg/Makefile.include
 create mode 100644 tests/tcg/aarch64/Makefile.target
 create mode 100644 tests/tcg/aarch64/fcvt.c
 create mode 100644 tests/tcg/aarch64/fcvt.out
 delete mode 100644 tests/tcg/alpha/Makefile
 create mode 100644 tests/tcg/alpha/Makefile.include
 create mode 100644 tests/tcg/alpha/Makefile.target
 rename tests/tcg/alpha/{crt.s => crt.S} (100%)
 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/{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 (87%)
 rename tests/tcg/{ => multiarch}/sha1.c (100%)
 rename tests/tcg/{ => multiarch}/test-mmap.c (94%)
 rename tests/tcg/{ => multiarch}/testthread.c (100%)
 create mode 100644 tests/tcg/ppc64le/Makefile.include
 create mode 100644 tests/tcg/s390x/Makefile.include
 create mode 100644 tests/tcg/s390x/Makefile.target
 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
#100 lore raw

Philippe Mathieu-Daudé, le mar. 24 avril 2018 22:25:18 -0300, a ecrit:

Quoted 12 lines
Quoted 6 lines

This is starting to shape up pretty nicely. I was able to add a whole bunch of additional architectures thanks to cross compilers in Debian Sid which are there to support the Debian "ports". These may not be around for ever, most "ports" are on the way out, but they will be the last thing to drop out of the Sid repo. Maybe when Debian stops caring (and no other distro does) maybe we should to?

I *think* working with Sid is not recommended as very unstable and not reproducible. A reproducible way is to use the Debian Snapshot Archive
(http://snapshot.debian.org/) eventually using package specific version and holding packages at this version.

Quoted 4 lines

I found an example in the following post:
https://blog.sleeplessbeastie.eu/2017/07/17/how-to-install-packages-using-repository-snapshot/

(I Cc'ed Debian experts who might have a better idea).

That looks like the correct idea :)
(basically what we use to make "releases" of the hurd port, as sid snapshots).

Samuel

#101 lore raw
Quoted 13 lines · Samuel Thibault

Philippe Mathieu-Daudé, le mar. 24 avril 2018 22:25:18 -0300, a ecrit:

Quoted 12 lines
Quoted 6 lines

This is starting to shape up pretty nicely. I was able to add a whole bunch of additional architectures thanks to cross compilers in Debian Sid which are there to support the Debian "ports". These may not be around for ever, most "ports" are on the way out, but they will be the last thing to drop out of the Sid repo. Maybe when Debian stops caring (and no other distro does) maybe we should to?

I *think* working with Sid is not recommended as very unstable and not reproducible. A reproducible way is to use the Debian Snapshot Archive
(http://snapshot.debian.org/) eventually using package specific version and holding packages at this version.

Quoted 8 lines
Quoted 4 lines

I found an example in the following post:
https://blog.sleeplessbeastie.eu/2017/07/17/how-to-install-packages-using-repository-snapshot/

(I Cc'ed Debian experts who might have a better idea).

That looks like the correct idea :)
(basically what we use to make "releases" of the hurd port, as sid snapshots).

So how would this work in docker. Should I take for example the sid-20180312 tag and then just munge sources.list to the appropriate snapshot url?

That said I'm relatively sanguine about the stability of the toolchain in sid. It would be the last thing to bitrot as once the toolchain is dead the distro dies with it so it is the last thing to die and the first thing to fix.

--
Alex Bennée