From f0c67a79ef7acce9305092f685da5d15c03502b4 Mon Sep 17 00:00:00 2001 From: "Lucas Mateus Castro (alqotel)" Date: Thu, 29 Sep 2022 12:41:44 +0100 Subject: tests/docker: run script use realpath instead of readlink MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The alpine docker image only comes with busybox, which doesn't have the '-e' option on its readlink, so change it to 'realpath' to avoid that problem. Suggested-by: Daniel P. Berrangé Signed-off-by: Lucas Mateus Castro (alqotel) Message-Id: <20220922135516.33627-5-lucas.araujo@eldorado.org.br> Signed-off-by: Alex Bennée Message-Id: <20220929114231.583801-5-alex.bennee@linaro.org> --- tests/docker/run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/docker/run b/tests/docker/run index 4213930..9eb96129 100755 --- a/tests/docker/run +++ b/tests/docker/run @@ -15,7 +15,7 @@ if test -n "$V"; then set -x fi -BASE="$(dirname $(readlink -e $0))" +BASE="$(dirname $(realpath $0))" # Prepare the environment export PATH=/usr/lib/ccache:/usr/lib64/ccache:$PATH -- cgit v1.1 From 94378d4eb6d75322665d8a6d1577736fcc4ba97b Mon Sep 17 00:00:00 2001 From: Anton Johansson Date: Thu, 29 Sep 2022 12:41:46 +0100 Subject: target/hexagon: add flex/bison/glib2 to qemu.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Note, the glib2-native mapping exists separately from the normal glib2 mapping. The latter uses a `foreign` cross-policy-default, and libvirt-ci is not able to support package mappings for multiple cross-compilation policies. This will probably change in the future. Signed-off-by: Alessandro Di Federico Signed-off-by: Paolo Montesel Signed-off-by: Anton Johansson Signed-off-by: Alex Bennée Message-Id: <20220804115548.13024-9-anjo@rev.ng> Message-Id: <20220929114231.583801-7-alex.bennee@linaro.org> --- tests/lcitool/projects/qemu.yml | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests') diff --git a/tests/lcitool/projects/qemu.yml b/tests/lcitool/projects/qemu.yml index d9f826f..0d92819 100644 --- a/tests/lcitool/projects/qemu.yml +++ b/tests/lcitool/projects/qemu.yml @@ -3,6 +3,7 @@ packages: - alsa - bash - bc + - bison - brlapi - bzip2 - bzip2-libs @@ -19,6 +20,7 @@ packages: - diffutils - dtrace - findutils + - flex - fuse3 - g++ - gcc @@ -26,6 +28,7 @@ packages: - gettext - genisoimage - glib2 + - glib2-native - glib2-static - glusterfs - gnutls -- cgit v1.1 From 8fae3910e2370691b098d51b918600b9ad905df5 Mon Sep 17 00:00:00 2001 From: Anton Johansson Date: Thu, 29 Sep 2022 12:41:47 +0100 Subject: target/hexagon: regenerate docker/cirrus files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch updates the docker and cirrus files with the new packages by running tests/lcitool/refresh Signed-off-by: Anton Johansson Signed-off-by: Alex Bennée Message-Id: <20220804115548.13024-10-anjo@rev.ng> Message-Id: <20220929114231.583801-8-alex.bennee@linaro.org> --- tests/docker/dockerfiles/alpine.docker | 2 ++ tests/docker/dockerfiles/centos8.docker | 2 ++ tests/docker/dockerfiles/debian-amd64-cross.docker | 3 +++ tests/docker/dockerfiles/debian-amd64.docker | 2 ++ tests/docker/dockerfiles/debian-arm64-cross.docker | 3 +++ tests/docker/dockerfiles/debian-armel-cross.docker | 3 +++ tests/docker/dockerfiles/debian-armhf-cross.docker | 3 +++ tests/docker/dockerfiles/debian-mips64el-cross.docker | 3 +++ tests/docker/dockerfiles/debian-mipsel-cross.docker | 3 +++ tests/docker/dockerfiles/debian-ppc64el-cross.docker | 3 +++ tests/docker/dockerfiles/debian-s390x-cross.docker | 3 +++ tests/docker/dockerfiles/fedora.docker | 2 ++ tests/docker/dockerfiles/opensuse-leap.docker | 2 ++ tests/docker/dockerfiles/ubuntu2004.docker | 2 ++ 14 files changed, 36 insertions(+) (limited to 'tests') diff --git a/tests/docker/dockerfiles/alpine.docker b/tests/docker/dockerfiles/alpine.docker index 806cb19..7d6e952 100644 --- a/tests/docker/dockerfiles/alpine.docker +++ b/tests/docker/dockerfiles/alpine.docker @@ -13,6 +13,7 @@ RUN apk update && \ attr-dev \ bash \ bc \ + bison \ bzip2 \ bzip2-dev \ ca-certificates \ @@ -30,6 +31,7 @@ RUN apk update && \ dtc-dev \ eudev-dev \ findutils \ + flex \ fuse3-dev \ g++ \ gcc \ diff --git a/tests/docker/dockerfiles/centos8.docker b/tests/docker/dockerfiles/centos8.docker index 3c29883..d89113c 100644 --- a/tests/docker/dockerfiles/centos8.docker +++ b/tests/docker/dockerfiles/centos8.docker @@ -17,6 +17,7 @@ RUN dnf distro-sync -y && \ alsa-lib-devel \ bash \ bc \ + bison \ brlapi-devel \ bzip2 \ bzip2-devel \ @@ -31,6 +32,7 @@ RUN dnf distro-sync -y && \ device-mapper-multipath-devel \ diffutils \ findutils \ + flex \ fuse3-devel \ gcc \ gcc-c++ \ diff --git a/tests/docker/dockerfiles/debian-amd64-cross.docker b/tests/docker/dockerfiles/debian-amd64-cross.docker index 7d2feb7..9047759 100644 --- a/tests/docker/dockerfiles/debian-amd64-cross.docker +++ b/tests/docker/dockerfiles/debian-amd64-cross.docker @@ -13,6 +13,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ eatmydata apt-get install --no-install-recommends -y \ bash \ bc \ + bison \ bsdextrautils \ bzip2 \ ca-certificates \ @@ -22,11 +23,13 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ diffutils \ exuberant-ctags \ findutils \ + flex \ gcovr \ genisoimage \ gettext \ git \ hostname \ + libglib2.0-dev \ libpcre2-dev \ libspice-protocol-dev \ llvm \ diff --git a/tests/docker/dockerfiles/debian-amd64.docker b/tests/docker/dockerfiles/debian-amd64.docker index 8d78ba2..a8b728c 100644 --- a/tests/docker/dockerfiles/debian-amd64.docker +++ b/tests/docker/dockerfiles/debian-amd64.docker @@ -13,6 +13,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ eatmydata apt-get install --no-install-recommends -y \ bash \ bc \ + bison \ bsdextrautils \ bzip2 \ ca-certificates \ @@ -23,6 +24,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ diffutils \ exuberant-ctags \ findutils \ + flex \ g++ \ gcc \ gcovr \ diff --git a/tests/docker/dockerfiles/debian-arm64-cross.docker b/tests/docker/dockerfiles/debian-arm64-cross.docker index b7ba2c5..17a5709 100644 --- a/tests/docker/dockerfiles/debian-arm64-cross.docker +++ b/tests/docker/dockerfiles/debian-arm64-cross.docker @@ -13,6 +13,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ eatmydata apt-get install --no-install-recommends -y \ bash \ bc \ + bison \ bsdextrautils \ bzip2 \ ca-certificates \ @@ -22,11 +23,13 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ diffutils \ exuberant-ctags \ findutils \ + flex \ gcovr \ genisoimage \ gettext \ git \ hostname \ + libglib2.0-dev \ libpcre2-dev \ libspice-protocol-dev \ llvm \ diff --git a/tests/docker/dockerfiles/debian-armel-cross.docker b/tests/docker/dockerfiles/debian-armel-cross.docker index 9b17782..701fc70 100644 --- a/tests/docker/dockerfiles/debian-armel-cross.docker +++ b/tests/docker/dockerfiles/debian-armel-cross.docker @@ -13,6 +13,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ eatmydata apt-get install --no-install-recommends -y \ bash \ bc \ + bison \ bsdextrautils \ bzip2 \ ca-certificates \ @@ -22,11 +23,13 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ diffutils \ exuberant-ctags \ findutils \ + flex \ gcovr \ genisoimage \ gettext \ git \ hostname \ + libglib2.0-dev \ libpcre2-dev \ libspice-protocol-dev \ llvm \ diff --git a/tests/docker/dockerfiles/debian-armhf-cross.docker b/tests/docker/dockerfiles/debian-armhf-cross.docker index addbc9a..5a11fe3 100644 --- a/tests/docker/dockerfiles/debian-armhf-cross.docker +++ b/tests/docker/dockerfiles/debian-armhf-cross.docker @@ -13,6 +13,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ eatmydata apt-get install --no-install-recommends -y \ bash \ bc \ + bison \ bsdextrautils \ bzip2 \ ca-certificates \ @@ -22,11 +23,13 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ diffutils \ exuberant-ctags \ findutils \ + flex \ gcovr \ genisoimage \ gettext \ git \ hostname \ + libglib2.0-dev \ libpcre2-dev \ libspice-protocol-dev \ llvm \ diff --git a/tests/docker/dockerfiles/debian-mips64el-cross.docker b/tests/docker/dockerfiles/debian-mips64el-cross.docker index 1bb7d8e..9b90a4d 100644 --- a/tests/docker/dockerfiles/debian-mips64el-cross.docker +++ b/tests/docker/dockerfiles/debian-mips64el-cross.docker @@ -13,6 +13,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ eatmydata apt-get install --no-install-recommends -y \ bash \ bc \ + bison \ bsdextrautils \ bzip2 \ ca-certificates \ @@ -22,11 +23,13 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ diffutils \ exuberant-ctags \ findutils \ + flex \ gcovr \ genisoimage \ gettext \ git \ hostname \ + libglib2.0-dev \ libpcre2-dev \ libspice-protocol-dev \ llvm \ diff --git a/tests/docker/dockerfiles/debian-mipsel-cross.docker b/tests/docker/dockerfiles/debian-mipsel-cross.docker index a94b459..02feaf2 100644 --- a/tests/docker/dockerfiles/debian-mipsel-cross.docker +++ b/tests/docker/dockerfiles/debian-mipsel-cross.docker @@ -13,6 +13,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ eatmydata apt-get install --no-install-recommends -y \ bash \ bc \ + bison \ bsdextrautils \ bzip2 \ ca-certificates \ @@ -22,11 +23,13 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ diffutils \ exuberant-ctags \ findutils \ + flex \ gcovr \ genisoimage \ gettext \ git \ hostname \ + libglib2.0-dev \ libpcre2-dev \ libspice-protocol-dev \ llvm \ diff --git a/tests/docker/dockerfiles/debian-ppc64el-cross.docker b/tests/docker/dockerfiles/debian-ppc64el-cross.docker index c641fd5..97d3872 100644 --- a/tests/docker/dockerfiles/debian-ppc64el-cross.docker +++ b/tests/docker/dockerfiles/debian-ppc64el-cross.docker @@ -13,6 +13,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ eatmydata apt-get install --no-install-recommends -y \ bash \ bc \ + bison \ bsdextrautils \ bzip2 \ ca-certificates \ @@ -22,11 +23,13 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ diffutils \ exuberant-ctags \ findutils \ + flex \ gcovr \ genisoimage \ gettext \ git \ hostname \ + libglib2.0-dev \ libpcre2-dev \ libspice-protocol-dev \ llvm \ diff --git a/tests/docker/dockerfiles/debian-s390x-cross.docker b/tests/docker/dockerfiles/debian-s390x-cross.docker index c0cbe09..95585e9 100644 --- a/tests/docker/dockerfiles/debian-s390x-cross.docker +++ b/tests/docker/dockerfiles/debian-s390x-cross.docker @@ -13,6 +13,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ eatmydata apt-get install --no-install-recommends -y \ bash \ bc \ + bison \ bsdextrautils \ bzip2 \ ca-certificates \ @@ -22,11 +23,13 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ diffutils \ exuberant-ctags \ findutils \ + flex \ gcovr \ genisoimage \ gettext \ git \ hostname \ + libglib2.0-dev \ libpcre2-dev \ libspice-protocol-dev \ llvm \ diff --git a/tests/docker/dockerfiles/fedora.docker b/tests/docker/dockerfiles/fedora.docker index b39d311..fe84166 100644 --- a/tests/docker/dockerfiles/fedora.docker +++ b/tests/docker/dockerfiles/fedora.docker @@ -23,6 +23,7 @@ exec "$@"' > /usr/bin/nosync && \ alsa-lib-devel \ bash \ bc \ + bison \ brlapi-devel \ bzip2 \ bzip2-devel \ @@ -37,6 +38,7 @@ exec "$@"' > /usr/bin/nosync && \ device-mapper-multipath-devel \ diffutils \ findutils \ + flex \ fuse3-devel \ gcc \ gcc-c++ \ diff --git a/tests/docker/dockerfiles/opensuse-leap.docker b/tests/docker/dockerfiles/opensuse-leap.docker index 041cf9c..d800647 100644 --- a/tests/docker/dockerfiles/opensuse-leap.docker +++ b/tests/docker/dockerfiles/opensuse-leap.docker @@ -12,6 +12,7 @@ RUN zypper update -y && \ alsa-lib-devel \ bash \ bc \ + bison \ brlapi-devel \ bzip2 \ ca-certificates \ @@ -22,6 +23,7 @@ RUN zypper update -y && \ dbus-1 \ diffutils \ findutils \ + flex \ fuse3-devel \ gcc \ gcc-c++ \ diff --git a/tests/docker/dockerfiles/ubuntu2004.docker b/tests/docker/dockerfiles/ubuntu2004.docker index e1f4ed7..24594af 100644 --- a/tests/docker/dockerfiles/ubuntu2004.docker +++ b/tests/docker/dockerfiles/ubuntu2004.docker @@ -13,6 +13,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ eatmydata apt-get install --no-install-recommends -y \ bash \ bc \ + bison \ bsdmainutils \ bzip2 \ ca-certificates \ @@ -23,6 +24,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ diffutils \ exuberant-ctags \ findutils \ + flex \ g++ \ gcc \ gcovr \ -- cgit v1.1 From 3de61b9856f59bab7739bf213936ac63d8ef3584 Mon Sep 17 00:00:00 2001 From: Anton Johansson Date: Thu, 29 Sep 2022 12:41:48 +0100 Subject: target/hexagon: manually add flex/bison/glib2 to remaining containers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds our build-time dependencies to containers which build qemu-hexagon, but aren't covered by libvirt-ci. Signed-off-by: Anton Johansson Signed-off-by: Alex Bennée Message-Id: <20220804115548.13024-11-anjo@rev.ng> Message-Id: <20220929114231.583801-9-alex.bennee@linaro.org> --- tests/docker/dockerfiles/debian-riscv64-cross.docker | 3 +++ tests/docker/dockerfiles/fedora-i386-cross.docker | 2 ++ tests/docker/dockerfiles/fedora-win32-cross.docker | 3 +++ tests/docker/dockerfiles/fedora-win64-cross.docker | 3 +++ 4 files changed, 11 insertions(+) (limited to 'tests') diff --git a/tests/docker/dockerfiles/debian-riscv64-cross.docker b/tests/docker/dockerfiles/debian-riscv64-cross.docker index 594d979..9715791 100644 --- a/tests/docker/dockerfiles/debian-riscv64-cross.docker +++ b/tests/docker/dockerfiles/debian-riscv64-cross.docker @@ -16,13 +16,16 @@ RUN apt update && \ # Install common build utilities RUN DEBIAN_FRONTEND=noninteractive eatmydata apt install -yy \ + bison \ bc \ build-essential \ ca-certificates \ debian-ports-archive-keyring \ dpkg-dev \ + flex \ gettext \ git \ + libglib2.0-dev \ ninja-build \ pkg-config \ python3 diff --git a/tests/docker/dockerfiles/fedora-i386-cross.docker b/tests/docker/dockerfiles/fedora-i386-cross.docker index 0a3ec34..7eec648 100644 --- a/tests/docker/dockerfiles/fedora-i386-cross.docker +++ b/tests/docker/dockerfiles/fedora-i386-cross.docker @@ -1,9 +1,11 @@ FROM registry.fedoraproject.org/fedora:34 ENV PACKAGES \ + bison \ bzip2 \ ccache \ diffutils \ + flex \ findutils \ gcc \ git \ diff --git a/tests/docker/dockerfiles/fedora-win32-cross.docker b/tests/docker/dockerfiles/fedora-win32-cross.docker index a06bd29..aca37aa 100644 --- a/tests/docker/dockerfiles/fedora-win32-cross.docker +++ b/tests/docker/dockerfiles/fedora-win32-cross.docker @@ -3,13 +3,16 @@ FROM registry.fedoraproject.org/fedora:35 # Please keep this list sorted alphabetically ENV PACKAGES \ bc \ + bison \ bzip2 \ ccache \ diffutils \ findutils \ + flex \ gcc \ gettext \ git \ + glib2-devel \ hostname \ make \ meson \ diff --git a/tests/docker/dockerfiles/fedora-win64-cross.docker b/tests/docker/dockerfiles/fedora-win64-cross.docker index b716243..3642766 100644 --- a/tests/docker/dockerfiles/fedora-win64-cross.docker +++ b/tests/docker/dockerfiles/fedora-win64-cross.docker @@ -3,13 +3,16 @@ FROM registry.fedoraproject.org/fedora:35 # Please keep this list sorted alphabetically ENV PACKAGES \ bc \ + bison \ bzip2 \ ccache \ diffutils \ findutils \ + flex \ gcc \ gettext \ git \ + glib2-devel \ hostname \ make \ meson \ -- cgit v1.1 From 81844654156af97294657c0b4e793206afcc68ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Thu, 29 Sep 2022 12:41:50 +0100 Subject: tests/docker: move alpine from edge to tagged release MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tracking alpine-edge like debian-sid is a moving target. Usually such rolling releases are marked as "allow_failure: true" in our CI. However as alpine presents a musl based distro and provides useful extra coverage lets track a release branch instead to avoid random breakages. Signed-off-by: Alex Bennée Reviewed-by: Thomas Huth Message-Id: <20220929114231.583801-11-alex.bennee@linaro.org> --- tests/docker/dockerfiles/alpine.docker | 4 ++-- tests/lcitool/refresh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/docker/dockerfiles/alpine.docker b/tests/docker/dockerfiles/alpine.docker index 7d6e952..9b75412 100644 --- a/tests/docker/dockerfiles/alpine.docker +++ b/tests/docker/dockerfiles/alpine.docker @@ -1,10 +1,10 @@ # THIS FILE WAS AUTO-GENERATED # -# $ lcitool dockerfile --layers all alpine-edge qemu +# $ lcitool dockerfile --layers all alpine-316 qemu # # https://gitlab.com/libvirt/libvirt-ci -FROM docker.io/library/alpine:edge +FROM docker.io/library/alpine:3.16 RUN apk update && \ apk upgrade && \ diff --git a/tests/lcitool/refresh b/tests/lcitool/refresh index fc604d8..e45c99a 100755 --- a/tests/lcitool/refresh +++ b/tests/lcitool/refresh @@ -107,7 +107,7 @@ try: # # Standard native builds # - generate_dockerfile("alpine", "alpine-edge") + generate_dockerfile("alpine", "alpine-316") generate_dockerfile("centos8", "centos-stream-8") generate_dockerfile("debian-amd64", "debian-11", trailer="".join(debian11_extras)) -- cgit v1.1 From 100c459f1948b9367cea44c76d5c633b0d23f23b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Thu, 29 Sep 2022 12:41:51 +0100 Subject: tests/qtest: bump up QOS_PATH_MAX_ELEMENT_SIZE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It seems the depth of stack we need to support can vary depending on the order of the init constructors getting called. It seems --enable-lto shuffles things around just enough to push you over the limit. Signed-off-by: Alex Bennée Fixes: https://gitlab.com/qemu-project/qemu/-/issues/1186 Acked-by: Thomas Huth Acked-by: Paolo Bonzini Message-Id: <20220929114231.583801-12-alex.bennee@linaro.org> --- tests/qtest/libqos/qgraph.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/qtest/libqos/qgraph.h b/tests/qtest/libqos/qgraph.h index 6e94824..5c0046e 100644 --- a/tests/qtest/libqos/qgraph.h +++ b/tests/qtest/libqos/qgraph.h @@ -24,7 +24,7 @@ #include "libqos-malloc.h" /* maximum path length */ -#define QOS_PATH_MAX_ELEMENT_SIZE 50 +#define QOS_PATH_MAX_ELEMENT_SIZE 64 typedef struct QOSGraphObject QOSGraphObject; typedef struct QOSGraphNode QOSGraphNode; -- cgit v1.1 From c4575b59155e2e0065c29d56496dbf3e6ffd035b Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 29 Sep 2022 12:41:58 +0100 Subject: configure: store container engine in config-host.mak MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In preparation for removing $(DOCKER_SCRIPT) from the tests/tcg configuration files, have Make use the same container engine that had been probed at configure time. Signed-off-by: Paolo Bonzini Signed-off-by: Alex Bennée Message-Id: <20220929114231.583801-19-alex.bennee@linaro.org> --- tests/docker/Makefile.include | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include index 270e997..c87f144 100644 --- a/tests/docker/Makefile.include +++ b/tests/docker/Makefile.include @@ -14,7 +14,7 @@ DOCKER_DEFAULT_REGISTRY := registry.gitlab.com/qemu-project/qemu endif DOCKER_REGISTRY := $(if $(REGISTRY),$(REGISTRY),$(DOCKER_DEFAULT_REGISTRY)) -ENGINE := auto +ENGINE ?= auto DOCKER_SCRIPT=$(SRC_PATH)/tests/docker/docker.py --engine $(ENGINE) CUR_TIME := $(shell date +%Y-%m-%d-%H.%M.%S.$$$$) -- cgit v1.1 From a3e28f81fd886a79502d56ac3614d30bdf4a6dad Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 29 Sep 2022 12:41:59 +0100 Subject: tests: simplify Makefile invocation for tests/tcg MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove the DOCKER_SCRIPT and TARGET variable from the Makefile invocation for tests/tcg. For DOCKER_SCRIPT, resolve the path to docker.py in configure; for TARGET, move it to config-$(TARGET).mak and use a symbolic link to break the cycle. The symbolic link is still needed because tests/tcg includes dummy config files for targets that are not buildable. Once that is cleaned up, the symbolic link will go away too. Signed-off-by: Paolo Bonzini Signed-off-by: Alex Bennée Message-Id: <20220929114231.583801-20-alex.bennee@linaro.org> --- tests/Makefile.include | 9 +++------ tests/tcg/Makefile.target | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) (limited to 'tests') diff --git a/tests/Makefile.include b/tests/Makefile.include index 3accb83..826b189 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -50,23 +50,20 @@ $(foreach TARGET,$(TCG_TESTS_TARGETS), \ .PHONY: $(TCG_TESTS_TARGETS:%=build-tcg-tests-%) $(TCG_TESTS_TARGETS:%=build-tcg-tests-%): build-tcg-tests-%: $(BUILD_DIR)/tests/tcg/config-%.mak $(call quiet-command, \ - $(MAKE) -C tests/tcg/$* -f ../Makefile.target $(SUBDIR_MAKEFLAGS) \ - DOCKER_SCRIPT="$(DOCKER_SCRIPT)" \ - TARGET="$*" SRC_PATH="$(SRC_PATH)", \ + $(MAKE) -C tests/tcg/$* -f ../Makefile.target $(SUBDIR_MAKEFLAGS), \ "BUILD","$* guest-tests") .PHONY: $(TCG_TESTS_TARGETS:%=run-tcg-tests-%) $(TCG_TESTS_TARGETS:%=run-tcg-tests-%): run-tcg-tests-%: build-tcg-tests-% $(call quiet-command, \ $(MAKE) -C tests/tcg/$* -f ../Makefile.target $(SUBDIR_MAKEFLAGS) \ - TARGET="$*" SRC_PATH="$(SRC_PATH)" SPEED=$(SPEED) run, \ + SPEED=$(SPEED) run, \ "RUN", "$* guest-tests") .PHONY: $(TCG_TESTS_TARGETS:%=clean-tcg-tests-%) $(TCG_TESTS_TARGETS:%=clean-tcg-tests-%): clean-tcg-tests-%: $(call quiet-command, \ - $(MAKE) -C tests/tcg/$* -f ../Makefile.target $(SUBDIR_MAKEFLAGS) \ - TARGET="$*" SRC_PATH="$(SRC_PATH)" clean, \ + $(MAKE) -C tests/tcg/$* -f ../Makefile.target $(SUBDIR_MAKEFLAGS) clean, \ "CLEAN", "$* guest-tests") .PHONY: build-tcg diff --git a/tests/tcg/Makefile.target b/tests/tcg/Makefile.target index c896d10..b9c3d24 100644 --- a/tests/tcg/Makefile.target +++ b/tests/tcg/Makefile.target @@ -31,7 +31,7 @@ all: -include ../config-host.mak --include ../config-$(TARGET).mak +-include config-target.mak # Get semihosting definitions for user-mode emulation ifeq ($(filter %-softmmu, $(TARGET)),) -- cgit v1.1 From d674342e2e29feb7dd3ccf44e2116f78e611e906 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 29 Sep 2022 12:42:00 +0100 Subject: tests/tcg: remove -f from Makefile invocation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of linking tests/tcg/Makefile.target into the build tree, name the symbolic link "Makefile" and create it in every target subdirectory. This makes it possible to just invoke "make" in tests/tcg subdirectories. Signed-off-by: Paolo Bonzini Signed-off-by: Alex Bennée Message-Id: <20220929114231.583801-21-alex.bennee@linaro.org> --- tests/Makefile.include | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/Makefile.include b/tests/Makefile.include index 826b189..caef287 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -50,20 +50,19 @@ $(foreach TARGET,$(TCG_TESTS_TARGETS), \ .PHONY: $(TCG_TESTS_TARGETS:%=build-tcg-tests-%) $(TCG_TESTS_TARGETS:%=build-tcg-tests-%): build-tcg-tests-%: $(BUILD_DIR)/tests/tcg/config-%.mak $(call quiet-command, \ - $(MAKE) -C tests/tcg/$* -f ../Makefile.target $(SUBDIR_MAKEFLAGS), \ + $(MAKE) -C tests/tcg/$* $(SUBDIR_MAKEFLAGS), \ "BUILD","$* guest-tests") .PHONY: $(TCG_TESTS_TARGETS:%=run-tcg-tests-%) $(TCG_TESTS_TARGETS:%=run-tcg-tests-%): run-tcg-tests-%: build-tcg-tests-% $(call quiet-command, \ - $(MAKE) -C tests/tcg/$* -f ../Makefile.target $(SUBDIR_MAKEFLAGS) \ - SPEED=$(SPEED) run, \ + $(MAKE) -C tests/tcg/$* $(SUBDIR_MAKEFLAGS) SPEED=$(SPEED) run, \ "RUN", "$* guest-tests") .PHONY: $(TCG_TESTS_TARGETS:%=clean-tcg-tests-%) $(TCG_TESTS_TARGETS:%=clean-tcg-tests-%): clean-tcg-tests-%: $(call quiet-command, \ - $(MAKE) -C tests/tcg/$* -f ../Makefile.target $(SUBDIR_MAKEFLAGS) clean, \ + $(MAKE) -C tests/tcg/$* $(SUBDIR_MAKEFLAGS) clean, \ "CLEAN", "$* guest-tests") .PHONY: build-tcg -- cgit v1.1 From 6ffe81370aab511f438ece256977def804f9b6e2 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 29 Sep 2022 12:42:01 +0100 Subject: tests/tcg: add distclean rule MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Paolo Bonzini Signed-off-by: Alex Bennée Message-Id: <20220929114231.583801-22-alex.bennee@linaro.org> --- tests/Makefile.include | 11 +++++++++++ tests/tcg/Makefile.target | 3 +++ 2 files changed, 14 insertions(+) (limited to 'tests') diff --git a/tests/Makefile.include b/tests/Makefile.include index caef287..9ed6772 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -42,6 +42,7 @@ tests/tcg/Makefile.prereqs: config-host.mak # Per guest TCG tests BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(TCG_TESTS_TARGETS)) CLEAN_TCG_TARGET_RULES=$(patsubst %,clean-tcg-tests-%, $(TCG_TESTS_TARGETS)) +DISTCLEAN_TCG_TARGET_RULES=$(patsubst %,distclean-tcg-tests-%, $(TCG_TESTS_TARGETS)) RUN_TCG_TARGET_RULES=$(patsubst %,run-tcg-tests-%, $(TCG_TESTS_TARGETS)) $(foreach TARGET,$(TCG_TESTS_TARGETS), \ @@ -65,6 +66,12 @@ $(TCG_TESTS_TARGETS:%=clean-tcg-tests-%): clean-tcg-tests-%: $(MAKE) -C tests/tcg/$* $(SUBDIR_MAKEFLAGS) clean, \ "CLEAN", "$* guest-tests") +.PHONY: $(TCG_TESTS_TARGETS:%=distclean-tcg-tests-%) +$(TCG_TESTS_TARGETS:%=distclean-tcg-tests-%): distclean-tcg-tests-%: + $(call quiet-command, \ + $(MAKE) -C tests/tcg/$* $(SUBDIR_MAKEFLAGS) distclean, \ + "CLEAN", "$* guest-tests") + .PHONY: build-tcg build-tcg: $(BUILD_TCG_TARGET_RULES) @@ -75,6 +82,9 @@ check-tcg: $(RUN_TCG_TARGET_RULES) .PHONY: clean-tcg clean-tcg: $(CLEAN_TCG_TARGET_RULES) +.PHONY: distclean-tcg +distclean-tcg: $(DISTCLEAN_TCG_TARGET_RULES) + # Python venv for running tests .PHONY: check-venv check-avocado check-acceptance check-acceptance-deprecated-warning @@ -159,5 +169,6 @@ check-clean: rm -rf $(TESTS_VENV_DIR) $(TESTS_RESULTS_DIR) clean: check-clean clean-tcg +distclean: distclean-tcg endif diff --git a/tests/tcg/Makefile.target b/tests/tcg/Makefile.target index b9c3d24..c14eca8 100644 --- a/tests/tcg/Makefile.target +++ b/tests/tcg/Makefile.target @@ -189,3 +189,6 @@ run: $(RUN_TESTS) clean: rm -f $(TESTS) *.o $(CLEANFILES) + +distclean: + rm -f config-target.mak ../config-$(TARGET).mak -- cgit v1.1 From 37b0dba45c4e44a02000a4170f25af0110f501d5 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 29 Sep 2022 12:42:02 +0100 Subject: tests/tcg: unify ppc64 and ppc64le Makefiles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make tests/tcg/ppc64le include tests/tcg/ppc64 instead of duplicating the rules. Because the ppc64le vpath includes tests/tcg/ppc64 but not vice versa, the tests have to be moved from tests/tcg/ppc64le/ to tests/tcg/ppc64. Signed-off-by: Paolo Bonzini Signed-off-by: Alex Bennée Message-Id: <20220929114231.583801-23-alex.bennee@linaro.org> --- tests/tcg/ppc64/Makefile.target | 1 - tests/tcg/ppc64/bcdsub.c | 134 ++++++++++++++++++++++++++++ tests/tcg/ppc64/byte_reverse.c | 21 +++++ tests/tcg/ppc64/mffsce.c | 37 ++++++++ tests/tcg/ppc64/mtfsf.c | 60 +++++++++++++ tests/tcg/ppc64/non_signalling_xscv.c | 37 ++++++++ tests/tcg/ppc64/signal_save_restore_xer.c | 42 +++++++++ tests/tcg/ppc64/xxspltw.c | 46 ++++++++++ tests/tcg/ppc64le/Makefile.target | 26 +----- tests/tcg/ppc64le/bcdsub.c | 134 ---------------------------- tests/tcg/ppc64le/byte_reverse.c | 21 ----- tests/tcg/ppc64le/mffsce.c | 37 -------- tests/tcg/ppc64le/mtfsf.c | 60 ------------- tests/tcg/ppc64le/non_signalling_xscv.c | 37 -------- tests/tcg/ppc64le/signal_save_restore_xer.c | 42 --------- tests/tcg/ppc64le/xxspltw.c | 46 ---------- 16 files changed, 378 insertions(+), 403 deletions(-) create mode 100644 tests/tcg/ppc64/bcdsub.c create mode 100644 tests/tcg/ppc64/byte_reverse.c create mode 100644 tests/tcg/ppc64/mffsce.c create mode 100644 tests/tcg/ppc64/mtfsf.c create mode 100644 tests/tcg/ppc64/non_signalling_xscv.c create mode 100644 tests/tcg/ppc64/signal_save_restore_xer.c create mode 100644 tests/tcg/ppc64/xxspltw.c delete mode 100644 tests/tcg/ppc64le/bcdsub.c delete mode 100644 tests/tcg/ppc64le/byte_reverse.c delete mode 100644 tests/tcg/ppc64le/mffsce.c delete mode 100644 tests/tcg/ppc64le/mtfsf.c delete mode 100644 tests/tcg/ppc64le/non_signalling_xscv.c delete mode 100644 tests/tcg/ppc64le/signal_save_restore_xer.c delete mode 100644 tests/tcg/ppc64le/xxspltw.c (limited to 'tests') diff --git a/tests/tcg/ppc64/Makefile.target b/tests/tcg/ppc64/Makefile.target index 331fae6..7db7a3e 100644 --- a/tests/tcg/ppc64/Makefile.target +++ b/tests/tcg/ppc64/Makefile.target @@ -3,7 +3,6 @@ # ppc64 specific tweaks VPATH += $(SRC_PATH)/tests/tcg/ppc64 -VPATH += $(SRC_PATH)/tests/tcg/ppc64le ifneq ($(CROSS_CC_HAS_POWER8_VECTOR),) PPC64_TESTS=bcdsub non_signalling_xscv diff --git a/tests/tcg/ppc64/bcdsub.c b/tests/tcg/ppc64/bcdsub.c new file mode 100644 index 0000000..87c8c44 --- /dev/null +++ b/tests/tcg/ppc64/bcdsub.c @@ -0,0 +1,134 @@ +#include +#include +#include +#include + +#define CRF_LT (1 << 3) +#define CRF_GT (1 << 2) +#define CRF_EQ (1 << 1) +#define CRF_SO (1 << 0) +#define UNDEF 0 + +#ifdef __has_builtin +#if !__has_builtin(__builtin_bcdsub) +#define NO_BUILTIN_BCDSUB +#endif +#endif + +#ifdef NO_BUILTIN_BCDSUB +#define BCDSUB(T, A, B, PS) \ + ".long 4 << 26 | (" #T ") << 21 | (" #A ") << 16 | (" #B ") << 11" \ + " | 1 << 10 | (" #PS ") << 9 | 65\n\t" +#else +#define BCDSUB(T, A, B, PS) "bcdsub. " #T ", " #A ", " #B ", " #PS "\n\t" +#endif + +#define TEST(AH, AL, BH, BL, PS, TH, TL, CR6) \ + do { \ + int cr = 0; \ + uint64_t th, tl; \ + /* \ + * Use GPR pairs to load the VSR values and place the resulting VSR and\ + * CR6 in th, tl, and cr. Note that we avoid newer instructions (e.g., \ + * mtvsrdd/mfvsrld) so we can run this test on POWER8 machines. \ + */ \ + asm ("mtvsrd 32, %3\n\t" \ + "mtvsrd 33, %4\n\t" \ + "xxmrghd 32, 32, 33\n\t" \ + "mtvsrd 33, %5\n\t" \ + "mtvsrd 34, %6\n\t" \ + "xxmrghd 33, 33, 34\n\t" \ + BCDSUB(0, 0, 1, PS) \ + "mfocrf %0, 0b10\n\t" \ + "mfvsrd %1, 32\n\t" \ + "xxswapd 32, 32\n\t" \ + "mfvsrd %2, 32\n\t" \ + : "=r" (cr), "=r" (th), "=r" (tl) \ + : "r" (AH), "r" (AL), "r" (BH), "r" (BL) \ + : "v0", "v1", "v2"); \ + if (TH != UNDEF || TL != UNDEF) { \ + assert(tl == TL); \ + assert(th == TH); \ + } \ + assert((cr >> 4) == CR6); \ + } while (0) + +/* + * Unbounded result is equal to zero: + * sign = (PS) ? 0b1111 : 0b1100 + * CR6 = 0b0010 + */ +void test_bcdsub_eq(void) +{ + /* maximum positive BCD value */ + TEST(0x9999999999999999, 0x999999999999999c, + 0x9999999999999999, 0x999999999999999c, + 0, 0x0, 0xc, CRF_EQ); + TEST(0x9999999999999999, 0x999999999999999c, + 0x9999999999999999, 0x999999999999999c, + 1, 0x0, 0xf, CRF_EQ); +} + +/* + * Unbounded result is greater than zero: + * sign = (PS) ? 0b1111 : 0b1100 + * CR6 = (overflow) ? 0b0101 : 0b0100 + */ +void test_bcdsub_gt(void) +{ + /* maximum positive and negative one BCD values */ + TEST(0x9999999999999999, 0x999999999999999c, 0x0, 0x1d, 0, + 0x0, 0xc, (CRF_GT | CRF_SO)); + TEST(0x9999999999999999, 0x999999999999999c, 0x0, 0x1d, 1, + 0x0, 0xf, (CRF_GT | CRF_SO)); + + TEST(0x9999999999999999, 0x999999999999998c, 0x0, 0x1d, 0, + 0x9999999999999999, 0x999999999999999c, CRF_GT); + TEST(0x9999999999999999, 0x999999999999998c, 0x0, 0x1d, 1, + 0x9999999999999999, 0x999999999999999f, CRF_GT); +} + +/* + * Unbounded result is less than zero: + * sign = 0b1101 + * CR6 = (overflow) ? 0b1001 : 0b1000 + */ +void test_bcdsub_lt(void) +{ + /* positive zero and positive one BCD values */ + TEST(0x0, 0xc, 0x0, 0x1c, 0, 0x0, 0x1d, CRF_LT); + TEST(0x0, 0xc, 0x0, 0x1c, 1, 0x0, 0x1d, CRF_LT); + + /* maximum negative and positive one BCD values */ + TEST(0x9999999999999999, 0x999999999999999d, 0x0, 0x1c, 0, + 0x0, 0xd, (CRF_LT | CRF_SO)); + TEST(0x9999999999999999, 0x999999999999999d, 0x0, 0x1c, 1, + 0x0, 0xd, (CRF_LT | CRF_SO)); +} + +void test_bcdsub_invalid(void) +{ + TEST(0x0, 0x1c, 0x0, 0xf00, 0, UNDEF, UNDEF, CRF_SO); + TEST(0x0, 0x1c, 0x0, 0xf00, 1, UNDEF, UNDEF, CRF_SO); + + TEST(0x0, 0xf00, 0x0, 0x1c, 0, UNDEF, UNDEF, CRF_SO); + TEST(0x0, 0xf00, 0x0, 0x1c, 1, UNDEF, UNDEF, CRF_SO); + + TEST(0x0, 0xbad, 0x0, 0xf00, 0, UNDEF, UNDEF, CRF_SO); + TEST(0x0, 0xbad, 0x0, 0xf00, 1, UNDEF, UNDEF, CRF_SO); +} + +int main(void) +{ + struct sigaction action; + + action.sa_handler = _exit; + sigaction(SIGABRT, &action, NULL); + + test_bcdsub_eq(); + test_bcdsub_gt(); + test_bcdsub_lt(); + test_bcdsub_invalid(); + + return 0; +} diff --git a/tests/tcg/ppc64/byte_reverse.c b/tests/tcg/ppc64/byte_reverse.c new file mode 100644 index 0000000..53b76fc --- /dev/null +++ b/tests/tcg/ppc64/byte_reverse.c @@ -0,0 +1,21 @@ +#include + +int main(void) +{ + unsigned long var; + + var = 0xFEDCBA9876543210; + asm("brh %0, %0" : "+r"(var)); + assert(var == 0xDCFE98BA54761032); + + var = 0xFEDCBA9876543210; + asm("brw %0, %0" : "+r"(var)); + assert(var == 0x98BADCFE10325476); + + var = 0xFEDCBA9876543210; + asm("brd %0, %0" : "+r"(var)); + assert(var == 0x1032547698BADCFE); + + return 0; +} + diff --git a/tests/tcg/ppc64/mffsce.c b/tests/tcg/ppc64/mffsce.c new file mode 100644 index 0000000..20d882c --- /dev/null +++ b/tests/tcg/ppc64/mffsce.c @@ -0,0 +1,37 @@ +#include +#include +#include + +#define MTFSF(FLM, FRB) asm volatile ("mtfsf %0, %1" :: "i" (FLM), "f" (FRB)) +#define MFFS(FRT) asm("mffs %0" : "=f" (FRT)) +#define MFFSCE(FRT) asm("mffsce %0" : "=f" (FRT)) + +#define PPC_BIT_NR(nr) (63 - (nr)) + +#define FP_VE (1ull << PPC_BIT_NR(56)) +#define FP_UE (1ull << PPC_BIT_NR(58)) +#define FP_ZE (1ull << PPC_BIT_NR(59)) +#define FP_XE (1ull << PPC_BIT_NR(60)) +#define FP_NI (1ull << PPC_BIT_NR(61)) +#define FP_RN1 (1ull << PPC_BIT_NR(63)) + +int main(void) +{ + uint64_t frt, fpscr; + uint64_t test_value = FP_VE | FP_UE | FP_ZE | + FP_XE | FP_NI | FP_RN1; + MTFSF(0b11111111, test_value); /* set test value to cpu fpscr */ + MFFSCE(frt); + MFFS(fpscr); /* read the value that mffsce stored to cpu fpscr */ + + /* the returned value should be as the cpu fpscr was before */ + assert((frt & 0xff) == test_value); + + /* + * the cpu fpscr last 3 bits should be unchanged + * and enable bits should be unset + */ + assert((fpscr & 0xff) == (test_value & 0x7)); + + return 0; +} diff --git a/tests/tcg/ppc64/mtfsf.c b/tests/tcg/ppc64/mtfsf.c new file mode 100644 index 0000000..bed5b1a --- /dev/null +++ b/tests/tcg/ppc64/mtfsf.c @@ -0,0 +1,60 @@ +#include +#include +#include +#include +#include + +#define MTFSF(FLM, FRB) asm volatile ("mtfsf %0, %1" :: "i" (FLM), "f" (FRB)) +#define MFFS(FRT) asm("mffs %0" : "=f" (FRT)) + +#define FPSCR_VE 7 /* Floating-point invalid operation exception enable */ +#define FPSCR_VXSOFT 10 /* Floating-point invalid operation exception (soft) */ +#define FPSCR_FI 17 /* Floating-point fraction inexact */ + +#define FP_VE (1ull << FPSCR_VE) +#define FP_VXSOFT (1ull << FPSCR_VXSOFT) +#define FP_FI (1ull << FPSCR_FI) + +void sigfpe_handler(int sig, siginfo_t *si, void *ucontext) +{ + if (si->si_code == FPE_FLTINV) { + exit(0); + } + exit(1); +} + +int main(void) +{ + uint64_t fpscr; + + struct sigaction sa = { + .sa_sigaction = sigfpe_handler, + .sa_flags = SA_SIGINFO + }; + + /* + * Enable the MSR bits F0 and F1 to enable exceptions. + * This shouldn't be needed in linux-user as these bits are enabled by + * default, but this allows to execute either in a VM or a real machine + * to compare the behaviors. + */ + prctl(PR_SET_FPEXC, PR_FP_EXC_PRECISE); + + /* First test if the FI bit is being set correctly */ + MTFSF(0b11111111, FP_FI); + MFFS(fpscr); + assert((fpscr & FP_FI) != 0); + + /* Then test if the deferred exception is being called correctly */ + sigaction(SIGFPE, &sa, NULL); + + /* + * Although the VXSOFT exception has been chosen, based on test in a Power9 + * any combination of exception bit + its enabling bit should work. + * But if a different exception is chosen si_code check should + * change accordingly. + */ + MTFSF(0b11111111, FP_VE | FP_VXSOFT); + + return 1; +} diff --git a/tests/tcg/ppc64/non_signalling_xscv.c b/tests/tcg/ppc64/non_signalling_xscv.c new file mode 100644 index 0000000..836df71 --- /dev/null +++ b/tests/tcg/ppc64/non_signalling_xscv.c @@ -0,0 +1,37 @@ +#include +#include +#include +#include + +#define TEST(INSN, B_HI, B_LO, T_HI, T_LO) \ + do { \ + uint64_t th, tl, bh = B_HI, bl = B_LO; \ + asm("mtvsrd 32, %2\n\t" \ + "mtvsrd 33, %3\n\t" \ + "xxmrghd 32, 32, 33\n\t" \ + INSN " 32, 32\n\t" \ + "mfvsrd %0, 32\n\t" \ + "xxswapd 32, 32\n\t" \ + "mfvsrd %1, 32\n\t" \ + : "=r" (th), "=r" (tl) \ + : "r" (bh), "r" (bl) \ + : "v0", "v1"); \ + printf(INSN "(0x%016" PRIx64 "%016" PRIx64 ") = 0x%016" PRIx64 \ + "%016" PRIx64 "\n", bh, bl, th, tl); \ + assert(th == T_HI && tl == T_LO); \ + } while (0) + +int main(void) +{ + /* SNaN shouldn't be silenced */ + TEST("xscvspdpn", 0x7fbfffff00000000ULL, 0x0, 0x7ff7ffffe0000000ULL, 0x0); + TEST("xscvdpspn", 0x7ff7ffffffffffffULL, 0x0, 0x7fbfffff7fbfffffULL, 0x0); + + /* + * SNaN inputs having no significant bits in the upper 23 bits of the + * signifcand will return Infinity as the result. + */ + TEST("xscvdpspn", 0x7ff000001fffffffULL, 0x0, 0x7f8000007f800000ULL, 0x0); + + return 0; +} diff --git a/tests/tcg/ppc64/signal_save_restore_xer.c b/tests/tcg/ppc64/signal_save_restore_xer.c new file mode 100644 index 0000000..9227f4f --- /dev/null +++ b/tests/tcg/ppc64/signal_save_restore_xer.c @@ -0,0 +1,42 @@ +#include +#include +#include +#include + +#define XER_SO (1 << 31) +#define XER_OV (1 << 30) +#define XER_CA (1 << 29) +#define XER_OV32 (1 << 19) +#define XER_CA32 (1 << 18) + +uint64_t saved; + +void sigtrap_handler(int sig, siginfo_t *si, void *ucontext) +{ + ucontext_t *uc = ucontext; + uc->uc_mcontext.regs->nip += 4; + saved = uc->uc_mcontext.regs->xer; + uc->uc_mcontext.regs->xer |= XER_OV | XER_OV32; +} + +int main(void) +{ + uint64_t initial = XER_CA | XER_CA32, restored; + struct sigaction sa = { + .sa_sigaction = sigtrap_handler, + .sa_flags = SA_SIGINFO + }; + + sigaction(SIGTRAP, &sa, NULL); + + asm("mtspr 1, %1\n\t" + "trap\n\t" + "mfspr %0, 1\n\t" + : "=r" (restored) + : "r" (initial)); + + assert(saved == initial); + assert(restored == (XER_OV | XER_OV32 | XER_CA | XER_CA32)); + + return 0; +} diff --git a/tests/tcg/ppc64/xxspltw.c b/tests/tcg/ppc64/xxspltw.c new file mode 100644 index 0000000..4cff78b --- /dev/null +++ b/tests/tcg/ppc64/xxspltw.c @@ -0,0 +1,46 @@ +#include +#include +#include +#include + +#define WORD_A 0xAAAAAAAAUL +#define WORD_B 0xBBBBBBBBUL +#define WORD_C 0xCCCCCCCCUL +#define WORD_D 0xDDDDDDDDUL + +#define DWORD_HI (WORD_A << 32 | WORD_B) +#define DWORD_LO (WORD_C << 32 | WORD_D) + +#define TEST(HI, LO, UIM, RES) \ + do { \ + union { \ + uint64_t u; \ + double f; \ + } h = { .u = HI }, l = { .u = LO }; \ + /* \ + * Use a pair of FPRs to load the VSR avoiding insns \ + * newer than xxswapd. \ + */ \ + asm("xxmrghd 32, %0, %1\n\t" \ + "xxspltw 32, 32, %2\n\t" \ + "xxmrghd %0, 32, %0\n\t" \ + "xxswapd 32, 32\n\t" \ + "xxmrghd %1, 32, %1\n\t" \ + : "+f" (h.f), "+f" (l.f) \ + : "i" (UIM) \ + : "v0"); \ + printf("xxspltw(0x%016" PRIx64 "%016" PRIx64 ", %d) =" \ + " %016" PRIx64 "%016" PRIx64 "\n", HI, LO, UIM, \ + h.u, l.u); \ + assert(h.u == (RES)); \ + assert(l.u == (RES)); \ + } while (0) + +int main(void) +{ + TEST(DWORD_HI, DWORD_LO, 0, WORD_A << 32 | WORD_A); + TEST(DWORD_HI, DWORD_LO, 1, WORD_B << 32 | WORD_B); + TEST(DWORD_HI, DWORD_LO, 2, WORD_C << 32 | WORD_C); + TEST(DWORD_HI, DWORD_LO, 3, WORD_D << 32 | WORD_D); + return 0; +} diff --git a/tests/tcg/ppc64le/Makefile.target b/tests/tcg/ppc64le/Makefile.target index 6ca3003..daad511 100644 --- a/tests/tcg/ppc64le/Makefile.target +++ b/tests/tcg/ppc64le/Makefile.target @@ -4,28 +4,4 @@ VPATH += $(SRC_PATH)/tests/tcg/ppc64le -ifneq ($(CROSS_CC_HAS_POWER8_VECTOR),) -PPC64LE_TESTS=bcdsub non_signalling_xscv -endif -$(PPC64LE_TESTS): CFLAGS += -mpower8-vector - -ifneq ($(CROSS_CC_HAS_POWER10),) -PPC64LE_TESTS += byte_reverse sha512-vector -endif -byte_reverse: CFLAGS += -mcpu=power10 -run-byte_reverse: QEMU_OPTS+=-cpu POWER10 -run-plugin-byte_reverse-with-%: QEMU_OPTS+=-cpu POWER10 - -sha512-vector: CFLAGS +=-mcpu=power10 -O3 -sha512-vector: sha512.c - $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) - -run-sha512-vector: QEMU_OPTS+=-cpu POWER10 -run-plugin-sha512-vector-with-%: QEMU_OPTS+=-cpu POWER10 - -PPC64LE_TESTS += mtfsf -PPC64LE_TESTS += mffsce -PPC64LE_TESTS += signal_save_restore_xer -PPC64LE_TESTS += xxspltw - -TESTS += $(PPC64LE_TESTS) +include $(SRC_PATH)/tests/tcg/ppc64/Makefile.target diff --git a/tests/tcg/ppc64le/bcdsub.c b/tests/tcg/ppc64le/bcdsub.c deleted file mode 100644 index 87c8c44..0000000 --- a/tests/tcg/ppc64le/bcdsub.c +++ /dev/null @@ -1,134 +0,0 @@ -#include -#include -#include -#include - -#define CRF_LT (1 << 3) -#define CRF_GT (1 << 2) -#define CRF_EQ (1 << 1) -#define CRF_SO (1 << 0) -#define UNDEF 0 - -#ifdef __has_builtin -#if !__has_builtin(__builtin_bcdsub) -#define NO_BUILTIN_BCDSUB -#endif -#endif - -#ifdef NO_BUILTIN_BCDSUB -#define BCDSUB(T, A, B, PS) \ - ".long 4 << 26 | (" #T ") << 21 | (" #A ") << 16 | (" #B ") << 11" \ - " | 1 << 10 | (" #PS ") << 9 | 65\n\t" -#else -#define BCDSUB(T, A, B, PS) "bcdsub. " #T ", " #A ", " #B ", " #PS "\n\t" -#endif - -#define TEST(AH, AL, BH, BL, PS, TH, TL, CR6) \ - do { \ - int cr = 0; \ - uint64_t th, tl; \ - /* \ - * Use GPR pairs to load the VSR values and place the resulting VSR and\ - * CR6 in th, tl, and cr. Note that we avoid newer instructions (e.g., \ - * mtvsrdd/mfvsrld) so we can run this test on POWER8 machines. \ - */ \ - asm ("mtvsrd 32, %3\n\t" \ - "mtvsrd 33, %4\n\t" \ - "xxmrghd 32, 32, 33\n\t" \ - "mtvsrd 33, %5\n\t" \ - "mtvsrd 34, %6\n\t" \ - "xxmrghd 33, 33, 34\n\t" \ - BCDSUB(0, 0, 1, PS) \ - "mfocrf %0, 0b10\n\t" \ - "mfvsrd %1, 32\n\t" \ - "xxswapd 32, 32\n\t" \ - "mfvsrd %2, 32\n\t" \ - : "=r" (cr), "=r" (th), "=r" (tl) \ - : "r" (AH), "r" (AL), "r" (BH), "r" (BL) \ - : "v0", "v1", "v2"); \ - if (TH != UNDEF || TL != UNDEF) { \ - assert(tl == TL); \ - assert(th == TH); \ - } \ - assert((cr >> 4) == CR6); \ - } while (0) - -/* - * Unbounded result is equal to zero: - * sign = (PS) ? 0b1111 : 0b1100 - * CR6 = 0b0010 - */ -void test_bcdsub_eq(void) -{ - /* maximum positive BCD value */ - TEST(0x9999999999999999, 0x999999999999999c, - 0x9999999999999999, 0x999999999999999c, - 0, 0x0, 0xc, CRF_EQ); - TEST(0x9999999999999999, 0x999999999999999c, - 0x9999999999999999, 0x999999999999999c, - 1, 0x0, 0xf, CRF_EQ); -} - -/* - * Unbounded result is greater than zero: - * sign = (PS) ? 0b1111 : 0b1100 - * CR6 = (overflow) ? 0b0101 : 0b0100 - */ -void test_bcdsub_gt(void) -{ - /* maximum positive and negative one BCD values */ - TEST(0x9999999999999999, 0x999999999999999c, 0x0, 0x1d, 0, - 0x0, 0xc, (CRF_GT | CRF_SO)); - TEST(0x9999999999999999, 0x999999999999999c, 0x0, 0x1d, 1, - 0x0, 0xf, (CRF_GT | CRF_SO)); - - TEST(0x9999999999999999, 0x999999999999998c, 0x0, 0x1d, 0, - 0x9999999999999999, 0x999999999999999c, CRF_GT); - TEST(0x9999999999999999, 0x999999999999998c, 0x0, 0x1d, 1, - 0x9999999999999999, 0x999999999999999f, CRF_GT); -} - -/* - * Unbounded result is less than zero: - * sign = 0b1101 - * CR6 = (overflow) ? 0b1001 : 0b1000 - */ -void test_bcdsub_lt(void) -{ - /* positive zero and positive one BCD values */ - TEST(0x0, 0xc, 0x0, 0x1c, 0, 0x0, 0x1d, CRF_LT); - TEST(0x0, 0xc, 0x0, 0x1c, 1, 0x0, 0x1d, CRF_LT); - - /* maximum negative and positive one BCD values */ - TEST(0x9999999999999999, 0x999999999999999d, 0x0, 0x1c, 0, - 0x0, 0xd, (CRF_LT | CRF_SO)); - TEST(0x9999999999999999, 0x999999999999999d, 0x0, 0x1c, 1, - 0x0, 0xd, (CRF_LT | CRF_SO)); -} - -void test_bcdsub_invalid(void) -{ - TEST(0x0, 0x1c, 0x0, 0xf00, 0, UNDEF, UNDEF, CRF_SO); - TEST(0x0, 0x1c, 0x0, 0xf00, 1, UNDEF, UNDEF, CRF_SO); - - TEST(0x0, 0xf00, 0x0, 0x1c, 0, UNDEF, UNDEF, CRF_SO); - TEST(0x0, 0xf00, 0x0, 0x1c, 1, UNDEF, UNDEF, CRF_SO); - - TEST(0x0, 0xbad, 0x0, 0xf00, 0, UNDEF, UNDEF, CRF_SO); - TEST(0x0, 0xbad, 0x0, 0xf00, 1, UNDEF, UNDEF, CRF_SO); -} - -int main(void) -{ - struct sigaction action; - - action.sa_handler = _exit; - sigaction(SIGABRT, &action, NULL); - - test_bcdsub_eq(); - test_bcdsub_gt(); - test_bcdsub_lt(); - test_bcdsub_invalid(); - - return 0; -} diff --git a/tests/tcg/ppc64le/byte_reverse.c b/tests/tcg/ppc64le/byte_reverse.c deleted file mode 100644 index 53b76fc..0000000 --- a/tests/tcg/ppc64le/byte_reverse.c +++ /dev/null @@ -1,21 +0,0 @@ -#include - -int main(void) -{ - unsigned long var; - - var = 0xFEDCBA9876543210; - asm("brh %0, %0" : "+r"(var)); - assert(var == 0xDCFE98BA54761032); - - var = 0xFEDCBA9876543210; - asm("brw %0, %0" : "+r"(var)); - assert(var == 0x98BADCFE10325476); - - var = 0xFEDCBA9876543210; - asm("brd %0, %0" : "+r"(var)); - assert(var == 0x1032547698BADCFE); - - return 0; -} - diff --git a/tests/tcg/ppc64le/mffsce.c b/tests/tcg/ppc64le/mffsce.c deleted file mode 100644 index 20d882c..0000000 --- a/tests/tcg/ppc64le/mffsce.c +++ /dev/null @@ -1,37 +0,0 @@ -#include -#include -#include - -#define MTFSF(FLM, FRB) asm volatile ("mtfsf %0, %1" :: "i" (FLM), "f" (FRB)) -#define MFFS(FRT) asm("mffs %0" : "=f" (FRT)) -#define MFFSCE(FRT) asm("mffsce %0" : "=f" (FRT)) - -#define PPC_BIT_NR(nr) (63 - (nr)) - -#define FP_VE (1ull << PPC_BIT_NR(56)) -#define FP_UE (1ull << PPC_BIT_NR(58)) -#define FP_ZE (1ull << PPC_BIT_NR(59)) -#define FP_XE (1ull << PPC_BIT_NR(60)) -#define FP_NI (1ull << PPC_BIT_NR(61)) -#define FP_RN1 (1ull << PPC_BIT_NR(63)) - -int main(void) -{ - uint64_t frt, fpscr; - uint64_t test_value = FP_VE | FP_UE | FP_ZE | - FP_XE | FP_NI | FP_RN1; - MTFSF(0b11111111, test_value); /* set test value to cpu fpscr */ - MFFSCE(frt); - MFFS(fpscr); /* read the value that mffsce stored to cpu fpscr */ - - /* the returned value should be as the cpu fpscr was before */ - assert((frt & 0xff) == test_value); - - /* - * the cpu fpscr last 3 bits should be unchanged - * and enable bits should be unset - */ - assert((fpscr & 0xff) == (test_value & 0x7)); - - return 0; -} diff --git a/tests/tcg/ppc64le/mtfsf.c b/tests/tcg/ppc64le/mtfsf.c deleted file mode 100644 index bed5b1a..0000000 --- a/tests/tcg/ppc64le/mtfsf.c +++ /dev/null @@ -1,60 +0,0 @@ -#include -#include -#include -#include -#include - -#define MTFSF(FLM, FRB) asm volatile ("mtfsf %0, %1" :: "i" (FLM), "f" (FRB)) -#define MFFS(FRT) asm("mffs %0" : "=f" (FRT)) - -#define FPSCR_VE 7 /* Floating-point invalid operation exception enable */ -#define FPSCR_VXSOFT 10 /* Floating-point invalid operation exception (soft) */ -#define FPSCR_FI 17 /* Floating-point fraction inexact */ - -#define FP_VE (1ull << FPSCR_VE) -#define FP_VXSOFT (1ull << FPSCR_VXSOFT) -#define FP_FI (1ull << FPSCR_FI) - -void sigfpe_handler(int sig, siginfo_t *si, void *ucontext) -{ - if (si->si_code == FPE_FLTINV) { - exit(0); - } - exit(1); -} - -int main(void) -{ - uint64_t fpscr; - - struct sigaction sa = { - .sa_sigaction = sigfpe_handler, - .sa_flags = SA_SIGINFO - }; - - /* - * Enable the MSR bits F0 and F1 to enable exceptions. - * This shouldn't be needed in linux-user as these bits are enabled by - * default, but this allows to execute either in a VM or a real machine - * to compare the behaviors. - */ - prctl(PR_SET_FPEXC, PR_FP_EXC_PRECISE); - - /* First test if the FI bit is being set correctly */ - MTFSF(0b11111111, FP_FI); - MFFS(fpscr); - assert((fpscr & FP_FI) != 0); - - /* Then test if the deferred exception is being called correctly */ - sigaction(SIGFPE, &sa, NULL); - - /* - * Although the VXSOFT exception has been chosen, based on test in a Power9 - * any combination of exception bit + its enabling bit should work. - * But if a different exception is chosen si_code check should - * change accordingly. - */ - MTFSF(0b11111111, FP_VE | FP_VXSOFT); - - return 1; -} diff --git a/tests/tcg/ppc64le/non_signalling_xscv.c b/tests/tcg/ppc64le/non_signalling_xscv.c deleted file mode 100644 index 836df71..0000000 --- a/tests/tcg/ppc64le/non_signalling_xscv.c +++ /dev/null @@ -1,37 +0,0 @@ -#include -#include -#include -#include - -#define TEST(INSN, B_HI, B_LO, T_HI, T_LO) \ - do { \ - uint64_t th, tl, bh = B_HI, bl = B_LO; \ - asm("mtvsrd 32, %2\n\t" \ - "mtvsrd 33, %3\n\t" \ - "xxmrghd 32, 32, 33\n\t" \ - INSN " 32, 32\n\t" \ - "mfvsrd %0, 32\n\t" \ - "xxswapd 32, 32\n\t" \ - "mfvsrd %1, 32\n\t" \ - : "=r" (th), "=r" (tl) \ - : "r" (bh), "r" (bl) \ - : "v0", "v1"); \ - printf(INSN "(0x%016" PRIx64 "%016" PRIx64 ") = 0x%016" PRIx64 \ - "%016" PRIx64 "\n", bh, bl, th, tl); \ - assert(th == T_HI && tl == T_LO); \ - } while (0) - -int main(void) -{ - /* SNaN shouldn't be silenced */ - TEST("xscvspdpn", 0x7fbfffff00000000ULL, 0x0, 0x7ff7ffffe0000000ULL, 0x0); - TEST("xscvdpspn", 0x7ff7ffffffffffffULL, 0x0, 0x7fbfffff7fbfffffULL, 0x0); - - /* - * SNaN inputs having no significant bits in the upper 23 bits of the - * signifcand will return Infinity as the result. - */ - TEST("xscvdpspn", 0x7ff000001fffffffULL, 0x0, 0x7f8000007f800000ULL, 0x0); - - return 0; -} diff --git a/tests/tcg/ppc64le/signal_save_restore_xer.c b/tests/tcg/ppc64le/signal_save_restore_xer.c deleted file mode 100644 index 9227f4f..0000000 --- a/tests/tcg/ppc64le/signal_save_restore_xer.c +++ /dev/null @@ -1,42 +0,0 @@ -#include -#include -#include -#include - -#define XER_SO (1 << 31) -#define XER_OV (1 << 30) -#define XER_CA (1 << 29) -#define XER_OV32 (1 << 19) -#define XER_CA32 (1 << 18) - -uint64_t saved; - -void sigtrap_handler(int sig, siginfo_t *si, void *ucontext) -{ - ucontext_t *uc = ucontext; - uc->uc_mcontext.regs->nip += 4; - saved = uc->uc_mcontext.regs->xer; - uc->uc_mcontext.regs->xer |= XER_OV | XER_OV32; -} - -int main(void) -{ - uint64_t initial = XER_CA | XER_CA32, restored; - struct sigaction sa = { - .sa_sigaction = sigtrap_handler, - .sa_flags = SA_SIGINFO - }; - - sigaction(SIGTRAP, &sa, NULL); - - asm("mtspr 1, %1\n\t" - "trap\n\t" - "mfspr %0, 1\n\t" - : "=r" (restored) - : "r" (initial)); - - assert(saved == initial); - assert(restored == (XER_OV | XER_OV32 | XER_CA | XER_CA32)); - - return 0; -} diff --git a/tests/tcg/ppc64le/xxspltw.c b/tests/tcg/ppc64le/xxspltw.c deleted file mode 100644 index 4cff78b..0000000 --- a/tests/tcg/ppc64le/xxspltw.c +++ /dev/null @@ -1,46 +0,0 @@ -#include -#include -#include -#include - -#define WORD_A 0xAAAAAAAAUL -#define WORD_B 0xBBBBBBBBUL -#define WORD_C 0xCCCCCCCCUL -#define WORD_D 0xDDDDDDDDUL - -#define DWORD_HI (WORD_A << 32 | WORD_B) -#define DWORD_LO (WORD_C << 32 | WORD_D) - -#define TEST(HI, LO, UIM, RES) \ - do { \ - union { \ - uint64_t u; \ - double f; \ - } h = { .u = HI }, l = { .u = LO }; \ - /* \ - * Use a pair of FPRs to load the VSR avoiding insns \ - * newer than xxswapd. \ - */ \ - asm("xxmrghd 32, %0, %1\n\t" \ - "xxspltw 32, 32, %2\n\t" \ - "xxmrghd %0, 32, %0\n\t" \ - "xxswapd 32, 32\n\t" \ - "xxmrghd %1, 32, %1\n\t" \ - : "+f" (h.f), "+f" (l.f) \ - : "i" (UIM) \ - : "v0"); \ - printf("xxspltw(0x%016" PRIx64 "%016" PRIx64 ", %d) =" \ - " %016" PRIx64 "%016" PRIx64 "\n", HI, LO, UIM, \ - h.u, l.u); \ - assert(h.u == (RES)); \ - assert(l.u == (RES)); \ - } while (0) - -int main(void) -{ - TEST(DWORD_HI, DWORD_LO, 0, WORD_A << 32 | WORD_A); - TEST(DWORD_HI, DWORD_LO, 1, WORD_B << 32 | WORD_B); - TEST(DWORD_HI, DWORD_LO, 2, WORD_C << 32 | WORD_C); - TEST(DWORD_HI, DWORD_LO, 3, WORD_D << 32 | WORD_D); - return 0; -} -- cgit v1.1 From c6cf8a20521c7114893042cb7c75866bd07838ae Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 29 Sep 2022 12:42:03 +0100 Subject: tests/tcg: clean up calls to run-test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Almost all invocations of run-test have either "$* on $(TARGET_NAME)" or "$< on $(TARGET_NAME)" as the last argument. So provide a default test name, while allowing an escape hatch for custom names. As an additional simplification, remove the need to do shell quoting. Signed-off-by: Paolo Bonzini Signed-off-by: Alex Bennée Message-Id: <20220929114231.583801-24-alex.bennee@linaro.org> --- tests/tcg/Makefile.target | 21 ++++++++++----------- tests/tcg/aarch64/Makefile.softmmu-target | 6 ++---- tests/tcg/aarch64/Makefile.target | 6 +++--- tests/tcg/arm/Makefile.target | 9 ++++----- tests/tcg/cris/Makefile.target | 2 +- tests/tcg/i386/Makefile.softmmu-target | 3 +-- tests/tcg/i386/Makefile.target | 5 ++--- tests/tcg/multiarch/Makefile.target | 18 ++++++++---------- tests/tcg/multiarch/system/Makefile.softmmu-target | 2 +- tests/tcg/s390x/Makefile.target | 2 +- tests/tcg/x86_64/Makefile.softmmu-target | 3 +-- 11 files changed, 34 insertions(+), 43 deletions(-) (limited to 'tests') diff --git a/tests/tcg/Makefile.target b/tests/tcg/Makefile.target index c14eca8..cd0a2ad 100644 --- a/tests/tcg/Makefile.target +++ b/tests/tcg/Makefile.target @@ -41,14 +41,16 @@ endif # for including , in command strings COMMA := , -quiet-command = $(if $(V),$1,$(if $(2),@printf " %-7s %s\n" $2 $3 && $1, @$1)) +quiet-@ = $(if $(V),,@$(if $1,printf " %-7s %s\n" "$(strip $1)" "$(strip $2)" && )) +quiet-command = $(call quiet-@,$2,$3)$1 # $1 = test name, $2 = cmd, $3 = desc ifeq ($(filter %-softmmu, $(TARGET)),) run-test = $(call quiet-command, timeout --foreground $(TIMEOUT) $2 > $1.out, \ - "TEST",$3) + TEST,$(or $3, $*, $<) on $(TARGET_NAME)) else -run-test = $(call quiet-command, timeout --foreground $(TIMEOUT) $2,"TEST",$3) +run-test = $(call quiet-command, timeout --foreground $(TIMEOUT) $2, \ + TEST,$(or $3, $*, $<) on $(TARGET_NAME)) endif # $1 = test name, $2 = reference @@ -56,7 +58,7 @@ endif # we know it failed and then force failure at the end. diff-out = $(call quiet-command, diff -q $1.out $2 || \ (diff -u $1.out $2 | head -n 10 && false), \ - "DIFF","$1.out with $2") + DIFF,$1.out with $2) # $1 = test name, $2 = reason skip-test = @printf " SKIPPED %s on $(TARGET_NAME) because %s\n" $1 $2 @@ -155,21 +157,19 @@ RUN_TESTS+=$(EXTRA_RUNS) ifeq ($(filter %-softmmu, $(TARGET)),) run-%: % - $(call run-test, $<, $(QEMU) $(QEMU_OPTS) $<, "$< on $(TARGET_NAME)") + $(call run-test, $<, $(QEMU) $(QEMU_OPTS) $<) run-plugin-%: $(call run-test, $@, $(QEMU) $(QEMU_OPTS) \ -plugin $(PLUGIN_LIB)/$(call extract-plugin,$@) \ -d plugin -D $*.pout \ - $(call strip-plugin,$<), \ - "$* on $(TARGET_NAME)") + $(call strip-plugin,$<)) else run-%: % $(call run-test, $<, \ $(QEMU) -monitor none -display none \ -chardev file$(COMMA)path=$<.out$(COMMA)id=output \ - $(QEMU_OPTS) $<, \ - "$< on $(TARGET_NAME)") + $(QEMU_OPTS) $<) run-plugin-%: $(call run-test, $@, \ @@ -177,8 +177,7 @@ run-plugin-%: -chardev file$(COMMA)path=$@.out$(COMMA)id=output \ -plugin $(PLUGIN_LIB)/$(call extract-plugin,$@) \ -d plugin -D $*.pout \ - $(QEMU_OPTS) $(call strip-plugin,$<), \ - "$* on $(TARGET_NAME)") + $(QEMU_OPTS) $(call strip-plugin,$<)) endif gdb-%: % diff --git a/tests/tcg/aarch64/Makefile.softmmu-target b/tests/tcg/aarch64/Makefile.softmmu-target index f6fcd48..84a9990 100644 --- a/tests/tcg/aarch64/Makefile.softmmu-target +++ b/tests/tcg/aarch64/Makefile.softmmu-target @@ -50,8 +50,7 @@ run-memory-record: memory-record memory $(QEMU) -monitor none -display none \ -chardev file$(COMMA)path=$<.out$(COMMA)id=output \ -icount shift=5$(COMMA)rr=record$(COMMA)rrfile=record.bin \ - $(QEMU_OPTS) memory, \ - "$< on $(TARGET_NAME)") + $(QEMU_OPTS) memory) .PHONY: memory-replay run-memory-replay: memory-replay run-memory-record @@ -59,8 +58,7 @@ run-memory-replay: memory-replay run-memory-record $(QEMU) -monitor none -display none \ -chardev file$(COMMA)path=$<.out$(COMMA)id=output \ -icount shift=5$(COMMA)rr=replay$(COMMA)rrfile=record.bin \ - $(QEMU_OPTS) memory, \ - "$< on $(TARGET_NAME)") + $(QEMU_OPTS) memory) EXTRA_RUNS+=run-memory-replay diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target index d6a74d2..9837a80 100644 --- a/tests/tcg/aarch64/Makefile.target +++ b/tests/tcg/aarch64/Makefile.target @@ -55,7 +55,7 @@ sha1-vector: CFLAGS=-O3 sha1-vector: sha1.c $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) run-sha1-vector: sha1-vector run-sha1 - $(call run-test, $<, $(QEMU) $(QEMU_OPTS) $<, "$< on $(TARGET_NAME)") + $(call run-test, $<, $(QEMU) $(QEMU_OPTS) $<) $(call diff-out, sha1-vector, sha1.out) TESTS += sha1-vector @@ -75,14 +75,14 @@ run-gdbstub-sysregs: sysregs --gdb $(HAVE_GDB_BIN) \ --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ --bin $< --test $(AARCH64_SRC)/gdbstub/test-sve.py, \ - "basic gdbstub SVE support") + basic gdbstub SVE support) run-gdbstub-sve-ioctls: sve-ioctls $(call run-test, $@, $(GDB_SCRIPT) \ --gdb $(HAVE_GDB_BIN) \ --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ --bin $< --test $(AARCH64_SRC)/gdbstub/test-sve-ioctl.py, \ - "basic gdbstub SVE ZLEN support") + basic gdbstub SVE ZLEN support) EXTRA_RUNS += run-gdbstub-sysregs run-gdbstub-sve-ioctls endif diff --git a/tests/tcg/arm/Makefile.target b/tests/tcg/arm/Makefile.target index 2f81512..b3b1504 100644 --- a/tests/tcg/arm/Makefile.target +++ b/tests/tcg/arm/Makefile.target @@ -26,7 +26,7 @@ ARM_TESTS += fcvt fcvt: LDFLAGS+=-lm # fcvt: CFLAGS+=-march=armv8.2-a+fp16 -mfpu=neon-fp-armv8 run-fcvt: fcvt - $(call run-test,fcvt,$(QEMU) $<,"$< on $(TARGET_NAME)") + $(call run-test,fcvt,$(QEMU) $<) $(call diff-out,fcvt,$(ARM_SRC)/fcvt.ref) # PC alignment test @@ -44,13 +44,12 @@ semihosting-arm: semihosting.c $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) run-semihosting-arm: semihosting-arm - $(call run-test,$<,$(QEMU) $< 2> $<.err, "$< on $(TARGET_NAME)") + $(call run-test,$<,$(QEMU) $< 2> $<.err) run-plugin-semihosting-arm-with-%: $(call run-test, $@, $(QEMU) $(QEMU_OPTS) \ -plugin $(PLUGIN_LIB)/$(call extract-plugin,$@) \ - $(call strip-plugin,$<) 2> $<.err, \ - "$< on $(TARGET_NAME) with $*") + $(call strip-plugin,$<) 2> $<.err) ARM_TESTS += semiconsole-arm @@ -75,7 +74,7 @@ sha1-vector: CFLAGS=-O3 sha1-vector: sha1.c $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) run-sha1-vector: sha1-vector run-sha1 - $(call run-test, $<, $(QEMU) $(QEMU_OPTS) $<, "$< on $(TARGET_NAME)") + $(call run-test, $<, $(QEMU) $(QEMU_OPTS) $<) $(call diff-out, sha1-vector, sha1.out) ARM_TESTS += sha1-vector diff --git a/tests/tcg/cris/Makefile.target b/tests/tcg/cris/Makefile.target index e72d3cb..372287b 100644 --- a/tests/tcg/cris/Makefile.target +++ b/tests/tcg/cris/Makefile.target @@ -56,4 +56,4 @@ 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") + $(call run-test, $<, $(SIMG) $<) diff --git a/tests/tcg/i386/Makefile.softmmu-target b/tests/tcg/i386/Makefile.softmmu-target index 9b9038d..ed922d5 100644 --- a/tests/tcg/i386/Makefile.softmmu-target +++ b/tests/tcg/i386/Makefile.softmmu-target @@ -40,8 +40,7 @@ run-plugin-%-with-libinsn.so: -chardev file$(COMMA)path=$@.out$(COMMA)id=output \ -plugin ../../plugin/libinsn.so$(COMMA)inline=on \ -d plugin -D $*-with-libinsn.so.pout \ - $(QEMU_OPTS) $*, \ - "$* on $(TARGET_NAME)") + $(QEMU_OPTS) $*) # Running QEMU_OPTS+=-device isa-debugcon,chardev=output -device isa-debug-exit,iobase=0xf4,iosize=0x4 -kernel diff --git a/tests/tcg/i386/Makefile.target b/tests/tcg/i386/Makefile.target index 599f192..8af066e 100644 --- a/tests/tcg/i386/Makefile.target +++ b/tests/tcg/i386/Makefile.target @@ -53,7 +53,7 @@ test-i386-fprem.ref: test-i386-fprem run-test-i386-fprem: TIMEOUT=60 run-test-i386-fprem: test-i386-fprem test-i386-fprem.ref - $(call run-test,test-i386-fprem, $(QEMU) $<,"$< on $(TARGET_NAME)") + $(call run-test,test-i386-fprem, $(QEMU) $<) $(call diff-out,test-i386-fprem, test-i386-fprem.ref) else SKIP_I386_TESTS+=test-i386-fprem @@ -63,8 +63,7 @@ endif run-plugin-%-with-libinsn.so: $(call run-test, $@, $(QEMU) $(QEMU_OPTS) \ -plugin ../../plugin/libinsn.so$(COMMA)inline=on \ - -d plugin -D $*-with-libinsn.so.pout $*, \ - "$* (inline) on $(TARGET_NAME)") + -d plugin -D $*-with-libinsn.so.pout $*) # Update TESTS I386_TESTS:=$(filter-out $(SKIP_I386_TESTS), $(ALL_X86_TESTS)) diff --git a/tests/tcg/multiarch/Makefile.target b/tests/tcg/multiarch/Makefile.target index 6bba523..78104f9 100644 --- a/tests/tcg/multiarch/Makefile.target +++ b/tests/tcg/multiarch/Makefile.target @@ -26,7 +26,7 @@ float_%: float_%.c libs/float_helpers.c $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< $(MULTIARCH_SRC)/libs/float_helpers.c -o $@ $(LDFLAGS) run-float_%: float_% - $(call run-test,$<, $(QEMU) $(QEMU_OPTS) $<,"$< on $(TARGET_NAME)") + $(call run-test,$<, $(QEMU) $(QEMU_OPTS) $<) $(call conditional-diff-out,$<,$(SRC_PATH)/tests/tcg/$(TARGET_NAME)/$<.ref) @@ -42,13 +42,11 @@ signals: LDFLAGS+=-lrt -lpthread # default case (host page size) run-test-mmap: test-mmap - $(call run-test, test-mmap, $(QEMU) $<, \ - "$< (default) on $(TARGET_NAME)") + $(call run-test, test-mmap, $(QEMU) $<, $< (default)) # additional page sizes (defined by each architecture adding to EXTRA_RUNS) run-test-mmap-%: test-mmap - $(call run-test, test-mmap-$*, $(QEMU) -p $* $<,\ - "$< ($* byte pages) on $(TARGET_NAME)") + $(call run-test, test-mmap-$*, $(QEMU) -p $* $<, $< ($* byte pages)) ifneq ($(HAVE_GDB_BIN),) GDB_SCRIPT=$(SRC_PATH)/tests/guest-debug/run-test.py @@ -58,21 +56,21 @@ run-gdbstub-sha1: sha1 --gdb $(HAVE_GDB_BIN) \ --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ --bin $< --test $(MULTIARCH_SRC)/gdbstub/sha1.py, \ - "basic gdbstub support") + basic gdbstub support) run-gdbstub-qxfer-auxv-read: sha1 $(call run-test, $@, $(GDB_SCRIPT) \ --gdb $(HAVE_GDB_BIN) \ --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ --bin $< --test $(MULTIARCH_SRC)/gdbstub/test-qxfer-auxv-read.py, \ - "basic gdbstub qXfer:auxv:read support") + basic gdbstub qXfer:auxv:read support) run-gdbstub-thread-breakpoint: testthread $(call run-test, $@, $(GDB_SCRIPT) \ --gdb $(HAVE_GDB_BIN) \ --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ --bin $< --test $(MULTIARCH_SRC)/gdbstub/test-thread-breakpoint.py, \ - "hitting a breakpoint on non-main thread") + hitting a breakpoint on non-main thread) else run-gdbstub-%: @@ -94,13 +92,13 @@ VPATH += $(MULTIARCH_SRC)/arm-compat-semi semihosting: CFLAGS+=-I$(SRC_PATH)/tests/tcg/$(TARGET_NAME) run-semihosting: semihosting - $(call run-test,$<,$(QEMU) $< 2> $<.err, "$< on $(TARGET_NAME)") + $(call run-test,$<,$(QEMU) $< 2> $<.err) run-plugin-semihosting-with-%: $(call run-test, $@, $(QEMU) $(QEMU_OPTS) \ -plugin $(PLUGIN_LIB)/$(call extract-plugin,$@) \ $(call strip-plugin,$<) 2> $<.err, \ - "$< on $(TARGET_NAME) with $*") + $< with $*) semiconsole: CFLAGS+=-I$(SRC_PATH)/tests/tcg/$(TARGET_NAME) diff --git a/tests/tcg/multiarch/system/Makefile.softmmu-target b/tests/tcg/multiarch/system/Makefile.softmmu-target index 625ed79..368b64d 100644 --- a/tests/tcg/multiarch/system/Makefile.softmmu-target +++ b/tests/tcg/multiarch/system/Makefile.softmmu-target @@ -25,7 +25,7 @@ run-gdbstub-memory: memory --qargs \ "-monitor none -display none -chardev file$(COMMA)path=$<.out$(COMMA)id=output $(QEMU_OPTS)" \ --bin $< --test $(MULTIARCH_SRC)/gdbstub/memory.py, \ - "softmmu gdbstub support") + softmmu gdbstub support) else run-gdbstub-%: diff --git a/tests/tcg/s390x/Makefile.target b/tests/tcg/s390x/Makefile.target index 5e13a41..c830313 100644 --- a/tests/tcg/s390x/Makefile.target +++ b/tests/tcg/s390x/Makefile.target @@ -41,7 +41,7 @@ run-gdbstub-signals-s390x: signals-s390x --gdb $(HAVE_GDB_BIN) \ --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ --bin $< --test $(S390X_SRC)/gdbstub/test-signals-s390x.py, \ - "mixing signals and debugging on s390x") + mixing signals and debugging) EXTRA_RUNS += run-gdbstub-signals-s390x endif diff --git a/tests/tcg/x86_64/Makefile.softmmu-target b/tests/tcg/x86_64/Makefile.softmmu-target index 2afa329..7207fee 100644 --- a/tests/tcg/x86_64/Makefile.softmmu-target +++ b/tests/tcg/x86_64/Makefile.softmmu-target @@ -40,8 +40,7 @@ run-plugin-%-with-libinsn.so: -chardev file$(COMMA)path=$@.out$(COMMA)id=output \ -plugin ../../plugin/libinsn.so$(COMMA)inline=on \ -d plugin -D $*-with-libinsn.so.pout \ - $(QEMU_OPTS) $*, \ - "$* on $(TARGET_NAME)") + $(QEMU_OPTS) $*) # Running QEMU_OPTS+=-device isa-debugcon,chardev=output -device isa-debug-exit,iobase=0xf4,iosize=0x4 -kernel -- cgit v1.1 From 15b273f8e6a4740768fba3878a346c82ef48a966 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 29 Sep 2022 12:42:04 +0100 Subject: tests/tcg: move compiler tests to Makefiles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Further decoupling of tests/tcg from the main QEMU Makefile, and making the build more similar between the cross compiler case and the vetted container images. Signed-off-by: Paolo Bonzini Signed-off-by: Alex Bennée Message-Id: <20220929114231.583801-25-alex.bennee@linaro.org> --- tests/tcg/Makefile.target | 10 +++++++++- tests/tcg/aarch64/Makefile.softmmu-target | 5 +++++ tests/tcg/aarch64/Makefile.target | 9 +++++++++ tests/tcg/i386/Makefile.target | 6 ++++++ tests/tcg/ppc64/Makefile.target | 7 +++++++ 5 files changed, 36 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/tcg/Makefile.target b/tests/tcg/Makefile.target index cd0a2ad..75257f2 100644 --- a/tests/tcg/Makefile.target +++ b/tests/tcg/Makefile.target @@ -40,10 +40,18 @@ endif # for including , in command strings COMMA := , +NULL := +SPACE := $(NULL) # +TARGET_PREFIX=tests/tcg/$(TARGET):$(SPACE) quiet-@ = $(if $(V),,@$(if $1,printf " %-7s %s\n" "$(strip $1)" "$(strip $2)" && )) quiet-command = $(call quiet-@,$2,$3)$1 +cc-test = $(CC) -Werror $1 -c -o /dev/null -xc /dev/null >/dev/null 2>&1 +cc-option = if $(call cc-test, $1); then \ + echo "$(TARGET_PREFIX)$1 detected" && echo "$(strip $2)=y" >&3; else \ + echo "$(TARGET_PREFIX)$1 not detected"; fi + # $1 = test name, $2 = cmd, $3 = desc ifeq ($(filter %-softmmu, $(TARGET)),) run-test = $(call quiet-command, timeout --foreground $(TIMEOUT) $2 > $1.out, \ @@ -190,4 +198,4 @@ clean: rm -f $(TESTS) *.o $(CLEANFILES) distclean: - rm -f config-target.mak ../config-$(TARGET).mak + rm -f config-cc.mak config-target.mak ../config-$(TARGET).mak diff --git a/tests/tcg/aarch64/Makefile.softmmu-target b/tests/tcg/aarch64/Makefile.softmmu-target index 84a9990..a136890 100644 --- a/tests/tcg/aarch64/Makefile.softmmu-target +++ b/tests/tcg/aarch64/Makefile.softmmu-target @@ -19,6 +19,11 @@ EXTRA_RUNS+=$(MULTIARCH_RUNS) CFLAGS+=-nostdlib -ggdb -O0 $(MINILIB_INC) LDFLAGS+=-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) -lgcc +config-cc.mak: Makefile + $(quiet-@)( \ + $(call cc-option,-march=armv8.3-a, CROSS_CC_HAS_ARMV8_3)) 3> config-cc.mak +-include config-cc.mak + # building head blobs .PRECIOUS: $(CRT_OBJS) diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target index 9837a80..fc8d90e 100644 --- a/tests/tcg/aarch64/Makefile.target +++ b/tests/tcg/aarch64/Makefile.target @@ -17,6 +17,15 @@ run-fcvt: fcvt $(call run-test,$<,$(QEMU) $<, "$< on $(TARGET_NAME)") $(call diff-out,$<,$(AARCH64_SRC)/fcvt.ref) +config-cc.mak: Makefile + $(quiet-@)( \ + $(call cc-option,-march=armv8.1-a+sve, CROSS_CC_HAS_SVE); \ + $(call cc-option,-march=armv8.1-a+sve2, CROSS_CC_HAS_SVE2); \ + $(call cc-option,-march=armv8.3-a, CROSS_CC_HAS_ARMV8_3); \ + $(call cc-option,-mbranch-protection=standard, CROSS_CC_HAS_ARMV8_BTI); \ + $(call cc-option,-march=armv8.5-a+memtag, CROSS_CC_HAS_ARMV8_MTE)) 3> config-cc.mak +-include config-cc.mak + # Pauth Tests ifneq ($(CROSS_CC_HAS_ARMV8_3),) AARCH64_TESTS += pauth-1 pauth-2 pauth-4 pauth-5 diff --git a/tests/tcg/i386/Makefile.target b/tests/tcg/i386/Makefile.target index 8af066e..3273aa8 100644 --- a/tests/tcg/i386/Makefile.target +++ b/tests/tcg/i386/Makefile.target @@ -5,6 +5,12 @@ I386_SRC=$(SRC_PATH)/tests/tcg/i386 # Set search path for all sources VPATH += $(I386_SRC) +config-cc.mak: Makefile + $(quiet-@)( \ + $(call cc-option,-fno-pie, CROSS_CC_HAS_I386_NOPIE)) 3> config-cc.mak + +-include config-cc.mak + I386_SRCS=$(notdir $(wildcard $(I386_SRC)/*.c)) ALL_X86_TESTS=$(I386_SRCS:.c=) SKIP_I386_TESTS=test-i386-ssse3 test-avx test-3dnow test-mmx diff --git a/tests/tcg/ppc64/Makefile.target b/tests/tcg/ppc64/Makefile.target index 7db7a3e..f081f1c 100644 --- a/tests/tcg/ppc64/Makefile.target +++ b/tests/tcg/ppc64/Makefile.target @@ -4,6 +4,13 @@ VPATH += $(SRC_PATH)/tests/tcg/ppc64 +config-cc.mak: Makefile + $(quiet-@)( \ + $(call cc-option,-mpower8-vector, CROSS_CC_HAS_POWER8_VECTOR); \ + $(call cc-option,-mpower10, CROSS_CC_HAS_POWER10)) 3> config-cc.mak + +-include config-cc.mak + ifneq ($(CROSS_CC_HAS_POWER8_VECTOR),) PPC64_TESTS=bcdsub non_signalling_xscv endif -- cgit v1.1 From b898bf28469847cbe4e576000e83ec103bf9b174 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 29 Sep 2022 12:42:05 +0100 Subject: configure: move tests/tcg/Makefile.prereqs to root build directory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It will not be specific to tests/tcg anymore, since it will be possible to build firmware using container-based cross compilers too. Signed-off-by: Paolo Bonzini Signed-off-by: Alex Bennée Message-Id: <20220929114231.583801-26-alex.bennee@linaro.org> --- tests/Makefile.include | 3 --- 1 file changed, 3 deletions(-) (limited to 'tests') diff --git a/tests/Makefile.include b/tests/Makefile.include index 9ed6772..9422dda 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -36,9 +36,6 @@ export SRC_PATH SPEED = quick --include tests/tcg/Makefile.prereqs -tests/tcg/Makefile.prereqs: config-host.mak - # Per guest TCG tests BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(TCG_TESTS_TARGETS)) CLEAN_TCG_TARGET_RULES=$(patsubst %,clean-tcg-tests-%, $(TCG_TESTS_TARGETS)) -- cgit v1.1