aboutsummaryrefslogtreecommitdiff
path: root/tests/tcg/Makefile.target
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tcg/Makefile.target')
-rw-r--r--tests/tcg/Makefile.target43
1 files changed, 41 insertions, 2 deletions
diff --git a/tests/tcg/Makefile.target b/tests/tcg/Makefile.target
index 5a9a6faba4..3c7421a356 100644
--- a/tests/tcg/Makefile.target
+++ b/tests/tcg/Makefile.target
@@ -30,7 +30,7 @@
#
all:
--include ../../config-host.mak
+-include ../../../config-host.mak
-include ../config-$(TARGET).mak
# for including , in command strings
@@ -66,6 +66,8 @@ conditional-diff-out = \
# Tests we are building
TESTS=
+# additional tests which may re-use existing binaries
+EXTRA_TESTS=
# Start with a blank slate, the build targets get to add stuff first
CFLAGS=
@@ -109,7 +111,7 @@ else
endif
-all: $(TESTS)
+all: $(TESTS) $(EXTRA_TESTS)
#
# Test Runners
@@ -121,11 +123,39 @@ all: $(TESTS)
#
RUN_TESTS=$(patsubst %,run-%, $(TESTS))
+
+# If plugins exist also include those in the tests
+ifeq ($(CONFIG_PLUGIN),y)
+PLUGIN_DIR=../../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-plugin-$(t)-with-$(p): TIMEOUT=30) \
+ $(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,$@) \
+ -d plugin -D $*.pout \
+ $(call strip-plugin,$<), \
+ "$* on $(TARGET_NAME)")
else
run-%: %
$(call run-test, $<, \
@@ -133,6 +163,15 @@ 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,$@) \
+ -d plugin -D $*.pout \
+ $(QEMU_OPTS) $(call strip-plugin,$<), \
+ "$* on $(TARGET_NAME)")
endif
gdb-%: %