1 # -*- Mode: makefile -*-
3 # Multiarch Tests - included from tests/tcg/Makefile.target
5 # These tests are plain C and built without any architecture specific code.
8 MULTIARCH_SRC=$(SRC_PATH)/tests/tcg/multiarch
10 # Set search path for all sources
11 VPATH += $(MULTIARCH_SRC)
12 MULTIARCH_SRCS = $(notdir $(wildcard $(MULTIARCH_SRC)/*.c))
13 ifeq ($(filter %-linux-user, $(TARGET)),$(TARGET))
14 VPATH += $(MULTIARCH_SRC)/linux
15 MULTIARCH_SRCS += $(notdir $(wildcard $(MULTIARCH_SRC)/linux/*.c))
17 MULTIARCH_TESTS = $(MULTIARCH_SRCS:.c=)
20 # The following are any additional rules needed to build things
25 float_%: float_%.c libs/float_helpers.c
26 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< $(MULTIARCH_SRC)/libs/float_helpers.c -o $@ $(LDFLAGS)
29 $(call run-test,$<, $(QEMU) $(QEMU_OPTS) $<)
30 $(call conditional-diff-out,$<,$(SRC_PATH)/tests/tcg/$(TARGET_NAME)/$<.ref)
33 testthread: LDFLAGS+=-lpthread
35 threadcount: LDFLAGS+=-lpthread
37 signals: LDFLAGS+=-lrt -lpthread
39 munmap-pthread: CFLAGS+=-pthread
40 munmap-pthread: LDFLAGS+=-pthread
42 vma-pthread: CFLAGS+=-pthread
43 vma-pthread: LDFLAGS+=-pthread
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.
48 run-vma-pthread: vma-pthread
49 $(call skip-test, $<, "flaky on CI?")
50 run-plugin-vma-pthread-with-%: vma-pthread
51 $(call skip-test, $<, "flaky on CI?")
54 run-test-mmap: test-mmap
55 $(call run-test, test-mmap, $(QEMU) $<, $< (default))
58 GDB_SCRIPT=$(SRC_PATH)/tests/guest-debug/run-test.py
60 run-gdbstub-sha1: sha1
61 $(call run-test, $@, $(GDB_SCRIPT) \
63 --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
64 --bin $< --test $(MULTIARCH_SRC)/gdbstub/sha1.py, \
65 basic gdbstub support)
67 run-gdbstub-qxfer-auxv-read: sha1
68 $(call run-test, $@, $(GDB_SCRIPT) \
70 --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
71 --bin $< --test $(MULTIARCH_SRC)/gdbstub/test-qxfer-auxv-read.py, \
72 basic gdbstub qXfer:auxv:read support)
74 run-gdbstub-qxfer-siginfo-read: segfault
75 $(call run-test, $@, $(GDB_SCRIPT) \
77 --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
78 --bin "$< -s" --test $(MULTIARCH_SRC)/gdbstub/test-qxfer-siginfo-read.py, \
79 basic gdbstub qXfer:siginfo:read support)
81 run-gdbstub-proc-mappings: sha1
82 $(call run-test, $@, $(GDB_SCRIPT) \
84 --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
85 --bin $< --test $(MULTIARCH_SRC)/gdbstub/test-proc-mappings.py, \
86 proc mappings support)
88 run-gdbstub-thread-breakpoint: testthread
89 $(call run-test, $@, $(GDB_SCRIPT) \
91 --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
92 --bin $< --test $(MULTIARCH_SRC)/gdbstub/test-thread-breakpoint.py, \
93 hitting a breakpoint on non-main thread)
95 run-gdbstub-registers: sha512
96 $(call run-test, $@, $(GDB_SCRIPT) \
98 --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
99 --bin $< --test $(MULTIARCH_SRC)/gdbstub/registers.py, \
100 checking register enumeration)
102 run-gdbstub-prot-none: prot-none
103 $(call run-test, $@, env PROT_NONE_PY=1 $(GDB_SCRIPT) \
105 --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
106 --bin $< --test $(MULTIARCH_SRC)/gdbstub/prot-none.py, \
107 accessing PROT_NONE memory)
109 run-gdbstub-catch-syscalls: catch-syscalls
110 $(call run-test, $@, $(GDB_SCRIPT) \
112 --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
113 --bin $< --test $(MULTIARCH_SRC)/gdbstub/catch-syscalls.py, \
114 hitting a syscall catchpoint)
116 run-gdbstub-follow-fork-mode-child: follow-fork-mode
117 $(call run-test, $@, $(GDB_SCRIPT) \
119 --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
120 --bin $< --test $(MULTIARCH_SRC)/gdbstub/follow-fork-mode-child.py, \
121 following children on fork)
123 run-gdbstub-follow-fork-mode-parent: follow-fork-mode
124 $(call run-test, $@, $(GDB_SCRIPT) \
126 --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
127 --bin $< --test $(MULTIARCH_SRC)/gdbstub/follow-fork-mode-parent.py, \
128 following parents on fork)
132 $(call skip-test, "gdbstub test $*", "need working gdb with $(patsubst -%,,$(TARGET_NAME)) support")
134 EXTRA_RUNS += run-gdbstub-sha1 run-gdbstub-qxfer-auxv-read \
135 run-gdbstub-proc-mappings run-gdbstub-thread-breakpoint \
136 run-gdbstub-registers run-gdbstub-prot-none \
137 run-gdbstub-catch-syscalls run-gdbstub-follow-fork-mode-child \
138 run-gdbstub-follow-fork-mode-parent \
139 run-gdbstub-qxfer-siginfo-read
141 # ARM Compatible Semi Hosting Tests
143 # Despite having ARM in the name we actually have several
144 # architectures that implement it. We gate the tests on the feature
145 # appearing in config.
147 ifeq ($(CONFIG_ARM_COMPATIBLE_SEMIHOSTING),y)
148 VPATH += $(MULTIARCH_SRC)/arm-compat-semi
150 # Add -I path back to TARGET_NAME for semicall.h
151 semihosting: CFLAGS+=-I$(SRC_PATH)/tests/tcg/$(TARGET_NAME)
153 run-semihosting: semihosting
154 $(call run-test,$<,$(QEMU) $< 2> $<.err)
156 run-plugin-semihosting-with-%:
157 $(call run-test, $@, $(QEMU) $(QEMU_OPTS) \
158 -plugin $(PLUGIN_LIB)/$(call extract-plugin,$@) \
159 $(call strip-plugin,$<) 2> $<.err, \
162 semiconsole: CFLAGS+=-I$(SRC_PATH)/tests/tcg/$(TARGET_NAME)
164 run-semiconsole: semiconsole
165 $(call skip-test, $<, "MANUAL ONLY")
167 run-plugin-semiconsole-with-%:
168 $(call skip-test, $<, "MANUAL ONLY")
170 TESTS += semihosting semiconsole
173 # Test plugin memory access instrumentation
174 run-plugin-test-plugin-mem-access-with-libmem.so: \
175 PLUGIN_ARGS=$(COMMA)print-accesses=true
176 run-plugin-test-plugin-mem-access-with-libmem.so: \
177 CHECK_PLUGIN_OUTPUT_COMMAND= \
178 $(SRC_PATH)/tests/tcg/multiarch/check-plugin-output.sh \
181 test-plugin-mem-access: CFLAGS+=-pthread -O0
182 test-plugin-mem-access: LDFLAGS+=-pthread -O0
185 TESTS += $(MULTIARCH_TESTS)