xref: /qemu/tests/tcg/multiarch/Makefile.target (revision a0e93dd8)
1# -*- Mode: makefile -*-
2#
3# Multiarch Tests - included from tests/tcg/Makefile.target
4#
5# These tests are plain C and built without any architecture specific code.
6#
7
8MULTIARCH_SRC=$(SRC_PATH)/tests/tcg/multiarch
9
10# Set search path for all sources
11VPATH 	       += $(MULTIARCH_SRC)
12MULTIARCH_SRCS =  $(notdir $(wildcard $(MULTIARCH_SRC)/*.c))
13ifeq ($(filter %-linux-user, $(TARGET)),$(TARGET))
14VPATH 	       += $(MULTIARCH_SRC)/linux
15MULTIARCH_SRCS += $(notdir $(wildcard $(MULTIARCH_SRC)/linux/*.c))
16endif
17MULTIARCH_TESTS = $(MULTIARCH_SRCS:.c=)
18
19#
20# The following are any additional rules needed to build things
21#
22
23
24float_%: LDFLAGS+=-lm
25float_%: float_%.c libs/float_helpers.c
26	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< $(MULTIARCH_SRC)/libs/float_helpers.c -o $@ $(LDFLAGS)
27
28run-float_%: float_%
29	$(call run-test,$<, $(QEMU) $(QEMU_OPTS) $<)
30	$(call conditional-diff-out,$<,$(SRC_PATH)/tests/tcg/$(TARGET_NAME)/$<.ref)
31
32
33testthread: LDFLAGS+=-lpthread
34
35threadcount: LDFLAGS+=-lpthread
36
37signals: LDFLAGS+=-lrt -lpthread
38
39munmap-pthread: CFLAGS+=-pthread
40munmap-pthread: LDFLAGS+=-pthread
41
42vma-pthread: CFLAGS+=-pthread
43vma-pthread: LDFLAGS+=-pthread
44
45# The vma-pthread seems very sensitive on gitlab and we currently
46# don't know if its exposing a real bug or the test is flaky.
47ifneq ($(GITLAB_CI),)
48run-vma-pthread: vma-pthread
49	$(call skip-test, $<, "flaky on CI?")
50run-plugin-vma-pthread-with-%: vma-pthread
51	$(call skip-test, $<, "flaky on CI?")
52endif
53
54# We define the runner for test-mmap after the individual
55# architectures have defined their supported pages sizes. If no
56# additional page sizes are defined we only run the default test.
57
58# default case (host page size)
59run-test-mmap: test-mmap
60	$(call run-test, test-mmap, $(QEMU) $<, $< (default))
61
62# additional page sizes (defined by each architecture adding to EXTRA_RUNS)
63run-test-mmap-%: test-mmap
64	$(call run-test, test-mmap-$*, $(QEMU) -p $* $<, $< ($* byte pages))
65
66ifneq ($(GDB),)
67GDB_SCRIPT=$(SRC_PATH)/tests/guest-debug/run-test.py
68
69run-gdbstub-sha1: sha1
70	$(call run-test, $@, $(GDB_SCRIPT) \
71		--gdb $(GDB) \
72		--qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
73		--bin $< --test $(MULTIARCH_SRC)/gdbstub/sha1.py, \
74	basic gdbstub support)
75
76run-gdbstub-qxfer-auxv-read: sha1
77	$(call run-test, $@, $(GDB_SCRIPT) \
78		--gdb $(GDB) \
79		--qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
80		--bin $< --test $(MULTIARCH_SRC)/gdbstub/test-qxfer-auxv-read.py, \
81	basic gdbstub qXfer:auxv:read support)
82
83run-gdbstub-proc-mappings: sha1
84	$(call run-test, $@, $(GDB_SCRIPT) \
85		--gdb $(GDB) \
86		--qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
87		--bin $< --test $(MULTIARCH_SRC)/gdbstub/test-proc-mappings.py, \
88	proc mappings support)
89
90run-gdbstub-thread-breakpoint: testthread
91	$(call run-test, $@, $(GDB_SCRIPT) \
92		--gdb $(GDB) \
93		--qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
94		--bin $< --test $(MULTIARCH_SRC)/gdbstub/test-thread-breakpoint.py, \
95	hitting a breakpoint on non-main thread)
96
97run-gdbstub-registers: sha512
98	$(call run-test, $@, $(GDB_SCRIPT) \
99		--gdb $(GDB) \
100		--qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
101		--bin $< --test $(MULTIARCH_SRC)/gdbstub/registers.py, \
102	checking register enumeration)
103
104run-gdbstub-prot-none: prot-none
105	$(call run-test, $@, env PROT_NONE_PY=1 $(GDB_SCRIPT) \
106		--gdb $(GDB) \
107		--qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
108		--bin $< --test $(MULTIARCH_SRC)/gdbstub/prot-none.py, \
109	accessing PROT_NONE memory)
110
111run-gdbstub-catch-syscalls: catch-syscalls
112	$(call run-test, $@, $(GDB_SCRIPT) \
113		--gdb $(GDB) \
114		--qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
115		--bin $< --test $(MULTIARCH_SRC)/gdbstub/catch-syscalls.py, \
116	hitting a syscall catchpoint)
117
118else
119run-gdbstub-%:
120	$(call skip-test, "gdbstub test $*", "need working gdb with $(patsubst -%,,$(TARGET_NAME)) support")
121endif
122EXTRA_RUNS += run-gdbstub-sha1 run-gdbstub-qxfer-auxv-read \
123	      run-gdbstub-proc-mappings run-gdbstub-thread-breakpoint \
124	      run-gdbstub-registers run-gdbstub-prot-none \
125	      run-gdbstub-catch-syscalls
126
127# ARM Compatible Semi Hosting Tests
128#
129# Despite having ARM in the name we actually have several
130# architectures that implement it. We gate the tests on the feature
131# appearing in config.
132#
133ifeq ($(CONFIG_ARM_COMPATIBLE_SEMIHOSTING),y)
134VPATH += $(MULTIARCH_SRC)/arm-compat-semi
135
136# Add -I path back to TARGET_NAME for semicall.h
137semihosting: CFLAGS+=-I$(SRC_PATH)/tests/tcg/$(TARGET_NAME)
138
139run-semihosting: semihosting
140	$(call run-test,$<,$(QEMU) $< 2> $<.err)
141
142run-plugin-semihosting-with-%:
143	$(call run-test, $@, $(QEMU) $(QEMU_OPTS) \
144		-plugin $(PLUGIN_LIB)/$(call extract-plugin,$@) \
145		 $(call strip-plugin,$<) 2> $<.err, \
146		$< with $*)
147
148semiconsole: CFLAGS+=-I$(SRC_PATH)/tests/tcg/$(TARGET_NAME)
149
150run-semiconsole: semiconsole
151	$(call skip-test, $<, "MANUAL ONLY")
152
153run-plugin-semiconsole-with-%:
154	$(call skip-test, $<, "MANUAL ONLY")
155
156TESTS += semihosting semiconsole
157endif
158
159# Update TESTS
160TESTS += $(MULTIARCH_TESTS)
161