blob: 29c1e5178991db78f0e007123db3ba0a695cf6f5 [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)
Anthony Liguoriad65aa82012-01-10 13:10:51 -060016
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020017check-block-$(CONFIG_POSIX) += tests/qemu-iotests-quick.sh
Anthony Liguoridbfe06c2012-01-10 13:10:43 -060018
Anthony Liguorid1aaf542012-03-28 15:42:07 +020019# All QTests for now are POSIX-only, but the dependencies are
20# really in libqtest, not in the testcases themselves.
21check-qtest-i386-y = tests/rtc-test
22check-qtest-x86_64-y = $(check-qtest-i386-y)
23
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020024GENERATED_HEADERS += tests/test-qapi-types.h tests/test-qapi-visit.h tests/test-qmp-commands.h
Anthony Liguoridbfe06c2012-01-10 13:10:43 -060025
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020026test-obj-y = tests/check-qint.o tests/check-qstring.o tests/check-qdict.o \
27 tests/check-qlist.o tests/check-qfloat.o tests/check-qjson.o \
28 tests/test-coroutine.o tests/test-string-output-visitor.o \
29 tests/test-string-input-visitor.o tests/test-qmp-output-visitor.o \
30 tests/test-qmp-input-visitor.o tests/test-qmp-input-strict.o \
31 tests/test-qmp-commands.o
Anthony Liguoridbfe06c2012-01-10 13:10:43 -060032
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020033test-qapi-obj-y = $(qobject-obj-y) $(qapi-obj-y) $(tools-obj-y)
34test-qapi-obj-y += tests/test-qapi-visit.o tests/test-qapi-types.o
35test-qapi-obj-y += module.o
36
37$(test-obj-y): $(GENERATED_HEADERS)
38$(test-obj-y): QEMU_INCLUDES += -Itests
39
40tests/check-qint$(EXESUF): tests/check-qint.o qint.o $(tools-obj-y)
41tests/check-qstring$(EXESUF): tests/check-qstring.o qstring.o $(tools-obj-y)
42tests/check-qdict$(EXESUF): tests/check-qdict.o qdict.o qfloat.o qint.o qstring.o qbool.o qlist.o $(tools-obj-y)
43tests/check-qlist$(EXESUF): tests/check-qlist.o qlist.o qint.o $(tools-obj-y)
44tests/check-qfloat$(EXESUF): tests/check-qfloat.o qfloat.o $(tools-obj-y)
45tests/check-qjson$(EXESUF): tests/check-qjson.o $(qobject-obj-y) $(tools-obj-y)
46tests/test-coroutine$(EXESUF): tests/test-coroutine.o $(coroutine-obj-y) $(tools-obj-y)
47
48tests/test-qapi-types.c tests/test-qapi-types.h :\
Anthony Liguoridbfe06c2012-01-10 13:10:43 -060049$(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-types.py
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020050 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py $(gen-out-type) -o tests -p "test-" < $<, " GEN $@")
51tests/test-qapi-visit.c tests/test-qapi-visit.h :\
Anthony Liguoridbfe06c2012-01-10 13:10:43 -060052$(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-visit.py
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020053 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py $(gen-out-type) -o tests -p "test-" < $<, " GEN $@")
54tests/test-qmp-commands.h tests/test-qmp-marshal.c :\
Anthony Liguoridbfe06c2012-01-10 13:10:43 -060055$(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-commands.py
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020056 $(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 -060057
58
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020059tests/test-string-output-visitor$(EXESUF): tests/test-string-output-visitor.o $(test-qapi-obj-y)
60tests/test-string-input-visitor$(EXESUF): tests/test-string-input-visitor.o $(test-qapi-obj-y)
61tests/test-qmp-output-visitor$(EXESUF): tests/test-qmp-output-visitor.o $(test-qapi-obj-y)
62tests/test-qmp-input-visitor$(EXESUF): tests/test-qmp-input-visitor.o $(test-qapi-obj-y)
63tests/test-qmp-input-strict$(EXESUF): tests/test-qmp-input-strict.o $(test-qapi-obj-y)
64tests/test-qmp-commands$(EXESUF): tests/test-qmp-commands.o tests/test-qmp-marshal.o $(test-qapi-obj-y)
Paolo Bonzini2d7799f2012-02-09 11:21:03 +010065
Anthony Liguori49ee3592012-03-28 15:42:05 +020066# QTest rules
67
68TARGETS=$(patsubst %-softmmu,%, $(filter %-softmmu,$(TARGET_DIRS)))
69QTEST_TARGETS=$(foreach TARGET,$(TARGETS), $(if $(check-qtest-$(TARGET)-y), $(TARGET),))
70check-qtest-$(CONFIG_POSIX)=$(foreach TARGET,$(TARGETS), $(check-qtest-$(TARGET)-y))
71
72qtest-obj-y = tests/libqtest.o $(oslib-obj-y)
73$(check-qtest-y): $(qtest-obj-y)
74
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020075.PHONY: check-help
76check-help:
77 @echo "Regression testing targets:"
78 @echo
79 @echo " make check Run all tests"
Anthony Liguori49ee3592012-03-28 15:42:05 +020080 @echo " make check-qtest-TARGET Run qtest tests for given target"
81 @echo " make check-qtest Run qtest tests"
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020082 @echo " make check-unit Run qobject tests"
83 @echo " make check-block Run block tests"
84 @echo " make check-report.html Generates an HTML test report"
85 @echo
86 @echo "Please note that HTML reports do not regenerate if the unit tests"
87 @echo "has not changed."
88 @echo
89 @echo "The variable SPEED can be set to control the gtester speed setting."
90 @echo "Default options are -k and (for make V=1) --verbose; they can be"
91 @echo "changed with variable GTESTER_OPTIONS."
Paolo Bonzini2d7799f2012-02-09 11:21:03 +010092
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020093.SECONDARY:
Paolo Bonzinie38ac962012-03-22 12:51:10 +010094
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020095SPEED = quick
96GTESTER_OPTIONS = -k $(if $(V),--verbose,-q)
Anthony Liguoridbfe06c2012-01-10 13:10:43 -060097
Paolo Bonzinib93b63f2012-03-28 15:42:01 +020098# gtester tests, possibly with verbose output
Anthony Liguoridbfe06c2012-01-10 13:10:43 -060099
Anthony Liguori49ee3592012-03-28 15:42:05 +0200100.PHONY: $(patsubst %, check-qtest-%, $(QTEST_TARGETS))
101$(patsubst %, check-qtest-%, $(QTEST_TARGETS)): check-qtest-%: $(check-qtest-y)
102 $(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
103 gtester $(GTESTER_OPTIONS) -m=$(SPEED) $(check-qtest-$*-y),"GTESTER $@")
104
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200105.PHONY: $(patsubst %, check-%, $(check-unit-y))
106$(patsubst %, check-%, $(check-unit-y)): check-%: %
107 $(call quiet-command,gtester $(GTESTER_OPTIONS) -m=$(SPEED) $*,"GTESTER $*")
Anthony Liguoridbfe06c2012-01-10 13:10:43 -0600108
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200109# gtester tests with XML output
110
Anthony Liguori49ee3592012-03-28 15:42:05 +0200111$(patsubst %, check-report-qtest-%.xml, $(QTEST_TARGETS)): check-report-qtest-%.xml: $(check-qtest-y)
112 $(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
113 gtester -q $(GTESTER_OPTIONS) -o $@ -m=$(SPEED) $(check-qtest-$*-y),"GTESTER $@")
114
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200115check-report-unit.xml: $(check-unit-y)
116 $(call quiet-command,gtester -q $(GTESTER_OPTIONS) -o $@ -m=$(SPEED) $^, "GTESTER $@")
117
118# Reports and overall runs
119
Anthony Liguori49ee3592012-03-28 15:42:05 +0200120check-report.xml: $(patsubst %,check-report-qtest-%.xml, $(QTEST_TARGETS)) check-report-unit.xml
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200121 $(call quiet-command,$(SRC_PATH)/scripts/gtester-cat $^ > $@, " GEN $@")
122
123check-report.html: check-report.xml
124 $(call quiet-command,gtester-report $< > $@, " GEN $@")
Kevin Wolf89594492012-03-08 12:29:00 +0100125
Kevin Wolfb8c6f292012-03-09 13:37:40 +0100126
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200127# Other tests
Kevin Wolfb8c6f292012-03-09 13:37:40 +0100128
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200129.PHONY: check-tests/qemu-iotests-quick.sh
130check-tests/qemu-iotests-quick.sh: tests/qemu-iotests-quick.sh qemu-img$(EXESUF) qemu-io$(EXESUF)
131 $<
Kevin Wolfb8c6f292012-03-09 13:37:40 +0100132
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200133# Consolidated targets
134
Anthony Liguori49ee3592012-03-28 15:42:05 +0200135.PHONY: check-qtest check-unit check
136check-qtest: $(patsubst %,check-qtest-%, $(QTEST_TARGETS))
Paolo Bonzinib93b63f2012-03-28 15:42:01 +0200137check-unit: $(patsubst %,check-%, $(check-unit-y))
138check-block: $(patsubst %,check-%, $(check-block-y))
Anthony Liguori49ee3592012-03-28 15:42:05 +0200139check: check-unit check-qtest