meson: convert the speed tests
Use meson benchmark() for them, adjust mtest2make.py for that. A new target "make bench" can be used to run all benchmarks. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20200828110734.1638685-14-marcandre.lureau@redhat.com> [Rewrite mtest2make part. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
24441f912e
commit
9ed7247a59
3
Makefile
3
Makefile
@ -64,7 +64,7 @@ ${ninja-targets-c_COMPILER} ${ninja-targets-cpp_COMPILER}: .var.command += -MP
|
|||||||
# reread (and MESON won't be empty anymore).
|
# reread (and MESON won't be empty anymore).
|
||||||
ifneq ($(MESON),)
|
ifneq ($(MESON),)
|
||||||
Makefile.mtest: build.ninja scripts/mtest2make.py
|
Makefile.mtest: build.ninja scripts/mtest2make.py
|
||||||
$(MESON) introspect --tests | $(PYTHON) scripts/mtest2make.py > $@
|
$(MESON) introspect --tests --benchmarks | $(PYTHON) scripts/mtest2make.py > $@
|
||||||
-include Makefile.mtest
|
-include Makefile.mtest
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -283,6 +283,7 @@ help:
|
|||||||
@echo ''
|
@echo ''
|
||||||
@echo 'Test targets:'
|
@echo 'Test targets:'
|
||||||
$(call print-help,check,Run all tests (check-help for details))
|
$(call print-help,check,Run all tests (check-help for details))
|
||||||
|
$(call print-help,bench,Run all benchmarks)
|
||||||
$(call print-help,docker,Help about targets running tests inside containers)
|
$(call print-help,docker,Help about targets running tests inside containers)
|
||||||
$(call print-help,vm-help,Help about targets running tests inside VM)
|
$(call print-help,vm-help,Help about targets running tests inside VM)
|
||||||
@echo ''
|
@echo ''
|
||||||
|
@ -103,10 +103,17 @@ def emit_suite(name, suite, prefix):
|
|||||||
print('endif')
|
print('endif')
|
||||||
|
|
||||||
testsuites = defaultdict(Suite)
|
testsuites = defaultdict(Suite)
|
||||||
for test in introspect:
|
for test in introspect['tests']:
|
||||||
process_tests(test, testsuites)
|
process_tests(test, testsuites)
|
||||||
emit_prolog(testsuites, 'check')
|
emit_prolog(testsuites, 'check')
|
||||||
for name, suite in testsuites.items():
|
for name, suite in testsuites.items():
|
||||||
emit_suite(name, suite, 'check')
|
emit_suite(name, suite, 'check')
|
||||||
|
|
||||||
|
benchsuites = defaultdict(Suite)
|
||||||
|
for test in introspect['benchmarks']:
|
||||||
|
process_tests(test, benchsuites)
|
||||||
|
emit_prolog(benchsuites, 'bench')
|
||||||
|
for name, suite in benchsuites.items():
|
||||||
|
emit_suite(name, suite, 'bench')
|
||||||
|
|
||||||
print('run-tests: $(patsubst %, run-test-%, $(.tests))')
|
print('run-tests: $(patsubst %, run-test-%, $(.tests))')
|
||||||
|
@ -38,16 +38,8 @@ export SRC_PATH
|
|||||||
SYSEMU_TARGET_LIST := $(subst -softmmu.mak,,$(notdir \
|
SYSEMU_TARGET_LIST := $(subst -softmmu.mak,,$(notdir \
|
||||||
$(wildcard $(SRC_PATH)/default-configs/*-softmmu.mak)))
|
$(wildcard $(SRC_PATH)/default-configs/*-softmmu.mak)))
|
||||||
|
|
||||||
check-speed-$(CONFIG_BLOCK) += tests/benchmark-crypto-hash$(EXESUF)
|
|
||||||
check-speed-$(CONFIG_BLOCK) += tests/benchmark-crypto-hmac$(EXESUF)
|
|
||||||
check-speed-$(CONFIG_BLOCK) += tests/benchmark-crypto-cipher$(EXESUF)
|
|
||||||
|
|
||||||
QEMU_CFLAGS += -I$(SRC_PATH)/tests -I$(SRC_PATH)/tests/qtest
|
QEMU_CFLAGS += -I$(SRC_PATH)/tests -I$(SRC_PATH)/tests/qtest
|
||||||
|
|
||||||
tests/benchmark-crypto-hash$(EXESUF): tests/benchmark-crypto-hash.o $(test-crypto-obj-y)
|
|
||||||
tests/benchmark-crypto-hmac$(EXESUF): tests/benchmark-crypto-hmac.o $(test-crypto-obj-y)
|
|
||||||
tests/benchmark-crypto-cipher$(EXESUF): tests/benchmark-crypto-cipher.o $(test-crypto-obj-y)
|
|
||||||
|
|
||||||
tests/migration/stress$(EXESUF): tests/migration/stress.o
|
tests/migration/stress$(EXESUF): tests/migration/stress.o
|
||||||
$(call quiet-command, $(LINKPROG) -static -O3 $(PTHREAD_LIB) -o $@ $< ,"LINK","$(TARGET_DIR)$@")
|
$(call quiet-command, $(LINKPROG) -static -O3 $(PTHREAD_LIB) -o $@ $< ,"LINK","$(TARGET_DIR)$@")
|
||||||
|
|
||||||
@ -97,9 +89,6 @@ define do_test_tap
|
|||||||
"TAP","$@")
|
"TAP","$@")
|
||||||
endef
|
endef
|
||||||
|
|
||||||
check-speed: $(check-speed-y)
|
|
||||||
$(call do_test_human, $^)
|
|
||||||
|
|
||||||
# Per guest TCG tests
|
# Per guest TCG tests
|
||||||
|
|
||||||
BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(TARGET_DIRS))
|
BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(TARGET_DIRS))
|
||||||
@ -212,6 +201,10 @@ check-clean:
|
|||||||
|
|
||||||
clean: check-clean
|
clean: check-clean
|
||||||
|
|
||||||
|
# For backwards compatibility
|
||||||
|
|
||||||
|
check-speed: bench-speed
|
||||||
|
|
||||||
# Build the help program automatically
|
# Build the help program automatically
|
||||||
|
|
||||||
-include $(wildcard tests/*.d)
|
-include $(wildcard tests/*.d)
|
||||||
|
@ -111,6 +111,8 @@ test_deps = {
|
|||||||
'test-qht-par': qht_bench,
|
'test-qht-par': qht_bench,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
benchs = {}
|
||||||
|
|
||||||
if have_block
|
if have_block
|
||||||
tests += {
|
tests += {
|
||||||
'test-coroutine': [testblock],
|
'test-coroutine': [testblock],
|
||||||
@ -167,6 +169,11 @@ if have_block
|
|||||||
if 'CONFIG_NETTLE' in config_host or 'CONFIG_GCRYPT' in config_host
|
if 'CONFIG_NETTLE' in config_host or 'CONFIG_GCRYPT' in config_host
|
||||||
tests += {'test-crypto-pbkdf': [io]}
|
tests += {'test-crypto-pbkdf': [io]}
|
||||||
endif
|
endif
|
||||||
|
benchs += {
|
||||||
|
'benchmark-crypto-hash': [crypto],
|
||||||
|
'benchmark-crypto-hmac': [crypto],
|
||||||
|
'benchmark-crypto-cipher': [crypto],
|
||||||
|
}
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if have_system
|
if have_system
|
||||||
@ -226,6 +233,14 @@ foreach test_name, extra: tests
|
|||||||
suite: ['unit'])
|
suite: ['unit'])
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
|
foreach bench_name, deps: benchs
|
||||||
|
exe = executable(bench_name, bench_name + '.c',
|
||||||
|
dependencies: [qemuutil] + deps)
|
||||||
|
benchmark(bench_name, exe,
|
||||||
|
args: ['--tap', '-k'],
|
||||||
|
protocol: 'tap',
|
||||||
|
suite: ['speed'])
|
||||||
|
endforeach
|
||||||
|
|
||||||
if have_tools and 'CONFIG_VHOST_USER' in config_host
|
if have_tools and 'CONFIG_VHOST_USER' in config_host
|
||||||
executable('vhost-user-bridge',
|
executable('vhost-user-bridge',
|
||||||
|
Loading…
Reference in New Issue
Block a user