Statistics
| Branch: | Revision:

root / tests / Makefile @ 8a090705

History | View | Annotate | Download (8.9 kB)

1 8959449b Kevin Wolf
export SRC_PATH
2 8959449b Kevin Wolf
3 b93b63f5 Paolo Bonzini
check-unit-y = tests/check-qdict$(EXESUF)
4 1d728c39 Blue Swirl
gcov-files-check-qdict-y = qdict.c
5 b93b63f5 Paolo Bonzini
check-unit-y += tests/check-qfloat$(EXESUF)
6 1d728c39 Blue Swirl
gcov-files-check-qfloat-y = qfloat.c
7 b93b63f5 Paolo Bonzini
check-unit-y += tests/check-qint$(EXESUF)
8 1d728c39 Blue Swirl
gcov-files-check-qint-y = qint.c
9 b93b63f5 Paolo Bonzini
check-unit-y += tests/check-qstring$(EXESUF)
10 1d728c39 Blue Swirl
gcov-files-check-qstring-y = qstring.c
11 b93b63f5 Paolo Bonzini
check-unit-y += tests/check-qlist$(EXESUF)
12 1d728c39 Blue Swirl
gcov-files-check-qlist-y = qlist.c
13 b93b63f5 Paolo Bonzini
check-unit-y += tests/check-qjson$(EXESUF)
14 1d728c39 Blue Swirl
gcov-files-check-qjson-y = qjson.c
15 b93b63f5 Paolo Bonzini
check-unit-y += tests/test-qmp-output-visitor$(EXESUF)
16 1d728c39 Blue Swirl
gcov-files-test-qmp-output-visitor-y = qapi/qmp-output-visitor.c
17 b93b63f5 Paolo Bonzini
check-unit-y += tests/test-qmp-input-visitor$(EXESUF)
18 1d728c39 Blue Swirl
gcov-files-test-qmp-input-visitor-y = qapi/qmp-input-visitor.c
19 b93b63f5 Paolo Bonzini
check-unit-y += tests/test-qmp-input-strict$(EXESUF)
20 b93b63f5 Paolo Bonzini
check-unit-y += tests/test-qmp-commands$(EXESUF)
21 1d728c39 Blue Swirl
gcov-files-test-qmp-commands-y = qapi/qmp-dispatch.c
22 b93b63f5 Paolo Bonzini
check-unit-y += tests/test-string-input-visitor$(EXESUF)
23 1d728c39 Blue Swirl
gcov-files-test-string-input-visitor-y = qapi/string-input-visitor.c
24 b93b63f5 Paolo Bonzini
check-unit-y += tests/test-string-output-visitor$(EXESUF)
25 1d728c39 Blue Swirl
gcov-files-test-string-output-visitor-y = qapi/string-output-visitor.c
26 b93b63f5 Paolo Bonzini
check-unit-y += tests/test-coroutine$(EXESUF)
27 1d728c39 Blue Swirl
ifeq ($(CONFIG_WIN32),y)
28 1d728c39 Blue Swirl
gcov-files-test-coroutine-y = coroutine-win32.c
29 1d728c39 Blue Swirl
else
30 1d728c39 Blue Swirl
ifeq ($(CONFIG_UCONTEXT_COROUTINE),y)
31 1d728c39 Blue Swirl
gcov-files-test-coroutine-y = coroutine-ucontext.c
32 1d728c39 Blue Swirl
else
33 1d728c39 Blue Swirl
ifeq ($(CONFIG_SIGALTSTACK_COROUTINE),y)
34 1d728c39 Blue Swirl
gcov-files-test-coroutine-y = coroutine-sigaltstack.c
35 1d728c39 Blue Swirl
else
36 1d728c39 Blue Swirl
gcov-files-test-coroutine-y = coroutine-gthread.c
37 1d728c39 Blue Swirl
endif
38 1d728c39 Blue Swirl
endif
39 1d728c39 Blue Swirl
endif
40 2d496105 Michael Roth
check-unit-y += tests/test-visitor-serialization$(EXESUF)
41 2278a69e Michael Tokarev
check-unit-y += tests/test-iov$(EXESUF)
42 1d728c39 Blue Swirl
gcov-files-test-iov-y = iov.c
43 b2ea25d7 Paolo Bonzini
check-unit-y += tests/test-aio$(EXESUF)
44 1d728c39 Blue Swirl
gcov-files-test-aio-$(CONFIG_WIN32) = aio-win32.c
45 1d728c39 Blue Swirl
gcov-files-test-aio-$(CONFIG_POSIX) = aio-posix.c
46 74c856e9 Paolo Bonzini
check-unit-y += tests/test-thread-pool$(EXESUF)
47 1d728c39 Blue Swirl
gcov-files-test-thread-pool-y = thread-pool.c
48 b93b63f5 Paolo Bonzini
49 b93b63f5 Paolo Bonzini
check-block-$(CONFIG_POSIX) += tests/qemu-iotests-quick.sh
50 b93b63f5 Paolo Bonzini
51 d1aaf543 Anthony Liguori
# All QTests for now are POSIX-only, but the dependencies are
52 d1aaf543 Anthony Liguori
# really in libqtest, not in the testcases themselves.
53 6c806637 Kevin Wolf
check-qtest-i386-y = tests/fdc-test$(EXESUF)
54 1d728c39 Blue Swirl
gcov-files-i386-y = hw/fdc.c
55 0e8a8c8f Markus Armbruster
check-qtest-i386-y += tests/hd-geo-test$(EXESUF)
56 1d728c39 Blue Swirl
gcov-files-i386-y += hw/hd-geometry.c
57 fba0c40b Stefan Weil
check-qtest-i386-y += tests/rtc-test$(EXESUF)
58 d1aaf543 Anthony Liguori
check-qtest-x86_64-y = $(check-qtest-i386-y)
59 1d728c39 Blue Swirl
gcov-files-i386-y += i386-softmmu/hw/mc146818rtc.c
60 f91837a7 Blue Swirl
check-qtest-sparc-y = tests/m48t59-test$(EXESUF)
61 f91837a7 Blue Swirl
check-qtest-sparc64-y = tests/m48t59-test$(EXESUF)
62 1d728c39 Blue Swirl
gcov-files-sparc-y += hw/m48t59.c
63 d1aaf543 Anthony Liguori
64 b93b63f5 Paolo Bonzini
GENERATED_HEADERS += tests/test-qapi-types.h tests/test-qapi-visit.h tests/test-qmp-commands.h
65 b93b63f5 Paolo Bonzini
66 b93b63f5 Paolo Bonzini
test-obj-y = tests/check-qint.o tests/check-qstring.o tests/check-qdict.o \
67 b93b63f5 Paolo Bonzini
	tests/check-qlist.o tests/check-qfloat.o tests/check-qjson.o \
68 b93b63f5 Paolo Bonzini
	tests/test-coroutine.o tests/test-string-output-visitor.o \
69 b93b63f5 Paolo Bonzini
	tests/test-string-input-visitor.o tests/test-qmp-output-visitor.o \
70 b93b63f5 Paolo Bonzini
	tests/test-qmp-input-visitor.o tests/test-qmp-input-strict.o \
71 2d496105 Michael Roth
	tests/test-qmp-commands.o tests/test-visitor-serialization.o
72 b93b63f5 Paolo Bonzini
73 5708fc66 Paolo Bonzini
test-qapi-obj-y =  $(qobject-obj-y) $(qapi-obj-y)
74 b93b63f5 Paolo Bonzini
test-qapi-obj-y += tests/test-qapi-visit.o tests/test-qapi-types.o
75 b93b63f5 Paolo Bonzini
76 b93b63f5 Paolo Bonzini
$(test-obj-y): QEMU_INCLUDES += -Itests
77 b93b63f5 Paolo Bonzini
78 0ef3dd6c Paolo Bonzini
tests/check-qint$(EXESUF): tests/check-qint.o qint.o
79 0ef3dd6c Paolo Bonzini
tests/check-qstring$(EXESUF): tests/check-qstring.o qstring.o
80 0ef3dd6c Paolo Bonzini
tests/check-qdict$(EXESUF): tests/check-qdict.o qdict.o qfloat.o qint.o qstring.o qbool.o qlist.o
81 0ef3dd6c Paolo Bonzini
tests/check-qlist$(EXESUF): tests/check-qlist.o qlist.o qint.o
82 0ef3dd6c Paolo Bonzini
tests/check-qfloat$(EXESUF): tests/check-qfloat.o qfloat.o
83 5708fc66 Paolo Bonzini
tests/check-qjson$(EXESUF): tests/check-qjson.o $(qobject-obj-y) libqemustub.a
84 2b84c2be Paolo Bonzini
tests/test-coroutine$(EXESUF): tests/test-coroutine.o $(coroutine-obj-y) $(tools-obj-y) $(block-obj-y) iov.o libqemustub.a
85 b2ea25d7 Paolo Bonzini
tests/test-aio$(EXESUF): tests/test-aio.o $(coroutine-obj-y) $(tools-obj-y) $(block-obj-y) libqemustub.a
86 74c856e9 Paolo Bonzini
tests/test-thread-pool$(EXESUF): tests/test-thread-pool.o $(coroutine-obj-y) $(tools-obj-y) $(block-obj-y) libqemustub.a
87 2278a69e Michael Tokarev
tests/test-iov$(EXESUF): tests/test-iov.o iov.o
88 b93b63f5 Paolo Bonzini
89 b93b63f5 Paolo Bonzini
tests/test-qapi-types.c tests/test-qapi-types.h :\
90 dbfe06c6 Anthony Liguori
$(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-types.py
91 b93b63f5 Paolo Bonzini
	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py $(gen-out-type) -o tests -p "test-" < $<, "  GEN   $@")
92 b93b63f5 Paolo Bonzini
tests/test-qapi-visit.c tests/test-qapi-visit.h :\
93 dbfe06c6 Anthony Liguori
$(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-visit.py
94 b93b63f5 Paolo Bonzini
	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py $(gen-out-type) -o tests -p "test-" < $<, "  GEN   $@")
95 b93b63f5 Paolo Bonzini
tests/test-qmp-commands.h tests/test-qmp-marshal.c :\
96 dbfe06c6 Anthony Liguori
$(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-commands.py
97 b93b63f5 Paolo Bonzini
	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py $(gen-out-type) -o tests -p "test-" < $<, "  GEN   $@")
98 dbfe06c6 Anthony Liguori
99 dbfe06c6 Anthony Liguori
100 8a090705 Paolo Bonzini
tests/test-string-output-visitor$(EXESUF): tests/test-string-output-visitor.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
101 8a090705 Paolo Bonzini
tests/test-string-input-visitor$(EXESUF): tests/test-string-input-visitor.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
102 8a090705 Paolo Bonzini
tests/test-qmp-output-visitor$(EXESUF): tests/test-qmp-output-visitor.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
103 8a090705 Paolo Bonzini
tests/test-qmp-input-visitor$(EXESUF): tests/test-qmp-input-visitor.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
104 8a090705 Paolo Bonzini
tests/test-qmp-input-strict$(EXESUF): tests/test-qmp-input-strict.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
105 8a090705 Paolo Bonzini
tests/test-qmp-commands$(EXESUF): tests/test-qmp-commands.o tests/test-qmp-marshal.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
106 8a090705 Paolo Bonzini
tests/test-visitor-serialization$(EXESUF): tests/test-visitor-serialization.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
107 2d7799f2 Paolo Bonzini
108 d2a16f74 Blue Swirl
tests/rtc-test$(EXESUF): tests/rtc-test.o $(trace-obj-y)
109 f91837a7 Blue Swirl
tests/m48t59-test$(EXESUF): tests/m48t59-test.o $(trace-obj-y)
110 fd4567d9 Stefan Weil
tests/fdc-test$(EXESUF): tests/fdc-test.o tests/libqtest.o $(trace-obj-y)
111 0e8a8c8f Markus Armbruster
tests/hd-geo-test$(EXESUF): tests/hd-geo-test.o tests/libqtest.o $(trace-obj-y)
112 d2a16f74 Blue Swirl
113 49ee3590 Anthony Liguori
# QTest rules
114 49ee3590 Anthony Liguori
115 49ee3590 Anthony Liguori
TARGETS=$(patsubst %-softmmu,%, $(filter %-softmmu,$(TARGET_DIRS)))
116 49ee3590 Anthony Liguori
QTEST_TARGETS=$(foreach TARGET,$(TARGETS), $(if $(check-qtest-$(TARGET)-y), $(TARGET),))
117 49ee3590 Anthony Liguori
check-qtest-$(CONFIG_POSIX)=$(foreach TARGET,$(TARGETS), $(check-qtest-$(TARGET)-y))
118 49ee3590 Anthony Liguori
119 8a090705 Paolo Bonzini
qtest-obj-y = tests/libqtest.o libqemuutil.a libqemustub.a
120 49ee3590 Anthony Liguori
$(check-qtest-y): $(qtest-obj-y)
121 49ee3590 Anthony Liguori
122 b93b63f5 Paolo Bonzini
.PHONY: check-help
123 b93b63f5 Paolo Bonzini
check-help:
124 b93b63f5 Paolo Bonzini
	@echo "Regression testing targets:"
125 b93b63f5 Paolo Bonzini
	@echo
126 b93b63f5 Paolo Bonzini
	@echo " make check                Run all tests"
127 49ee3590 Anthony Liguori
	@echo " make check-qtest-TARGET   Run qtest tests for given target"
128 49ee3590 Anthony Liguori
	@echo " make check-qtest          Run qtest tests"
129 b93b63f5 Paolo Bonzini
	@echo " make check-unit           Run qobject tests"
130 b93b63f5 Paolo Bonzini
	@echo " make check-block          Run block tests"
131 b93b63f5 Paolo Bonzini
	@echo " make check-report.html    Generates an HTML test report"
132 b93b63f5 Paolo Bonzini
	@echo
133 b93b63f5 Paolo Bonzini
	@echo "Please note that HTML reports do not regenerate if the unit tests"
134 b93b63f5 Paolo Bonzini
	@echo "has not changed."
135 b93b63f5 Paolo Bonzini
	@echo
136 b93b63f5 Paolo Bonzini
	@echo "The variable SPEED can be set to control the gtester speed setting."
137 b93b63f5 Paolo Bonzini
	@echo "Default options are -k and (for make V=1) --verbose; they can be"
138 b93b63f5 Paolo Bonzini
	@echo "changed with variable GTESTER_OPTIONS."
139 2d7799f2 Paolo Bonzini
140 b93b63f5 Paolo Bonzini
SPEED = quick
141 b93b63f5 Paolo Bonzini
GTESTER_OPTIONS = -k $(if $(V),--verbose,-q)
142 1d728c39 Blue Swirl
GCOV_OPTIONS = -n $(if $(V),-f,)
143 dbfe06c6 Anthony Liguori
144 b93b63f5 Paolo Bonzini
# gtester tests, possibly with verbose output
145 dbfe06c6 Anthony Liguori
146 49ee3590 Anthony Liguori
.PHONY: $(patsubst %, check-qtest-%, $(QTEST_TARGETS))
147 49ee3590 Anthony Liguori
$(patsubst %, check-qtest-%, $(QTEST_TARGETS)): check-qtest-%: $(check-qtest-y)
148 1d728c39 Blue Swirl
	$(if $(CONFIG_GCOV),@rm -f *.gcda */*.gcda */*/*.gcda */*/*/*.gcda,)
149 49ee3590 Anthony Liguori
	$(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
150 49ee3590 Anthony Liguori
		gtester $(GTESTER_OPTIONS) -m=$(SPEED) $(check-qtest-$*-y),"GTESTER $@")
151 1d728c39 Blue Swirl
	$(if $(CONFIG_GCOV),@for f in $(gcov-files-$*-y); do \
152 1d728c39 Blue Swirl
	  echo Gcov report for $$f:;\
153 1d728c39 Blue Swirl
	  $(GCOV) $(GCOV_OPTIONS) $$f -o `dirname $$f`; \
154 1d728c39 Blue Swirl
	done,)
155 49ee3590 Anthony Liguori
156 b93b63f5 Paolo Bonzini
.PHONY: $(patsubst %, check-%, $(check-unit-y))
157 b93b63f5 Paolo Bonzini
$(patsubst %, check-%, $(check-unit-y)): check-%: %
158 1d728c39 Blue Swirl
	$(if $(CONFIG_GCOV),@rm -f *.gcda */*.gcda */*/*.gcda */*/*/*.gcda,)
159 b93b63f5 Paolo Bonzini
	$(call quiet-command,gtester $(GTESTER_OPTIONS) -m=$(SPEED) $*,"GTESTER $*")
160 1d728c39 Blue Swirl
	$(if $(CONFIG_GCOV),@for f in $(gcov-files-$(subst tests/,,$*)-y); do \
161 1d728c39 Blue Swirl
	  echo Gcov report for $$f:;\
162 1d728c39 Blue Swirl
	  $(GCOV) $(GCOV_OPTIONS) $$f -o `dirname $$f`; \
163 1d728c39 Blue Swirl
	done,)
164 dbfe06c6 Anthony Liguori
165 b93b63f5 Paolo Bonzini
# gtester tests with XML output
166 8959449b Kevin Wolf
167 49ee3590 Anthony Liguori
$(patsubst %, check-report-qtest-%.xml, $(QTEST_TARGETS)): check-report-qtest-%.xml: $(check-qtest-y)
168 49ee3590 Anthony Liguori
	$(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
169 49ee3590 Anthony Liguori
	  gtester -q $(GTESTER_OPTIONS) -o $@ -m=$(SPEED) $(check-qtest-$*-y),"GTESTER $@")
170 49ee3590 Anthony Liguori
171 b93b63f5 Paolo Bonzini
check-report-unit.xml: $(check-unit-y)
172 b93b63f5 Paolo Bonzini
	$(call quiet-command,gtester -q $(GTESTER_OPTIONS) -o $@ -m=$(SPEED) $^, "GTESTER $@")
173 b8c6f29e Kevin Wolf
174 b93b63f5 Paolo Bonzini
# Reports and overall runs
175 b8c6f29e Kevin Wolf
176 49ee3590 Anthony Liguori
check-report.xml: $(patsubst %,check-report-qtest-%.xml, $(QTEST_TARGETS)) check-report-unit.xml
177 b93b63f5 Paolo Bonzini
	$(call quiet-command,$(SRC_PATH)/scripts/gtester-cat $^ > $@, "  GEN    $@")
178 b8c6f29e Kevin Wolf
179 b93b63f5 Paolo Bonzini
check-report.html: check-report.xml
180 b93b63f5 Paolo Bonzini
	$(call quiet-command,gtester-report $< > $@, "  GEN    $@")
181 b93b63f5 Paolo Bonzini
182 b93b63f5 Paolo Bonzini
183 b93b63f5 Paolo Bonzini
# Other tests
184 b93b63f5 Paolo Bonzini
185 b93b63f5 Paolo Bonzini
.PHONY: check-tests/qemu-iotests-quick.sh
186 b93b63f5 Paolo Bonzini
check-tests/qemu-iotests-quick.sh: tests/qemu-iotests-quick.sh qemu-img$(EXESUF) qemu-io$(EXESUF)
187 b93b63f5 Paolo Bonzini
	$<
188 b93b63f5 Paolo Bonzini
189 b93b63f5 Paolo Bonzini
# Consolidated targets
190 b93b63f5 Paolo Bonzini
191 49ee3590 Anthony Liguori
.PHONY: check-qtest check-unit check
192 49ee3590 Anthony Liguori
check-qtest: $(patsubst %,check-qtest-%, $(QTEST_TARGETS))
193 b93b63f5 Paolo Bonzini
check-unit: $(patsubst %,check-%, $(check-unit-y))
194 b93b63f5 Paolo Bonzini
check-block: $(patsubst %,check-%, $(check-block-y))
195 49ee3590 Anthony Liguori
check: check-unit check-qtest
196 14117c7b Eduardo Habkost
197 14117c7b Eduardo Habkost
-include $(wildcard tests/*.d)