2012-03-08 12:29:00 +01:00
|
|
|
export SRC_PATH
|
|
|
|
|
2012-03-28 15:42:01 +02:00
|
|
|
check-unit-y = tests/check-qdict$(EXESUF)
|
|
|
|
check-unit-y += tests/check-qfloat$(EXESUF)
|
|
|
|
check-unit-y += tests/check-qint$(EXESUF)
|
|
|
|
check-unit-y += tests/check-qstring$(EXESUF)
|
|
|
|
check-unit-y += tests/check-qlist$(EXESUF)
|
|
|
|
check-unit-y += tests/check-qjson$(EXESUF)
|
|
|
|
check-unit-y += tests/test-qmp-output-visitor$(EXESUF)
|
|
|
|
check-unit-y += tests/test-qmp-input-visitor$(EXESUF)
|
|
|
|
check-unit-y += tests/test-qmp-input-strict$(EXESUF)
|
|
|
|
check-unit-y += tests/test-qmp-commands$(EXESUF)
|
|
|
|
check-unit-y += tests/test-string-input-visitor$(EXESUF)
|
|
|
|
check-unit-y += tests/test-string-output-visitor$(EXESUF)
|
|
|
|
check-unit-y += tests/test-coroutine$(EXESUF)
|
2012-02-22 04:05:07 +01:00
|
|
|
check-unit-y += tests/test-visitor-serialization$(EXESUF)
|
rewrite iov_* functions
This changes implementations of all iov_*
functions, completing the previous step.
All iov_* functions now ensure that this offset
argument is within the iovec (using assertion),
but lets to specify `bytes' value larger than
actual length of the iovec - in this case they
stops at the actual end of iovec. It is also
suggested to use convinient `-1' value as `bytes'
to mean just this -- "up to the end".
There's one very minor semantic change here: new
requiriment is that `offset' points to inside of
iovec. This is checked just at the end of functions
(assert()), it does not actually need to be enforced,
but using any of these functions with offset pointing
past the end of iovec is wrong anyway.
Note: the new code in iov.c uses arithmetic with
void pointers. I thought this is not supported
everywhere and is a GCC extension (indeed, the C
standard does not define void arithmetic). However,
the original code already use void arith in
iov_from_buf() function:
(memcpy(..., buf + buf_off,...)
which apparently works well so far (it is this
way in qemu 1.0). So I left it this way and used
it in other places.
While at it, add a unit-test file test-iov.c,
to check various corner cases with iov_from_buf(),
iov_to_buf() and iov_memset().
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2012-06-07 18:08:19 +02:00
|
|
|
check-unit-y += tests/test-iov$(EXESUF)
|
2012-03-28 15:42:01 +02:00
|
|
|
|
|
|
|
check-block-$(CONFIG_POSIX) += tests/qemu-iotests-quick.sh
|
|
|
|
|
2012-03-28 15:42:07 +02:00
|
|
|
# All QTests for now are POSIX-only, but the dependencies are
|
|
|
|
# really in libqtest, not in the testcases themselves.
|
2012-05-10 09:46:18 +02:00
|
|
|
check-qtest-i386-y = tests/fdc-test$(EXESUF)
|
2012-07-10 11:12:30 +02:00
|
|
|
check-qtest-i386-y += tests/hd-geo-test$(EXESUF)
|
2012-05-15 18:19:45 +02:00
|
|
|
check-qtest-i386-y += tests/rtc-test$(EXESUF)
|
2012-03-28 15:42:07 +02:00
|
|
|
check-qtest-x86_64-y = $(check-qtest-i386-y)
|
2012-04-15 13:45:18 +02:00
|
|
|
check-qtest-sparc-y = tests/m48t59-test$(EXESUF)
|
|
|
|
check-qtest-sparc64-y = tests/m48t59-test$(EXESUF)
|
2012-03-28 15:42:07 +02:00
|
|
|
|
2012-03-28 15:42:01 +02:00
|
|
|
GENERATED_HEADERS += tests/test-qapi-types.h tests/test-qapi-visit.h tests/test-qmp-commands.h
|
|
|
|
|
|
|
|
test-obj-y = tests/check-qint.o tests/check-qstring.o tests/check-qdict.o \
|
|
|
|
tests/check-qlist.o tests/check-qfloat.o tests/check-qjson.o \
|
|
|
|
tests/test-coroutine.o tests/test-string-output-visitor.o \
|
|
|
|
tests/test-string-input-visitor.o tests/test-qmp-output-visitor.o \
|
|
|
|
tests/test-qmp-input-visitor.o tests/test-qmp-input-strict.o \
|
2012-02-22 04:05:07 +01:00
|
|
|
tests/test-qmp-commands.o tests/test-visitor-serialization.o
|
2012-03-28 15:42:01 +02:00
|
|
|
|
|
|
|
test-qapi-obj-y = $(qobject-obj-y) $(qapi-obj-y) $(tools-obj-y)
|
|
|
|
test-qapi-obj-y += tests/test-qapi-visit.o tests/test-qapi-types.o
|
|
|
|
test-qapi-obj-y += module.o
|
|
|
|
|
|
|
|
$(test-obj-y): QEMU_INCLUDES += -Itests
|
|
|
|
|
2012-10-23 22:36:08 +02:00
|
|
|
tests/check-qint$(EXESUF): tests/check-qint.o qint.o
|
|
|
|
tests/check-qstring$(EXESUF): tests/check-qstring.o qstring.o
|
|
|
|
tests/check-qdict$(EXESUF): tests/check-qdict.o qdict.o qfloat.o qint.o qstring.o qbool.o qlist.o
|
|
|
|
tests/check-qlist$(EXESUF): tests/check-qlist.o qlist.o qint.o
|
|
|
|
tests/check-qfloat$(EXESUF): tests/check-qfloat.o qfloat.o
|
2012-03-28 15:42:01 +02:00
|
|
|
tests/check-qjson$(EXESUF): tests/check-qjson.o $(qobject-obj-y) $(tools-obj-y)
|
2012-10-24 14:58:39 +02:00
|
|
|
tests/test-coroutine$(EXESUF): tests/test-coroutine.o $(coroutine-obj-y) $(tools-obj-y) iov.o
|
rewrite iov_* functions
This changes implementations of all iov_*
functions, completing the previous step.
All iov_* functions now ensure that this offset
argument is within the iovec (using assertion),
but lets to specify `bytes' value larger than
actual length of the iovec - in this case they
stops at the actual end of iovec. It is also
suggested to use convinient `-1' value as `bytes'
to mean just this -- "up to the end".
There's one very minor semantic change here: new
requiriment is that `offset' points to inside of
iovec. This is checked just at the end of functions
(assert()), it does not actually need to be enforced,
but using any of these functions with offset pointing
past the end of iovec is wrong anyway.
Note: the new code in iov.c uses arithmetic with
void pointers. I thought this is not supported
everywhere and is a GCC extension (indeed, the C
standard does not define void arithmetic). However,
the original code already use void arith in
iov_from_buf() function:
(memcpy(..., buf + buf_off,...)
which apparently works well so far (it is this
way in qemu 1.0). So I left it this way and used
it in other places.
While at it, add a unit-test file test-iov.c,
to check various corner cases with iov_from_buf(),
iov_to_buf() and iov_memset().
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2012-06-07 18:08:19 +02:00
|
|
|
tests/test-iov$(EXESUF): tests/test-iov.o iov.o
|
2012-03-28 15:42:01 +02:00
|
|
|
|
|
|
|
tests/test-qapi-types.c tests/test-qapi-types.h :\
|
2012-01-10 20:10:43 +01:00
|
|
|
$(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-types.py
|
2012-03-28 15:42:01 +02:00
|
|
|
$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py $(gen-out-type) -o tests -p "test-" < $<, " GEN $@")
|
|
|
|
tests/test-qapi-visit.c tests/test-qapi-visit.h :\
|
2012-01-10 20:10:43 +01:00
|
|
|
$(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-visit.py
|
2012-03-28 15:42:01 +02:00
|
|
|
$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py $(gen-out-type) -o tests -p "test-" < $<, " GEN $@")
|
|
|
|
tests/test-qmp-commands.h tests/test-qmp-marshal.c :\
|
2012-01-10 20:10:43 +01:00
|
|
|
$(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-commands.py
|
2012-03-28 15:42:01 +02:00
|
|
|
$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py $(gen-out-type) -o tests -p "test-" < $<, " GEN $@")
|
2012-01-10 20:10:43 +01:00
|
|
|
|
|
|
|
|
2012-03-28 15:42:01 +02:00
|
|
|
tests/test-string-output-visitor$(EXESUF): tests/test-string-output-visitor.o $(test-qapi-obj-y)
|
|
|
|
tests/test-string-input-visitor$(EXESUF): tests/test-string-input-visitor.o $(test-qapi-obj-y)
|
|
|
|
tests/test-qmp-output-visitor$(EXESUF): tests/test-qmp-output-visitor.o $(test-qapi-obj-y)
|
|
|
|
tests/test-qmp-input-visitor$(EXESUF): tests/test-qmp-input-visitor.o $(test-qapi-obj-y)
|
|
|
|
tests/test-qmp-input-strict$(EXESUF): tests/test-qmp-input-strict.o $(test-qapi-obj-y)
|
|
|
|
tests/test-qmp-commands$(EXESUF): tests/test-qmp-commands.o tests/test-qmp-marshal.o $(test-qapi-obj-y)
|
2012-02-22 04:05:07 +01:00
|
|
|
tests/test-visitor-serialization$(EXESUF): tests/test-visitor-serialization.o $(test-qapi-obj-y)
|
2012-02-09 11:21:03 +01:00
|
|
|
|
2012-03-30 19:39:33 +02:00
|
|
|
tests/rtc-test$(EXESUF): tests/rtc-test.o $(trace-obj-y)
|
2012-04-15 13:45:18 +02:00
|
|
|
tests/m48t59-test$(EXESUF): tests/m48t59-test.o $(trace-obj-y)
|
2012-05-15 07:27:19 +02:00
|
|
|
tests/fdc-test$(EXESUF): tests/fdc-test.o tests/libqtest.o $(trace-obj-y)
|
2012-07-10 11:12:30 +02:00
|
|
|
tests/hd-geo-test$(EXESUF): tests/hd-geo-test.o tests/libqtest.o $(trace-obj-y)
|
2012-03-30 19:39:33 +02:00
|
|
|
|
2012-03-28 15:42:05 +02:00
|
|
|
# QTest rules
|
|
|
|
|
|
|
|
TARGETS=$(patsubst %-softmmu,%, $(filter %-softmmu,$(TARGET_DIRS)))
|
|
|
|
QTEST_TARGETS=$(foreach TARGET,$(TARGETS), $(if $(check-qtest-$(TARGET)-y), $(TARGET),))
|
|
|
|
check-qtest-$(CONFIG_POSIX)=$(foreach TARGET,$(TARGETS), $(check-qtest-$(TARGET)-y))
|
|
|
|
|
2012-08-14 22:43:47 +02:00
|
|
|
qtest-obj-y = tests/libqtest.o $(oslib-obj-y) $(tools-obj-y)
|
2012-03-28 15:42:05 +02:00
|
|
|
$(check-qtest-y): $(qtest-obj-y)
|
|
|
|
|
2012-03-28 15:42:01 +02:00
|
|
|
.PHONY: check-help
|
|
|
|
check-help:
|
|
|
|
@echo "Regression testing targets:"
|
|
|
|
@echo
|
|
|
|
@echo " make check Run all tests"
|
2012-03-28 15:42:05 +02:00
|
|
|
@echo " make check-qtest-TARGET Run qtest tests for given target"
|
|
|
|
@echo " make check-qtest Run qtest tests"
|
2012-03-28 15:42:01 +02:00
|
|
|
@echo " make check-unit Run qobject tests"
|
|
|
|
@echo " make check-block Run block tests"
|
|
|
|
@echo " make check-report.html Generates an HTML test report"
|
|
|
|
@echo
|
|
|
|
@echo "Please note that HTML reports do not regenerate if the unit tests"
|
|
|
|
@echo "has not changed."
|
|
|
|
@echo
|
|
|
|
@echo "The variable SPEED can be set to control the gtester speed setting."
|
|
|
|
@echo "Default options are -k and (for make V=1) --verbose; they can be"
|
|
|
|
@echo "changed with variable GTESTER_OPTIONS."
|
2012-02-09 11:21:03 +01:00
|
|
|
|
2012-03-28 15:42:01 +02:00
|
|
|
SPEED = quick
|
|
|
|
GTESTER_OPTIONS = -k $(if $(V),--verbose,-q)
|
2012-01-10 20:10:43 +01:00
|
|
|
|
2012-03-28 15:42:01 +02:00
|
|
|
# gtester tests, possibly with verbose output
|
2012-01-10 20:10:43 +01:00
|
|
|
|
2012-03-28 15:42:05 +02:00
|
|
|
.PHONY: $(patsubst %, check-qtest-%, $(QTEST_TARGETS))
|
|
|
|
$(patsubst %, check-qtest-%, $(QTEST_TARGETS)): check-qtest-%: $(check-qtest-y)
|
|
|
|
$(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
|
|
|
|
gtester $(GTESTER_OPTIONS) -m=$(SPEED) $(check-qtest-$*-y),"GTESTER $@")
|
|
|
|
|
2012-03-28 15:42:01 +02:00
|
|
|
.PHONY: $(patsubst %, check-%, $(check-unit-y))
|
|
|
|
$(patsubst %, check-%, $(check-unit-y)): check-%: %
|
|
|
|
$(call quiet-command,gtester $(GTESTER_OPTIONS) -m=$(SPEED) $*,"GTESTER $*")
|
2012-01-10 20:10:43 +01:00
|
|
|
|
2012-03-28 15:42:01 +02:00
|
|
|
# gtester tests with XML output
|
2012-03-08 12:29:00 +01:00
|
|
|
|
2012-03-28 15:42:05 +02:00
|
|
|
$(patsubst %, check-report-qtest-%.xml, $(QTEST_TARGETS)): check-report-qtest-%.xml: $(check-qtest-y)
|
|
|
|
$(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
|
|
|
|
gtester -q $(GTESTER_OPTIONS) -o $@ -m=$(SPEED) $(check-qtest-$*-y),"GTESTER $@")
|
|
|
|
|
2012-03-28 15:42:01 +02:00
|
|
|
check-report-unit.xml: $(check-unit-y)
|
|
|
|
$(call quiet-command,gtester -q $(GTESTER_OPTIONS) -o $@ -m=$(SPEED) $^, "GTESTER $@")
|
2012-03-09 13:37:40 +01:00
|
|
|
|
2012-03-28 15:42:01 +02:00
|
|
|
# Reports and overall runs
|
2012-03-09 13:37:40 +01:00
|
|
|
|
2012-03-28 15:42:05 +02:00
|
|
|
check-report.xml: $(patsubst %,check-report-qtest-%.xml, $(QTEST_TARGETS)) check-report-unit.xml
|
2012-03-28 15:42:01 +02:00
|
|
|
$(call quiet-command,$(SRC_PATH)/scripts/gtester-cat $^ > $@, " GEN $@")
|
2012-03-09 13:37:40 +01:00
|
|
|
|
2012-03-28 15:42:01 +02:00
|
|
|
check-report.html: check-report.xml
|
|
|
|
$(call quiet-command,gtester-report $< > $@, " GEN $@")
|
|
|
|
|
|
|
|
|
|
|
|
# Other tests
|
|
|
|
|
|
|
|
.PHONY: check-tests/qemu-iotests-quick.sh
|
|
|
|
check-tests/qemu-iotests-quick.sh: tests/qemu-iotests-quick.sh qemu-img$(EXESUF) qemu-io$(EXESUF)
|
|
|
|
$<
|
|
|
|
|
|
|
|
# Consolidated targets
|
|
|
|
|
2012-03-28 15:42:05 +02:00
|
|
|
.PHONY: check-qtest check-unit check
|
|
|
|
check-qtest: $(patsubst %,check-qtest-%, $(QTEST_TARGETS))
|
2012-03-28 15:42:01 +02:00
|
|
|
check-unit: $(patsubst %,check-%, $(check-unit-y))
|
|
|
|
check-block: $(patsubst %,check-%, $(check-block-y))
|
2012-03-28 15:42:05 +02:00
|
|
|
check: check-unit check-qtest
|
2012-07-18 19:22:27 +02:00
|
|
|
|
|
|
|
-include $(wildcard tests/*.d)
|