blob: cafbb2726fd729c1f257a932d4206e3df63a8814 [file] [log] [blame]
Kevin Wolf89594492012-03-08 12:29:00 +01001export SRC_PATH
2
Paolo Bonzinib93b63f2012-03-28 15:42:01 +02003check-unit-y = tests/check-qdict$(EXESUF)
Paolo Bonzini5f7a74a2013-01-15 09:49:35 +01004gcov-files-check-qdict-y = qobject/qdict.c
Paolo Bonzinib93b63f2012-03-28 15:42:01 +02005check-unit-y += tests/check-qfloat$(EXESUF)
Paolo Bonzini5f7a74a2013-01-15 09:49:35 +01006gcov-files-check-qfloat-y = qobject/qfloat.c
Paolo Bonzinib93b63f2012-03-28 15:42:01 +02007check-unit-y += tests/check-qint$(EXESUF)
Paolo Bonzini5f7a74a2013-01-15 09:49:35 +01008gcov-files-check-qint-y = qobject/qint.c
Paolo Bonzinib93b63f2012-03-28 15:42:01 +02009check-unit-y += tests/check-qstring$(EXESUF)
Paolo Bonzini5f7a74a2013-01-15 09:49:35 +010010gcov-files-check-qstring-y = qobject/qstring.c
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020011check-unit-y += tests/check-qlist$(EXESUF)
Paolo Bonzini5f7a74a2013-01-15 09:49:35 +010012gcov-files-check-qlist-y = qobject/qlist.c
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020013check-unit-y += tests/check-qjson$(EXESUF)
Paolo Bonzini5f7a74a2013-01-15 09:49:35 +010014gcov-files-check-qjson-y = qobject/qjson.c
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020015check-unit-y += tests/test-qmp-output-visitor$(EXESUF)
Blue Swirl1d728c32012-05-01 18:45:39 +000016gcov-files-test-qmp-output-visitor-y = qapi/qmp-output-visitor.c
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020017check-unit-y += tests/test-qmp-input-visitor$(EXESUF)
Blue Swirl1d728c32012-05-01 18:45:39 +000018gcov-files-test-qmp-input-visitor-y = qapi/qmp-input-visitor.c
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020019check-unit-y += tests/test-qmp-input-strict$(EXESUF)
20check-unit-y += tests/test-qmp-commands$(EXESUF)
Blue Swirl1d728c32012-05-01 18:45:39 +000021gcov-files-test-qmp-commands-y = qapi/qmp-dispatch.c
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020022check-unit-y += tests/test-string-input-visitor$(EXESUF)
Blue Swirl1d728c32012-05-01 18:45:39 +000023gcov-files-test-string-input-visitor-y = qapi/string-input-visitor.c
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020024check-unit-y += tests/test-string-output-visitor$(EXESUF)
Blue Swirl1d728c32012-05-01 18:45:39 +000025gcov-files-test-string-output-visitor-y = qapi/string-output-visitor.c
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020026check-unit-y += tests/test-coroutine$(EXESUF)
Peter Maydell7c2acc72013-04-08 12:11:27 +010027gcov-files-test-coroutine-y = coroutine-$(CONFIG_COROUTINE_BACKEND).c
Michael Roth2d496102012-02-21 21:05:07 -060028check-unit-y += tests/test-visitor-serialization$(EXESUF)
Michael Tokarev2278a692012-06-07 20:08:19 +040029check-unit-y += tests/test-iov$(EXESUF)
Paolo Bonzini5f7a74a2013-01-15 09:49:35 +010030gcov-files-test-iov-y = util/iov.c
Paolo Bonzinib2ea25d2012-11-23 16:13:23 +010031check-unit-y += tests/test-aio$(EXESUF)
Blue Swirl1d728c32012-05-01 18:45:39 +000032gcov-files-test-aio-$(CONFIG_WIN32) = aio-win32.c
33gcov-files-test-aio-$(CONFIG_POSIX) = aio-posix.c
Paolo Bonzini74c856e2012-11-23 16:13:24 +010034check-unit-y += tests/test-thread-pool$(EXESUF)
Blue Swirl1d728c32012-05-01 18:45:39 +000035gcov-files-test-thread-pool-y = thread-pool.c
Paolo Bonzinie7c033c2013-01-21 17:09:40 +010036gcov-files-test-hbitmap-y = util/hbitmap.c
37check-unit-y += tests/test-hbitmap$(EXESUF)
Eduardo Habkost247c9de2013-01-23 15:58:27 -020038check-unit-y += tests/test-x86-cpuid$(EXESUF)
39# all code tested by test-x86-cpuid is inside topology.h
40gcov-files-test-x86-cpuid-y =
Orit Wasserman21e3cd22013-01-31 09:12:16 +020041check-unit-y += tests/test-xbzrle$(EXESUF)
42gcov-files-test-xbzrle-y = xbzrle.c
Eduardo Habkoste3f9fe22013-02-04 16:27:45 -020043check-unit-y += tests/test-cutils$(EXESUF)
44gcov-files-test-cutils-y += util/cutils.c
Richard Hendersonf4c0f982013-02-16 12:47:01 -080045check-unit-y += tests/test-mul64$(EXESUF)
46gcov-files-test-mul64-y = util/host-utils.c
Anthony Liguoriad65aa82012-01-10 13:10:51 -060047
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020048check-block-$(CONFIG_POSIX) += tests/qemu-iotests-quick.sh
Anthony Liguoridbfe06c2012-01-10 13:10:43 -060049
Anthony Liguorid1aaf542012-03-28 15:42:07 +020050# All QTests for now are POSIX-only, but the dependencies are
51# really in libqtest, not in the testcases themselves.
Kevin Wolf6c806632012-05-10 09:46:18 +020052check-qtest-i386-y = tests/fdc-test$(EXESUF)
Blue Swirl1d728c32012-05-01 18:45:39 +000053gcov-files-i386-y = hw/fdc.c
Markus Armbruster0e8a8c82012-07-10 11:12:30 +020054check-qtest-i386-y += tests/hd-geo-test$(EXESUF)
Blue Swirl1d728c32012-05-01 18:45:39 +000055gcov-files-i386-y += hw/hd-geometry.c
Stefan Weilfba0c402012-05-15 18:19:45 +020056check-qtest-i386-y += tests/rtc-test$(EXESUF)
Anthony Liguorid1aaf542012-03-28 15:42:07 +020057check-qtest-x86_64-y = $(check-qtest-i386-y)
Blue Swirl1d728c32012-05-01 18:45:39 +000058gcov-files-i386-y += i386-softmmu/hw/mc146818rtc.c
Andreas Färberc5cd02b2013-01-26 12:45:14 +010059gcov-files-x86_64-y = $(subst i386-softmmu/,x86_64-softmmu/,$(gcov-files-i386-y))
Anthony Liguoribaeddde2013-01-29 15:42:45 -060060#check-qtest-sparc-y = tests/m48t59-test$(EXESUF)
61#check-qtest-sparc64-y = tests/m48t59-test$(EXESUF)
Blue Swirl1d728c32012-05-01 18:45:39 +000062gcov-files-sparc-y += hw/m48t59.c
Andreas Färbercba040c2013-01-26 12:45:13 +010063gcov-files-sparc64-y += hw/m48t59.c
Andreas Färber6e998902013-01-16 01:57:57 +010064check-qtest-arm-y = tests/tmp105-test$(EXESUF)
Andreas Färber6a694492013-01-26 12:45:12 +010065gcov-files-arm-y += hw/tmp105.c
Anthony Liguorid1aaf542012-03-28 15:42:07 +020066
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020067GENERATED_HEADERS += tests/test-qapi-types.h tests/test-qapi-visit.h tests/test-qmp-commands.h
Anthony Liguoridbfe06c2012-01-10 13:10:43 -060068
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020069test-obj-y = tests/check-qint.o tests/check-qstring.o tests/check-qdict.o \
70 tests/check-qlist.o tests/check-qfloat.o tests/check-qjson.o \
71 tests/test-coroutine.o tests/test-string-output-visitor.o \
72 tests/test-string-input-visitor.o tests/test-qmp-output-visitor.o \
73 tests/test-qmp-input-visitor.o tests/test-qmp-input-strict.o \
Eduardo Habkost247c9de2013-01-23 15:58:27 -020074 tests/test-qmp-commands.o tests/test-visitor-serialization.o \
Richard Hendersonf4c0f982013-02-16 12:47:01 -080075 tests/test-x86-cpuid.o tests/test-mul64.o
Anthony Liguoridbfe06c2012-01-10 13:10:43 -060076
Paolo Bonzini576d5502012-12-20 15:27:51 +010077test-qapi-obj-y = tests/test-qapi-visit.o tests/test-qapi-types.o
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020078
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020079$(test-obj-y): QEMU_INCLUDES += -Itests
Anthony Liguoric4efe1c2013-04-16 09:45:16 -050080QEMU_CFLAGS += -I$(SRC_PATH)/tests
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020081
Eduardo Habkost247c9de2013-01-23 15:58:27 -020082tests/test-x86-cpuid.o: QEMU_INCLUDES += -I$(SRC_PATH)/target-i386
83
Paolo Bonzinia3728232012-12-20 16:10:26 +010084tests/check-qint$(EXESUF): tests/check-qint.o libqemuutil.a
85tests/check-qstring$(EXESUF): tests/check-qstring.o libqemuutil.a
86tests/check-qdict$(EXESUF): tests/check-qdict.o libqemuutil.a
87tests/check-qlist$(EXESUF): tests/check-qlist.o libqemuutil.a
88tests/check-qfloat$(EXESUF): tests/check-qfloat.o libqemuutil.a
89tests/check-qjson$(EXESUF): tests/check-qjson.o libqemuutil.a libqemustub.a
Paolo Bonzinif157ebb2012-12-20 16:09:36 +010090tests/test-coroutine$(EXESUF): tests/test-coroutine.o $(block-obj-y) libqemuutil.a libqemustub.a
91tests/test-aio$(EXESUF): tests/test-aio.o $(block-obj-y) libqemuutil.a libqemustub.a
92tests/test-thread-pool$(EXESUF): tests/test-thread-pool.o $(block-obj-y) libqemuutil.a libqemustub.a
93tests/test-iov$(EXESUF): tests/test-iov.o libqemuutil.a
Paolo Bonzinie7c033c2013-01-21 17:09:40 +010094tests/test-hbitmap$(EXESUF): tests/test-hbitmap.o libqemuutil.a libqemustub.a
Eduardo Habkost247c9de2013-01-23 15:58:27 -020095tests/test-x86-cpuid$(EXESUF): tests/test-x86-cpuid.o
Orit Wasserman21e3cd22013-01-31 09:12:16 +020096tests/test-xbzrle$(EXESUF): tests/test-xbzrle.o xbzrle.o page_cache.o libqemuutil.a
Eduardo Habkoste3f9fe22013-02-04 16:27:45 -020097tests/test-cutils$(EXESUF): tests/test-cutils.o util/cutils.o
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020098
99tests/test-qapi-types.c tests/test-qapi-types.h :\
Anthony Liguoridbfe06c2012-01-10 13:10:43 -0600100$(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-types.py
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200101 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py $(gen-out-type) -o tests -p "test-" < $<, " GEN $@")
102tests/test-qapi-visit.c tests/test-qapi-visit.h :\
Anthony Liguoridbfe06c2012-01-10 13:10:43 -0600103$(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-visit.py
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200104 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py $(gen-out-type) -o tests -p "test-" < $<, " GEN $@")
105tests/test-qmp-commands.h tests/test-qmp-marshal.c :\
Anthony Liguoridbfe06c2012-01-10 13:10:43 -0600106$(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-commands.py
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200107 $(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 -0600108
Paolo Bonzini8a090702012-12-20 15:40:20 +0100109tests/test-string-output-visitor$(EXESUF): tests/test-string-output-visitor.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
110tests/test-string-input-visitor$(EXESUF): tests/test-string-input-visitor.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
111tests/test-qmp-output-visitor$(EXESUF): tests/test-qmp-output-visitor.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
112tests/test-qmp-input-visitor$(EXESUF): tests/test-qmp-input-visitor.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
113tests/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 +0100114tests/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 +0100115tests/test-visitor-serialization$(EXESUF): tests/test-visitor-serialization.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
Paolo Bonzini2d7799f2012-02-09 11:21:03 +0100116
Richard Hendersonf4c0f982013-02-16 12:47:01 -0800117tests/test-mul64$(EXESUF): tests/test-mul64.o libqemuutil.a
118
Anthony Liguori234c69c2013-04-16 09:45:17 -0500119libqos-obj-y = tests/libqos/pci.o tests/libqos/fw_cfg.o
120libqos-pc-obj-y = $(libqos-obj-y) tests/libqos/pci-pc.o tests/libqos/fw_cfg-pc.o
Anthony Liguori8a0743c2013-04-16 09:45:18 -0500121libqos-pc-obj-y += tests/libqos/malloc-pc.o
Anthony Liguoric4efe1c2013-04-16 09:45:16 -0500122
Paolo Bonziniff667e22012-12-21 09:45:20 +0100123tests/rtc-test$(EXESUF): tests/rtc-test.o
124tests/m48t59-test$(EXESUF): tests/m48t59-test.o
125tests/fdc-test$(EXESUF): tests/fdc-test.o
126tests/hd-geo-test$(EXESUF): tests/hd-geo-test.o
Andreas Färber6e998902013-01-16 01:57:57 +0100127tests/tmp105-test$(EXESUF): tests/tmp105-test.o
Blue Swirld2a16f72012-03-30 17:39:33 +0000128
Anthony Liguori49ee3592012-03-28 15:42:05 +0200129# QTest rules
130
131TARGETS=$(patsubst %-softmmu,%, $(filter %-softmmu,$(TARGET_DIRS)))
132QTEST_TARGETS=$(foreach TARGET,$(TARGETS), $(if $(check-qtest-$(TARGET)-y), $(TARGET),))
133check-qtest-$(CONFIG_POSIX)=$(foreach TARGET,$(TARGETS), $(check-qtest-$(TARGET)-y))
134
Paolo Bonzini8a090702012-12-20 15:40:20 +0100135qtest-obj-y = tests/libqtest.o libqemuutil.a libqemustub.a
Andreas Färber2bf7b452013-01-16 01:57:54 +0100136qtest-obj-y += tests/libi2c.o tests/libi2c-omap.o
Anthony Liguori49ee3592012-03-28 15:42:05 +0200137$(check-qtest-y): $(qtest-obj-y)
138
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200139.PHONY: check-help
140check-help:
141 @echo "Regression testing targets:"
142 @echo
143 @echo " make check Run all tests"
Anthony Liguori49ee3592012-03-28 15:42:05 +0200144 @echo " make check-qtest-TARGET Run qtest tests for given target"
145 @echo " make check-qtest Run qtest tests"
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200146 @echo " make check-unit Run qobject tests"
147 @echo " make check-block Run block tests"
148 @echo " make check-report.html Generates an HTML test report"
149 @echo
150 @echo "Please note that HTML reports do not regenerate if the unit tests"
151 @echo "has not changed."
152 @echo
153 @echo "The variable SPEED can be set to control the gtester speed setting."
154 @echo "Default options are -k and (for make V=1) --verbose; they can be"
155 @echo "changed with variable GTESTER_OPTIONS."
Paolo Bonzini2d7799f2012-02-09 11:21:03 +0100156
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200157SPEED = quick
158GTESTER_OPTIONS = -k $(if $(V),--verbose,-q)
Blue Swirl1d728c32012-05-01 18:45:39 +0000159GCOV_OPTIONS = -n $(if $(V),-f,)
Anthony Liguoridbfe06c2012-01-10 13:10:43 -0600160
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200161# gtester tests, possibly with verbose output
Anthony Liguoridbfe06c2012-01-10 13:10:43 -0600162
Anthony Liguori49ee3592012-03-28 15:42:05 +0200163.PHONY: $(patsubst %, check-qtest-%, $(QTEST_TARGETS))
164$(patsubst %, check-qtest-%, $(QTEST_TARGETS)): check-qtest-%: $(check-qtest-y)
Blue Swirl1d728c32012-05-01 18:45:39 +0000165 $(if $(CONFIG_GCOV),@rm -f *.gcda */*.gcda */*/*.gcda */*/*/*.gcda,)
Anthony Liguori49ee3592012-03-28 15:42:05 +0200166 $(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
167 gtester $(GTESTER_OPTIONS) -m=$(SPEED) $(check-qtest-$*-y),"GTESTER $@")
Blue Swirl1d728c32012-05-01 18:45:39 +0000168 $(if $(CONFIG_GCOV),@for f in $(gcov-files-$*-y); do \
169 echo Gcov report for $$f:;\
170 $(GCOV) $(GCOV_OPTIONS) $$f -o `dirname $$f`; \
171 done,)
Anthony Liguori49ee3592012-03-28 15:42:05 +0200172
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200173.PHONY: $(patsubst %, check-%, $(check-unit-y))
174$(patsubst %, check-%, $(check-unit-y)): check-%: %
Blue Swirl1d728c32012-05-01 18:45:39 +0000175 $(if $(CONFIG_GCOV),@rm -f *.gcda */*.gcda */*/*.gcda */*/*/*.gcda,)
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200176 $(call quiet-command,gtester $(GTESTER_OPTIONS) -m=$(SPEED) $*,"GTESTER $*")
Blue Swirl1d728c32012-05-01 18:45:39 +0000177 $(if $(CONFIG_GCOV),@for f in $(gcov-files-$(subst tests/,,$*)-y); do \
178 echo Gcov report for $$f:;\
179 $(GCOV) $(GCOV_OPTIONS) $$f -o `dirname $$f`; \
180 done,)
Anthony Liguoridbfe06c2012-01-10 13:10:43 -0600181
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200182# gtester tests with XML output
183
Anthony Liguori49ee3592012-03-28 15:42:05 +0200184$(patsubst %, check-report-qtest-%.xml, $(QTEST_TARGETS)): check-report-qtest-%.xml: $(check-qtest-y)
185 $(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
186 gtester -q $(GTESTER_OPTIONS) -o $@ -m=$(SPEED) $(check-qtest-$*-y),"GTESTER $@")
187
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200188check-report-unit.xml: $(check-unit-y)
189 $(call quiet-command,gtester -q $(GTESTER_OPTIONS) -o $@ -m=$(SPEED) $^, "GTESTER $@")
190
191# Reports and overall runs
192
Anthony Liguori49ee3592012-03-28 15:42:05 +0200193check-report.xml: $(patsubst %,check-report-qtest-%.xml, $(QTEST_TARGETS)) check-report-unit.xml
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200194 $(call quiet-command,$(SRC_PATH)/scripts/gtester-cat $^ > $@, " GEN $@")
195
196check-report.html: check-report.xml
197 $(call quiet-command,gtester-report $< > $@, " GEN $@")
Kevin Wolf89594492012-03-08 12:29:00 +0100198
Kevin Wolfb8c6f292012-03-09 13:37:40 +0100199
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200200# Other tests
Kevin Wolfb8c6f292012-03-09 13:37:40 +0100201
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200202.PHONY: check-tests/qemu-iotests-quick.sh
203check-tests/qemu-iotests-quick.sh: tests/qemu-iotests-quick.sh qemu-img$(EXESUF) qemu-io$(EXESUF)
204 $<
Kevin Wolfb8c6f292012-03-09 13:37:40 +0100205
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200206# Consolidated targets
207
Anthony Liguori49ee3592012-03-28 15:42:05 +0200208.PHONY: check-qtest check-unit check
209check-qtest: $(patsubst %,check-qtest-%, $(QTEST_TARGETS))
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200210check-unit: $(patsubst %,check-%, $(check-unit-y))
211check-block: $(patsubst %,check-%, $(check-block-y))
Anthony Liguori49ee3592012-03-28 15:42:05 +0200212check: check-unit check-qtest
Eduardo Habkost14117c72012-07-18 14:22:27 -0300213
214-include $(wildcard tests/*.d)