Signed-off-by: Pierrick Bouvier <[email protected]>
---
tests/tcg/i386/Makefile.softmmu-target | 37 --------------------
tests/tcg/i386/meson.build | 2 ++
tests/tcg/i386/system/meson.build | 48 ++++++++++++++++++++++++++
3 files changed, 50 insertions(+), 37 deletions(-)
delete mode 100644 tests/tcg/i386/Makefile.softmmu-target
create mode 100644 tests/tcg/i386/system/meson.build
diff --git a/tests/tcg/i386/Makefile.softmmu-target
b/tests/tcg/i386/Makefile.softmmu-target
deleted file mode 100644
index 4096a1cf31f..00000000000
--- a/tests/tcg/i386/Makefile.softmmu-target
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# x86 system tests
-#
-# This currently builds only for i386. The common C code is built
-# with standard compiler flags however so we can support both by
-# adding additional boot files for x86_64.
-#
-
-I386_SYSTEM_SRC=$(SRC_PATH)/tests/tcg/i386/system
-X64_SYSTEM_SRC=$(SRC_PATH)/tests/tcg/x86_64/system
-
-# These objects provide the basic boot code and helper functions for all tests
-CRT_OBJS=boot.o
-
-CRT_PATH=$(I386_SYSTEM_SRC)
-LINK_SCRIPT=$(I386_SYSTEM_SRC)/kernel.ld
-LDFLAGS=-Wl,-T$(LINK_SCRIPT) -Wl,-melf_i386
-CFLAGS+=-nostdlib -ggdb -O0 $(MINILIB_INC)
-LDFLAGS+=-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) -lgcc
-
-TESTS+=$(MULTIARCH_TESTS)
-EXTRA_RUNS+=$(MULTIARCH_RUNS)
-
-# building head blobs
-.PRECIOUS: $(CRT_OBJS)
-
-%.o: $(CRT_PATH)/%.S
- $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -Wa,--noexecstack -c $< -o $@
-
-# Build and link the tests
-%: %.c $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS)
- $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
-
-memory: CFLAGS+=-DCHECK_UNALIGNED=1
-
-# Running
-QEMU_OPTS+=-device isa-debugcon,chardev=output -device
isa-debug-exit,iobase=0xf4,iosize=0x4 -kernel
diff --git a/tests/tcg/i386/meson.build b/tests/tcg/i386/meson.build
index 62074b86c9e..5cda03655fa 100644
--- a/tests/tcg/i386/meson.build
+++ b/tests/tcg/i386/meson.build
@@ -2,6 +2,8 @@ cc = 'i686-linux-gnu-gcc'
cc_dockerfile = 'debian-i686-cross'
cc_docker_host_arch = ['x86_64']
+subdir('system')
+
tests = []
tests += tcg_tests['multiarch-linux-user']['tests']
diff --git a/tests/tcg/i386/system/meson.build
b/tests/tcg/i386/system/meson.build
new file mode 100644
index 00000000000..482a400555e
--- /dev/null
+++ b/tests/tcg/i386/system/meson.build
@@ -0,0 +1,48 @@
+tests = []
+
+minilib_dir = meson.current_source_dir() / '..' / '..' / 'minilib'
+minilib_printf = files(minilib_dir / 'printf.c')[0]
+link_script = files('kernel.ld')[0]
+boot = files('boot.S')[0]
+cflags = ['-nostdlib',
+ '-Wa,--noexecstack',
+ '-I', minilib_dir, minilib_printf, boot,
+ '-Wl,-T', link_script,
+ '-Wl,-melf_i386',
+ '-Wl,--no-warn-rwx-segments',
+ '-lgcc']
+qemu_def_args = ['-display', 'none',
+ '-device', 'isa-debugcon,chardev=stdio',
+ '-chardev', 'stdio,id=stdio',
+ '-device', 'isa-debug-exit,iobase=0xf4,iosize=0x4',
+ '-kernel']
+
+# Multi arch tests
+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=1'
+ endif
+ if src not in multi_src
+ setup += {'cflags': [new_cflags]}
+ multi_src += src
+ endif
+ tests += {src: setup + {'qemu_args': qemu_def_args}}
+ endforeach
+endforeach
+
+if 'qemu-system-i386' in emulators
+ tcg_tests += {
+ 'i386-softmmu': {
+ 'cc': cc,
+ 'cc_dockerfile': cc_dockerfile,
+ 'cc_docker_host_arch': cc_docker_host_arch,
+ 'folder': 'i386/system',
+ 'gdb_arch': 'i386',
+ 'qemu': emulators['qemu-system-i386'],
+ 'tests': tests,
+ }
+ }
+endif
--
2.47.3