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$(info SRCS=${MULTIARCH_SRCS} and ${MULTIARCH_TESTS})
20#
21# The following are any additional rules needed to build things
22#
23
24
25float_%: LDFLAGS+=-lm
26float_%: float_%.c libs/float_helpers.c
27	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< $(MULTIARCH_SRC)/libs/float_helpers.c -o $@ $(LDFLAGS)
28
29run-float_%: float_%
30	$(call run-test,$<, $(QEMU) $(QEMU_OPTS) $<,"$< on $(TARGET_NAME)")
31	$(call conditional-diff-out,$<,$(SRC_PATH)/tests/tcg/$(TARGET_NAME)/$<.ref)
32
33
34testthread: LDFLAGS+=-lpthread
35
36threadcount: LDFLAGS+=-lpthread
37
38signals: LDFLAGS+=-lrt -lpthread
39
40# We define the runner for test-mmap after the individual
41# architectures have defined their supported pages sizes. If no
42# additional page sizes are defined we only run the default test.
43
44# default case (host page size)
45run-test-mmap: test-mmap
46	$(call run-test, test-mmap, $(QEMU) $<, \
47		"$< (default) on $(TARGET_NAME)")
48
49# additional page sizes (defined by each architecture adding to EXTRA_RUNS)
50run-test-mmap-%: test-mmap
51	$(call run-test, test-mmap-$*, $(QEMU) -p $* $<,\
52		"$< ($* byte pages) on $(TARGET_NAME)")
53
54ifneq ($(HAVE_GDB_BIN),)
55GDB_SCRIPT=$(SRC_PATH)/tests/guest-debug/run-test.py
56
57run-gdbstub-sha1: sha1
58	$(call run-test, $@, $(GDB_SCRIPT) \
59		--gdb $(HAVE_GDB_BIN) \
60		--qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
61		--bin $< --test $(MULTIARCH_SRC)/gdbstub/sha1.py, \
62	"basic gdbstub support")
63
64EXTRA_RUNS += run-gdbstub-sha1
65
66run-gdbstub-qxfer-auxv-read: sha1
67	$(call run-test, $@, $(GDB_SCRIPT) \
68		--gdb $(HAVE_GDB_BIN) \
69		--qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
70		--bin $< --test $(MULTIARCH_SRC)/gdbstub/test-qxfer-auxv-read.py, \
71	"basic gdbstub qXfer:auxv:read support")
72
73else
74run-gdbstub-%:
75	$(call skip-test, "gdbstub test $*", "need working gdb")
76endif
77EXTRA_RUNS += run-gdbstub-sha1 run-gdbstub-qxfer-auxv-read
78
79# ARM Compatible Semi Hosting Tests
80#
81# Despite having ARM in the name we actually have several
82# architectures that implement it. We gate the tests on the feature
83# appearing in config.
84#
85ifeq ($(CONFIG_ARM_COMPATIBLE_SEMIHOSTING),y)
86VPATH += $(MULTIARCH_SRC)/arm-compat-semi
87
88# Add -I path back to TARGET_NAME for semicall.h
89semihosting: CFLAGS+=-I$(SRC_PATH)/tests/tcg/$(TARGET_NAME)
90
91run-semihosting: semihosting
92	$(call run-test,$<,$(QEMU) $< 2> $<.err, "$< on $(TARGET_NAME)")
93
94run-plugin-semihosting-with-%:
95	$(call run-test, $@, $(QEMU) $(QEMU_OPTS) \
96		-plugin $(PLUGIN_LIB)/$(call extract-plugin,$@) \
97		 $(call strip-plugin,$<) 2> $<.err, \
98		"$< on $(TARGET_NAME) with $*")
99
100semiconsole: CFLAGS+=-I$(SRC_PATH)/tests/tcg/$(TARGET_NAME)
101
102run-semiconsole: semiconsole
103	$(call skip-test, $<, "MANUAL ONLY")
104
105run-plugin-semiconsole-with-%:
106	$(call skip-test, $<, "MANUAL ONLY")
107
108TESTS += semihosting semiconsole
109endif
110
111# Update TESTS
112TESTS += $(MULTIARCH_TESTS)
113