blob: c6b661472beadaa97ebea27a1adefd09f2711f5c [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)
Stefan Hajnoczid597a322014-03-28 10:55:53 +010038check-unit-$(CONFIG_POSIX) += tests/test-rfifolock$(EXESUF)
Benoît Canetf17cfe82013-09-02 14:14:38 +020039check-unit-y += tests/test-throttle$(EXESUF)
Blue Swirl1d728c32012-05-01 18:45:39 +000040gcov-files-test-aio-$(CONFIG_WIN32) = aio-win32.c
41gcov-files-test-aio-$(CONFIG_POSIX) = aio-posix.c
Paolo Bonzini74c856e2012-11-23 16:13:24 +010042check-unit-y += tests/test-thread-pool$(EXESUF)
Blue Swirl1d728c32012-05-01 18:45:39 +000043gcov-files-test-thread-pool-y = thread-pool.c
Paolo Bonzinie7c033c2013-01-21 17:09:40 +010044gcov-files-test-hbitmap-y = util/hbitmap.c
45check-unit-y += tests/test-hbitmap$(EXESUF)
Eduardo Habkost247c9de2013-01-23 15:58:27 -020046check-unit-y += tests/test-x86-cpuid$(EXESUF)
47# all code tested by test-x86-cpuid is inside topology.h
48gcov-files-test-x86-cpuid-y =
Orit Wasserman21e3cd22013-01-31 09:12:16 +020049check-unit-y += tests/test-xbzrle$(EXESUF)
50gcov-files-test-xbzrle-y = xbzrle.c
Eduardo Habkoste3f9fe22013-02-04 16:27:45 -020051check-unit-y += tests/test-cutils$(EXESUF)
52gcov-files-test-cutils-y += util/cutils.c
Richard Hendersonf4c0f982013-02-16 12:47:01 -080053check-unit-y += tests/test-mul64$(EXESUF)
54gcov-files-test-mul64-y = util/host-utils.c
Paolo Bonzini6046c622013-06-20 16:19:32 +020055check-unit-y += tests/test-int128$(EXESUF)
56# all code tested by test-int128 is inside int128.h
57gcov-files-test-int128-y =
Peter Maydell34647002013-06-28 12:40:32 +010058check-unit-y += tests/test-bitops$(EXESUF)
Eduardo Habkost747b0cb2013-07-10 17:08:40 -030059check-unit-y += tests/test-qdev-global-props$(EXESUF)
Igor Mammedov14389db2013-12-20 22:14:40 +010060check-unit-y += tests/check-qom-interface$(EXESUF)
61gcov-files-check-qom-interface-y = qom/object.c
Stefan Hajnoczid597a322014-03-28 10:55:53 +010062check-unit-$(CONFIG_POSIX) += tests/test-vmstate$(EXESUF)
Anthony Liguoriad65aa82012-01-10 13:10:51 -060063
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020064check-block-$(CONFIG_POSIX) += tests/qemu-iotests-quick.sh
Anthony Liguoridbfe06c2012-01-10 13:10:43 -060065
Anthony Liguorid1aaf542012-03-28 15:42:07 +020066# All QTests for now are POSIX-only, but the dependencies are
67# really in libqtest, not in the testcases themselves.
Andreas Färbera21baf72013-11-07 18:25:10 +010068
Andreas Färber1f9c4cf2013-08-02 00:48:40 +020069gcov-files-ipack-y += hw/ipack/ipack.c
Andreas Färber37146822014-02-09 12:24:15 +010070check-qtest-ipack-y += tests/ipoctal232-test$(EXESUF)
71gcov-files-ipack-y += hw/char/ipoctal232.c
72
Andreas Färber6e8114a2014-02-21 17:49:12 +010073check-qtest-virtioserial-y += tests/virtio-console-test$(EXESUF)
74gcov-files-virtioserial-y += hw/char/virtio-console.c
75
Andreas Färberb815ec52014-02-09 04:13:37 +010076gcov-files-virtio-y += i386-softmmu/hw/virtio/virtio.c
77check-qtest-virtio-y += tests/virtio-net-test$(EXESUF)
78gcov-files-virtio-y += i386-softmmu/hw/net/virtio-net.c
Andreas Färber02063aa2014-02-09 04:39:47 +010079check-qtest-virtio-y += tests/virtio-balloon-test$(EXESUF)
80gcov-files-virtio-y += i386-softmmu/hw/virtio/virtio-balloon.c
Andreas Färberc7a59be2014-02-09 04:32:55 +010081check-qtest-virtio-y += tests/virtio-blk-test$(EXESUF)
82gcov-files-virtio-y += i386-softmmu/hw/block/virtio-blk.c
Andreas Färberb6f46f02014-02-09 04:43:10 +010083check-qtest-virtio-y += tests/virtio-rng-test$(EXESUF)
84gcov-files-virtio-y += hw/virtio/virtio-rng.c
Andreas Färber26c9a012014-02-21 16:42:15 +010085check-qtest-virtio-y += tests/virtio-scsi-test$(EXESUF)
86gcov-files-virtio-y += i386-softmmu/hw/scsi/virtio-scsi.c
Andreas Färber2d888c02014-02-21 17:15:21 +010087ifeq ($(CONFIG_VIRTIO)$(CONFIG_VIRTFS)$(CONFIG_PCI),yyy)
88check-qtest-virtio-y += tests/virtio-9p-test$(EXESUF)
89gcov-files-virtio-y += hw/9pfs/virtio-9p.c
90gcov-files-virtio-y += i386-softmmu/hw/9pfs/virtio-9p-device.c
91endif
Andreas Färberaa974052014-02-21 17:36:57 +010092check-qtest-virtio-y += tests/virtio-serial-test$(EXESUF)
93gcov-files-virtio-y += i386-softmmu/hw/char/virtio-serial-bus.c
Andreas Färber6e8114a2014-02-21 17:49:12 +010094check-qtest-virtio-y += $(check-qtest-virtioserial-y)
95gcov-files-virtio-y += $(gcov-files-virtioserial-y)
Andreas Färberb815ec52014-02-09 04:13:37 +010096
Andreas Färbera21baf72013-11-07 18:25:10 +010097check-qtest-pci-y += tests/e1000-test$(EXESUF)
98gcov-files-pci-y += hw/net/e1000.c
Andreas Färber74769fe2013-11-07 18:43:09 +010099check-qtest-pci-y += tests/rtl8139-test$(EXESUF)
100gcov-files-pci-y += hw/net/rtl8139.c
Andreas Färber85f68d52013-11-07 18:53:28 +0100101check-qtest-pci-y += tests/pcnet-test$(EXESUF)
102gcov-files-pci-y += hw/net/pcnet.c
103gcov-files-pci-y += hw/net/pcnet-pci.c
Andreas Färber92838a12013-11-07 19:18:46 +0100104check-qtest-pci-y += tests/eepro100-test$(EXESUF)
105gcov-files-pci-y += hw/net/eepro100.c
Andreas Färber5297ea62014-02-09 04:01:37 +0100106check-qtest-pci-y += tests/ne2000-test$(EXESUF)
107gcov-files-pci-y += hw/net/ne2000.c
Andreas Färberfc967792014-02-21 22:19:43 +0100108check-qtest-pci-y += tests/nvme-test$(EXESUF)
109gcov-files-pci-y += hw/block/nvme.c
Andreas Färberb815ec52014-02-09 04:13:37 +0100110check-qtest-pci-y += $(check-qtest-virtio-y)
111gcov-files-pci-y += $(gcov-files-virtio-y) hw/virtio/virtio-pci.c
Andreas Färber76491072014-02-09 03:48:44 +0100112check-qtest-pci-y += tests/tpci200-test$(EXESUF)
Andreas Färber83bb0b22014-02-21 16:29:17 +0100113gcov-files-pci-y += hw/ipack/tpci200.c
Andreas Färber37146822014-02-09 12:24:15 +0100114check-qtest-pci-y += $(check-qtest-ipack-y)
Andreas Färber83bb0b22014-02-21 16:29:17 +0100115gcov-files-pci-y += $(gcov-files-ipack-y)
Gerd Hoffmann0850fd52014-04-28 11:01:13 +0200116check-qtest-pci-y += tests/display-vga-test$(EXESUF)
117gcov-files-pci-y += hw/display/vga.c
118gcov-files-pci-y += hw/display/cirrus_vga.c
119gcov-files-pci-y += hw/display/vga-pci.c
Andreas Färbera21baf72013-11-07 18:25:10 +0100120
Paolo Bonzini8fefa312013-07-22 15:54:34 +0200121check-qtest-i386-y = tests/endianness-test$(EXESUF)
122check-qtest-i386-y += tests/fdc-test$(EXESUF)
Andreas Färber5ec889b2014-02-14 15:09:28 +0100123gcov-files-i386-y = hw/block/fdc.c
Kevin Wolfacbe4802013-05-08 11:18:41 +0200124check-qtest-i386-y += tests/ide-test$(EXESUF)
Markus Armbruster0e8a8c82012-07-10 11:12:30 +0200125check-qtest-i386-y += tests/hd-geo-test$(EXESUF)
Andreas Färber5ec889b2014-02-14 15:09:28 +0100126gcov-files-i386-y += hw/block/hd-geometry.c
Markus Armbrusteredbd7902013-06-26 15:52:13 +0200127check-qtest-i386-y += tests/boot-order-test$(EXESUF)
Michael S. Tsirkinad6423a2013-10-18 00:52:18 +0300128check-qtest-i386-y += tests/acpi-test$(EXESUF)
Stefan Weilfba0c402012-05-15 18:19:45 +0200129check-qtest-i386-y += tests/rtc-test$(EXESUF)
Anthony Liguori9bda4132013-04-16 09:45:19 -0500130check-qtest-i386-y += tests/i440fx-test$(EXESUF)
Anthony Liguoribf2a38d2013-04-16 09:45:21 -0500131check-qtest-i386-y += tests/fw_cfg-test$(EXESUF)
Stefan Hajnoczi7ceeedd2013-10-30 14:54:34 +0100132check-qtest-i386-y += tests/blockdev-test$(EXESUF)
Stefan Hajnoczi43cd2092013-10-30 14:54:35 +0100133check-qtest-i386-y += tests/qdev-monitor-test$(EXESUF)
Andreas Färbera21baf72013-11-07 18:25:10 +0100134check-qtest-i386-y += $(check-qtest-pci-y)
135gcov-files-i386-y += $(gcov-files-pci-y)
Andreas Färber4a053e72013-11-07 18:37:34 +0100136check-qtest-i386-y += tests/vmxnet3-test$(EXESUF)
137gcov-files-i386-y += hw/net/vmxnet3.c
138gcov-files-i386-y += hw/net/vmxnet_rx_pkt.c
139gcov-files-i386-y += hw/net/vmxnet_tx_pkt.c
Andreas Färberabc53732014-02-21 20:38:48 +0100140check-qtest-i386-y += tests/pvpanic-test$(EXESUF)
141gcov-files-i386-y += i386-softmmu/hw/misc/pvpanic.c
Andreas Färbere683eb92014-02-21 22:43:43 +0100142check-qtest-i386-y += tests/i82801b11-test$(EXESUF)
143gcov-files-i386-y += hw/pci-bridge/i82801b11.c
Anthony Liguorid1aaf542012-03-28 15:42:07 +0200144check-qtest-x86_64-y = $(check-qtest-i386-y)
Andreas Färber5ec889b2014-02-14 15:09:28 +0100145gcov-files-i386-y += i386-softmmu/hw/timer/mc146818rtc.c
Andreas Färberc5cd02b2013-01-26 12:45:14 +0100146gcov-files-x86_64-y = $(subst i386-softmmu/,x86_64-softmmu/,$(gcov-files-i386-y))
Paolo Bonzini8fefa312013-07-22 15:54:34 +0200147check-qtest-mips-y = tests/endianness-test$(EXESUF)
148check-qtest-mips64-y = tests/endianness-test$(EXESUF)
149check-qtest-mips64el-y = tests/endianness-test$(EXESUF)
150check-qtest-ppc-y = tests/endianness-test$(EXESUF)
151check-qtest-ppc64-y = tests/endianness-test$(EXESUF)
152check-qtest-sh4-y = tests/endianness-test$(EXESUF)
153check-qtest-sh4eb-y = tests/endianness-test$(EXESUF)
154check-qtest-sparc64-y = tests/endianness-test$(EXESUF)
Anthony Liguoribaeddde2013-01-29 15:42:45 -0600155#check-qtest-sparc-y = tests/m48t59-test$(EXESUF)
Paolo Bonzini8fefa312013-07-22 15:54:34 +0200156#check-qtest-sparc64-y += tests/m48t59-test$(EXESUF)
Andreas Färber5ec889b2014-02-14 15:09:28 +0100157gcov-files-sparc-y += hw/timer/m48t59.c
158gcov-files-sparc64-y += hw/timer/m48t59.c
Andreas Färber6e998902013-01-16 01:57:57 +0100159check-qtest-arm-y = tests/tmp105-test$(EXESUF)
Andreas Färber5ec889b2014-02-14 15:09:28 +0100160gcov-files-arm-y += hw/misc/tmp105.c
Andreas Färber530a7e42013-06-26 15:52:16 +0200161check-qtest-ppc-y += tests/boot-order-test$(EXESUF)
162check-qtest-ppc64-y += tests/boot-order-test$(EXESUF)
Alexey Kardashevskiy04e9a202014-02-10 14:52:56 +1100163check-qtest-ppc64-y += tests/spapr-phb-test$(EXESUF)
164gcov-files-ppc64-y += ppc64-softmmu/hw/ppc/spapr_pci.c
Andreas Färber7c41f212013-07-29 05:44:47 +0200165check-qtest-microblazeel-y = $(check-qtest-microblaze-y)
Andreas Färber7c41f212013-07-29 05:44:47 +0200166check-qtest-xtensaeb-y = $(check-qtest-xtensa-y)
Anthony Liguorid1aaf542012-03-28 15:42:07 +0200167
Peter Maydell3687d532014-01-23 16:22:59 +0000168# qom-test works for all sysemu architectures:
169$(foreach target,$(SYSEMU_TARGET_LIST), \
170 $(eval check-qtest-$(target)-y += tests/qom-test$(EXESUF)))
171
Markus Armbruster98626572013-07-27 17:41:53 +0200172check-qapi-schema-y := $(addprefix tests/qapi-schema/, \
173 comments.json empty.json funny-char.json indented-expr.json \
174 missing-colon.json missing-comma-list.json \
175 missing-comma-object.json non-objects.json \
Markus Armbruster4f193e32013-07-27 17:41:54 +0200176 qapi-schema-test.json quoted-structural-chars.json \
Markus Armbruster98626572013-07-27 17:41:53 +0200177 trailing-comma-list.json trailing-comma-object.json \
Wenchao Xia4b359912014-03-04 18:44:32 -0800178 unclosed-list.json unclosed-object.json unclosed-string.json \
Wenchao Xiab86b05e2014-03-04 18:44:34 -0800179 duplicate-key.json union-invalid-base.json flat-union-no-base.json \
180 flat-union-invalid-discriminator.json \
Wenchao Xia52230702014-03-04 18:44:39 -0800181 flat-union-invalid-branch-key.json flat-union-reverse-define.json \
182 flat-union-string-discriminator.json)
Markus Armbruster98626572013-07-27 17:41:53 +0200183
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200184GENERATED_HEADERS += tests/test-qapi-types.h tests/test-qapi-visit.h tests/test-qmp-commands.h
Anthony Liguoridbfe06c2012-01-10 13:10:43 -0600185
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200186test-obj-y = tests/check-qint.o tests/check-qstring.o tests/check-qdict.o \
187 tests/check-qlist.o tests/check-qfloat.o tests/check-qjson.o \
188 tests/test-coroutine.o tests/test-string-output-visitor.o \
189 tests/test-string-input-visitor.o tests/test-qmp-output-visitor.o \
190 tests/test-qmp-input-visitor.o tests/test-qmp-input-strict.o \
Eduardo Habkost247c9de2013-01-23 15:58:27 -0200191 tests/test-qmp-commands.o tests/test-visitor-serialization.o \
Laszlo Ersek3953e3a2013-08-20 00:35:40 +0200192 tests/test-x86-cpuid.o tests/test-mul64.o tests/test-int128.o \
193 tests/test-opts-visitor.o
Anthony Liguoridbfe06c2012-01-10 13:10:43 -0600194
Paolo Bonzini576d5502012-12-20 15:27:51 +0100195test-qapi-obj-y = tests/test-qapi-visit.o tests/test-qapi-types.o
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200196
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200197$(test-obj-y): QEMU_INCLUDES += -Itests
Anthony Liguoric4efe1c2013-04-16 09:45:16 -0500198QEMU_CFLAGS += -I$(SRC_PATH)/tests
Igor Mammedov14389db2013-12-20 22:14:40 +0100199qom-core-obj = qom/object.o qom/qom-qobject.o qom/container.o
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200200
Eduardo Habkost247c9de2013-01-23 15:58:27 -0200201tests/test-x86-cpuid.o: QEMU_INCLUDES += -I$(SRC_PATH)/target-i386
202
Paolo Bonzinia3728232012-12-20 16:10:26 +0100203tests/check-qint$(EXESUF): tests/check-qint.o libqemuutil.a
204tests/check-qstring$(EXESUF): tests/check-qstring.o libqemuutil.a
205tests/check-qdict$(EXESUF): tests/check-qdict.o libqemuutil.a
206tests/check-qlist$(EXESUF): tests/check-qlist.o libqemuutil.a
207tests/check-qfloat$(EXESUF): tests/check-qfloat.o libqemuutil.a
208tests/check-qjson$(EXESUF): tests/check-qjson.o libqemuutil.a libqemustub.a
Peter Crosthwaite3dbe85b2014-01-15 03:05:36 -0800209tests/check-qom-interface$(EXESUF): tests/check-qom-interface.o $(qom-core-obj) libqemuutil.a libqemustub.a
Paolo Bonzinif157ebb2012-12-20 16:09:36 +0100210tests/test-coroutine$(EXESUF): tests/test-coroutine.o $(block-obj-y) libqemuutil.a libqemustub.a
211tests/test-aio$(EXESUF): tests/test-aio.o $(block-obj-y) libqemuutil.a libqemustub.a
Stefan Hajnoczi2da61b62014-03-03 11:30:03 +0100212tests/test-rfifolock$(EXESUF): tests/test-rfifolock.o libqemuutil.a libqemustub.a
Benoît Canetf17cfe82013-09-02 14:14:38 +0200213tests/test-throttle$(EXESUF): tests/test-throttle.o $(block-obj-y) libqemuutil.a libqemustub.a
Paolo Bonzinif157ebb2012-12-20 16:09:36 +0100214tests/test-thread-pool$(EXESUF): tests/test-thread-pool.o $(block-obj-y) libqemuutil.a libqemustub.a
215tests/test-iov$(EXESUF): tests/test-iov.o libqemuutil.a
Paolo Bonzinie7c033c2013-01-21 17:09:40 +0100216tests/test-hbitmap$(EXESUF): tests/test-hbitmap.o libqemuutil.a libqemustub.a
Eduardo Habkost247c9de2013-01-23 15:58:27 -0200217tests/test-x86-cpuid$(EXESUF): tests/test-x86-cpuid.o
Orit Wasserman21e3cd22013-01-31 09:12:16 +0200218tests/test-xbzrle$(EXESUF): tests/test-xbzrle.o xbzrle.o page_cache.o libqemuutil.a
Eduardo Habkoste3f9fe22013-02-04 16:27:45 -0200219tests/test-cutils$(EXESUF): tests/test-cutils.o util/cutils.o
Paolo Bonzini6046c622013-06-20 16:19:32 +0200220tests/test-int128$(EXESUF): tests/test-int128.o
Eduardo Habkost747b0cb2013-07-10 17:08:40 -0300221tests/test-qdev-global-props$(EXESUF): tests/test-qdev-global-props.o \
Igor Mammedov5e954942014-02-05 16:36:52 +0100222 hw/core/qdev.o hw/core/qdev-properties.o hw/core/hotplug.o\
Eduardo Habkost747b0cb2013-07-10 17:08:40 -0300223 hw/core/irq.o \
Paolo Bonzini6b1566c2014-03-17 13:40:23 +1100224 hw/core/fw-path-provider.o \
Igor Mammedov14389db2013-12-20 22:14:40 +0100225 $(qom-core-obj) \
Eduardo Habkost747b0cb2013-07-10 17:08:40 -0300226 $(test-qapi-obj-y) \
227 libqemuutil.a libqemustub.a
Eduardo Habkost2668b4b2013-11-28 12:01:18 -0200228tests/test-vmstate$(EXESUF): tests/test-vmstate.o \
229 vmstate.o qemu-file.o \
230 libqemuutil.a
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200231
232tests/test-qapi-types.c tests/test-qapi-types.h :\
Markus Armbruster4f193e32013-07-27 17:41:54 +0200233$(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-types.py
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200234 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py $(gen-out-type) -o tests -p "test-" < $<, " GEN $@")
235tests/test-qapi-visit.c tests/test-qapi-visit.h :\
Markus Armbruster4f193e32013-07-27 17:41:54 +0200236$(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-visit.py
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200237 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py $(gen-out-type) -o tests -p "test-" < $<, " GEN $@")
238tests/test-qmp-commands.h tests/test-qmp-marshal.c :\
Markus Armbruster4f193e32013-07-27 17:41:54 +0200239$(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-commands.py
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200240 $(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 -0600241
Paolo Bonzini8a090702012-12-20 15:40:20 +0100242tests/test-string-output-visitor$(EXESUF): tests/test-string-output-visitor.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
243tests/test-string-input-visitor$(EXESUF): tests/test-string-input-visitor.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
244tests/test-qmp-output-visitor$(EXESUF): tests/test-qmp-output-visitor.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
245tests/test-qmp-input-visitor$(EXESUF): tests/test-qmp-input-visitor.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
246tests/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 +0100247tests/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 +0100248tests/test-visitor-serialization$(EXESUF): tests/test-visitor-serialization.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
Laszlo Ersek3953e3a2013-08-20 00:35:40 +0200249tests/test-opts-visitor$(EXESUF): tests/test-opts-visitor.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
Paolo Bonzini2d7799f2012-02-09 11:21:03 +0100250
Richard Hendersonf4c0f982013-02-16 12:47:01 -0800251tests/test-mul64$(EXESUF): tests/test-mul64.o libqemuutil.a
Peter Maydell34647002013-06-28 12:40:32 +0100252tests/test-bitops$(EXESUF): tests/test-bitops.o libqemuutil.a
Richard Hendersonf4c0f982013-02-16 12:47:01 -0800253
Anthony Liguori234c69c2013-04-16 09:45:17 -0500254libqos-obj-y = tests/libqos/pci.o tests/libqos/fw_cfg.o
Andreas Färbercc9936a2013-05-02 15:56:26 +0200255libqos-obj-y += tests/libqos/i2c.o
Markus Armbruster26491a32013-06-26 15:52:22 +0200256libqos-pc-obj-y = $(libqos-obj-y) tests/libqos/pci-pc.o
Anthony Liguori8a0743c2013-04-16 09:45:18 -0500257libqos-pc-obj-y += tests/libqos/malloc-pc.o
Andreas Färbercc9936a2013-05-02 15:56:26 +0200258libqos-omap-obj-y = $(libqos-obj-y) tests/libqos/i2c-omap.o
Anthony Liguoric4efe1c2013-04-16 09:45:16 -0500259
Paolo Bonziniff667e22012-12-21 09:45:20 +0100260tests/rtc-test$(EXESUF): tests/rtc-test.o
261tests/m48t59-test$(EXESUF): tests/m48t59-test.o
Paolo Bonzini8fefa312013-07-22 15:54:34 +0200262tests/endianness-test$(EXESUF): tests/endianness-test.o
Alexey Kardashevskiy04e9a202014-02-10 14:52:56 +1100263tests/spapr-phb-test$(EXESUF): tests/spapr-phb-test.o $(libqos-obj-y)
Paolo Bonziniff667e22012-12-21 09:45:20 +0100264tests/fdc-test$(EXESUF): tests/fdc-test.o
Kevin Wolfacbe4802013-05-08 11:18:41 +0200265tests/ide-test$(EXESUF): tests/ide-test.o $(libqos-pc-obj-y)
Paolo Bonziniff667e22012-12-21 09:45:20 +0100266tests/hd-geo-test$(EXESUF): tests/hd-geo-test.o
Andreas Färber530a7e42013-06-26 15:52:16 +0200267tests/boot-order-test$(EXESUF): tests/boot-order-test.o $(libqos-obj-y)
Michael S. Tsirkinad6423a2013-10-18 00:52:18 +0300268tests/acpi-test$(EXESUF): tests/acpi-test.o $(libqos-obj-y)
Andreas Färbercc9936a2013-05-02 15:56:26 +0200269tests/tmp105-test$(EXESUF): tests/tmp105-test.o $(libqos-omap-obj-y)
Anthony Liguori9bda4132013-04-16 09:45:19 -0500270tests/i440fx-test$(EXESUF): tests/i440fx-test.o $(libqos-pc-obj-y)
Anthony Liguoribf2a38d2013-04-16 09:45:21 -0500271tests/fw_cfg-test$(EXESUF): tests/fw_cfg-test.o $(libqos-pc-obj-y)
Andreas Färbera21baf72013-11-07 18:25:10 +0100272tests/e1000-test$(EXESUF): tests/e1000-test.o
Andreas Färber74769fe2013-11-07 18:43:09 +0100273tests/rtl8139-test$(EXESUF): tests/rtl8139-test.o
Andreas Färber85f68d52013-11-07 18:53:28 +0100274tests/pcnet-test$(EXESUF): tests/pcnet-test.o
Andreas Färber92838a12013-11-07 19:18:46 +0100275tests/eepro100-test$(EXESUF): tests/eepro100-test.o
Andreas Färber4a053e72013-11-07 18:37:34 +0100276tests/vmxnet3-test$(EXESUF): tests/vmxnet3-test.o
Andreas Färber5297ea62014-02-09 04:01:37 +0100277tests/ne2000-test$(EXESUF): tests/ne2000-test.o
Andreas Färber02063aa2014-02-09 04:39:47 +0100278tests/virtio-balloon-test$(EXESUF): tests/virtio-balloon-test.o
Andreas Färberc7a59be2014-02-09 04:32:55 +0100279tests/virtio-blk-test$(EXESUF): tests/virtio-blk-test.o
Andreas Färberb815ec52014-02-09 04:13:37 +0100280tests/virtio-net-test$(EXESUF): tests/virtio-net-test.o
Andreas Färberb6f46f02014-02-09 04:43:10 +0100281tests/virtio-rng-test$(EXESUF): tests/virtio-rng-test.o
Andreas Färber26c9a012014-02-21 16:42:15 +0100282tests/virtio-scsi-test$(EXESUF): tests/virtio-scsi-test.o
Andreas Färber2d888c02014-02-21 17:15:21 +0100283tests/virtio-9p-test$(EXESUF): tests/virtio-9p-test.o
Andreas Färberaa974052014-02-21 17:36:57 +0100284tests/virtio-serial-test$(EXESUF): tests/virtio-serial-test.o
Andreas Färber6e8114a2014-02-21 17:49:12 +0100285tests/virtio-console-test$(EXESUF): tests/virtio-console-test.o
Andreas Färber76491072014-02-09 03:48:44 +0100286tests/tpci200-test$(EXESUF): tests/tpci200-test.o
Gerd Hoffmann0850fd52014-04-28 11:01:13 +0200287tests/display-vga-test$(EXESUF): tests/display-vga-test.o
Andreas Färber37146822014-02-09 12:24:15 +0100288tests/ipoctal232-test$(EXESUF): tests/ipoctal232-test.o
Andreas Färber7c41f212013-07-29 05:44:47 +0200289tests/qom-test$(EXESUF): tests/qom-test.o
Stefan Hajnoczi7ceeedd2013-10-30 14:54:34 +0100290tests/blockdev-test$(EXESUF): tests/blockdev-test.o $(libqos-pc-obj-y)
Stefan Hajnoczi43cd2092013-10-30 14:54:35 +0100291tests/qdev-monitor-test$(EXESUF): tests/qdev-monitor-test.o $(libqos-pc-obj-y)
Andreas Färberfc967792014-02-21 22:19:43 +0100292tests/nvme-test$(EXESUF): tests/nvme-test.o
Andreas Färberabc53732014-02-21 20:38:48 +0100293tests/pvpanic-test$(EXESUF): tests/pvpanic-test.o
Andreas Färbere683eb92014-02-21 22:43:43 +0100294tests/i82801b11-test$(EXESUF): tests/i82801b11-test.o
Wenchao Xiaf93296e2013-09-06 11:24:32 +0800295tests/qemu-iotests/socket_scm_helper$(EXESUF): tests/qemu-iotests/socket_scm_helper.o
Blue Swirld2a16f72012-03-30 17:39:33 +0000296
Anthony Liguori49ee3592012-03-28 15:42:05 +0200297# QTest rules
298
299TARGETS=$(patsubst %-softmmu,%, $(filter %-softmmu,$(TARGET_DIRS)))
Stefan Hajnoczi5c4e24c2014-03-28 10:55:54 +0100300ifeq ($(CONFIG_POSIX),y)
Anthony Liguori49ee3592012-03-28 15:42:05 +0200301QTEST_TARGETS=$(foreach TARGET,$(TARGETS), $(if $(check-qtest-$(TARGET)-y), $(TARGET),))
Stefan Hajnoczi5c4e24c2014-03-28 10:55:54 +0100302check-qtest-y=$(foreach TARGET,$(TARGETS), $(check-qtest-$(TARGET)-y))
303endif
Anthony Liguori49ee3592012-03-28 15:42:05 +0200304
Paolo Bonzini8a090702012-12-20 15:40:20 +0100305qtest-obj-y = tests/libqtest.o libqemuutil.a libqemustub.a
Anthony Liguori49ee3592012-03-28 15:42:05 +0200306$(check-qtest-y): $(qtest-obj-y)
307
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200308.PHONY: check-help
309check-help:
310 @echo "Regression testing targets:"
311 @echo
312 @echo " make check Run all tests"
Anthony Liguori49ee3592012-03-28 15:42:05 +0200313 @echo " make check-qtest-TARGET Run qtest tests for given target"
314 @echo " make check-qtest Run qtest tests"
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200315 @echo " make check-unit Run qobject tests"
Markus Armbruster98626572013-07-27 17:41:53 +0200316 @echo " make check-qapi-schema Run QAPI schema tests"
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200317 @echo " make check-block Run block tests"
318 @echo " make check-report.html Generates an HTML test report"
Wenchao Xia2cdfb122013-09-26 08:42:56 +0800319 @echo " make check-clean Clean the tests"
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200320 @echo
321 @echo "Please note that HTML reports do not regenerate if the unit tests"
322 @echo "has not changed."
323 @echo
324 @echo "The variable SPEED can be set to control the gtester speed setting."
325 @echo "Default options are -k and (for make V=1) --verbose; they can be"
326 @echo "changed with variable GTESTER_OPTIONS."
Paolo Bonzini2d7799f2012-02-09 11:21:03 +0100327
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200328SPEED = quick
329GTESTER_OPTIONS = -k $(if $(V),--verbose,-q)
Blue Swirl1d728c32012-05-01 18:45:39 +0000330GCOV_OPTIONS = -n $(if $(V),-f,)
Anthony Liguoridbfe06c2012-01-10 13:10:43 -0600331
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200332# gtester tests, possibly with verbose output
Anthony Liguoridbfe06c2012-01-10 13:10:43 -0600333
Anthony Liguori49ee3592012-03-28 15:42:05 +0200334.PHONY: $(patsubst %, check-qtest-%, $(QTEST_TARGETS))
335$(patsubst %, check-qtest-%, $(QTEST_TARGETS)): check-qtest-%: $(check-qtest-y)
Blue Swirl1d728c32012-05-01 18:45:39 +0000336 $(if $(CONFIG_GCOV),@rm -f *.gcda */*.gcda */*/*.gcda */*/*/*.gcda,)
Anthony Liguori49ee3592012-03-28 15:42:05 +0200337 $(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
Stefan Hajnoczi04129602013-05-27 15:28:51 +0200338 MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$((RANDOM % 255 + 1))} \
Anthony Liguori49ee3592012-03-28 15:42:05 +0200339 gtester $(GTESTER_OPTIONS) -m=$(SPEED) $(check-qtest-$*-y),"GTESTER $@")
Blue Swirl1d728c32012-05-01 18:45:39 +0000340 $(if $(CONFIG_GCOV),@for f in $(gcov-files-$*-y); do \
341 echo Gcov report for $$f:;\
342 $(GCOV) $(GCOV_OPTIONS) $$f -o `dirname $$f`; \
343 done,)
Anthony Liguori49ee3592012-03-28 15:42:05 +0200344
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200345.PHONY: $(patsubst %, check-%, $(check-unit-y))
346$(patsubst %, check-%, $(check-unit-y)): check-%: %
Blue Swirl1d728c32012-05-01 18:45:39 +0000347 $(if $(CONFIG_GCOV),@rm -f *.gcda */*.gcda */*/*.gcda */*/*/*.gcda,)
Stefan Hajnoczi04129602013-05-27 15:28:51 +0200348 $(call quiet-command, \
349 MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$((RANDOM % 255 + 1))} \
350 gtester $(GTESTER_OPTIONS) -m=$(SPEED) $*,"GTESTER $*")
Blue Swirl1d728c32012-05-01 18:45:39 +0000351 $(if $(CONFIG_GCOV),@for f in $(gcov-files-$(subst tests/,,$*)-y); do \
352 echo Gcov report for $$f:;\
353 $(GCOV) $(GCOV_OPTIONS) $$f -o `dirname $$f`; \
354 done,)
Anthony Liguoridbfe06c2012-01-10 13:10:43 -0600355
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200356# gtester tests with XML output
357
Anthony Liguori49ee3592012-03-28 15:42:05 +0200358$(patsubst %, check-report-qtest-%.xml, $(QTEST_TARGETS)): check-report-qtest-%.xml: $(check-qtest-y)
359 $(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
360 gtester -q $(GTESTER_OPTIONS) -o $@ -m=$(SPEED) $(check-qtest-$*-y),"GTESTER $@")
361
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200362check-report-unit.xml: $(check-unit-y)
363 $(call quiet-command,gtester -q $(GTESTER_OPTIONS) -o $@ -m=$(SPEED) $^, "GTESTER $@")
364
365# Reports and overall runs
366
Anthony Liguori49ee3592012-03-28 15:42:05 +0200367check-report.xml: $(patsubst %,check-report-qtest-%.xml, $(QTEST_TARGETS)) check-report-unit.xml
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200368 $(call quiet-command,$(SRC_PATH)/scripts/gtester-cat $^ > $@, " GEN $@")
369
370check-report.html: check-report.xml
371 $(call quiet-command,gtester-report $< > $@, " GEN $@")
Kevin Wolf89594492012-03-08 12:29:00 +0100372
Kevin Wolfb8c6f292012-03-09 13:37:40 +0100373
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200374# Other tests
Kevin Wolfb8c6f292012-03-09 13:37:40 +0100375
Wenchao Xia22ee5a52013-09-26 08:42:55 +0800376QEMU_IOTESTS_HELPERS-$(CONFIG_LINUX) = tests/qemu-iotests/socket_scm_helper$(EXESUF)
377
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200378.PHONY: check-tests/qemu-iotests-quick.sh
Wenchao Xia22ee5a52013-09-26 08:42:55 +0800379check-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 +0200380 $<
Kevin Wolfb8c6f292012-03-09 13:37:40 +0100381
Markus Armbruster98626572013-07-27 17:41:53 +0200382.PHONY: check-tests/test-qapi.py
383check-tests/test-qapi.py: tests/test-qapi.py
384
385.PHONY: $(patsubst %, check-%, $(check-qapi-schema-y))
386$(patsubst %, check-%, $(check-qapi-schema-y)): check-%.json: $(SRC_PATH)/%.json
Markus Armbrusterd8039e52013-09-24 09:43:39 +0200387 $(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")
388 @diff -q $(SRC_PATH)/$*.out $*.test.out
389 @diff -q $(SRC_PATH)/$*.err $*.test.err
390 @diff -q $(SRC_PATH)/$*.exit $*.test.exit
Markus Armbruster98626572013-07-27 17:41:53 +0200391
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200392# Consolidated targets
393
Wenchao Xia2cdfb122013-09-26 08:42:56 +0800394.PHONY: check-qapi-schema check-qtest check-unit check check-clean
Markus Armbruster98626572013-07-27 17:41:53 +0200395check-qapi-schema: $(patsubst %,check-%, $(check-qapi-schema-y))
Anthony Liguori49ee3592012-03-28 15:42:05 +0200396check-qtest: $(patsubst %,check-qtest-%, $(QTEST_TARGETS))
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200397check-unit: $(patsubst %,check-%, $(check-unit-y))
398check-block: $(patsubst %,check-%, $(check-block-y))
Markus Armbruster98626572013-07-27 17:41:53 +0200399check: check-qapi-schema check-unit check-qtest
Wenchao Xia2cdfb122013-09-26 08:42:56 +0800400check-clean:
401 $(MAKE) -C tests/tcg clean
Andreas Färberf85e3452014-04-07 18:33:22 +0200402 rm -rf $(check-unit-y) tests/*.o $(QEMU_IOTESTS_HELPERS-y)
403 rm -rf $(sort $(foreach target,$(SYSEMU_TARGET_LIST), $(check-qtest-$(target)-y)))
Wenchao Xia2cdfb122013-09-26 08:42:56 +0800404
405clean: check-clean
Eduardo Habkost14117c72012-07-18 14:22:27 -0300406
Wenchao Xia22ee5a52013-09-26 08:42:55 +0800407# Build the help program automatically
408
409all: $(QEMU_IOTESTS_HELPERS-y)
410
Eduardo Habkost14117c72012-07-18 14:22:27 -0300411-include $(wildcard tests/*.d)
Anthony Liguoridb2b5502013-06-26 15:52:14 +0200412-include $(wildcard tests/libqos/*.d)