[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 22/39] meson: convert the speed tests
From: |
Paolo Bonzini |
Subject: |
[PATCH 22/39] meson: convert the speed tests |
Date: |
Wed, 2 Sep 2020 08:59:00 -0400 |
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>
---
Makefile | 3 ++-
scripts/mtest2make.py | 9 ++++++++-
tests/Makefile.include | 15 ++++-----------
tests/meson.build | 16 ++++++++++++++++
4 files changed, 30 insertions(+), 13 deletions(-)
diff --git a/Makefile b/Makefile
index ed354c43b0..d4d6a67d96 100644
--- a/Makefile
+++ b/Makefile
@@ -64,7 +64,7 @@ ${ninja-targets-c_COMPILER} ${ninja-targets-cpp_COMPILER}:
.var.command += -MP
# reread (and MESON won't be empty anymore).
ifneq ($(MESON),)
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
endif
@@ -283,6 +283,7 @@ help:
@echo ''
@echo 'Test targets:'
$(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,vm-help,Help about targets running tests inside VM)
@echo ''
diff --git a/scripts/mtest2make.py b/scripts/mtest2make.py
index e5dcb66bf7..afb8835191 100644
--- a/scripts/mtest2make.py
+++ b/scripts/mtest2make.py
@@ -99,12 +99,19 @@ def emit_suite(name, suite, prefix):
print('endif')
testsuites = defaultdict(Suite)
-for test in introspect:
+for test in introspect['tests']:
process_tests(test, testsuites)
emit_prolog(testsuites, 'check')
for name, suite in testsuites.items():
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('.PHONY: $(patsubst %, run-test-%, $(.tests))')
print('$(patsubst %, run-test-%, $(sort $(.tests))): run-test-%: all')
print('\t@$(call .test.run,$*,$(.test.output-format))')
diff --git a/tests/Makefile.include b/tests/Makefile.include
index 0388a0e4fd..fe22ccfcc6 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -38,16 +38,8 @@ export SRC_PATH
SYSEMU_TARGET_LIST := $(subst -softmmu.mak,,$(notdir \
$(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
-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
$(call quiet-command, $(LINKPROG) -static -O3 $(PTHREAD_LIB) -o $@ $<
,"LINK","$(TARGET_DIR)$@")
@@ -97,9 +89,6 @@ define do_test_tap
"TAP","$@")
endef
-check-speed: $(check-speed-y)
- $(call do_test_human, $^)
-
# Per guest TCG tests
BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(TARGET_DIRS))
@@ -212,6 +201,10 @@ check-clean:
clean: check-clean
+# For backwards compatibility
+
+check-speed: bench-speed
+
# Build the help program automatically
-include $(wildcard tests/*.d)
diff --git a/tests/meson.build b/tests/meson.build
index 2c87e16fad..71d0776a79 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -107,6 +107,8 @@ tests = {
'test-qapi-util': [],
}
+benchs = {}
+
if have_block
tests += {
'test-coroutine': [testblock],
@@ -164,6 +166,11 @@ if have_block
if 'CONFIG_NETTLE' in config_host or 'CONFIG_GCRYPT' in config_host
tests += {'test-crypto-pbkdf': [io]}
endif
+ benchs += {
+ 'benchmark-crypto-hash': {'deps': [crypto]},
+ 'benchmark-crypto-hmac': {'deps': [crypto]},
+ 'benchmark-crypto-cipher': {'deps': [crypto]},
+ }
endif
if have_system
@@ -231,6 +238,15 @@ foreach test_name, extra: tests
suite: ['unit'])
endforeach
+foreach bench_name, extra_args: benchs
+ src = extra_args.get('src', [bench_name + '.c'])
+ exe = executable(bench_name, src,
+ dependencies: [qemuutil] + extra_args.get('deps', []))
+ benchmark(bench_name, exe,
+ args: ['--tap', '-k'],
+ protocol: 'tap',
+ suite: ['speed'])
+endforeach
if have_tools and 'CONFIG_VHOST_USER' in config_host
executable('vhost-user-bridge',
--
2.26.2
- [PATCH 19/39] meson: convert vhost-user-bridge, (continued)
- [PATCH 19/39] meson: convert vhost-user-bridge, Paolo Bonzini, 2020/09/02
- [PATCH 20/39] meson: convert atomic*-bench, Paolo Bonzini, 2020/09/02
- [PATCH 13/39] meson: declare keyutils dependency, Paolo Bonzini, 2020/09/02
- [PATCH 09/39] ninjatool: use constant names for stamp files, Paolo Bonzini, 2020/09/02
- [PATCH 18/39] meson: remove old socket_scm_helper rule, Paolo Bonzini, 2020/09/02
- [PATCH 17/39] meson: move keyutils dependency check, Paolo Bonzini, 2020/09/02
- [PATCH 04/39] mtest2make: hide output of successful tests, Paolo Bonzini, 2020/09/02
- [PATCH 29/39] Makefile: inline the relevant parts of rules.mak, Paolo Bonzini, 2020/09/02
- [PATCH 26/39] configure: remove dead code for in-tree builds, Paolo Bonzini, 2020/09/02
- [PATCH 31/39] configure: move C++ compiler handling to meson, Paolo Bonzini, 2020/09/02
- [PATCH 22/39] meson: convert the speed tests,
Paolo Bonzini <=
- [PATCH 25/39] meson: convert migration/initrd-stress, Paolo Bonzini, 2020/09/02
- [PATCH 32/39] meson: keep all compiler flags detection together, Paolo Bonzini, 2020/09/02
- [PATCH 34/39] configure: remove unnecessary libm test, Paolo Bonzini, 2020/09/02
- [PATCH 39/39] docs: suggest Meson replacements for various configure functions, Paolo Bonzini, 2020/09/02
- [PATCH 36/39] meson: get glib compilation flags from GLIB_CFLAGS, Paolo Bonzini, 2020/09/02
- [PATCH 16/39] meson: convert the unit tests, Paolo Bonzini, 2020/09/02
- [PATCH 37/39] configure: do not include dependency flags in QEMU_CFLAGS and LIBS, Paolo Bonzini, 2020/09/02
- [PATCH 30/39] configure: move disassembler configuration to meson, Paolo Bonzini, 2020/09/02
- [PATCH 27/39] meson: compute config_all_devices directly, Paolo Bonzini, 2020/09/02
- [PATCH 28/39] Makefile: remove dead variables and includes, Paolo Bonzini, 2020/09/02