]> git.proxmox.com Git - qemu.git/blame - tests/Makefile
rtc: split out macros into a header file and use in test case
[qemu.git] / tests / Makefile
CommitLineData
8959449b
KW
1export SRC_PATH
2
b93b63f5
PB
3check-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)
16
17check-block-$(CONFIG_POSIX) += tests/qemu-iotests-quick.sh
18
19GENERATED_HEADERS += tests/test-qapi-types.h tests/test-qapi-visit.h tests/test-qmp-commands.h
20
21test-obj-y = tests/check-qint.o tests/check-qstring.o tests/check-qdict.o \
22 tests/check-qlist.o tests/check-qfloat.o tests/check-qjson.o \
23 tests/test-coroutine.o tests/test-string-output-visitor.o \
24 tests/test-string-input-visitor.o tests/test-qmp-output-visitor.o \
25 tests/test-qmp-input-visitor.o tests/test-qmp-input-strict.o \
26 tests/test-qmp-commands.o
27
28test-qapi-obj-y = $(qobject-obj-y) $(qapi-obj-y) $(tools-obj-y)
29test-qapi-obj-y += tests/test-qapi-visit.o tests/test-qapi-types.o
30test-qapi-obj-y += module.o
31
32$(test-obj-y): $(GENERATED_HEADERS)
33$(test-obj-y): QEMU_INCLUDES += -Itests
34
35tests/check-qint$(EXESUF): tests/check-qint.o qint.o $(tools-obj-y)
36tests/check-qstring$(EXESUF): tests/check-qstring.o qstring.o $(tools-obj-y)
37tests/check-qdict$(EXESUF): tests/check-qdict.o qdict.o qfloat.o qint.o qstring.o qbool.o qlist.o $(tools-obj-y)
38tests/check-qlist$(EXESUF): tests/check-qlist.o qlist.o qint.o $(tools-obj-y)
39tests/check-qfloat$(EXESUF): tests/check-qfloat.o qfloat.o $(tools-obj-y)
40tests/check-qjson$(EXESUF): tests/check-qjson.o $(qobject-obj-y) $(tools-obj-y)
41tests/test-coroutine$(EXESUF): tests/test-coroutine.o $(coroutine-obj-y) $(tools-obj-y)
42
43tests/test-qapi-types.c tests/test-qapi-types.h :\
dbfe06c6 44$(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-types.py
b93b63f5
PB
45 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py $(gen-out-type) -o tests -p "test-" < $<, " GEN $@")
46tests/test-qapi-visit.c tests/test-qapi-visit.h :\
dbfe06c6 47$(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-visit.py
b93b63f5
PB
48 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py $(gen-out-type) -o tests -p "test-" < $<, " GEN $@")
49tests/test-qmp-commands.h tests/test-qmp-marshal.c :\
dbfe06c6 50$(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-commands.py
b93b63f5 51 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py $(gen-out-type) -o tests -p "test-" < $<, " GEN $@")
dbfe06c6
AL
52
53
b93b63f5
PB
54tests/test-string-output-visitor$(EXESUF): tests/test-string-output-visitor.o $(test-qapi-obj-y)
55tests/test-string-input-visitor$(EXESUF): tests/test-string-input-visitor.o $(test-qapi-obj-y)
56tests/test-qmp-output-visitor$(EXESUF): tests/test-qmp-output-visitor.o $(test-qapi-obj-y)
57tests/test-qmp-input-visitor$(EXESUF): tests/test-qmp-input-visitor.o $(test-qapi-obj-y)
58tests/test-qmp-input-strict$(EXESUF): tests/test-qmp-input-strict.o $(test-qapi-obj-y)
59tests/test-qmp-commands$(EXESUF): tests/test-qmp-commands.o tests/test-qmp-marshal.o $(test-qapi-obj-y)
2d7799f2 60
49ee3590
AL
61# QTest rules
62
63TARGETS=$(patsubst %-softmmu,%, $(filter %-softmmu,$(TARGET_DIRS)))
64QTEST_TARGETS=$(foreach TARGET,$(TARGETS), $(if $(check-qtest-$(TARGET)-y), $(TARGET),))
65check-qtest-$(CONFIG_POSIX)=$(foreach TARGET,$(TARGETS), $(check-qtest-$(TARGET)-y))
66
67qtest-obj-y = tests/libqtest.o $(oslib-obj-y)
68$(check-qtest-y): $(qtest-obj-y)
69
b93b63f5
PB
70.PHONY: check-help
71check-help:
72 @echo "Regression testing targets:"
73 @echo
74 @echo " make check Run all tests"
49ee3590
AL
75 @echo " make check-qtest-TARGET Run qtest tests for given target"
76 @echo " make check-qtest Run qtest tests"
b93b63f5
PB
77 @echo " make check-unit Run qobject tests"
78 @echo " make check-block Run block tests"
79 @echo " make check-report.html Generates an HTML test report"
80 @echo
81 @echo "Please note that HTML reports do not regenerate if the unit tests"
82 @echo "has not changed."
83 @echo
84 @echo "The variable SPEED can be set to control the gtester speed setting."
85 @echo "Default options are -k and (for make V=1) --verbose; they can be"
86 @echo "changed with variable GTESTER_OPTIONS."
2d7799f2 87
b93b63f5 88.SECONDARY:
e38ac962 89
b93b63f5
PB
90SPEED = quick
91GTESTER_OPTIONS = -k $(if $(V),--verbose,-q)
dbfe06c6 92
b93b63f5 93# gtester tests, possibly with verbose output
dbfe06c6 94
49ee3590
AL
95.PHONY: $(patsubst %, check-qtest-%, $(QTEST_TARGETS))
96$(patsubst %, check-qtest-%, $(QTEST_TARGETS)): check-qtest-%: $(check-qtest-y)
97 $(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
98 gtester $(GTESTER_OPTIONS) -m=$(SPEED) $(check-qtest-$*-y),"GTESTER $@")
99
b93b63f5
PB
100.PHONY: $(patsubst %, check-%, $(check-unit-y))
101$(patsubst %, check-%, $(check-unit-y)): check-%: %
102 $(call quiet-command,gtester $(GTESTER_OPTIONS) -m=$(SPEED) $*,"GTESTER $*")
dbfe06c6 103
b93b63f5 104# gtester tests with XML output
8959449b 105
49ee3590
AL
106$(patsubst %, check-report-qtest-%.xml, $(QTEST_TARGETS)): check-report-qtest-%.xml: $(check-qtest-y)
107 $(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
108 gtester -q $(GTESTER_OPTIONS) -o $@ -m=$(SPEED) $(check-qtest-$*-y),"GTESTER $@")
109
b93b63f5
PB
110check-report-unit.xml: $(check-unit-y)
111 $(call quiet-command,gtester -q $(GTESTER_OPTIONS) -o $@ -m=$(SPEED) $^, "GTESTER $@")
b8c6f29e 112
b93b63f5 113# Reports and overall runs
b8c6f29e 114
49ee3590 115check-report.xml: $(patsubst %,check-report-qtest-%.xml, $(QTEST_TARGETS)) check-report-unit.xml
b93b63f5 116 $(call quiet-command,$(SRC_PATH)/scripts/gtester-cat $^ > $@, " GEN $@")
b8c6f29e 117
b93b63f5
PB
118check-report.html: check-report.xml
119 $(call quiet-command,gtester-report $< > $@, " GEN $@")
120
121
122# Other tests
123
124.PHONY: check-tests/qemu-iotests-quick.sh
125check-tests/qemu-iotests-quick.sh: tests/qemu-iotests-quick.sh qemu-img$(EXESUF) qemu-io$(EXESUF)
126 $<
127
128# Consolidated targets
129
49ee3590
AL
130.PHONY: check-qtest check-unit check
131check-qtest: $(patsubst %,check-qtest-%, $(QTEST_TARGETS))
b93b63f5
PB
132check-unit: $(patsubst %,check-%, $(check-unit-y))
133check-block: $(patsubst %,check-%, $(check-block-y))
49ee3590 134check: check-unit check-qtest