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 # 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.
58 # default case (host page size)
59 run-test-mmap: test-mmap
60 $(call run-test, test-mmap, $(QEMU) $<, $< (default))
62 # additional page sizes (defined by each architecture adding to EXTRA_RUNS)
63 run-test-mmap-%: test-mmap
64 $(call run-test, test-mmap-$*, $(QEMU) -p $* $<, $< ($* byte pages))
67 GDB_SCRIPT=$(SRC_PATH)/tests/guest-debug/run-test.py
69 run-gdbstub-sha1: sha1
70 $(call run-test, $@, $(GDB_SCRIPT) \
72 --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
73 --bin $< --test $(MULTIARCH_SRC)/gdbstub/sha1.py, \
74 basic gdbstub support)
76 run-gdbstub-qxfer-auxv-read: sha1
77 $(call run-test, $@, $(GDB_SCRIPT) \
79 --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
80 --bin $< --test $(MULTIARCH_SRC)/gdbstub/test-qxfer-auxv-read.py, \
81 basic gdbstub qXfer:auxv:read support)
83 run-gdbstub-proc-mappings: sha1
84 $(call run-test, $@, $(GDB_SCRIPT) \
86 --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
87 --bin $< --test $(MULTIARCH_SRC)/gdbstub/test-proc-mappings.py, \
88 proc mappings support)
90 run-gdbstub-thread-breakpoint: testthread
91 $(call run-test, $@, $(GDB_SCRIPT) \
93 --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
94 --bin $< --test $(MULTIARCH_SRC)/gdbstub/test-thread-breakpoint.py, \
95 hitting a breakpoint on non-main thread)
97 run-gdbstub-registers: sha512
98 $(call run-test, $@, $(GDB_SCRIPT) \
100 --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
101 --bin $< --test $(MULTIARCH_SRC)/gdbstub/registers.py, \
102 checking register enumeration)
106 $(call skip-test, "gdbstub test $*", "need working gdb with $(patsubst -%,,$(TARGET_NAME)) support")
108 EXTRA_RUNS += run-gdbstub-sha1 run-gdbstub-qxfer-auxv-read \
109 run-gdbstub-proc-mappings run-gdbstub-thread-breakpoint \
110 run-gdbstub-registers
112 # ARM Compatible Semi Hosting Tests
114 # Despite having ARM in the name we actually have several
115 # architectures that implement it. We gate the tests on the feature
116 # appearing in config.
118 ifeq ($(CONFIG_ARM_COMPATIBLE_SEMIHOSTING),y)
119 VPATH += $(MULTIARCH_SRC)/arm-compat-semi
121 # Add -I path back to TARGET_NAME for semicall.h
122 semihosting: CFLAGS+=-I$(SRC_PATH)/tests/tcg/$(TARGET_NAME)
124 run-semihosting: semihosting
125 $(call run-test,$<,$(QEMU) $< 2> $<.err)
127 run-plugin-semihosting-with-%:
128 $(call run-test, $@, $(QEMU) $(QEMU_OPTS) \
129 -plugin $(PLUGIN_LIB)/$(call extract-plugin,$@) \
130 $(call strip-plugin,$<) 2> $<.err, \
133 semiconsole: CFLAGS+=-I$(SRC_PATH)/tests/tcg/$(TARGET_NAME)
135 run-semiconsole: semiconsole
136 $(call skip-test, $<, "MANUAL ONLY")
138 run-plugin-semiconsole-with-%:
139 $(call skip-test, $<, "MANUAL ONLY")
141 TESTS += semihosting semiconsole
145 TESTS += $(MULTIARCH_TESTS)