Kevin Wolf | 8959449 | 2012-03-08 12:29:00 +0100 | [diff] [blame] | 1 | export SRC_PATH |
| 2 | |
Paolo Bonzini | b93b63f | 2012-03-28 15:42:01 +0200 | [diff] [blame] | 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) |
Michael Roth | 2d49610 | 2012-02-21 21:05:07 -0600 | [diff] [blame] | 16 | check-unit-y += tests/test-visitor-serialization$(EXESUF) |
Anthony Liguori | ad65aa8 | 2012-01-10 13:10:51 -0600 | [diff] [blame] | 17 | |
Paolo Bonzini | b93b63f | 2012-03-28 15:42:01 +0200 | [diff] [blame] | 18 | check-block-$(CONFIG_POSIX) += tests/qemu-iotests-quick.sh |
Anthony Liguori | dbfe06c | 2012-01-10 13:10:43 -0600 | [diff] [blame] | 19 | |
Anthony Liguori | d1aaf54 | 2012-03-28 15:42:07 +0200 | [diff] [blame] | 20 | # All QTests for now are POSIX-only, but the dependencies are |
| 21 | # really in libqtest, not in the testcases themselves. |
Kevin Wolf | 6c80663 | 2012-05-10 09:46:18 +0200 | [diff] [blame] | 22 | check-qtest-i386-y = tests/fdc-test$(EXESUF) |
Stefan Weil | fba0c40 | 2012-05-15 18:19:45 +0200 | [diff] [blame] | 23 | check-qtest-i386-y += tests/rtc-test$(EXESUF) |
Anthony Liguori | d1aaf54 | 2012-03-28 15:42:07 +0200 | [diff] [blame] | 24 | check-qtest-x86_64-y = $(check-qtest-i386-y) |
Blue Swirl | f91837a | 2012-04-15 11:45:18 +0000 | [diff] [blame] | 25 | check-qtest-sparc-y = tests/m48t59-test$(EXESUF) |
| 26 | check-qtest-sparc64-y = tests/m48t59-test$(EXESUF) |
Anthony Liguori | d1aaf54 | 2012-03-28 15:42:07 +0200 | [diff] [blame] | 27 | |
Paolo Bonzini | b93b63f | 2012-03-28 15:42:01 +0200 | [diff] [blame] | 28 | GENERATED_HEADERS += tests/test-qapi-types.h tests/test-qapi-visit.h tests/test-qmp-commands.h |
Anthony Liguori | dbfe06c | 2012-01-10 13:10:43 -0600 | [diff] [blame] | 29 | |
Paolo Bonzini | b93b63f | 2012-03-28 15:42:01 +0200 | [diff] [blame] | 30 | test-obj-y = tests/check-qint.o tests/check-qstring.o tests/check-qdict.o \ |
| 31 | tests/check-qlist.o tests/check-qfloat.o tests/check-qjson.o \ |
| 32 | tests/test-coroutine.o tests/test-string-output-visitor.o \ |
| 33 | tests/test-string-input-visitor.o tests/test-qmp-output-visitor.o \ |
| 34 | tests/test-qmp-input-visitor.o tests/test-qmp-input-strict.o \ |
Michael Roth | 2d49610 | 2012-02-21 21:05:07 -0600 | [diff] [blame] | 35 | tests/test-qmp-commands.o tests/test-visitor-serialization.o |
Anthony Liguori | dbfe06c | 2012-01-10 13:10:43 -0600 | [diff] [blame] | 36 | |
Paolo Bonzini | b93b63f | 2012-03-28 15:42:01 +0200 | [diff] [blame] | 37 | test-qapi-obj-y = $(qobject-obj-y) $(qapi-obj-y) $(tools-obj-y) |
| 38 | test-qapi-obj-y += tests/test-qapi-visit.o tests/test-qapi-types.o |
| 39 | test-qapi-obj-y += module.o |
| 40 | |
Paolo Bonzini | b93b63f | 2012-03-28 15:42:01 +0200 | [diff] [blame] | 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 :\ |
Anthony Liguori | dbfe06c | 2012-01-10 13:10:43 -0600 | [diff] [blame] | 52 | $(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-types.py |
Paolo Bonzini | b93b63f | 2012-03-28 15:42:01 +0200 | [diff] [blame] | 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 :\ |
Anthony Liguori | dbfe06c | 2012-01-10 13:10:43 -0600 | [diff] [blame] | 55 | $(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-visit.py |
Paolo Bonzini | b93b63f | 2012-03-28 15:42:01 +0200 | [diff] [blame] | 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 :\ |
Anthony Liguori | dbfe06c | 2012-01-10 13:10:43 -0600 | [diff] [blame] | 58 | $(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-commands.py |
Paolo Bonzini | b93b63f | 2012-03-28 15:42:01 +0200 | [diff] [blame] | 59 | $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py $(gen-out-type) -o tests -p "test-" < $<, " GEN $@") |
Anthony Liguori | dbfe06c | 2012-01-10 13:10:43 -0600 | [diff] [blame] | 60 | |
| 61 | |
Paolo Bonzini | b93b63f | 2012-03-28 15:42:01 +0200 | [diff] [blame] | 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) |
Michael Roth | 2d49610 | 2012-02-21 21:05:07 -0600 | [diff] [blame] | 68 | tests/test-visitor-serialization$(EXESUF): tests/test-visitor-serialization.o $(test-qapi-obj-y) |
Paolo Bonzini | 2d7799f | 2012-02-09 11:21:03 +0100 | [diff] [blame] | 69 | |
Blue Swirl | d2a16f7 | 2012-03-30 17:39:33 +0000 | [diff] [blame] | 70 | tests/rtc-test$(EXESUF): tests/rtc-test.o $(trace-obj-y) |
Blue Swirl | f91837a | 2012-04-15 11:45:18 +0000 | [diff] [blame] | 71 | tests/m48t59-test$(EXESUF): tests/m48t59-test.o $(trace-obj-y) |
Stefan Weil | fd4567d | 2012-05-15 07:27:19 +0200 | [diff] [blame] | 72 | tests/fdc-test$(EXESUF): tests/fdc-test.o tests/libqtest.o $(trace-obj-y) |
Blue Swirl | d2a16f7 | 2012-03-30 17:39:33 +0000 | [diff] [blame] | 73 | |
Anthony Liguori | 49ee359 | 2012-03-28 15:42:05 +0200 | [diff] [blame] | 74 | # QTest rules |
| 75 | |
| 76 | TARGETS=$(patsubst %-softmmu,%, $(filter %-softmmu,$(TARGET_DIRS))) |
| 77 | QTEST_TARGETS=$(foreach TARGET,$(TARGETS), $(if $(check-qtest-$(TARGET)-y), $(TARGET),)) |
| 78 | check-qtest-$(CONFIG_POSIX)=$(foreach TARGET,$(TARGETS), $(check-qtest-$(TARGET)-y)) |
| 79 | |
| 80 | qtest-obj-y = tests/libqtest.o $(oslib-obj-y) |
| 81 | $(check-qtest-y): $(qtest-obj-y) |
| 82 | |
Paolo Bonzini | b93b63f | 2012-03-28 15:42:01 +0200 | [diff] [blame] | 83 | .PHONY: check-help |
| 84 | check-help: |
| 85 | @echo "Regression testing targets:" |
| 86 | @echo |
| 87 | @echo " make check Run all tests" |
Anthony Liguori | 49ee359 | 2012-03-28 15:42:05 +0200 | [diff] [blame] | 88 | @echo " make check-qtest-TARGET Run qtest tests for given target" |
| 89 | @echo " make check-qtest Run qtest tests" |
Paolo Bonzini | b93b63f | 2012-03-28 15:42:01 +0200 | [diff] [blame] | 90 | @echo " make check-unit Run qobject tests" |
| 91 | @echo " make check-block Run block tests" |
| 92 | @echo " make check-report.html Generates an HTML test report" |
| 93 | @echo |
| 94 | @echo "Please note that HTML reports do not regenerate if the unit tests" |
| 95 | @echo "has not changed." |
| 96 | @echo |
| 97 | @echo "The variable SPEED can be set to control the gtester speed setting." |
| 98 | @echo "Default options are -k and (for make V=1) --verbose; they can be" |
| 99 | @echo "changed with variable GTESTER_OPTIONS." |
Paolo Bonzini | 2d7799f | 2012-02-09 11:21:03 +0100 | [diff] [blame] | 100 | |
Paolo Bonzini | b93b63f | 2012-03-28 15:42:01 +0200 | [diff] [blame] | 101 | SPEED = quick |
| 102 | GTESTER_OPTIONS = -k $(if $(V),--verbose,-q) |
Anthony Liguori | dbfe06c | 2012-01-10 13:10:43 -0600 | [diff] [blame] | 103 | |
Paolo Bonzini | b93b63f | 2012-03-28 15:42:01 +0200 | [diff] [blame] | 104 | # gtester tests, possibly with verbose output |
Anthony Liguori | dbfe06c | 2012-01-10 13:10:43 -0600 | [diff] [blame] | 105 | |
Anthony Liguori | 49ee359 | 2012-03-28 15:42:05 +0200 | [diff] [blame] | 106 | .PHONY: $(patsubst %, check-qtest-%, $(QTEST_TARGETS)) |
| 107 | $(patsubst %, check-qtest-%, $(QTEST_TARGETS)): check-qtest-%: $(check-qtest-y) |
| 108 | $(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \ |
| 109 | gtester $(GTESTER_OPTIONS) -m=$(SPEED) $(check-qtest-$*-y),"GTESTER $@") |
| 110 | |
Paolo Bonzini | b93b63f | 2012-03-28 15:42:01 +0200 | [diff] [blame] | 111 | .PHONY: $(patsubst %, check-%, $(check-unit-y)) |
| 112 | $(patsubst %, check-%, $(check-unit-y)): check-%: % |
| 113 | $(call quiet-command,gtester $(GTESTER_OPTIONS) -m=$(SPEED) $*,"GTESTER $*") |
Anthony Liguori | dbfe06c | 2012-01-10 13:10:43 -0600 | [diff] [blame] | 114 | |
Paolo Bonzini | b93b63f | 2012-03-28 15:42:01 +0200 | [diff] [blame] | 115 | # gtester tests with XML output |
| 116 | |
Anthony Liguori | 49ee359 | 2012-03-28 15:42:05 +0200 | [diff] [blame] | 117 | $(patsubst %, check-report-qtest-%.xml, $(QTEST_TARGETS)): check-report-qtest-%.xml: $(check-qtest-y) |
| 118 | $(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \ |
| 119 | gtester -q $(GTESTER_OPTIONS) -o $@ -m=$(SPEED) $(check-qtest-$*-y),"GTESTER $@") |
| 120 | |
Paolo Bonzini | b93b63f | 2012-03-28 15:42:01 +0200 | [diff] [blame] | 121 | check-report-unit.xml: $(check-unit-y) |
| 122 | $(call quiet-command,gtester -q $(GTESTER_OPTIONS) -o $@ -m=$(SPEED) $^, "GTESTER $@") |
| 123 | |
| 124 | # Reports and overall runs |
| 125 | |
Anthony Liguori | 49ee359 | 2012-03-28 15:42:05 +0200 | [diff] [blame] | 126 | check-report.xml: $(patsubst %,check-report-qtest-%.xml, $(QTEST_TARGETS)) check-report-unit.xml |
Paolo Bonzini | b93b63f | 2012-03-28 15:42:01 +0200 | [diff] [blame] | 127 | $(call quiet-command,$(SRC_PATH)/scripts/gtester-cat $^ > $@, " GEN $@") |
| 128 | |
| 129 | check-report.html: check-report.xml |
| 130 | $(call quiet-command,gtester-report $< > $@, " GEN $@") |
Kevin Wolf | 8959449 | 2012-03-08 12:29:00 +0100 | [diff] [blame] | 131 | |
Kevin Wolf | b8c6f29 | 2012-03-09 13:37:40 +0100 | [diff] [blame] | 132 | |
Paolo Bonzini | b93b63f | 2012-03-28 15:42:01 +0200 | [diff] [blame] | 133 | # Other tests |
Kevin Wolf | b8c6f29 | 2012-03-09 13:37:40 +0100 | [diff] [blame] | 134 | |
Paolo Bonzini | b93b63f | 2012-03-28 15:42:01 +0200 | [diff] [blame] | 135 | .PHONY: check-tests/qemu-iotests-quick.sh |
| 136 | check-tests/qemu-iotests-quick.sh: tests/qemu-iotests-quick.sh qemu-img$(EXESUF) qemu-io$(EXESUF) |
| 137 | $< |
Kevin Wolf | b8c6f29 | 2012-03-09 13:37:40 +0100 | [diff] [blame] | 138 | |
Paolo Bonzini | b93b63f | 2012-03-28 15:42:01 +0200 | [diff] [blame] | 139 | # Consolidated targets |
| 140 | |
Anthony Liguori | 49ee359 | 2012-03-28 15:42:05 +0200 | [diff] [blame] | 141 | .PHONY: check-qtest check-unit check |
| 142 | check-qtest: $(patsubst %,check-qtest-%, $(QTEST_TARGETS)) |
Paolo Bonzini | b93b63f | 2012-03-28 15:42:01 +0200 | [diff] [blame] | 143 | check-unit: $(patsubst %,check-%, $(check-unit-y)) |
| 144 | check-block: $(patsubst %,check-%, $(check-block-y)) |
Anthony Liguori | 49ee359 | 2012-03-28 15:42:05 +0200 | [diff] [blame] | 145 | check: check-unit check-qtest |