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