[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 47/54] tests/tcg: enable plugin testing
From: |
Alex Bennée |
Subject: |
[Qemu-devel] [PATCH v4 47/54] tests/tcg: enable plugin testing |
Date: |
Wed, 31 Jul 2019 17:07:12 +0100 |
If CONFIG_PLUGINS is enabled then lets enable testing for all our TCG
targets. This is a simple smoke test that ensure we don't crash or
otherwise barf out by running each plugin against each test.
There is a minor knock on effect for additional runners which need
specialised QEMU_OPTS which will also need to declare a plugin version
of the runner. If this gets onerous we might need to add another
helper.
Checking the results of the plugins is left for a later exercise.
Signed-off-by: Alex Bennée <address@hidden>
---
tests/Makefile.include | 10 +++++++-
tests/tcg/Makefile | 34 +++++++++++++++++++++++++++
tests/tcg/arm/Makefile.softmmu-target | 1 +
3 files changed, 44 insertions(+), 1 deletion(-)
diff --git a/tests/Makefile.include b/tests/Makefile.include
index fd7fdb86586..0611aede077 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -1052,6 +1052,14 @@ check-softfloat:
"SKIPPED for non-TCG builds")
endif
+# Plugins
+ifeq ($(CONFIG_PLUGIN),y)
+plugins:
+ $(call quiet-command,\
+ $(MAKE) $(SUBDIR_MAKEFLAGS) -C tests/plugin V="$(V)", \
+ "BUILD", "plugins")
+endif
+
# Per guest TCG tests
BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(TARGET_DIRS))
@@ -1066,7 +1074,7 @@ $(foreach PROBE_TARGET,$(TARGET_DIRS),
\
$(eval build-tcg-tests-$(PROBE_TARGET): $(DOCKER_PREREQ))))
endif
-build-tcg-tests-%:
+build-tcg-tests-%: $(if $(CONFIG_PLUGIN),plugins)
$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" \
SKIP_DOCKER_BUILD=1 TARGET_DIR="$*/" guest-tests, \
"BUILD", "TCG tests for $*")
diff --git a/tests/tcg/Makefile b/tests/tcg/Makefile
index 9f567686240..8341a5345bc 100644
--- a/tests/tcg/Makefile
+++ b/tests/tcg/Makefile
@@ -120,11 +120,37 @@ all: $(TESTS)
#
RUN_TESTS=$(patsubst %,run-%, $(TESTS))
+
+# If plugins exist also include those in the tests
+ifeq ($(CONFIG_PLUGIN),y)
+PLUGIN_DIR=../../tests/plugin
+VPATH+=$(PLUGIN_DIR)
+PLUGINS=$(notdir $(wildcard $(PLUGIN_DIR)/*.so))
+
+# We need to ensure expand the run-plugin-TEST-with-PLUGIN
+# pre-requistes manually here as we can't use stems to handle it. We
+# also add some special helpers the run-plugin- rules can use bellow.
+
+$(foreach p,$(PLUGINS), \
+ $(foreach t,$(TESTS),\
+ $(eval run-plugin-$(t)-with-$(p): $t $p) \
+ $(eval RUN_TESTS+=run-plugin-$(t)-with-$(p))))
+endif
+
+strip-plugin = $(wordlist 1, 1, $(subst -with-, ,$1))
+extract-plugin = $(wordlist 2, 2, $(subst -with-, ,$1))
+
RUN_TESTS+=$(EXTRA_RUNS)
ifdef CONFIG_USER_ONLY
run-%: %
$(call run-test, $<, $(QEMU) $(QEMU_OPTS) $<, "$< on $(TARGET_NAME)")
+
+run-plugin-%:
+ $(call run-test, $@, $(QEMU) $(QEMU_OPTS) \
+ -plugin $(PLUGIN_DIR)/$(call extract-plugin,$@) \
+ $(call strip-plugin,$<), \
+ "$< on $(TARGET_NAME)")
else
run-%: %
$(call run-test, $<, \
@@ -132,6 +158,14 @@ run-%: %
-chardev file$(COMMA)path=$<.out$(COMMA)id=output \
$(QEMU_OPTS) $<, \
"$< on $(TARGET_NAME)")
+
+run-plugin-%:
+ $(call run-test, $@, \
+ $(QEMU) -monitor none -display none \
+ -chardev file$(COMMA)path=$@.out$(COMMA)id=output \
+ -plugin $(PLUGIN_DIR)/$(call extract-plugin,$@) \
+ $(QEMU_OPTS) $(call strip-plugin,$<), \
+ "$< on $(TARGET_NAME)")
endif
gdb-%: %
diff --git a/tests/tcg/arm/Makefile.softmmu-target
b/tests/tcg/arm/Makefile.softmmu-target
index 49d48d8a1c3..cd628306b3e 100644
--- a/tests/tcg/arm/Makefile.softmmu-target
+++ b/tests/tcg/arm/Makefile.softmmu-target
@@ -25,5 +25,6 @@ LDFLAGS+=-nostdlib -N -static
test-armv6m-undef: EXTRA_CFLAGS+=-mcpu=cortex-m0
run-test-armv6m-undef: QEMU_OPTS+=-semihosting -M microbit -kernel
+run-plugin-test-armv6m-undef-%: QEMU_OPTS+=-semihosting -M microbit -kernel
endif
--
2.20.1
- [Qemu-devel] [PATCH v4 51/54] tests/plugin: add hotpages plugin to breakdown memory access patterns, (continued)
- [Qemu-devel] [PATCH v4 51/54] tests/plugin: add hotpages plugin to breakdown memory access patterns, Alex Bennée, 2019/07/31
- [Qemu-devel] [PATCH v4 25/54] translate-all: notify plugin code of tb_flush, Alex Bennée, 2019/07/31
- [Qemu-devel] [PATCH v4 50/54] tests/plugin: add instruction execution breakdown, Alex Bennée, 2019/07/31
- [Qemu-devel] [PATCH v4 23/54] tcg: let plugins instrument virtual memory accesses, Alex Bennée, 2019/07/31
- [Qemu-devel] [PATCH v4 20/54] plugin-gen: add module for TCG-related code, Alex Bennée, 2019/07/31
- [Qemu-devel] [PATCH v4 17/54] cputlb: document get_page_addr_code, Alex Bennée, 2019/07/31
- [Qemu-devel] [PATCH v4 38/54] target/riscv: fetch code with translator_ld, Alex Bennée, 2019/07/31
- [Qemu-devel] [PATCH v4 36/54] target/m68k: fetch code with translator_ld, Alex Bennée, 2019/07/31
- [Qemu-devel] [PATCH v4 49/54] plugin: add qemu_plugin_insn_disas helper, Alex Bennée, 2019/07/31
- [Qemu-devel] [PATCH v4 52/54] accel/stubs: reduce headers from tcg-stub, Alex Bennée, 2019/07/31
- [Qemu-devel] [PATCH v4 47/54] tests/tcg: enable plugin testing,
Alex Bennée <=
- [Qemu-devel] [PATCH v4 34/54] target/i386: fetch code with translator_ld, Alex Bennée, 2019/07/31
- [Qemu-devel] [PATCH v4 24/54] plugins: implement helpers for resolving hwaddr, Alex Bennée, 2019/07/31
- [Qemu-devel] [PATCH v4 48/54] tests/plugin: add a hotblocks plugin, Alex Bennée, 2019/07/31
- [Qemu-devel] [PATCH v4 35/54] target/hppa: fetch code with translator_ld, Alex Bennée, 2019/07/31
- [Qemu-devel] [PATCH v4 46/54] tests/plugin: add sample plugins, Alex Bennée, 2019/07/31
- [Qemu-devel] [PATCH v4 26/54] *-user: notify plugin of exit, Alex Bennée, 2019/07/31
- [Qemu-devel] [PATCH v4 16/54] queue: add QTAILQ_REMOVE_SEVERAL, Alex Bennée, 2019/07/31
- [Qemu-devel] [PATCH v4 43/54] plugin: add API symbols to qemu-plugins.symbols, Alex Bennée, 2019/07/31
- [Qemu-devel] [PATCH v4 21/54] atomic_template: fix indentation in GEN_ATOMIC_HELPER, Alex Bennée, 2019/07/31
- [Qemu-devel] [PATCH v4 28/54] cpu: hook plugin vcpu events, Alex Bennée, 2019/07/31