blob: 75b46599f6e21f81432b7e050792ad74596d8b03 [file] [log] [blame]
Kevin Wolf89594492012-03-08 12:29:00 +01001export SRC_PATH
2
Peter Maydell3687d532014-01-23 16:22:59 +00003# Get the list of all supported sysemu targets
4SYSEMU_TARGET_LIST := $(subst -softmmu.mak,,$(notdir \
5 $(wildcard $(SRC_PATH)/default-configs/*-softmmu.mak)))
6
Paolo Bonzinib93b63f2012-03-28 15:42:01 +02007check-unit-y = tests/check-qdict$(EXESUF)
Paolo Bonzini5f7a74a2013-01-15 09:49:35 +01008gcov-files-check-qdict-y = qobject/qdict.c
Paolo Bonzinib93b63f2012-03-28 15:42:01 +02009check-unit-y += tests/check-qfloat$(EXESUF)
Paolo Bonzini5f7a74a2013-01-15 09:49:35 +010010gcov-files-check-qfloat-y = qobject/qfloat.c
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020011check-unit-y += tests/check-qint$(EXESUF)
Paolo Bonzini5f7a74a2013-01-15 09:49:35 +010012gcov-files-check-qint-y = qobject/qint.c
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020013check-unit-y += tests/check-qstring$(EXESUF)
Paolo Bonzini5f7a74a2013-01-15 09:49:35 +010014gcov-files-check-qstring-y = qobject/qstring.c
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020015check-unit-y += tests/check-qlist$(EXESUF)
Paolo Bonzini5f7a74a2013-01-15 09:49:35 +010016gcov-files-check-qlist-y = qobject/qlist.c
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020017check-unit-y += tests/check-qjson$(EXESUF)
Paolo Bonzini5f7a74a2013-01-15 09:49:35 +010018gcov-files-check-qjson-y = qobject/qjson.c
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020019check-unit-y += tests/test-qmp-output-visitor$(EXESUF)
Blue Swirl1d728c32012-05-01 18:45:39 +000020gcov-files-test-qmp-output-visitor-y = qapi/qmp-output-visitor.c
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020021check-unit-y += tests/test-qmp-input-visitor$(EXESUF)
Blue Swirl1d728c32012-05-01 18:45:39 +000022gcov-files-test-qmp-input-visitor-y = qapi/qmp-input-visitor.c
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020023check-unit-y += tests/test-qmp-input-strict$(EXESUF)
24check-unit-y += tests/test-qmp-commands$(EXESUF)
Blue Swirl1d728c32012-05-01 18:45:39 +000025gcov-files-test-qmp-commands-y = qapi/qmp-dispatch.c
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020026check-unit-y += tests/test-string-input-visitor$(EXESUF)
Blue Swirl1d728c32012-05-01 18:45:39 +000027gcov-files-test-string-input-visitor-y = qapi/string-input-visitor.c
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020028check-unit-y += tests/test-string-output-visitor$(EXESUF)
Blue Swirl1d728c32012-05-01 18:45:39 +000029gcov-files-test-string-output-visitor-y = qapi/string-output-visitor.c
Laszlo Ersek3953e3a2013-08-20 00:35:40 +020030check-unit-y += tests/test-opts-visitor$(EXESUF)
31gcov-files-test-opts-visitor-y = qapi/opts-visitor.c
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020032check-unit-y += tests/test-coroutine$(EXESUF)
Peter Maydell7c2acc72013-04-08 12:11:27 +010033gcov-files-test-coroutine-y = coroutine-$(CONFIG_COROUTINE_BACKEND).c
Michael Roth2d496102012-02-21 21:05:07 -060034check-unit-y += tests/test-visitor-serialization$(EXESUF)
Michael Tokarev2278a692012-06-07 20:08:19 +040035check-unit-y += tests/test-iov$(EXESUF)
Paolo Bonzini5f7a74a2013-01-15 09:49:35 +010036gcov-files-test-iov-y = util/iov.c
Paolo Bonzinib2ea25d2012-11-23 16:13:23 +010037check-unit-y += tests/test-aio$(EXESUF)
Benoît Canetf17cfe82013-09-02 14:14:38 +020038check-unit-y += tests/test-throttle$(EXESUF)
Blue Swirl1d728c32012-05-01 18:45:39 +000039gcov-files-test-aio-$(CONFIG_WIN32) = aio-win32.c
40gcov-files-test-aio-$(CONFIG_POSIX) = aio-posix.c
Paolo Bonzini74c856e2012-11-23 16:13:24 +010041check-unit-y += tests/test-thread-pool$(EXESUF)
Blue Swirl1d728c32012-05-01 18:45:39 +000042gcov-files-test-thread-pool-y = thread-pool.c
Paolo Bonzinie7c033c2013-01-21 17:09:40 +010043gcov-files-test-hbitmap-y = util/hbitmap.c
44check-unit-y += tests/test-hbitmap$(EXESUF)
Eduardo Habkost247c9de2013-01-23 15:58:27 -020045check-unit-y += tests/test-x86-cpuid$(EXESUF)
46# all code tested by test-x86-cpuid is inside topology.h
47gcov-files-test-x86-cpuid-y =
Orit Wasserman21e3cd22013-01-31 09:12:16 +020048check-unit-y += tests/test-xbzrle$(EXESUF)
49gcov-files-test-xbzrle-y = xbzrle.c
Eduardo Habkoste3f9fe22013-02-04 16:27:45 -020050check-unit-y += tests/test-cutils$(EXESUF)
51gcov-files-test-cutils-y += util/cutils.c
Richard Hendersonf4c0f982013-02-16 12:47:01 -080052check-unit-y += tests/test-mul64$(EXESUF)
53gcov-files-test-mul64-y = util/host-utils.c
Paolo Bonzini6046c622013-06-20 16:19:32 +020054check-unit-y += tests/test-int128$(EXESUF)
55# all code tested by test-int128 is inside int128.h
56gcov-files-test-int128-y =
Peter Maydell34647002013-06-28 12:40:32 +010057check-unit-y += tests/test-bitops$(EXESUF)
Eduardo Habkost747b0cb2013-07-10 17:08:40 -030058check-unit-y += tests/test-qdev-global-props$(EXESUF)
Igor Mammedov14389db2013-12-20 22:14:40 +010059check-unit-y += tests/check-qom-interface$(EXESUF)
60gcov-files-check-qom-interface-y = qom/object.c
Eduardo Habkost2668b4b2013-11-28 12:01:18 -020061check-unit-y += tests/test-vmstate$(EXESUF)
Anthony Liguoriad65aa82012-01-10 13:10:51 -060062
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020063check-block-$(CONFIG_POSIX) += tests/qemu-iotests-quick.sh
Anthony Liguoridbfe06c2012-01-10 13:10:43 -060064
Anthony Liguorid1aaf542012-03-28 15:42:07 +020065# All QTests for now are POSIX-only, but the dependencies are
66# really in libqtest, not in the testcases themselves.
Andreas Färbera21baf72013-11-07 18:25:10 +010067
Andreas Färber1f9c4cf2013-08-02 00:48:40 +020068gcov-files-ipack-y += hw/ipack/ipack.c
Andreas Färber37146822014-02-09 12:24:15 +010069check-qtest-ipack-y += tests/ipoctal232-test$(EXESUF)
70gcov-files-ipack-y += hw/char/ipoctal232.c
71
Andreas Färberb815ec52014-02-09 04:13:37 +010072gcov-files-virtio-y += i386-softmmu/hw/virtio/virtio.c
73check-qtest-virtio-y += tests/virtio-net-test$(EXESUF)
74gcov-files-virtio-y += i386-softmmu/hw/net/virtio-net.c
Andreas Färber02063aa2014-02-09 04:39:47 +010075check-qtest-virtio-y += tests/virtio-balloon-test$(EXESUF)
76gcov-files-virtio-y += i386-softmmu/hw/virtio/virtio-balloon.c
Andreas Färberc7a59be2014-02-09 04:32:55 +010077check-qtest-virtio-y += tests/virtio-blk-test$(EXESUF)
78gcov-files-virtio-y += i386-softmmu/hw/block/virtio-blk.c
Andreas Färberb6f46f02014-02-09 04:43:10 +010079check-qtest-virtio-y += tests/virtio-rng-test$(EXESUF)
80gcov-files-virtio-y += hw/virtio/virtio-rng.c
Andreas Färber26c9a012014-02-21 16:42:15 +010081check-qtest-virtio-y += tests/virtio-scsi-test$(EXESUF)
82gcov-files-virtio-y += i386-softmmu/hw/scsi/virtio-scsi.c
Andreas Färberb815ec52014-02-09 04:13:37 +010083
Andreas Färbera21baf72013-11-07 18:25:10 +010084check-qtest-pci-y += tests/e1000-test$(EXESUF)
85gcov-files-pci-y += hw/net/e1000.c
Andreas Färber74769fe2013-11-07 18:43:09 +010086check-qtest-pci-y += tests/rtl8139-test$(EXESUF)
87gcov-files-pci-y += hw/net/rtl8139.c
Andreas Färber85f68d52013-11-07 18:53:28 +010088check-qtest-pci-y += tests/pcnet-test$(EXESUF)
89gcov-files-pci-y += hw/net/pcnet.c
90gcov-files-pci-y += hw/net/pcnet-pci.c
Andreas Färber92838a12013-11-07 19:18:46 +010091check-qtest-pci-y += tests/eepro100-test$(EXESUF)
92gcov-files-pci-y += hw/net/eepro100.c
Andreas Färber5297ea62014-02-09 04:01:37 +010093check-qtest-pci-y += tests/ne2000-test$(EXESUF)
94gcov-files-pci-y += hw/net/ne2000.c
Andreas Färberb815ec52014-02-09 04:13:37 +010095check-qtest-pci-y += $(check-qtest-virtio-y)
96gcov-files-pci-y += $(gcov-files-virtio-y) hw/virtio/virtio-pci.c
Andreas Färber76491072014-02-09 03:48:44 +010097check-qtest-pci-y += tests/tpci200-test$(EXESUF)
Andreas Färber83bb0b22014-02-21 16:29:17 +010098gcov-files-pci-y += hw/ipack/tpci200.c
Andreas Färber37146822014-02-09 12:24:15 +010099check-qtest-pci-y += $(check-qtest-ipack-y)
Andreas Färber83bb0b22014-02-21 16:29:17 +0100100gcov-files-pci-y += $(gcov-files-ipack-y)
Andreas Färbera21baf72013-11-07 18:25:10 +0100101
Paolo Bonzini8fefa312013-07-22 15:54:34 +0200102check-qtest-i386-y = tests/endianness-test$(EXESUF)
103check-qtest-i386-y += tests/fdc-test$(EXESUF)
Andreas Färber5ec889b2014-02-14 15:09:28 +0100104gcov-files-i386-y = hw/block/fdc.c
Kevin Wolfacbe4802013-05-08 11:18:41 +0200105check-qtest-i386-y += tests/ide-test$(EXESUF)
Markus Armbruster0e8a8c82012-07-10 11:12:30 +0200106check-qtest-i386-y += tests/hd-geo-test$(EXESUF)
Andreas Färber5ec889b2014-02-14 15:09:28 +0100107gcov-files-i386-y += hw/block/hd-geometry.c
Markus Armbrusteredbd7902013-06-26 15:52:13 +0200108check-qtest-i386-y += tests/boot-order-test$(EXESUF)
Michael S. Tsirkinad6423a2013-10-18 00:52:18 +0300109check-qtest-i386-y += tests/acpi-test$(EXESUF)
Stefan Weilfba0c402012-05-15 18:19:45 +0200110check-qtest-i386-y += tests/rtc-test$(EXESUF)
Anthony Liguori9bda4132013-04-16 09:45:19 -0500111check-qtest-i386-y += tests/i440fx-test$(EXESUF)
Anthony Liguoribf2a38d2013-04-16 09:45:21 -0500112check-qtest-i386-y += tests/fw_cfg-test$(EXESUF)
Stefan Hajnoczi7ceeedd2013-10-30 14:54:34 +0100113check-qtest-i386-y += tests/blockdev-test$(EXESUF)
Stefan Hajnoczi43cd2092013-10-30 14:54:35 +0100114check-qtest-i386-y += tests/qdev-monitor-test$(EXESUF)
Andreas Färbera21baf72013-11-07 18:25:10 +0100115check-qtest-i386-y += $(check-qtest-pci-y)
116gcov-files-i386-y += $(gcov-files-pci-y)
Andreas Färber4a053e72013-11-07 18:37:34 +0100117check-qtest-i386-y += tests/vmxnet3-test$(EXESUF)
118gcov-files-i386-y += hw/net/vmxnet3.c
119gcov-files-i386-y += hw/net/vmxnet_rx_pkt.c
120gcov-files-i386-y += hw/net/vmxnet_tx_pkt.c
Anthony Liguorid1aaf542012-03-28 15:42:07 +0200121check-qtest-x86_64-y = $(check-qtest-i386-y)
Andreas Färber5ec889b2014-02-14 15:09:28 +0100122gcov-files-i386-y += i386-softmmu/hw/timer/mc146818rtc.c
Andreas Färberc5cd02b2013-01-26 12:45:14 +0100123gcov-files-x86_64-y = $(subst i386-softmmu/,x86_64-softmmu/,$(gcov-files-i386-y))
Paolo Bonzini8fefa312013-07-22 15:54:34 +0200124check-qtest-mips-y = tests/endianness-test$(EXESUF)
125check-qtest-mips64-y = tests/endianness-test$(EXESUF)
126check-qtest-mips64el-y = tests/endianness-test$(EXESUF)
127check-qtest-ppc-y = tests/endianness-test$(EXESUF)
128check-qtest-ppc64-y = tests/endianness-test$(EXESUF)
129check-qtest-sh4-y = tests/endianness-test$(EXESUF)
130check-qtest-sh4eb-y = tests/endianness-test$(EXESUF)
131check-qtest-sparc64-y = tests/endianness-test$(EXESUF)
Anthony Liguoribaeddde2013-01-29 15:42:45 -0600132#check-qtest-sparc-y = tests/m48t59-test$(EXESUF)
Paolo Bonzini8fefa312013-07-22 15:54:34 +0200133#check-qtest-sparc64-y += tests/m48t59-test$(EXESUF)
Andreas Färber5ec889b2014-02-14 15:09:28 +0100134gcov-files-sparc-y += hw/timer/m48t59.c
135gcov-files-sparc64-y += hw/timer/m48t59.c
Andreas Färber6e998902013-01-16 01:57:57 +0100136check-qtest-arm-y = tests/tmp105-test$(EXESUF)
Andreas Färber5ec889b2014-02-14 15:09:28 +0100137gcov-files-arm-y += hw/misc/tmp105.c
Andreas Färber530a7e42013-06-26 15:52:16 +0200138check-qtest-ppc-y += tests/boot-order-test$(EXESUF)
139check-qtest-ppc64-y += tests/boot-order-test$(EXESUF)
Andreas Färber7c41f212013-07-29 05:44:47 +0200140check-qtest-microblazeel-y = $(check-qtest-microblaze-y)
Andreas Färber7c41f212013-07-29 05:44:47 +0200141check-qtest-xtensaeb-y = $(check-qtest-xtensa-y)
Anthony Liguorid1aaf542012-03-28 15:42:07 +0200142
Peter Maydell3687d532014-01-23 16:22:59 +0000143# qom-test works for all sysemu architectures:
144$(foreach target,$(SYSEMU_TARGET_LIST), \
145 $(eval check-qtest-$(target)-y += tests/qom-test$(EXESUF)))
146
Markus Armbruster98626572013-07-27 17:41:53 +0200147check-qapi-schema-y := $(addprefix tests/qapi-schema/, \
148 comments.json empty.json funny-char.json indented-expr.json \
149 missing-colon.json missing-comma-list.json \
150 missing-comma-object.json non-objects.json \
Markus Armbruster4f193e32013-07-27 17:41:54 +0200151 qapi-schema-test.json quoted-structural-chars.json \
Markus Armbruster98626572013-07-27 17:41:53 +0200152 trailing-comma-list.json trailing-comma-object.json \
Wenchao Xia4b359912014-03-04 18:44:32 -0800153 unclosed-list.json unclosed-object.json unclosed-string.json \
Wenchao Xiab86b05e2014-03-04 18:44:34 -0800154 duplicate-key.json union-invalid-base.json flat-union-no-base.json \
155 flat-union-invalid-discriminator.json \
Wenchao Xia52230702014-03-04 18:44:39 -0800156 flat-union-invalid-branch-key.json flat-union-reverse-define.json \
157 flat-union-string-discriminator.json)
Markus Armbruster98626572013-07-27 17:41:53 +0200158
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200159GENERATED_HEADERS += tests/test-qapi-types.h tests/test-qapi-visit.h tests/test-qmp-commands.h
Anthony Liguoridbfe06c2012-01-10 13:10:43 -0600160
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200161test-obj-y = tests/check-qint.o tests/check-qstring.o tests/check-qdict.o \
162 tests/check-qlist.o tests/check-qfloat.o tests/check-qjson.o \
163 tests/test-coroutine.o tests/test-string-output-visitor.o \
164 tests/test-string-input-visitor.o tests/test-qmp-output-visitor.o \
165 tests/test-qmp-input-visitor.o tests/test-qmp-input-strict.o \
Eduardo Habkost247c9de2013-01-23 15:58:27 -0200166 tests/test-qmp-commands.o tests/test-visitor-serialization.o \
Laszlo Ersek3953e3a2013-08-20 00:35:40 +0200167 tests/test-x86-cpuid.o tests/test-mul64.o tests/test-int128.o \
168 tests/test-opts-visitor.o
Anthony Liguoridbfe06c2012-01-10 13:10:43 -0600169
Paolo Bonzini576d5502012-12-20 15:27:51 +0100170test-qapi-obj-y = tests/test-qapi-visit.o tests/test-qapi-types.o
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200171
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200172$(test-obj-y): QEMU_INCLUDES += -Itests
Anthony Liguoric4efe1c2013-04-16 09:45:16 -0500173QEMU_CFLAGS += -I$(SRC_PATH)/tests
Igor Mammedov14389db2013-12-20 22:14:40 +0100174qom-core-obj = qom/object.o qom/qom-qobject.o qom/container.o
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200175
Eduardo Habkost247c9de2013-01-23 15:58:27 -0200176tests/test-x86-cpuid.o: QEMU_INCLUDES += -I$(SRC_PATH)/target-i386
177
Paolo Bonzinia3728232012-12-20 16:10:26 +0100178tests/check-qint$(EXESUF): tests/check-qint.o libqemuutil.a
179tests/check-qstring$(EXESUF): tests/check-qstring.o libqemuutil.a
180tests/check-qdict$(EXESUF): tests/check-qdict.o libqemuutil.a
181tests/check-qlist$(EXESUF): tests/check-qlist.o libqemuutil.a
182tests/check-qfloat$(EXESUF): tests/check-qfloat.o libqemuutil.a
183tests/check-qjson$(EXESUF): tests/check-qjson.o libqemuutil.a libqemustub.a
Peter Crosthwaite3dbe85b2014-01-15 03:05:36 -0800184tests/check-qom-interface$(EXESUF): tests/check-qom-interface.o $(qom-core-obj) libqemuutil.a libqemustub.a
Paolo Bonzinif157ebb2012-12-20 16:09:36 +0100185tests/test-coroutine$(EXESUF): tests/test-coroutine.o $(block-obj-y) libqemuutil.a libqemustub.a
186tests/test-aio$(EXESUF): tests/test-aio.o $(block-obj-y) libqemuutil.a libqemustub.a
Benoît Canetf17cfe82013-09-02 14:14:38 +0200187tests/test-throttle$(EXESUF): tests/test-throttle.o $(block-obj-y) libqemuutil.a libqemustub.a
Paolo Bonzinif157ebb2012-12-20 16:09:36 +0100188tests/test-thread-pool$(EXESUF): tests/test-thread-pool.o $(block-obj-y) libqemuutil.a libqemustub.a
189tests/test-iov$(EXESUF): tests/test-iov.o libqemuutil.a
Paolo Bonzinie7c033c2013-01-21 17:09:40 +0100190tests/test-hbitmap$(EXESUF): tests/test-hbitmap.o libqemuutil.a libqemustub.a
Eduardo Habkost247c9de2013-01-23 15:58:27 -0200191tests/test-x86-cpuid$(EXESUF): tests/test-x86-cpuid.o
Orit Wasserman21e3cd22013-01-31 09:12:16 +0200192tests/test-xbzrle$(EXESUF): tests/test-xbzrle.o xbzrle.o page_cache.o libqemuutil.a
Eduardo Habkoste3f9fe22013-02-04 16:27:45 -0200193tests/test-cutils$(EXESUF): tests/test-cutils.o util/cutils.o
Paolo Bonzini6046c622013-06-20 16:19:32 +0200194tests/test-int128$(EXESUF): tests/test-int128.o
Eduardo Habkost747b0cb2013-07-10 17:08:40 -0300195tests/test-qdev-global-props$(EXESUF): tests/test-qdev-global-props.o \
Igor Mammedov5e954942014-02-05 16:36:52 +0100196 hw/core/qdev.o hw/core/qdev-properties.o hw/core/hotplug.o\
Eduardo Habkost747b0cb2013-07-10 17:08:40 -0300197 hw/core/irq.o \
Igor Mammedov14389db2013-12-20 22:14:40 +0100198 $(qom-core-obj) \
Eduardo Habkost747b0cb2013-07-10 17:08:40 -0300199 $(test-qapi-obj-y) \
200 libqemuutil.a libqemustub.a
Eduardo Habkost2668b4b2013-11-28 12:01:18 -0200201tests/test-vmstate$(EXESUF): tests/test-vmstate.o \
202 vmstate.o qemu-file.o \
203 libqemuutil.a
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200204
205tests/test-qapi-types.c tests/test-qapi-types.h :\
Markus Armbruster4f193e32013-07-27 17:41:54 +0200206$(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-types.py
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200207 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py $(gen-out-type) -o tests -p "test-" < $<, " GEN $@")
208tests/test-qapi-visit.c tests/test-qapi-visit.h :\
Markus Armbruster4f193e32013-07-27 17:41:54 +0200209$(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-visit.py
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200210 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py $(gen-out-type) -o tests -p "test-" < $<, " GEN $@")
211tests/test-qmp-commands.h tests/test-qmp-marshal.c :\
Markus Armbruster4f193e32013-07-27 17:41:54 +0200212$(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-commands.py
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200213 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py $(gen-out-type) -o tests -p "test-" < $<, " GEN $@")
Anthony Liguoridbfe06c2012-01-10 13:10:43 -0600214
Paolo Bonzini8a090702012-12-20 15:40:20 +0100215tests/test-string-output-visitor$(EXESUF): tests/test-string-output-visitor.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
216tests/test-string-input-visitor$(EXESUF): tests/test-string-input-visitor.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
217tests/test-qmp-output-visitor$(EXESUF): tests/test-qmp-output-visitor.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
218tests/test-qmp-input-visitor$(EXESUF): tests/test-qmp-input-visitor.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
219tests/test-qmp-input-strict$(EXESUF): tests/test-qmp-input-strict.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
Paolo Bonzini59cacde2012-12-20 15:03:18 +0100220tests/test-qmp-commands$(EXESUF): tests/test-qmp-commands.o tests/test-qmp-marshal.o $(test-qapi-obj-y) qapi-types.o qapi-visit.o libqemuutil.a libqemustub.a
Paolo Bonzini8a090702012-12-20 15:40:20 +0100221tests/test-visitor-serialization$(EXESUF): tests/test-visitor-serialization.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
Laszlo Ersek3953e3a2013-08-20 00:35:40 +0200222tests/test-opts-visitor$(EXESUF): tests/test-opts-visitor.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
Paolo Bonzini2d7799f2012-02-09 11:21:03 +0100223
Richard Hendersonf4c0f982013-02-16 12:47:01 -0800224tests/test-mul64$(EXESUF): tests/test-mul64.o libqemuutil.a
Peter Maydell34647002013-06-28 12:40:32 +0100225tests/test-bitops$(EXESUF): tests/test-bitops.o libqemuutil.a
Richard Hendersonf4c0f982013-02-16 12:47:01 -0800226
Anthony Liguori234c69c2013-04-16 09:45:17 -0500227libqos-obj-y = tests/libqos/pci.o tests/libqos/fw_cfg.o
Andreas Färbercc9936a2013-05-02 15:56:26 +0200228libqos-obj-y += tests/libqos/i2c.o
Markus Armbruster26491a32013-06-26 15:52:22 +0200229libqos-pc-obj-y = $(libqos-obj-y) tests/libqos/pci-pc.o
Anthony Liguori8a0743c2013-04-16 09:45:18 -0500230libqos-pc-obj-y += tests/libqos/malloc-pc.o
Andreas Färbercc9936a2013-05-02 15:56:26 +0200231libqos-omap-obj-y = $(libqos-obj-y) tests/libqos/i2c-omap.o
Anthony Liguoric4efe1c2013-04-16 09:45:16 -0500232
Paolo Bonziniff667e22012-12-21 09:45:20 +0100233tests/rtc-test$(EXESUF): tests/rtc-test.o
234tests/m48t59-test$(EXESUF): tests/m48t59-test.o
Paolo Bonzini8fefa312013-07-22 15:54:34 +0200235tests/endianness-test$(EXESUF): tests/endianness-test.o
Paolo Bonziniff667e22012-12-21 09:45:20 +0100236tests/fdc-test$(EXESUF): tests/fdc-test.o
Kevin Wolfacbe4802013-05-08 11:18:41 +0200237tests/ide-test$(EXESUF): tests/ide-test.o $(libqos-pc-obj-y)
Paolo Bonziniff667e22012-12-21 09:45:20 +0100238tests/hd-geo-test$(EXESUF): tests/hd-geo-test.o
Andreas Färber530a7e42013-06-26 15:52:16 +0200239tests/boot-order-test$(EXESUF): tests/boot-order-test.o $(libqos-obj-y)
Michael S. Tsirkinad6423a2013-10-18 00:52:18 +0300240tests/acpi-test$(EXESUF): tests/acpi-test.o $(libqos-obj-y)
Andreas Färbercc9936a2013-05-02 15:56:26 +0200241tests/tmp105-test$(EXESUF): tests/tmp105-test.o $(libqos-omap-obj-y)
Anthony Liguori9bda4132013-04-16 09:45:19 -0500242tests/i440fx-test$(EXESUF): tests/i440fx-test.o $(libqos-pc-obj-y)
Anthony Liguoribf2a38d2013-04-16 09:45:21 -0500243tests/fw_cfg-test$(EXESUF): tests/fw_cfg-test.o $(libqos-pc-obj-y)
Andreas Färbera21baf72013-11-07 18:25:10 +0100244tests/e1000-test$(EXESUF): tests/e1000-test.o
Andreas Färber74769fe2013-11-07 18:43:09 +0100245tests/rtl8139-test$(EXESUF): tests/rtl8139-test.o
Andreas Färber85f68d52013-11-07 18:53:28 +0100246tests/pcnet-test$(EXESUF): tests/pcnet-test.o
Andreas Färber92838a12013-11-07 19:18:46 +0100247tests/eepro100-test$(EXESUF): tests/eepro100-test.o
Andreas Färber4a053e72013-11-07 18:37:34 +0100248tests/vmxnet3-test$(EXESUF): tests/vmxnet3-test.o
Andreas Färber5297ea62014-02-09 04:01:37 +0100249tests/ne2000-test$(EXESUF): tests/ne2000-test.o
Andreas Färber02063aa2014-02-09 04:39:47 +0100250tests/virtio-balloon-test$(EXESUF): tests/virtio-balloon-test.o
Andreas Färberc7a59be2014-02-09 04:32:55 +0100251tests/virtio-blk-test$(EXESUF): tests/virtio-blk-test.o
Andreas Färberb815ec52014-02-09 04:13:37 +0100252tests/virtio-net-test$(EXESUF): tests/virtio-net-test.o
Andreas Färberb6f46f02014-02-09 04:43:10 +0100253tests/virtio-rng-test$(EXESUF): tests/virtio-rng-test.o
Andreas Färber26c9a012014-02-21 16:42:15 +0100254tests/virtio-scsi-test$(EXESUF): tests/virtio-scsi-test.o
Andreas Färber76491072014-02-09 03:48:44 +0100255tests/tpci200-test$(EXESUF): tests/tpci200-test.o
Andreas Färber37146822014-02-09 12:24:15 +0100256tests/ipoctal232-test$(EXESUF): tests/ipoctal232-test.o
Andreas Färber7c41f212013-07-29 05:44:47 +0200257tests/qom-test$(EXESUF): tests/qom-test.o
Stefan Hajnoczi7ceeedd2013-10-30 14:54:34 +0100258tests/blockdev-test$(EXESUF): tests/blockdev-test.o $(libqos-pc-obj-y)
Stefan Hajnoczi43cd2092013-10-30 14:54:35 +0100259tests/qdev-monitor-test$(EXESUF): tests/qdev-monitor-test.o $(libqos-pc-obj-y)
Wenchao Xiaf93296e2013-09-06 11:24:32 +0800260tests/qemu-iotests/socket_scm_helper$(EXESUF): tests/qemu-iotests/socket_scm_helper.o
Blue Swirld2a16f72012-03-30 17:39:33 +0000261
Anthony Liguori49ee3592012-03-28 15:42:05 +0200262# QTest rules
263
264TARGETS=$(patsubst %-softmmu,%, $(filter %-softmmu,$(TARGET_DIRS)))
265QTEST_TARGETS=$(foreach TARGET,$(TARGETS), $(if $(check-qtest-$(TARGET)-y), $(TARGET),))
266check-qtest-$(CONFIG_POSIX)=$(foreach TARGET,$(TARGETS), $(check-qtest-$(TARGET)-y))
267
Paolo Bonzini8a090702012-12-20 15:40:20 +0100268qtest-obj-y = tests/libqtest.o libqemuutil.a libqemustub.a
Anthony Liguori49ee3592012-03-28 15:42:05 +0200269$(check-qtest-y): $(qtest-obj-y)
270
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200271.PHONY: check-help
272check-help:
273 @echo "Regression testing targets:"
274 @echo
275 @echo " make check Run all tests"
Anthony Liguori49ee3592012-03-28 15:42:05 +0200276 @echo " make check-qtest-TARGET Run qtest tests for given target"
277 @echo " make check-qtest Run qtest tests"
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200278 @echo " make check-unit Run qobject tests"
Markus Armbruster98626572013-07-27 17:41:53 +0200279 @echo " make check-qapi-schema Run QAPI schema tests"
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200280 @echo " make check-block Run block tests"
281 @echo " make check-report.html Generates an HTML test report"
Wenchao Xia2cdfb122013-09-26 08:42:56 +0800282 @echo " make check-clean Clean the tests"
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200283 @echo
284 @echo "Please note that HTML reports do not regenerate if the unit tests"
285 @echo "has not changed."
286 @echo
287 @echo "The variable SPEED can be set to control the gtester speed setting."
288 @echo "Default options are -k and (for make V=1) --verbose; they can be"
289 @echo "changed with variable GTESTER_OPTIONS."
Paolo Bonzini2d7799f2012-02-09 11:21:03 +0100290
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200291SPEED = quick
292GTESTER_OPTIONS = -k $(if $(V),--verbose,-q)
Blue Swirl1d728c32012-05-01 18:45:39 +0000293GCOV_OPTIONS = -n $(if $(V),-f,)
Anthony Liguoridbfe06c2012-01-10 13:10:43 -0600294
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200295# gtester tests, possibly with verbose output
Anthony Liguoridbfe06c2012-01-10 13:10:43 -0600296
Anthony Liguori49ee3592012-03-28 15:42:05 +0200297.PHONY: $(patsubst %, check-qtest-%, $(QTEST_TARGETS))
298$(patsubst %, check-qtest-%, $(QTEST_TARGETS)): check-qtest-%: $(check-qtest-y)
Blue Swirl1d728c32012-05-01 18:45:39 +0000299 $(if $(CONFIG_GCOV),@rm -f *.gcda */*.gcda */*/*.gcda */*/*/*.gcda,)
Anthony Liguori49ee3592012-03-28 15:42:05 +0200300 $(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
Stefan Hajnoczi04129602013-05-27 15:28:51 +0200301 MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$((RANDOM % 255 + 1))} \
Anthony Liguori49ee3592012-03-28 15:42:05 +0200302 gtester $(GTESTER_OPTIONS) -m=$(SPEED) $(check-qtest-$*-y),"GTESTER $@")
Blue Swirl1d728c32012-05-01 18:45:39 +0000303 $(if $(CONFIG_GCOV),@for f in $(gcov-files-$*-y); do \
304 echo Gcov report for $$f:;\
305 $(GCOV) $(GCOV_OPTIONS) $$f -o `dirname $$f`; \
306 done,)
Anthony Liguori49ee3592012-03-28 15:42:05 +0200307
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200308.PHONY: $(patsubst %, check-%, $(check-unit-y))
309$(patsubst %, check-%, $(check-unit-y)): check-%: %
Blue Swirl1d728c32012-05-01 18:45:39 +0000310 $(if $(CONFIG_GCOV),@rm -f *.gcda */*.gcda */*/*.gcda */*/*/*.gcda,)
Stefan Hajnoczi04129602013-05-27 15:28:51 +0200311 $(call quiet-command, \
312 MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$((RANDOM % 255 + 1))} \
313 gtester $(GTESTER_OPTIONS) -m=$(SPEED) $*,"GTESTER $*")
Blue Swirl1d728c32012-05-01 18:45:39 +0000314 $(if $(CONFIG_GCOV),@for f in $(gcov-files-$(subst tests/,,$*)-y); do \
315 echo Gcov report for $$f:;\
316 $(GCOV) $(GCOV_OPTIONS) $$f -o `dirname $$f`; \
317 done,)
Anthony Liguoridbfe06c2012-01-10 13:10:43 -0600318
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200319# gtester tests with XML output
320
Anthony Liguori49ee3592012-03-28 15:42:05 +0200321$(patsubst %, check-report-qtest-%.xml, $(QTEST_TARGETS)): check-report-qtest-%.xml: $(check-qtest-y)
322 $(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
323 gtester -q $(GTESTER_OPTIONS) -o $@ -m=$(SPEED) $(check-qtest-$*-y),"GTESTER $@")
324
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200325check-report-unit.xml: $(check-unit-y)
326 $(call quiet-command,gtester -q $(GTESTER_OPTIONS) -o $@ -m=$(SPEED) $^, "GTESTER $@")
327
328# Reports and overall runs
329
Anthony Liguori49ee3592012-03-28 15:42:05 +0200330check-report.xml: $(patsubst %,check-report-qtest-%.xml, $(QTEST_TARGETS)) check-report-unit.xml
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200331 $(call quiet-command,$(SRC_PATH)/scripts/gtester-cat $^ > $@, " GEN $@")
332
333check-report.html: check-report.xml
334 $(call quiet-command,gtester-report $< > $@, " GEN $@")
Kevin Wolf89594492012-03-08 12:29:00 +0100335
Kevin Wolfb8c6f292012-03-09 13:37:40 +0100336
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200337# Other tests
Kevin Wolfb8c6f292012-03-09 13:37:40 +0100338
Wenchao Xia22ee5a52013-09-26 08:42:55 +0800339QEMU_IOTESTS_HELPERS-$(CONFIG_LINUX) = tests/qemu-iotests/socket_scm_helper$(EXESUF)
340
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200341.PHONY: check-tests/qemu-iotests-quick.sh
Wenchao Xia22ee5a52013-09-26 08:42:55 +0800342check-tests/qemu-iotests-quick.sh: tests/qemu-iotests-quick.sh qemu-img$(EXESUF) qemu-io$(EXESUF) $(QEMU_IOTESTS_HELPERS-y)
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200343 $<
Kevin Wolfb8c6f292012-03-09 13:37:40 +0100344
Markus Armbruster98626572013-07-27 17:41:53 +0200345.PHONY: check-tests/test-qapi.py
346check-tests/test-qapi.py: tests/test-qapi.py
347
348.PHONY: $(patsubst %, check-%, $(check-qapi-schema-y))
349$(patsubst %, check-%, $(check-qapi-schema-y)): check-%.json: $(SRC_PATH)/%.json
Markus Armbrusterd8039e52013-09-24 09:43:39 +0200350 $(call quiet-command, PYTHONPATH=$(SRC_PATH)/scripts $(PYTHON) $(SRC_PATH)/tests/qapi-schema/test-qapi.py <$^ >$*.test.out 2>$*.test.err; echo $$? >$*.test.exit, " TEST $*.out")
351 @diff -q $(SRC_PATH)/$*.out $*.test.out
352 @diff -q $(SRC_PATH)/$*.err $*.test.err
353 @diff -q $(SRC_PATH)/$*.exit $*.test.exit
Markus Armbruster98626572013-07-27 17:41:53 +0200354
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200355# Consolidated targets
356
Wenchao Xia2cdfb122013-09-26 08:42:56 +0800357.PHONY: check-qapi-schema check-qtest check-unit check check-clean
Markus Armbruster98626572013-07-27 17:41:53 +0200358check-qapi-schema: $(patsubst %,check-%, $(check-qapi-schema-y))
Anthony Liguori49ee3592012-03-28 15:42:05 +0200359check-qtest: $(patsubst %,check-qtest-%, $(QTEST_TARGETS))
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200360check-unit: $(patsubst %,check-%, $(check-unit-y))
361check-block: $(patsubst %,check-%, $(check-block-y))
Markus Armbruster98626572013-07-27 17:41:53 +0200362check: check-qapi-schema check-unit check-qtest
Wenchao Xia2cdfb122013-09-26 08:42:56 +0800363check-clean:
364 $(MAKE) -C tests/tcg clean
365 rm -rf $(check-unit-y) $(check-qtest-i386-y) $(check-qtest-x86_64-y) $(check-qtest-sparc64-y) $(check-qtest-sparc-y) tests/*.o $(QEMU_IOTESTS_HELPERS-y)
366
367clean: check-clean
Eduardo Habkost14117c72012-07-18 14:22:27 -0300368
Wenchao Xia22ee5a52013-09-26 08:42:55 +0800369# Build the help program automatically
370
371all: $(QEMU_IOTESTS_HELPERS-y)
372
Eduardo Habkost14117c72012-07-18 14:22:27 -0300373-include $(wildcard tests/*.d)
Anthony Liguoridb2b5502013-06-26 15:52:14 +0200374-include $(wildcard tests/libqos/*.d)