summaryrefslogtreecommitdiffstats
path: root/tests/tcg
diff options
context:
space:
mode:
authorPaolo Bonzini2022-09-29 13:42:04 +0200
committerAlex Bennée2022-10-06 12:53:40 +0200
commit15b273f8e6a4740768fba3878a346c82ef48a966 (patch)
tree4b0fc44b5ffa1dfb23fccf89d4cd71aa30c664f3 /tests/tcg
parenttests/tcg: clean up calls to run-test (diff)
downloadqemu-15b273f8e6a4740768fba3878a346c82ef48a966.tar.gz
qemu-15b273f8e6a4740768fba3878a346c82ef48a966.tar.xz
qemu-15b273f8e6a4740768fba3878a346c82ef48a966.zip
tests/tcg: move compiler tests to Makefiles
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 <pbonzini@redhat.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20220929114231.583801-25-alex.bennee@linaro.org>
Diffstat (limited to 'tests/tcg')
-rw-r--r--tests/tcg/Makefile.target10
-rw-r--r--tests/tcg/aarch64/Makefile.softmmu-target5
-rw-r--r--tests/tcg/aarch64/Makefile.target9
-rw-r--r--tests/tcg/i386/Makefile.target6
-rw-r--r--tests/tcg/ppc64/Makefile.target7
5 files changed, 36 insertions, 1 deletions
diff --git a/tests/tcg/Makefile.target b/tests/tcg/Makefile.target
index cd0a2ad873..75257f2b29 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 84a9990f8d..a1368905f5 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 9837a809dc..fc8d90ed69 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 8af066efc5..3273aa8061 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 7db7a3e2b3..f081f1c683 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