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 109else 110run-gdbstub-%: 111 $(call skip-test, "gdbstub test $*", "need working gdb with $(patsubst -%,,$(TARGET_NAME)) support") 112endif 113EXTRA_RUNS += run-gdbstub-sha1 run-gdbstub-qxfer-auxv-read \ 114 run-gdbstub-proc-mappings run-gdbstub-thread-breakpoint \ 115 run-gdbstub-registers run-gdbstub-prot-none \ 116 run-gdbstub-catch-syscalls 117 118# ARM Compatible Semi Hosting Tests 119# 120# Despite having ARM in the name we actually have several 121# architectures that implement it. We gate the tests on the feature 122# appearing in config. 123# 124ifeq ($(CONFIG_ARM_COMPATIBLE_SEMIHOSTING),y) 125VPATH += $(MULTIARCH_SRC)/arm-compat-semi 126 127# Add -I path back to TARGET_NAME for semicall.h 128semihosting: CFLAGS+=-I$(SRC_PATH)/tests/tcg/$(TARGET_NAME) 129 130run-semihosting: semihosting 131 $(call run-test,$<,$(QEMU) $< 2> $<.err) 132 133run-plugin-semihosting-with-%: 134 $(call run-test, $@, $(QEMU) $(QEMU_OPTS) \ 135 -plugin $(PLUGIN_LIB)/$(call extract-plugin,$@) \ 136 $(call strip-plugin,$<) 2> $<.err, \ 137 $< with $*) 138 139semiconsole: CFLAGS+=-I$(SRC_PATH)/tests/tcg/$(TARGET_NAME) 140 141run-semiconsole: semiconsole 142 $(call skip-test, $<, "MANUAL ONLY") 143 144run-plugin-semiconsole-with-%: 145 $(call skip-test, $<, "MANUAL ONLY") 146 147TESTS += semihosting semiconsole 148endif 149 150# Update TESTS 151TESTS += $(MULTIARCH_TESTS) 152