]> Git Repo - qemu.git/blob - tests/Makefile.include
meson: qemu-{img,io,nbd}
[qemu.git] / tests / Makefile.include
1 # -*- Mode: makefile -*-
2
3 .PHONY: check-help
4 check-help:
5         @echo "Regression testing targets:"
6         @echo
7         @echo " $(MAKE) check                Run block, qapi-schema, unit, softfloat, qtest and decodetree tests"
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 ifeq ($(CONFIG_TCG),y)
16         @echo " $(MAKE) check-tcg            Run TCG tests"
17         @echo " $(MAKE) check-softfloat      Run FPU emulation tests"
18 endif
19         @echo " $(MAKE) check-acceptance     Run all acceptance (functional) tests"
20         @echo
21         @echo " $(MAKE) check-report.tap     Generates an aggregated TAP test report"
22         @echo " $(MAKE) check-venv           Creates a Python venv for tests"
23         @echo " $(MAKE) check-clean          Clean the tests and related data"
24         @echo
25         @echo "The following are useful for CI builds"
26         @echo " $(MAKE) check-build          Build most test binaris"
27         @echo " $(MAKE) get-vm-images        Downloads all images used by acceptance tests, according to configured targets (~350 MB each, 1.5 GB max)"
28         @echo
29         @echo
30         @echo "The variable SPEED can be set to control the gtester speed setting."
31         @echo "Default options are -k and (for $(MAKE) V=1) --verbose; they can be"
32         @echo "changed with variable GTESTER_OPTIONS."
33
34 ifneq ($(wildcard config-host.mak),)
35 export SRC_PATH
36
37 # TODO don't duplicate $(SRC_PATH)/Makefile's qapi-py here
38 qapi-py = $(SRC_PATH)/scripts/qapi/__init__.py \
39 $(SRC_PATH)/scripts/qapi/commands.py \
40 $(SRC_PATH)/scripts/qapi/common.py \
41 $(SRC_PATH)/scripts/qapi/doc.py \
42 $(SRC_PATH)/scripts/qapi/error.py \
43 $(SRC_PATH)/scripts/qapi/events.py \
44 $(SRC_PATH)/scripts/qapi/expr.py \
45 $(SRC_PATH)/scripts/qapi/gen.py \
46 $(SRC_PATH)/scripts/qapi/introspect.py \
47 $(SRC_PATH)/scripts/qapi/parser.py \
48 $(SRC_PATH)/scripts/qapi/schema.py \
49 $(SRC_PATH)/scripts/qapi/source.py \
50 $(SRC_PATH)/scripts/qapi/types.py \
51 $(SRC_PATH)/scripts/qapi/visit.py \
52 $(SRC_PATH)/scripts/qapi-gen.py
53
54 # Get the list of all supported sysemu targets
55 SYSEMU_TARGET_LIST := $(subst -softmmu.mak,,$(notdir \
56    $(wildcard $(SRC_PATH)/default-configs/*-softmmu.mak)))
57
58 check-unit-y += tests/check-qdict$(EXESUF)
59 check-unit-y += tests/check-block-qdict$(EXESUF)
60 check-unit-y += tests/check-qnum$(EXESUF)
61 check-unit-y += tests/check-qstring$(EXESUF)
62 check-unit-y += tests/check-qlist$(EXESUF)
63 check-unit-y += tests/check-qnull$(EXESUF)
64 check-unit-y += tests/check-qobject$(EXESUF)
65 check-unit-y += tests/check-qjson$(EXESUF)
66 check-unit-y += tests/check-qlit$(EXESUF)
67 check-unit-y += tests/test-qobject-output-visitor$(EXESUF)
68 check-unit-y += tests/test-clone-visitor$(EXESUF)
69 check-unit-y += tests/test-qobject-input-visitor$(EXESUF)
70 check-unit-$(CONFIG_SOFTMMU) += tests/test-qmp-cmds$(EXESUF)
71 check-unit-y += tests/test-string-input-visitor$(EXESUF)
72 check-unit-y += tests/test-string-output-visitor$(EXESUF)
73 check-unit-y += tests/test-qmp-event$(EXESUF)
74 check-unit-y += tests/test-opts-visitor$(EXESUF)
75 check-unit-$(CONFIG_BLOCK) += tests/test-coroutine$(EXESUF)
76 check-unit-y += tests/test-visitor-serialization$(EXESUF)
77 check-unit-$(CONFIG_SOFTMMU) += tests/test-iov$(EXESUF)
78 check-unit-y += tests/test-bitmap$(EXESUF)
79 check-unit-$(CONFIG_BLOCK) += tests/test-aio$(EXESUF)
80 check-unit-$(CONFIG_BLOCK) += tests/test-aio-multithread$(EXESUF)
81 check-unit-$(CONFIG_BLOCK) += tests/test-throttle$(EXESUF)
82 check-unit-$(CONFIG_BLOCK) += tests/test-thread-pool$(EXESUF)
83 check-unit-$(CONFIG_BLOCK) += tests/test-hbitmap$(EXESUF)
84 check-unit-$(CONFIG_BLOCK) += tests/test-bdrv-drain$(EXESUF)
85 check-unit-$(CONFIG_BLOCK) += tests/test-bdrv-graph-mod$(EXESUF)
86 check-unit-$(CONFIG_BLOCK) += tests/test-blockjob$(EXESUF)
87 check-unit-$(CONFIG_BLOCK) += tests/test-blockjob-txn$(EXESUF)
88 check-unit-$(CONFIG_BLOCK) += tests/test-block-backend$(EXESUF)
89 check-unit-$(CONFIG_BLOCK) += tests/test-block-iothread$(EXESUF)
90 check-unit-$(CONFIG_BLOCK) += tests/test-image-locking$(EXESUF)
91 check-unit-y += tests/test-x86-cpuid$(EXESUF)
92 # all code tested by test-x86-cpuid is inside topology.h
93 ifeq ($(CONFIG_SOFTMMU),y)
94 check-unit-y += tests/test-xbzrle$(EXESUF)
95 check-unit-$(CONFIG_POSIX) += tests/test-vmstate$(EXESUF)
96 endif
97 check-unit-y += tests/test-cutils$(EXESUF)
98 check-unit-y += tests/test-shift128$(EXESUF)
99 check-unit-y += tests/test-mul64$(EXESUF)
100 check-unit-y += tests/test-int128$(EXESUF)
101 # all code tested by test-int128 is inside int128.h
102 check-unit-y += tests/rcutorture$(EXESUF)
103 check-unit-y += tests/test-rcu-list$(EXESUF)
104 check-unit-y += tests/test-rcu-simpleq$(EXESUF)
105 check-unit-y += tests/test-rcu-tailq$(EXESUF)
106 check-unit-y += tests/test-rcu-slist$(EXESUF)
107 check-unit-y += tests/test-qdist$(EXESUF)
108 check-unit-y += tests/test-qht$(EXESUF)
109 check-unit-y += tests/test-qht-par$(EXESUF)
110 check-unit-y += tests/test-bitops$(EXESUF)
111 check-unit-y += tests/test-bitcnt$(EXESUF)
112 check-unit-y += tests/check-qom-interface$(EXESUF)
113 check-unit-y += tests/check-qom-proplist$(EXESUF)
114 check-unit-y += tests/test-qemu-opts$(EXESUF)
115 check-unit-y += tests/test-keyval$(EXESUF)
116 check-unit-$(CONFIG_BLOCK) += tests/test-write-threshold$(EXESUF)
117 check-unit-$(CONFIG_BLOCK) += tests/test-crypto-hash$(EXESUF)
118 check-speed-$(CONFIG_BLOCK) += tests/benchmark-crypto-hash$(EXESUF)
119 check-unit-$(CONFIG_BLOCK) += tests/test-crypto-hmac$(EXESUF)
120 check-speed-$(CONFIG_BLOCK) += tests/benchmark-crypto-hmac$(EXESUF)
121 check-unit-$(CONFIG_BLOCK) += tests/test-crypto-cipher$(EXESUF)
122 check-speed-$(CONFIG_BLOCK) += tests/benchmark-crypto-cipher$(EXESUF)
123 check-unit-$(CONFIG_BLOCK) += tests/test-crypto-secret$(EXESUF)
124 check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_GNUTLS)) += tests/test-crypto-tlscredsx509$(EXESUF)
125 check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_GNUTLS)) += tests/test-crypto-tlssession$(EXESUF)
126 ifndef CONFIG_TSAN
127 # Some tests: test-char, test-qdev-global-props, and test-qga,
128 # are not runnable under TSan due to a known issue.
129 # https://github.com/google/sanitizers/issues/1116
130 check-unit-$(CONFIG_SOFTMMU) += tests/test-char$(EXESUF)
131 check-unit-$(CONFIG_SOFTMMU) += tests/test-qdev-global-props$(EXESUF)
132 ifeq ($(CONFIG_GUEST_AGENT),y)
133 check-unit-$(call land,$(CONFIG_LINUX),$(CONFIG_VIRTIO_SERIAL)) += tests/test-qga$(EXESUF)
134 endif
135 endif
136 check-unit-$(CONFIG_SOFTMMU) += tests/test-timed-average$(EXESUF)
137 check-unit-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_INOTIFY1)) += tests/test-util-filemonitor$(EXESUF)
138 check-unit-$(CONFIG_SOFTMMU) += tests/test-util-sockets$(EXESUF)
139 check-unit-$(CONFIG_BLOCK) += tests/test-authz-simple$(EXESUF)
140 check-unit-$(CONFIG_BLOCK) += tests/test-authz-list$(EXESUF)
141 check-unit-$(CONFIG_BLOCK) += tests/test-authz-listfile$(EXESUF)
142 check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_AUTH_PAM)) += tests/test-authz-pam$(EXESUF)
143 check-unit-$(CONFIG_BLOCK) += tests/test-io-task$(EXESUF)
144 check-unit-$(CONFIG_BLOCK) += tests/test-io-channel-socket$(EXESUF)
145 check-unit-$(CONFIG_BLOCK) += tests/test-io-channel-file$(EXESUF)
146 check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_GNUTLS)) += tests/test-io-channel-tls$(EXESUF)
147 check-unit-$(CONFIG_BLOCK) += tests/test-io-channel-command$(EXESUF)
148 check-unit-$(CONFIG_BLOCK) += tests/test-io-channel-buffer$(EXESUF)
149 check-unit-$(CONFIG_SOFTMMU) += tests/test-base64$(EXESUF)
150 check-unit-$(call land,$(CONFIG_BLOCK),$(if $(CONFIG_NETTLE),y,$(CONFIG_GCRYPT))) += tests/test-crypto-pbkdf$(EXESUF)
151 check-unit-$(CONFIG_BLOCK) += tests/test-crypto-ivgen$(EXESUF)
152 check-unit-$(CONFIG_BLOCK)  += tests/test-crypto-afsplit$(EXESUF)
153 check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_QEMU_PRIVATE_XTS)) += tests/test-crypto-xts$(EXESUF)
154 check-unit-$(CONFIG_BLOCK)  += tests/test-crypto-block$(EXESUF)
155 check-unit-y += tests/test-logging$(EXESUF)
156 check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_REPLICATION)) += tests/test-replication$(EXESUF)
157 check-unit-$(CONFIG_SOFTMMU) += tests/test-bufferiszero$(EXESUF)
158 check-unit-y += tests/test-uuid$(EXESUF)
159 check-unit-y += tests/ptimer-test$(EXESUF)
160 check-unit-y += tests/test-qapi-util$(EXESUF)
161
162 check-block-$(call land,$(CONFIG_POSIX),$(CONFIG_SOFTMMU)) += tests/check-block.sh
163
164 generated-files-y += tests/test-qapi-types.h
165 generated-files-y += tests/include/test-qapi-types-sub-module.h
166 generated-files-y += tests/test-qapi-types-sub-sub-module.h
167 generated-files-y += tests/test-qapi-visit.h
168 generated-files-y += tests/include/test-qapi-visit-sub-module.h
169 generated-files-y += tests/test-qapi-visit-sub-sub-module.h
170 generated-files-y += tests/test-qapi-commands.h
171 generated-files-y += tests/test-qapi-init-commands.h
172 generated-files-y += tests/include/test-qapi-commands-sub-module.h
173 generated-files-y += tests/test-qapi-commands-sub-sub-module.h
174 generated-files-y += tests/test-qapi-emit-events.h
175 generated-files-y += tests/test-qapi-events.h
176 generated-files-y += tests/include/test-qapi-events-sub-module.h
177 generated-files-y += tests/test-qapi-events-sub-sub-module.h
178 generated-files-y += tests/test-qapi-introspect.h
179
180 QEMU_CFLAGS += -I$(SRC_PATH)/tests -I$(SRC_PATH)/tests/qtest
181
182
183 # Deps that are common to various different sets of tests below
184 test-util-obj-y = libqemuutil.a
185 test-qom-obj-y = $(qom-obj-y) $(test-util-obj-y)
186 test-qapi-obj-y = tests/test-qapi-types.o \
187         tests/include/test-qapi-types-sub-module.o \
188         tests/test-qapi-types-sub-sub-module.o \
189         tests/test-qapi-visit.o \
190         tests/include/test-qapi-visit-sub-module.o \
191         tests/test-qapi-visit-sub-sub-module.o \
192         tests/test-qapi-introspect.o \
193         $(test-qom-obj-y)
194 benchmark-crypto-obj-$(CONFIG_BLOCK) = $(authz-obj-y) $(crypto-obj-y) $(test-qom-obj-y)
195 test-crypto-obj-$(CONFIG_BLOCK) = $(authz-obj-y) $(crypto-obj-y) $(test-qom-obj-y)
196 test-io-obj-$(CONFIG_BLOCK) = $(io-obj-y) $(test-crypto-obj-y)
197 test-authz-obj-$(CONFIG_BLOCK) = $(test-qom-obj-y) $(authz-obj-y)
198 test-block-obj-$(CONFIG_BLOCK) = $(block-obj-y) $(test-io-obj-y) tests/iothread.o
199
200 tests/check-qnum$(EXESUF): tests/check-qnum.o $(test-util-obj-y)
201 tests/check-qstring$(EXESUF): tests/check-qstring.o $(test-util-obj-y)
202 tests/check-qdict$(EXESUF): tests/check-qdict.o $(test-util-obj-y)
203 tests/check-block-qdict$(EXESUF): tests/check-block-qdict.o $(test-util-obj-y)
204 tests/check-qlist$(EXESUF): tests/check-qlist.o $(test-util-obj-y)
205 tests/check-qnull$(EXESUF): tests/check-qnull.o $(test-util-obj-y)
206 tests/check-qobject$(EXESUF): tests/check-qobject.o $(test-util-obj-y)
207 tests/check-qjson$(EXESUF): tests/check-qjson.o $(test-util-obj-y)
208 tests/check-qlit$(EXESUF): tests/check-qlit.o $(test-util-obj-y)
209 tests/check-qom-interface$(EXESUF): tests/check-qom-interface.o $(test-qom-obj-y)
210 tests/check-qom-proplist$(EXESUF): tests/check-qom-proplist.o $(test-qom-obj-y)
211
212 tests/test-char$(EXESUF): tests/test-char.o $(test-util-obj-y) $(test-io-obj-y) $(chardev-obj-y) tests/socket-helpers.o
213 tests/test-coroutine$(EXESUF): tests/test-coroutine.o $(test-block-obj-y)
214 tests/test-aio$(EXESUF): tests/test-aio.o $(test-block-obj-y)
215 tests/test-aio-multithread$(EXESUF): tests/test-aio-multithread.o $(test-block-obj-y)
216 tests/test-throttle$(EXESUF): tests/test-throttle.o $(test-block-obj-y)
217 tests/test-bdrv-drain$(EXESUF): tests/test-bdrv-drain.o $(test-block-obj-y) $(test-util-obj-y)
218 tests/test-bdrv-graph-mod$(EXESUF): tests/test-bdrv-graph-mod.o $(test-block-obj-y) $(test-util-obj-y)
219 tests/test-blockjob$(EXESUF): tests/test-blockjob.o $(test-block-obj-y) $(test-util-obj-y)
220 tests/test-blockjob-txn$(EXESUF): tests/test-blockjob-txn.o $(test-block-obj-y) $(test-util-obj-y)
221 tests/test-block-backend$(EXESUF): tests/test-block-backend.o $(test-block-obj-y) $(test-util-obj-y)
222 tests/test-block-iothread$(EXESUF): tests/test-block-iothread.o $(test-block-obj-y) $(test-util-obj-y)
223 tests/test-image-locking$(EXESUF): tests/test-image-locking.o $(test-block-obj-y) $(test-util-obj-y)
224 tests/test-thread-pool$(EXESUF): tests/test-thread-pool.o $(test-block-obj-y)
225 tests/test-iov$(EXESUF): tests/test-iov.o $(test-util-obj-y)
226 tests/test-hbitmap$(EXESUF): tests/test-hbitmap.o $(test-util-obj-y) $(test-crypto-obj-y)
227 tests/test-bitmap$(EXESUF): tests/test-bitmap.o $(test-util-obj-y)
228 tests/test-x86-cpuid$(EXESUF): tests/test-x86-cpuid.o
229 tests/test-xbzrle$(EXESUF): tests/test-xbzrle.o migration/xbzrle.o migration/page_cache.o $(test-util-obj-y)
230 tests/test-cutils$(EXESUF): tests/test-cutils.o util/cutils.o $(test-util-obj-y)
231 tests/test-int128$(EXESUF): tests/test-int128.o
232 tests/rcutorture$(EXESUF): tests/rcutorture.o $(test-util-obj-y)
233 tests/test-rcu-list$(EXESUF): tests/test-rcu-list.o $(test-util-obj-y)
234 tests/test-rcu-simpleq$(EXESUF): tests/test-rcu-simpleq.o $(test-util-obj-y)
235 tests/test-rcu-tailq$(EXESUF): tests/test-rcu-tailq.o $(test-util-obj-y)
236 tests/test-rcu-slist$(EXESUF): tests/test-rcu-slist.o $(test-util-obj-y)
237 tests/test-qdist$(EXESUF): tests/test-qdist.o $(test-util-obj-y)
238 tests/test-qht$(EXESUF): tests/test-qht.o $(test-util-obj-y)
239 tests/test-qht-par$(EXESUF): tests/test-qht-par.o tests/qht-bench$(EXESUF) $(test-util-obj-y)
240 tests/qht-bench$(EXESUF): tests/qht-bench.o $(test-util-obj-y)
241 tests/test-bufferiszero$(EXESUF): tests/test-bufferiszero.o $(test-util-obj-y)
242 tests/atomic_add-bench$(EXESUF): tests/atomic_add-bench.o $(test-util-obj-y)
243 tests/atomic64-bench$(EXESUF): tests/atomic64-bench.o $(test-util-obj-y)
244
245 tests/test-qdev-global-props$(EXESUF): tests/test-qdev-global-props.o \
246         hw/core/qdev.o hw/core/qdev-properties.o hw/core/hotplug.o\
247         hw/core/bus.o \
248         hw/core/resettable.o \
249         hw/core/irq.o \
250         hw/core/fw-path-provider.o \
251         hw/core/reset.o \
252         hw/core/vmstate-if.o \
253         hw/core/clock.o hw/core/qdev-clock.o \
254         $(test-qapi-obj-y)
255 tests/test-vmstate$(EXESUF): tests/test-vmstate.o \
256         migration/vmstate.o migration/vmstate-types.o migration/qemu-file.o \
257         migration/qemu-file-channel.o migration/qjson.o \
258         $(test-io-obj-y)
259 tests/test-timed-average$(EXESUF): tests/test-timed-average.o $(test-util-obj-y)
260 tests/test-base64$(EXESUF): tests/test-base64.o $(test-util-obj-y)
261 tests/ptimer-test$(EXESUF): tests/ptimer-test.o tests/ptimer-test-stubs.o hw/core/ptimer.o
262 tests/test-qemu-opts$(EXESUF): tests/test-qemu-opts.o $(test-util-obj-y)
263 tests/test-keyval$(EXESUF): tests/test-keyval.o $(test-util-obj-y) $(test-qapi-obj-y)
264 tests/test-write-threshold$(EXESUF): tests/test-write-threshold.o $(test-block-obj-y)
265 tests/test-uuid$(EXESUF): tests/test-uuid.o $(test-util-obj-y)
266 tests/test-qapi-util$(EXESUF): tests/test-qapi-util.o $(test-util-obj-y)
267
268 tests/test-logging$(EXESUF): tests/test-logging.o $(test-util-obj-y)
269
270 tests/test-replication$(EXESUF): tests/test-replication.o $(test-util-obj-y) \
271         $(test-block-obj-y)
272
273 tests/test-qapi-types.c tests/test-qapi-types.h \
274 tests/include/test-qapi-types-sub-module.c \
275 tests/include/test-qapi-types-sub-module.h \
276 tests/test-qapi-types-sub-sub-module.c \
277 tests/test-qapi-types-sub-sub-module.h \
278 tests/test-qapi-visit.c tests/test-qapi-visit.h \
279 tests/include/test-qapi-visit-sub-module.c \
280 tests/include/test-qapi-visit-sub-module.h \
281 tests/test-qapi-visit-sub-sub-module.c \
282 tests/test-qapi-visit-sub-sub-module.h \
283 tests/test-qapi-commands.h tests/test-qapi-commands.c \
284 tests/include/test-qapi-commands-sub-module.h \
285 tests/include/test-qapi-commands-sub-module.c \
286 tests/test-qapi-commands-sub-sub-module.h \
287 tests/test-qapi-commands-sub-sub-module.c \
288 tests/test-qapi-emit-events.c tests/test-qapi-emit-events.h \
289 tests/test-qapi-events.c tests/test-qapi-events.h \
290 tests/test-qapi-init-commands.c \
291 tests/test-qapi-init-commands.h \
292 tests/include/test-qapi-events-sub-module.c \
293 tests/include/test-qapi-events-sub-module.h \
294 tests/test-qapi-events-sub-sub-module.c \
295 tests/test-qapi-events-sub-sub-module.h \
296 tests/test-qapi-introspect.c tests/test-qapi-introspect.h: \
297 tests/test-qapi-gen-timestamp ;
298 tests/test-qapi-gen-timestamp: \
299                 $(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json \
300                 $(SRC_PATH)/tests/qapi-schema/include/sub-module.json \
301                 $(SRC_PATH)/tests/qapi-schema/sub-sub-module.json \
302                 $(qapi-py)
303         $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \
304                 -o tests -p "test-" $<, \
305                 "GEN","$(@:%-timestamp=%)")
306         @rm -f tests/test-qapi-doc.texi
307         @>$@
308
309 tests/qtest/dbus-vmstate1.h tests/qtest/dbus-vmstate1.c: tests/qtest/dbus-vmstate1-gen-timestamp ;
310 tests/qtest/dbus-vmstate1-gen-timestamp: $(SRC_PATH)/tests/qtest/dbus-vmstate1.xml
311         $(call quiet-command,$(GDBUS_CODEGEN) $< \
312                 --interface-prefix org.qemu --generate-c-code tests/qtest/dbus-vmstate1, \
313                 "GEN","$(@:%-timestamp=%)")
314         @>$@
315
316 tests/qtest/dbus-vmstate-test.o-cflags := -DSRCDIR="$(SRC_PATH)"
317 tests/qtest/dbus-vmstate1.o-cflags := $(GIO_CFLAGS)
318 tests/qtest/dbus-vmstate1.o-libs := $(GIO_LIBS)
319
320 tests/qtest/dbus-vmstate-test.o: tests/qtest/dbus-vmstate1.h
321
322 tests/test-string-output-visitor$(EXESUF): tests/test-string-output-visitor.o $(test-qapi-obj-y)
323 tests/test-string-input-visitor$(EXESUF): tests/test-string-input-visitor.o $(test-qapi-obj-y)
324 tests/test-qmp-event$(EXESUF): tests/test-qmp-event.o $(test-qapi-obj-y) tests/test-qapi-emit-events.o tests/test-qapi-events.o
325 tests/test-qobject-output-visitor$(EXESUF): tests/test-qobject-output-visitor.o $(test-qapi-obj-y)
326 tests/test-clone-visitor$(EXESUF): tests/test-clone-visitor.o $(test-qapi-obj-y)
327 tests/test-qobject-input-visitor$(EXESUF): tests/test-qobject-input-visitor.o $(test-qapi-obj-y)
328 tests/test-qmp-cmds$(EXESUF): tests/test-qmp-cmds.o tests/test-qapi-commands.o tests/test-qapi-init-commands.o $(test-qapi-obj-y)
329 tests/test-visitor-serialization$(EXESUF): tests/test-visitor-serialization.o $(test-qapi-obj-y)
330 tests/test-opts-visitor$(EXESUF): tests/test-opts-visitor.o $(test-qapi-obj-y)
331
332 tests/test-shift128$(EXESUF): tests/test-shift128.o $(test-util-obj-y)
333 tests/test-mul64$(EXESUF): tests/test-mul64.o $(test-util-obj-y)
334 tests/test-bitops$(EXESUF): tests/test-bitops.o $(test-util-obj-y)
335 tests/test-bitcnt$(EXESUF): tests/test-bitcnt.o $(test-util-obj-y)
336 tests/test-crypto-hash$(EXESUF): tests/test-crypto-hash.o $(test-crypto-obj-y)
337 tests/benchmark-crypto-hash$(EXESUF): tests/benchmark-crypto-hash.o $(test-crypto-obj-y)
338 tests/test-crypto-hmac$(EXESUF): tests/test-crypto-hmac.o $(test-crypto-obj-y)
339 tests/benchmark-crypto-hmac$(EXESUF): tests/benchmark-crypto-hmac.o $(test-crypto-obj-y)
340 tests/test-crypto-cipher$(EXESUF): tests/test-crypto-cipher.o $(test-crypto-obj-y)
341 tests/benchmark-crypto-cipher$(EXESUF): tests/benchmark-crypto-cipher.o $(test-crypto-obj-y)
342 tests/test-crypto-secret$(EXESUF): tests/test-crypto-secret.o $(test-crypto-obj-y)
343 tests/test-crypto-xts$(EXESUF): tests/test-crypto-xts.o $(test-crypto-obj-y)
344
345 ifeq ($(CONFIG_TEST_SECRET_KEYRING),y)
346 tests/test-crypto-secret.o-libs := -lkeyutils
347 endif
348
349 tests/crypto-tls-x509-helpers.o-cflags := $(TASN1_CFLAGS)
350 tests/crypto-tls-x509-helpers.o-libs := $(TASN1_LIBS)
351 tests/pkix_asn1_tab.o-cflags := $(TASN1_CFLAGS)
352
353 tests/test-crypto-tlscredsx509.o-cflags := $(TASN1_CFLAGS)
354 tests/test-crypto-tlscredsx509$(EXESUF): tests/test-crypto-tlscredsx509.o \
355         tests/crypto-tls-x509-helpers.o tests/pkix_asn1_tab.o $(test-crypto-obj-y)
356
357 tests/test-crypto-tlssession.o-cflags := $(TASN1_CFLAGS)
358 tests/test-crypto-tlssession$(EXESUF): tests/test-crypto-tlssession.o \
359         tests/crypto-tls-x509-helpers.o tests/pkix_asn1_tab.o \
360         tests/crypto-tls-psk-helpers.o \
361         $(test-crypto-obj-y)
362 tests/test-util-filemonitor$(EXESUF): tests/test-util-filemonitor.o \
363         $(test-util-obj-y)
364 tests/test-util-sockets$(EXESUF): tests/test-util-sockets.o \
365         tests/socket-helpers.o $(test-util-obj-y)
366 tests/test-authz-simple$(EXESUF): tests/test-authz-simple.o $(test-authz-obj-y)
367 tests/test-authz-list$(EXESUF): tests/test-authz-list.o $(test-authz-obj-y)
368 tests/test-authz-listfile$(EXESUF): tests/test-authz-listfile.o $(test-authz-obj-y)
369 tests/test-authz-pam$(EXESUF): tests/test-authz-pam.o $(test-authz-obj-y)
370 tests/test-io-task$(EXESUF): tests/test-io-task.o $(test-io-obj-y)
371 tests/test-io-channel-socket$(EXESUF): tests/test-io-channel-socket.o \
372         tests/io-channel-helpers.o tests/socket-helpers.o $(test-io-obj-y)
373 tests/test-io-channel-file$(EXESUF): tests/test-io-channel-file.o \
374         tests/io-channel-helpers.o $(test-io-obj-y)
375 tests/test-io-channel-tls$(EXESUF): tests/test-io-channel-tls.o \
376         tests/crypto-tls-x509-helpers.o tests/pkix_asn1_tab.o \
377         tests/io-channel-helpers.o $(test-io-obj-y)
378 tests/test-io-channel-command$(EXESUF): tests/test-io-channel-command.o \
379         tests/io-channel-helpers.o $(test-io-obj-y)
380 tests/test-io-channel-buffer$(EXESUF): tests/test-io-channel-buffer.o \
381         tests/io-channel-helpers.o $(test-io-obj-y)
382 tests/test-crypto-pbkdf$(EXESUF): tests/test-crypto-pbkdf.o $(test-crypto-obj-y)
383 tests/test-crypto-ivgen$(EXESUF): tests/test-crypto-ivgen.o $(test-crypto-obj-y)
384 tests/test-crypto-afsplit$(EXESUF): tests/test-crypto-afsplit.o $(test-crypto-obj-y)
385 tests/test-crypto-block$(EXESUF): tests/test-crypto-block.o $(test-crypto-obj-y)
386
387 tests/migration/stress$(EXESUF): tests/migration/stress.o
388         $(call quiet-command, $(LINKPROG) -static -O3 $(PTHREAD_LIB) -o $@ $< ,"LINK","$(TARGET_DIR)$@")
389
390 INITRD_WORK_DIR=tests/migration/initrd
391
392 tests/migration/initrd-stress.img: tests/migration/stress$(EXESUF)
393         mkdir -p $(INITRD_WORK_DIR)
394         cp $< $(INITRD_WORK_DIR)/init
395         (cd $(INITRD_WORK_DIR) && (find | cpio --quiet -o -H newc | gzip -9)) > $@
396         rm $(INITRD_WORK_DIR)/init
397         rmdir $(INITRD_WORK_DIR)
398
399 include $(SRC_PATH)/tests/qtest/Makefile.include
400
401 tests/test-qga$(EXESUF): qga/qemu-ga$(EXESUF)
402 tests/test-qga$(EXESUF): tests/test-qga.o $(qtest-obj-y)
403 tests/vhost-user-bridge$(EXESUF): tests/vhost-user-bridge.o $(test-util-obj-y) libvhost-user.a
404 tests/qemu-iotests/socket_scm_helper$(EXESUF): tests/qemu-iotests/socket_scm_helper.o
405
406 SPEED = quick
407
408 # gtester tests, possibly with verbose output
409 # do_test_tap runs all tests, even if some of them fail, while do_test_human
410 # stops at the first failure unless -k is given on the command line
411
412 define do_test_human_k
413         $(quiet-@)rc=0; $(foreach COMMAND, $1, \
414           $(call quiet-command-run, \
415             export MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))} $2; \
416               $(COMMAND) -m=$(SPEED) -k --tap < /dev/null \
417               | ./scripts/tap-driver.pl --test-name="$(notdir $(COMMAND))" $(if $(V),, --show-failures-only) \
418               || rc=$$?;, "TEST", "$@: $(COMMAND)")) exit $$rc
419 endef
420 define do_test_human_no_k
421         $(foreach COMMAND, $1, \
422           $(call quiet-command, \
423             MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))} $2 \
424               $(COMMAND) -m=$(SPEED) -k --tap < /dev/null \
425               | ./scripts/tap-driver.pl --test-name="$(notdir $(COMMAND))" $(if $(V),, --show-failures-only), \
426               "TEST", "$@: $(COMMAND)")
427 )
428 endef
429 do_test_human = \
430         $(if $(findstring k, $(MAKEFLAGS)), $(do_test_human_k), $(do_test_human_no_k))
431
432 define do_test_tap
433         $(call quiet-command, \
434           { export MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))} $2; \
435             $(foreach COMMAND, $1, \
436               $(COMMAND) -m=$(SPEED) -k --tap < /dev/null \
437               | sed "s/^\(not \)\?ok [0-9]* /&$(notdir $(COMMAND)) /" || true; ) } \
438               | ./scripts/tap-merge.pl | tee "$@" \
439               | ./scripts/tap-driver.pl $(if $(V),, --show-failures-only), \
440           "TAP","$@")
441 endef
442
443 .PHONY: $(patsubst %, check-qtest-%, $(QTEST_TARGETS))
444 $(patsubst %, check-qtest-%, $(QTEST_TARGETS)): check-qtest-%: %-softmmu/all $(check-qtest-y)
445         $(call do_test_human,$(check-qtest-$*-y:%=tests/qtest/%$(EXESUF)) $(check-qtest-generic-y:%=tests/qtest/%$(EXESUF)), \
446           QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
447           QTEST_QEMU_IMG=qemu-img$(EXESUF))
448
449 build-qtest: $(patsubst %, %-softmmu/all, $(QTEST_TARGETS)) $(check-qtest-y)
450
451 build-unit: $(check-unit-y)
452
453 check-unit: $(check-unit-y)
454         $(call do_test_human, $^)
455
456 check-speed: $(check-speed-y)
457         $(call do_test_human, $^)
458
459 # gtester tests with TAP output
460
461 $(patsubst %, check-report-qtest-%.tap, $(QTEST_TARGETS)): check-report-qtest-%.tap: %-softmmu/all $(check-qtest-y)
462         $(call do_test_tap, $(check-qtest-$*-y:%=tests/qtest/%$(EXESUF)) $(check-qtest-generic-y:%=tests/qtest/%$(EXESUF)), \
463           QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
464           QTEST_QEMU_IMG=qemu-img$(EXESUF))
465
466 check-report-unit.tap: $(check-unit-y)
467         $(call do_test_tap,$^)
468
469 # Reports and overall runs
470
471 check-report.tap: $(patsubst %,check-report-qtest-%.tap, $(QTEST_TARGETS)) check-report-unit.tap
472
473 # Plugins
474 ifeq ($(CONFIG_PLUGIN),y)
475 .PHONY: plugins
476 plugins:
477         $(call quiet-command,\
478                 $(MAKE) $(SUBDIR_MAKEFLAGS) -C tests/plugin V="$(V)", \
479                 "BUILD", "plugins")
480 endif
481
482 # Per guest TCG tests
483
484 BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(TARGET_DIRS))
485 CLEAN_TCG_TARGET_RULES=$(patsubst %,clean-tcg-tests-%, $(TARGET_DIRS))
486 RUN_TCG_TARGET_RULES=$(patsubst %,run-tcg-tests-%, $(TARGET_DIRS))
487
488 # Probe for the Docker Builds needed for each build
489 $(foreach PROBE_TARGET,$(TARGET_DIRS),                          \
490         $(eval -include $(SRC_PATH)/tests/tcg/Makefile.prereqs))
491
492 build-tcg-tests-%: $(if $(CONFIG_PLUGIN),plugins)
493         $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) \
494                 -f $(SRC_PATH)/tests/tcg/Makefile.qemu \
495                 SRC_PATH=$(SRC_PATH) \
496                 V="$(V)" TARGET="$*" guest-tests, \
497                 "BUILD", "TCG tests for $*")
498
499 run-tcg-tests-%: build-tcg-tests-% %/all
500         $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) \
501                 -f $(SRC_PATH)/tests/tcg/Makefile.qemu \
502                 SRC_PATH=$(SRC_PATH) SPEED="$(SPEED)" \
503                 V="$(V)" TARGET="$*" run-guest-tests, \
504                 "RUN", "TCG tests for $*")
505
506 clean-tcg-tests-%:
507         $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) \
508                 -f $(SRC_PATH)/tests/tcg/Makefile.qemu \
509                 SRC_PATH=$(SRC_PATH) TARGET="$*" clean-guest-tests, \
510                 "CLEAN", "TCG tests for $*")
511
512 .PHONY: build-tcg
513 build-tcg: $(BUILD_TCG_TARGET_RULES)
514
515 .PHONY: check-tcg
516 check-tcg: $(RUN_TCG_TARGET_RULES)
517
518 .PHONY: clean-tcg
519 clean-tcg: $(CLEAN_TCG_TARGET_RULES)
520
521
522 QEMU_IOTESTS_HELPERS-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_LINUX)) = tests/qemu-iotests/socket_scm_helper$(EXESUF)
523
524 .PHONY: check-tests/check-block.sh
525 check-tests/check-block.sh: tests/check-block.sh qemu-img$(EXESUF) \
526                 qemu-io$(EXESUF) qemu-nbd$(EXESUF) $(QEMU_IOTESTS_HELPERS-y) \
527                 $(patsubst %,%/all,$(filter %-softmmu,$(TARGET_DIRS)))
528         @$<
529
530 # Python venv for running tests
531
532 .PHONY: check-venv check-acceptance
533
534 TESTS_VENV_DIR=$(BUILD_DIR)/tests/venv
535 TESTS_VENV_REQ=$(SRC_PATH)/tests/requirements.txt
536 TESTS_RESULTS_DIR=$(BUILD_DIR)/tests/results
537 # Controls the output generated by Avocado when running tests.
538 # Any number of command separated loggers are accepted.  For more
539 # information please refer to "avocado --help".
540 AVOCADO_SHOW=app
541 AVOCADO_TAGS=$(patsubst %-softmmu,-t arch:%, $(filter %-softmmu,$(TARGET_DIRS)))
542
543 $(TESTS_VENV_DIR): $(TESTS_VENV_REQ)
544         $(call quiet-command, \
545             $(PYTHON) -m venv --system-site-packages $@, \
546             VENV, $@)
547         $(call quiet-command, \
548             $(TESTS_VENV_DIR)/bin/python -m pip -q install -r $(TESTS_VENV_REQ), \
549             PIP, $(TESTS_VENV_REQ))
550         $(call quiet-command, touch $@)
551
552 $(TESTS_RESULTS_DIR):
553         $(call quiet-command, mkdir -p $@, \
554             MKDIR, $@)
555
556 check-venv: $(TESTS_VENV_DIR)
557
558 FEDORA_31_ARCHES_CANDIDATES=$(patsubst ppc64,ppc64le,$(TARGETS))
559 FEDORA_31_ARCHES := x86_64 aarch64 ppc64le s390x
560 FEDORA_31_DOWNLOAD=$(filter $(FEDORA_31_ARCHES),$(FEDORA_31_ARCHES_CANDIDATES))
561
562 # download one specific Fedora 31 image
563 get-vm-image-fedora-31-%: check-venv
564         $(call quiet-command, \
565              $(TESTS_VENV_DIR)/bin/python -m avocado vmimage get \
566              --distro=fedora --distro-version=31 --arch=$*, \
567         "AVOCADO", "Downloading acceptance tests VM image for $*")
568
569 # download all vm images, according to defined targets
570 get-vm-images: check-venv $(patsubst %,get-vm-image-fedora-31-%, $(FEDORA_31_DOWNLOAD))
571
572 check-acceptance: check-venv $(TESTS_RESULTS_DIR) get-vm-images
573         $(call quiet-command, \
574             $(TESTS_VENV_DIR)/bin/python -m avocado \
575             --show=$(AVOCADO_SHOW) run --job-results-dir=$(TESTS_RESULTS_DIR) \
576             --filter-by-tags-include-empty --filter-by-tags-include-empty-key \
577             $(AVOCADO_TAGS) \
578             $(if $(GITLAB_CI),,--failfast=on) tests/acceptance, \
579             "AVOCADO", "tests/acceptance")
580
581 # Consolidated targets
582
583 .PHONY: check-block check-qtest check-unit check check-clean get-vm-images
584 check-qtest: $(patsubst %,check-qtest-%, $(QTEST_TARGETS))
585 ifeq ($(CONFIG_TOOLS),y)
586 check-block: $(patsubst %,check-%, $(check-block-y))
587 endif
588 check-build: build-unit build-qtest
589
590 check-clean:
591         rm -rf $(check-unit-y) tests/*.o tests/*/*.o $(QEMU_IOTESTS_HELPERS-y)
592         rm -rf $(sort $(foreach target,$(SYSEMU_TARGET_LIST), $(check-qtest-$(target)-y:%=tests/qtest/%$(EXESUF))) $(check-qtest-generic-y:%=tests/qtest/%$(EXESUF)))
593         rm -f tests/test-qapi-gen-timestamp
594         rm -f tests/qtest/dbus-vmstate1-gen-timestamp
595         rm -rf $(TESTS_VENV_DIR) $(TESTS_RESULTS_DIR)
596
597 check: check-block check-unit check-qtest
598
599 clean: check-clean
600
601 # Build the help program automatically
602
603 all: $(QEMU_IOTESTS_HELPERS-y)
604
605 -include $(wildcard tests/*.d)
606 -include $(wildcard tests/qtest/*.d)
607 -include $(wildcard tests/qtest/libqos/*.d)
608
609 endif
This page took 0.056745 seconds and 4 git commands to generate.