xref: /qemu/tests/tcg/multiarch/Makefile.target (revision 620d0b49a40e24465472b667f19b5fb0c63a6f0c)
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 
8 MULTIARCH_SRC=$(SRC_PATH)/tests/tcg/multiarch
9 
10 # Set search path for all sources
11 VPATH 	       += $(MULTIARCH_SRC)
12 MULTIARCH_SRCS =  $(notdir $(wildcard $(MULTIARCH_SRC)/*.c))
13 ifneq ($(CONFIG_LINUX_USER),)
14 VPATH 	       += $(MULTIARCH_SRC)/linux
15 MULTIARCH_SRCS += $(notdir $(wildcard $(MULTIARCH_SRC)/linux/*.c))
16 endif
17 MULTIARCH_TESTS = $(MULTIARCH_SRCS:.c=)
18 
19 #
20 # The following are any additional rules needed to build things
21 #
22 
23 
24 float_%: LDFLAGS+=-lm
25 float_%: float_%.c libs/float_helpers.c
26 	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< $(MULTIARCH_SRC)/libs/float_helpers.c -o $@ $(LDFLAGS)
27 
28 run-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 
33 testthread: LDFLAGS+=-lpthread
34 
35 threadcount: LDFLAGS+=-lpthread
36 
37 signals: 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)
44 run-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)
49 run-test-mmap-%: test-mmap
50 	$(call run-test, test-mmap-$*, $(QEMU) -p $* $<,\
51 		"$< ($* byte pages) on $(TARGET_NAME)")
52 
53 ifneq ($(HAVE_GDB_BIN),)
54 GDB_SCRIPT=$(SRC_PATH)/tests/guest-debug/run-test.py
55 
56 run-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 
63 run-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 
70 run-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 
77 else
78 run-gdbstub-%:
79 	$(call skip-test, "gdbstub test $*", "need working gdb")
80 endif
81 EXTRA_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 #
90 ifeq ($(CONFIG_ARM_COMPATIBLE_SEMIHOSTING),y)
91 VPATH += $(MULTIARCH_SRC)/arm-compat-semi
92 
93 # Add -I path back to TARGET_NAME for semicall.h
94 semihosting: CFLAGS+=-I$(SRC_PATH)/tests/tcg/$(TARGET_NAME)
95 
96 run-semihosting: semihosting
97 	$(call run-test,$<,$(QEMU) $< 2> $<.err, "$< on $(TARGET_NAME)")
98 
99 run-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 
105 semiconsole: CFLAGS+=-I$(SRC_PATH)/tests/tcg/$(TARGET_NAME)
106 
107 run-semiconsole: semiconsole
108 	$(call skip-test, $<, "MANUAL ONLY")
109 
110 run-plugin-semiconsole-with-%:
111 	$(call skip-test, $<, "MANUAL ONLY")
112 
113 TESTS += semihosting semiconsole
114 endif
115 
116 # Update TESTS
117 TESTS += $(MULTIARCH_TESTS)
118