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)) 13ifneq ($(CONFIG_LINUX),) 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) $<,"$< on $(TARGET_NAME)") 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 39# We define the runner for test-mmap after the individual 40# architectures have defined their supported pages sizes. If no 41# additional page sizes are defined we only run the default test. 42 43# default case (host page size) 44run-test-mmap: test-mmap 45 $(call run-test, test-mmap, $(QEMU) $<, \ 46 "$< (default) on $(TARGET_NAME)") 47 48# additional page sizes (defined by each architecture adding to EXTRA_RUNS) 49run-test-mmap-%: test-mmap 50 $(call run-test, test-mmap-$*, $(QEMU) -p $* $<,\ 51 "$< ($* byte pages) on $(TARGET_NAME)") 52 53ifneq ($(HAVE_GDB_BIN),) 54GDB_SCRIPT=$(SRC_PATH)/tests/guest-debug/run-test.py 55 56run-gdbstub-sha1: sha1 57 $(call run-test, $@, $(GDB_SCRIPT) \ 58 --gdb $(HAVE_GDB_BIN) \ 59 --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ 60 --bin $< --test $(MULTIARCH_SRC)/gdbstub/sha1.py, \ 61 "basic gdbstub support") 62 63run-gdbstub-qxfer-auxv-read: sha1 64 $(call run-test, $@, $(GDB_SCRIPT) \ 65 --gdb $(HAVE_GDB_BIN) \ 66 --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ 67 --bin $< --test $(MULTIARCH_SRC)/gdbstub/test-qxfer-auxv-read.py, \ 68 "basic gdbstub qXfer:auxv:read support") 69 70run-gdbstub-thread-breakpoint: testthread 71 $(call run-test, $@, $(GDB_SCRIPT) \ 72 --gdb $(HAVE_GDB_BIN) \ 73 --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ 74 --bin $< --test $(MULTIARCH_SRC)/gdbstub/test-thread-breakpoint.py, \ 75 "hitting a breakpoint on non-main thread") 76 77else 78run-gdbstub-%: 79 $(call skip-test, "gdbstub test $*", "need working gdb") 80endif 81EXTRA_RUNS += run-gdbstub-sha1 run-gdbstub-qxfer-auxv-read \ 82 run-gdbstub-thread-breakpoint 83 84# ARM Compatible Semi Hosting Tests 85# 86# Despite having ARM in the name we actually have several 87# architectures that implement it. We gate the tests on the feature 88# appearing in config. 89# 90ifeq ($(CONFIG_ARM_COMPATIBLE_SEMIHOSTING),y) 91VPATH += $(MULTIARCH_SRC)/arm-compat-semi 92 93# Add -I path back to TARGET_NAME for semicall.h 94semihosting: CFLAGS+=-I$(SRC_PATH)/tests/tcg/$(TARGET_NAME) 95 96run-semihosting: semihosting 97 $(call run-test,$<,$(QEMU) $< 2> $<.err, "$< on $(TARGET_NAME)") 98 99run-plugin-semihosting-with-%: 100 $(call run-test, $@, $(QEMU) $(QEMU_OPTS) \ 101 -plugin $(PLUGIN_LIB)/$(call extract-plugin,$@) \ 102 $(call strip-plugin,$<) 2> $<.err, \ 103 "$< on $(TARGET_NAME) with $*") 104 105semiconsole: CFLAGS+=-I$(SRC_PATH)/tests/tcg/$(TARGET_NAME) 106 107run-semiconsole: semiconsole 108 $(call skip-test, $<, "MANUAL ONLY") 109 110run-plugin-semiconsole-with-%: 111 $(call skip-test, $<, "MANUAL ONLY") 112 113TESTS += semihosting semiconsole 114endif 115 116# Update TESTS 117TESTS += $(MULTIARCH_TESTS) 118