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 54run-test-mmap: test-mmap 55 $(call run-test, test-mmap, $(QEMU) $<, $< (default)) 56 57ifneq ($(GDB),) 58GDB_SCRIPT=$(SRC_PATH)/tests/guest-debug/run-test.py 59 60run-gdbstub-sha1: sha1 61 $(call run-test, $@, $(GDB_SCRIPT) \ 62 --gdb $(GDB) \ 63 --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ 64 --bin $< --test $(MULTIARCH_SRC)/gdbstub/sha1.py, \ 65 basic gdbstub support) 66 67run-gdbstub-qxfer-auxv-read: sha1 68 $(call run-test, $@, $(GDB_SCRIPT) \ 69 --gdb $(GDB) \ 70 --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ 71 --bin $< --test $(MULTIARCH_SRC)/gdbstub/test-qxfer-auxv-read.py, \ 72 basic gdbstub qXfer:auxv:read support) 73 74run-gdbstub-proc-mappings: sha1 75 $(call run-test, $@, $(GDB_SCRIPT) \ 76 --gdb $(GDB) \ 77 --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ 78 --bin $< --test $(MULTIARCH_SRC)/gdbstub/test-proc-mappings.py, \ 79 proc mappings support) 80 81run-gdbstub-thread-breakpoint: testthread 82 $(call run-test, $@, $(GDB_SCRIPT) \ 83 --gdb $(GDB) \ 84 --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ 85 --bin $< --test $(MULTIARCH_SRC)/gdbstub/test-thread-breakpoint.py, \ 86 hitting a breakpoint on non-main thread) 87 88run-gdbstub-registers: sha512 89 $(call run-test, $@, $(GDB_SCRIPT) \ 90 --gdb $(GDB) \ 91 --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ 92 --bin $< --test $(MULTIARCH_SRC)/gdbstub/registers.py, \ 93 checking register enumeration) 94 95run-gdbstub-prot-none: prot-none 96 $(call run-test, $@, env PROT_NONE_PY=1 $(GDB_SCRIPT) \ 97 --gdb $(GDB) \ 98 --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ 99 --bin $< --test $(MULTIARCH_SRC)/gdbstub/prot-none.py, \ 100 accessing PROT_NONE memory) 101 102run-gdbstub-catch-syscalls: catch-syscalls 103 $(call run-test, $@, $(GDB_SCRIPT) \ 104 --gdb $(GDB) \ 105 --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ 106 --bin $< --test $(MULTIARCH_SRC)/gdbstub/catch-syscalls.py, \ 107 hitting a syscall catchpoint) 108 109run-gdbstub-follow-fork-mode-child: follow-fork-mode 110 $(call run-test, $@, $(GDB_SCRIPT) \ 111 --gdb $(GDB) \ 112 --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ 113 --bin $< --test $(MULTIARCH_SRC)/gdbstub/follow-fork-mode-child.py, \ 114 following children on fork) 115 116run-gdbstub-follow-fork-mode-parent: follow-fork-mode 117 $(call run-test, $@, $(GDB_SCRIPT) \ 118 --gdb $(GDB) \ 119 --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ 120 --bin $< --test $(MULTIARCH_SRC)/gdbstub/follow-fork-mode-parent.py, \ 121 following parents on fork) 122 123else 124run-gdbstub-%: 125 $(call skip-test, "gdbstub test $*", "need working gdb with $(patsubst -%,,$(TARGET_NAME)) support") 126endif 127EXTRA_RUNS += run-gdbstub-sha1 run-gdbstub-qxfer-auxv-read \ 128 run-gdbstub-proc-mappings run-gdbstub-thread-breakpoint \ 129 run-gdbstub-registers run-gdbstub-prot-none \ 130 run-gdbstub-catch-syscalls run-gdbstub-follow-fork-mode-child \ 131 run-gdbstub-follow-fork-mode-parent 132 133# ARM Compatible Semi Hosting Tests 134# 135# Despite having ARM in the name we actually have several 136# architectures that implement it. We gate the tests on the feature 137# appearing in config. 138# 139ifeq ($(CONFIG_ARM_COMPATIBLE_SEMIHOSTING),y) 140VPATH += $(MULTIARCH_SRC)/arm-compat-semi 141 142# Add -I path back to TARGET_NAME for semicall.h 143semihosting: CFLAGS+=-I$(SRC_PATH)/tests/tcg/$(TARGET_NAME) 144 145run-semihosting: semihosting 146 $(call run-test,$<,$(QEMU) $< 2> $<.err) 147 148run-plugin-semihosting-with-%: 149 $(call run-test, $@, $(QEMU) $(QEMU_OPTS) \ 150 -plugin $(PLUGIN_LIB)/$(call extract-plugin,$@) \ 151 $(call strip-plugin,$<) 2> $<.err, \ 152 $< with $*) 153 154semiconsole: CFLAGS+=-I$(SRC_PATH)/tests/tcg/$(TARGET_NAME) 155 156run-semiconsole: semiconsole 157 $(call skip-test, $<, "MANUAL ONLY") 158 159run-plugin-semiconsole-with-%: 160 $(call skip-test, $<, "MANUAL ONLY") 161 162TESTS += semihosting semiconsole 163endif 164 165# Update TESTS 166TESTS += $(MULTIARCH_TESTS) 167