Lines Matching +full:build +full:- +full:tcg +full:- +full:disabled

1 # -*- Mode: makefile -*-
3 # TCG tests
5 # These are complicated by the fact we want to build them for guest
7 # ones we have cross-compilers for or docker images with
8 # cross-compilers.
11 # cross-compilers don't always have a large amount of libraries
14 # We only include the host build system for SRC_PATH and we don't
17 # CC - the C compiler command
18 # EXTRA_CFLAGS - any extra CFLAGS
19 # BUILD_STATIC - are we building static binaries
23 # cross-compiler can only build dynamic libraries the user might need
29 # We also expect to be in the tests build dir for the FOO-(linux-user|softmmu).
33 -include ../config-host.mak
34 -include config-target.mak
36 # Get semihosting definitions for user-mode emulation
37 ifeq ($(filter %-softmmu, $(TARGET)),)
38 -include $(SRC_PATH)/configs/targets/$(TARGET).mak
45 TARGET_PREFIX=tests/tcg/$(TARGET):$(SPACE)
47 quiet-@ = $(if $(V),,@$(if $1,printf " %-7s %s\n" "$(strip $1)" "$(strip $2)" && ))
48 quiet-command = $(call quiet-@,$2,$3)$1
50 cc-test = $(CC) -Werror $1 -c -o /dev/null -xc /dev/null >/dev/null 2>&1
51 cc-option = if $(call cc-test, $1); then \
56 ifeq ($(filter %-softmmu, $(TARGET)),)
57 run-test = $(call quiet-command, timeout -s KILL --foreground $(TIMEOUT) $2 > $1.out, \
60 run-test = $(call quiet-command, timeout -s KILL --foreground $(TIMEOUT) $2, \
67 diff-out = $(call quiet-command, diff -q $1.out $2 || \
68 (diff -u $1.out $2 | head -n 10 && false), \
72 skip-test = @printf " SKIPPED %s on $(TARGET_NAME) because %s\n" $1 $2
77 conditional-diff-out = \
79 $(call diff-out,$1,$2), \
80 $(call skip-test,"$1 check","no reference"))
85 # additional tests which may re-use existing binaries
88 # Start with a blank slate, the build targets get to add stuff first
96 # If TCG debugging, or TCI is enabled things are a lot slower
101 ifeq ($(filter %-softmmu, $(TARGET)),)
104 # sub-targets (e.g. ARM & AArch64) then it is up to
107 # can't even build the multiarch tests.
109 -include $(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.target
111 -include $(SRC_PATH)/tests/tcg/multiarch/Makefile.target
112 -include $(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.target
115 # Add the common build options
116 CFLAGS+=-Wall -Werror -O0 -g -fno-strict-aliasing
118 LDFLAGS+=-static
122 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
124 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -Wa,--noexecstack $< -o $@ $(LDFLAGS)
127 # build options for bare programs are usually pretty different. They
128 # are expected to provide their own build recipes.
129 EXTRA_CFLAGS += -ffreestanding -fno-stack-protector
135 -include $(SRC_PATH)/tests/tcg/minilib/Makefile.target
136 -include $(SRC_PATH)/tests/tcg/multiarch/system/Makefile.softmmu-target
138 -include $(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.softmmu-target
153 RUN_TESTS=$(patsubst %,run-%, $(TESTS))
157 PLUGIN_SRC=$(SRC_PATH)/tests/tcg/plugins
160 # Some plugins need to be disabled for all tests to avoid exponential explosion.
161 # For example, libpatch.so only needs to run against the arch-specific patch
162 # target test, so we explicitly run it in the arch-specific Makefile.
166 ifneq ($(filter %-softmmu, $(TARGET)),)
170 PLUGINS=$(filter-out $(DISABLE_PLUGINS), \
173 strip-plugin = $(wordlist 1, 1, $(subst -with-, ,$1))
174 extract-plugin = $(wordlist 2, 2, $(subst -with-, ,$1))
175 extract-test = $(subst run-plugin-,,$(wordlist 1, 1, $(subst -with-, ,$1)))
177 # We need to ensure expand the run-plugin-TEST-with-PLUGIN
178 # pre-requistes manually here as we can't use stems to handle it. We
188 $(EXTRA_RUNS_WITH_PLUGIN),$(call extract-test,$(test)))
191 MULTIARCH_TESTS:=$(filter-out $(EXTRA_TESTS_WITH_PLUGIN), $(MULTIARCH_TESTS))
197 $(shell $(PYTHON) -c "print( ($(1) % $(2)) + 1 )")
204 $(eval run-plugin-$(_test)-with-$(_plugin): $(_test) $(_plugin)) \
205 $(eval RUN_TESTS+=run-plugin-$(_test)-with-$(_plugin)))
209 $(eval $(f): $(call extract-test,$(f)) $(call extract-plugin,$(f))))
218 # exercise things. We can define them on a per-test basis here.
219 run-plugin-%-with-libmem.so: PLUGIN_ARGS=$(COMMA)inline=true
221 ifeq ($(filter %-softmmu, $(TARGET)),)
222 run-%: %
223 $(call run-test, $<, env QEMU=$(QEMU) $(QEMU) $(QEMU_OPTS) $<)
225 run-plugin-%:
226 $(call run-test, $@, env QEMU=$(QEMU) $(QEMU) $(QEMU_OPTS) \
227 -plugin $(PLUGIN_LIB)/$(call extract-plugin,$@)$(PLUGIN_ARGS) \
228 -d plugin -D $*.pout \
229 $(call strip-plugin,$<))
231 $(call quiet-command, $(CHECK_PLUGIN_OUTPUT_COMMAND) $*.pout, \
232 TEST, check plugin $(call extract-plugin,$@) output \
233 with $(call strip-plugin,$<)))
235 run-%: %
236 $(call run-test, $<, \
237 $(QEMU) -monitor none -display none \
238 -chardev file$(COMMA)path=$<.out$(COMMA)id=output \
241 run-plugin-%:
242 $(call run-test, $@, \
243 $(QEMU) -monitor none -display none \
244 -chardev file$(COMMA)path=$@.out$(COMMA)id=output \
245 -plugin $(PLUGIN_LIB)/$(call extract-plugin,$@)$(PLUGIN_ARGS) \
246 -d plugin -D $*.pout \
247 $(QEMU_OPTS) $(call strip-plugin,$<))
249 $(call quiet-command, $(CHECK_PLUGIN_OUTPUT_COMMAND) $*.pout, \
250 TEST, check plugin $(call extract-plugin,$@) output \
251 with $(call strip-plugin,$<)))
254 gdb-%: %
255 gdb --args $(QEMU) $(QEMU_OPTS) $<
261 rm -f $(TESTS) *.o $(CLEANFILES)
264 rm -f config-cc.mak config-target.mak ../config-$(TARGET).mak
268 @echo "TCG tests help $(TARGET_NAME)"