mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00

At first I thought I could compile the user-mode test for system mode however we already have a fairly comprehensive test case for system mode in "memory" so lets use that. As tracking every access will quickly build up with "print-access" we add a new mode to track groups of reads and writes to regions. Because the test_data is 16k aligned we can be sure all accesses to it are ones we can count. First we extend the test to report where the test_data region is. Then we expand the pdot() function to track the total number of reads and writes to the region. We have to add some addition pdot() calls to take into account multiple reads/writes in the test loops. Finally we add a python script to integrate the data from the plugin and the output of the test and validate they both agree on the total counts. As some boot codes clear the bss we also add a flag to add a regions worth of writes to the expected total. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Message-Id: <20240916085400.1046925-14-alex.bennee@linaro.org>
73 lines
2.5 KiB
Makefile
73 lines
2.5 KiB
Makefile
# -*- Mode: makefile -*-
|
|
#
|
|
# Multiarch system tests
|
|
#
|
|
# We just collect the tests together here and rely on the actual guest
|
|
# architecture to add to the test dependencies and deal with the
|
|
# complications of building.
|
|
#
|
|
|
|
MULTIARCH_SRC=$(SRC_PATH)/tests/tcg/multiarch
|
|
MULTIARCH_SYSTEM_SRC=$(MULTIARCH_SRC)/system
|
|
VPATH+=$(MULTIARCH_SYSTEM_SRC)
|
|
|
|
MULTIARCH_TEST_SRCS=$(wildcard $(MULTIARCH_SYSTEM_SRC)/*.c)
|
|
MULTIARCH_TESTS = $(patsubst $(MULTIARCH_SYSTEM_SRC)/%.c, %, $(MULTIARCH_TEST_SRCS))
|
|
|
|
ifneq ($(GDB),)
|
|
GDB_SCRIPT=$(SRC_PATH)/tests/guest-debug/run-test.py
|
|
|
|
run-gdbstub-memory: memory
|
|
$(call run-test, $@, $(GDB_SCRIPT) \
|
|
--gdb $(GDB) \
|
|
--qemu $(QEMU) \
|
|
--output $<.gdb.out \
|
|
--qargs \
|
|
"-monitor none -display none -chardev file$(COMMA)path=$<.out$(COMMA)id=output $(QEMU_OPTS)" \
|
|
--bin $< --test $(MULTIARCH_SRC)/gdbstub/memory.py, \
|
|
softmmu gdbstub support)
|
|
run-gdbstub-interrupt: interrupt
|
|
$(call run-test, $@, $(GDB_SCRIPT) \
|
|
--gdb $(GDB) \
|
|
--qemu $(QEMU) \
|
|
--output $<.gdb.out \
|
|
--qargs \
|
|
"-smp 2 -monitor none -display none -chardev file$(COMMA)path=$<.out$(COMMA)id=output $(QEMU_OPTS)" \
|
|
--bin $< --test $(MULTIARCH_SRC)/gdbstub/interrupt.py, \
|
|
softmmu gdbstub support)
|
|
run-gdbstub-untimely-packet: hello
|
|
$(call run-test, $@, $(GDB_SCRIPT) \
|
|
--gdb $(GDB) \
|
|
--gdb-args "-ex 'set debug remote 1'" \
|
|
--output untimely-packet.gdb.out \
|
|
--stderr untimely-packet.gdb.err \
|
|
--qemu $(QEMU) \
|
|
--bin $< --qargs \
|
|
"-monitor none -display none -chardev file$(COMMA)path=untimely-packet.out$(COMMA)id=output $(QEMU_OPTS)", \
|
|
softmmu gdbstub untimely packets)
|
|
$(call quiet-command, \
|
|
(! grep -Fq 'Packet instead of Ack, ignoring it' untimely-packet.gdb.err), \
|
|
"GREP", file untimely-packet.gdb.err)
|
|
|
|
run-gdbstub-registers: memory
|
|
$(call run-test, $@, $(GDB_SCRIPT) \
|
|
--gdb $(GDB) \
|
|
--qemu $(QEMU) \
|
|
--output $<.registers.gdb.out \
|
|
--qargs \
|
|
"-monitor none -display none -chardev file$(COMMA)path=$<.out$(COMMA)id=output $(QEMU_OPTS)" \
|
|
--bin $< --test $(MULTIARCH_SRC)/gdbstub/registers.py, \
|
|
softmmu gdbstub support)
|
|
else
|
|
run-gdbstub-%:
|
|
$(call skip-test, "gdbstub test $*", "need working gdb with $(patsubst -%,,$(TARGET_NAME)) support")
|
|
endif
|
|
|
|
MULTIARCH_RUNS += run-gdbstub-memory run-gdbstub-interrupt \
|
|
run-gdbstub-untimely-packet run-gdbstub-registers
|
|
|
|
# Test plugin memory access instrumentation
|
|
run-plugin-memory-with-libmem.so: \
|
|
PLUGIN_ARGS=$(COMMA)region-summary=true
|
|
run-plugin-memory-with-libmem.so: \
|
|
CHECK_PLUGIN_OUTPUT_COMMAND=$(MULTIARCH_SYSTEM_SRC)/validate-memory-counts.py $@.out
|