Commit cd81cf8683 for qemu.org
commit cd81cf86834df42c79f90818a8c0193281466079
Author: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Date: Thu Aug 27 22:14:47 2026 +0000
tests/tcg/s390x: system tests
Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
Tested-by: Aniket Sahu <asahu1x@linux.ibm.com>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-ID: <20260827221506.91574-87-pierrick.bouvier@oss.qualcomm.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
diff --git a/tests/tcg/s390x/Makefile.softmmu-target b/tests/tcg/s390x/Makefile.softmmu-target
deleted file mode 100644
index a4425d3184..0000000000
--- a/tests/tcg/s390x/Makefile.softmmu-target
+++ /dev/null
@@ -1,57 +0,0 @@
-S390X_SRC=$(SRC_PATH)/tests/tcg/s390x
-VPATH+=$(S390X_SRC)
-# EXTFLAGS can be passed by the user, e.g. to override the --accel
-QEMU_OPTS+=-action panic=exit-failure -nographic -serial chardev:output $(EXTFLAGS) -kernel
-LINK_SCRIPT=$(S390X_SRC)/softmmu.ld
-CFLAGS+=-ggdb -O0 -I$(SRC_PATH)/include/hw/s390x/ipl/
-LDFLAGS=-nostdlib -static
-
-%.o: %.S
- $(CC) -march=z13 -m64 -Wa,--noexecstack -c $< -o $@
-
-%.o: %.c
- $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -march=z13 -m64 -c $< -o $@
-
-%: %.o
- $(CC) $< -o $@ $(LDFLAGS)
-
-ASM_TESTS = \
- bal \
- cksm \
- clm \
- exrl-ssm-early \
- icm \
- sam \
- lpsw \
- lpswe-early \
- lra \
- mc \
- per \
- precise-smc-softmmu \
- sckc \
- ssm-early \
- stosm-early \
- stpq \
- unaligned-lowcore
-
-include $(S390X_SRC)/pgm-specification.mak
-$(PGM_SPECIFICATION_TESTS): pgm-specification-softmmu.o
-$(PGM_SPECIFICATION_TESTS): LDFLAGS+=pgm-specification-softmmu.o
-ASM_TESTS += $(PGM_SPECIFICATION_TESTS)
-
-$(ASM_TESTS): LDFLAGS += -Wl,-T$(LINK_SCRIPT) -Wl,--build-id=none
-$(ASM_TESTS): $(LINK_SCRIPT)
-TESTS += $(ASM_TESTS)
-
-MULTIARCH_TESTS += mvc-smc
-S390X_MULTIARCH_RUNTIME_OBJS = head64.o console.o $(MINILIB_OBJS)
-$(MULTIARCH_TESTS): $(S390X_MULTIARCH_RUNTIME_OBJS)
-$(MULTIARCH_TESTS): LDFLAGS += $(S390X_MULTIARCH_RUNTIME_OBJS)
-$(MULTIARCH_TESTS): CFLAGS += $(MINILIB_INC) \
- -I$(SRC_PATH)/roms/SLOF/lib/libc/include/
-memory: CFLAGS += -DCHECK_UNALIGNED=0
-
-# s390x clears the BSS section so we need to account for that
-run-plugin-memory-with-libmem.so: \
- CHECK_PLUGIN_OUTPUT_COMMAND=$(MULTIARCH_SYSTEM_SRC)/validate-memory-counts.py \
- --bss-cleared $@.out
diff --git a/tests/tcg/s390x/meson.build b/tests/tcg/s390x/meson.build
index dcbbb463c4..dc6271c7c7 100644
--- a/tests/tcg/s390x/meson.build
+++ b/tests/tcg/s390x/meson.build
@@ -21,6 +21,8 @@ tests_s390x_pgm = [
'strl-unaligned.S',
]
+subdir('system')
+
tests = []
# Multi arch tests
diff --git a/tests/tcg/s390x/pgm-specification.mak b/tests/tcg/s390x/pgm-specification.mak
deleted file mode 100644
index 73dc47af0d..0000000000
--- a/tests/tcg/s390x/pgm-specification.mak
+++ /dev/null
@@ -1,15 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# List of specification exception tests.
-# Shared between the system and the user makefiles.
-PGM_SPECIFICATION_TESTS = \
- br-odd \
- cgrl-unaligned \
- clrl-unaligned \
- crl-unaligned \
- ex-odd \
- lgrl-unaligned \
- llgfrl-unaligned \
- lpswe-unaligned \
- lrl-unaligned \
- stgrl-unaligned \
- strl-unaligned
diff --git a/tests/tcg/s390x/system/meson.build b/tests/tcg/s390x/system/meson.build
new file mode 100644
index 0000000000..ca07f50305
--- /dev/null
+++ b/tests/tcg/s390x/system/meson.build
@@ -0,0 +1,92 @@
+tests = []
+
+minilib_dir = meson.current_source_dir() / '..' / '..' / 'minilib'
+minilib_printf = files(minilib_dir / 'printf.c')[0]
+link_script = files('../softmmu.ld')[0]
+head64 = files('../head64.S')[0]
+console = files('../console.c')[0]
+ipl_inc = meson.project_source_root()/'include'/'hw'/'s390x'/'ipl'
+cflags = ['-nostdlib',
+ '-ffreestanding',
+ '-Wa,--noexecstack',
+ '-I', minilib_dir, minilib_printf,
+ '-I', ipl_inc,
+ '-march=z13',
+ head64, console]
+asmflags = ['-nostdlib',
+ '-Wl,-T', link_script, '-Wl,--build-id=none',
+ '-march=z13', '-Wa,--noexecstack']
+qemu_args = ['-display', 'none',
+ '-action', 'panic=exit-failure',
+ '-serial', 'stdio',
+ '-kernel']
+
+# Multi arch tests - add cflags only once per src
+multi_src = []
+foreach t: tcg_tests['multiarch-softmmu']['tests']
+ foreach src, setup: t
+ new_cflags = cflags
+ if fs.stem(src) == 'memory'
+ new_cflags += '-DCHECK_UNALIGNED=0'
+ endif
+ if 'test_name' in setup and setup['test_name'] == 'memory-access'
+ # s390x clears the BSS section so we need to account for that
+ # ./validate-memory-counts.py --bss-cleared
+ setup += {'wrapper': setup['wrapper'] + '--bss-cleared'}
+ endif
+ if src not in multi_src
+ setup += {'cflags': [new_cflags]}
+ multi_src += src
+ endif
+ tests += {src: setup + {'qemu_args': qemu_args}}
+ endforeach
+endforeach
+
+tests += {
+ 'mvc-smc.c': {'cflags': [cflags], 'qemu_args': qemu_args},
+}
+
+setup_asm = {'cflags': [asmflags], 'qemu_args': qemu_args}
+tests += {
+ 'bal.S': setup_asm,
+ 'cksm.S': setup_asm,
+ 'clm.S': setup_asm,
+ 'exrl-ssm-early.S': setup_asm,
+ 'icm.S': setup_asm,
+ 'sam.S': setup_asm,
+ 'lpsw.S': setup_asm,
+ 'lpswe-early.S': setup_asm,
+ 'lra.S': setup_asm,
+ 'mc.S': setup_asm,
+ 'per.S': setup_asm,
+ 'precise-smc-softmmu.S': setup_asm,
+ 'sckc.S': setup_asm,
+ 'ssm-early.S': setup_asm,
+ 'stosm-early.S': setup_asm,
+ 'stpq.S': setup_asm,
+ 'unaligned-lowcore.S': setup_asm,
+}
+
+foreach src: tests_s390x_pgm
+ tests += {
+ src: {
+ 'cflags': [asmflags, files('../pgm-specification-softmmu.S')],
+ 'qemu_args': qemu_args,
+ }
+ }
+endforeach
+
+if 'qemu-system-s390x' in emulators
+ tcg_tests += {
+ 's390x-softmmu': {
+ 'cc': cc,
+ 'cc_dockerfile': cc_dockerfile,
+ 'cc_docker_host_arch': cc_docker_host_arch,
+ 'cc_feat_cflags': cc_feat_cflags,
+ 'folder': 's390x',
+ 'gdb_arch': 's390x',
+ 'qemu': emulators['qemu-system-s390x'],
+ 'tests': tests,
+ }
+ }
+endif