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>
This commit is contained in:
Paolo Bonzini 2022-09-29 12:42:04 +01:00 committed by Alex Bennée
parent c6cf8a2052
commit 15b273f8e6
6 changed files with 38 additions and 64 deletions

65
configure vendored
View File

@ -2490,73 +2490,11 @@ for target in $target_list; do
probe_target_compiler $target
if test $got_cross_cc = yes; then
# Test for compiler features for optional tests. We only do this
# for cross compilers because ensuring the docker containers based
# compilers is a requirememt for adding a new test that needs a
# compiler feature.
echo "BUILD_STATIC=$build_static" >> "$config_target_mak"
write_target_makefile >> "$config_target_mak"
case $target in
aarch64-*)
if do_compiler "$target_cc" $target_cflags \
-march=armv8.1-a+sve -o $TMPE $TMPC; then
echo "CROSS_CC_HAS_SVE=y" >> "$config_target_mak"
fi
if do_compiler "$target_cc" $target_cflags \
-march=armv8.1-a+sve2 -o $TMPE $TMPC; then
echo "CROSS_CC_HAS_SVE2=y" >> "$config_target_mak"
fi
if do_compiler "$target_cc" $target_cflags \
-march=armv8.3-a -o $TMPE $TMPC; then
echo "CROSS_CC_HAS_ARMV8_3=y" >> "$config_target_mak"
fi
if do_compiler "$target_cc" $target_cflags \
-mbranch-protection=standard -o $TMPE $TMPC; then
echo "CROSS_CC_HAS_ARMV8_BTI=y" >> "$config_target_mak"
fi
if do_compiler "$target_cc" $target_cflags \
-march=armv8.5-a+memtag -o $TMPE $TMPC; then
echo "CROSS_CC_HAS_ARMV8_MTE=y" >> "$config_target_mak"
fi
;;
ppc*)
if do_compiler "$target_cc" $target_cflags \
-mpower8-vector -o $TMPE $TMPC; then
echo "CROSS_CC_HAS_POWER8_VECTOR=y" >> "$config_target_mak"
fi
if do_compiler "$target_cc" $target_cflags \
-mpower10 -o $TMPE $TMPC; then
echo "CROSS_CC_HAS_POWER10=y" >> "$config_target_mak"
fi
;;
i386-linux-user)
if do_compiler "$target_cc" $target_cflags \
-Werror -fno-pie -o $TMPE $TMPC; then
echo "CROSS_CC_HAS_I386_NOPIE=y" >> "$config_target_mak"
fi
;;
esac
elif test -n "$container_image"; then
build_static=y
echo "build-tcg-tests-$target: docker-image-$container_image" >> $makefile
echo "BUILD_STATIC=y" >> "$config_target_mak"
write_container_target_makefile >> "$config_target_mak"
case $target in
aarch64-*)
echo "CROSS_CC_HAS_SVE=y" >> "$config_target_mak"
echo "CROSS_CC_HAS_SVE2=y" >> "$config_target_mak"
echo "CROSS_CC_HAS_ARMV8_3=y" >> "$config_target_mak"
echo "CROSS_CC_HAS_ARMV8_BTI=y" >> "$config_target_mak"
echo "CROSS_CC_HAS_ARMV8_MTE=y" >> "$config_target_mak"
;;
ppc*)
echo "CROSS_CC_HAS_POWER8_VECTOR=y" >> "$config_target_mak"
echo "CROSS_CC_HAS_POWER10=y" >> "$config_target_mak"
;;
i386-linux-user)
echo "CROSS_CC_HAS_I386_NOPIE=y" >> "$config_target_mak"
;;
esac
got_cross_cc=yes
fi
if test $got_cross_cc = yes; then
@ -2565,6 +2503,7 @@ for target in $target_list; do
ln -sf "../config-$target.mak" "tests/tcg/$target/config-target.mak"
echo "TARGET=$target" >> "$config_target_mak"
echo "QEMU=$PWD/$qemu" >> "$config_target_mak"
echo "BUILD_STATIC=$build_static" >> "$config_target_mak"
echo "run-tcg-tests-$target: $qemu\$(EXESUF)" >> $makefile
tcg_tests_targets="$tcg_tests_targets $target"
fi

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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