aboutsummaryrefslogtreecommitdiff
path: root/tests/tcg/multiarch/Makefile.target
blob: dec401e67fdd9a8fec2eee3dc6b39660690e6dd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# -*- Mode: makefile -*-
#
# Multiarch Tests - included from tests/tcg/Makefile.target
#
# These tests are plain C and built without any architecture specific code.
#

MULTIARCH_SRC=$(SRC_PATH)/tests/tcg/multiarch

# Set search path for all sources
VPATH 	       += $(MULTIARCH_SRC)
MULTIARCH_SRCS =  $(notdir $(wildcard $(MULTIARCH_SRC)/*.c))
ifneq ($(CONFIG_LINUX_USER),)
VPATH 	       += $(MULTIARCH_SRC)/linux
MULTIARCH_SRCS += $(notdir $(wildcard $(MULTIARCH_SRC)/linux/*.c))
endif
MULTIARCH_TESTS = $(MULTIARCH_SRCS:.c=)

#
# The following are any additional rules needed to build things
#


float_%: LDFLAGS+=-lm
float_%: float_%.c libs/float_helpers.c
	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< $(MULTIARCH_SRC)/libs/float_helpers.c -o $@ $(LDFLAGS)

run-float_%: float_%
	$(call run-test,$<, $(QEMU) $(QEMU_OPTS) $<,"$< on $(TARGET_NAME)")
	$(call conditional-diff-out,$<,$(SRC_PATH)/tests/tcg/$(TARGET_NAME)/$<.ref)


testthread: LDFLAGS+=-lpthread

threadcount: LDFLAGS+=-lpthread

signals: LDFLAGS+=-lrt -lpthread

# We define the runner for test-mmap after the individual
# architectures have defined their supported pages sizes. If no
# additional page sizes are defined we only run the default test.

# default case (host page size)
run-test-mmap: test-mmap
	$(call run-test, test-mmap, $(QEMU) $<, \
		"$< (default) on $(TARGET_NAME)")

# additional page sizes (defined by each architecture adding to EXTRA_RUNS)
run-test-mmap-%: test-mmap
	$(call run-test, test-mmap-$*, $(QEMU) -p $* $<,\
		"$< ($* byte pages) on $(TARGET_NAME)")

ifneq ($(HAVE_GDB_BIN),)
GDB_SCRIPT=$(SRC_PATH)/tests/guest-debug/run-test.py

run-gdbstub-sha1: sha1
	$(call run-test, $@, $(GDB_SCRIPT) \
		--gdb $(HAVE_GDB_BIN) \
		--qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
		--bin $< --test $(MULTIARCH_SRC)/gdbstub/sha1.py, \
	"basic gdbstub support")

run-gdbstub-qxfer-auxv-read: sha1
	$(call run-test, $@, $(GDB_SCRIPT) \
		--gdb $(HAVE_GDB_BIN) \
		--qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
		--bin $< --test $(MULTIARCH_SRC)/gdbstub/test-qxfer-auxv-read.py, \
	"basic gdbstub qXfer:auxv:read support")

run-gdbstub-thread-breakpoint: testthread
	$(call run-test, $@, $(GDB_SCRIPT) \
		--gdb $(HAVE_GDB_BIN) \
		--qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
		--bin $< --test $(MULTIARCH_SRC)/gdbstub/test-thread-breakpoint.py, \
	"hitting a breakpoint on non-main thread")

else
run-gdbstub-%:
	$(call skip-test, "gdbstub test $*", "need working gdb")
endif
EXTRA_RUNS += run-gdbstub-sha1 run-gdbstub-qxfer-auxv-read \
	      run-gdbstub-thread-breakpoint

# ARM Compatible Semi Hosting Tests
#
# Despite having ARM in the name we actually have several
# architectures that implement it. We gate the tests on the feature
# appearing in config.
#
ifeq ($(CONFIG_ARM_COMPATIBLE_SEMIHOSTING),y)
VPATH += $(MULTIARCH_SRC)/arm-compat-semi

# Add -I path back to TARGET_NAME for semicall.h
semihosting: CFLAGS+=-I$(SRC_PATH)/tests/tcg/$(TARGET_NAME)

run-semihosting: semihosting
	$(call run-test,$<,$(QEMU) $< 2> $<.err, "$< on $(TARGET_NAME)")

run-plugin-semihosting-with-%:
	$(call run-test, $@, $(QEMU) $(QEMU_OPTS) \
		-plugin $(PLUGIN_LIB)/$(call extract-plugin,$@) \
		 $(call strip-plugin,$<) 2> $<.err, \
		"$< on $(TARGET_NAME) with $*")

semiconsole: CFLAGS+=-I$(SRC_PATH)/tests/tcg/$(TARGET_NAME)

run-semiconsole: semiconsole
	$(call skip-test, $<, "MANUAL ONLY")

run-plugin-semiconsole-with-%:
	$(call skip-test, $<, "MANUAL ONLY")

TESTS += semihosting semiconsole
endif

# Update TESTS
TESTS += $(MULTIARCH_TESTS)