]> git.proxmox.com Git - qemu.git/blob - tests/Makefile
tests: add AioContext unit tests
[qemu.git] / tests / Makefile
1 export SRC_PATH
2
3 check-unit-y = tests/check-qdict$(EXESUF)
4 check-unit-y += tests/check-qfloat$(EXESUF)
5 check-unit-y += tests/check-qint$(EXESUF)
6 check-unit-y += tests/check-qstring$(EXESUF)
7 check-unit-y += tests/check-qlist$(EXESUF)
8 check-unit-y += tests/check-qjson$(EXESUF)
9 check-unit-y += tests/test-qmp-output-visitor$(EXESUF)
10 check-unit-y += tests/test-qmp-input-visitor$(EXESUF)
11 check-unit-y += tests/test-qmp-input-strict$(EXESUF)
12 check-unit-y += tests/test-qmp-commands$(EXESUF)
13 check-unit-y += tests/test-string-input-visitor$(EXESUF)
14 check-unit-y += tests/test-string-output-visitor$(EXESUF)
15 check-unit-y += tests/test-coroutine$(EXESUF)
16 check-unit-y += tests/test-visitor-serialization$(EXESUF)
17 check-unit-y += tests/test-iov$(EXESUF)
18 check-unit-y += tests/test-aio$(EXESUF)
19
20 check-block-$(CONFIG_POSIX) += tests/qemu-iotests-quick.sh
21
22 # All QTests for now are POSIX-only, but the dependencies are
23 # really in libqtest, not in the testcases themselves.
24 check-qtest-i386-y = tests/fdc-test$(EXESUF)
25 check-qtest-i386-y += tests/hd-geo-test$(EXESUF)
26 check-qtest-i386-y += tests/rtc-test$(EXESUF)
27 check-qtest-x86_64-y = $(check-qtest-i386-y)
28 check-qtest-sparc-y = tests/m48t59-test$(EXESUF)
29 check-qtest-sparc64-y = tests/m48t59-test$(EXESUF)
30
31 GENERATED_HEADERS += tests/test-qapi-types.h tests/test-qapi-visit.h tests/test-qmp-commands.h
32
33 test-obj-y = tests/check-qint.o tests/check-qstring.o tests/check-qdict.o \
34 tests/check-qlist.o tests/check-qfloat.o tests/check-qjson.o \
35 tests/test-coroutine.o tests/test-string-output-visitor.o \
36 tests/test-string-input-visitor.o tests/test-qmp-output-visitor.o \
37 tests/test-qmp-input-visitor.o tests/test-qmp-input-strict.o \
38 tests/test-qmp-commands.o tests/test-visitor-serialization.o
39
40 test-qapi-obj-y = $(qobject-obj-y) $(qapi-obj-y) qemu-tool.o
41 test-qapi-obj-y += tests/test-qapi-visit.o tests/test-qapi-types.o
42 test-qapi-obj-y += module.o
43
44 $(test-obj-y): QEMU_INCLUDES += -Itests
45
46 tests/check-qint$(EXESUF): tests/check-qint.o qint.o
47 tests/check-qstring$(EXESUF): tests/check-qstring.o qstring.o
48 tests/check-qdict$(EXESUF): tests/check-qdict.o qdict.o qfloat.o qint.o qstring.o qbool.o qlist.o
49 tests/check-qlist$(EXESUF): tests/check-qlist.o qlist.o qint.o
50 tests/check-qfloat$(EXESUF): tests/check-qfloat.o qfloat.o
51 tests/check-qjson$(EXESUF): tests/check-qjson.o $(qobject-obj-y) qemu-tool.o
52 tests/test-coroutine$(EXESUF): tests/test-coroutine.o $(coroutine-obj-y) $(tools-obj-y) $(block-obj-y) iov.o libqemustub.a
53 tests/test-aio$(EXESUF): tests/test-aio.o $(coroutine-obj-y) $(tools-obj-y) $(block-obj-y) libqemustub.a
54 tests/test-iov$(EXESUF): tests/test-iov.o iov.o
55
56 tests/test-qapi-types.c tests/test-qapi-types.h :\
57 $(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-types.py
58 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py $(gen-out-type) -o tests -p "test-" < $<, " GEN $@")
59 tests/test-qapi-visit.c tests/test-qapi-visit.h :\
60 $(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-visit.py
61 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py $(gen-out-type) -o tests -p "test-" < $<, " GEN $@")
62 tests/test-qmp-commands.h tests/test-qmp-marshal.c :\
63 $(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-commands.py
64 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py $(gen-out-type) -o tests -p "test-" < $<, " GEN $@")
65
66
67 tests/test-string-output-visitor$(EXESUF): tests/test-string-output-visitor.o $(test-qapi-obj-y)
68 tests/test-string-input-visitor$(EXESUF): tests/test-string-input-visitor.o $(test-qapi-obj-y)
69 tests/test-qmp-output-visitor$(EXESUF): tests/test-qmp-output-visitor.o $(test-qapi-obj-y)
70 tests/test-qmp-input-visitor$(EXESUF): tests/test-qmp-input-visitor.o $(test-qapi-obj-y)
71 tests/test-qmp-input-strict$(EXESUF): tests/test-qmp-input-strict.o $(test-qapi-obj-y)
72 tests/test-qmp-commands$(EXESUF): tests/test-qmp-commands.o tests/test-qmp-marshal.o $(test-qapi-obj-y)
73 tests/test-visitor-serialization$(EXESUF): tests/test-visitor-serialization.o $(test-qapi-obj-y)
74
75 tests/rtc-test$(EXESUF): tests/rtc-test.o $(trace-obj-y)
76 tests/m48t59-test$(EXESUF): tests/m48t59-test.o $(trace-obj-y)
77 tests/fdc-test$(EXESUF): tests/fdc-test.o tests/libqtest.o $(trace-obj-y)
78 tests/hd-geo-test$(EXESUF): tests/hd-geo-test.o tests/libqtest.o $(trace-obj-y)
79
80 # QTest rules
81
82 TARGETS=$(patsubst %-softmmu,%, $(filter %-softmmu,$(TARGET_DIRS)))
83 QTEST_TARGETS=$(foreach TARGET,$(TARGETS), $(if $(check-qtest-$(TARGET)-y), $(TARGET),))
84 check-qtest-$(CONFIG_POSIX)=$(foreach TARGET,$(TARGETS), $(check-qtest-$(TARGET)-y))
85
86 qtest-obj-y = tests/libqtest.o $(oslib-obj-y) libqemustub.a
87 $(check-qtest-y): $(qtest-obj-y)
88
89 .PHONY: check-help
90 check-help:
91 @echo "Regression testing targets:"
92 @echo
93 @echo " make check Run all tests"
94 @echo " make check-qtest-TARGET Run qtest tests for given target"
95 @echo " make check-qtest Run qtest tests"
96 @echo " make check-unit Run qobject tests"
97 @echo " make check-block Run block tests"
98 @echo " make check-report.html Generates an HTML test report"
99 @echo
100 @echo "Please note that HTML reports do not regenerate if the unit tests"
101 @echo "has not changed."
102 @echo
103 @echo "The variable SPEED can be set to control the gtester speed setting."
104 @echo "Default options are -k and (for make V=1) --verbose; they can be"
105 @echo "changed with variable GTESTER_OPTIONS."
106
107 SPEED = quick
108 GTESTER_OPTIONS = -k $(if $(V),--verbose,-q)
109
110 # gtester tests, possibly with verbose output
111
112 .PHONY: $(patsubst %, check-qtest-%, $(QTEST_TARGETS))
113 $(patsubst %, check-qtest-%, $(QTEST_TARGETS)): check-qtest-%: $(check-qtest-y)
114 $(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
115 gtester $(GTESTER_OPTIONS) -m=$(SPEED) $(check-qtest-$*-y),"GTESTER $@")
116
117 .PHONY: $(patsubst %, check-%, $(check-unit-y))
118 $(patsubst %, check-%, $(check-unit-y)): check-%: %
119 $(call quiet-command,gtester $(GTESTER_OPTIONS) -m=$(SPEED) $*,"GTESTER $*")
120
121 # gtester tests with XML output
122
123 $(patsubst %, check-report-qtest-%.xml, $(QTEST_TARGETS)): check-report-qtest-%.xml: $(check-qtest-y)
124 $(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
125 gtester -q $(GTESTER_OPTIONS) -o $@ -m=$(SPEED) $(check-qtest-$*-y),"GTESTER $@")
126
127 check-report-unit.xml: $(check-unit-y)
128 $(call quiet-command,gtester -q $(GTESTER_OPTIONS) -o $@ -m=$(SPEED) $^, "GTESTER $@")
129
130 # Reports and overall runs
131
132 check-report.xml: $(patsubst %,check-report-qtest-%.xml, $(QTEST_TARGETS)) check-report-unit.xml
133 $(call quiet-command,$(SRC_PATH)/scripts/gtester-cat $^ > $@, " GEN $@")
134
135 check-report.html: check-report.xml
136 $(call quiet-command,gtester-report $< > $@, " GEN $@")
137
138
139 # Other tests
140
141 .PHONY: check-tests/qemu-iotests-quick.sh
142 check-tests/qemu-iotests-quick.sh: tests/qemu-iotests-quick.sh qemu-img$(EXESUF) qemu-io$(EXESUF)
143 $<
144
145 # Consolidated targets
146
147 .PHONY: check-qtest check-unit check
148 check-qtest: $(patsubst %,check-qtest-%, $(QTEST_TARGETS))
149 check-unit: $(patsubst %,check-%, $(check-unit-y))
150 check-block: $(patsubst %,check-%, $(check-block-y))
151 check: check-unit check-qtest
152
153 -include $(wildcard tests/*.d)