]> git.proxmox.com Git - mirror_qemu.git/blobdiff - tests/tcg/Makefile.target
semihosting: move semihosting tests to multiarch
[mirror_qemu.git] / tests / tcg / Makefile.target
index 8808beaf74b7551490a2c504ae8268b1d95734f9..cab8c6b3a2dab4f88deac8f5de77be6dce8b3474 100644 (file)
 #
 
 all:
--include ../../config-host.mak
+-include ../../../config-host.mak
 -include ../config-$(TARGET).mak
+ifeq ($(CONFIG_USER_ONLY),y)
+-include $(SRC_PATH)/default-configs/targets/$(TARGET).mak
+endif
 
 # for including , in command strings
 COMMA := ,
@@ -55,8 +58,19 @@ diff-out = $(call quiet-command, diff -q $1.out $2 || \
 # $1 = test name, $2 = reason
 skip-test = @printf "  SKIPPED %s on $(TARGET_NAME) because %s\n" $1 $2
 
+# $1 = test name, $2 = reference
+# As above but only diff if reference file exists, otherwise the test
+# passes if it managed to complete with a status of zero
+conditional-diff-out =                                                         \
+       $(if $(wildcard $2),                                            \
+               $(call diff-out,$1,$2),                                 \
+               $(call skip-test,"$1 check","no reference"))
+
+
 # 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=
@@ -68,19 +82,22 @@ QEMU_OPTS=
 
 # If TCG debugging is enabled things are a lot slower
 ifeq ($(CONFIG_DEBUG_TCG),y)
-TIMEOUT=45
+TIMEOUT=60
 else
 TIMEOUT=15
 endif
 
 ifdef CONFIG_USER_ONLY
-# The order we include is important. We include multiarch, base arch
-# and finally arch if it's not the same as base arch.
+# The order we include is important. We include multiarch first and
+# then the target. If there are common tests shared between
+# sub-targets (e.g. ARM & AArch64) then it is up to
+# $(TARGET_NAME)/Makefile.target to include the common parent
+# architecture in its VPATH.
 -include $(SRC_PATH)/tests/tcg/multiarch/Makefile.target
 -include $(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.target
 
 # Add the common build options
-CFLAGS+=-Wall -O0 -g -fno-strict-aliasing
+CFLAGS+=-Wall -Werror -O0 -g -fno-strict-aliasing
 ifeq ($(BUILD_STATIC),y)
 LDFLAGS+=-static
 endif
@@ -97,7 +114,7 @@ else
 
 endif
 
-all: $(TESTS)
+all: $(TESTS) $(EXTRA_TESTS)
 
 #
 # Test Runners
@@ -109,11 +126,40 @@ all: $(TESTS)
 #
 
 RUN_TESTS=$(patsubst %,run-%, $(TESTS))
+
+# If plugins exist also include those in the tests
+ifeq ($(CONFIG_PLUGIN),y)
+PLUGIN_SRC=$(SRC_PATH)/tests/plugin
+PLUGIN_LIB=../../plugin
+VPATH+=$(PLUGIN_LIB)
+PLUGINS=$(patsubst %.c, lib%.so, $(notdir $(wildcard $(PLUGIN_SRC)/*.c)))
+
+# 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=60) \
+               $(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_LIB)/$(call extract-plugin,$@) \
+               -d plugin -D $*.pout \
+                $(call strip-plugin,$<), \
+       "$* on $(TARGET_NAME)")
 else
 run-%: %
        $(call run-test, $<, \
@@ -121,6 +167,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_LIB)/$(call extract-plugin,$@) \
+                 -d plugin -D $*.pout \
+                 $(QEMU_OPTS) $(call strip-plugin,$<), \
+         "$* on $(TARGET_NAME)")
 endif
 
 gdb-%: %