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