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 45sigreturn-sigmask: CFLAGS+=-pthread 46sigreturn-sigmask: LDFLAGS+=-pthread 47 48# GCC versions 12/13/14/15 at least incorrectly complain about 49# "'SHA1Transform' reading 64 bytes from a region of size 0"; see the gcc bug 50# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106709 51# Since this is just a standard piece of library code we've borrowed for a 52# TCG test case, suppress the warning rather than trying to modify the 53# code to work around the compiler. 54sha1: CFLAGS+=-Wno-stringop-overread -Wno-unknown-warning-option 55 56# The vma-pthread seems very sensitive on gitlab and we currently 57# don't know if its exposing a real bug or the test is flaky. 58ifneq ($(GITLAB_CI),) 59run-vma-pthread: vma-pthread 60 $(call skip-test, $<, "flaky on CI?") 61run-plugin-vma-pthread-with-%: vma-pthread 62 $(call skip-test, $<, "flaky on CI?") 63endif 64 65run-test-mmap: test-mmap 66 $(call run-test, test-mmap, $(QEMU) $<, $< (default)) 67 68ifneq ($(GDB),) 69GDB_SCRIPT=$(SRC_PATH)/tests/guest-debug/run-test.py 70 71run-gdbstub-sha1: sha1 72 $(call run-test, $@, $(GDB_SCRIPT) \ 73 --gdb $(GDB) \ 74 --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ 75 --bin $< --test $(MULTIARCH_SRC)/gdbstub/sha1.py, \ 76 basic gdbstub support) 77 78run-gdbstub-qxfer-auxv-read: sha1 79 $(call run-test, $@, $(GDB_SCRIPT) \ 80 --gdb $(GDB) \ 81 --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ 82 --bin $< --test $(MULTIARCH_SRC)/gdbstub/test-qxfer-auxv-read.py, \ 83 basic gdbstub qXfer:auxv:read support) 84 85run-gdbstub-qxfer-siginfo-read: segfault 86 $(call run-test, $@, $(GDB_SCRIPT) \ 87 --gdb $(GDB) \ 88 --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ 89 --bin "$< -s" --test $(MULTIARCH_SRC)/gdbstub/test-qxfer-siginfo-read.py, \ 90 basic gdbstub qXfer:siginfo:read support) 91 92run-gdbstub-proc-mappings: sha1 93 $(call run-test, $@, $(GDB_SCRIPT) \ 94 --gdb $(GDB) \ 95 --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ 96 --bin $< --test $(MULTIARCH_SRC)/gdbstub/test-proc-mappings.py, \ 97 proc mappings support) 98 99run-gdbstub-thread-breakpoint: testthread 100 $(call run-test, $@, $(GDB_SCRIPT) \ 101 --gdb $(GDB) \ 102 --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ 103 --bin $< --test $(MULTIARCH_SRC)/gdbstub/test-thread-breakpoint.py, \ 104 hitting a breakpoint on non-main thread) 105 106run-gdbstub-registers: sha512 107 $(call run-test, $@, $(GDB_SCRIPT) \ 108 --gdb $(GDB) \ 109 --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ 110 --bin $< --test $(MULTIARCH_SRC)/gdbstub/registers.py, \ 111 checking register enumeration) 112 113run-gdbstub-prot-none: prot-none 114 $(call run-test, $@, env PROT_NONE_PY=1 $(GDB_SCRIPT) \ 115 --gdb $(GDB) \ 116 --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ 117 --bin $< --test $(MULTIARCH_SRC)/gdbstub/prot-none.py, \ 118 accessing PROT_NONE memory) 119 120run-gdbstub-catch-syscalls: catch-syscalls 121 $(call run-test, $@, $(GDB_SCRIPT) \ 122 --gdb $(GDB) \ 123 --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ 124 --bin $< --test $(MULTIARCH_SRC)/gdbstub/catch-syscalls.py, \ 125 hitting a syscall catchpoint) 126 127run-gdbstub-follow-fork-mode-child: follow-fork-mode 128 $(call run-test, $@, $(GDB_SCRIPT) \ 129 --gdb $(GDB) \ 130 --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ 131 --bin $< --test $(MULTIARCH_SRC)/gdbstub/follow-fork-mode-child.py, \ 132 following children on fork) 133 134run-gdbstub-follow-fork-mode-parent: follow-fork-mode 135 $(call run-test, $@, $(GDB_SCRIPT) \ 136 --gdb $(GDB) \ 137 --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ 138 --bin $< --test $(MULTIARCH_SRC)/gdbstub/follow-fork-mode-parent.py, \ 139 following parents on fork) 140 141run-gdbstub-late-attach: late-attach 142 $(call run-test, $@, env LATE_ATTACH_PY=1 $(GDB_SCRIPT) \ 143 --gdb $(GDB) \ 144 --qemu $(QEMU) --qargs "$(QEMU_OPTS)" --no-suspend \ 145 --bin $< --test $(MULTIARCH_SRC)/gdbstub/late-attach.py, \ 146 attaching to a running process) 147 148else 149run-gdbstub-%: 150 $(call skip-test, "gdbstub test $*", "need working gdb with $(patsubst -%,,$(TARGET_NAME)) support") 151endif 152EXTRA_RUNS += run-gdbstub-sha1 run-gdbstub-qxfer-auxv-read \ 153 run-gdbstub-proc-mappings run-gdbstub-thread-breakpoint \ 154 run-gdbstub-registers run-gdbstub-prot-none \ 155 run-gdbstub-catch-syscalls run-gdbstub-follow-fork-mode-child \ 156 run-gdbstub-follow-fork-mode-parent \ 157 run-gdbstub-qxfer-siginfo-read run-gdbstub-late-attach 158 159# ARM Compatible Semi Hosting Tests 160# 161# Despite having ARM in the name we actually have several 162# architectures that implement it. We gate the tests on the feature 163# appearing in config. 164# 165ifeq ($(CONFIG_ARM_COMPATIBLE_SEMIHOSTING),y) 166VPATH += $(MULTIARCH_SRC)/arm-compat-semi 167 168# Add -I path back to TARGET_NAME for semicall.h 169semihosting: CFLAGS+=-I$(SRC_PATH)/tests/tcg/$(TARGET_NAME) 170 171run-semihosting: semihosting 172 $(call run-test,$<,$(QEMU) $< 2> $<.err) 173 174run-plugin-semihosting-with-%: 175 $(call run-test, $@, $(QEMU) $(QEMU_OPTS) \ 176 -plugin $(PLUGIN_LIB)/$(call extract-plugin,$@) \ 177 $(call strip-plugin,$<) 2> $<.err, \ 178 $< with $*) 179 180semiconsole: CFLAGS+=-I$(SRC_PATH)/tests/tcg/$(TARGET_NAME) 181 182run-semiconsole: semiconsole 183 $(call skip-test, $<, "MANUAL ONLY") 184 185run-plugin-semiconsole-with-%: 186 $(call skip-test, $<, "MANUAL ONLY") 187 188TESTS += semihosting semiconsole 189endif 190 191# Test plugin memory access instrumentation 192run-plugin-test-plugin-mem-access-with-libmem.so: \ 193 PLUGIN_ARGS=$(COMMA)print-accesses=true 194run-plugin-test-plugin-mem-access-with-libmem.so: \ 195 CHECK_PLUGIN_OUTPUT_COMMAND= \ 196 $(SRC_PATH)/tests/tcg/multiarch/check-plugin-output.sh \ 197 $(QEMU) $< 198 199test-plugin-mem-access: CFLAGS+=-pthread -O0 200test-plugin-mem-access: LDFLAGS+=-pthread -O0 201 202# Update TESTS 203TESTS += $(MULTIARCH_TESTS) 204