Skip to contentSkip to conversation

tests/tcg: Run tests on arch variants again

PATCH In review Philippe Mathieu-Daudé 2 participants 2 messages Mar 12, 2021 – Apr 14, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/tcg: Run tests on arch variants again

We used to run the TCG tests for various QEMU targets, but at some points it got restricted to base directories in tests/tcg/. For example, armeb/mipsel/mips64/... targets are currently skipped.

The configuration Makefiles in default-configs/targets/ provide all the required information, in particular TARGET_BASE_ARCH.

Source the target default-configs.mak and optionally process the TARGET_ARCH / TARGET_BASE_ARCH Makefiles (if these variables differ from TARGET_NAME).

---
 tests/tcg/Makefile.target | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
tests/tcg/Makefile.target +27 -0
index 24d75a5801f..677b247328f 100644
@@ -85,6 +85,10 @@ TIMEOUT=15
 endif
 
 ifdef CONFIG_USER_ONLY
+
+# FIXME bsd-user?
+include $(SRC_PATH)/default-configs/targets/$(TARGET_NAME)-linux-user.mak
+
 # The order we include is important. We include multiarch first and
 # then the target. If there are common tests shared between
 # sub-targets (e.g. ARM & AArch64) then it is up to
@@ -92,6 +96,16 @@ ifdef CONFIG_USER_ONLY
 # architecture in its VPATH.
 -include $(SRC_PATH)/tests/tcg/multiarch/Makefile.target
 -include $(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.target
+ifneq ($(TARGET_ARCH),)
+ifneq ($(TARGET_ARCH),$(TARGET_NAME))
+-include $(SRC_PATH)/tests/tcg/$(TARGET_ARCH)/Makefile.target
+endif
+endif
+ifneq ($(TARGET_BASE_ARCH),)
+ifneq ($(TARGET_BASE_ARCH),$(TARGET_ARCH))
+-include $(SRC_PATH)/tests/tcg/$(TARGET_BASE_ARCH)/Makefile.target
+endif
+endif
 
 # Add the common build options
 CFLAGS+=-Wall -Werror -O0 -g -fno-strict-aliasing
@@ -102,12 +116,25 @@ endif
 %: %.c
 	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
 else
+
+include $(SRC_PATH)/default-configs/targets/$(TARGET_NAME)-softmmu.mak
+
 # 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/multiarch/system/Makefile.softmmu-target
 -include $(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.softmmu-target
+ifneq ($(TARGET_ARCH),)
+ifneq ($(TARGET_ARCH),$(TARGET_NAME))
+-include $(SRC_PATH)/tests/tcg/$(TARGET_ARCH)/Makefile.softmmu-target
+endif
+endif
+ifneq ($(TARGET_BASE_ARCH),)
+ifneq ($(TARGET_BASE_ARCH),$(TARGET_ARCH))
+-include $(SRC_PATH)/tests/tcg/$(TARGET_BASE_ARCH)/Makefile.softmmu-target
+endif
+endif
 
 endif
 
Signature · 1 line
2.26.2
#1 lore raw
Quoted 35 lines · Philippe Mathieu-Daudé

We used to run the TCG tests for various QEMU targets, but at some points it got restricted to base directories in tests/tcg/. For example, armeb/mipsel/mips64/... targets are currently skipped.

The configuration Makefiles in default-configs/targets/ provide all the required information, in particular TARGET_BASE_ARCH.

Source the target default-configs.mak and optionally process the TARGET_ARCH / TARGET_BASE_ARCH Makefiles (if these variables differ from TARGET_NAME).

---
 tests/tcg/Makefile.target | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
tests/tcg/Makefile.target +4 -0
index 24d75a5801f..677b247328f 100644
@@ -85,6 +85,10 @@ TIMEOUT=15
 endif
 
 ifdef CONFIG_USER_ONLY
+
+# FIXME bsd-user?
+include $(SRC_PATH)/default-configs/targets/$(TARGET_NAME)-linux-user.mak
+
 # The order we include is important. We include multiarch first and
 # then the target. If there are common tests shared between
 # sub-targets (e.g. ARM & AArch64) then it is up to
@@ -92,6 +96,16 @@ ifdef CONFIG_USER_ONLY
 # architecture in its VPATH.
 -include $(SRC_PATH)/tests/tcg/multiarch/Makefile.target
 -include $(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.target

tests/tcg/Makefile.target ifdef CONFIG_USER_ONLY · line 108

Quoted 10 lines
tests/tcg/Makefile.target +10 -0
+ifneq ($(TARGET_ARCH),)
+ifneq ($(TARGET_ARCH),$(TARGET_NAME))
+-include $(SRC_PATH)/tests/tcg/$(TARGET_ARCH)/Makefile.target
+endif
+endif
+ifneq ($(TARGET_BASE_ARCH),)
+ifneq ($(TARGET_BASE_ARCH),$(TARGET_ARCH))
+-include $(SRC_PATH)/tests/tcg/$(TARGET_BASE_ARCH)/Makefile.target
+endif
+endif

This then breaks things like aarch64-linux-user semihosting tests because we end up overriding semihosting CFLAGS:

subprocess.CalledProcessError: Command '['docker', 'run', '--rm', '--label', 'com.qemu.instance.uuid=34c4dca59b4f4f368fcc75f25e6b79d8', '-u', '1000', '-w', '/home/alex/lsrc/qemu.git/builds/user.static/tests/tcg/aarch64-linux-user', '-v', '/home/alex/lsrc/qemu.git/builds/user.static/tests/tcg/aarch64-linux-user:/home/alex/lsrc/qemu.git/builds/user.static/tests/tcg/aarch64-linux-user:rw', '-v', '/home/alex/lsrc/qemu.git:/home/alex/lsrc/qemu.git:ro,z', 'qemu/debian-arm64-test-cross', 'aarch64-linux-gnu-gcc-10', '-Wall', '-Werror', '-O0', '-g', '-fno-strict-aliasing', '-I/home/alex/lsrc/qemu.git/tests/tcg/aarch64', '-mthumb', '/home/alex/lsrc/qemu.git/tests/tcg/multiarch/arm-compat-semi/semihosting.c', '-o', 'semihosting', '-static']' returned non-zero exit status 1. filter=--filter=label=com.qemu.instance.uuid=34c4dca59b4f4f368fcc75f25e6b79d8
make[2]: *** [../Makefile.target:120: semihosting] Error 1
make[1]: *** [/home/alex/lsrc/qemu.git/tests/tcg/Makefile.qemu:64: docker-build-guest-tests] Error 2
make: *** [/home/alex/lsrc/qemu.git/tests/Makefile.include:56: build-tcg-tests-aarch64-linux-user] Error 2

We should at least be able to run multiarch tests for all these other arches if we have the right compilers for them.

I'm untangling configure.sh at the moment because I'm not quite sure what the current "arches" variable in there is trying to achieve.

Signature · 1 line
Alex Bennée