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