mirror of
https://github.com/qemu/qemu.git
synced 2025-01-19 20:13:27 +08:00
Final testing fixes for 4.0
- various CI tweaks and fixes - fixes for some tcg tests - addition of system tcg tests -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEZoWumedRZ7yvyN81+9DbCVqeKkQFAlyH50wACgkQ+9DbCVqe KkTXUAgAg8xQZa25VAIV/I/YcYPRRyqFxzP9bTgWoDrAbInxxge2HvTXsLsQ+uYu CYdcqHFVMMXWFj+tPq/nolvR9hTLy76rbpZN1sCBZ75OEj2ZYULI8a/B9hSUstTd /6wC2Mf/k0KDTByBX9tv303YBNi2J3LSODTvpZWQgiZpfnZ08agrOOsUXXDjcDie 506WozssJmJcsAHORYoNFX7q9NNOzLCzoa2Ulme+nyIy2wZIsiG34GjH0DjDkLmg kt/azpBtvpW8zbTaXgorjQIwFS3cil6H7mXgj712K+Xg8+1XgOgBUqaHh43hc63d CtkcB1IK3oQq0UArneTy/JwphC+9Dg== =vg+Q -----END PGP SIGNATURE----- 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>
This commit is contained in:
commit
e4770dd95a
30
.travis.yml
30
.travis.yml
@ -85,6 +85,12 @@ matrix:
|
||||
- CONFIG="--disable-user"
|
||||
|
||||
|
||||
# Just build tools and run minimal unit and softfloat checks
|
||||
- env:
|
||||
- BASE_CONFIG="--enable-tools"
|
||||
- CONFIG="--disable-user --disable-system"
|
||||
- TEST_CMD="make check-unit check-softfloat -j3"
|
||||
|
||||
- env:
|
||||
- CONFIG="--enable-debug --enable-debug-tcg --disable-user"
|
||||
|
||||
@ -98,8 +104,9 @@ matrix:
|
||||
- CONFIG="--disable-linux-aio --disable-cap-ng --disable-attr --disable-brlapi --disable-libusb --disable-user --disable-replication"
|
||||
|
||||
|
||||
# Module builds are mostly of interest to major distros
|
||||
- env:
|
||||
- CONFIG="--enable-modules --disable-linux-user"
|
||||
- CONFIG="--enable-modules --target-list=aarch64-softmmu,arm-softmmu,i386-softmmu,mips-softmmu,mips64-softmmu,ppc64-softmmu,riscv64-softmmu,s390x-softmmu,x86_64-softmmu"
|
||||
|
||||
|
||||
# Alternate coroutines implementations are only really of interest to KVM users
|
||||
@ -114,8 +121,9 @@ matrix:
|
||||
- TEST_CMD="make check-unit -j3 V=1"
|
||||
|
||||
|
||||
# Check we can build docs and tools
|
||||
# Check we can build docs and tools (out of tree)
|
||||
- env:
|
||||
- BUILD_DIR="out-of-tree/build/dir" SRC_DIR="../../.."
|
||||
- BASE_CONFIG="--enable-tools --enable-docs"
|
||||
- CONFIG="--target-list=x86_64-softmmu,aarch64-linux-user"
|
||||
addons:
|
||||
@ -125,11 +133,6 @@ matrix:
|
||||
- texinfo
|
||||
- perl
|
||||
|
||||
# Test out-of-tree builds
|
||||
- env:
|
||||
- CONFIG="--enable-debug --enable-debug-tcg"
|
||||
- BUILD_DIR="out-of-tree/build/dir" SRC_DIR="../../.."
|
||||
|
||||
|
||||
# Test with Clang for compile portability (Travis uses clang-5.0)
|
||||
- env:
|
||||
@ -185,6 +188,13 @@ matrix:
|
||||
compiler: clang
|
||||
|
||||
|
||||
- env:
|
||||
- CONFIG="--target-list=i386-softmmu,ppc-softmmu,ppc64-softmmu,m68k-softmmu,x86_64-softmmu"
|
||||
os: osx
|
||||
osx_image: xcode10.2
|
||||
compiler: clang
|
||||
|
||||
|
||||
# Python builds
|
||||
- env:
|
||||
- CONFIG="--target-list=x86_64-softmmu"
|
||||
@ -255,6 +265,12 @@ matrix:
|
||||
- ./configure ${CONFIG} --extra-cflags="-g3 -O0 -fsanitize=thread -fuse-ld=gold" || { cat config.log && exit 1; }
|
||||
|
||||
|
||||
# Run check-tcg against linux-user
|
||||
- env:
|
||||
- CONFIG="--disable-system"
|
||||
- TEST_CMD="make -j3 check-tcg V=1"
|
||||
|
||||
# Run check-tcg against softmmu targets
|
||||
- env:
|
||||
- CONFIG="--target-list=xtensa-softmmu,arm-softmmu"
|
||||
- TEST_CMD="make -j3 check-tcg V=1"
|
||||
|
3
Makefile
3
Makefile
@ -964,7 +964,8 @@ $(filter %.1 %.7 %.8,$(DOCS)): scripts/texi2pod.pl
|
||||
%/coverage-report.html:
|
||||
@mkdir -p $*
|
||||
$(call quiet-command,\
|
||||
gcovr -p --html --html-details -o $@, \
|
||||
gcovr -r $(SRC_PATH) --object-directory $(BUILD_PATH) \
|
||||
-p --html --html-details -o $@, \
|
||||
"GEN", "coverage-report.html")
|
||||
|
||||
.PHONY: coverage-report
|
||||
|
@ -40,9 +40,7 @@ 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
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
#
|
||||
|
31
tests/docker/dockerfiles/debian-xtensa-cross.docker
Normal file
31
tests/docker/dockerfiles/debian-xtensa-cross.docker
Normal file
@ -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
|
8
tests/docker/dockerfiles/fedora-cris-cross.docker
Normal file
8
tests/docker/dockerfiles/fedora-cris-cross.docker
Normal file
@ -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
|
@ -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)
|
||||
|
@ -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)")
|
||||
|
@ -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;
|
||||
|
||||
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));
|
||||
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));
|
||||
|
||||
assert(p1 != p0);
|
||||
assert(p1 != p2);
|
||||
if (p1 != p0) {
|
||||
count++;
|
||||
}
|
||||
if (p1 != p2) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
perc = (float) count / (float) (TESTS * 2);
|
||||
printf("Ptr Check: %0.2f%%", perc * 100.0);
|
||||
assert(perc > 0.95);
|
||||
return 0;
|
||||
}
|
||||
|
29
tests/tcg/arm/Makefile.softmmu-target
Normal file
29
tests/tcg/arm/Makefile.softmmu-target
Normal file
@ -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
|
154
tests/tcg/arm/test-armv6m-undef.S
Normal file
154
tests/tcg/arm/test-armv6m-undef.S
Normal file
@ -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
|
21
tests/tcg/arm/test-armv6m-undef.ld
Normal file
21
tests/tcg/arm/test-armv6m-undef.ld
Normal file
@ -0,0 +1,21 @@
|
||||
ENTRY(exc_reset_thumb)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x0;
|
||||
.text : {
|
||||
*(.text)
|
||||
}
|
||||
.data : {
|
||||
*(.data)
|
||||
}
|
||||
.rodata : {
|
||||
*(.rodata)
|
||||
}
|
||||
.bss : {
|
||||
*(.bss)
|
||||
}
|
||||
/DISCARD/ : {
|
||||
*(.ARM.attributes)
|
||||
}
|
||||
}
|
@ -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
|
6
tests/tcg/cris/Makefile.include
Normal file
6
tests/tcg/cris/Makefile.include
Normal file
@ -0,0 +1,6 @@
|
||||
#
|
||||
# Makefile.include for all CRIS targets
|
||||
#
|
||||
|
||||
DOCKER_IMAGE=fedora-cris-cross
|
||||
DOCKER_CROSS_COMPILER=cris-linux-gnu-gcc
|
58
tests/tcg/cris/Makefile.target
Normal file
58
tests/tcg/cris/Makefile.target
Normal file
@ -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")
|
@ -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
|
@ -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
|
63
tests/tcg/cris/bare/sys.c
Normal file
63
tests/tcg/cris/bare/sys.c
Normal file
@ -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);
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user