1# -*- Mode: makefile -*-
2#
3# Multiarch system tests
4#
5# We just collect the tests together here and rely on the actual guest
6# architecture to add to the test dependencies and deal with the
7# complications of building.
8#
9
10MULTIARCH_SRC=$(SRC_PATH)/tests/tcg/multiarch
11MULTIARCH_SYSTEM_SRC=$(MULTIARCH_SRC)/system
12VPATH+=$(MULTIARCH_SYSTEM_SRC)
13
14MULTIARCH_TEST_SRCS=$(wildcard $(MULTIARCH_SYSTEM_SRC)/*.c)
15MULTIARCH_TESTS = $(patsubst $(MULTIARCH_SYSTEM_SRC)/%.c, %, $(MULTIARCH_TEST_SRCS))
16
17ifneq ($(GDB),)
18GDB_SCRIPT=$(SRC_PATH)/tests/guest-debug/run-test.py
19
20run-gdbstub-memory: memory
21	$(call run-test, $@, $(GDB_SCRIPT) \
22		--gdb $(GDB) \
23		--qemu $(QEMU) \
24		--output $<.gdb.out \
25		--qargs \
26		"-monitor none -display none -chardev file$(COMMA)path=$<.out$(COMMA)id=output $(QEMU_OPTS)" \
27		--bin $< --test $(MULTIARCH_SRC)/gdbstub/memory.py, \
28	softmmu gdbstub support)
29run-gdbstub-interrupt: interrupt
30	$(call run-test, $@, $(GDB_SCRIPT) \
31		--gdb $(GDB) \
32		--qemu $(QEMU) \
33		--output $<.gdb.out \
34		--qargs \
35		"-smp 2 -monitor none -display none -chardev file$(COMMA)path=$<.out$(COMMA)id=output $(QEMU_OPTS)" \
36		--bin $< --test $(MULTIARCH_SRC)/gdbstub/interrupt.py, \
37	softmmu gdbstub support)
38run-gdbstub-untimely-packet: hello
39	$(call run-test, $@, $(GDB_SCRIPT) \
40		--gdb $(GDB) \
41		--gdb-args "-ex 'set debug remote 1'" \
42		--output untimely-packet.gdb.out \
43		--stderr untimely-packet.gdb.err \
44		--qemu $(QEMU) \
45		--bin $< --qargs \
46		"-monitor none -display none -chardev file$(COMMA)path=untimely-packet.out$(COMMA)id=output $(QEMU_OPTS)", \
47	softmmu gdbstub untimely packets)
48	$(call quiet-command, \
49		(! grep -Fq 'Packet instead of Ack, ignoring it' untimely-packet.gdb.err), \
50		"GREP", file untimely-packet.gdb.err)
51
52run-gdbstub-registers: memory
53	$(call run-test, $@, $(GDB_SCRIPT) \
54		--gdb $(GDB) \
55		--qemu $(QEMU) \
56		--output $<.registers.gdb.out \
57		--qargs \
58		"-monitor none -display none -chardev file$(COMMA)path=$<.out$(COMMA)id=output $(QEMU_OPTS)" \
59		--bin $< --test $(MULTIARCH_SRC)/gdbstub/registers.py, \
60	softmmu gdbstub support)
61else
62run-gdbstub-%:
63	$(call skip-test, "gdbstub test $*", "need working gdb with $(patsubst -%,,$(TARGET_NAME)) support")
64endif
65
66MULTIARCH_RUNS += run-gdbstub-memory run-gdbstub-interrupt \
67	run-gdbstub-untimely-packet run-gdbstub-registers
68
69# Test plugin memory access instrumentation
70run-plugin-memory-with-libmem.so: 		\
71	PLUGIN_ARGS=$(COMMA)region-summary=true
72run-plugin-memory-with-libmem.so: 		\
73	CHECK_PLUGIN_OUTPUT_COMMAND=$(MULTIARCH_SYSTEM_SRC)/validate-memory-counts.py $@.out
74