xref: /openbmc/qemu/tests/Makefile.include (revision 979a8902)
1# -*- Mode: makefile -*-
2
3.PHONY: check-help
4check-help:
5	@echo "Regression testing targets:"
6	@echo
7	@echo " $(MAKE) check                Run unit, qapi-schema, qtest and decodetree"
8	@echo
9	@echo " $(MAKE) check-qtest-TARGET   Run qtest tests for given target"
10	@echo " $(MAKE) check-qtest          Run qtest tests"
11	@echo " $(MAKE) check-unit           Run qobject tests"
12	@echo " $(MAKE) check-speed          Run qobject speed tests"
13	@echo " $(MAKE) check-qapi-schema    Run QAPI schema tests"
14	@echo " $(MAKE) check-block          Run block tests"
15	@echo " $(MAKE) check-tcg            Run TCG tests"
16	@echo " $(MAKE) check-softfloat      Run FPU emulation tests"
17	@echo " $(MAKE) check-acceptance     Run all acceptance (functional) tests"
18	@echo
19	@echo " $(MAKE) check-report.tap     Generates an aggregated TAP test report"
20	@echo " $(MAKE) check-venv           Creates a Python venv for tests"
21	@echo " $(MAKE) check-clean          Clean the tests and related data"
22	@echo
23	@echo
24	@echo "The variable SPEED can be set to control the gtester speed setting."
25	@echo "Default options are -k and (for $(MAKE) V=1) --verbose; they can be"
26	@echo "changed with variable GTESTER_OPTIONS."
27
28ifneq ($(wildcard config-host.mak),)
29export SRC_PATH
30
31# TODO don't duplicate $(SRC_PATH)/Makefile's qapi-py here
32qapi-py = $(SRC_PATH)/scripts/qapi/__init__.py \
33$(SRC_PATH)/scripts/qapi/commands.py \
34$(SRC_PATH)/scripts/qapi/common.py \
35$(SRC_PATH)/scripts/qapi/doc.py \
36$(SRC_PATH)/scripts/qapi/error.py \
37$(SRC_PATH)/scripts/qapi/events.py \
38$(SRC_PATH)/scripts/qapi/expr.py \
39$(SRC_PATH)/scripts/qapi/gen.py \
40$(SRC_PATH)/scripts/qapi/introspect.py \
41$(SRC_PATH)/scripts/qapi/parser.py \
42$(SRC_PATH)/scripts/qapi/schema.py \
43$(SRC_PATH)/scripts/qapi/source.py \
44$(SRC_PATH)/scripts/qapi/types.py \
45$(SRC_PATH)/scripts/qapi/visit.py \
46$(SRC_PATH)/scripts/qapi-gen.py
47
48# Get the list of all supported sysemu targets
49SYSEMU_TARGET_LIST := $(subst -softmmu.mak,,$(notdir \
50   $(wildcard $(SRC_PATH)/default-configs/*-softmmu.mak)))
51
52check-unit-y += tests/check-qdict$(EXESUF)
53check-unit-y += tests/check-block-qdict$(EXESUF)
54check-unit-$(CONFIG_SOFTMMU) += tests/test-char$(EXESUF)
55check-unit-y += tests/check-qnum$(EXESUF)
56check-unit-y += tests/check-qstring$(EXESUF)
57check-unit-y += tests/check-qlist$(EXESUF)
58check-unit-y += tests/check-qnull$(EXESUF)
59check-unit-y += tests/check-qobject$(EXESUF)
60check-unit-y += tests/check-qjson$(EXESUF)
61check-unit-y += tests/check-qlit$(EXESUF)
62check-unit-y += tests/test-qobject-output-visitor$(EXESUF)
63check-unit-y += tests/test-clone-visitor$(EXESUF)
64check-unit-y += tests/test-qobject-input-visitor$(EXESUF)
65check-unit-y += tests/test-qmp-cmds$(EXESUF)
66check-unit-y += tests/test-string-input-visitor$(EXESUF)
67check-unit-y += tests/test-string-output-visitor$(EXESUF)
68check-unit-y += tests/test-qmp-event$(EXESUF)
69check-unit-y += tests/test-opts-visitor$(EXESUF)
70check-unit-$(CONFIG_BLOCK) += tests/test-coroutine$(EXESUF)
71check-unit-y += tests/test-visitor-serialization$(EXESUF)
72check-unit-y += tests/test-iov$(EXESUF)
73check-unit-y += tests/test-bitmap$(EXESUF)
74check-unit-$(CONFIG_BLOCK) += tests/test-aio$(EXESUF)
75check-unit-$(CONFIG_BLOCK) += tests/test-aio-multithread$(EXESUF)
76check-unit-$(CONFIG_BLOCK) += tests/test-throttle$(EXESUF)
77check-unit-$(CONFIG_BLOCK) += tests/test-thread-pool$(EXESUF)
78check-unit-$(CONFIG_BLOCK) += tests/test-hbitmap$(EXESUF)
79check-unit-$(CONFIG_BLOCK) += tests/test-bdrv-drain$(EXESUF)
80check-unit-$(CONFIG_BLOCK) += tests/test-bdrv-graph-mod$(EXESUF)
81check-unit-$(CONFIG_BLOCK) += tests/test-blockjob$(EXESUF)
82check-unit-$(CONFIG_BLOCK) += tests/test-blockjob-txn$(EXESUF)
83check-unit-$(CONFIG_BLOCK) += tests/test-block-backend$(EXESUF)
84check-unit-$(CONFIG_BLOCK) += tests/test-block-iothread$(EXESUF)
85check-unit-$(CONFIG_BLOCK) += tests/test-image-locking$(EXESUF)
86check-unit-y += tests/test-x86-cpuid$(EXESUF)
87# all code tested by test-x86-cpuid is inside topology.h
88ifeq ($(CONFIG_SOFTMMU),y)
89check-unit-y += tests/test-xbzrle$(EXESUF)
90check-unit-$(CONFIG_POSIX) += tests/test-vmstate$(EXESUF)
91endif
92check-unit-y += tests/test-cutils$(EXESUF)
93check-unit-y += tests/test-shift128$(EXESUF)
94check-unit-y += tests/test-mul64$(EXESUF)
95check-unit-y += tests/test-int128$(EXESUF)
96# all code tested by test-int128 is inside int128.h
97check-unit-y += tests/rcutorture$(EXESUF)
98check-unit-y += tests/test-rcu-list$(EXESUF)
99check-unit-y += tests/test-rcu-simpleq$(EXESUF)
100check-unit-y += tests/test-rcu-tailq$(EXESUF)
101check-unit-y += tests/test-qdist$(EXESUF)
102check-unit-y += tests/test-qht$(EXESUF)
103check-unit-y += tests/test-qht-par$(EXESUF)
104check-unit-y += tests/test-bitops$(EXESUF)
105check-unit-y += tests/test-bitcnt$(EXESUF)
106check-unit-y += tests/test-qdev-global-props$(EXESUF)
107check-unit-y += tests/check-qom-interface$(EXESUF)
108check-unit-y += tests/check-qom-proplist$(EXESUF)
109check-unit-y += tests/test-qemu-opts$(EXESUF)
110check-unit-y += tests/test-keyval$(EXESUF)
111check-unit-$(CONFIG_BLOCK) += tests/test-write-threshold$(EXESUF)
112check-unit-$(CONFIG_BLOCK) += tests/test-crypto-hash$(EXESUF)
113check-speed-$(CONFIG_BLOCK) += tests/benchmark-crypto-hash$(EXESUF)
114check-unit-$(CONFIG_BLOCK) += tests/test-crypto-hmac$(EXESUF)
115check-speed-$(CONFIG_BLOCK) += tests/benchmark-crypto-hmac$(EXESUF)
116check-unit-$(CONFIG_BLOCK) += tests/test-crypto-cipher$(EXESUF)
117check-speed-$(CONFIG_BLOCK) += tests/benchmark-crypto-cipher$(EXESUF)
118check-unit-$(CONFIG_BLOCK) += tests/test-crypto-secret$(EXESUF)
119check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_GNUTLS)) += tests/test-crypto-tlscredsx509$(EXESUF)
120check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_GNUTLS)) += tests/test-crypto-tlssession$(EXESUF)
121ifneq (,$(findstring qemu-ga,$(TOOLS)))
122check-unit-$(call land,$(CONFIG_LINUX),$(CONFIG_VIRTIO_SERIAL)) += tests/test-qga$(EXESUF)
123endif
124check-unit-y += tests/test-timed-average$(EXESUF)
125check-unit-$(CONFIG_INOTIFY1) += tests/test-util-filemonitor$(EXESUF)
126check-unit-y += tests/test-util-sockets$(EXESUF)
127check-unit-$(CONFIG_BLOCK) += tests/test-authz-simple$(EXESUF)
128check-unit-$(CONFIG_BLOCK) += tests/test-authz-list$(EXESUF)
129check-unit-$(CONFIG_BLOCK) += tests/test-authz-listfile$(EXESUF)
130check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_AUTH_PAM)) += tests/test-authz-pam$(EXESUF)
131check-unit-$(CONFIG_BLOCK) += tests/test-io-task$(EXESUF)
132check-unit-$(CONFIG_BLOCK) += tests/test-io-channel-socket$(EXESUF)
133check-unit-$(CONFIG_BLOCK) += tests/test-io-channel-file$(EXESUF)
134check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_GNUTLS)) += tests/test-io-channel-tls$(EXESUF)
135check-unit-$(CONFIG_BLOCK) += tests/test-io-channel-command$(EXESUF)
136check-unit-$(CONFIG_BLOCK) += tests/test-io-channel-buffer$(EXESUF)
137check-unit-y += tests/test-base64$(EXESUF)
138check-unit-$(call land,$(CONFIG_BLOCK),$(if $(CONFIG_NETTLE),y,$(CONFIG_GCRYPT))) += tests/test-crypto-pbkdf$(EXESUF)
139check-unit-$(CONFIG_BLOCK) += tests/test-crypto-ivgen$(EXESUF)
140check-unit-$(CONFIG_BLOCK)  += tests/test-crypto-afsplit$(EXESUF)
141check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_QEMU_PRIVATE_XTS)) += tests/test-crypto-xts$(EXESUF)
142check-unit-$(CONFIG_BLOCK)  += tests/test-crypto-block$(EXESUF)
143check-unit-y += tests/test-logging$(EXESUF)
144check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_REPLICATION)) += tests/test-replication$(EXESUF)
145check-unit-y += tests/test-bufferiszero$(EXESUF)
146check-unit-y += tests/test-uuid$(EXESUF)
147check-unit-y += tests/ptimer-test$(EXESUF)
148check-unit-y += tests/test-qapi-util$(EXESUF)
149
150check-block-$(call land,$(CONFIG_POSIX),$(CONFIG_SOFTMMU)) += tests/check-block.sh
151
152qapi-schema += alternate-any.json
153qapi-schema += alternate-array.json
154qapi-schema += alternate-base.json
155qapi-schema += alternate-branch-if-invalid.json
156qapi-schema += alternate-clash.json
157qapi-schema += alternate-conflict-dict.json
158qapi-schema += alternate-conflict-enum-bool.json
159qapi-schema += alternate-conflict-enum-int.json
160qapi-schema += alternate-conflict-string.json
161qapi-schema += alternate-conflict-bool-string.json
162qapi-schema += alternate-conflict-num-string.json
163qapi-schema += alternate-empty.json
164qapi-schema += alternate-invalid-dict.json
165qapi-schema += alternate-nested.json
166qapi-schema += alternate-unknown.json
167qapi-schema += args-alternate.json
168qapi-schema += args-any.json
169qapi-schema += args-array-empty.json
170qapi-schema += args-array-unknown.json
171qapi-schema += args-bad-boxed.json
172qapi-schema += args-boxed-anon.json
173qapi-schema += args-boxed-string.json
174qapi-schema += args-int.json
175qapi-schema += args-invalid.json
176qapi-schema += args-member-array-bad.json
177qapi-schema += args-member-case.json
178qapi-schema += args-member-unknown.json
179qapi-schema += args-name-clash.json
180qapi-schema += args-union.json
181qapi-schema += args-unknown.json
182qapi-schema += bad-base.json
183qapi-schema += bad-data.json
184qapi-schema += bad-ident.json
185qapi-schema += bad-if.json
186qapi-schema += bad-if-empty.json
187qapi-schema += bad-if-empty-list.json
188qapi-schema += bad-if-list.json
189qapi-schema += bad-type-bool.json
190qapi-schema += bad-type-dict.json
191qapi-schema += bad-type-int.json
192qapi-schema += base-cycle-direct.json
193qapi-schema += base-cycle-indirect.json
194qapi-schema += command-int.json
195qapi-schema += comments.json
196qapi-schema += doc-bad-alternate-member.json
197qapi-schema += doc-bad-boxed-command-arg.json
198qapi-schema += doc-bad-command-arg.json
199qapi-schema += doc-bad-enum-member.json
200qapi-schema += doc-bad-event-arg.json
201qapi-schema += doc-bad-feature.json
202qapi-schema += doc-bad-section.json
203qapi-schema += doc-bad-symbol.json
204qapi-schema += doc-bad-union-member.json
205qapi-schema += doc-before-include.json
206qapi-schema += doc-before-pragma.json
207qapi-schema += doc-duplicated-arg.json
208qapi-schema += doc-duplicated-return.json
209qapi-schema += doc-duplicated-since.json
210qapi-schema += doc-empty-arg.json
211qapi-schema += doc-empty-section.json
212qapi-schema += doc-empty-symbol.json
213qapi-schema += doc-good.json
214qapi-schema += doc-interleaved-section.json
215qapi-schema += doc-invalid-end.json
216qapi-schema += doc-invalid-end2.json
217qapi-schema += doc-invalid-return.json
218qapi-schema += doc-invalid-section.json
219qapi-schema += doc-invalid-start.json
220qapi-schema += doc-missing-colon.json
221qapi-schema += doc-missing-expr.json
222qapi-schema += doc-missing-space.json
223qapi-schema += doc-missing.json
224qapi-schema += doc-no-symbol.json
225qapi-schema += doc-undoc-feature.json
226qapi-schema += double-type.json
227qapi-schema += duplicate-key.json
228qapi-schema += empty.json
229qapi-schema += enum-bad-member.json
230qapi-schema += enum-bad-name.json
231qapi-schema += enum-bad-prefix.json
232qapi-schema += enum-clash-member.json
233qapi-schema += enum-dict-member-unknown.json
234qapi-schema += enum-if-invalid.json
235qapi-schema += enum-int-member.json
236qapi-schema += enum-member-case.json
237qapi-schema += enum-missing-data.json
238qapi-schema += enum-wrong-data.json
239qapi-schema += event-boxed-empty.json
240qapi-schema += event-case.json
241qapi-schema += event-member-invalid-dict.json
242qapi-schema += event-nest-struct.json
243qapi-schema += features-bad-type.json
244qapi-schema += features-duplicate-name.json
245qapi-schema += features-if-invalid.json
246qapi-schema += features-missing-name.json
247qapi-schema += features-name-bad-type.json
248qapi-schema += features-no-list.json
249qapi-schema += features-unknown-key.json
250qapi-schema += flat-union-array-branch.json
251qapi-schema += flat-union-bad-base.json
252qapi-schema += flat-union-bad-discriminator.json
253qapi-schema += flat-union-base-any.json
254qapi-schema += flat-union-base-union.json
255qapi-schema += flat-union-clash-member.json
256qapi-schema += flat-union-discriminator-bad-name.json
257qapi-schema += flat-union-empty.json
258qapi-schema += flat-union-inline.json
259qapi-schema += flat-union-inline-invalid-dict.json
260qapi-schema += flat-union-int-branch.json
261qapi-schema += flat-union-invalid-branch-key.json
262qapi-schema += flat-union-invalid-discriminator.json
263qapi-schema += flat-union-invalid-if-discriminator.json
264qapi-schema += flat-union-no-base.json
265qapi-schema += flat-union-optional-discriminator.json
266qapi-schema += flat-union-string-discriminator.json
267qapi-schema += funny-char.json
268qapi-schema += funny-word.json
269qapi-schema += ident-with-escape.json
270qapi-schema += include-before-err.json
271qapi-schema += include-cycle.json
272qapi-schema += include-extra-junk.json
273qapi-schema += include-nested-err.json
274qapi-schema += include-no-file.json
275qapi-schema += include-non-file.json
276qapi-schema += include-repetition.json
277qapi-schema += include-self-cycle.json
278qapi-schema += include-simple.json
279qapi-schema += indented-expr.json
280qapi-schema += leading-comma-list.json
281qapi-schema += leading-comma-object.json
282qapi-schema += missing-colon.json
283qapi-schema += missing-comma-list.json
284qapi-schema += missing-comma-object.json
285qapi-schema += missing-type.json
286qapi-schema += nested-struct-data.json
287qapi-schema += nested-struct-data-invalid-dict.json
288qapi-schema += non-objects.json
289qapi-schema += oob-test.json
290qapi-schema += allow-preconfig-test.json
291qapi-schema += pragma-doc-required-crap.json
292qapi-schema += pragma-extra-junk.json
293qapi-schema += pragma-name-case-whitelist-crap.json
294qapi-schema += pragma-non-dict.json
295qapi-schema += pragma-unknown.json
296qapi-schema += pragma-returns-whitelist-crap.json
297qapi-schema += qapi-schema-test.json
298qapi-schema += quoted-structural-chars.json
299qapi-schema += redefined-builtin.json
300qapi-schema += redefined-command.json
301qapi-schema += redefined-event.json
302qapi-schema += redefined-type.json
303qapi-schema += reserved-command-q.json
304qapi-schema += reserved-enum-q.json
305qapi-schema += reserved-member-has.json
306qapi-schema += reserved-member-q.json
307qapi-schema += reserved-member-u.json
308qapi-schema += reserved-member-underscore.json
309qapi-schema += reserved-type-kind.json
310qapi-schema += reserved-type-list.json
311qapi-schema += returns-alternate.json
312qapi-schema += returns-array-bad.json
313qapi-schema += returns-dict.json
314qapi-schema += returns-unknown.json
315qapi-schema += returns-whitelist.json
316qapi-schema += string-code-point-31.json
317qapi-schema += string-code-point-127.json
318qapi-schema += struct-base-clash-deep.json
319qapi-schema += struct-base-clash.json
320qapi-schema += struct-data-invalid.json
321qapi-schema += struct-member-if-invalid.json
322qapi-schema += struct-member-invalid-dict.json
323qapi-schema += struct-member-invalid.json
324qapi-schema += trailing-comma-list.json
325qapi-schema += trailing-comma-object.json
326qapi-schema += type-bypass-bad-gen.json
327qapi-schema += unclosed-list.json
328qapi-schema += unclosed-object.json
329qapi-schema += unclosed-string.json
330qapi-schema += union-base-empty.json
331qapi-schema += union-base-no-discriminator.json
332qapi-schema += union-branch-case.json
333qapi-schema += union-branch-if-invalid.json
334qapi-schema += union-branch-invalid-dict.json
335qapi-schema += union-clash-branches.json
336qapi-schema += union-empty.json
337qapi-schema += union-invalid-base.json
338qapi-schema += union-optional-branch.json
339qapi-schema += union-unknown.json
340qapi-schema += unknown-escape.json
341qapi-schema += unknown-expr-key.json
342
343
344check-qapi-schema-y := $(addprefix tests/qapi-schema/, $(qapi-schema))
345
346generated-files-y += tests/test-qapi-types.h
347generated-files-y += tests/include/test-qapi-types-sub-module.h
348generated-files-y += tests/test-qapi-types-sub-sub-module.h
349generated-files-y += tests/test-qapi-visit.h
350generated-files-y += tests/include/test-qapi-visit-sub-module.h
351generated-files-y += tests/test-qapi-visit-sub-sub-module.h
352generated-files-y += tests/test-qapi-commands.h
353generated-files-y += tests/test-qapi-init-commands.h
354generated-files-y += tests/include/test-qapi-commands-sub-module.h
355generated-files-y += tests/test-qapi-commands-sub-sub-module.h
356generated-files-y += tests/test-qapi-emit-events.h
357generated-files-y += tests/test-qapi-events.h
358generated-files-y += tests/include/test-qapi-events-sub-module.h
359generated-files-y += tests/test-qapi-events-sub-sub-module.h
360generated-files-y += tests/test-qapi-introspect.h
361
362QEMU_CFLAGS += -I$(SRC_PATH)/tests -I$(SRC_PATH)/tests/qtest
363
364
365# Deps that are common to various different sets of tests below
366test-util-obj-y = libqemuutil.a
367test-qom-obj-y = $(qom-obj-y) $(test-util-obj-y)
368test-qapi-obj-y = tests/test-qapi-types.o \
369	tests/include/test-qapi-types-sub-module.o \
370	tests/test-qapi-types-sub-sub-module.o \
371	tests/test-qapi-visit.o \
372	tests/include/test-qapi-visit-sub-module.o \
373	tests/test-qapi-visit-sub-sub-module.o \
374	tests/test-qapi-introspect.o \
375	$(test-qom-obj-y)
376benchmark-crypto-obj-$(CONFIG_BLOCK) = $(authz-obj-y) $(crypto-obj-y) $(test-qom-obj-y)
377test-crypto-obj-$(CONFIG_BLOCK) = $(authz-obj-y) $(crypto-obj-y) $(test-qom-obj-y)
378test-io-obj-$(CONFIG_BLOCK) = $(io-obj-y) $(test-crypto-obj-y)
379test-authz-obj-$(CONFIG_BLOCK) = $(test-qom-obj-y) $(authz-obj-y)
380test-block-obj-$(CONFIG_BLOCK) = $(block-obj-y) $(test-io-obj-y) tests/iothread.o
381
382tests/check-qnum$(EXESUF): tests/check-qnum.o $(test-util-obj-y)
383tests/check-qstring$(EXESUF): tests/check-qstring.o $(test-util-obj-y)
384tests/check-qdict$(EXESUF): tests/check-qdict.o $(test-util-obj-y)
385tests/check-block-qdict$(EXESUF): tests/check-block-qdict.o $(test-util-obj-y)
386tests/check-qlist$(EXESUF): tests/check-qlist.o $(test-util-obj-y)
387tests/check-qnull$(EXESUF): tests/check-qnull.o $(test-util-obj-y)
388tests/check-qobject$(EXESUF): tests/check-qobject.o $(test-util-obj-y)
389tests/check-qjson$(EXESUF): tests/check-qjson.o $(test-util-obj-y)
390tests/check-qlit$(EXESUF): tests/check-qlit.o $(test-util-obj-y)
391tests/check-qom-interface$(EXESUF): tests/check-qom-interface.o $(test-qom-obj-y)
392tests/check-qom-proplist$(EXESUF): tests/check-qom-proplist.o $(test-qom-obj-y)
393
394tests/test-char$(EXESUF): tests/test-char.o $(test-util-obj-y) $(test-io-obj-y) $(chardev-obj-y) tests/socket-helpers.o
395tests/test-coroutine$(EXESUF): tests/test-coroutine.o $(test-block-obj-y)
396tests/test-aio$(EXESUF): tests/test-aio.o $(test-block-obj-y)
397tests/test-aio-multithread$(EXESUF): tests/test-aio-multithread.o $(test-block-obj-y)
398tests/test-throttle$(EXESUF): tests/test-throttle.o $(test-block-obj-y)
399tests/test-bdrv-drain$(EXESUF): tests/test-bdrv-drain.o $(test-block-obj-y) $(test-util-obj-y)
400tests/test-bdrv-graph-mod$(EXESUF): tests/test-bdrv-graph-mod.o $(test-block-obj-y) $(test-util-obj-y)
401tests/test-blockjob$(EXESUF): tests/test-blockjob.o $(test-block-obj-y) $(test-util-obj-y)
402tests/test-blockjob-txn$(EXESUF): tests/test-blockjob-txn.o $(test-block-obj-y) $(test-util-obj-y)
403tests/test-block-backend$(EXESUF): tests/test-block-backend.o $(test-block-obj-y) $(test-util-obj-y)
404tests/test-block-iothread$(EXESUF): tests/test-block-iothread.o $(test-block-obj-y) $(test-util-obj-y)
405tests/test-image-locking$(EXESUF): tests/test-image-locking.o $(test-block-obj-y) $(test-util-obj-y)
406tests/test-thread-pool$(EXESUF): tests/test-thread-pool.o $(test-block-obj-y)
407tests/test-iov$(EXESUF): tests/test-iov.o $(test-util-obj-y)
408tests/test-hbitmap$(EXESUF): tests/test-hbitmap.o $(test-util-obj-y) $(test-crypto-obj-y)
409tests/test-bitmap$(EXESUF): tests/test-bitmap.o $(test-util-obj-y)
410tests/test-x86-cpuid$(EXESUF): tests/test-x86-cpuid.o
411tests/test-xbzrle$(EXESUF): tests/test-xbzrle.o migration/xbzrle.o migration/page_cache.o $(test-util-obj-y)
412tests/test-cutils$(EXESUF): tests/test-cutils.o util/cutils.o $(test-util-obj-y)
413tests/test-int128$(EXESUF): tests/test-int128.o
414tests/rcutorture$(EXESUF): tests/rcutorture.o $(test-util-obj-y)
415tests/test-rcu-list$(EXESUF): tests/test-rcu-list.o $(test-util-obj-y)
416tests/test-rcu-simpleq$(EXESUF): tests/test-rcu-simpleq.o $(test-util-obj-y)
417tests/test-rcu-tailq$(EXESUF): tests/test-rcu-tailq.o $(test-util-obj-y)
418tests/test-qdist$(EXESUF): tests/test-qdist.o $(test-util-obj-y)
419tests/test-qht$(EXESUF): tests/test-qht.o $(test-util-obj-y)
420tests/test-qht-par$(EXESUF): tests/test-qht-par.o tests/qht-bench$(EXESUF) $(test-util-obj-y)
421tests/qht-bench$(EXESUF): tests/qht-bench.o $(test-util-obj-y)
422tests/test-bufferiszero$(EXESUF): tests/test-bufferiszero.o $(test-util-obj-y)
423tests/atomic_add-bench$(EXESUF): tests/atomic_add-bench.o $(test-util-obj-y)
424tests/atomic64-bench$(EXESUF): tests/atomic64-bench.o $(test-util-obj-y)
425
426tests/fp/%:
427	$(MAKE) -C $(dir $@) $(notdir $@)
428
429tests/test-qdev-global-props$(EXESUF): tests/test-qdev-global-props.o \
430	hw/core/qdev.o hw/core/qdev-properties.o hw/core/hotplug.o\
431	hw/core/bus.o \
432	hw/core/resettable.o \
433	hw/core/irq.o \
434	hw/core/fw-path-provider.o \
435	hw/core/reset.o \
436	hw/core/vmstate-if.o \
437	$(test-qapi-obj-y)
438tests/test-vmstate$(EXESUF): tests/test-vmstate.o \
439	migration/vmstate.o migration/vmstate-types.o migration/qemu-file.o \
440        migration/qemu-file-channel.o migration/qjson.o \
441	$(test-io-obj-y)
442tests/test-timed-average$(EXESUF): tests/test-timed-average.o $(test-util-obj-y)
443tests/test-base64$(EXESUF): tests/test-base64.o $(test-util-obj-y)
444tests/ptimer-test$(EXESUF): tests/ptimer-test.o tests/ptimer-test-stubs.o hw/core/ptimer.o
445tests/test-qemu-opts$(EXESUF): tests/test-qemu-opts.o $(test-util-obj-y)
446tests/test-keyval$(EXESUF): tests/test-keyval.o $(test-util-obj-y) $(test-qapi-obj-y)
447tests/test-write-threshold$(EXESUF): tests/test-write-threshold.o $(test-block-obj-y)
448tests/test-uuid$(EXESUF): tests/test-uuid.o $(test-util-obj-y)
449tests/test-qapi-util$(EXESUF): tests/test-qapi-util.o $(test-util-obj-y)
450
451tests/test-logging$(EXESUF): tests/test-logging.o $(test-util-obj-y)
452
453tests/test-replication$(EXESUF): tests/test-replication.o $(test-util-obj-y) \
454	$(test-block-obj-y)
455
456tests/test-qapi-types.c tests/test-qapi-types.h \
457tests/include/test-qapi-types-sub-module.c \
458tests/include/test-qapi-types-sub-module.h \
459tests/test-qapi-types-sub-sub-module.c \
460tests/test-qapi-types-sub-sub-module.h \
461tests/test-qapi-visit.c tests/test-qapi-visit.h \
462tests/include/test-qapi-visit-sub-module.c \
463tests/include/test-qapi-visit-sub-module.h \
464tests/test-qapi-visit-sub-sub-module.c \
465tests/test-qapi-visit-sub-sub-module.h \
466tests/test-qapi-commands.h tests/test-qapi-commands.c \
467tests/include/test-qapi-commands-sub-module.h \
468tests/include/test-qapi-commands-sub-module.c \
469tests/test-qapi-commands-sub-sub-module.h \
470tests/test-qapi-commands-sub-sub-module.c \
471tests/test-qapi-emit-events.c tests/test-qapi-emit-events.h \
472tests/test-qapi-events.c tests/test-qapi-events.h \
473tests/test-qapi-init-commands.c \
474tests/test-qapi-init-commands.h \
475tests/include/test-qapi-events-sub-module.c \
476tests/include/test-qapi-events-sub-module.h \
477tests/test-qapi-events-sub-sub-module.c \
478tests/test-qapi-events-sub-sub-module.h \
479tests/test-qapi-introspect.c tests/test-qapi-introspect.h: \
480tests/test-qapi-gen-timestamp ;
481tests/test-qapi-gen-timestamp: \
482		$(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json \
483		$(SRC_PATH)/tests/qapi-schema/include/sub-module.json \
484		$(SRC_PATH)/tests/qapi-schema/sub-sub-module.json \
485		$(qapi-py)
486	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \
487		-o tests -p "test-" $<, \
488		"GEN","$(@:%-timestamp=%)")
489	@rm -f tests/test-qapi-doc.texi
490	@>$@
491
492tests/qapi-schema/doc-good.test.texi: $(SRC_PATH)/tests/qapi-schema/doc-good.json $(qapi-py)
493	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \
494		-o tests/qapi-schema -p "doc-good-" $<, \
495		"GEN","$@")
496	@mv tests/qapi-schema/doc-good-qapi-doc.texi $@
497	@rm -f tests/qapi-schema/doc-good-qapi-*.[ch] tests/qapi-schema/doc-good-qmp-*.[ch]
498
499tests/qtest/dbus-vmstate1.h tests/qtest/dbus-vmstate1.c: tests/qtest/dbus-vmstate1-gen-timestamp ;
500tests/qtest/dbus-vmstate1-gen-timestamp: $(SRC_PATH)/tests/qtest/dbus-vmstate1.xml
501	$(call quiet-command,$(GDBUS_CODEGEN) $< \
502		--interface-prefix org.qemu --generate-c-code tests/qtest/dbus-vmstate1, \
503		"GEN","$(@:%-timestamp=%)")
504	@>$@
505
506tests/qtest/dbus-vmstate-test.o-cflags := -DSRCDIR="$(SRC_PATH)"
507tests/qtest/dbus-vmstate1.o-cflags := $(GIO_CFLAGS)
508tests/qtest/dbus-vmstate1.o-libs := $(GIO_LIBS)
509
510tests/qtest/dbus-vmstate-test.o: tests/qtest/dbus-vmstate1.h
511
512tests/test-string-output-visitor$(EXESUF): tests/test-string-output-visitor.o $(test-qapi-obj-y)
513tests/test-string-input-visitor$(EXESUF): tests/test-string-input-visitor.o $(test-qapi-obj-y)
514tests/test-qmp-event$(EXESUF): tests/test-qmp-event.o $(test-qapi-obj-y) tests/test-qapi-emit-events.o tests/test-qapi-events.o
515tests/test-qobject-output-visitor$(EXESUF): tests/test-qobject-output-visitor.o $(test-qapi-obj-y)
516tests/test-clone-visitor$(EXESUF): tests/test-clone-visitor.o $(test-qapi-obj-y)
517tests/test-qobject-input-visitor$(EXESUF): tests/test-qobject-input-visitor.o $(test-qapi-obj-y)
518tests/test-qmp-cmds$(EXESUF): tests/test-qmp-cmds.o tests/test-qapi-commands.o tests/test-qapi-init-commands.o $(test-qapi-obj-y)
519tests/test-visitor-serialization$(EXESUF): tests/test-visitor-serialization.o $(test-qapi-obj-y)
520tests/test-opts-visitor$(EXESUF): tests/test-opts-visitor.o $(test-qapi-obj-y)
521
522tests/test-shift128$(EXESUF): tests/test-shift128.o $(test-util-obj-y)
523tests/test-mul64$(EXESUF): tests/test-mul64.o $(test-util-obj-y)
524tests/test-bitops$(EXESUF): tests/test-bitops.o $(test-util-obj-y)
525tests/test-bitcnt$(EXESUF): tests/test-bitcnt.o $(test-util-obj-y)
526tests/test-crypto-hash$(EXESUF): tests/test-crypto-hash.o $(test-crypto-obj-y)
527tests/benchmark-crypto-hash$(EXESUF): tests/benchmark-crypto-hash.o $(test-crypto-obj-y)
528tests/test-crypto-hmac$(EXESUF): tests/test-crypto-hmac.o $(test-crypto-obj-y)
529tests/benchmark-crypto-hmac$(EXESUF): tests/benchmark-crypto-hmac.o $(test-crypto-obj-y)
530tests/test-crypto-cipher$(EXESUF): tests/test-crypto-cipher.o $(test-crypto-obj-y)
531tests/benchmark-crypto-cipher$(EXESUF): tests/benchmark-crypto-cipher.o $(test-crypto-obj-y)
532tests/test-crypto-secret$(EXESUF): tests/test-crypto-secret.o $(test-crypto-obj-y)
533tests/test-crypto-xts$(EXESUF): tests/test-crypto-xts.o $(test-crypto-obj-y)
534
535tests/crypto-tls-x509-helpers.o-cflags := $(TASN1_CFLAGS)
536tests/crypto-tls-x509-helpers.o-libs := $(TASN1_LIBS)
537tests/pkix_asn1_tab.o-cflags := $(TASN1_CFLAGS)
538
539tests/test-crypto-tlscredsx509.o-cflags := $(TASN1_CFLAGS)
540tests/test-crypto-tlscredsx509$(EXESUF): tests/test-crypto-tlscredsx509.o \
541	tests/crypto-tls-x509-helpers.o tests/pkix_asn1_tab.o $(test-crypto-obj-y)
542
543tests/test-crypto-tlssession.o-cflags := $(TASN1_CFLAGS)
544tests/test-crypto-tlssession$(EXESUF): tests/test-crypto-tlssession.o \
545	tests/crypto-tls-x509-helpers.o tests/pkix_asn1_tab.o \
546	tests/crypto-tls-psk-helpers.o \
547        $(test-crypto-obj-y)
548tests/test-util-filemonitor$(EXESUF): tests/test-util-filemonitor.o \
549	$(test-util-obj-y)
550tests/test-util-sockets$(EXESUF): tests/test-util-sockets.o \
551	tests/socket-helpers.o $(test-util-obj-y)
552tests/test-authz-simple$(EXESUF): tests/test-authz-simple.o $(test-authz-obj-y)
553tests/test-authz-list$(EXESUF): tests/test-authz-list.o $(test-authz-obj-y)
554tests/test-authz-listfile$(EXESUF): tests/test-authz-listfile.o $(test-authz-obj-y)
555tests/test-authz-pam$(EXESUF): tests/test-authz-pam.o $(test-authz-obj-y)
556tests/test-io-task$(EXESUF): tests/test-io-task.o $(test-io-obj-y)
557tests/test-io-channel-socket$(EXESUF): tests/test-io-channel-socket.o \
558        tests/io-channel-helpers.o tests/socket-helpers.o $(test-io-obj-y)
559tests/test-io-channel-file$(EXESUF): tests/test-io-channel-file.o \
560        tests/io-channel-helpers.o $(test-io-obj-y)
561tests/test-io-channel-tls$(EXESUF): tests/test-io-channel-tls.o \
562	tests/crypto-tls-x509-helpers.o tests/pkix_asn1_tab.o \
563	tests/io-channel-helpers.o $(test-io-obj-y)
564tests/test-io-channel-command$(EXESUF): tests/test-io-channel-command.o \
565        tests/io-channel-helpers.o $(test-io-obj-y)
566tests/test-io-channel-buffer$(EXESUF): tests/test-io-channel-buffer.o \
567        tests/io-channel-helpers.o $(test-io-obj-y)
568tests/test-crypto-pbkdf$(EXESUF): tests/test-crypto-pbkdf.o $(test-crypto-obj-y)
569tests/test-crypto-ivgen$(EXESUF): tests/test-crypto-ivgen.o $(test-crypto-obj-y)
570tests/test-crypto-afsplit$(EXESUF): tests/test-crypto-afsplit.o $(test-crypto-obj-y)
571tests/test-crypto-block$(EXESUF): tests/test-crypto-block.o $(test-crypto-obj-y)
572
573tests/migration/stress$(EXESUF): tests/migration/stress.o
574	$(call quiet-command, $(LINKPROG) -static -O3 $(PTHREAD_LIB) -o $@ $< ,"LINK","$(TARGET_DIR)$@")
575
576INITRD_WORK_DIR=tests/migration/initrd
577
578tests/migration/initrd-stress.img: tests/migration/stress$(EXESUF)
579	mkdir -p $(INITRD_WORK_DIR)
580	cp $< $(INITRD_WORK_DIR)/init
581	(cd $(INITRD_WORK_DIR) && (find | cpio --quiet -o -H newc | gzip -9)) > $@
582	rm $(INITRD_WORK_DIR)/init
583	rmdir $(INITRD_WORK_DIR)
584
585include $(SRC_PATH)/tests/qtest/Makefile.include
586
587tests/test-qga$(EXESUF): qemu-ga$(EXESUF)
588tests/test-qga$(EXESUF): tests/test-qga.o $(qtest-obj-y)
589tests/vhost-user-bridge$(EXESUF): tests/vhost-user-bridge.o $(test-util-obj-y) libvhost-user.a
590
591SPEED = quick
592
593# gtester tests, possibly with verbose output
594# do_test_tap runs all tests, even if some of them fail, while do_test_human
595# stops at the first failure unless -k is given on the command line
596
597define do_test_human_k
598        $(quiet-@)rc=0; $(foreach COMMAND, $1, \
599          $(call quiet-command-run, \
600            export MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))} $2; \
601              $(COMMAND) -m=$(SPEED) -k --tap < /dev/null \
602              | ./scripts/tap-driver.pl --test-name="$(notdir $(COMMAND))" $(if $(V),, --show-failures-only) \
603              || rc=$$?;, "TEST", "$@: $(COMMAND)")) exit $$rc
604endef
605define do_test_human_no_k
606        $(foreach COMMAND, $1, \
607          $(call quiet-command, \
608            MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))} $2 \
609              $(COMMAND) -m=$(SPEED) -k --tap < /dev/null \
610              | ./scripts/tap-driver.pl --test-name="$(notdir $(COMMAND))" $(if $(V),, --show-failures-only), \
611              "TEST", "$@: $(COMMAND)")
612)
613endef
614do_test_human = \
615        $(if $(findstring k, $(MAKEFLAGS)), $(do_test_human_k), $(do_test_human_no_k))
616
617define do_test_tap
618	$(call quiet-command, \
619          { export MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))} $2; \
620            $(foreach COMMAND, $1, \
621	      $(COMMAND) -m=$(SPEED) -k --tap < /dev/null \
622	      | sed "s/^[a-z][a-z]* [0-9]* /&$(notdir $(COMMAND)) /" || true; ) } \
623	      | ./scripts/tap-merge.pl | tee "$@" \
624	      | ./scripts/tap-driver.pl $(if $(V),, --show-failures-only), \
625	  "TAP","$@")
626endef
627
628.PHONY: $(patsubst %, check-qtest-%, $(QTEST_TARGETS))
629$(patsubst %, check-qtest-%, $(QTEST_TARGETS)): check-qtest-%: %-softmmu/all $(check-qtest-y)
630	$(call do_test_human,$(check-qtest-$*-y:%=tests/qtest/%$(EXESUF)) $(check-qtest-generic-y:%=tests/qtest/%$(EXESUF)), \
631	  QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
632	  QTEST_QEMU_IMG=qemu-img$(EXESUF))
633
634check-unit: $(check-unit-y)
635	$(call do_test_human, $^)
636
637check-speed: $(check-speed-y)
638	$(call do_test_human, $^)
639
640# gtester tests with TAP output
641
642$(patsubst %, check-report-qtest-%.tap, $(QTEST_TARGETS)): check-report-qtest-%.tap: %-softmmu/all $(check-qtest-y)
643	$(call do_test_tap, $(check-qtest-$*-y:%=tests/qtest/%$(EXESUF)) $(check-qtest-generic-y:%=tests/qtest/%$(EXESUF)), \
644	  QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
645	  QTEST_QEMU_IMG=qemu-img$(EXESUF))
646
647check-report-unit.tap: $(check-unit-y)
648	$(call do_test_tap,$^)
649
650# Reports and overall runs
651
652check-report.tap: $(patsubst %,check-report-qtest-%.tap, $(QTEST_TARGETS)) check-report-unit.tap
653	$(call quiet-command, cat $^ | scripts/tap-merge.pl >$@,"GEN","$@")
654
655# FPU Emulation tests (aka softfloat)
656#
657# As we still have some places that need fixing the rules are a little
658# more complex than they need to be and have to override some of the
659# generic Makefile expansions. Once we are cleanly passing all
660# the tests we can simplify the make syntax.
661
662FP_TEST_BIN=$(BUILD_DIR)/tests/fp/fp-test
663
664# the build dir is created by configure
665.PHONY: $(FP_TEST_BIN)
666$(FP_TEST_BIN): config-host.h $(test-util-obj-y)
667	$(call quiet-command, \
668	 	$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" $(notdir $@), \
669	         "BUILD", "$(notdir $@)")
670
671# The full test suite can take a bit of time, default to a quick run
672# "-l 2 -r all" can take more than a day for some operations and is best
673# run manually
674FP_TL=-l 1 -r all
675
676# $1 = tests, $2 = description, $3 = test flags
677test-softfloat = $(call quiet-command, \
678			cd $(BUILD_DIR)/tests/fp && \
679			./fp-test -s $(if $3,$3,$(FP_TL)) $1 > $2.out 2>&1 || \
680			(cat $2.out && exit 1;), \
681			"FLOAT TEST", $2)
682
683# Conversion Routines:
684# FIXME: i32_to_extF80 (broken), i64_to_extF80 (broken)
685#        ui32_to_f128 (not implemented), extF80_roundToInt (broken)
686#
687check-softfloat-conv: $(FP_TEST_BIN)
688	$(call test-softfloat, \
689		i32_to_f16 i64_to_f16 \
690		i32_to_f32 i64_to_f32 \
691		i32_to_f64 i64_to_f64 \
692		i32_to_f128 i64_to_f128, int-to-float)
693	$(call test-softfloat, \
694		ui32_to_f16 ui64_to_f16 \
695		ui32_to_f32 ui64_to_f32 \
696		ui32_to_f64 ui64_to_f64 \
697		ui64_to_f128, uint-to-float)
698	$(call test-softfloat, \
699		f16_to_i32 f16_to_i32_r_minMag \
700		f32_to_i32 f32_to_i32_r_minMag \
701		f64_to_i32 f64_to_i32_r_minMag \
702		extF80_to_i32 extF80_to_i32_r_minMag \
703		f128_to_i32 f128_to_i32_r_minMag \
704		f16_to_i64 f16_to_i64_r_minMag \
705		f32_to_i64 f32_to_i64_r_minMag \
706		f64_to_i64 f64_to_i64_r_minMag \
707		extF80_to_i64 extF80_to_i64_r_minMag \
708		f128_to_i64 f128_to_i64_r_minMag, \
709		float-to-int)
710	$(call test-softfloat, \
711		f16_to_ui32 f16_to_ui32_r_minMag \
712		f32_to_ui32 f32_to_ui32_r_minMag \
713		f64_to_ui32 f64_to_ui32_r_minMag \
714		f128_to_ui32 f128_to_ui32_r_minMag \
715		f16_to_ui64 f16_to_ui64_r_minMag \
716		f32_to_ui64 f32_to_ui64_r_minMag \
717		f64_to_ui64 f64_to_ui64_r_minMag \
718		f128_to_ui64 f128_to_ui64_r_minMag, \
719		float-to-uint)
720	$(call test-softfloat, \
721		f16_roundToInt f32_roundToInt \
722		f64_roundToInt f128_roundToInt, \
723		round-to-integer)
724
725# Generic rule for all float operations
726#
727# Some patterns are overidden due to broken or missing tests.
728# Hopefully these can be removed over time.
729
730check-softfloat-%: $(FP_TEST_BIN)
731	$(call test-softfloat, f16_$* f32_$* f64_$* extF80_$* f128_$*, $*)
732
733# Float Compare routines
734SF_COMPARE_OPS=eq eq_signaling le le_quiet lt_quiet
735SF_COMPARE_RULES=$(patsubst %,check-softfloat-%, $(SF_COMPARE_OPS))
736
737# FIXME: extF80_le_quiet (broken)
738check-softfloat-le_quiet: $(FP_TEST_BIN)
739	$(call test-softfloat, 				\
740		f16_le_quiet f32_le_quiet f64_le_quiet  \
741		f128_le_quiet, 				\
742		le_quiet)
743
744# FIXME: extF80_lt_quiet (broken)
745check-softfloat-lt_quiet: $(FP_TEST_BIN)
746	$(call test-softfloat, 				\
747		f16_lt_quiet f32_lt_quiet f64_lt_quiet  \
748		f128_lt_quiet, 				\
749		lt_quiet)
750
751.PHONY: check-softfloat-compare
752check-softfloat-compare: $(SF_COMPARE_RULES)
753
754# Math Operations
755
756# FIXME: extF80_mulAdd (missing)
757check-softfloat-mulAdd: $(FP_TEST_BIN)
758	$(call test-softfloat, \
759		f16_mulAdd f32_mulAdd f64_mulAdd f128_mulAdd, \
760		mulAdd,-l 1)
761
762# FIXME: extF80_rem (broken)
763check-softfloat-rem: $(FP_TEST_BIN)
764	$(call test-softfloat, \
765		f16_rem f32_rem f64_rem f128_rem, \
766		rem)
767
768SF_MATH_OPS=add sub mul mulAdd div rem sqrt
769SF_MATH_RULES=$(patsubst %,check-softfloat-%, $(SF_MATH_OPS))
770
771.PHONY: check-softfloat-ops
772check-softfloat-ops: $(SF_MATH_RULES)
773
774# Finally a generic rule to test all of softfoat. If TCG isnt't
775# enabled we define a null operation which skips the tests.
776
777.PHONY: check-softfloat
778ifeq ($(CONFIG_TCG),y)
779check-softfloat: check-softfloat-conv check-softfloat-compare check-softfloat-ops
780else
781check-softfloat:
782	$(call quiet-command, /bin/true, "FLOAT TEST", \
783		"SKIPPED for non-TCG builds")
784endif
785
786# Plugins
787ifeq ($(CONFIG_PLUGIN),y)
788.PHONY: plugins
789plugins:
790	$(call quiet-command,\
791		$(MAKE) $(SUBDIR_MAKEFLAGS) -C tests/plugin V="$(V)", \
792		"BUILD", "plugins")
793endif
794
795# Per guest TCG tests
796
797BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(TARGET_DIRS))
798CLEAN_TCG_TARGET_RULES=$(patsubst %,clean-tcg-tests-%, $(TARGET_DIRS))
799RUN_TCG_TARGET_RULES=$(patsubst %,run-tcg-tests-%, $(TARGET_DIRS))
800
801# Probe for the Docker Builds needed for each build
802$(foreach PROBE_TARGET,$(TARGET_DIRS), 				\
803	$(eval -include $(SRC_PATH)/tests/tcg/Makefile.prereqs))
804
805build-tcg-tests-%: $(if $(CONFIG_PLUGIN),plugins)
806	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) \
807		-f $(SRC_PATH)/tests/tcg/Makefile.qemu \
808		SRC_PATH=$(SRC_PATH) \
809	       	V="$(V)" TARGET="$*" guest-tests, \
810		"BUILD", "TCG tests for $*")
811
812run-tcg-tests-%: build-tcg-tests-% %/all
813	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) \
814		-f $(SRC_PATH)/tests/tcg/Makefile.qemu \
815		SRC_PATH=$(SRC_PATH) SPEED="$(SPEED)" \
816		V="$(V)" TARGET="$*" run-guest-tests, \
817		"RUN", "TCG tests for $*")
818
819clean-tcg-tests-%:
820	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) \
821		-f $(SRC_PATH)/tests/tcg/Makefile.qemu \
822		SRC_PATH=$(SRC_PATH) TARGET="$*" clean-guest-tests, \
823		"CLEAN", "TCG tests for $*")
824
825.PHONY: build-tcg
826build-tcg: $(BUILD_TCG_TARGET_RULES)
827
828.PHONY: check-tcg
829check-tcg: $(RUN_TCG_TARGET_RULES)
830
831.PHONY: clean-tcg
832clean-tcg: $(CLEAN_TCG_TARGET_RULES)
833
834# Other tests
835
836QEMU_IOTESTS_HELPERS-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_LINUX)) = tests/qemu-iotests/socket_scm_helper$(EXESUF)
837
838.PHONY: check-tests/check-block.sh
839check-tests/check-block.sh: tests/check-block.sh qemu-img$(EXESUF) \
840		qemu-io$(EXESUF) qemu-nbd$(EXESUF) $(QEMU_IOTESTS_HELPERS-y) \
841		$(patsubst %,%/all,$(filter %-softmmu,$(TARGET_DIRS)))
842	@$<
843
844.PHONY: check-tests/qapi-schema/frontend
845check-tests/qapi-schema/frontend: $(addprefix $(SRC_PATH)/, $(check-qapi-schema-y))
846	$(call quiet-command, PYTHONPATH=$(SRC_PATH)/scripts \
847	  PYTHONIOENCODING=utf-8 $(PYTHON) $(SRC_PATH)/tests/qapi-schema/test-qapi.py $^, \
848	  TEST, check-qapi-schema)
849
850.PHONY: check-tests/qapi-schema/doc-good.texi
851check-tests/qapi-schema/doc-good.texi: tests/qapi-schema/doc-good.test.texi
852	@diff -u $(SRC_PATH)/tests/qapi-schema/doc-good.texi $<
853
854.PHONY: check-decodetree
855check-decodetree:
856	$(call quiet-command, \
857	  cd $(SRC_PATH)/tests/decode && \
858          ./check.sh "$(PYTHON)" "$(SRC_PATH)/scripts/decodetree.py", \
859          TEST, decodetree.py)
860
861# Python venv for running tests
862
863.PHONY: check-venv check-acceptance
864
865TESTS_VENV_DIR=$(BUILD_DIR)/tests/venv
866TESTS_VENV_REQ=$(SRC_PATH)/tests/requirements.txt
867TESTS_RESULTS_DIR=$(BUILD_DIR)/tests/results
868# Controls the output generated by Avocado when running tests.
869# Any number of command separated loggers are accepted.  For more
870# information please refer to "avocado --help".
871AVOCADO_SHOW=app
872AVOCADO_TAGS=$(patsubst %-softmmu,-t arch:%, $(filter %-softmmu,$(TARGET_DIRS)))
873
874$(TESTS_VENV_DIR): $(TESTS_VENV_REQ)
875	$(call quiet-command, \
876            $(PYTHON) -m venv --system-site-packages $@, \
877            VENV, $@)
878	$(call quiet-command, \
879            $(TESTS_VENV_DIR)/bin/python -m pip -q install -r $(TESTS_VENV_REQ), \
880            PIP, $(TESTS_VENV_REQ))
881	$(call quiet-command, touch $@)
882
883$(TESTS_RESULTS_DIR):
884	$(call quiet-command, mkdir -p $@, \
885            MKDIR, $@)
886
887check-venv: $(TESTS_VENV_DIR)
888
889check-acceptance: check-venv $(TESTS_RESULTS_DIR)
890	$(call quiet-command, \
891            $(TESTS_VENV_DIR)/bin/python -m avocado \
892            --show=$(AVOCADO_SHOW) run --job-results-dir=$(TESTS_RESULTS_DIR) \
893            --filter-by-tags-include-empty --filter-by-tags-include-empty-key \
894            $(AVOCADO_TAGS) \
895            --failfast=on tests/acceptance, \
896            "AVOCADO", "tests/acceptance")
897
898# Consolidated targets
899
900.PHONY: check-block check-qapi-schema check-qtest check-unit check check-clean
901check-qapi-schema: check-tests/qapi-schema/frontend check-tests/qapi-schema/doc-good.texi
902check-qtest: $(patsubst %,check-qtest-%, $(QTEST_TARGETS))
903ifeq ($(CONFIG_TOOLS),y)
904check-block: $(patsubst %,check-%, $(check-block-y))
905endif
906check: check-block check-qapi-schema check-unit check-softfloat check-qtest check-decodetree
907check-clean:
908	rm -rf $(check-unit-y) tests/*.o tests/*/*.o $(QEMU_IOTESTS_HELPERS-y)
909	rm -rf $(sort $(foreach target,$(SYSEMU_TARGET_LIST), $(check-qtest-$(target)-y:%=tests/qtest/%$(EXESUF))) $(check-qtest-generic-y:%=tests/qtest/%$(EXESUF)))
910	rm -f tests/test-qapi-gen-timestamp
911	rm -f tests/qtest/dbus-vmstate1-gen-timestamp
912	rm -rf $(TESTS_VENV_DIR) $(TESTS_RESULTS_DIR)
913
914clean: check-clean
915
916# Build the help program automatically
917
918all: $(QEMU_IOTESTS_HELPERS-y)
919
920-include $(wildcard tests/*.d)
921-include $(wildcard tests/qtest/*.d)
922-include $(wildcard tests/qtest/libqos/*.d)
923
924endif
925