blob: 9675ba7c13d5558fe2a2027cfa20d2a04ccff413 [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)
4check-unit-y += tests/check-qfloat$(EXESUF)
5check-unit-y += tests/check-qint$(EXESUF)
6check-unit-y += tests/check-qstring$(EXESUF)
7check-unit-y += tests/check-qlist$(EXESUF)
8check-unit-y += tests/check-qjson$(EXESUF)
9check-unit-y += tests/test-qmp-output-visitor$(EXESUF)
10check-unit-y += tests/test-qmp-input-visitor$(EXESUF)
11check-unit-y += tests/test-qmp-input-strict$(EXESUF)
12check-unit-y += tests/test-qmp-commands$(EXESUF)
13check-unit-y += tests/test-string-input-visitor$(EXESUF)
14check-unit-y += tests/test-string-output-visitor$(EXESUF)
15check-unit-y += tests/test-coroutine$(EXESUF)
Michael Roth2d496102012-02-21 21:05:07 -060016check-unit-y += tests/test-visitor-serialization$(EXESUF)
Michael Tokarev2278a692012-06-07 20:08:19 +040017check-unit-y += tests/test-iov$(EXESUF)
Anthony Liguoriad65aa82012-01-10 13:10:51 -060018
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020019check-block-$(CONFIG_POSIX) += tests/qemu-iotests-quick.sh
Anthony Liguoridbfe06c2012-01-10 13:10:43 -060020
Anthony Liguorid1aaf542012-03-28 15:42:07 +020021# All QTests for now are POSIX-only, but the dependencies are
22# really in libqtest, not in the testcases themselves.
Kevin Wolf6c806632012-05-10 09:46:18 +020023check-qtest-i386-y = tests/fdc-test$(EXESUF)
Markus Armbruster0e8a8c82012-07-10 11:12:30 +020024check-qtest-i386-y += tests/hd-geo-test$(EXESUF)
Stefan Weilfba0c402012-05-15 18:19:45 +020025check-qtest-i386-y += tests/rtc-test$(EXESUF)
Anthony Liguorid1aaf542012-03-28 15:42:07 +020026check-qtest-x86_64-y = $(check-qtest-i386-y)
Blue Swirlf91837a2012-04-15 11:45:18 +000027check-qtest-sparc-y = tests/m48t59-test$(EXESUF)
28check-qtest-sparc64-y = tests/m48t59-test$(EXESUF)
Anthony Liguorid1aaf542012-03-28 15:42:07 +020029
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020030GENERATED_HEADERS += tests/test-qapi-types.h tests/test-qapi-visit.h tests/test-qmp-commands.h
Anthony Liguoridbfe06c2012-01-10 13:10:43 -060031
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020032test-obj-y = tests/check-qint.o tests/check-qstring.o tests/check-qdict.o \
33 tests/check-qlist.o tests/check-qfloat.o tests/check-qjson.o \
34 tests/test-coroutine.o tests/test-string-output-visitor.o \
35 tests/test-string-input-visitor.o tests/test-qmp-output-visitor.o \
36 tests/test-qmp-input-visitor.o tests/test-qmp-input-strict.o \
Michael Roth2d496102012-02-21 21:05:07 -060037 tests/test-qmp-commands.o tests/test-visitor-serialization.o
Anthony Liguoridbfe06c2012-01-10 13:10:43 -060038
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020039test-qapi-obj-y = $(qobject-obj-y) $(qapi-obj-y) $(tools-obj-y)
40test-qapi-obj-y += tests/test-qapi-visit.o tests/test-qapi-types.o
41test-qapi-obj-y += module.o
42
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020043$(test-obj-y): QEMU_INCLUDES += -Itests
44
45tests/check-qint$(EXESUF): tests/check-qint.o qint.o $(tools-obj-y)
46tests/check-qstring$(EXESUF): tests/check-qstring.o qstring.o $(tools-obj-y)
47tests/check-qdict$(EXESUF): tests/check-qdict.o qdict.o qfloat.o qint.o qstring.o qbool.o qlist.o $(tools-obj-y)
48tests/check-qlist$(EXESUF): tests/check-qlist.o qlist.o qint.o $(tools-obj-y)
49tests/check-qfloat$(EXESUF): tests/check-qfloat.o qfloat.o $(tools-obj-y)
50tests/check-qjson$(EXESUF): tests/check-qjson.o $(qobject-obj-y) $(tools-obj-y)
51tests/test-coroutine$(EXESUF): tests/test-coroutine.o $(coroutine-obj-y) $(tools-obj-y)
Michael Tokarev2278a692012-06-07 20:08:19 +040052tests/test-iov$(EXESUF): tests/test-iov.o iov.o
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020053
54tests/test-qapi-types.c tests/test-qapi-types.h :\
Anthony Liguoridbfe06c2012-01-10 13:10:43 -060055$(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-types.py
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020056 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py $(gen-out-type) -o tests -p "test-" < $<, " GEN $@")
57tests/test-qapi-visit.c tests/test-qapi-visit.h :\
Anthony Liguoridbfe06c2012-01-10 13:10:43 -060058$(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-visit.py
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020059 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py $(gen-out-type) -o tests -p "test-" < $<, " GEN $@")
60tests/test-qmp-commands.h tests/test-qmp-marshal.c :\
Anthony Liguoridbfe06c2012-01-10 13:10:43 -060061$(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-commands.py
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020062 $(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 -060063
64
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020065tests/test-string-output-visitor$(EXESUF): tests/test-string-output-visitor.o $(test-qapi-obj-y)
66tests/test-string-input-visitor$(EXESUF): tests/test-string-input-visitor.o $(test-qapi-obj-y)
67tests/test-qmp-output-visitor$(EXESUF): tests/test-qmp-output-visitor.o $(test-qapi-obj-y)
68tests/test-qmp-input-visitor$(EXESUF): tests/test-qmp-input-visitor.o $(test-qapi-obj-y)
69tests/test-qmp-input-strict$(EXESUF): tests/test-qmp-input-strict.o $(test-qapi-obj-y)
70tests/test-qmp-commands$(EXESUF): tests/test-qmp-commands.o tests/test-qmp-marshal.o $(test-qapi-obj-y)
Michael Roth2d496102012-02-21 21:05:07 -060071tests/test-visitor-serialization$(EXESUF): tests/test-visitor-serialization.o $(test-qapi-obj-y)
Paolo Bonzini2d7799f2012-02-09 11:21:03 +010072
Blue Swirld2a16f72012-03-30 17:39:33 +000073tests/rtc-test$(EXESUF): tests/rtc-test.o $(trace-obj-y)
Blue Swirlf91837a2012-04-15 11:45:18 +000074tests/m48t59-test$(EXESUF): tests/m48t59-test.o $(trace-obj-y)
Stefan Weilfd4567d2012-05-15 07:27:19 +020075tests/fdc-test$(EXESUF): tests/fdc-test.o tests/libqtest.o $(trace-obj-y)
Markus Armbruster0e8a8c82012-07-10 11:12:30 +020076tests/hd-geo-test$(EXESUF): tests/hd-geo-test.o tests/libqtest.o $(trace-obj-y)
Blue Swirld2a16f72012-03-30 17:39:33 +000077
Anthony Liguori49ee3592012-03-28 15:42:05 +020078# QTest rules
79
80TARGETS=$(patsubst %-softmmu,%, $(filter %-softmmu,$(TARGET_DIRS)))
81QTEST_TARGETS=$(foreach TARGET,$(TARGETS), $(if $(check-qtest-$(TARGET)-y), $(TARGET),))
82check-qtest-$(CONFIG_POSIX)=$(foreach TARGET,$(TARGETS), $(check-qtest-$(TARGET)-y))
83
84qtest-obj-y = tests/libqtest.o $(oslib-obj-y)
85$(check-qtest-y): $(qtest-obj-y)
86
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020087.PHONY: check-help
88check-help:
89 @echo "Regression testing targets:"
90 @echo
91 @echo " make check Run all tests"
Anthony Liguori49ee3592012-03-28 15:42:05 +020092 @echo " make check-qtest-TARGET Run qtest tests for given target"
93 @echo " make check-qtest Run qtest tests"
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020094 @echo " make check-unit Run qobject tests"
95 @echo " make check-block Run block tests"
96 @echo " make check-report.html Generates an HTML test report"
97 @echo
98 @echo "Please note that HTML reports do not regenerate if the unit tests"
99 @echo "has not changed."
100 @echo
101 @echo "The variable SPEED can be set to control the gtester speed setting."
102 @echo "Default options are -k and (for make V=1) --verbose; they can be"
103 @echo "changed with variable GTESTER_OPTIONS."
Paolo Bonzini2d7799f2012-02-09 11:21:03 +0100104
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200105SPEED = quick
106GTESTER_OPTIONS = -k $(if $(V),--verbose,-q)
Anthony Liguoridbfe06c2012-01-10 13:10:43 -0600107
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200108# gtester tests, possibly with verbose output
Anthony Liguoridbfe06c2012-01-10 13:10:43 -0600109
Anthony Liguori49ee3592012-03-28 15:42:05 +0200110.PHONY: $(patsubst %, check-qtest-%, $(QTEST_TARGETS))
111$(patsubst %, check-qtest-%, $(QTEST_TARGETS)): check-qtest-%: $(check-qtest-y)
112 $(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
113 gtester $(GTESTER_OPTIONS) -m=$(SPEED) $(check-qtest-$*-y),"GTESTER $@")
114
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200115.PHONY: $(patsubst %, check-%, $(check-unit-y))
116$(patsubst %, check-%, $(check-unit-y)): check-%: %
117 $(call quiet-command,gtester $(GTESTER_OPTIONS) -m=$(SPEED) $*,"GTESTER $*")
Anthony Liguoridbfe06c2012-01-10 13:10:43 -0600118
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200119# gtester tests with XML output
120
Anthony Liguori49ee3592012-03-28 15:42:05 +0200121$(patsubst %, check-report-qtest-%.xml, $(QTEST_TARGETS)): check-report-qtest-%.xml: $(check-qtest-y)
122 $(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
123 gtester -q $(GTESTER_OPTIONS) -o $@ -m=$(SPEED) $(check-qtest-$*-y),"GTESTER $@")
124
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200125check-report-unit.xml: $(check-unit-y)
126 $(call quiet-command,gtester -q $(GTESTER_OPTIONS) -o $@ -m=$(SPEED) $^, "GTESTER $@")
127
128# Reports and overall runs
129
Anthony Liguori49ee3592012-03-28 15:42:05 +0200130check-report.xml: $(patsubst %,check-report-qtest-%.xml, $(QTEST_TARGETS)) check-report-unit.xml
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200131 $(call quiet-command,$(SRC_PATH)/scripts/gtester-cat $^ > $@, " GEN $@")
132
133check-report.html: check-report.xml
134 $(call quiet-command,gtester-report $< > $@, " GEN $@")
Kevin Wolf89594492012-03-08 12:29:00 +0100135
Kevin Wolfb8c6f292012-03-09 13:37:40 +0100136
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200137# Other tests
Kevin Wolfb8c6f292012-03-09 13:37:40 +0100138
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200139.PHONY: check-tests/qemu-iotests-quick.sh
140check-tests/qemu-iotests-quick.sh: tests/qemu-iotests-quick.sh qemu-img$(EXESUF) qemu-io$(EXESUF)
141 $<
Kevin Wolfb8c6f292012-03-09 13:37:40 +0100142
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200143# Consolidated targets
144
Anthony Liguori49ee3592012-03-28 15:42:05 +0200145.PHONY: check-qtest check-unit check
146check-qtest: $(patsubst %,check-qtest-%, $(QTEST_TARGETS))
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200147check-unit: $(patsubst %,check-%, $(check-unit-y))
148check-block: $(patsubst %,check-%, $(check-block-y))
Anthony Liguori49ee3592012-03-28 15:42:05 +0200149check: check-unit check-qtest