blob: 6ac988932bcd9a828b30101b722d68470e8b8186 [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
75
Andreas Färbera21baf72013-11-07 18:25:10 +010076check-qtest-pci-y += tests/e1000-test$(EXESUF)
77gcov-files-pci-y += hw/net/e1000.c
Andreas Färber74769fe2013-11-07 18:43:09 +010078check-qtest-pci-y += tests/rtl8139-test$(EXESUF)
79gcov-files-pci-y += hw/net/rtl8139.c
Andreas Färber85f68d52013-11-07 18:53:28 +010080check-qtest-pci-y += tests/pcnet-test$(EXESUF)
81gcov-files-pci-y += hw/net/pcnet.c
82gcov-files-pci-y += hw/net/pcnet-pci.c
Andreas Färber92838a12013-11-07 19:18:46 +010083check-qtest-pci-y += tests/eepro100-test$(EXESUF)
84gcov-files-pci-y += hw/net/eepro100.c
Andreas Färber5297ea62014-02-09 04:01:37 +010085check-qtest-pci-y += tests/ne2000-test$(EXESUF)
86gcov-files-pci-y += hw/net/ne2000.c
Andreas Färberb815ec52014-02-09 04:13:37 +010087check-qtest-pci-y += $(check-qtest-virtio-y)
88gcov-files-pci-y += $(gcov-files-virtio-y) hw/virtio/virtio-pci.c
Andreas Färber76491072014-02-09 03:48:44 +010089check-qtest-pci-y += tests/tpci200-test$(EXESUF)
90gcov-files-pci-y += hw/char/tpci200.c
Andreas Färber37146822014-02-09 12:24:15 +010091check-qtest-pci-y += $(check-qtest-ipack-y)
Andreas Färber1f9c4cf2013-08-02 00:48:40 +020092gcov-files-pci-y += $(gcov-files-ipack-y) hw/ipack/tpci200.c
Andreas Färbera21baf72013-11-07 18:25:10 +010093
Paolo Bonzini8fefa312013-07-22 15:54:34 +020094check-qtest-i386-y = tests/endianness-test$(EXESUF)
95check-qtest-i386-y += tests/fdc-test$(EXESUF)
Andreas Färber5ec889b2014-02-14 15:09:28 +010096gcov-files-i386-y = hw/block/fdc.c
Kevin Wolfacbe4802013-05-08 11:18:41 +020097check-qtest-i386-y += tests/ide-test$(EXESUF)
Markus Armbruster0e8a8c82012-07-10 11:12:30 +020098check-qtest-i386-y += tests/hd-geo-test$(EXESUF)
Andreas Färber5ec889b2014-02-14 15:09:28 +010099gcov-files-i386-y += hw/block/hd-geometry.c
Markus Armbrusteredbd7902013-06-26 15:52:13 +0200100check-qtest-i386-y += tests/boot-order-test$(EXESUF)
Michael S. Tsirkinad6423a2013-10-18 00:52:18 +0300101check-qtest-i386-y += tests/acpi-test$(EXESUF)
Stefan Weilfba0c402012-05-15 18:19:45 +0200102check-qtest-i386-y += tests/rtc-test$(EXESUF)
Anthony Liguori9bda4132013-04-16 09:45:19 -0500103check-qtest-i386-y += tests/i440fx-test$(EXESUF)
Anthony Liguoribf2a38d2013-04-16 09:45:21 -0500104check-qtest-i386-y += tests/fw_cfg-test$(EXESUF)
Stefan Hajnoczi7ceeedd2013-10-30 14:54:34 +0100105check-qtest-i386-y += tests/blockdev-test$(EXESUF)
Stefan Hajnoczi43cd2092013-10-30 14:54:35 +0100106check-qtest-i386-y += tests/qdev-monitor-test$(EXESUF)
Andreas Färbera21baf72013-11-07 18:25:10 +0100107check-qtest-i386-y += $(check-qtest-pci-y)
108gcov-files-i386-y += $(gcov-files-pci-y)
Andreas Färber4a053e72013-11-07 18:37:34 +0100109check-qtest-i386-y += tests/vmxnet3-test$(EXESUF)
110gcov-files-i386-y += hw/net/vmxnet3.c
111gcov-files-i386-y += hw/net/vmxnet_rx_pkt.c
112gcov-files-i386-y += hw/net/vmxnet_tx_pkt.c
Anthony Liguorid1aaf542012-03-28 15:42:07 +0200113check-qtest-x86_64-y = $(check-qtest-i386-y)
Andreas Färber5ec889b2014-02-14 15:09:28 +0100114gcov-files-i386-y += i386-softmmu/hw/timer/mc146818rtc.c
Andreas Färberc5cd02b2013-01-26 12:45:14 +0100115gcov-files-x86_64-y = $(subst i386-softmmu/,x86_64-softmmu/,$(gcov-files-i386-y))
Paolo Bonzini8fefa312013-07-22 15:54:34 +0200116check-qtest-mips-y = tests/endianness-test$(EXESUF)
117check-qtest-mips64-y = tests/endianness-test$(EXESUF)
118check-qtest-mips64el-y = tests/endianness-test$(EXESUF)
Paolo Bonzini8fefa312013-07-22 15:54:34 +0200119check-qtest-ppc-y = tests/endianness-test$(EXESUF)
120check-qtest-ppc64-y = tests/endianness-test$(EXESUF)
121check-qtest-sh4-y = tests/endianness-test$(EXESUF)
122check-qtest-sh4eb-y = tests/endianness-test$(EXESUF)
Paolo Bonzini8fefa312013-07-22 15:54:34 +0200123check-qtest-sparc64-y = tests/endianness-test$(EXESUF)
Anthony Liguoribaeddde2013-01-29 15:42:45 -0600124#check-qtest-sparc-y = tests/m48t59-test$(EXESUF)
Paolo Bonzini8fefa312013-07-22 15:54:34 +0200125#check-qtest-sparc64-y += tests/m48t59-test$(EXESUF)
Andreas Färber5ec889b2014-02-14 15:09:28 +0100126gcov-files-sparc-y += hw/timer/m48t59.c
127gcov-files-sparc64-y += hw/timer/m48t59.c
Andreas Färber6e998902013-01-16 01:57:57 +0100128check-qtest-arm-y = tests/tmp105-test$(EXESUF)
Andreas Färber5ec889b2014-02-14 15:09:28 +0100129gcov-files-arm-y += hw/misc/tmp105.c
Andreas Färber530a7e42013-06-26 15:52:16 +0200130check-qtest-ppc-y += tests/boot-order-test$(EXESUF)
131check-qtest-ppc64-y += tests/boot-order-test$(EXESUF)
Andreas Färber7c41f212013-07-29 05:44:47 +0200132check-qtest-microblazeel-y = $(check-qtest-microblaze-y)
Andreas Färber7c41f212013-07-29 05:44:47 +0200133check-qtest-xtensaeb-y = $(check-qtest-xtensa-y)
Anthony Liguorid1aaf542012-03-28 15:42:07 +0200134
Peter Maydell3687d532014-01-23 16:22:59 +0000135# qom-test works for all sysemu architectures:
136$(foreach target,$(SYSEMU_TARGET_LIST), \
137 $(eval check-qtest-$(target)-y += tests/qom-test$(EXESUF)))
138
Markus Armbruster98626572013-07-27 17:41:53 +0200139check-qapi-schema-y := $(addprefix tests/qapi-schema/, \
140 comments.json empty.json funny-char.json indented-expr.json \
141 missing-colon.json missing-comma-list.json \
142 missing-comma-object.json non-objects.json \
Markus Armbruster4f193e32013-07-27 17:41:54 +0200143 qapi-schema-test.json quoted-structural-chars.json \
Markus Armbruster98626572013-07-27 17:41:53 +0200144 trailing-comma-list.json trailing-comma-object.json \
Wenchao Xia4b359912014-03-04 18:44:32 -0800145 unclosed-list.json unclosed-object.json unclosed-string.json \
Wenchao Xiab86b05e2014-03-04 18:44:34 -0800146 duplicate-key.json union-invalid-base.json flat-union-no-base.json \
147 flat-union-invalid-discriminator.json \
148 flat-union-invalid-branch-key.json)
Markus Armbruster98626572013-07-27 17:41:53 +0200149
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200150GENERATED_HEADERS += tests/test-qapi-types.h tests/test-qapi-visit.h tests/test-qmp-commands.h
Anthony Liguoridbfe06c2012-01-10 13:10:43 -0600151
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200152test-obj-y = tests/check-qint.o tests/check-qstring.o tests/check-qdict.o \
153 tests/check-qlist.o tests/check-qfloat.o tests/check-qjson.o \
154 tests/test-coroutine.o tests/test-string-output-visitor.o \
155 tests/test-string-input-visitor.o tests/test-qmp-output-visitor.o \
156 tests/test-qmp-input-visitor.o tests/test-qmp-input-strict.o \
Eduardo Habkost247c9de2013-01-23 15:58:27 -0200157 tests/test-qmp-commands.o tests/test-visitor-serialization.o \
Laszlo Ersek3953e3a2013-08-20 00:35:40 +0200158 tests/test-x86-cpuid.o tests/test-mul64.o tests/test-int128.o \
159 tests/test-opts-visitor.o
Anthony Liguoridbfe06c2012-01-10 13:10:43 -0600160
Paolo Bonzini576d5502012-12-20 15:27:51 +0100161test-qapi-obj-y = tests/test-qapi-visit.o tests/test-qapi-types.o
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200162
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200163$(test-obj-y): QEMU_INCLUDES += -Itests
Anthony Liguoric4efe1c2013-04-16 09:45:16 -0500164QEMU_CFLAGS += -I$(SRC_PATH)/tests
Igor Mammedov14389db2013-12-20 22:14:40 +0100165qom-core-obj = qom/object.o qom/qom-qobject.o qom/container.o
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200166
Eduardo Habkost247c9de2013-01-23 15:58:27 -0200167tests/test-x86-cpuid.o: QEMU_INCLUDES += -I$(SRC_PATH)/target-i386
168
Paolo Bonzinia3728232012-12-20 16:10:26 +0100169tests/check-qint$(EXESUF): tests/check-qint.o libqemuutil.a
170tests/check-qstring$(EXESUF): tests/check-qstring.o libqemuutil.a
171tests/check-qdict$(EXESUF): tests/check-qdict.o libqemuutil.a
172tests/check-qlist$(EXESUF): tests/check-qlist.o libqemuutil.a
173tests/check-qfloat$(EXESUF): tests/check-qfloat.o libqemuutil.a
174tests/check-qjson$(EXESUF): tests/check-qjson.o libqemuutil.a libqemustub.a
Peter Crosthwaite3dbe85b2014-01-15 03:05:36 -0800175tests/check-qom-interface$(EXESUF): tests/check-qom-interface.o $(qom-core-obj) libqemuutil.a libqemustub.a
Paolo Bonzinif157ebb2012-12-20 16:09:36 +0100176tests/test-coroutine$(EXESUF): tests/test-coroutine.o $(block-obj-y) libqemuutil.a libqemustub.a
177tests/test-aio$(EXESUF): tests/test-aio.o $(block-obj-y) libqemuutil.a libqemustub.a
Benoît Canetf17cfe82013-09-02 14:14:38 +0200178tests/test-throttle$(EXESUF): tests/test-throttle.o $(block-obj-y) libqemuutil.a libqemustub.a
Paolo Bonzinif157ebb2012-12-20 16:09:36 +0100179tests/test-thread-pool$(EXESUF): tests/test-thread-pool.o $(block-obj-y) libqemuutil.a libqemustub.a
180tests/test-iov$(EXESUF): tests/test-iov.o libqemuutil.a
Paolo Bonzinie7c033c2013-01-21 17:09:40 +0100181tests/test-hbitmap$(EXESUF): tests/test-hbitmap.o libqemuutil.a libqemustub.a
Eduardo Habkost247c9de2013-01-23 15:58:27 -0200182tests/test-x86-cpuid$(EXESUF): tests/test-x86-cpuid.o
Orit Wasserman21e3cd22013-01-31 09:12:16 +0200183tests/test-xbzrle$(EXESUF): tests/test-xbzrle.o xbzrle.o page_cache.o libqemuutil.a
Eduardo Habkoste3f9fe22013-02-04 16:27:45 -0200184tests/test-cutils$(EXESUF): tests/test-cutils.o util/cutils.o
Paolo Bonzini6046c622013-06-20 16:19:32 +0200185tests/test-int128$(EXESUF): tests/test-int128.o
Eduardo Habkost747b0cb2013-07-10 17:08:40 -0300186tests/test-qdev-global-props$(EXESUF): tests/test-qdev-global-props.o \
Igor Mammedov5e954942014-02-05 16:36:52 +0100187 hw/core/qdev.o hw/core/qdev-properties.o hw/core/hotplug.o\
Eduardo Habkost747b0cb2013-07-10 17:08:40 -0300188 hw/core/irq.o \
Igor Mammedov14389db2013-12-20 22:14:40 +0100189 $(qom-core-obj) \
Eduardo Habkost747b0cb2013-07-10 17:08:40 -0300190 $(test-qapi-obj-y) \
191 libqemuutil.a libqemustub.a
Eduardo Habkost2668b4b2013-11-28 12:01:18 -0200192tests/test-vmstate$(EXESUF): tests/test-vmstate.o \
193 vmstate.o qemu-file.o \
194 libqemuutil.a
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200195
196tests/test-qapi-types.c tests/test-qapi-types.h :\
Markus Armbruster4f193e32013-07-27 17:41:54 +0200197$(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-types.py
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200198 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py $(gen-out-type) -o tests -p "test-" < $<, " GEN $@")
199tests/test-qapi-visit.c tests/test-qapi-visit.h :\
Markus Armbruster4f193e32013-07-27 17:41:54 +0200200$(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-visit.py
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200201 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py $(gen-out-type) -o tests -p "test-" < $<, " GEN $@")
202tests/test-qmp-commands.h tests/test-qmp-marshal.c :\
Markus Armbruster4f193e32013-07-27 17:41:54 +0200203$(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-commands.py
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200204 $(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 -0600205
Paolo Bonzini8a090702012-12-20 15:40:20 +0100206tests/test-string-output-visitor$(EXESUF): tests/test-string-output-visitor.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
207tests/test-string-input-visitor$(EXESUF): tests/test-string-input-visitor.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
208tests/test-qmp-output-visitor$(EXESUF): tests/test-qmp-output-visitor.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
209tests/test-qmp-input-visitor$(EXESUF): tests/test-qmp-input-visitor.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
210tests/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 +0100211tests/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 +0100212tests/test-visitor-serialization$(EXESUF): tests/test-visitor-serialization.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
Laszlo Ersek3953e3a2013-08-20 00:35:40 +0200213tests/test-opts-visitor$(EXESUF): tests/test-opts-visitor.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
Paolo Bonzini2d7799f2012-02-09 11:21:03 +0100214
Richard Hendersonf4c0f982013-02-16 12:47:01 -0800215tests/test-mul64$(EXESUF): tests/test-mul64.o libqemuutil.a
Peter Maydell34647002013-06-28 12:40:32 +0100216tests/test-bitops$(EXESUF): tests/test-bitops.o libqemuutil.a
Richard Hendersonf4c0f982013-02-16 12:47:01 -0800217
Anthony Liguori234c69c2013-04-16 09:45:17 -0500218libqos-obj-y = tests/libqos/pci.o tests/libqos/fw_cfg.o
Andreas Färbercc9936a2013-05-02 15:56:26 +0200219libqos-obj-y += tests/libqos/i2c.o
Markus Armbruster26491a32013-06-26 15:52:22 +0200220libqos-pc-obj-y = $(libqos-obj-y) tests/libqos/pci-pc.o
Anthony Liguori8a0743c2013-04-16 09:45:18 -0500221libqos-pc-obj-y += tests/libqos/malloc-pc.o
Andreas Färbercc9936a2013-05-02 15:56:26 +0200222libqos-omap-obj-y = $(libqos-obj-y) tests/libqos/i2c-omap.o
Anthony Liguoric4efe1c2013-04-16 09:45:16 -0500223
Paolo Bonziniff667e22012-12-21 09:45:20 +0100224tests/rtc-test$(EXESUF): tests/rtc-test.o
225tests/m48t59-test$(EXESUF): tests/m48t59-test.o
Paolo Bonzini8fefa312013-07-22 15:54:34 +0200226tests/endianness-test$(EXESUF): tests/endianness-test.o
Paolo Bonziniff667e22012-12-21 09:45:20 +0100227tests/fdc-test$(EXESUF): tests/fdc-test.o
Kevin Wolfacbe4802013-05-08 11:18:41 +0200228tests/ide-test$(EXESUF): tests/ide-test.o $(libqos-pc-obj-y)
Paolo Bonziniff667e22012-12-21 09:45:20 +0100229tests/hd-geo-test$(EXESUF): tests/hd-geo-test.o
Andreas Färber530a7e42013-06-26 15:52:16 +0200230tests/boot-order-test$(EXESUF): tests/boot-order-test.o $(libqos-obj-y)
Michael S. Tsirkinad6423a2013-10-18 00:52:18 +0300231tests/acpi-test$(EXESUF): tests/acpi-test.o $(libqos-obj-y)
Andreas Färbercc9936a2013-05-02 15:56:26 +0200232tests/tmp105-test$(EXESUF): tests/tmp105-test.o $(libqos-omap-obj-y)
Anthony Liguori9bda4132013-04-16 09:45:19 -0500233tests/i440fx-test$(EXESUF): tests/i440fx-test.o $(libqos-pc-obj-y)
Anthony Liguoribf2a38d2013-04-16 09:45:21 -0500234tests/fw_cfg-test$(EXESUF): tests/fw_cfg-test.o $(libqos-pc-obj-y)
Andreas Färbera21baf72013-11-07 18:25:10 +0100235tests/e1000-test$(EXESUF): tests/e1000-test.o
Andreas Färber74769fe2013-11-07 18:43:09 +0100236tests/rtl8139-test$(EXESUF): tests/rtl8139-test.o
Andreas Färber85f68d52013-11-07 18:53:28 +0100237tests/pcnet-test$(EXESUF): tests/pcnet-test.o
Andreas Färber92838a12013-11-07 19:18:46 +0100238tests/eepro100-test$(EXESUF): tests/eepro100-test.o
Andreas Färber4a053e72013-11-07 18:37:34 +0100239tests/vmxnet3-test$(EXESUF): tests/vmxnet3-test.o
Andreas Färber5297ea62014-02-09 04:01:37 +0100240tests/ne2000-test$(EXESUF): tests/ne2000-test.o
Andreas Färberb815ec52014-02-09 04:13:37 +0100241tests/virtio-net-test$(EXESUF): tests/virtio-net-test.o
Andreas Färber76491072014-02-09 03:48:44 +0100242tests/tpci200-test$(EXESUF): tests/tpci200-test.o
Andreas Färber37146822014-02-09 12:24:15 +0100243tests/ipoctal232-test$(EXESUF): tests/ipoctal232-test.o
Andreas Färber7c41f212013-07-29 05:44:47 +0200244tests/qom-test$(EXESUF): tests/qom-test.o
Stefan Hajnoczi7ceeedd2013-10-30 14:54:34 +0100245tests/blockdev-test$(EXESUF): tests/blockdev-test.o $(libqos-pc-obj-y)
Stefan Hajnoczi43cd2092013-10-30 14:54:35 +0100246tests/qdev-monitor-test$(EXESUF): tests/qdev-monitor-test.o $(libqos-pc-obj-y)
Wenchao Xiaf93296e2013-09-06 11:24:32 +0800247tests/qemu-iotests/socket_scm_helper$(EXESUF): tests/qemu-iotests/socket_scm_helper.o
Blue Swirld2a16f72012-03-30 17:39:33 +0000248
Anthony Liguori49ee3592012-03-28 15:42:05 +0200249# QTest rules
250
251TARGETS=$(patsubst %-softmmu,%, $(filter %-softmmu,$(TARGET_DIRS)))
252QTEST_TARGETS=$(foreach TARGET,$(TARGETS), $(if $(check-qtest-$(TARGET)-y), $(TARGET),))
253check-qtest-$(CONFIG_POSIX)=$(foreach TARGET,$(TARGETS), $(check-qtest-$(TARGET)-y))
254
Paolo Bonzini8a090702012-12-20 15:40:20 +0100255qtest-obj-y = tests/libqtest.o libqemuutil.a libqemustub.a
Anthony Liguori49ee3592012-03-28 15:42:05 +0200256$(check-qtest-y): $(qtest-obj-y)
257
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200258.PHONY: check-help
259check-help:
260 @echo "Regression testing targets:"
261 @echo
262 @echo " make check Run all tests"
Anthony Liguori49ee3592012-03-28 15:42:05 +0200263 @echo " make check-qtest-TARGET Run qtest tests for given target"
264 @echo " make check-qtest Run qtest tests"
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200265 @echo " make check-unit Run qobject tests"
Markus Armbruster98626572013-07-27 17:41:53 +0200266 @echo " make check-qapi-schema Run QAPI schema tests"
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200267 @echo " make check-block Run block tests"
268 @echo " make check-report.html Generates an HTML test report"
Wenchao Xia2cdfb122013-09-26 08:42:56 +0800269 @echo " make check-clean Clean the tests"
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200270 @echo
271 @echo "Please note that HTML reports do not regenerate if the unit tests"
272 @echo "has not changed."
273 @echo
274 @echo "The variable SPEED can be set to control the gtester speed setting."
275 @echo "Default options are -k and (for make V=1) --verbose; they can be"
276 @echo "changed with variable GTESTER_OPTIONS."
Paolo Bonzini2d7799f2012-02-09 11:21:03 +0100277
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200278SPEED = quick
279GTESTER_OPTIONS = -k $(if $(V),--verbose,-q)
Blue Swirl1d728c32012-05-01 18:45:39 +0000280GCOV_OPTIONS = -n $(if $(V),-f,)
Anthony Liguoridbfe06c2012-01-10 13:10:43 -0600281
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200282# gtester tests, possibly with verbose output
Anthony Liguoridbfe06c2012-01-10 13:10:43 -0600283
Anthony Liguori49ee3592012-03-28 15:42:05 +0200284.PHONY: $(patsubst %, check-qtest-%, $(QTEST_TARGETS))
285$(patsubst %, check-qtest-%, $(QTEST_TARGETS)): check-qtest-%: $(check-qtest-y)
Blue Swirl1d728c32012-05-01 18:45:39 +0000286 $(if $(CONFIG_GCOV),@rm -f *.gcda */*.gcda */*/*.gcda */*/*/*.gcda,)
Anthony Liguori49ee3592012-03-28 15:42:05 +0200287 $(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
Stefan Hajnoczi04129602013-05-27 15:28:51 +0200288 MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$((RANDOM % 255 + 1))} \
Anthony Liguori49ee3592012-03-28 15:42:05 +0200289 gtester $(GTESTER_OPTIONS) -m=$(SPEED) $(check-qtest-$*-y),"GTESTER $@")
Blue Swirl1d728c32012-05-01 18:45:39 +0000290 $(if $(CONFIG_GCOV),@for f in $(gcov-files-$*-y); do \
291 echo Gcov report for $$f:;\
292 $(GCOV) $(GCOV_OPTIONS) $$f -o `dirname $$f`; \
293 done,)
Anthony Liguori49ee3592012-03-28 15:42:05 +0200294
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200295.PHONY: $(patsubst %, check-%, $(check-unit-y))
296$(patsubst %, check-%, $(check-unit-y)): check-%: %
Blue Swirl1d728c32012-05-01 18:45:39 +0000297 $(if $(CONFIG_GCOV),@rm -f *.gcda */*.gcda */*/*.gcda */*/*/*.gcda,)
Stefan Hajnoczi04129602013-05-27 15:28:51 +0200298 $(call quiet-command, \
299 MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$((RANDOM % 255 + 1))} \
300 gtester $(GTESTER_OPTIONS) -m=$(SPEED) $*,"GTESTER $*")
Blue Swirl1d728c32012-05-01 18:45:39 +0000301 $(if $(CONFIG_GCOV),@for f in $(gcov-files-$(subst tests/,,$*)-y); do \
302 echo Gcov report for $$f:;\
303 $(GCOV) $(GCOV_OPTIONS) $$f -o `dirname $$f`; \
304 done,)
Anthony Liguoridbfe06c2012-01-10 13:10:43 -0600305
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200306# gtester tests with XML output
307
Anthony Liguori49ee3592012-03-28 15:42:05 +0200308$(patsubst %, check-report-qtest-%.xml, $(QTEST_TARGETS)): check-report-qtest-%.xml: $(check-qtest-y)
309 $(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
310 gtester -q $(GTESTER_OPTIONS) -o $@ -m=$(SPEED) $(check-qtest-$*-y),"GTESTER $@")
311
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200312check-report-unit.xml: $(check-unit-y)
313 $(call quiet-command,gtester -q $(GTESTER_OPTIONS) -o $@ -m=$(SPEED) $^, "GTESTER $@")
314
315# Reports and overall runs
316
Anthony Liguori49ee3592012-03-28 15:42:05 +0200317check-report.xml: $(patsubst %,check-report-qtest-%.xml, $(QTEST_TARGETS)) check-report-unit.xml
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200318 $(call quiet-command,$(SRC_PATH)/scripts/gtester-cat $^ > $@, " GEN $@")
319
320check-report.html: check-report.xml
321 $(call quiet-command,gtester-report $< > $@, " GEN $@")
Kevin Wolf89594492012-03-08 12:29:00 +0100322
Kevin Wolfb8c6f292012-03-09 13:37:40 +0100323
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200324# Other tests
Kevin Wolfb8c6f292012-03-09 13:37:40 +0100325
Wenchao Xia22ee5a52013-09-26 08:42:55 +0800326QEMU_IOTESTS_HELPERS-$(CONFIG_LINUX) = tests/qemu-iotests/socket_scm_helper$(EXESUF)
327
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200328.PHONY: check-tests/qemu-iotests-quick.sh
Wenchao Xia22ee5a52013-09-26 08:42:55 +0800329check-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 +0200330 $<
Kevin Wolfb8c6f292012-03-09 13:37:40 +0100331
Markus Armbruster98626572013-07-27 17:41:53 +0200332.PHONY: check-tests/test-qapi.py
333check-tests/test-qapi.py: tests/test-qapi.py
334
335.PHONY: $(patsubst %, check-%, $(check-qapi-schema-y))
336$(patsubst %, check-%, $(check-qapi-schema-y)): check-%.json: $(SRC_PATH)/%.json
Markus Armbrusterd8039e52013-09-24 09:43:39 +0200337 $(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")
338 @diff -q $(SRC_PATH)/$*.out $*.test.out
339 @diff -q $(SRC_PATH)/$*.err $*.test.err
340 @diff -q $(SRC_PATH)/$*.exit $*.test.exit
Markus Armbruster98626572013-07-27 17:41:53 +0200341
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200342# Consolidated targets
343
Wenchao Xia2cdfb122013-09-26 08:42:56 +0800344.PHONY: check-qapi-schema check-qtest check-unit check check-clean
Markus Armbruster98626572013-07-27 17:41:53 +0200345check-qapi-schema: $(patsubst %,check-%, $(check-qapi-schema-y))
Anthony Liguori49ee3592012-03-28 15:42:05 +0200346check-qtest: $(patsubst %,check-qtest-%, $(QTEST_TARGETS))
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200347check-unit: $(patsubst %,check-%, $(check-unit-y))
348check-block: $(patsubst %,check-%, $(check-block-y))
Markus Armbruster98626572013-07-27 17:41:53 +0200349check: check-qapi-schema check-unit check-qtest
Wenchao Xia2cdfb122013-09-26 08:42:56 +0800350check-clean:
351 $(MAKE) -C tests/tcg clean
352 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)
353
354clean: check-clean
Eduardo Habkost14117c72012-07-18 14:22:27 -0300355
Wenchao Xia22ee5a52013-09-26 08:42:55 +0800356# Build the help program automatically
357
358all: $(QEMU_IOTESTS_HELPERS-y)
359
Eduardo Habkost14117c72012-07-18 14:22:27 -0300360-include $(wildcard tests/*.d)
Anthony Liguoridb2b5502013-06-26 15:52:14 +0200361-include $(wildcard tests/libqos/*.d)