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