diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2019-03-14 13:04:46 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2019-03-14 13:04:46 +0000 |
commit | e4770dd95a59584a8d077f3f57c2356791dec870 (patch) | |
tree | 90a89c3571b11cefebd823fade300bde291a822e /tests | |
parent | f6c63c0dbf3d83faca481153c918c1a9abd29e60 (diff) | |
parent | dab3a7c0f54cedc542205fb6f29184b510dfe479 (diff) |
Merge remote-tracking branch 'remotes/stsquad/tags/pull-testing-for-4.0-120319-1' into staging
Final testing fixes for 4.0
- various CI tweaks and fixes
- fixes for some tcg tests
- addition of system tcg tests
# gpg: Signature made Tue 12 Mar 2019 17:07:24 GMT
# gpg: using RSA key 6685AE99E75167BCAFC8DF35FBD0DB095A9E2A44
# gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>" [full]
# Primary key fingerprint: 6685 AE99 E751 67BC AFC8 DF35 FBD0 DB09 5A9E 2A44
* remotes/stsquad/tags/pull-testing-for-4.0-120319-1: (26 commits)
.travis.yml: add softmmu check-tcg tests
.travis.yml: separate softfloat from check-tcg
tests/tcg/arm: account for pauth randomness
tests/tcg/i386: add memory test to exercise softmmu
tests/tcg/i386: add system mode Hello World test
tests/tcg: provide a minilib for system tests
tests/tcg: enable cris base user-mode tests
tests/tcg/cris: align mul operations
tests/tcg/cris: comment out the ccs test
tests/tcg: split cris tests into bare and libc directories
tests/tcg/cris: cleanup sys.c
tests/docker: add fedora-cris-cross compilers
tests/tcg/arm: add ARMv6-M UNDEFINED 32-bit instruction test
tests/tcg/xtensa: enable system tests
tests/docker: add debian-xtensa-cross image
tests/tcg/mips: fix hello-mips compilation
tests/tcg: add gdb runner variant
tests/tcg: split run-test into user and system variants
tests/tcg: add QEMU_OPT option for test runner
tests/tcg: enable tcg tests for softmmu
...
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.include | 9 | ||||
-rw-r--r-- | tests/docker/Makefile.include | 1 | ||||
-rw-r--r-- | tests/docker/dockerfiles/debian-xtensa-cross.docker | 31 | ||||
-rw-r--r-- | tests/docker/dockerfiles/fedora-cris-cross.docker | 8 | ||||
-rw-r--r-- | tests/tcg/Makefile | 41 | ||||
-rw-r--r-- | tests/tcg/Makefile.include | 2 | ||||
-rw-r--r-- | tests/tcg/aarch64/pauth-1.c | 26 | ||||
-rw-r--r-- | tests/tcg/arm/Makefile.softmmu-target | 29 | ||||
-rw-r--r-- | tests/tcg/arm/test-armv6m-undef.S | 154 | ||||
-rw-r--r-- | tests/tcg/arm/test-armv6m-undef.ld | 21 | ||||
-rw-r--r-- | tests/tcg/cris/Makefile | 168 | ||||
-rw-r--r-- | tests/tcg/cris/Makefile.include | 6 | ||||
-rw-r--r-- | tests/tcg/cris/Makefile.target | 58 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_addcv17.s (renamed from tests/tcg/cris/check_addcv17.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_addi.s (renamed from tests/tcg/cris/check_addi.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_addiv32.s (renamed from tests/tcg/cris/check_addiv32.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_addm.s (renamed from tests/tcg/cris/check_addm.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_addq.s (renamed from tests/tcg/cris/check_addq.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_addr.s (renamed from tests/tcg/cris/check_addr.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_addxc.s (renamed from tests/tcg/cris/check_addxc.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_addxm.s (renamed from tests/tcg/cris/check_addxm.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_addxr.s (renamed from tests/tcg/cris/check_addxr.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_andc.s (renamed from tests/tcg/cris/check_andc.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_andm.s (renamed from tests/tcg/cris/check_andm.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_andq.s (renamed from tests/tcg/cris/check_andq.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_andr.s (renamed from tests/tcg/cris/check_andr.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_asr.s (renamed from tests/tcg/cris/check_asr.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_ba.s (renamed from tests/tcg/cris/check_ba.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_bas.s (renamed from tests/tcg/cris/check_bas.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_bcc.s (renamed from tests/tcg/cris/check_bcc.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_boundc.s (renamed from tests/tcg/cris/check_boundc.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_boundr.s (renamed from tests/tcg/cris/check_boundr.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_btst.s (renamed from tests/tcg/cris/check_btst.s) | 14 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_clearfv32.s (renamed from tests/tcg/cris/check_clearfv32.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_clrjmp1.s (renamed from tests/tcg/cris/check_clrjmp1.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_cmp-2.s (renamed from tests/tcg/cris/check_cmp-2.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_cmpc.s (renamed from tests/tcg/cris/check_cmpc.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_cmpm.s (renamed from tests/tcg/cris/check_cmpm.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_cmpq.s (renamed from tests/tcg/cris/check_cmpq.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_cmpr.s (renamed from tests/tcg/cris/check_cmpr.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_cmpxc.s (renamed from tests/tcg/cris/check_cmpxc.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_cmpxm.s (renamed from tests/tcg/cris/check_cmpxm.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_dstep.s (renamed from tests/tcg/cris/check_dstep.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_jsr.s (renamed from tests/tcg/cris/check_jsr.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_lapc.s (renamed from tests/tcg/cris/check_lapc.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_lsl.s (renamed from tests/tcg/cris/check_lsl.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_lsr.s (renamed from tests/tcg/cris/check_lsr.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_mcp.s (renamed from tests/tcg/cris/check_mcp.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_movdelsr1.s (renamed from tests/tcg/cris/check_movdelsr1.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_movecr.s (renamed from tests/tcg/cris/check_movecr.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_movei.s (renamed from tests/tcg/cris/check_movei.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_movemr.s (renamed from tests/tcg/cris/check_movemr.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_movemrv32.s (renamed from tests/tcg/cris/check_movemrv32.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_mover.s (renamed from tests/tcg/cris/check_mover.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_moverm.s (renamed from tests/tcg/cris/check_moverm.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_movmp.s (renamed from tests/tcg/cris/check_movmp.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_movpmv32.s (renamed from tests/tcg/cris/check_movpmv32.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_movpr.s (renamed from tests/tcg/cris/check_movpr.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_movprv32.s (renamed from tests/tcg/cris/check_movprv32.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_movscr.s (renamed from tests/tcg/cris/check_movscr.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_movsm.s (renamed from tests/tcg/cris/check_movsm.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_movsr.s (renamed from tests/tcg/cris/check_movsr.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_movucr.s (renamed from tests/tcg/cris/check_movucr.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_movum.s (renamed from tests/tcg/cris/check_movum.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_movur.s (renamed from tests/tcg/cris/check_movur.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_mulv32.s (renamed from tests/tcg/cris/check_mulv32.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_mulx.s (renamed from tests/tcg/cris/check_mulx.s) | 11 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_neg.s (renamed from tests/tcg/cris/check_neg.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_not.s (renamed from tests/tcg/cris/check_not.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_orc.s (renamed from tests/tcg/cris/check_orc.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_orm.s (renamed from tests/tcg/cris/check_orm.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_orq.s (renamed from tests/tcg/cris/check_orq.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_orr.s (renamed from tests/tcg/cris/check_orr.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_ret.s (renamed from tests/tcg/cris/check_ret.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_scc.s (renamed from tests/tcg/cris/check_scc.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_subc.s (renamed from tests/tcg/cris/check_subc.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_subm.s (renamed from tests/tcg/cris/check_subm.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_subq.s (renamed from tests/tcg/cris/check_subq.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_subr.s (renamed from tests/tcg/cris/check_subr.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/check_xarith.s (renamed from tests/tcg/cris/check_xarith.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/crt.s (renamed from tests/tcg/cris/crt.s) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/bare/sys.c | 63 | ||||
-rw-r--r-- | tests/tcg/cris/bare/testutils.inc (renamed from tests/tcg/cris/testutils.inc) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/libc/check_abs.c (renamed from tests/tcg/cris/check_abs.c) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/libc/check_addc.c (renamed from tests/tcg/cris/check_addc.c) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/libc/check_addcm.c (renamed from tests/tcg/cris/check_addcm.c) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/libc/check_addo.c (renamed from tests/tcg/cris/check_addo.c) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/libc/check_addoq.c (renamed from tests/tcg/cris/check_addoq.c) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/libc/check_bound.c (renamed from tests/tcg/cris/check_bound.c) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/libc/check_ftag.c (renamed from tests/tcg/cris/check_ftag.c) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/libc/check_gcctorture_pr28634-1.c (renamed from tests/tcg/cris/check_gcctorture_pr28634-1.c) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/libc/check_gcctorture_pr28634.c (renamed from tests/tcg/cris/check_gcctorture_pr28634.c) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/libc/check_glibc_kernelversion.c (renamed from tests/tcg/cris/check_glibc_kernelversion.c) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/libc/check_hello.c (renamed from tests/tcg/cris/check_hello.c) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/libc/check_int64.c (renamed from tests/tcg/cris/check_int64.c) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/libc/check_lz.c (renamed from tests/tcg/cris/check_lz.c) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/libc/check_mapbrk.c (renamed from tests/tcg/cris/check_mapbrk.c) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/libc/check_mmap1.c (renamed from tests/tcg/cris/check_mmap1.c) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/libc/check_mmap2.c (renamed from tests/tcg/cris/check_mmap2.c) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/libc/check_mmap3.c (renamed from tests/tcg/cris/check_mmap3.c) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/libc/check_moveq.c (renamed from tests/tcg/cris/check_moveq.c) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/libc/check_openpf1.c (renamed from tests/tcg/cris/check_openpf1.c) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/libc/check_openpf2.c (renamed from tests/tcg/cris/check_openpf2.c) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/libc/check_openpf3.c (renamed from tests/tcg/cris/check_openpf3.c) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/libc/check_openpf5.c (renamed from tests/tcg/cris/check_openpf5.c) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/libc/check_settls1.c (renamed from tests/tcg/cris/check_settls1.c) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/libc/check_sigalrm.c (renamed from tests/tcg/cris/check_sigalrm.c) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/libc/check_stat1.c (renamed from tests/tcg/cris/check_stat1.c) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/libc/check_stat2.c (renamed from tests/tcg/cris/check_stat2.c) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/libc/check_stat3.c (renamed from tests/tcg/cris/check_stat3.c) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/libc/check_stat4.c (renamed from tests/tcg/cris/check_stat4.c) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/libc/check_swap.c (renamed from tests/tcg/cris/check_swap.c) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/libc/check_time2.c (renamed from tests/tcg/cris/check_time2.c) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/libc/crisutils.h (renamed from tests/tcg/cris/crisutils.h) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/libc/sys.h (renamed from tests/tcg/cris/sys.h) | 0 | ||||
-rw-r--r-- | tests/tcg/cris/sys.c | 59 | ||||
-rw-r--r-- | tests/tcg/i386/Makefile.softmmu-target | 46 | ||||
-rw-r--r-- | tests/tcg/i386/system/boot.S | 172 | ||||
-rw-r--r-- | tests/tcg/i386/system/hello.c | 14 | ||||
-rw-r--r-- | tests/tcg/i386/system/kernel.ld | 23 | ||||
-rw-r--r-- | tests/tcg/i386/system/memory.c | 243 | ||||
-rw-r--r-- | tests/tcg/minilib/Makefile.target | 21 | ||||
-rw-r--r-- | tests/tcg/minilib/minilib.h | 25 | ||||
-rw-r--r-- | tests/tcg/minilib/printf.c | 133 | ||||
-rw-r--r-- | tests/tcg/mips/Makefile.target | 11 | ||||
-rw-r--r-- | tests/tcg/mips/hello-mips.c | 2 | ||||
-rw-r--r-- | tests/tcg/xtensa/Makefile | 102 | ||||
-rw-r--r-- | tests/tcg/xtensa/Makefile.include | 11 | ||||
-rw-r--r-- | tests/tcg/xtensa/Makefile.softmmu-target | 42 |
129 files changed, 1188 insertions, 358 deletions
diff --git a/tests/Makefile.include b/tests/Makefile.include index a5719551dd..852f17b8c7 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -1061,10 +1061,9 @@ endif # Per guest TCG tests -LINUX_USER_TARGETS=$(filter %-linux-user,$(TARGET_DIRS)) -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_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(TARGET_DIRS)) +CLEAN_TCG_TARGET_RULES=$(patsubst %,clean-tcg-tests-%, $(TARGET_DIRS)) +RUN_TCG_TARGET_RULES=$(patsubst %,run-tcg-tests-%, $(TARGET_DIRS)) ifeq ($(HAVE_USER_DOCKER),y) # Probe for the Docker Builds needed for each build @@ -1091,7 +1090,7 @@ clean-tcg-tests-%: build-tcg: $(BUILD_TCG_TARGET_RULES) .PHONY: check-tcg -check-tcg: check-softfloat $(RUN_TCG_TARGET_RULES) +check-tcg: $(RUN_TCG_TARGET_RULES) .PHONY: clean-tcg clean-tcg: $(CLEAN_TCG_TARGET_RULES) diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include index 83d43c50e4..60314d293a 100644 --- a/tests/docker/Makefile.include +++ b/tests/docker/Makefile.include @@ -116,6 +116,7 @@ docker-image-tricore-cross: docker-image-debian9 DOCKER_PARTIAL_IMAGES += debian-alpha-cross debian-hppa-cross debian-m68k-cross debian-sh4-cross DOCKER_PARTIAL_IMAGES += debian-sparc64-cross debian-mips64-cross debian-riscv64-cross DOCKER_PARTIAL_IMAGES += debian-tricore-cross debian-powerpc-cross fedora-i386-cross +DOCKER_PARTIAL_IMAGES += fedora-cris-cross # Rules for building linux-user powered images # diff --git a/tests/docker/dockerfiles/debian-xtensa-cross.docker b/tests/docker/dockerfiles/debian-xtensa-cross.docker new file mode 100644 index 0000000000..afd2ab9163 --- /dev/null +++ b/tests/docker/dockerfiles/debian-xtensa-cross.docker @@ -0,0 +1,31 @@ +# +# Docker cross-compiler target +# +# This docker target builds on the debian stretch base image, +# using a prebuilt toolchains for Xtensa cores from: +# https://github.com/foss-xtensa/toolchain/releases +# +FROM debian:stretch-slim + +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt install -yy eatmydata +RUN DEBIAN_FRONTEND=noninteractive eatmydata \ + apt-get install -y --no-install-recommends \ + bison \ + build-essential \ + ca-certificates \ + curl \ + flex \ + gettext \ + git \ + python-minimal + +ENV CPU_LIST csp dc232b dc233c +ENV TOOLCHAIN_RELEASE 2018.02 + +RUN for cpu in $CPU_LIST; do \ + curl -#SL http://github.com/foss-xtensa/toolchain/releases/download/$TOOLCHAIN_RELEASE/x86_64-$TOOLCHAIN_RELEASE-xtensa-$cpu-elf.tar.gz \ + | tar -xzC /opt; \ + done + +ENV PATH $PATH:/opt/$TOOLCHAIN_RELEASE/xtensa-dc232b-elf/bin:/opt/$TOOLCHAIN_RELEASE/xtensa-dc233c-elf/bin:/opt/$TOOLCHAIN_RELEASE/xtensa-csp-elf/bin diff --git a/tests/docker/dockerfiles/fedora-cris-cross.docker b/tests/docker/dockerfiles/fedora-cris-cross.docker new file mode 100644 index 0000000000..b168ada615 --- /dev/null +++ b/tests/docker/dockerfiles/fedora-cris-cross.docker @@ -0,0 +1,8 @@ +# +# Cross compiler for cris system tests +# + +FROM fedora:latest +ENV PACKAGES gcc-cris-linux-gnu +RUN dnf install -y $PACKAGES +RUN rpm -q $PACKAGES | sort > /packages.txt diff --git a/tests/tcg/Makefile b/tests/tcg/Makefile index bf06415390..1cdd628e96 100644 --- a/tests/tcg/Makefile +++ b/tests/tcg/Makefile @@ -26,16 +26,23 @@ # # We also accept SPEED=slow to enable slower running tests # -# We also expect to be in the tests build dir for the FOO-linux-user. +# We also expect to be in the tests build dir for the FOO-(linux-user|softmmu). # -include ../../config-host.mak -include ../config-target.mak +# for including , in command strings +COMMA := , + quiet-command = $(if $(V),$1,$(if $(2),@printf " %-7s %s\n" $2 $3 && $1, @$1)) # $1 = test name, $2 = cmd, $3 = desc +ifdef CONFIG_USER_ONLY run-test = $(call quiet-command, timeout $(TIMEOUT) $2 > $1.out,"TEST",$3) +else +run-test = $(call quiet-command, timeout $(TIMEOUT) $2,"TEST",$3) +endif # $1 = test name, $2 = reference diff-out = $(call quiet-command, diff -u $1.out $2 | head -n 10,"DIFF","$1.out with $2") @@ -52,7 +59,13 @@ QEMU_CFLAGS= LDFLAGS= # The QEMU for this TARGET +ifdef CONFIG_USER_ONLY QEMU=../qemu-$(TARGET_NAME) +else +QEMU=../qemu-system-$(TARGET_NAME) +endif +QEMU_OPTS= + # If TCG debugging is enabled things are a lot slower ifeq ($(CONFIG_DEBUG_TCG),y) @@ -61,6 +74,7 @@ else TIMEOUT=15 endif +ifdef CONFIG_USER_ONLY # The order we include is important. We include multiarch, base arch # and finally arch if it's not the same as base arch. -include $(SRC_PATH)/tests/tcg/multiarch/Makefile.target @@ -77,6 +91,17 @@ endif %: %.c $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) +else +# For softmmu targets we include a different Makefile fragement as the +# build options for bare programs are usually pretty different. They +# are expected to provide their own build recipes. +-include $(SRC_PATH)/tests/tcg/minilib/Makefile.target +-include $(SRC_PATH)/tests/tcg/$(TARGET_BASE_ARCH)/Makefile.softmmu-target +ifneq ($(TARGET_BASE_ARCH),$(TARGET_NAME)) +-include $(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.softmmu-target +endif + +endif all: $(TESTS) @@ -92,8 +117,20 @@ all: $(TESTS) RUN_TESTS=$(patsubst %,run-%, $(TESTS)) RUN_TESTS+=$(EXTRA_RUNS) +ifdef CONFIG_USER_ONLY run-%: % - $(call run-test, $<, $(QEMU) $<, "$< on $(TARGET_NAME)") + $(call run-test, $<, $(QEMU) $(QEMU_OPTS) $<, "$< on $(TARGET_NAME)") +else +run-%: % + $(call run-test, $<, \ + $(QEMU) -monitor none -display none \ + -chardev file$(COMMA)path=$<.out$(COMMA)id=output \ + $(QEMU_OPTS) $<, \ + "$< on $(TARGET_NAME)") +endif + +gdb-%: % + gdb --args $(QEMU) $(QEMU_OPTS) $< .PHONY: run run: $(RUN_TESTS) diff --git a/tests/tcg/Makefile.include b/tests/tcg/Makefile.include index c581bd6ffc..73b5626fc5 100644 --- a/tests/tcg/Makefile.include +++ b/tests/tcg/Makefile.include @@ -67,7 +67,7 @@ endif ifneq ($(GUEST_BUILD),) guest-tests: $(GUEST_BUILD) -run-guest-tests: guest-tests qemu-$(TARGET_NAME) +run-guest-tests: guest-tests qemu-$(subst y,system-,$(CONFIG_SOFTMMU))$(TARGET_NAME) $(call quiet-command, \ (cd tests && $(MAKE) -f $(TCG_MAKE) SPEED=$(SPEED) run), \ "RUN", "tests for $(TARGET_NAME)") diff --git a/tests/tcg/aarch64/pauth-1.c b/tests/tcg/aarch64/pauth-1.c index ae6dc05c2b..a3c1443cd0 100644 --- a/tests/tcg/aarch64/pauth-1.c +++ b/tests/tcg/aarch64/pauth-1.c @@ -1,5 +1,6 @@ #include <assert.h> #include <sys/prctl.h> +#include <stdio.h> asm(".arch armv8.4-a"); @@ -8,16 +9,29 @@ asm(".arch armv8.4-a"); #define PR_PAC_APDAKEY (1 << 2) #endif +#define TESTS 1000 + int main() { - int x; + int x, i, count = 0; void *p0 = &x, *p1, *p2; + float perc; + + for (i = 0; i < TESTS; i++) { + asm volatile("pacdza %0" : "=r"(p1) : "0"(p0)); + prctl(PR_PAC_RESET_KEYS, PR_PAC_APDAKEY, 0, 0, 0); + asm volatile("pacdza %0" : "=r"(p2) : "0"(p0)); - asm volatile("pacdza %0" : "=r"(p1) : "0"(p0)); - prctl(PR_PAC_RESET_KEYS, PR_PAC_APDAKEY, 0, 0, 0); - asm volatile("pacdza %0" : "=r"(p2) : "0"(p0)); + if (p1 != p0) { + count++; + } + if (p1 != p2) { + count++; + } + } - assert(p1 != p0); - assert(p1 != p2); + perc = (float) count / (float) (TESTS * 2); + printf("Ptr Check: %0.2f%%", perc * 100.0); + assert(perc > 0.95); return 0; } diff --git a/tests/tcg/arm/Makefile.softmmu-target b/tests/tcg/arm/Makefile.softmmu-target new file mode 100644 index 0000000000..49d48d8a1c --- /dev/null +++ b/tests/tcg/arm/Makefile.softmmu-target @@ -0,0 +1,29 @@ +# -*- Mode: makefile -*- +# +# ARM SoftMMU tests - included from tests/tcg/Makefile +# + +ifeq ($(TARGET_ABI_DIR),arm) + +ARM_SRC=$(SRC_PATH)/tests/tcg/arm + +# Set search path for all sources +VPATH += $(ARM_SRC) + +ARM_TESTS=test-armv6m-undef + +TESTS += $(ARM_TESTS) + +CFLAGS+=-Wl,--build-id=none -x assembler-with-cpp +LDFLAGS+=-nostdlib -N -static + +%: %.S %.ld + $(CC) $(CFLAGS) $(ASFLAGS) $< -o $@ $(LDFLAGS) -T $(ARM_SRC)/$@.ld + +# Specific Test Rules + +test-armv6m-undef: EXTRA_CFLAGS+=-mcpu=cortex-m0 + +run-test-armv6m-undef: QEMU_OPTS+=-semihosting -M microbit -kernel + +endif diff --git a/tests/tcg/arm/test-armv6m-undef.S b/tests/tcg/arm/test-armv6m-undef.S new file mode 100644 index 0000000000..d18ca56b4a --- /dev/null +++ b/tests/tcg/arm/test-armv6m-undef.S @@ -0,0 +1,154 @@ +/* + * Test ARMv6-M UNDEFINED 32-bit instructions + * + * Copyright 2018 Red Hat Inc. + * + * This work is licensed under the terms of the GNU GPL, version 2 + * or later. See the COPYING file in the top-level directory. + */ + +/* + * Test that UNDEFINED 32-bit instructions fault as expected. This is an + * interesting test because ARMv6-M shares code with its more fully-featured + * siblings and it's necessary to verify that its limited instruction set is + * emulated correctly. + * + * The emulator must be invoked with -semihosting so that the test case can + * terminate with exit code 0 on success or 1 on failure. + * + * Failures can be debugged with -d in_asm,int,exec,cpu and the + * gdbstub (-S -s). + */ + +.syntax unified +.cpu cortex-m0 +.thumb + +/* + * Memory map + */ +#define SRAM_BASE 0x20000000 +#define SRAM_SIZE (16 * 1024) + +/* + * Semihosting interface on ARM T32 + * See "Semihosting for AArch32 and AArch64 Version 2.0 Documentation" by ARM + */ +#define semihosting_call bkpt 0xab +#define SYS_EXIT 0x18 + +vector_table: + .word SRAM_BASE + SRAM_SIZE /* 0. SP_main */ + .word exc_reset_thumb /* 1. Reset */ + .word 0 /* 2. NMI */ + .word exc_hard_fault_thumb /* 3. HardFault */ + .rept 7 + .word 0 /* 4-10. Reserved */ + .endr + .word 0 /* 11. SVCall */ + .word 0 /* 12. Reserved */ + .word 0 /* 13. Reserved */ + .word 0 /* 14. PendSV */ + .word 0 /* 15. SysTick */ + .rept 32 + .word 0 /* 16-47. External Interrupts */ + .endr + +exc_reset: +.equ exc_reset_thumb, exc_reset + 1 +.global exc_reset_thumb + /* The following 32-bit UNDEFINED instructions are tested by executing + * them. The HardFault exception handler should execute and return to + * the next test case. If no exception is raised the test fails. + */ + + /* Table A5-9 32-bit Thumb encoding */ + .short 0b1110100000000000 + .short 0b0000000000000000 + b not_reached + .short 0b1110100000000000 + .short 0b1000000000000000 + b not_reached + .short 0b1111100000000000 + .short 0b0000000000000000 + b not_reached + .short 0b1111100000000000 + .short 0b1000000000000000 + b not_reached + .short 0b1111000000000000 + .short 0b0000000000000000 + b not_reached + + /* Table A5-10 Branch and miscellaneous control instructions */ + .short 0b1111011111110000 + .short 0b1010000000000000 + b not_reached + + /* The following are valid 32-bit instructions that must not raise a + * HardFault. + */ + + /* B4.2.3 Move to Special Register (moves to IPSR are ignored) */ + msr ipsr, r0 + b 1f + b not_reached +1: + /* B4.2.2 Move from Special Register */ + mrs r0, ipsr + b 1f + b not_reached +1: + /* A6.7.13 Branch with Link (immediate) */ + bl 1f +1: + b 1f + b not_reached +1: + /* A6.7.21 Data Memory Barrier */ + dmb + b 1f + b not_reached +1: + /* A6.7.22 Data Synchronization Barrier */ + dsb + b 1f + b not_reached +1: + /* A6.7.24 Instruction Memory Barrier */ + isb + b 1f + b not_reached +1: + + /* Success! */ + movs r0, 1 + b exit + +not_reached: /* Failure :( */ + movs r0, 0 + b exit + +/* When a HardFault occurs, return to pc+6 (test cases are 3 halfwords long) */ +exc_hard_fault: +.equ exc_hard_fault_thumb, exc_hard_fault + 1 +.global exc_hard_fault_thumb + ldr r0, [sp, 0x18] + adds r0, 6 + str r0, [sp, 0x18] + bx lr + +/* + * exit: Terminate emulator + * @r0: 0 - failure, 1 - success + */ +exit: + movs r1, 0 + cmp r0, 1 + bne 1f + ldr r1, ADP_Stopped_ApplicationExit +1: + movs r0, SYS_EXIT + semihosting_call +.align 2 +ADP_Stopped_ApplicationExit: + .word 0x20026 diff --git a/tests/tcg/arm/test-armv6m-undef.ld b/tests/tcg/arm/test-armv6m-undef.ld new file mode 100644 index 0000000000..43dbbf17d5 --- /dev/null +++ b/tests/tcg/arm/test-armv6m-undef.ld @@ -0,0 +1,21 @@ +ENTRY(exc_reset_thumb) + +SECTIONS +{ + . = 0x0; + .text : { + *(.text) + } + .data : { + *(.data) + } + .rodata : { + *(.rodata) + } + .bss : { + *(.bss) + } + /DISCARD/ : { + *(.ARM.attributes) + } +} diff --git a/tests/tcg/cris/Makefile b/tests/tcg/cris/Makefile deleted file mode 100644 index 664b30ce81..0000000000 --- a/tests/tcg/cris/Makefile +++ /dev/null @@ -1,168 +0,0 @@ --include ../../../config-host.mak - -CROSS=crisv32-axis-linux-gnu- -SIM=../../../cris-linux-user/qemu-cris -L ./ -SIMG=cris-axis-linux-gnu-run --sysroot=./ - -CC = $(CROSS)gcc -#AS = $(CROSS)as -AS = $(CC) -x assembler-with-cpp -SIZE = $(CROSS)size -LD = $(CC) -OBJCOPY = $(CROSS)objcopy - -# we rely on GCC inline:ing the stuff we tell it to in many places here. -CFLAGS = -Winline -Wall -g -O2 -static -NOSTDFLAGS = -nostartfiles -nostdlib -ASFLAGS += -g -Wa,-I,$(SRC_PATH)/tests/tcg/cris/ -LDLIBS = -NOSTDLIBS = -lgcc - -CRT = crt.o -SYS = sys.o -TESTCASES += check_abs.tst -TESTCASES += check_addc.tst -TESTCASES += check_addcm.tst -TESTCASES += check_addcv17.tst -TESTCASES += check_addo.tst -TESTCASES += check_addoq.tst -TESTCASES += check_addi.tst -TESTCASES += check_addiv32.tst -TESTCASES += check_addm.tst -TESTCASES += check_addr.tst -TESTCASES += check_addq.tst -TESTCASES += check_addxc.tst -TESTCASES += check_addxm.tst -TESTCASES += check_addxr.tst -TESTCASES += check_andc.tst -TESTCASES += check_andm.tst -TESTCASES += check_andr.tst -TESTCASES += check_andq.tst -TESTCASES += check_asr.tst -TESTCASES += check_ba.tst -TESTCASES += check_bas.tst -TESTCASES += check_bcc.tst -TESTCASES += check_bound.tst -TESTCASES += check_boundc.tst -TESTCASES += check_boundr.tst -TESTCASES += check_btst.tst -TESTCASES += check_clearfv32.tst -TESTCASES += check_cmpc.tst -TESTCASES += check_cmpr.tst -TESTCASES += check_cmpq.tst -TESTCASES += check_cmpm.tst -TESTCASES += check_cmpxc.tst -TESTCASES += check_cmpxm.tst -TESTCASES += check_cmp-2.tst -TESTCASES += check_clrjmp1.tst -TESTCASES += check_dstep.tst -TESTCASES += check_ftag.tst -TESTCASES += check_int64.tst -# check_jsr is broken. -#TESTCASES += check_jsr.tst -TESTCASES += check_mcp.tst -TESTCASES += check_movei.tst -TESTCASES += check_mover.tst -TESTCASES += check_moverm.tst -TESTCASES += check_moveq.tst -TESTCASES += check_movemr.tst -TESTCASES += check_movemrv32.tst -TESTCASES += check_movecr.tst -TESTCASES += check_movmp.tst -TESTCASES += check_movpr.tst -TESTCASES += check_movprv32.tst -TESTCASES += check_movdelsr1.tst -TESTCASES += check_movpmv32.tst -TESTCASES += check_movsr.tst -TESTCASES += check_movsm.tst -TESTCASES += check_movscr.tst -TESTCASES += check_movur.tst -TESTCASES += check_movum.tst -TESTCASES += check_movucr.tst -TESTCASES += check_mulx.tst -TESTCASES += check_mulv32.tst -TESTCASES += check_neg.tst -TESTCASES += check_not.tst -TESTCASES += check_lz.tst -TESTCASES += check_lapc.tst -TESTCASES += check_lsl.tst -TESTCASES += check_lsr.tst -TESTCASES += check_orc.tst -TESTCASES += check_orm.tst -TESTCASES += check_orr.tst -TESTCASES += check_orq.tst -TESTCASES += check_ret.tst -TESTCASES += check_swap.tst -TESTCASES += check_scc.tst -TESTCASES += check_subc.tst -TESTCASES += check_subq.tst -TESTCASES += check_subr.tst -TESTCASES += check_subm.tst -TESTCASES += check_glibc_kernelversion.tst -TESTCASES += check_xarith.tst - -TESTCASES += check_hello.ctst -TESTCASES += check_stat1.ctst -TESTCASES += check_stat2.ctst -TESTCASES += check_stat3.ctst -TESTCASES += check_stat4.ctst -TESTCASES += check_openpf1.ctst -TESTCASES += check_openpf2.ctst -TESTCASES += check_openpf3.ctst -TESTCASES += check_openpf5.ctst -TESTCASES += check_mapbrk.ctst -TESTCASES += check_mmap1.ctst -TESTCASES += check_mmap2.ctst -TESTCASES += check_mmap3.ctst -TESTCASES += check_sigalrm.ctst -TESTCASES += check_time2.ctst -TESTCASES += check_settls1.ctst - -TESTCASES += check_gcctorture_pr28634-1.ctst -#TESTCASES += check_gcctorture_pr28634.ctst - -all: build - -%.o: $(SRC_PATH)/tests/tcg/cris/%.c - $(CC) $(CFLAGS) -c $< -o $@ - -%.o: $(SRC_PATH)/tests/tcg/cris/%.s - $(AS) $(ASFLAGS) -c $< -o $@ - -%.tst: %.o - $(CC) $(CFLAGS) $(NOSTDFLAGS) $(LDLIBS) $(NOSTDLIBS) $(CRT) $< $(SYS) -o $@ - -%.ctst: %.o - $(CC) $(CFLAGS) $(LDLIBS) $< -o $@ - - -sysv10.o: sys.c - $(CC) $(CFLAGS) -mcpu=v10 -c $< -o $@ - -crtv10.o: crt.s - $(AS) $(ASFLAGS) -mcpu=v10 -c $< -o $@ - -check_addcv17.tst: ASFLAGS += -mcpu=v10 -check_addcv17.tst: CRT := crtv10.o -check_addcv17.tst: SYS := sysv10.o -check_addcv17.tst: crtv10.o sysv10.o - -build: $(CRT) $(SYS) $(TESTCASES) - -check: $(CRT) $(SYS) $(TESTCASES) - @printf "\nQEMU simulator.\n" - for case in $(TESTCASES); do \ - printf %s "$$case "; \ - SIMARGS=; \ - case $$case in *v17*) SIMARGS="-cpu crisv17";; esac; \ - $(SIM) $$SIMARGS ./$$case; \ - done -check-g: $(CRT) $(SYS) $(TESTCASES) - @printf "\nGDB simulator.\n" - @for case in $(TESTCASES); do \ - printf %s "$$case "; \ - $(SIMG) $$case; \ - done - -clean: - $(RM) -fr $(TESTCASES) *.o diff --git a/tests/tcg/cris/Makefile.include b/tests/tcg/cris/Makefile.include new file mode 100644 index 0000000000..1c037824bf --- /dev/null +++ b/tests/tcg/cris/Makefile.include @@ -0,0 +1,6 @@ +# +# Makefile.include for all CRIS targets +# + +DOCKER_IMAGE=fedora-cris-cross +DOCKER_CROSS_COMPILER=cris-linux-gnu-gcc diff --git a/tests/tcg/cris/Makefile.target b/tests/tcg/cris/Makefile.target new file mode 100644 index 0000000000..c1173ead42 --- /dev/null +++ b/tests/tcg/cris/Makefile.target @@ -0,0 +1,58 @@ +# -*- Mode: makefile -*- +# +# Cris tests +# +# Currently we can only build the "bare" tests with the docker +# supplied cross-compiler. +# + +CRIS_SRC = $(SRC_PATH)/tests/tcg/cris/bare +CRIS_ALL = $(wildcard $(CRIS_SRC)/*.s) +CRIS_TESTS = $(patsubst $(CRIS_SRC)/%.s, %, $(CRIS_ALL)) +# Filter out common blobs and broken tests +CRIS_BROKEN_TESTS = crt check_jsr +# upstream GCC doesn't support v32 +CRIS_BROKEN_TESTS += check_mcp check_mulv32 check_addiv32 check_movpmv32 +CRIS_BROKEN_TESTS += check_movprv32 check_clearfv32 check_movemrv32 check_bas +CRIS_BROKEN_TESTS += check_lapc check_movei +# no sure why +CRIS_BROKEN_TESTS += check_scc check_xarith + +CRIS_USABLE_TESTS = $(filter-out $(CRIS_BROKEN_TESTS), $(CRIS_TESTS)) +CRIS_RUNS = $(patsubst %, run-%, $(CRIS_USABLE_TESTS)) + +# override the list of tests, as we can't build the multiarch tests +TESTS = $(CRIS_USABLE_TESTS) +VPATH = $(CRIS_SRC) + +AS = $(CC) -x assembler-with-cpp +LD = $(CC) + +# we rely on GCC inline:ing the stuff we tell it to in many places here. +CFLAGS = -Winline -Wall -g -O2 -static +NOSTDFLAGS = -nostartfiles -nostdlib +ASFLAGS += -mcpu=v10 -g -Wa,-I,$(SRC_PATH)/tests/tcg/cris/bare +CRT_FILES = crt.o sys.o + +# stop make deleting crt files if build fails +.PRECIOUS: $(CRT_FILES) + +%.o: %.c + $(CC) -c $< -o $@ + +%.o: %.s + $(AS) $(ASFLAGS) -c $< -o $@ + +%: %.s $(CRT_FILES) + $(CC) $(ASFLAGS) $< -o $@ $(LDFLAGS) $(NOSTDFLAGS) $(CRT_FILES) + +# The default CPU breaks (possibly as it's max?) so force crisv17 +$(CRIS_RUNS): QEMU_OPTS=-cpu crisv17 + +# Additional runners to run under GNU SIM +CRIS_RUNS_ON_SIM=$(patsubst %, %-on-sim, $(CRIS_RUNS)) +SIMG:=cris-axis-linux-gnu-run + +# e.g.: make -f ../../tests/tcg/Makefile run-check_orm-on-sim +run-%-on-sim: + $(call run-test, $<, $(SIMG) $<, "$< on $(TARGET_NAME) with SIM") diff --git a/tests/tcg/cris/check_addcv17.s b/tests/tcg/cris/bare/check_addcv17.s index 52ef7a9716..52ef7a9716 100644 --- a/tests/tcg/cris/check_addcv17.s +++ b/tests/tcg/cris/bare/check_addcv17.s diff --git a/tests/tcg/cris/check_addi.s b/tests/tcg/cris/bare/check_addi.s index a00dec02af..a00dec02af 100644 --- a/tests/tcg/cris/check_addi.s +++ b/tests/tcg/cris/bare/check_addi.s diff --git a/tests/tcg/cris/check_addiv32.s b/tests/tcg/cris/bare/check_addiv32.s index 20ba25d219..20ba25d219 100644 --- a/tests/tcg/cris/check_addiv32.s +++ b/tests/tcg/cris/bare/check_addiv32.s diff --git a/tests/tcg/cris/check_addm.s b/tests/tcg/cris/bare/check_addm.s index efece9f538..efece9f538 100644 --- a/tests/tcg/cris/check_addm.s +++ b/tests/tcg/cris/bare/check_addm.s diff --git a/tests/tcg/cris/check_addq.s b/tests/tcg/cris/bare/check_addq.s index e6f874f9b2..e6f874f9b2 100644 --- a/tests/tcg/cris/check_addq.s +++ b/tests/tcg/cris/bare/check_addq.s diff --git a/tests/tcg/cris/check_addr.s b/tests/tcg/cris/bare/check_addr.s index 7f55cdc1b5..7f55cdc1b5 100644 --- a/tests/tcg/cris/check_addr.s +++ b/tests/tcg/cris/bare/check_addr.s diff --git a/tests/tcg/cris/check_addxc.s b/tests/tcg/cris/bare/check_addxc.s index 09c8355bf8..09c8355bf8 100644 --- a/tests/tcg/cris/check_addxc.s +++ b/tests/tcg/cris/bare/check_addxc.s diff --git a/tests/tcg/cris/check_addxm.s b/tests/tcg/cris/bare/check_addxm.s index 7563494b99..7563494b99 100644 --- a/tests/tcg/cris/check_addxm.s +++ b/tests/tcg/cris/bare/check_addxm.s diff --git a/tests/tcg/cris/check_addxr.s b/tests/tcg/cris/bare/check_addxr.s index 7f55cdc1b5..7f55cdc1b5 100644 --- a/tests/tcg/cris/check_addxr.s +++ b/tests/tcg/cris/bare/check_addxr.s diff --git a/tests/tcg/cris/check_andc.s b/tests/tcg/cris/bare/check_andc.s index a947b773c9..a947b773c9 100644 --- a/tests/tcg/cris/check_andc.s +++ b/tests/tcg/cris/bare/check_andc.s diff --git a/tests/tcg/cris/check_andm.s b/tests/tcg/cris/bare/check_andm.s index 93858863fe..93858863fe 100644 --- a/tests/tcg/cris/check_andm.s +++ b/tests/tcg/cris/bare/check_andm.s diff --git a/tests/tcg/cris/check_andq.s b/tests/tcg/cris/bare/check_andq.s index 55aa7b0607..55aa7b0607 100644 --- a/tests/tcg/cris/check_andq.s +++ b/tests/tcg/cris/bare/check_andq.s diff --git a/tests/tcg/cris/check_andr.s b/tests/tcg/cris/bare/check_andr.s index 61aa1dc32f..61aa1dc32f 100644 --- a/tests/tcg/cris/check_andr.s +++ b/tests/tcg/cris/bare/check_andr.s diff --git a/tests/tcg/cris/check_asr.s b/tests/tcg/cris/bare/check_asr.s index 0a02ae6f7e..0a02ae6f7e 100644 --- a/tests/tcg/cris/check_asr.s +++ b/tests/tcg/cris/bare/check_asr.s diff --git a/tests/tcg/cris/check_ba.s b/tests/tcg/cris/bare/check_ba.s index 873a4086c5..873a4086c5 100644 --- a/tests/tcg/cris/check_ba.s +++ b/tests/tcg/cris/bare/check_ba.s diff --git a/tests/tcg/cris/check_bas.s b/tests/tcg/cris/bare/check_bas.s index 11929d4202..11929d4202 100644 --- a/tests/tcg/cris/check_bas.s +++ b/tests/tcg/cris/bare/check_bas.s diff --git a/tests/tcg/cris/check_bcc.s b/tests/tcg/cris/bare/check_bcc.s index c57ffa6fa3..c57ffa6fa3 100644 --- a/tests/tcg/cris/check_bcc.s +++ b/tests/tcg/cris/bare/check_bcc.s diff --git a/tests/tcg/cris/check_boundc.s b/tests/tcg/cris/bare/check_boundc.s index fb9e5bc905..fb9e5bc905 100644 --- a/tests/tcg/cris/check_boundc.s +++ b/tests/tcg/cris/bare/check_boundc.s diff --git a/tests/tcg/cris/check_boundr.s b/tests/tcg/cris/bare/check_boundr.s index 5c50cc5f6a..5c50cc5f6a 100644 --- a/tests/tcg/cris/check_boundr.s +++ b/tests/tcg/cris/bare/check_boundr.s diff --git a/tests/tcg/cris/check_btst.s b/tests/tcg/cris/bare/check_btst.s index e39fc8f4d6..485deb2006 100644 --- a/tests/tcg/cris/check_btst.s +++ b/tests/tcg/cris/bare/check_btst.s @@ -85,12 +85,12 @@ checkr3 1111 ; check that X gets cleared and that only the NZ flags are touched. - move.d 0xff, $r0 - move $r0, $ccs - btst r3,r3 - move $ccs, $r0 - and.d 0xff, $r0 - cmp.d 0xe3, $r0 - test_cc 0 1 0 0 + ;; move.d 0xff, $r0 + ;; move $r0, $ccs + ;; btst r3,r3 + ;; move $ccs, $r0 + ;; and.d 0xff, $r0 + ;; cmp.d 0xe3, $r0 + ;; test_cc 0 1 0 0 quit diff --git a/tests/tcg/cris/check_clearfv32.s b/tests/tcg/cris/bare/check_clearfv32.s index 4e91360273..4e91360273 100644 --- a/tests/tcg/cris/check_clearfv32.s +++ b/tests/tcg/cris/bare/check_clearfv32.s diff --git a/tests/tcg/cris/check_clrjmp1.s b/tests/tcg/cris/bare/check_clrjmp1.s index 45a7005e24..45a7005e24 100644 --- a/tests/tcg/cris/check_clrjmp1.s +++ b/tests/tcg/cris/bare/check_clrjmp1.s diff --git a/tests/tcg/cris/check_cmp-2.s b/tests/tcg/cris/bare/check_cmp-2.s index 414d370517..414d370517 100644 --- a/tests/tcg/cris/check_cmp-2.s +++ b/tests/tcg/cris/bare/check_cmp-2.s diff --git a/tests/tcg/cris/check_cmpc.s b/tests/tcg/cris/bare/check_cmpc.s index 267c9ba8c0..267c9ba8c0 100644 --- a/tests/tcg/cris/check_cmpc.s +++ b/tests/tcg/cris/bare/check_cmpc.s diff --git a/tests/tcg/cris/check_cmpm.s b/tests/tcg/cris/bare/check_cmpm.s index e4dde15b32..e4dde15b32 100644 --- a/tests/tcg/cris/check_cmpm.s +++ b/tests/tcg/cris/bare/check_cmpm.s diff --git a/tests/tcg/cris/check_cmpq.s b/tests/tcg/cris/bare/check_cmpq.s index 5469141c91..5469141c91 100644 --- a/tests/tcg/cris/check_cmpq.s +++ b/tests/tcg/cris/bare/check_cmpq.s diff --git a/tests/tcg/cris/check_cmpr.s b/tests/tcg/cris/bare/check_cmpr.s index b30af7a538..b30af7a538 100644 --- a/tests/tcg/cris/check_cmpr.s +++ b/tests/tcg/cris/bare/check_cmpr.s diff --git a/tests/tcg/cris/check_cmpxc.s b/tests/tcg/cris/bare/check_cmpxc.s index b237a93175..b237a93175 100644 --- a/tests/tcg/cris/check_cmpxc.s +++ b/tests/tcg/cris/bare/check_cmpxc.s diff --git a/tests/tcg/cris/check_cmpxm.s b/tests/tcg/cris/bare/check_cmpxm.s index 87ea5bf8e3..87ea5bf8e3 100644 --- a/tests/tcg/cris/check_cmpxm.s +++ b/tests/tcg/cris/bare/check_cmpxm.s diff --git a/tests/tcg/cris/check_dstep.s b/tests/tcg/cris/bare/check_dstep.s index bd43b838ea..bd43b838ea 100644 --- a/tests/tcg/cris/check_dstep.s +++ b/tests/tcg/cris/bare/check_dstep.s diff --git a/tests/tcg/cris/check_jsr.s b/tests/tcg/cris/bare/check_jsr.s index 1060237873..1060237873 100644 --- a/tests/tcg/cris/check_jsr.s +++ b/tests/tcg/cris/bare/check_jsr.s diff --git a/tests/tcg/cris/check_lapc.s b/tests/tcg/cris/bare/check_lapc.s index 9a6150b749..9a6150b749 100644 --- a/tests/tcg/cris/check_lapc.s +++ b/tests/tcg/cris/bare/check_lapc.s diff --git a/tests/tcg/cris/check_lsl.s b/tests/tcg/cris/bare/check_lsl.s index 9e2ddd7cd0..9e2ddd7cd0 100644 --- a/tests/tcg/cris/check_lsl.s +++ b/tests/tcg/cris/bare/check_lsl.s diff --git a/tests/tcg/cris/check_lsr.s b/tests/tcg/cris/bare/check_lsr.s index 18fdbef9b2..18fdbef9b2 100644 --- a/tests/tcg/cris/check_lsr.s +++ b/tests/tcg/cris/bare/check_lsr.s diff --git a/tests/tcg/cris/check_mcp.s b/tests/tcg/cris/bare/check_mcp.s index e65ccddfd4..e65ccddfd4 100644 --- a/tests/tcg/cris/check_mcp.s +++ b/tests/tcg/cris/bare/check_mcp.s diff --git a/tests/tcg/cris/check_movdelsr1.s b/tests/tcg/cris/bare/check_movdelsr1.s index 300cc87742..300cc87742 100644 --- a/tests/tcg/cris/check_movdelsr1.s +++ b/tests/tcg/cris/bare/check_movdelsr1.s diff --git a/tests/tcg/cris/check_movecr.s b/tests/tcg/cris/bare/check_movecr.s index da8ec26284..da8ec26284 100644 --- a/tests/tcg/cris/check_movecr.s +++ b/tests/tcg/cris/bare/check_movecr.s diff --git a/tests/tcg/cris/check_movei.s b/tests/tcg/cris/bare/check_movei.s index bbfa633373..bbfa633373 100644 --- a/tests/tcg/cris/check_movei.s +++ b/tests/tcg/cris/bare/check_movei.s diff --git a/tests/tcg/cris/check_movemr.s b/tests/tcg/cris/bare/check_movemr.s index 88489dee31..88489dee31 100644 --- a/tests/tcg/cris/check_movemr.s +++ b/tests/tcg/cris/bare/check_movemr.s diff --git a/tests/tcg/cris/check_movemrv32.s b/tests/tcg/cris/bare/check_movemrv32.s index 53950abd5b..53950abd5b 100644 --- a/tests/tcg/cris/check_movemrv32.s +++ b/tests/tcg/cris/bare/check_movemrv32.s diff --git a/tests/tcg/cris/check_mover.s b/tests/tcg/cris/bare/check_mover.s index b4db595d64..b4db595d64 100644 --- a/tests/tcg/cris/check_mover.s +++ b/tests/tcg/cris/bare/check_mover.s diff --git a/tests/tcg/cris/check_moverm.s b/tests/tcg/cris/bare/check_moverm.s index eabc9588d4..eabc9588d4 100644 --- a/tests/tcg/cris/check_moverm.s +++ b/tests/tcg/cris/bare/check_moverm.s diff --git a/tests/tcg/cris/check_movmp.s b/tests/tcg/cris/bare/check_movmp.s index 7fc11f064d..7fc11f064d 100644 --- a/tests/tcg/cris/check_movmp.s +++ b/tests/tcg/cris/bare/check_movmp.s diff --git a/tests/tcg/cris/check_movpmv32.s b/tests/tcg/cris/bare/check_movpmv32.s index daf0970e4a..daf0970e4a 100644 --- a/tests/tcg/cris/check_movpmv32.s +++ b/tests/tcg/cris/bare/check_movpmv32.s diff --git a/tests/tcg/cris/check_movpr.s b/tests/tcg/cris/bare/check_movpr.s index eef9bdb4fb..eef9bdb4fb 100644 --- a/tests/tcg/cris/check_movpr.s +++ b/tests/tcg/cris/bare/check_movpr.s diff --git a/tests/tcg/cris/check_movprv32.s b/tests/tcg/cris/bare/check_movprv32.s index d0d90e1246..d0d90e1246 100644 --- a/tests/tcg/cris/check_movprv32.s +++ b/tests/tcg/cris/bare/check_movprv32.s diff --git a/tests/tcg/cris/check_movscr.s b/tests/tcg/cris/bare/check_movscr.s index 53c8ce6b50..53c8ce6b50 100644 --- a/tests/tcg/cris/check_movscr.s +++ b/tests/tcg/cris/bare/check_movscr.s diff --git a/tests/tcg/cris/check_movsm.s b/tests/tcg/cris/bare/check_movsm.s index 7074336e78..7074336e78 100644 --- a/tests/tcg/cris/check_movsm.s +++ b/tests/tcg/cris/bare/check_movsm.s diff --git a/tests/tcg/cris/check_movsr.s b/tests/tcg/cris/bare/check_movsr.s index d1889a7a1b..d1889a7a1b 100644 --- a/tests/tcg/cris/check_movsr.s +++ b/tests/tcg/cris/bare/check_movsr.s diff --git a/tests/tcg/cris/check_movucr.s b/tests/tcg/cris/bare/check_movucr.s index 7c8487d1a2..7c8487d1a2 100644 --- a/tests/tcg/cris/check_movucr.s +++ b/tests/tcg/cris/bare/check_movucr.s diff --git a/tests/tcg/cris/check_movum.s b/tests/tcg/cris/bare/check_movum.s index 038e539463..038e539463 100644 --- a/tests/tcg/cris/check_movum.s +++ b/tests/tcg/cris/bare/check_movum.s diff --git a/tests/tcg/cris/check_movur.s b/tests/tcg/cris/bare/check_movur.s index 3ecf475f75..3ecf475f75 100644 --- a/tests/tcg/cris/check_movur.s +++ b/tests/tcg/cris/bare/check_movur.s diff --git a/tests/tcg/cris/check_mulv32.s b/tests/tcg/cris/bare/check_mulv32.s index f379358765..f379358765 100644 --- a/tests/tcg/cris/check_mulv32.s +++ b/tests/tcg/cris/bare/check_mulv32.s diff --git a/tests/tcg/cris/check_mulx.s b/tests/tcg/cris/bare/check_mulx.s index d43241a6f5..a7a1f82a82 100644 --- a/tests/tcg/cris/check_mulx.s +++ b/tests/tcg/cris/bare/check_mulx.s @@ -3,6 +3,8 @@ .include "testutils.inc" start + + .align 4 moveq -1,r3 moveq 2,r4 muls.d r4,r3 @@ -11,6 +13,7 @@ move mof,r3 checkr3 ffffffff + .align 4 moveq -1,r3 moveq 2,r4 mulu.d r4,r3 @@ -19,6 +22,7 @@ move mof,r3 checkr3 1 + .align 4 moveq 2,r3 moveq -1,r4 muls.d r4,r3 @@ -27,6 +31,7 @@ move mof,r3 checkr3 ffffffff + .align 4 moveq 2,r3 moveq -1,r4 mulu.d r4,r3 @@ -98,6 +103,7 @@ checkr3 1fffe move mof,r3 checkr3 0 + nop moveq 2,r3 move.d 0xffff,r4 @@ -138,6 +144,7 @@ checkr3 fdbdade2 move mof,r3 checkr3 ffffffff + nop move.d 0x5432f789,r4 move.d 0x78134452,r3 @@ -146,6 +153,7 @@ checkr3 420fade2 move mof,r3 checkr3 0 + nop move.d 0xff,r3 moveq 2,r4 @@ -186,6 +194,7 @@ checkr3 1 move mof,r3 checkr3 0 + nop moveq -1,r4 move.d r4,r3 @@ -194,6 +203,7 @@ checkr3 fe01 move mof,r3 checkr3 0 + nop move.d 0xfeda49ff,r4 move.d r4,r3 @@ -202,6 +212,7 @@ checkr3 1 move mof,r3 checkr3 0 + nop move.d 0xfeda49ff,r4 move.d r4,r3 diff --git a/tests/tcg/cris/check_neg.s b/tests/tcg/cris/bare/check_neg.s index 963c4b6f5e..963c4b6f5e 100644 --- a/tests/tcg/cris/check_neg.s +++ b/tests/tcg/cris/bare/check_neg.s diff --git a/tests/tcg/cris/check_not.s b/tests/tcg/cris/bare/check_not.s index 33bcf155e5..33bcf155e5 100644 --- a/tests/tcg/cris/check_not.s +++ b/tests/tcg/cris/bare/check_not.s diff --git a/tests/tcg/cris/check_orc.s b/tests/tcg/cris/bare/check_orc.s index c733f036a2..c733f036a2 100644 --- a/tests/tcg/cris/check_orc.s +++ b/tests/tcg/cris/bare/check_orc.s diff --git a/tests/tcg/cris/check_orm.s b/tests/tcg/cris/bare/check_orm.s index ee723a6aa0..ee723a6aa0 100644 --- a/tests/tcg/cris/check_orm.s +++ b/tests/tcg/cris/bare/check_orm.s diff --git a/tests/tcg/cris/check_orq.s b/tests/tcg/cris/bare/check_orq.s index 5060edc72d..5060edc72d 100644 --- a/tests/tcg/cris/check_orq.s +++ b/tests/tcg/cris/bare/check_orq.s diff --git a/tests/tcg/cris/check_orr.s b/tests/tcg/cris/bare/check_orr.s index a514c11bc9..a514c11bc9 100644 --- a/tests/tcg/cris/check_orr.s +++ b/tests/tcg/cris/bare/check_orr.s diff --git a/tests/tcg/cris/check_ret.s b/tests/tcg/cris/bare/check_ret.s index b44fb25933..b44fb25933 100644 --- a/tests/tcg/cris/check_ret.s +++ b/tests/tcg/cris/bare/check_ret.s diff --git a/tests/tcg/cris/check_scc.s b/tests/tcg/cris/bare/check_scc.s index 4a8674cc1a..4a8674cc1a 100644 --- a/tests/tcg/cris/check_scc.s +++ b/tests/tcg/cris/bare/check_scc.s diff --git a/tests/tcg/cris/check_subc.s b/tests/tcg/cris/bare/check_subc.s index e34b5448e2..e34b5448e2 100644 --- a/tests/tcg/cris/check_subc.s +++ b/tests/tcg/cris/bare/check_subc.s diff --git a/tests/tcg/cris/check_subm.s b/tests/tcg/cris/bare/check_subm.s index e07ea02dd4..e07ea02dd4 100644 --- a/tests/tcg/cris/check_subm.s +++ b/tests/tcg/cris/bare/check_subm.s diff --git a/tests/tcg/cris/check_subq.s b/tests/tcg/cris/bare/check_subq.s index 9e34fa31ab..9e34fa31ab 100644 --- a/tests/tcg/cris/check_subq.s +++ b/tests/tcg/cris/bare/check_subq.s diff --git a/tests/tcg/cris/check_subr.s b/tests/tcg/cris/bare/check_subr.s index 742fbc8915..742fbc8915 100644 --- a/tests/tcg/cris/check_subr.s +++ b/tests/tcg/cris/bare/check_subr.s diff --git a/tests/tcg/cris/check_xarith.s b/tests/tcg/cris/bare/check_xarith.s index 80038b2ab9..80038b2ab9 100644 --- a/tests/tcg/cris/check_xarith.s +++ b/tests/tcg/cris/bare/check_xarith.s diff --git a/tests/tcg/cris/crt.s b/tests/tcg/cris/bare/crt.s index af027d7475..af027d7475 100644 --- a/tests/tcg/cris/crt.s +++ b/tests/tcg/cris/bare/crt.s diff --git a/tests/tcg/cris/bare/sys.c b/tests/tcg/cris/bare/sys.c new file mode 100644 index 0000000000..1644eecc33 --- /dev/null +++ b/tests/tcg/cris/bare/sys.c @@ -0,0 +1,63 @@ +/* + * Helper functions for CRIS system tests + * + * There is no libc and only a limited set of headers. + */ + +#include <stddef.h> + +void exit(int status) +{ + register unsigned int callno asm ("r9") = 1; /* NR_exit */ + + asm volatile ("break 13\n" + : /* no outputs */ + : "r" (callno) + : "memory"); + while (1) { + /* do nothing */ + }; +} + +size_t write(int fd, const void *buf, size_t count) +{ + register unsigned int callno asm ("r9") = 4; /* NR_write */ + register unsigned int r10 asm ("r10") = fd; + register const void *r11 asm ("r11") = buf; + register size_t r12 asm ("r12") = count; + register unsigned int r asm ("r10"); + + asm volatile ("break 13\n" + : "=r" (r) + : "r" (callno), "0" (r10), "r" (r11), "r" (r12) + : "memory"); + + return r; +} + +static inline int mystrlen(char *s) +{ + int i = 0; + while (s[i]) { + i++; + } + return i; +} + + +void pass(void) +{ + char s[] = "passed.\n"; + write(1, s, sizeof(s) - 1); + exit(0); +} + +void _fail(char *reason) +{ + char s[] = "\nfailed: "; + int len = mystrlen(reason); + write(1, s, sizeof(s) - 1); + write(1, reason, len); + write(1, "\n", 1); + exit(1); +} diff --git a/tests/tcg/cris/testutils.inc b/tests/tcg/cris/bare/testutils.inc index aa1641b2e6..aa1641b2e6 100644 --- a/tests/tcg/cris/testutils.inc +++ b/tests/tcg/cris/bare/testutils.inc diff --git a/tests/tcg/cris/check_abs.c b/tests/tcg/cris/libc/check_abs.c index 08b67b6ef0..08b67b6ef0 100644 --- a/tests/tcg/cris/check_abs.c +++ b/tests/tcg/cris/libc/check_abs.c diff --git a/tests/tcg/cris/check_addc.c b/tests/tcg/cris/libc/check_addc.c index fc3fb1faa8..fc3fb1faa8 100644 --- a/tests/tcg/cris/check_addc.c +++ b/tests/tcg/cris/libc/check_addc.c diff --git a/tests/tcg/cris/check_addcm.c b/tests/tcg/cris/libc/check_addcm.c index b355ba164f..b355ba164f 100644 --- a/tests/tcg/cris/check_addcm.c +++ b/tests/tcg/cris/libc/check_addcm.c diff --git a/tests/tcg/cris/check_addo.c b/tests/tcg/cris/libc/check_addo.c index 4235e5fc65..4235e5fc65 100644 --- a/tests/tcg/cris/check_addo.c +++ b/tests/tcg/cris/libc/check_addo.c diff --git a/tests/tcg/cris/check_addoq.c b/tests/tcg/cris/libc/check_addoq.c index ed509e27e0..ed509e27e0 100644 --- a/tests/tcg/cris/check_addoq.c +++ b/tests/tcg/cris/libc/check_addoq.c diff --git a/tests/tcg/cris/check_bound.c b/tests/tcg/cris/libc/check_bound.c index d956ab9ade..d956ab9ade 100644 --- a/tests/tcg/cris/check_bound.c +++ b/tests/tcg/cris/libc/check_bound.c diff --git a/tests/tcg/cris/check_ftag.c b/tests/tcg/cris/libc/check_ftag.c index aaa5c97115..aaa5c97115 100644 --- a/tests/tcg/cris/check_ftag.c +++ b/tests/tcg/cris/libc/check_ftag.c diff --git a/tests/tcg/cris/check_gcctorture_pr28634-1.c b/tests/tcg/cris/libc/check_gcctorture_pr28634-1.c index 45ecd159b3..45ecd159b3 100644 --- a/tests/tcg/cris/check_gcctorture_pr28634-1.c +++ b/tests/tcg/cris/libc/check_gcctorture_pr28634-1.c diff --git a/tests/tcg/cris/check_gcctorture_pr28634.c b/tests/tcg/cris/libc/check_gcctorture_pr28634.c index a0c525497d..a0c525497d 100644 --- a/tests/tcg/cris/check_gcctorture_pr28634.c +++ b/tests/tcg/cris/libc/check_gcctorture_pr28634.c diff --git a/tests/tcg/cris/check_glibc_kernelversion.c b/tests/tcg/cris/libc/check_glibc_kernelversion.c index 7aada89911..7aada89911 100644 --- a/tests/tcg/cris/check_glibc_kernelversion.c +++ b/tests/tcg/cris/libc/check_glibc_kernelversion.c diff --git a/tests/tcg/cris/check_hello.c b/tests/tcg/cris/libc/check_hello.c index fb403ba996..fb403ba996 100644 --- a/tests/tcg/cris/check_hello.c +++ b/tests/tcg/cris/libc/check_hello.c diff --git a/tests/tcg/cris/check_int64.c b/tests/tcg/cris/libc/check_int64.c index 69caec1bb2..69caec1bb2 100644 --- a/tests/tcg/cris/check_int64.c +++ b/tests/tcg/cris/libc/check_int64.c diff --git a/tests/tcg/cris/check_lz.c b/tests/tcg/cris/libc/check_lz.c index bf051a6b55..bf051a6b55 100644 --- a/tests/tcg/cris/check_lz.c +++ b/tests/tcg/cris/libc/check_lz.c diff --git a/tests/tcg/cris/check_mapbrk.c b/tests/tcg/cris/libc/check_mapbrk.c index 1aff7622bc..1aff7622bc 100644 --- a/tests/tcg/cris/check_mapbrk.c +++ b/tests/tcg/cris/libc/check_mapbrk.c diff --git a/tests/tcg/cris/check_mmap1.c b/tests/tcg/cris/libc/check_mmap1.c index b803f0c431..b803f0c431 100644 --- a/tests/tcg/cris/check_mmap1.c +++ b/tests/tcg/cris/libc/check_mmap1.c diff --git a/tests/tcg/cris/check_mmap2.c b/tests/tcg/cris/libc/check_mmap2.c index 35139a0ed9..35139a0ed9 100644 --- a/tests/tcg/cris/check_mmap2.c +++ b/tests/tcg/cris/libc/check_mmap2.c diff --git a/tests/tcg/cris/check_mmap3.c b/tests/tcg/cris/libc/check_mmap3.c index cb890ef120..cb890ef120 100644 --- a/tests/tcg/cris/check_mmap3.c +++ b/tests/tcg/cris/libc/check_mmap3.c diff --git a/tests/tcg/cris/check_moveq.c b/tests/tcg/cris/libc/check_moveq.c index 80f2dff6ab..80f2dff6ab 100644 --- a/tests/tcg/cris/check_moveq.c +++ b/tests/tcg/cris/libc/check_moveq.c diff --git a/tests/tcg/cris/check_openpf1.c b/tests/tcg/cris/libc/check_openpf1.c index 251d26eec2..251d26eec2 100644 --- a/tests/tcg/cris/check_openpf1.c +++ b/tests/tcg/cris/libc/check_openpf1.c diff --git a/tests/tcg/cris/check_openpf2.c b/tests/tcg/cris/libc/check_openpf2.c index 5d56189f8e..5d56189f8e 100644 --- a/tests/tcg/cris/check_openpf2.c +++ b/tests/tcg/cris/libc/check_openpf2.c diff --git a/tests/tcg/cris/check_openpf3.c b/tests/tcg/cris/libc/check_openpf3.c index 557adee92d..557adee92d 100644 --- a/tests/tcg/cris/check_openpf3.c +++ b/tests/tcg/cris/libc/check_openpf3.c diff --git a/tests/tcg/cris/check_openpf5.c b/tests/tcg/cris/libc/check_openpf5.c index 1f86ea283d..1f86ea283d 100644 --- a/tests/tcg/cris/check_openpf5.c +++ b/tests/tcg/cris/libc/check_openpf5.c diff --git a/tests/tcg/cris/check_settls1.c b/tests/tcg/cris/libc/check_settls1.c index 3abc3a9ea8..3abc3a9ea8 100644 --- a/tests/tcg/cris/check_settls1.c +++ b/tests/tcg/cris/libc/check_settls1.c diff --git a/tests/tcg/cris/check_sigalrm.c b/tests/tcg/cris/libc/check_sigalrm.c index 39fa8d9bac..39fa8d9bac 100644 --- a/tests/tcg/cris/check_sigalrm.c +++ b/tests/tcg/cris/libc/check_sigalrm.c diff --git a/tests/tcg/cris/check_stat1.c b/tests/tcg/cris/libc/check_stat1.c index 2e2cae51df..2e2cae51df 100644 --- a/tests/tcg/cris/check_stat1.c +++ b/tests/tcg/cris/libc/check_stat1.c diff --git a/tests/tcg/cris/check_stat2.c b/tests/tcg/cris/libc/check_stat2.c index e36172ed25..e36172ed25 100644 --- a/tests/tcg/cris/check_stat2.c +++ b/tests/tcg/cris/libc/check_stat2.c diff --git a/tests/tcg/cris/check_stat3.c b/tests/tcg/cris/libc/check_stat3.c index 36a9d5d274..36a9d5d274 100644 --- a/tests/tcg/cris/check_stat3.c +++ b/tests/tcg/cris/libc/check_stat3.c diff --git a/tests/tcg/cris/check_stat4.c b/tests/tcg/cris/libc/check_stat4.c index 04f21fe7c4..04f21fe7c4 100644 --- a/tests/tcg/cris/check_stat4.c +++ b/tests/tcg/cris/libc/check_stat4.c diff --git a/tests/tcg/cris/check_swap.c b/tests/tcg/cris/libc/check_swap.c index 9a68c1e5d7..9a68c1e5d7 100644 --- a/tests/tcg/cris/check_swap.c +++ b/tests/tcg/cris/libc/check_swap.c diff --git a/tests/tcg/cris/check_time2.c b/tests/tcg/cris/libc/check_time2.c index 20b69b4f60..20b69b4f60 100644 --- a/tests/tcg/cris/check_time2.c +++ b/tests/tcg/cris/libc/check_time2.c diff --git a/tests/tcg/cris/crisutils.h b/tests/tcg/cris/libc/crisutils.h index bbbe6c5540..bbbe6c5540 100644 --- a/tests/tcg/cris/crisutils.h +++ b/tests/tcg/cris/libc/crisutils.h diff --git a/tests/tcg/cris/sys.h b/tests/tcg/cris/libc/sys.h index 3dd47bb673..3dd47bb673 100644 --- a/tests/tcg/cris/sys.h +++ b/tests/tcg/cris/libc/sys.h diff --git a/tests/tcg/cris/sys.c b/tests/tcg/cris/sys.c deleted file mode 100644 index 21f08c0747..0000000000 --- a/tests/tcg/cris/sys.c +++ /dev/null @@ -1,59 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> - -static inline int mystrlen(char *s) { - int i = 0; - while (s[i]) - i++; - return i; -} - -void pass(void) { - char s[] = "passed.\n"; - write (1, s, sizeof (s) - 1); - exit (0); -} - -void _fail(char *reason) { - char s[] = "\nfailed: "; - int len = mystrlen(reason); - write (1, s, sizeof (s) - 1); - write (1, reason, len); - write (1, "\n", 1); -// exit (1); -} - -void *memset (void *s, int c, size_t n) { - char *p = s; - int i; - for (i = 0; i < n; i++) - p[i] = c; - return p; -} - -void exit (int status) { - register unsigned int callno asm ("r9") = 1; /* NR_exit */ - - asm volatile ("break 13\n" - : - : "r" (callno) - : "memory" ); - while(1) - ; -} - -ssize_t write (int fd, const void *buf, size_t count) { - register unsigned int callno asm ("r9") = 4; /* NR_write */ - register unsigned int r10 asm ("r10") = fd; - register const void *r11 asm ("r11") = buf; - register size_t r12 asm ("r12") = count; - register unsigned int r asm ("r10"); - - asm volatile ("break 13\n" - : "=r" (r) - : "r" (callno), "0" (r10), "r" (r11), "r" (r12) - : "memory"); - - return r; -} diff --git a/tests/tcg/i386/Makefile.softmmu-target b/tests/tcg/i386/Makefile.softmmu-target new file mode 100644 index 0000000000..53c9c5ece0 --- /dev/null +++ b/tests/tcg/i386/Makefile.softmmu-target @@ -0,0 +1,46 @@ +# +# x86 system tests +# +# This currently builds only for i386. The common C code is built +# with standard compiler flags however so we can support both by +# adding additional boot files for x86_64. +# + +I386_SYSTEM_SRC=$(SRC_PATH)/tests/tcg/i386/system +X64_SYSTEM_SRC=$(SRC_PATH)/tests/tcg/x86_64/system +# Set search path for all sources +VPATH+=$(I386_SYSTEM_SRC) + +# These objects provide the basic boot code and helper functions for all tests +CRT_OBJS=boot.o + +X86_TEST_SRCS=$(wildcard $(I386_SYSTEM_SRC)/*.c) +X86_TESTS = $(patsubst $(I386_SYSTEM_SRC)/%.c, %, $(X86_TEST_SRCS)) + +ifeq ($(TARGET_X86_64), y) +CRT_PATH=$(X64_SYSTEM_SRC) +LINK_SCRIPT=$(X64_SYSTEM_SRC)/kernel.ld +LDFLAGS=-Wl,-T$(LINK_SCRIPT) -Wl,-melf_x86_64 +else +CRT_PATH=$(I386_SYSTEM_SRC) +CFLAGS+=-m32 +LINK_SCRIPT=$(I386_SYSTEM_SRC)/kernel.ld +LDFLAGS=-Wl,-T$(LINK_SCRIPT) -Wl,-melf_i386 +# FIXME: move to common once x86_64 is bootstrapped +TESTS+=$(X86_TESTS) +endif +CFLAGS+=-nostdlib -ggdb -O0 $(MINILIB_INC) +LDFLAGS+=-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) -lgcc + +# building head blobs +.PRECIOUS: $(CRT_OBJS) + +%.o: $(CRT_PATH)/%.S + $(CC) $(CFLAGS) -c $< -o $@ + +# Build and link the tests +%: %.c $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS) + $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS) + +# Running +QEMU_OPTS+=-device isa-debugcon,chardev=output -device isa-debug-exit,iobase=0xf4,iosize=0x4 -kernel diff --git a/tests/tcg/i386/system/boot.S b/tests/tcg/i386/system/boot.S new file mode 100644 index 0000000000..90aa174908 --- /dev/null +++ b/tests/tcg/i386/system/boot.S @@ -0,0 +1,172 @@ +/* + * i386 boot code, based on qemu-bmibug. + * + * Copyright 2019 Doug Gale + * Copyright 2019 Linaro + * + * This work is licensed under the terms of the GNU GPL, version 3 or later. + * See the COPYING file in the top-level directory. + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + + .section .head + + /* Multi-boot header */ +multiboot_st: + .int 0x1BADB002 + .int 0x10000 + .int -(0x10000+0x1BADB002) + // Load address + .int __load_st + .int __load_st + .int __load_en + .int __bss_en + .int _start + // mode + .int 0 + // width + .int 0 + // height + .int 0 + // depth + .int 0 + + .code32 + .section .text + + /* Kernel Entry Point */ +.global _start +_start: + // Setup stack ASAP + mov $stack_end,%esp + + // Load GDT ASAP + lgdt gdtr + ljmp $0x8,$.Lloadcs +.Lloadcs: + mov $0x10,%eax + mov %eax,%ds + mov %eax,%es + mov %eax,%fs + mov %eax,%gs + mov %eax,%ss + + // Fixup the IDT to the ridiculous i386 layout + xor %ebx,%ebx +.Lnextidt: + mov idt_00(,%ebx,8),%eax + shr $16,%eax + movw $0x8,idt_00+2(,%ebx,8) + movw $0x8E00,idt_00+4(,%ebx,8) + movw %ax,idt_00+6(,%ebx,8) + add $1,%ebx + cmp $32,%ebx + jl .Lnextidt + + // Load IDTR + push $idt_00 + push $((32 * 8 - 1) << 16) + lidt 2(%esp) + add $8,%esp + + /* + * Don't worry about stack frame, assume everthing + * is garbage when we return, we won't need it. + */ + call main + + /* output any non-zero result in eax to isa-debug-exit device */ + test %al, %al + jz 1f + out %ax, $0xf4 + +1: /* QEMU ACPI poweroff */ + mov $0x604,%edx + mov $0x2000,%eax + out %ax,%dx + hlt + jmp 1b + + /* + * Helper Functions + */ + + /* Output a single character to serial port */ + .global __sys_outc +__sys_outc: + pushl %ebp + movl %esp, %ebp + out %al,$0xE9 + movl %ebp, %esp + popl %ebp + ret + + + /* Interrupt Descriptor Table */ + + .section .data + .align 16 + +idt_00: .int 0, 0 +idt_01: .int 0, 0 +idt_02: .int 0, 0 +idt_03: .int 0, 0 +idt_04: .int 0, 0 +idt_05: .int 0, 0 +idt_06: .int 0, 0 /* intr_6_opcode, Invalid Opcode */ +idt_07: .int 0, 0 +idt_08: .int 0, 0 +idt_09: .int 0, 0 +idt_0A: .int 0, 0 +idt_0B: .int 0, 0 +idt_0C: .int 0, 0 +idt_0D: .int 0, 0 +idt_0E: .int 0, 0 +idt_0F: .int 0, 0 +idt_10: .int 0, 0 +idt_11: .int 0, 0 +idt_12: .int 0, 0 +idt_13: .int 0, 0 +idt_14: .int 0, 0 +idt_15: .int 0, 0 +idt_16: .int 0, 0 +idt_17: .int 0, 0 +idt_18: .int 0, 0 +idt_19: .int 0, 0 +idt_1A: .int 0, 0 +idt_1B: .int 0, 0 +idt_1C: .int 0, 0 +idt_1D: .int 0, 0 +idt_1E: .int 0, 0 +idt_1F: .int 0, 0 + +gdt: + .short 0 +gdtr: + .short gdt_en - gdt - 1 + .int gdt + + // Code + .short 0xFFFF + .short 0 + .byte 0 + .byte 0x9b + .byte 0xCF + .byte 0 + + // Data + .short 0xFFFF + .short 0 + .byte 0 + .byte 0x93 + .byte 0xCF + .byte 0 + +gdt_en: + + .section .bss + .align 16 + +stack: .space 65536 +stack_end: diff --git a/tests/tcg/i386/system/hello.c b/tests/tcg/i386/system/hello.c new file mode 100644 index 0000000000..821dc0ef09 --- /dev/null +++ b/tests/tcg/i386/system/hello.c @@ -0,0 +1,14 @@ +/* + * Hello World, system test version + * + * We don't have the benefit of libc, just builtin C primitives and + * whatever is in minilib. + */ + +#include <minilib.h> + +int main(void) +{ + ml_printf("Hello World\n"); + return 0; +} diff --git a/tests/tcg/i386/system/kernel.ld b/tests/tcg/i386/system/kernel.ld new file mode 100644 index 0000000000..92de525e93 --- /dev/null +++ b/tests/tcg/i386/system/kernel.ld @@ -0,0 +1,23 @@ +SECTIONS { + . = 0x100000; + + .text : { + __load_st = .; + *(.head) + *(.text) + } + + .rodata : { + *(.rodata) + } + + .data : { + *(.data) + __load_en = .; + } + + .bss : { + *(.bss) + __bss_en = .; + } +} diff --git a/tests/tcg/i386/system/memory.c b/tests/tcg/i386/system/memory.c new file mode 100644 index 0000000000..a7a0a8e978 --- /dev/null +++ b/tests/tcg/i386/system/memory.c @@ -0,0 +1,243 @@ +/* + * Memory Test + * + * This is intended to test the softmmu code and ensure we properly + * behave across normal and unaligned accesses across several pages. + * We are not replicating memory tests for stuck bits and other + * hardware level failures but looking for issues with different size + * accesses when: + + * + */ + +#include <inttypes.h> +#include <minilib.h> + +#define TEST_SIZE (4096 * 4) /* 4 pages */ + +static uint8_t test_data[TEST_SIZE]; + +static void pdot(int count) +{ + if (count % 128 == 0) { + ml_printf("."); + } +} + + +/* + * Fill the data with ascending value bytes. As x86 is a LE machine we + * write in ascending order and then read and high byte should either + * be zero or higher than the lower bytes. + */ + +static void init_test_data_u8(void) +{ + uint8_t count = 0, *ptr = &test_data[0]; + int i; + + ml_printf("Filling test area with u8:"); + for (i = 0; i < TEST_SIZE; i++) { + *ptr++ = count++; + pdot(i); + } + ml_printf("done\n"); +} + +static void init_test_data_u16(int offset) +{ + uint8_t count = 0; + uint16_t word, *ptr = (uint16_t *) &test_data[0]; + const int max = (TEST_SIZE - offset) / sizeof(word); + int i; + + ml_printf("Filling test area with u16 (offset %d):", offset); + + /* Leading zeros */ + for (i = 0; i < offset; i++) { + *ptr = 0; + } + + ptr = (uint16_t *) &test_data[offset]; + for (i = 0; i < max; i++) { + uint8_t high, low; + low = count++; + high = count++; + word = (high << 8) | low; + *ptr++ = word; + pdot(i); + } + ml_printf("done\n"); +} + +static void init_test_data_u32(int offset) +{ + uint8_t count = 0; + uint32_t word, *ptr = (uint32_t *) &test_data[0]; + const int max = (TEST_SIZE - offset) / sizeof(word); + int i; + + ml_printf("Filling test area with u32 (offset %d):", offset); + + /* Leading zeros */ + for (i = 0; i < offset; i++) { + *ptr = 0; + } + + ptr = (uint32_t *) &test_data[offset]; + for (i = 0; i < max; i++) { + uint8_t b1, b2, b3, b4; + b4 = count++; + b3 = count++; + b2 = count++; + b1 = count++; + word = (b1 << 24) | (b2 << 16) | (b3 << 8) | b4; + *ptr++ = word; + pdot(i); + } + ml_printf("done\n"); +} + + +static int read_test_data_u16(int offset) +{ + uint16_t word, *ptr = (uint16_t *)&test_data[offset]; + int i; + const int max = (TEST_SIZE - offset) / sizeof(word); + + ml_printf("Reading u16 from %#lx (offset %d):", ptr, offset); + + for (i = 0; i < max; i++) { + uint8_t high, low; + word = *ptr++; + high = (word >> 8) & 0xff; + low = word & 0xff; + if (high < low && high != 0) { + ml_printf("Error %d < %d\n", high, low); + return 1; + } else { + pdot(i); + } + + } + ml_printf("done\n"); + return 0; +} + +static int read_test_data_u32(int offset) +{ + uint32_t word, *ptr = (uint32_t *)&test_data[offset]; + int i; + const int max = (TEST_SIZE - offset) / sizeof(word); + + ml_printf("Reading u32 from %#lx (offset %d):", ptr, offset); + + for (i = 0; i < max; i++) { + uint8_t b1, b2, b3, b4; + word = *ptr++; + + b1 = word >> 24 & 0xff; + b2 = word >> 16 & 0xff; + b3 = word >> 8 & 0xff; + b4 = word & 0xff; + + if ((b1 < b2 && b1 != 0) || + (b2 < b3 && b2 != 0) || + (b3 < b4 && b3 != 0)) { + ml_printf("Error %d, %d, %d, %d", b1, b2, b3, b4); + return 2; + } else { + pdot(i); + } + } + ml_printf("done\n"); + return 0; +} + +static int read_test_data_u64(int offset) +{ + uint64_t word, *ptr = (uint64_t *)&test_data[offset]; + int i; + const int max = (TEST_SIZE - offset) / sizeof(word); + + ml_printf("Reading u64 from %#lx (offset %d):", ptr, offset); + + for (i = 0; i < max; i++) { + uint8_t b1, b2, b3, b4, b5, b6, b7, b8; + word = *ptr++; + + b1 = ((uint64_t) (word >> 56)) & 0xff; + b2 = ((uint64_t) (word >> 48)) & 0xff; + b3 = ((uint64_t) (word >> 40)) & 0xff; + b4 = (word >> 32) & 0xff; + b5 = (word >> 24) & 0xff; + b6 = (word >> 16) & 0xff; + b7 = (word >> 8) & 0xff; + b8 = (word >> 0) & 0xff; + + if ((b1 < b2 && b1 != 0) || + (b2 < b3 && b2 != 0) || + (b3 < b4 && b3 != 0) || + (b4 < b5 && b4 != 0) || + (b5 < b6 && b5 != 0) || + (b6 < b7 && b6 != 0) || + (b7 < b8 && b7 != 0)) { + ml_printf("Error %d, %d, %d, %d, %d, %d, %d, %d", + b1, b2, b3, b4, b5, b6, b7, b8); + return 2; + } else { + pdot(i); + } + } + ml_printf("done\n"); + return 0; +} + +/* Read the test data and verify at various offsets */ +int do_reads(void) +{ + int r = 0; + int off = 0; + + while (r == 0 && off < 8) { + r = read_test_data_u16(off); + r |= read_test_data_u32(off); + r |= read_test_data_u64(off); + off++; + } + + return r; +} + +int main(void) +{ + int i, r = 0; + + + init_test_data_u8(); + r = do_reads(); + if (r) { + return r; + } + + for (i = 0; i < 8; i++) { + init_test_data_u16(i); + + r = do_reads(); + if (r) { + return r; + } + } + + for (i = 0; i < 8; i++) { + init_test_data_u32(i); + + r = do_reads(); + if (r) { + return r; + } + } + + ml_printf("Test complete: %s\n", r == 0 ? "PASSED" : "FAILED"); + return r; +} diff --git a/tests/tcg/minilib/Makefile.target b/tests/tcg/minilib/Makefile.target new file mode 100644 index 0000000000..3ed8077d0f --- /dev/null +++ b/tests/tcg/minilib/Makefile.target @@ -0,0 +1,21 @@ +# +# System test minilib objects +# +# The system tests are very constrained in terms of the library they +# support but we are not savages. We provide a few helpful routines +# that can be shared with the tests for basic I/O. +# +# They assume each arch has provided a putc function. +# + +SYSTEM_MINILIB_SRC=$(SRC_PATH)/tests/tcg/minilib +MINILIB_SRCS=$(wildcard $(SYSTEM_MINILIB_SRC)/*.c) +MINILIB_OBJS=$(patsubst $(SYSTEM_MINILIB_SRC)/%.c, %.o, $(MINILIB_SRCS)) + +MINILIB_CFLAGS+=-nostdlib -ggdb -O0 +MINILIB_INC=-isystem $(SYSTEM_MINILIB_SRC) + +.PRECIOUS: $(MINILIB_OBJS) + +%.o: $(SYSTEM_MINILIB_SRC)/%.c + $(CC) $(CFLAGS) -c $< -o $@ diff --git a/tests/tcg/minilib/minilib.h b/tests/tcg/minilib/minilib.h new file mode 100644 index 0000000000..e23361380a --- /dev/null +++ b/tests/tcg/minilib/minilib.h @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2015 Virtual Open Systems SAS + * Author: Alexander Spyridakis <a.spyridakis@virtualopensystems.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * SPDX-License-Identifier: GPL-2.0-only + */ + +#ifndef _MINILIB_H_ +#define _MINILIB_H_ + +/* + * Provided by the individual arch + */ +extern void __sys_outc(char c); + +/* + * Provided by the common minilib + */ +void ml_printf(const char *fmt, ...); + +#endif /* _MINILIB_H_ */ diff --git a/tests/tcg/minilib/printf.c b/tests/tcg/minilib/printf.c new file mode 100644 index 0000000000..121620cb16 --- /dev/null +++ b/tests/tcg/minilib/printf.c @@ -0,0 +1,133 @@ +/* + * Copyright (C) 2015 Virtual Open Systems SAS + * Author: Alexander Spyridakis <a.spyridakis@virtualopensystems.com> + * + * printf based on implementation by Kevin Wolf <kwolf@redhat.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * SPDX-License-Identifier: GPL-2.0-only + */ + +#include "minilib.h" + +typedef __builtin_va_list va_list; +#define va_start(ap, X) __builtin_va_start(ap, X) +#define va_arg(ap, type) __builtin_va_arg(ap, type) +#define va_end(ap) __builtin_va_end(ap) + +static void print_str(char *s) +{ + while (*s) { + __sys_outc(*s++); + } +} + +static void print_num(unsigned long long value, int base) +{ + char digits[] = "0123456789abcdef"; + char buf[32]; + int i = sizeof(buf) - 2, j; + + /* Set the buffer to 0. See problem of before. */ + for (j = 0; j < 32; j++) { + buf[j] = 0; + } + + do { + buf[i--] = digits[value % base]; + value /= base; + } while (value); + + print_str(&buf[i + 1]); +} + +void ml_printf(const char *fmt, ...) +{ + va_list ap; + char *str; + int base; + int has_long; + int alt_form; + unsigned long long val; + + va_start(ap, fmt); + + for (; *fmt; fmt++) { + if (*fmt != '%') { + __sys_outc(*fmt); + continue; + } + fmt++; + + if (*fmt == '#') { + fmt++; + alt_form = 1; + } else { + alt_form = 0; + } + + if (*fmt == 'l') { + fmt++; + if (*fmt == 'l') { + fmt++; + has_long = 2; + } else { + has_long = 1; + } + } else { + has_long = 0; + } + + switch (*fmt) { + case 'x': + case 'p': + base = 16; + goto convert_number; + case 'd': + case 'i': + case 'u': + base = 10; + goto convert_number; + case 'o': + base = 8; + goto convert_number; + + convert_number: + switch (has_long) { + case 0: + val = va_arg(ap, unsigned int); + break; + case 1: + val = va_arg(ap, unsigned long); + break; + case 2: + val = va_arg(ap, unsigned long long); + break; + } + + if (alt_form && base == 16) { + print_str("0x"); + } + + print_num(val, base); + break; + + case 's': + str = va_arg(ap, char*); + print_str(str); + break; + case '%': + __sys_outc(*fmt); + break; + default: + __sys_outc('%'); + __sys_outc(*fmt); + break; + } + } + + va_end(ap); +} diff --git a/tests/tcg/mips/Makefile.target b/tests/tcg/mips/Makefile.target index 086625f533..1a994d5525 100644 --- a/tests/tcg/mips/Makefile.target +++ b/tests/tcg/mips/Makefile.target @@ -8,15 +8,12 @@ MIPS_SRC=$(SRC_PATH)/tests/tcg/mips # Set search path for all sources VPATH += $(MIPS_SRC) +# hello-mips is 32 bit only +ifeq ($(findstring 64,$(TARGET_NAME)),) MIPS_TESTS=hello-mips TESTS += $(MIPS_TESTS) -hello-mips: CFLAGS+=-ffreestanding +hello-mips: CFLAGS+=-mno-abicalls -fno-PIC -mabi=32 hello-mips: LDFLAGS+=-nostdlib - -# For MIPS32 and 64 we have a bunch of extra tests in sub-directories -# however they are intended for system tests. - -run-hello-mips: hello-mips - $(call skip-test, $<, "BROKEN") +endif diff --git a/tests/tcg/mips/hello-mips.c b/tests/tcg/mips/hello-mips.c index c7052fdf2e..4e1cf501af 100644 --- a/tests/tcg/mips/hello-mips.c +++ b/tests/tcg/mips/hello-mips.c @@ -60,5 +60,5 @@ static inline int write(int fd, const char *buf, int len) void __start(void) { write (1, "Hello, World!\n", 14); - exit1 (42); + exit1(0); } diff --git a/tests/tcg/xtensa/Makefile b/tests/tcg/xtensa/Makefile deleted file mode 100644 index 2bd4491769..0000000000 --- a/tests/tcg/xtensa/Makefile +++ /dev/null @@ -1,102 +0,0 @@ --include ../../../config-host.mak - -CORE=dc232b -CROSS=xtensa-$(CORE)-elf- - -ifndef XT -SIM = ../../../xtensa-softmmu/qemu-system-xtensa -SIMFLAGS = -M sim -cpu $(CORE) -nographic -semihosting -icount 6 $(EXTFLAGS) -kernel -SIMDEBUG = -s -S -else -SIM = xt-run -SIMFLAGS = --xtensa-core=DC_B_232L --exit_with_target_code $(EXTFLAGS) -SIMDEBUG = --gdbserve=0 -endif - -HOST_CC = gcc -CC = $(CROSS)gcc -AS = $(CROSS)gcc -x assembler-with-cpp -LD = $(CROSS)ld - -ASFLAGS = -Wa,--no-absolute-literals -vectors_ASFLAGS = -mtext-section-literals - -XTENSA_SRC_PATH = $(SRC_PATH)/tests/tcg/xtensa -INCLUDE_DIRS = $(XTENSA_SRC_PATH) $(SRC_PATH)/target/xtensa/core-$(CORE) -XTENSA_INC = $(addprefix -I,$(INCLUDE_DIRS)) - -LDFLAGS = -Tlinker.ld - -CRT = crt.o vectors.o - -TESTCASES += test_b.tst -TESTCASES += test_bi.tst -TESTCASES += test_boolean.tst -TESTCASES += test_break.tst -TESTCASES += test_bz.tst -TESTCASES += test_cache.tst -TESTCASES += test_clamps.tst -TESTCASES += test_extui.tst -TESTCASES += test_fail.tst -TESTCASES += test_flix.tst -TESTCASES += test_fp0_arith.tst -TESTCASES += test_fp0_conv.tst -TESTCASES += test_fp1.tst -TESTCASES += test_fp_cpenable.tst -TESTCASES += test_interrupt.tst -TESTCASES += test_loop.tst -TESTCASES += test_lsc.tst -TESTCASES += test_mac16.tst -TESTCASES += test_max.tst -TESTCASES += test_min.tst -TESTCASES += test_mmu.tst -TESTCASES += test_mul16.tst -TESTCASES += test_mul32.tst -TESTCASES += test_nsa.tst -TESTCASES += test_phys_mem.tst -ifdef XT -TESTCASES += test_pipeline.tst -endif -TESTCASES += test_quo.tst -TESTCASES += test_rem.tst -TESTCASES += test_rst0.tst -TESTCASES += test_s32c1i.tst -TESTCASES += test_sar.tst -TESTCASES += test_sext.tst -TESTCASES += test_shift.tst -TESTCASES += test_sr.tst -TESTCASES += test_timer.tst -TESTCASES += test_windowed.tst - -all: build - -linker.ld: $(XTENSA_SRC_PATH)/linker.ld.S - $(HOST_CC) $(XTENSA_INC) -E -P $< -o $@ - -%.o: $(XTENSA_SRC_PATH)/%.c - $(CC) $(XTENSA_INC) $(CFLAGS) -c $< -o $@ - -%.o: $(XTENSA_SRC_PATH)/%.S - $(CC) $(XTENSA_INC) $($*_ASFLAGS) $(ASFLAGS) -c $< -o $@ - -%.tst: %.o linker.ld $(XTENSA_SRC_PATH)/macros.inc $(CRT) Makefile - $(LD) $(LDFLAGS) $(NOSTDFLAGS) $(CRT) $< -o $@ - -build: $(TESTCASES) - -check: $(addprefix run-, $(TESTCASES)) - -run-%.tst: %.tst - $(SIM) $(SIMFLAGS) ./$< - -run-test_fail.tst: test_fail.tst - ! $(SIM) $(SIMFLAGS) ./$< - -debug-%.tst: %.tst - $(SIM) $(SIMDEBUG) $(SIMFLAGS) ./$< - -host-debug-%.tst: %.tst - gdb --args $(SIM) $(SIMFLAGS) ./$< - -clean: - $(RM) -fr $(TESTCASES) $(CRT) linker.ld diff --git a/tests/tcg/xtensa/Makefile.include b/tests/tcg/xtensa/Makefile.include new file mode 100644 index 0000000000..423c00a5d3 --- /dev/null +++ b/tests/tcg/xtensa/Makefile.include @@ -0,0 +1,11 @@ +# Makefile.include for xtensa targets +# +# The compilers can only be used for building system tests + +ifeq ($(CONFIG_SOFTMMU),y) +DOCKER_IMAGE=debian-xtensa-cross + +# default to the dc232b cpu +DOCKER_CROSS_COMPILER=/opt/2018.02/xtensa-dc232b-elf/bin/xtensa-dc232b-elf-gcc +DOCKER_CROSS_LINKER=/opt/2018.02/xtensa-dc232b-elf/bin/xtensa-dc232b-elf-ld +endif diff --git a/tests/tcg/xtensa/Makefile.softmmu-target b/tests/tcg/xtensa/Makefile.softmmu-target new file mode 100644 index 0000000000..86bb47db77 --- /dev/null +++ b/tests/tcg/xtensa/Makefile.softmmu-target @@ -0,0 +1,42 @@ +# +# Xtensa softmmu tests +# + +ifneq ($(TARGET_WORDS_BIGENDIAN),y) + +XTENSA_SRC = $(SRC_PATH)/tests/tcg/xtensa +XTENSA_ALL = $(filter-out $(XTENSA_SRC)/linker.ld.S,$(wildcard $(XTENSA_SRC)/*.S)) +XTENSA_TESTS = $(patsubst $(XTENSA_SRC)/%.S, %, $(XTENSA_ALL)) +# Filter out common blobs and broken tests +XTENSA_BROKEN_TESTS = crt vectors test_boolean test_pipeline test_fail +XTENSA_USABLE_TESTS = $(filter-out $(XTENSA_BROKEN_TESTS), $(XTENSA_TESTS)) + +# add to the list of tests +TESTS += $(XTENSA_USABLE_TESTS) +VPATH += $(XTENSA_SRC) + +CORE=dc232b +QEMU_OPTS+=-M sim -cpu $(CORE) -nographic -semihosting -icount 6 $(EXTFLAGS) -kernel + +INCLUDE_DIRS = $(SRC_PATH)/target/xtensa/core-$(CORE) +XTENSA_INC = $(addprefix -I,$(INCLUDE_DIRS)) + +vectors_ASFLAGS = -mtext-section-literals +ASFLAGS = -Wa,--no-absolute-literals +LDFLAGS = -Tlinker.ld -nostartfiles -nostdlib + +CRT = crt.o vectors.o + +linker.ld: linker.ld.S + $(CC) $(XTENSA_INC) -E -P $< -o $@ + +$(XTENSA_USABLE_TESTS): linker.ld macros.inc $(CRT) Makefile.softmmu-target + +# special rule for common blobs +%.o: %.S + $(CC) $(XTENSA_INC) $($*_ASFLAGS) $(ASFLAGS) -c $< -o $@ + +%: %.S + $(CC) $(XTENSA_INC) $(ASFLAGS) $< -o $@ $(LDFLAGS) $(NOSTDFLAGS) $(CRT) + +endif |